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E,QAAQ;gBACd,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE;aACpD;YACD,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;gBACnB,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE;oBACN,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAE,oBAA4B;iBACzE;aACF;SACF;QACD,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;YACvD,qGAAqG;YACrG,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;gBACnB,SAAS,EAAE,CAAC,aAAa,CAAC;gBAC1B,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;aACzC;SACF;KACF,CAAC,CAAC;IAEH,SAAS,SAAS,CAAC,cAAc,GAAG,SAAS;QAC3C,QAAQ,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC;gBACJ,OAAO,MAAM,CAAC;YAChB,KAAK,CAAC;gBACJ,OAAO,MAAM,CAAC;YAChB,KAAK,CAAC;gBACJ,OAAO,OAAO,CAAC;YACjB,KAAK,CAAC;gBACJ,OAAO,OAAO,CAAC;YACjB;gBACE,OAAO,KAAK,CAAC;QACjB,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import '@jsii/check-node/run';\n\nimport * as path from 'node:path';\nimport * as util from 'node:util';\nimport * as log4js from 'log4js';\nimport { version as tsVersion } from 'typescript/package.json';\nimport * as yargs from 'yargs';\n\nimport { Compiler } from './compiler';\nimport { configureCategories } from './jsii-diagnostic';\nimport { loadProjectInfo } from './project-info';\nimport { emitSupportPolicyInformation } from './support';\nimport { TypeScriptConfigValidationRuleSet } from './tsconfig';\nimport * as utils from './utils';\nimport { VERSION } from './version';\nimport { enabledWarnings } from './warnings';\n\nconst warningTypes = Object.keys(enabledWarnings);\n\nfunction choiceWithDesc(\n choices: { [choice: string]: string },\n desc: string,\n): {\n choices: string[];\n desc: string;\n} {\n return {\n choices: Object.keys(choices),\n desc: [desc, ...Object.entries(choices).map(([choice, docs]) => `${choice}: ${docs}`)].join('\\n'),\n };\n}\n\nenum OPTION_GROUP {\n JSII = 'jsii compiler options:',\n TS = 'TypeScript config options:',\n}\n\nconst ruleSets: {\n [choice in TypeScriptConfigValidationRuleSet]: string;\n} = {\n [TypeScriptConfigValidationRuleSet.STRICT]:\n 'Validates the provided config against a strict rule set designed for maximum backwards-compatibility.',\n [TypeScriptConfigValidationRuleSet.GENERATED]:\n 'Enforces a config as created by --generate-tsconfig. Use this to stay compatible with the generated config, but have full ownership over the file.',\n [TypeScriptConfigValidationRuleSet.MINIMAL]:\n 'Only enforce options that are known to be incompatible with jsii. This rule set is likely to be incomplete and new rules will be added without notice as incompatibilities emerge.',\n [TypeScriptConfigValidationRuleSet.NONE]:\n 'Disables all config validation, including options that are known to be incompatible with jsii. Intended for experimentation only. Use at your own risk.',\n};\n\n(async () => {\n await emitSupportPolicyInformation();\n\n await yargs\n .env('JSII')\n .command(\n ['$0 [PROJECT_ROOT]', 'compile [PROJECT_ROOT]'],\n 'Compiles a jsii/TypeScript project',\n (argv) =>\n argv\n .positional('PROJECT_ROOT', {\n type: 'string',\n desc: 'The root of the project to be compiled',\n default: '.',\n normalize: true,\n })\n .option('watch', {\n alias: 'w',\n type: 'boolean',\n desc: 'Watch for file changes and recompile automatically',\n })\n .option('project-references', {\n group: OPTION_GROUP.JSII,\n alias: 'r',\n type: 'boolean',\n desc: 'Generate TypeScript project references (also [package.json].jsii.projectReferences)\\nHas no effect if --tsconfig is provided',\n })\n .option('fix-peer-dependencies', {\n type: 'boolean',\n default: true,\n desc: 'This option no longer has any effect.',\n hidden: true,\n })\n .options('fail-on-warnings', {\n group: OPTION_GROUP.JSII,\n alias: 'Werr',\n type: 'boolean',\n desc: 'Treat warnings as errors',\n })\n .option('silence-warnings', {\n group: OPTION_GROUP.JSII,\n type: 'array',\n default: [],\n desc: `List of warnings to silence (warnings: ${warningTypes.join(',')})`,\n })\n .option('strip-deprecated', {\n group: OPTION_GROUP.JSII,\n type: 'string',\n desc: '[EXPERIMENTAL] Hides all @deprecated members from the API (implementations remain). If an optional file name is given, only FQNs present in the file will be stripped.',\n })\n .option('add-deprecation-warnings', {\n group: OPTION_GROUP.JSII,\n type: 'boolean',\n default: false,\n desc: '[EXPERIMENTAL] Injects warning statements for all deprecated elements, to be printed at runtime',\n })\n .option('generate-tsconfig', {\n group: OPTION_GROUP.TS,\n type: 'string',\n defaultDescription: 'tsconfig.json',\n desc: 'Name of the typescript configuration file to generate with compiler settings',\n })\n .option('tsconfig', {\n group: OPTION_GROUP.TS,\n alias: 'c',\n type: 'string',\n desc: '[EXPERIMENTAL] Use this typescript configuration file to compile the jsii project.',\n })\n .conflicts('tsconfig', ['generate-tsconfig', 'project-references'])\n .option('validate-tsconfig', {\n group: OPTION_GROUP.TS,\n ...choiceWithDesc(\n ruleSets,\n '[EXPERIMENTAL] Validate the provided typescript configuration file against a set of rules.',\n ),\n defaultDescription: TypeScriptConfigValidationRuleSet.STRICT,\n })\n .option('compress-assembly', {\n group: OPTION_GROUP.JSII,\n type: 'boolean',\n default: false,\n desc: 'Emit a compressed version of the assembly',\n })\n .option('verbose', {\n alias: 'v',\n type: 'count',\n desc: 'Increase the verbosity of output',\n global: true,\n }),\n async (argv) => {\n _configureLog4js(argv.verbose);\n\n if (argv['generate-tsconfig'] != null && argv.tsconfig != null) {\n throw new Error('Options --generate-tsconfig and --tsconfig are mutually exclusive');\n }\n\n const projectRoot = path.normalize(path.resolve(process.cwd(), argv.PROJECT_ROOT));\n\n const { projectInfo, diagnostics: projectInfoDiagnostics } = loadProjectInfo(projectRoot);\n\n // disable all silenced warnings\n for (const key of argv['silence-warnings']) {\n if (!(key in enabledWarnings)) {\n throw new Error(`Unknown warning type ${key as any}. Must be one of: ${warningTypes.join(', ')}`);\n }\n\n enabledWarnings[key] = false;\n }\n\n configureCategories(projectInfo.diagnostics ?? {});\n\n const typeScriptConfig = argv.tsconfig ?? projectInfo.packageJson.jsii?.tsconfig;\n const validateTypeScriptConfig =\n (argv['validate-tsconfig'] as TypeScriptConfigValidationRuleSet) ??\n projectInfo.packageJson.jsii?.validateTsconfig ??\n TypeScriptConfigValidationRuleSet.STRICT;\n\n const compiler = new Compiler({\n projectInfo,\n projectReferences: argv['project-references'],\n failOnWarnings: argv['fail-on-warnings'],\n stripDeprecated: argv['strip-deprecated'] != null,\n stripDeprecatedAllowListFile: argv['strip-deprecated'],\n addDeprecationWarnings: argv['add-deprecation-warnings'],\n generateTypeScriptConfig: argv['generate-tsconfig'],\n typeScriptConfig,\n validateTypeScriptConfig,\n compressAssembly: argv['compress-assembly'],\n });\n\n const emitResult = argv.watch ? await compiler.watch() : compiler.emit();\n\n const allDiagnostics = [...projectInfoDiagnostics, ...emitResult.diagnostics];\n\n for (const diagnostic of allDiagnostics) {\n utils.logDiagnostic(diagnostic, projectRoot);\n }\n if (emitResult.emitSkipped) {\n process.exitCode = 1;\n }\n },\n )\n .help()\n .version(`${VERSION}, typescript ${tsVersion}`)\n .parse();\n})().catch((e) => {\n console.error(`Error: ${e.stack}`);\n process.exitCode = -1;\n});\n\nfunction _configureLog4js(verbosity: number) {\n const stderrColor = !!process.stderr.isTTY;\n const stdoutColor = !!process.stdout.isTTY;\n\n log4js.addLayout('passThroughNoColor', () => {\n return (loggingEvent) => utils.stripAnsi(util.format(...loggingEvent.data));\n });\n\n log4js.configure({\n appenders: {\n console: {\n type: 'stderr',\n layout: { type: stderrColor ? 'colored' : 'basic' },\n },\n [utils.DIAGNOSTICS]: {\n type: 'stdout',\n layout: {\n type: stdoutColor ? 'messagePassThrough' : ('passThroughNoColor' as any),\n },\n },\n },\n categories: {\n default: { appenders: ['console'], level: _logLevel() },\n // The diagnostics logger must be set to INFO or more verbose, or watch won't show important messages\n [utils.DIAGNOSTICS]: {\n appenders: ['diagnostics'],\n level: _logLevel(Math.max(verbosity, 1)),\n },\n },\n });\n\n function _logLevel(verbosityLevel = verbosity): keyof log4js.Levels {\n switch (verbosityLevel) {\n case 0:\n return 'WARN';\n case 1:\n return 'INFO';\n case 2:\n return 'DEBUG';\n case 3:\n return 'TRACE';\n default:\n return 'ALL';\n }\n }\n}\n"]}
\No newline at end of file