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AE,KAAK;YACvD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;gBACrC,MAAM,IAAI,KAAK,CAAC,2FAA2F,CAAC,CAAC;YAC/G,CAAC;YACD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACzE,CAAC;QACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjC,yBAAyB,EAAE,IAAI,CAAC,yBAAyB,EAAE;QAC3D,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;KACtD,CAAC;AACJ,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as chalk from 'chalk';\nimport * as log4js from 'log4js';\nimport * as ts from 'typescript';\n\nimport { Assembler } from './assembler';\nimport { findDependencyDirectory } from './common/find-utils';\nimport { emitDownleveledDeclarations, TYPES_COMPAT } from './downlevel-dts';\nimport { Emitter } from './emitter';\nimport { JsiiDiagnostic } from './jsii-diagnostic';\nimport { ProjectInfo } from './project-info';\nimport { WARNINGSCODE_FILE_NAME } from './transforms/deprecation-warnings';\nimport { TypeScriptConfig, TypeScriptConfigValidationRuleSet } from './tsconfig';\nimport { BASE_COMPILER_OPTIONS, convertForJson } from './tsconfig/compiler-options';\nimport { TypeScriptConfigValidator } from './tsconfig/tsconfig-validator';\nimport { ValidationError } from './tsconfig/validator';\nimport * as utils from './utils';\n\nconst LOG = log4js.getLogger('jsii/compiler');\nexport const DIAGNOSTICS = 'diagnostics';\nexport const JSII_DIAGNOSTICS_CODE = 9999;\n\nexport interface CompilerOptions {\n /** The information about the project to be built */\n projectInfo: ProjectInfo;\n /** Whether the compiler should watch for changes or just compile once */\n watch?: boolean;\n /** Whether to detect and generate TypeScript project references */\n projectReferences?: boolean;\n /** Whether to fail when a warning is emitted */\n failOnWarnings?: boolean;\n /** Whether to strip deprecated members from emitted artifacts */\n stripDeprecated?: boolean;\n /** The path to an allowlist of FQNs to strip if stripDeprecated is set */\n stripDeprecatedAllowListFile?: string;\n /** Whether to add warnings for deprecated elements */\n addDeprecationWarnings?: boolean;\n /**\n * The name of the tsconfig file to generate.\n * Cannot be used at the same time as `typeScriptConfig`.\n * @default \"tsconfig.json\"\n */\n generateTypeScriptConfig?: string;\n /**\n * The name of the tsconfig file to use.\n * Cannot be used at the same time as `generateTypeScriptConfig`.\n * @default - generate the tsconfig file\n */\n typeScriptConfig?: string;\n /**\n * The ruleset to validate the provided tsconfig file against.\n * Can only be used when `typeScriptConfig` is provided.\n * @default TypeScriptConfigValidationRuleSet.STRICT - if `typeScriptConfig` is provided\n */\n validateTypeScriptConfig?: TypeScriptConfigValidationRuleSet;\n /**\n * Whether to compress the assembly\n * @default false\n */\n compressAssembly?: boolean;\n}\n\nexport class Compiler implements Emitter {\n private readonly system: ts.System;\n private readonly compilerHost: ts.CompilerHost;\n private readonly userProvidedTypeScriptConfig: boolean;\n private readonly tsconfig: TypeScriptConfig;\n private rootFiles: string[] = [];\n private readonly configPath: string;\n private readonly projectRoot: string;\n\n public constructor(private readonly options: CompilerOptions) {\n if (options.generateTypeScriptConfig != null && options.typeScriptConfig != null) {\n throw new Error(\n 'Cannot use `generateTypeScriptConfig` and `typeScriptConfig` together. Provide only one of them.',\n );\n }\n\n this.projectRoot = this.options.projectInfo.projectRoot;\n const configFileName = options.typeScriptConfig ?? options.generateTypeScriptConfig ?? 'tsconfig.json';\n this.configPath = path.join(this.projectRoot, configFileName);\n this.userProvidedTypeScriptConfig = Boolean(options.typeScriptConfig);\n\n this.system = {\n ...ts.sys,\n getCurrentDirectory: () => this.projectRoot,\n createDirectory: (pth) => ts.sys.createDirectory(path.resolve(this.projectRoot, pth)),\n deleteFile: ts.sys.deleteFile && ((pth) => ts.sys.deleteFile!(path.join(this.projectRoot, pth))),\n fileExists: (pth) => ts.sys.fileExists(path.resolve(this.projectRoot, pth)),\n getFileSize: ts.sys.getFileSize && ((pth) => ts.sys.getFileSize!(path.resolve(this.projectRoot, pth))),\n readFile: (pth, encoding) => ts.sys.readFile(path.resolve(this.projectRoot, pth), encoding),\n watchFile:\n ts.sys.watchFile &&\n ((pth, callback, pollingInterval, watchOptions) =>\n ts.sys.watchFile!(path.resolve(this.projectRoot, pth), callback, pollingInterval, watchOptions)),\n writeFile: (pth, data, writeByteOrderMark) =>\n ts.sys.writeFile(path.resolve(this.projectRoot, pth), data, writeByteOrderMark),\n };\n\n this.tsconfig = this.configureTypeScript();\n this.compilerHost = ts.createIncrementalCompilerHost(this.tsconfig.compilerOptions, this.system);\n }\n\n /**\n * Compiles the configured program.\n *\n * @param files can be specified to override the standard source code location logic. Useful for example when testing \"negatives\".\n */\n public emit(...files: string[]): ts.EmitResult {\n this.prepareForBuild(...files);\n return this.buildOnce();\n }\n\n /**\n * Watches for file-system changes and dynamically recompiles the project as needed. In non-blocking mode, this\n * returns the TypeScript watch handle for the application to use.\n *\n * @internal\n */\n public async watch(opts: NonBlockingWatchOptions): Promise<ts.Watch<ts.BuilderProgram>>;\n /**\n * Watches for file-system changes and dynamically recompiles the project as needed. In blocking mode, this results\n * in a never-resolving promise.\n */\n public async watch(): Promise<never>;\n public async watch(opts?: NonBlockingWatchOptions): Promise<ts.Watch<ts.BuilderProgram> | never> {\n this.prepareForBuild();\n\n const host = ts.createWatchCompilerHost(\n this.configPath,\n {\n ...this.tsconfig.compilerOptions,\n noEmitOnError: false,\n },\n this.system,\n ts.createEmitAndSemanticDiagnosticsBuilderProgram,\n opts?.reportDiagnostics,\n opts?.reportWatchStatus,\n this.tsconfig.watchOptions,\n );\n if (!host.getDefaultLibLocation) {\n throw new Error('No default library location was found on the TypeScript compiler host!');\n }\n const orig = host.afterProgramCreate;\n // This is a callback cascade, so it's \"okay\" to return an unhandled promise there. This may\n // cause an unhandled promise rejection warning, but that's not a big deal.\n //\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n host.afterProgramCreate = (builderProgram) => {\n const emitResult = this.consumeProgram(builderProgram.getProgram(), host.getDefaultLibLocation!());\n\n for (const diag of emitResult.diagnostics.filter((d) => d.code === JSII_DIAGNOSTICS_CODE)) {\n utils.logDiagnostic(diag, this.projectRoot);\n }\n\n if (orig) {\n orig.call(host, builderProgram);\n }\n if (opts?.compilationComplete) {\n opts.compilationComplete(emitResult);\n }\n };\n const watch = ts.createWatchProgram(host);\n\n if (opts?.nonBlocking) {\n // In non-blocking mode, returns the handle to the TypeScript watch interface.\n return watch;\n }\n // In blocking mode, returns a never-resolving promise.\n return new Promise<never>(() => null);\n }\n\n /**\n * Prepares the project for build, by creating the necessary configuration\n * file(s), and assigning the relevant root file(s).\n *\n * @param files the files that were specified as input in the CLI invocation.\n */\n private configureTypeScript(): TypeScriptConfig {\n if (this.userProvidedTypeScriptConfig) {\n const config = this.readTypeScriptConfig();\n\n // emit a warning if validation is disabled\n const rules = this.options.validateTypeScriptConfig ?? TypeScriptConfigValidationRuleSet.NONE;\n if (rules === TypeScriptConfigValidationRuleSet.NONE) {\n utils.logDiagnostic(\n JsiiDiagnostic.JSII_4009_DISABLED_TSCONFIG_VALIDATION.create(undefined, this.configPath),\n this.projectRoot,\n );\n }\n\n // validate the user provided config\n if (rules !== TypeScriptConfigValidationRuleSet.NONE) {\n const configName = path.relative(this.projectRoot, this.configPath);\n try {\n const validator = new TypeScriptConfigValidator(rules);\n validator.validate({\n ...config,\n // convert the internal format to the user format which is what the validator operates on\n compilerOptions: convertForJson(config.compilerOptions),\n });\n } catch (error: unknown) {\n if (error instanceof ValidationError) {\n utils.logDiagnostic(\n JsiiDiagnostic.JSII_4000_FAILED_TSCONFIG_VALIDATION.create(\n undefined,\n configName,\n rules,\n error.violations,\n ),\n this.projectRoot,\n );\n }\n\n throw new Error(\n `Failed validation of tsconfig \"compilerOptions\" in \"${configName}\" against rule set \"${rules}\"!`,\n );\n }\n }\n\n return config;\n }\n\n // generated config if none is provided by the user\n return this.buildTypeScriptConfig();\n }\n\n /**\n * Final preparations of the project for build.\n *\n * These are preparations that either\n * - must happen immediately before the build, or\n * - can be different for every build like assigning the relevant root file(s).\n *\n * @param files the files that were specified as input in the CLI invocation.\n */\n private prepareForBuild(...files: string[]) {\n if (!this.userProvidedTypeScriptConfig) {\n this.writeTypeScriptConfig();\n }\n\n this.rootFiles = this.determineSources(files);\n }\n\n /**\n * Do a single build\n */\n private buildOnce(): ts.EmitResult {\n if (!this.compilerHost.getDefaultLibLocation) {\n throw new Error('No default library location was found on the TypeScript compiler host!');\n }\n\n const tsconf = this.tsconfig!;\n\n const prog = ts.createIncrementalProgram({\n rootNames: this.rootFiles.concat(_pathOfLibraries(this.compilerHost)),\n options: tsconf.compilerOptions,\n // Make the references absolute for the compiler\n projectReferences: tsconf.references?.map((ref) => ({\n path: path.resolve(path.dirname(this.configPath), ref.path),\n })),\n host: this.compilerHost,\n });\n\n return this.consumeProgram(prog.getProgram(), this.compilerHost.getDefaultLibLocation());\n }\n\n private consumeProgram(program: ts.Program, stdlib: string): ts.EmitResult {\n const diagnostics = [...ts.getPreEmitDiagnostics(program)];\n let hasErrors = false;\n\n if (!hasErrors && this.diagsHaveAbortableErrors(diagnostics)) {\n hasErrors = true;\n LOG.error('Compilation errors prevented the JSII assembly from being created');\n }\n\n // Do the \"Assembler\" part first because we need some of the analysis done in there\n // to post-process the AST\n const assembler = new Assembler(this.options.projectInfo, this.system, program, stdlib, {\n stripDeprecated: this.options.stripDeprecated,\n stripDeprecatedAllowListFile: this.options.stripDeprecatedAllowListFile,\n addDeprecationWarnings: this.options.addDeprecationWarnings,\n compressAssembly: this.options.compressAssembly,\n });\n\n try {\n const assmEmit = assembler.emit();\n if (!hasErrors && (assmEmit.emitSkipped || this.diagsHaveAbortableErrors(assmEmit.diagnostics))) {\n hasErrors = true;\n LOG.error('Type model errors prevented the JSII assembly from being created');\n }\n\n diagnostics.push(...assmEmit.diagnostics);\n } catch (e: any) {\n diagnostics.push(JsiiDiagnostic.JSII_9997_UNKNOWN_ERROR.createDetached(e));\n hasErrors = true;\n }\n\n // Do the emit, but add in transformers which are going to replace real\n // comments with synthetic ones.\n const emit = program.emit(\n undefined, // targetSourceFile\n undefined, // writeFile\n undefined, // cancellationToken\n undefined, // emitOnlyDtsFiles\n assembler.customTransformers,\n );\n diagnostics.push(...emit.diagnostics);\n\n if (!hasErrors && (emit.emitSkipped || this.diagsHaveAbortableErrors(emit.diagnostics))) {\n hasErrors = true;\n LOG.error('Compilation errors prevented the JSII assembly from being created');\n }\n\n if (!hasErrors) {\n emitDownleveledDeclarations(this.options.projectInfo);\n }\n\n // Some extra validation on the config.\n // Make sure that { \"./.warnings.jsii.js\": \"./.warnings.jsii.js\" } is in the set of\n // exports, if they are specified.\n if (this.options.addDeprecationWarnings && this.options.projectInfo.exports !== undefined) {\n const expected = `./${WARNINGSCODE_FILE_NAME}`;\n const warningsExport = Object.entries(this.options.projectInfo.exports).filter(\n ([k, v]) => k === expected && v === expected,\n );\n\n if (warningsExport.length === 0) {\n hasErrors = true;\n diagnostics.push(JsiiDiagnostic.JSII_0007_MISSING_WARNINGS_EXPORT.createDetached());\n }\n }\n\n return {\n emitSkipped: hasErrors,\n diagnostics: ts.sortAndDeduplicateDiagnostics(diagnostics),\n emittedFiles: emit.emittedFiles,\n };\n }\n\n /**\n * Build the TypeScript config object from jsii config\n *\n * This is the object that will be written to disk\n * unless an existing tsconfig was provided.\n */\n private buildTypeScriptConfig(): TypeScriptConfig {\n let references: string[] | undefined;\n\n const isComposite =\n this.options.projectReferences !== undefined\n ? this.options.projectReferences\n : this.options.projectInfo.projectReferences !== undefined\n ? this.options.projectInfo.projectReferences\n : false;\n if (isComposite) {\n references = this.findProjectReferences();\n }\n\n const pi = this.options.projectInfo;\n\n return {\n compilerOptions: {\n ...pi.tsc,\n ...BASE_COMPILER_OPTIONS,\n // Enable composite mode if project references are enabled\n composite: isComposite,\n // When incremental, configure a tsbuildinfo file\n tsBuildInfoFile: path.join(pi.tsc?.outDir ?? '.', 'tsconfig.tsbuildinfo'),\n },\n include: [pi.tsc?.rootDir != null ? path.join(pi.tsc.rootDir, '**', '*.ts') : path.join('**', '*.ts')],\n exclude: [\n 'node_modules',\n pi.tsc?.outDir != null ? path.resolve(pi.tsc.outDir, TYPES_COMPAT) : TYPES_COMPAT,\n ...(pi.excludeTypescript ?? []),\n ...(pi.tsc?.outDir != null &&\n (pi.tsc?.rootDir == null || path.resolve(pi.tsc.outDir).startsWith(path.resolve(pi.tsc.rootDir) + path.sep))\n ? [path.join(pi.tsc.outDir, '**', '*.ts')]\n : []),\n ],\n // Change the references a little. We write 'originalpath' to the\n // file under the 'path' key, which is the same as what the\n // TypeScript compiler does. Make it relative so that the files are\n // movable. Not strictly required but looks better.\n references: references?.map((p) => ({ path: p })),\n };\n }\n\n /**\n * Load the TypeScript config object from a provided file\n */\n private readTypeScriptConfig(): TypeScriptConfig {\n const projectRoot = this.options.projectInfo.projectRoot;\n const { config, error } = ts.readConfigFile(this.configPath, ts.sys.readFile);\n if (error) {\n utils.logDiagnostic(error, projectRoot);\n throw new Error(`Failed to load tsconfig at ${this.configPath}`);\n }\n const extended = ts.parseJsonConfigFileContent(config, ts.sys, projectRoot);\n // the tsconfig parser adds this in, but it is not an expected compilerOption\n delete extended.options.configFilePath;\n\n return {\n compilerOptions: extended.options,\n watchOptions: extended.watchOptions,\n include: extended.fileNames,\n };\n }\n\n /**\n * Creates a `tsconfig.json` file to improve the IDE experience.\n *\n * @return the fully qualified path to the `tsconfig.json` file\n */\n private writeTypeScriptConfig(): void {\n const commentKey = '_generated_by_jsii_';\n const commentValue = 'Generated by jsii - safe to delete, and ideally should be in .gitignore';\n\n (this.tsconfig as any)[commentKey] = commentValue;\n\n if (fs.existsSync(this.configPath)) {\n const currentConfig = JSON.parse(fs.readFileSync(this.configPath, 'utf-8'));\n if (!(commentKey in currentConfig)) {\n throw new Error(\n `A '${this.configPath}' file that was not generated by jsii is in ${this.options.projectInfo.projectRoot}. Aborting instead of overwriting.`,\n );\n }\n }\n\n const outputConfig = {\n ...this.tsconfig,\n compilerOptions: convertForJson(this.tsconfig?.compilerOptions),\n };\n\n LOG.debug(`Creating or updating ${chalk.blue(this.configPath)}`);\n fs.writeFileSync(this.configPath, JSON.stringify(outputConfig, null, 2), 'utf8');\n }\n\n /**\n * Find all dependencies that look like TypeScript projects.\n *\n * Enumerate all dependencies, if they have a tsconfig.json file with\n * \"composite: true\" we consider them project references.\n *\n * (Note: TypeScript seems to only correctly find transitive project references\n * if there's an \"index\" tsconfig.json of all projects somewhere up the directory\n * tree)\n */\n private findProjectReferences(): string[] {\n const pkg = this.options.projectInfo.packageJson;\n\n const ret = new Array<string>();\n\n const dependencyNames = new Set<string>();\n for (const dependencyMap of [pkg.dependencies, pkg.devDependencies, pkg.peerDependencies]) {\n if (dependencyMap === undefined) {\n continue;\n }\n for (const name of Object.keys(dependencyMap)) {\n dependencyNames.add(name);\n }\n }\n\n for (const tsconfigFile of Array.from(dependencyNames).map((depName) => this.findMonorepoPeerTsconfig(depName))) {\n if (!tsconfigFile) {\n continue;\n }\n\n const { config: tsconfig } = ts.readConfigFile(tsconfigFile, this.system.readFile);\n\n // Add references to any TypeScript package we find that is 'composite' enabled.\n // Make it relative.\n if (tsconfig.compilerOptions?.composite) {\n ret.push(path.relative(this.options.projectInfo.projectRoot, path.dirname(tsconfigFile)));\n } else {\n // Not a composite package--if this package is in a node_modules directory, that is most\n // likely correct, otherwise it is most likely an error (heuristic here, I don't know how to\n // properly check this).\n if (tsconfigFile.includes('node_modules')) {\n LOG.warn('%s: not a composite TypeScript package, but it probably should be', path.dirname(tsconfigFile));\n }\n }\n }\n\n return ret;\n }\n\n /**\n * Find source files using the same mechanism that the TypeScript compiler itself uses.\n *\n * Respects includes/excludes/etc.\n *\n * This makes it so that running 'typescript' and running 'jsii' has the same behavior.\n */\n private determineSources(files: string[]): string[] {\n // explicitly requested files\n if (files.length > 0) {\n return [...files];\n }\n\n // for user provided config we already have parsed the full list of files\n if (this.userProvidedTypeScriptConfig) {\n return [...(this.tsconfig.include ?? [])];\n }\n\n // finally get the file list for the generated config\n const parseConfigHost = parseConfigHostFromCompilerHost(this.compilerHost);\n const parsed = ts.parseJsonConfigFileContent(this.tsconfig, parseConfigHost, this.options.projectInfo.projectRoot);\n return [...parsed.fileNames];\n }\n\n /**\n * Resolve the given dependency name from the current package, and find the associated tsconfig.json location\n *\n * Because we have the following potential directory layout:\n *\n * package/node_modules/some_dependency\n * package/tsconfig.json\n *\n * We resolve symlinks and only find a \"TypeScript\" dependency if doesn't have 'node_modules' in\n * the path after resolving symlinks (i.e., if it's a peer package in the same monorepo).\n *\n * Returns undefined if no such tsconfig could be found.\n */\n private findMonorepoPeerTsconfig(depName: string): string | undefined {\n // eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires\n const { builtinModules } = require('node:module');\n if ((builtinModules ?? []).includes(depName)) {\n // Can happen for modules like 'punycode' which are declared as dependency for polyfill purposes\n return undefined;\n }\n\n try {\n const depDir = findDependencyDirectory(depName, this.options.projectInfo.projectRoot);\n\n const dep = path.join(depDir, 'tsconfig.json');\n if (!fs.existsSync(dep)) {\n return undefined;\n }\n\n // Resolve symlinks, to check if this is a monorepo peer\n const dependencyRealPath = fs.realpathSync(dep);\n if (dependencyRealPath.split(path.sep).includes('node_modules')) {\n return undefined;\n }\n\n return dependencyRealPath;\n } catch (e: any) {\n // @types modules cannot be required, for example\n if (['MODULE_NOT_FOUND', 'ERR_PACKAGE_PATH_NOT_EXPORTED'].includes(e.code)) {\n return undefined;\n }\n throw e;\n }\n }\n\n private diagsHaveAbortableErrors(diags: readonly ts.Diagnostic[]) {\n return diags.some(\n (d) =>\n d.category === ts.DiagnosticCategory.Error ||\n (this.options.failOnWarnings && d.category === ts.DiagnosticCategory.Warning),\n );\n }\n}\n\n/**\n * Options for Watch in non-blocking mode.\n *\n * @internal\n */\nexport interface NonBlockingWatchOptions {\n /**\n * Signals non-blocking execution\n */\n readonly nonBlocking: true;\n\n /**\n * Configures the diagnostics reporter\n */\n readonly reportDiagnostics: ts.DiagnosticReporter;\n\n /**\n * Configures the watch status reporter\n */\n readonly reportWatchStatus: ts.WatchStatusReporter;\n\n /**\n * This hook gets invoked when a compilation cycle (complete with Assembler execution) completes.\n */\n readonly compilationComplete: (emitResult: ts.EmitResult) => void;\n}\n\nfunction _pathOfLibraries(host: ts.CompilerHost | ts.WatchCompilerHost<any>): string[] {\n if (!BASE_COMPILER_OPTIONS.lib || BASE_COMPILER_OPTIONS.lib.length === 0) {\n return [];\n }\n const lib = host.getDefaultLibLocation?.();\n if (!lib) {\n throw new Error(\n `Compiler host doesn't have a default library directory available for ${BASE_COMPILER_OPTIONS.lib.join(', ')}`,\n );\n }\n return BASE_COMPILER_OPTIONS.lib.map((name) => path.join(lib, name));\n}\n\nfunction parseConfigHostFromCompilerHost(host: ts.CompilerHost): ts.ParseConfigHost {\n // Copied from upstream\n // https://github.com/Microsoft/TypeScript/blob/9e05abcfd3f8bb3d6775144ede807daceab2e321/src/compiler/program.ts#L3105\n return {\n fileExists: (f) => host.fileExists(f),\n readDirectory(root, extensions, excludes, includes, depth) {\n if (host.readDirectory === undefined) {\n throw new Error(\"'CompilerHost.readDirectory' must be implemented to correctly process 'projectReferences'\");\n }\n return host.readDirectory(root, extensions, excludes, includes, depth);\n },\n readFile: (f) => host.readFile(f),\n useCaseSensitiveFileNames: host.useCaseSensitiveFileNames(),\n trace: host.trace ? (s) => host.trace!(s) : undefined,\n };\n}\n"]}
\No newline at end of file