jsii 5.9.28 → 5.9.29-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/main.js CHANGED
@@ -14,7 +14,6 @@ const tsconfig_1 = require("./tsconfig");
14
14
  const utils = require("./utils");
15
15
  const version_1 = require("./version");
16
16
  const warnings_1 = require("./warnings");
17
- const warningTypes = Object.keys(warnings_1.enabledWarnings);
18
17
  function choiceWithDesc(choices, desc) {
19
18
  return {
20
19
  choices: Object.keys(choices),
@@ -68,9 +67,10 @@ const ruleSets = {
68
67
  })
69
68
  .option('silence-warnings', {
70
69
  group: OPTION_GROUP.JSII,
70
+ alias: 'Wno',
71
71
  type: 'array',
72
72
  default: [],
73
- desc: `List of warnings to silence (warnings: ${warningTypes.join(',')})`,
73
+ desc: 'List of warnings to silence. Accepts JSII codes (e.g. JSII5018), numbers (e.g. 5018), or diagnostic names (e.g. reserved-word, language-compatibility)',
74
74
  })
75
75
  .option('strip-deprecated', {
76
76
  group: OPTION_GROUP.JSII,
@@ -122,10 +122,9 @@ const ruleSets = {
122
122
  const { projectInfo, diagnostics: projectInfoDiagnostics } = (0, project_info_1.loadProjectInfo)(projectRoot);
123
123
  // disable all silenced warnings
124
124
  for (const key of argv['silence-warnings']) {
125
- if (!(key in warnings_1.enabledWarnings)) {
126
- throw new utils.JsiiError(`Unknown warning type ${key}. Must be one of: ${warningTypes.join(', ')}`);
125
+ for (const code of (0, warnings_1.parseWarningCodes)(String(key))) {
126
+ warnings_1.silencedWarnings.add(code);
127
127
  }
128
- warnings_1.enabledWarnings[key] = false;
129
128
  }
130
129
  (0, jsii_diagnostic_1.configureCategories)(projectInfo.diagnostics ?? {});
131
130
  const typeScriptConfig = argv.tsconfig ?? projectInfo.packageJson.jsii?.tsconfig;
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,gCAA8B;AAE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CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;gBACnB,SAAS,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;gBAC9B,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 try {\n _configureLog4js(argv.verbose);\n\n if (argv['generate-tsconfig'] != null && argv.tsconfig != null) {\n throw new utils.JsiiError('Options --generate-tsconfig and --tsconfig are mutually exclusive', true);\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 utils.JsiiError(\n `Unknown warning type ${key as any}. Must be one of: ${warningTypes.join(', ')}`,\n );\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 } catch (e: unknown) {\n if (e instanceof utils.JsiiError) {\n if (e.showHelp) {\n console.log();\n yargs.showHelp();\n console.log();\n }\n\n const LOG = log4js.getLogger(utils.CLI_LOGGER);\n LOG.error(e.message);\n\n process.exitCode = -1;\n } else {\n throw e;\n }\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\n [utils.DIAGNOSTICS]: {\n type: 'stdout',\n layout: {\n type: stdoutColor ? 'messagePassThrough' : ('passThroughNoColor' as any),\n },\n },\n [utils.CLI_LOGGER]: {\n type: 'stderr',\n layout: {\n type: 'pattern',\n pattern: stdoutColor ? '%[[%p]%] %m' : '[%p] %m',\n },\n },\n },\n categories: {\n default: { appenders: ['console'], level: _logLevel() },\n [utils.CLI_LOGGER]: {\n appenders: [utils.CLI_LOGGER],\n level: _logLevel(),\n },\n // The diagnostics logger must be set to INFO or more verbose, or watch won't show important messages\n [utils.DIAGNOSTICS]: {\n appenders: [utils.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"]}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,gCAA8B;AAE9B,kCAAkC;AAClC,kCAAkC;AAClC,iCAAiC;AACjC,0DAA+D;AAC/D,+BAA+B;AAE/B,yCAAsC;AACtC,uDAAwD;AACxD,iDAAiD;AACjD,uCAAyD;AACzD,yCAA+D;AAC/D,iCAAiC;AACjC,uCAAoC;AACpC,yCAAiE;AAEjE,SAAS,cAAc,CACrB,OAAqC,EACrC,IAAY;IAKZ,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;KAClG,CAAC;AACJ,CAAC;AAED,IAAK,YAGJ;AAHD,WAAK,YAAY;IACf,+CAA+B,CAAA;IAC/B,iDAAiC,CAAA;AACnC,CAAC,EAHI,YAAY,KAAZ,YAAY,QAGhB;AAED,MAAM,QAAQ,GAEV;IACF,CAAC,4CAAiC,CAAC,MAAM,CAAC,EACxC,uGAAuG;IACzG,CAAC,4CAAiC,CAAC,SAAS,CAAC,EAC3C,oJAAoJ;IACtJ,CAAC,4CAAiC,CAAC,OAAO,CAAC,EACzC,oLAAoL;IACtL,CAAC,4CAAiC,CAAC,IAAI,CAAC,EACtC,yJAAyJ;CAC5J,CAAC;AAEF,CAAC,K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AAU,CAAC,EAAE;gBAClB,SAAS,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC;gBAC7B,KAAK,EAAE,SAAS,EAAE;aACnB;YACD,qGAAqG;YACrG,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;gBACnB,SAAS,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;gBAC9B,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 { parseWarningCodes, silencedWarnings } from './warnings';\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 alias: 'Wno',\n type: 'array',\n default: [],\n desc: 'List of warnings to silence. Accepts JSII codes (e.g. JSII5018), numbers (e.g. 5018), or diagnostic names (e.g. reserved-word, language-compatibility)',\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 try {\n _configureLog4js(argv.verbose);\n\n if (argv['generate-tsconfig'] != null && argv.tsconfig != null) {\n throw new utils.JsiiError('Options --generate-tsconfig and --tsconfig are mutually exclusive', true);\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 for (const code of parseWarningCodes(String(key))) {\n silencedWarnings.add(code);\n }\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 } catch (e: unknown) {\n if (e instanceof utils.JsiiError) {\n if (e.showHelp) {\n console.log();\n yargs.showHelp();\n console.log();\n }\n\n const LOG = log4js.getLogger(utils.CLI_LOGGER);\n LOG.error(e.message);\n\n process.exitCode = -1;\n } else {\n throw e;\n }\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\n [utils.DIAGNOSTICS]: {\n type: 'stdout',\n layout: {\n type: stdoutColor ? 'messagePassThrough' : ('passThroughNoColor' as any),\n },\n },\n [utils.CLI_LOGGER]: {\n type: 'stderr',\n layout: {\n type: 'pattern',\n pattern: stdoutColor ? '%[[%p]%] %m' : '[%p] %m',\n },\n },\n },\n categories: {\n default: { appenders: ['console'], level: _logLevel() },\n [utils.CLI_LOGGER]: {\n appenders: [utils.CLI_LOGGER],\n level: _logLevel(),\n },\n // The diagnostics logger must be set to INFO or more verbose, or watch won't show important messages\n [utils.DIAGNOSTICS]: {\n appenders: [utils.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"]}
package/lib/utils.js CHANGED
@@ -11,6 +11,7 @@ exports.stripAnsi = stripAnsi;
11
11
  const log4js = require("log4js");
12
12
  const ts = require("typescript");
13
13
  const jsii_diagnostic_1 = require("./jsii-diagnostic");
14
+ const warnings_1 = require("./warnings");
14
15
  /**
15
16
  * Name of the logger for cli errors
16
17
  */
@@ -94,9 +95,22 @@ function _formatDiagnostic(diagnostic, projectRoot) {
94
95
  return message;
95
96
  }
96
97
  // This is our own diagnostics, so we'll format appropriately (replacing TS#### with JSII####).
97
- return message.replace(` TS${exports.JSII_DIAGNOSTICS_CODE}: `, ` JSII${diagnostic.jsiiCode}: `);
98
+ const formatted = message.replace(` TS${exports.JSII_DIAGNOSTICS_CODE}: `, ` JSII${diagnostic.jsiiCode}: `);
99
+ const diagName = jsii_diagnostic_1.Code.lookup(diagnostic.jsiiCode)?.name;
100
+ if (diagName) {
101
+ // Insert the diagnostic name after the message text on the first line
102
+ const firstNewline = formatted.indexOf('\n');
103
+ if (firstNewline !== -1) {
104
+ return `${formatted.slice(0, firstNewline)} [${diagName}]${formatted.slice(firstNewline)}`;
105
+ }
106
+ return formatted.trimEnd() + ` [${diagName}]\n`;
107
+ }
108
+ return formatted;
98
109
  }
99
110
  function logDiagnostic(diagnostic, projectRoot) {
111
+ if ((0, warnings_1.isSilenced)(diagnostic)) {
112
+ return;
113
+ }
100
114
  const logFunc = diagnosticsLogger(log4js.getLogger(exports.DIAGNOSTICS), diagnostic);
101
115
  if (!logFunc) {
102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;YACX,OAAO,EAAE,GAAG,EAAE,sBAAsB,IAAI,MAAM,EAAE,CAAC;QACnD,KAAK,MAAM;YACT,OAAO,EAAE,GAAG,EAAE,2BAA2B,IAAI,MAAM,EAAE,CAAC;QACxD,KAAK,WAAW;YACd,OAAO,EAAE,GAAG,EAAE,yBAAyB,IAAI,MAAM,EAAE,CAAC;QACtD,KAAK,QAAQ;YACX,OAAO,EAAE,GAAG,EAAE,sBAAsB,IAAI,MAAM,EAAE,CAAC;QACnD;YACE,MAAM,IAAI,SAAS,CAAC,uCAAuC,IAAI,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED,MAAM,UAAU;AACd,4CAA4C;AAC5C,6EAA6E,CAAC;AAEhF,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAOD;;GAEG;AACH,MAAa,SAAU,SAAQ,KAAK;IAClC;;;;;;OAMG;IACH,YAAqC,OAAe,EAAkB,WAAW,KAAK;QACpF,KAAK,CAAC,OAAO,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAQ;QAAkB,aAAQ,GAAR,QAAQ,CAAQ;QAEpF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;CACF;AAZD,8BAYC","sourcesContent":["import * as log4js from 'log4js';\nimport * as ts from 'typescript';\n\nimport { JsiiDiagnostic } from './jsii-diagnostic';\n\n/**\n * Name of the logger for cli errors\n */\nexport const CLI_LOGGER = 'jsii/cli';\n/**\n * Name of the logger for diagnostics information\n */\nexport const DIAGNOSTICS = 'diagnostics';\n/**\n * Diagnostic code for JSII-generated messages.\n */\nexport const JSII_DIAGNOSTICS_CODE = 9999;\n\n/**\n * Obtains the relevant logger to be used for a given diagnostic message.\n *\n * @param logger the ``log4js.Logger`` to use for emitting the message.\n * @param diagnostic the message for which a logger is requested.\n *\n * @returns a logger method of the ``logger`` for the appropriate level.\n */\nexport function diagnosticsLogger(\n logger: log4js.Logger,\n diagnostic: ts.Diagnostic,\n): ((message: any, ...args: any[]) => void) | undefined {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Error:\n if (!logger.isErrorEnabled()) {\n return undefined;\n }\n return logger.error.bind(logger);\n case ts.DiagnosticCategory.Warning:\n if (!logger.isWarnEnabled()) {\n return undefined;\n }\n return logger.warn.bind(logger);\n case ts.DiagnosticCategory.Message:\n if (!logger.isDebugEnabled()) {\n return undefined;\n }\n return logger.debug.bind(logger);\n case ts.DiagnosticCategory.Suggestion:\n default:\n if (!logger.isTraceEnabled()) {\n return undefined;\n }\n return logger.trace.bind(logger);\n }\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n if (JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n // Ensure we leverage pre-rendered diagnostics where available.\n return diagnostic.format(projectRoot);\n }\n return _formatDiagnostic(diagnostic, projectRoot);\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible. Users\n * should use `formatDiagnostic` instead, as this implementation is intended for\n * internal usafe only.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function _formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const formatDiagnosticsHost: ts.FormatDiagnosticsHost = {\n getCurrentDirectory: () => projectRoot,\n getCanonicalFileName: (fileName) => fileName,\n getNewLine: () => ts.sys.newLine,\n };\n\n const message =\n diagnostic.file != null\n ? ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost)\n : ts.formatDiagnostic(diagnostic, formatDiagnosticsHost);\n\n if (!JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n return message;\n }\n\n // This is our own diagnostics, so we'll format appropriately (replacing TS#### with JSII####).\n return message.replace(` TS${JSII_DIAGNOSTICS_CODE}: `, ` JSII${diagnostic.jsiiCode}: `);\n}\n\nexport function logDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const logFunc = diagnosticsLogger(log4js.getLogger(DIAGNOSTICS), diagnostic);\n if (!logFunc) {\n return;\n }\n logFunc(formatDiagnostic(diagnostic, projectRoot).trim());\n}\n\nconst PERSON_REGEX = /^\\s*(.+?)(?:\\s*<([^>]+)>)?(?:\\s*\\(([^)]+)\\))?\\s*$/;\n/**\n * Parses a string-formatted person entry from `package.json`.\n * @param value the string-formatted person entry.\n *\n * @example\n * parsePerson(\"Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)\");\n * // => { name: \"Barney Rubble\", email: \"b@rubble.com\", url: \"http://barnyrubble.tumblr.com/\" }\n */\nexport function parsePerson(value: string) {\n const match = PERSON_REGEX.exec(value);\n if (!match) {\n throw new JsiiError(`Invalid stringified \"person\" value: ${value}`);\n }\n const [, name, email, url] = match;\n const result: { name: string; email?: string; url?: string } = {\n name: name.trim(),\n };\n if (email) {\n result.email = email.trim();\n }\n if (url) {\n result.url = url.trim();\n }\n return result;\n}\n\nconst REPOSITORY_REGEX = /^(?:(github|gist|bitbucket|gitlab):)?([A-Za-z\\d_-]+\\/[A-Za-z\\d_-]+)$/;\nexport function parseRepository(value: string): { url: string } {\n const match = REPOSITORY_REGEX.exec(value);\n if (!match) {\n return { url: value };\n }\n const [, host, slug] = match;\n switch (host ?? 'github') {\n case 'github':\n return { url: `https://github.com/${slug}.git` };\n case 'gist':\n return { url: `https://gist.github.com/${slug}.git` };\n case 'bitbucket':\n return { url: `https://bitbucket.org/${slug}.git` };\n case 'gitlab':\n return { url: `https://gitlab.com/${slug}.git` };\n default:\n throw new JsiiError(`Unknown repository hosting service: ${host}`);\n }\n}\n\nconst ANSI_REGEX =\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;\n\nexport function stripAnsi(x: string): string {\n return x.replace(ANSI_REGEX, '');\n}\n\n/**\n * Maps the provided type to stip all `readonly` modifiers from its properties.\n */\nexport type Mutable<T> = { -readonly [K in keyof T]: Mutable<T[K]> };\n\n/**\n * Throws an error that is intended as CLI output.\n */\nexport class JsiiError extends Error {\n /**\n * An expected error that can be nicely formatted where needed (e.g. in CLI output)\n * This should only be used for errors that a user can fix themselves.\n *\n * @param message The error message to be printed to the user.\n * @param showHelp Print the help before the error.\n */\n constructor(public override readonly message: string, public readonly showHelp = false) {\n super(message);\n Object.setPrototypeOf(this, JsiiError.prototype);\n }\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AA2BA,8CA2BC;AAUD,4CAMC;AAYD,8CA4BC;AAED,sCASC;AAWD,kCAgBC;AAGD,0CAkBC;AAMD,8BAEC;AAjLD,iCAAiC;AACjC,iCAAiC;AAEjC,uDAAyD;AACzD,yCAAwC;AAExC;;GAEG;AACU,QAAA,UAAU,GAAG,UAAU,CAAC;AACrC;;GAEG;AACU,QAAA,WAAW,GAAG,aAAa,CAAC;AACzC;;GAEG;AACU,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAE1C;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,MAAqB,EACrB,UAAyB;IAEzB,QAAQ,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC5B,KAAK,EAAE,CAAC,kBAAkB,CAAC,KAAK;YAC9B,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC7B,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,KAAK,EAAE,CAAC,kBAAkB,CAAC,OAAO;YAChC,IAAI,CAAC,MAAM,CAAC,aAAa,EA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EAAE,CAAC;QACtD,KAAK,QAAQ;YACX,OAAO,EAAE,GAAG,EAAE,sBAAsB,IAAI,MAAM,EAAE,CAAC;QACnD;YACE,MAAM,IAAI,SAAS,CAAC,uCAAuC,IAAI,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED,MAAM,UAAU;AACd,4CAA4C;AAC5C,6EAA6E,CAAC;AAEhF,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAOD;;GAEG;AACH,MAAa,SAAU,SAAQ,KAAK;IAClC;;;;;;OAMG;IACH,YAAqC,OAAe,EAAkB,WAAW,KAAK;QACpF,KAAK,CAAC,OAAO,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAQ;QAAkB,aAAQ,GAAR,QAAQ,CAAQ;QAEpF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;CACF;AAZD,8BAYC","sourcesContent":["import * as log4js from 'log4js';\nimport * as ts from 'typescript';\n\nimport { Code, JsiiDiagnostic } from './jsii-diagnostic';\nimport { isSilenced } from './warnings';\n\n/**\n * Name of the logger for cli errors\n */\nexport const CLI_LOGGER = 'jsii/cli';\n/**\n * Name of the logger for diagnostics information\n */\nexport const DIAGNOSTICS = 'diagnostics';\n/**\n * Diagnostic code for JSII-generated messages.\n */\nexport const JSII_DIAGNOSTICS_CODE = 9999;\n\n/**\n * Obtains the relevant logger to be used for a given diagnostic message.\n *\n * @param logger the ``log4js.Logger`` to use for emitting the message.\n * @param diagnostic the message for which a logger is requested.\n *\n * @returns a logger method of the ``logger`` for the appropriate level.\n */\nexport function diagnosticsLogger(\n logger: log4js.Logger,\n diagnostic: ts.Diagnostic,\n): ((message: any, ...args: any[]) => void) | undefined {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Error:\n if (!logger.isErrorEnabled()) {\n return undefined;\n }\n return logger.error.bind(logger);\n case ts.DiagnosticCategory.Warning:\n if (!logger.isWarnEnabled()) {\n return undefined;\n }\n return logger.warn.bind(logger);\n case ts.DiagnosticCategory.Message:\n if (!logger.isDebugEnabled()) {\n return undefined;\n }\n return logger.debug.bind(logger);\n case ts.DiagnosticCategory.Suggestion:\n default:\n if (!logger.isTraceEnabled()) {\n return undefined;\n }\n return logger.trace.bind(logger);\n }\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n if (JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n // Ensure we leverage pre-rendered diagnostics where available.\n return diagnostic.format(projectRoot);\n }\n return _formatDiagnostic(diagnostic, projectRoot);\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible. Users\n * should use `formatDiagnostic` instead, as this implementation is intended for\n * internal usafe only.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function _formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const formatDiagnosticsHost: ts.FormatDiagnosticsHost = {\n getCurrentDirectory: () => projectRoot,\n getCanonicalFileName: (fileName) => fileName,\n getNewLine: () => ts.sys.newLine,\n };\n\n const message =\n diagnostic.file != null\n ? ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost)\n : ts.formatDiagnostic(diagnostic, formatDiagnosticsHost);\n\n if (!JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n return message;\n }\n\n // This is our own diagnostics, so we'll format appropriately (replacing TS#### with JSII####).\n const formatted = message.replace(` TS${JSII_DIAGNOSTICS_CODE}: `, ` JSII${diagnostic.jsiiCode}: `);\n const diagName = Code.lookup(diagnostic.jsiiCode)?.name;\n if (diagName) {\n // Insert the diagnostic name after the message text on the first line\n const firstNewline = formatted.indexOf('\\n');\n if (firstNewline !== -1) {\n return `${formatted.slice(0, firstNewline)} [${diagName}]${formatted.slice(firstNewline)}`;\n }\n return formatted.trimEnd() + ` [${diagName}]\\n`;\n }\n return formatted;\n}\n\nexport function logDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n if (isSilenced(diagnostic)) {\n return;\n }\n const logFunc = diagnosticsLogger(log4js.getLogger(DIAGNOSTICS), diagnostic);\n if (!logFunc) {\n return;\n }\n logFunc(formatDiagnostic(diagnostic, projectRoot).trim());\n}\n\nconst PERSON_REGEX = /^\\s*(.+?)(?:\\s*<([^>]+)>)?(?:\\s*\\(([^)]+)\\))?\\s*$/;\n/**\n * Parses a string-formatted person entry from `package.json`.\n * @param value the string-formatted person entry.\n *\n * @example\n * parsePerson(\"Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)\");\n * // => { name: \"Barney Rubble\", email: \"b@rubble.com\", url: \"http://barnyrubble.tumblr.com/\" }\n */\nexport function parsePerson(value: string) {\n const match = PERSON_REGEX.exec(value);\n if (!match) {\n throw new JsiiError(`Invalid stringified \"person\" value: ${value}`);\n }\n const [, name, email, url] = match;\n const result: { name: string; email?: string; url?: string } = {\n name: name.trim(),\n };\n if (email) {\n result.email = email.trim();\n }\n if (url) {\n result.url = url.trim();\n }\n return result;\n}\n\nconst REPOSITORY_REGEX = /^(?:(github|gist|bitbucket|gitlab):)?([A-Za-z\\d_-]+\\/[A-Za-z\\d_-]+)$/;\nexport function parseRepository(value: string): { url: string } {\n const match = REPOSITORY_REGEX.exec(value);\n if (!match) {\n return { url: value };\n }\n const [, host, slug] = match;\n switch (host ?? 'github') {\n case 'github':\n return { url: `https://github.com/${slug}.git` };\n case 'gist':\n return { url: `https://gist.github.com/${slug}.git` };\n case 'bitbucket':\n return { url: `https://bitbucket.org/${slug}.git` };\n case 'gitlab':\n return { url: `https://gitlab.com/${slug}.git` };\n default:\n throw new JsiiError(`Unknown repository hosting service: ${host}`);\n }\n}\n\nconst ANSI_REGEX =\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;\n\nexport function stripAnsi(x: string): string {\n return x.replace(ANSI_REGEX, '');\n}\n\n/**\n * Maps the provided type to stip all `readonly` modifiers from its properties.\n */\nexport type Mutable<T> = { -readonly [K in keyof T]: Mutable<T[K]> };\n\n/**\n * Throws an error that is intended as CLI output.\n */\nexport class JsiiError extends Error {\n /**\n * An expected error that can be nicely formatted where needed (e.g. in CLI output)\n * This should only be used for errors that a user can fix themselves.\n *\n * @param message The error message to be printed to the user.\n * @param showHelp Print the help before the error.\n */\n constructor(public override readonly message: string, public readonly showHelp = false) {\n super(message);\n Object.setPrototypeOf(this, JsiiError.prototype);\n }\n}\n"]}
package/lib/version.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
2
- export declare const SHORT_VERSION = "5.9.28";
2
+ export declare const SHORT_VERSION = "5.9.29-dev.1";
3
3
  /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
4
- export declare const VERSION = "5.9.28 (build cbad63d)";
4
+ export declare const VERSION = "5.9.29-dev.1 (build ab1f4aa)";
5
5
  /** The release line identifier for this JSII compiler (e.g: `X.Y`) */
6
6
  export declare const RELEASE_LINE = "5.9";
7
7
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -4,9 +4,9 @@ exports.RELEASE_LINE = exports.VERSION = exports.SHORT_VERSION = void 0;
4
4
  const typescript_1 = require("typescript");
5
5
  // GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!
6
6
  /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
7
- exports.SHORT_VERSION = '5.9.28';
7
+ exports.SHORT_VERSION = '5.9.29-dev.1';
8
8
  /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
9
- exports.VERSION = '5.9.28 (build cbad63d)';
9
+ exports.VERSION = '5.9.29-dev.1 (build ab1f4aa)';
10
10
  /** The release line identifier for this JSII compiler (e.g: `X.Y`) */
11
11
  exports.RELEASE_LINE = typescript_1.versionMajorMinor;
12
12
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,uFAAuF;AAEvF,qEAAqE;AACxD,QAAA,aAAa,GAAG,QAAQ,CAAC;AAEtC,yFAAyF;AAC5E,QAAA,OAAO,GAAG,wBAAwB,CAAC;AAEhD,sEAAsE;AACzD,QAAA,YAAY,GAAG,8BAAiB,CAAC","sourcesContent":["import { versionMajorMinor } from 'typescript';\n\n// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!\n\n/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */\nexport const SHORT_VERSION = '5.9.28';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.9.28 (build cbad63d)';\n\n/** The release line identifier for this JSII compiler (e.g: `X.Y`) */\nexport const RELEASE_LINE = versionMajorMinor;\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,uFAAuF;AAEvF,qEAAqE;AACxD,QAAA,aAAa,GAAG,cAAc,CAAC;AAE5C,yFAAyF;AAC5E,QAAA,OAAO,GAAG,8BAA8B,CAAC;AAEtD,sEAAsE;AACzD,QAAA,YAAY,GAAG,8BAAiB,CAAC","sourcesContent":["import { versionMajorMinor } from 'typescript';\n\n// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!\n\n/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */\nexport const SHORT_VERSION = '5.9.29-dev.1';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.9.29-dev.1 (build ab1f4aa)';\n\n/** The release line identifier for this JSII compiler (e.g: `X.Y`) */\nexport const RELEASE_LINE = versionMajorMinor;\n"]}
package/lib/warnings.d.ts CHANGED
@@ -1,8 +1,19 @@
1
+ import * as ts from 'typescript';
1
2
  /**
2
- * Indicates which warnings are currently enabled. By default all warnings are
3
- * enabled, and can be silenced through the --silence-warning option.
3
+ * Set of silenced warning codes (numeric JSII codes).
4
4
  */
5
- export declare const enabledWarnings: {
6
- [name: string]: boolean;
7
- };
5
+ export declare const silencedWarnings: Set<number>;
6
+ /**
7
+ * Parse a user-provided warning identifier into numeric JSII codes.
8
+ * Accepts: "JSII5019", "5019", or a diagnostic name / partial name.
9
+ *
10
+ * A name containing `/` must match a full diagnostic name exactly.
11
+ * A name without `/` matches any diagnostic whose category or specific
12
+ * name equals the input (e.g. "reserved-word" or "language-compatibility").
13
+ */
14
+ export declare function parseWarningCodes(input: string): number[];
15
+ /**
16
+ * Check if a diagnostic is a silenced warning.
17
+ */
18
+ export declare function isSilenced(diagnostic: ts.Diagnostic): boolean;
8
19
  //# sourceMappingURL=warnings.d.ts.map
package/lib/warnings.js CHANGED
@@ -1,11 +1,53 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.enabledWarnings = void 0;
3
+ exports.silencedWarnings = void 0;
4
+ exports.parseWarningCodes = parseWarningCodes;
5
+ exports.isSilenced = isSilenced;
6
+ const ts = require("typescript");
7
+ const jsii_diagnostic_1 = require("./jsii-diagnostic");
4
8
  /**
5
- * Indicates which warnings are currently enabled. By default all warnings are
6
- * enabled, and can be silenced through the --silence-warning option.
9
+ * Set of silenced warning codes (numeric JSII codes).
7
10
  */
8
- exports.enabledWarnings = {
9
- 'reserved-word': true,
10
- };
11
+ exports.silencedWarnings = new Set();
12
+ /**
13
+ * Parse a user-provided warning identifier into numeric JSII codes.
14
+ * Accepts: "JSII5019", "5019", or a diagnostic name / partial name.
15
+ *
16
+ * A name containing `/` must match a full diagnostic name exactly.
17
+ * A name without `/` matches any diagnostic whose category or specific
18
+ * name equals the input (e.g. "reserved-word" or "language-compatibility").
19
+ */
20
+ function parseWarningCodes(input) {
21
+ // JSII<number> format
22
+ const jsiiMatch = /^JSII(\d+)$/i.exec(input);
23
+ if (jsiiMatch) {
24
+ return [parseInt(jsiiMatch[1], 10)];
25
+ }
26
+ // Plain number
27
+ const num = parseInt(input, 10);
28
+ if (String(num) === input) {
29
+ return [num];
30
+ }
31
+ // Name-based lookup
32
+ const matches = jsii_diagnostic_1.Code.lookupByPartialName(input);
33
+ if (matches.length > 0) {
34
+ return matches.map((c) => c.code);
35
+ }
36
+ throw new Error(`Unknown warning "${input}". Expected a JSII code (e.g. JSII5018), a number (e.g. 5018), or a diagnostic name (e.g. reserved-word, language-compatibility/reserved-word, language-compatibility).`);
37
+ }
38
+ /**
39
+ * Check if a diagnostic is a silenced warning.
40
+ */
41
+ function isSilenced(diagnostic) {
42
+ if (exports.silencedWarnings.size === 0) {
43
+ return false;
44
+ }
45
+ if (diagnostic.category !== ts.DiagnosticCategory.Warning) {
46
+ return false;
47
+ }
48
+ if (!jsii_diagnostic_1.JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {
49
+ return false;
50
+ }
51
+ return exports.silencedWarnings.has(diagnostic.jsiiCode);
52
+ }
11
53
  //# sourceMappingURL=warnings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"warnings.js","sourceRoot":"","sources":["../src/warnings.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,eAAe,GAAgC;IAC1D,eAAe,EAAE,IAAI;CACtB,CAAC","sourcesContent":["/**\n * Indicates which warnings are currently enabled. By default all warnings are\n * enabled, and can be silenced through the --silence-warning option.\n */\nexport const enabledWarnings: { [name: string]: boolean } = {\n 'reserved-word': true,\n};\n"]}
1
+ {"version":3,"file":"warnings.js","sourceRoot":"","sources":["../src/warnings.ts"],"names":[],"mappings":";;;AAiBA,8CAsBC;AAKD,gCAWC;AAvD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AAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import * as ts from 'typescript';\n\nimport { Code, JsiiDiagnostic } from './jsii-diagnostic';\n\n/**\n * Set of silenced warning codes (numeric JSII codes).\n */\nexport const silencedWarnings = new Set<number>();\n\n/**\n * Parse a user-provided warning identifier into numeric JSII codes.\n * Accepts: \"JSII5019\", \"5019\", or a diagnostic name / partial name.\n *\n * A name containing `/` must match a full diagnostic name exactly.\n * A name without `/` matches any diagnostic whose category or specific\n * name equals the input (e.g. \"reserved-word\" or \"language-compatibility\").\n */\nexport function parseWarningCodes(input: string): number[] {\n // JSII<number> format\n const jsiiMatch = /^JSII(\\d+)$/i.exec(input);\n if (jsiiMatch) {\n return [parseInt(jsiiMatch[1], 10)];\n }\n\n // Plain number\n const num = parseInt(input, 10);\n if (String(num) === input) {\n return [num];\n }\n\n // Name-based lookup\n const matches = Code.lookupByPartialName(input);\n if (matches.length > 0) {\n return matches.map((c) => c.code);\n }\n\n throw new Error(\n `Unknown warning \"${input}\". Expected a JSII code (e.g. JSII5018), a number (e.g. 5018), or a diagnostic name (e.g. reserved-word, language-compatibility/reserved-word, language-compatibility).`,\n );\n}\n\n/**\n * Check if a diagnostic is a silenced warning.\n */\nexport function isSilenced(diagnostic: ts.Diagnostic): boolean {\n if (silencedWarnings.size === 0) {\n return false;\n }\n if (diagnostic.category !== ts.DiagnosticCategory.Warning) {\n return false;\n }\n if (!JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n return false;\n }\n return silencedWarnings.has(diagnostic.jsiiCode);\n}\n"]}
package/package.json CHANGED
@@ -64,7 +64,7 @@
64
64
  "npm": "^9.9.4",
65
65
  "npm-check-updates": "^16",
66
66
  "prettier": "^2.8.8",
67
- "projen": "^0.99.13",
67
+ "projen": "^0.99.16",
68
68
  "tar": "^7.5.9",
69
69
  "ts-jest": "^29.4.6",
70
70
  "ts-node": "^10.9.2"
@@ -92,7 +92,7 @@
92
92
  "publishConfig": {
93
93
  "access": "public"
94
94
  },
95
- "version": "5.9.28",
95
+ "version": "5.9.29-dev.1",
96
96
  "types": "lib/index.d.ts",
97
97
  "exports": {
98
98
  ".": "./lib/index.js",