jsii 5.9.29-dev.1 → 5.9.30-dev.0
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/README.md +25 -1
- package/lib/compiler.js +2 -0
- package/lib/compiler.js.map +1 -1
- package/lib/directives.d.ts +2 -0
- package/lib/directives.js +13 -1
- package/lib/directives.js.map +1 -1
- package/lib/literate.js +1 -1
- package/lib/literate.js.map +1 -1
- package/lib/main.js +2 -0
- package/lib/main.js.map +1 -1
- package/lib/utils.d.ts +4 -0
- package/lib/utils.js +27 -3
- package/lib/utils.js.map +1 -1
- package/lib/validator.js +19 -13
- package/lib/validator.js.map +1 -1
- package/lib/version.d.ts +2 -2
- package/lib/version.js +2 -2
- package/lib/version.js.map +1 -1
- package/lib/warnings.d.ts +1 -1
- package/lib/warnings.js +43 -5
- package/lib/warnings.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ The current status of `jsii` compiler releases is:
|
|
|
71
71
|
|
|
72
72
|
The `--silence-warnings` option allows you to suppress specific warnings from the compiler output. Silenced warnings
|
|
73
73
|
are still emitted internally (e.g. they are still part of the assembly), but are not printed to the console. When
|
|
74
|
-
`--fail-on-warnings` (
|
|
74
|
+
`--fail-on-warnings` (`--Werr`) is set, silenced warnings are not treated as errors.
|
|
75
75
|
|
|
76
76
|
Warnings can be identified by JSII code, number, or diagnostic name:
|
|
77
77
|
|
|
@@ -95,6 +95,30 @@ jsii --silence-warnings language-compatibility
|
|
|
95
95
|
jsii --silence-warnings reserved-word JSII5019
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
+
### Inline Suppression
|
|
99
|
+
|
|
100
|
+
Individual warnings can be suppressed directly in source code using the `@jsii suppress` directive. This is useful
|
|
101
|
+
when you want `--fail-on-warnings` enabled globally but need to allow specific instances of a warning.
|
|
102
|
+
|
|
103
|
+
Each directive accepts a single warning identifier using the same formats as `--silence-warnings`. An optional text after
|
|
104
|
+
the identifier is treated as an explanation comment. Use multiple directives to suppress multiple warnings:
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
export class MyClass {
|
|
108
|
+
/**
|
|
109
|
+
* @jsii suppress JSII5019 this name is intentional
|
|
110
|
+
* @jsii suppress reserved-word
|
|
111
|
+
*/
|
|
112
|
+
public myClass(): void { }
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The suppression applies to the annotated declaration and all of its members. For example, a `@jsii suppress`
|
|
117
|
+
directive on a class will suppress matching warnings on all methods and properties within that class.
|
|
118
|
+
|
|
119
|
+
Only warnings that reference a source code location can be suppressed inline. Warnings not tied to a specific node
|
|
120
|
+
(e.g. `JSII0003` for a missing README) are not affected.
|
|
121
|
+
|
|
98
122
|
## :balance_scale: License
|
|
99
123
|
|
|
100
124
|
**jsii** is distributed under the [Apache License, Version 2.0][apache-2.0].
|
package/lib/compiler.js
CHANGED
|
@@ -69,10 +69,12 @@ class Compiler {
|
|
|
69
69
|
//
|
|
70
70
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
71
71
|
host.afterProgramCreate = (builderProgram) => {
|
|
72
|
+
const startTime = Date.now();
|
|
72
73
|
const emitResult = this.consumeProgram(builderProgram.getProgram(), host.getDefaultLibLocation());
|
|
73
74
|
for (const diag of emitResult.diagnostics.filter((d) => d.code === exports.JSII_DIAGNOSTICS_CODE)) {
|
|
74
75
|
utils.logDiagnostic(diag, this.projectRoot);
|
|
75
76
|
}
|
|
77
|
+
console.log(utils.formatCompilationSummary(emitResult.diagnostics, emitResult.emitSkipped, Date.now() - startTime));
|
|
76
78
|
if (orig) {
|
|
77
79
|
orig.call(host, builderProgram);
|
|
78
80
|
}
|
package/lib/compiler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kCAAkC;AAClC,+BAA+B;AAC/B,iCA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,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 { 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';\nimport { isSilenced } from './warnings';\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 utils.JsiiError(\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 utils.JsiiError(\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(tsconf.compilerOptions, 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 // 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.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 utils.JsiiError(`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 utils.JsiiError(\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 && !isSilenced(d)),\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(options: ts.CompilerOptions, host: ts.CompilerHost | ts.WatchCompilerHost<any>): string[] {\n // Prefer user libraries, falling back to a library based on the target if not supplied by the user.\n // This matches tsc behavior.\n const libs = options.lib ?? [ts.getDefaultLibFileName(options)];\n if (libs.length === 0) {\n return [];\n }\n\n const libDir = host.getDefaultLibLocation?.();\n if (!libDir) {\n throw new Error(`Compiler host doesn't have a default library directory available for ${libs.join(', ')}`);\n }\n return libs.map((name) => path.join(libDir, 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"]}
|
|
1
|
+
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kCAAkC;AAClC,+BAA+B;AAC/B,iCAAiC;AACjC,iCAAiC;AAEjC,2CAAwC;AACxC,oDAA8D;AAE9D,uDAAmD;AAEnD,4EAA2E;AAC3E,yCAAiF;AACjF,kEAAoF;AACpF,sEAA0E;AAC1E,oDAAuD;AACvD,iCAAiC;AACjC,yCAAwC;AAExC,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;AACjC,QAAA,WAAW,GAAG,aAAa,CAAC;AAC5B,QAAA,qBAAqB,GAAG,IAAI,CAAC;AA0C1C,MAAa,QAAQ;IASnB,YAAoC,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAJpD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C,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 { 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';\nimport { isSilenced } from './warnings';\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 utils.JsiiError(\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 startTime = Date.now();\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 console.log(\n utils.formatCompilationSummary(emitResult.diagnostics, emitResult.emitSkipped, Date.now() - startTime),\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 utils.JsiiError(\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(tsconf.compilerOptions, 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 // 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.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 utils.JsiiError(`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 utils.JsiiError(\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 && !isSilenced(d)),\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(options: ts.CompilerOptions, host: ts.CompilerHost | ts.WatchCompilerHost<any>): string[] {\n // Prefer user libraries, falling back to a library based on the target if not supplied by the user.\n // This matches tsc behavior.\n const libs = options.lib ?? [ts.getDefaultLibFileName(options)];\n if (libs.length === 0) {\n return [];\n }\n\n const libDir = host.getDefaultLibLocation?.();\n if (!libDir) {\n throw new Error(`Compiler host doesn't have a default library directory available for ${libs.join(', ')}`);\n }\n return libs.map((name) => path.join(libDir, 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"]}
|
package/lib/directives.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare class Directives {
|
|
|
17
17
|
readonly ignore?: ts.JSDocComment | ts.JSDocTag;
|
|
18
18
|
/** Whether the node has the `@jsii struct` directive set. */
|
|
19
19
|
readonly struct?: ts.JSDocComment | ts.JSDocTag;
|
|
20
|
+
/** Suppression codes from `@jsii suppress <code>` directives. */
|
|
21
|
+
readonly suppressions: readonly string[];
|
|
20
22
|
private constructor();
|
|
21
23
|
}
|
|
22
24
|
//# sourceMappingURL=directives.d.ts.map
|
package/lib/directives.js
CHANGED
|
@@ -30,6 +30,9 @@ class Directives {
|
|
|
30
30
|
return directives;
|
|
31
31
|
}
|
|
32
32
|
constructor(node, onDiagnostic) {
|
|
33
|
+
/** Suppression codes from `@jsii suppress <code>` directives. */
|
|
34
|
+
this.suppressions = [];
|
|
35
|
+
const suppressions = [];
|
|
33
36
|
for (const tag of ts.getJSDocTags(node)) {
|
|
34
37
|
switch (tag.tagName.text) {
|
|
35
38
|
case 'internal':
|
|
@@ -42,10 +45,18 @@ class Directives {
|
|
|
42
45
|
continue;
|
|
43
46
|
}
|
|
44
47
|
for (const { text, jsdocNode } of comments) {
|
|
45
|
-
|
|
48
|
+
const [subcommand, ...rest] = text.split(/\s+/);
|
|
49
|
+
switch (subcommand) {
|
|
46
50
|
case 'ignore':
|
|
47
51
|
this.ignore ?? (this.ignore = jsdocNode);
|
|
48
52
|
break;
|
|
53
|
+
case 'suppress': {
|
|
54
|
+
const code = rest[0];
|
|
55
|
+
if (code) {
|
|
56
|
+
suppressions.push(code);
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
49
60
|
default:
|
|
50
61
|
onDiagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_2999_UNKNOWN_DIRECTIVE.create(jsdocNode, text));
|
|
51
62
|
break;
|
|
@@ -55,6 +66,7 @@ class Directives {
|
|
|
55
66
|
default: // Ignore
|
|
56
67
|
}
|
|
57
68
|
}
|
|
69
|
+
this.suppressions = suppressions;
|
|
58
70
|
}
|
|
59
71
|
}
|
|
60
72
|
exports.Directives = Directives;
|
package/lib/directives.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iCAAiC;AACjC,uDAAmD;AAEnD;;GAEG;AACH,MAAa,UAAU;IACrB;;;;;;OAMG;IACI,MAAM,CAAC,EAAE,CAAC,IAAa,EAAE,YAA4C;QAC1E,MAAM,KAAK,GAAG,uBAAA,EAAU,6BAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,EAAU,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACtD,uBAAA,EAAU,6BAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UA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AC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACtD,CAAC,CAAC;YACJ,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;IAED,yFAAyF;IACzF,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,SAAS,EAAa,EAAE;QAClD,IAAI,IAAY,CAAC;QACjB,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;YACvB,KAAK,EAAE,CAAC,UAAU,CAAC,SAAS;gBAC1B,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;gBACtB,MAAM;YACR,KAAK,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;YAC7B,KAAK,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC;YACjC,KAAK,EAAE,CAAC,UAAU,CAAC,cAAc;gBAC/B,IAAI,GAAG,SAAS,CAAC,IAAI;oBACnB,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,KAAK,SAAS,CAAC,IAAI,EAAE;oBAChF,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC;gBACnB,MAAM;QACV,CAAC;QACD,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as ts from 'typescript';\nimport { JsiiDiagnostic } from './jsii-diagnostic';\n\n/**\n * TSDoc-style directives that can be attached to a symbol.\n */\nexport class Directives {\n /**\n * Obtains the `Directives` for a given TypeScript AST node.\n *\n * @param node the node for which directives are requested.\n * @param onDiagnostic a callback invoked whenever a diagnostic message is\n * emitted when parsing directives.\n */\n public static of(node: ts.Node, onDiagnostic: (diag: JsiiDiagnostic) => void): Directives {\n const found = Directives.#CACHE.get(node);\n if (found != null) {\n return found;\n }\n\n const directives = new Directives(node, onDiagnostic);\n Directives.#CACHE.set(node, directives);\n return directives;\n }\n\n static readonly #CACHE = new WeakMap<ts.Node, Directives>();\n\n /** Whether the node has the `@internal` JSDoc tag. */\n public readonly tsInternal?: ts.JSDocTag;\n /** Whether the node has the `@jsii ignore` directive set. */\n public readonly ignore?: ts.JSDocComment | ts.JSDocTag;\n /** Whether the node has the `@jsii struct` directive set. */\n public readonly struct?: ts.JSDocComment | ts.JSDocTag;\n /** Suppression codes from `@jsii suppress <code>` directives. */\n public readonly suppressions: readonly string[] = [];\n\n private constructor(node: ts.Node, onDiagnostic: (diag: JsiiDiagnostic) => void) {\n const suppressions: string[] = [];\n for (const tag of ts.getJSDocTags(node)) {\n switch (tag.tagName.text) {\n case 'internal':\n this.tsInternal ??= tag;\n break;\n case 'jsii':\n const comments = getComments(tag);\n if (comments.length === 0) {\n onDiagnostic(JsiiDiagnostic.JSII_2000_MISSING_DIRECTIVE_ARGUMENT.create(tag));\n continue;\n }\n for (const { text, jsdocNode } of comments) {\n const [subcommand, ...rest] = text.split(/\\s+/);\n switch (subcommand) {\n case 'ignore':\n this.ignore ??= jsdocNode;\n break;\n case 'suppress': {\n const code = rest[0];\n if (code) {\n suppressions.push(code);\n }\n break;\n }\n default:\n onDiagnostic(JsiiDiagnostic.JSII_2999_UNKNOWN_DIRECTIVE.create(jsdocNode, text));\n break;\n }\n }\n break;\n default: // Ignore\n }\n }\n this.suppressions = suppressions;\n }\n}\n\nfunction getComments(tag: ts.JSDocTag): Comment[] {\n if (tag.comment == null) {\n return [];\n }\n\n if (typeof tag.comment === 'string') {\n const text = tag.comment.trim();\n return text\n ? text.split(/[\\n,]/).flatMap((line) => {\n line = line.trim();\n return line ? [{ text: line, jsdocNode: tag }] : [];\n })\n : [];\n }\n\n // Possible per the type signature in the compiler, however not sure in which conditions.\n return tag.comment.flatMap((jsdocNode): Comment[] => {\n let text: string;\n switch (jsdocNode.kind) {\n case ts.SyntaxKind.JSDocText:\n text = jsdocNode.text;\n break;\n case ts.SyntaxKind.JSDocLink:\n case ts.SyntaxKind.JSDocLinkCode:\n case ts.SyntaxKind.JSDocLinkPlain:\n text = jsdocNode.name\n ? `${jsdocNode.name.getText(jsdocNode.name.getSourceFile())}: ${jsdocNode.text}`\n : jsdocNode.text;\n break;\n }\n text = text.trim();\n return text ? [{ text, jsdocNode }] : [];\n });\n}\n\ninterface Comment {\n readonly text: string;\n readonly jsdocNode: ts.JSDocComment | ts.JSDocTag;\n}\n"]}
|
package/lib/literate.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.fileSystemLoader = fileSystemLoader;
|
|
|
8
8
|
/**
|
|
9
9
|
* A tiny module to include annotated (working!) code snippets into the documentation
|
|
10
10
|
*
|
|
11
|
-
* Not using 'literate-programming' or '
|
|
11
|
+
* Not using 'literate-programming' or 'erasmus' projects because they work
|
|
12
12
|
* the other way around: take code from MarkDown, save it as a file, then
|
|
13
13
|
* execute that.
|
|
14
14
|
*
|
package/lib/literate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literate.js","sourceRoot":"","sources":["../src/literate.ts"],"names":[],"mappings":";;AAgEA,gEAIC;AAiBD,4DAqBC;AAKD,oCAGC;AAKD,wCAEC;AAKD,4CAKC;AAnID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,8BAA8B;AAC9B,kCAAkC;AAElC;;GAEG;AACH,SAAgB,0BAA0B,CAAC,KAAe,EAAE,oBAA8B;IACxF,MAAM,aAAa,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,aAAa,GAAG,WAAW,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;IACvE,OAAO,aAAa,CAAC;AACvB,CAAC;AASD;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAC,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AAE,GAAG,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["/**\n * A tiny module to include annotated (working!) code snippets into the documentation\n *\n * Not using 'literate-programming' or '
|
|
1
|
+
{"version":3,"file":"literate.js","sourceRoot":"","sources":["../src/literate.ts"],"names":[],"mappings":";;AAgEA,gEAIC;AAiBD,4DAqBC;AAKD,oCAGC;AAKD,wCAEC;AAKD,4CAKC;AAnID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,8BAA8B;AAC9B,kCAAkC;AAElC;;GAEG;AACH,SAAgB,0BAA0B,CAAC,KAAe,EAAE,oBAA8B;IACxF,MAAM,aAAa,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,aAAa,GAAG,WAAW,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;IACvE,OAAO,aAAa,CAAC;AACvB,CAAC;AASD;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAC,KAAe,EAAE,MAAkB,EAAE,WAAmB;IAC/F,MAAM,GAAG,GAAa,EAAE,CAAC;IAEzB,MAAM,KAAK,GAAG,oCAAoC,CAAC;IACnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,EAAE,CAAC;YACN,mBAAmB;YACnB,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACtB,4CAA4C;YAC5C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;YACrD,oFAAoF;YACpF,4CAA4C;YAC5C,MAAM,QAAQ,GAAG,0BAA0B,CAAC,MAAM,EAAE,CAAC,OAAO,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAA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,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,EAAE,CAAC;IAEV,OAAO,GAAG,CAAC;IAEX;;OAEG;IACH,SAAS,OAAO;QACd,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjC,2CAA2C;YAC3C,GAAG,CAAC,IAAI,CACN,WAAW,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EACxF,GAAG,eAAe,EAClB,KAAK,CACN,CAAC;YACF,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ;QACrC,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["/**\n * A tiny module to include annotated (working!) code snippets into the documentation\n *\n * Not using 'literate-programming' or 'erasmus' projects because they work\n * the other way around: take code from MarkDown, save it as a file, then\n * execute that.\n *\n * We do the opposite: start from source code annotated with MarkDown and\n * extract it into (larger) MarkDown files.\n *\n * Including into README\n * ---------------------\n *\n * To include the examples directly into the README, make a link to the\n * annotated TypeScript file on a line by itself, and make sure the\n * extension of the file ends in `.lit.ts`.\n *\n * For example:\n *\n * [example](test/integ.bucket.lit.ts)\n *\n * Annotating source\n * -----------------\n *\n * We use the triple-slash comment for our directives, since it's valid TypeScript\n * and are treated as regular comments if not the very first thing in the file.\n *\n * By default, the whole file is included, unless the source contains the statement\n * \"/// !show\". For example:\n *\n * a\n * /// !show\n * b\n * /// !hide\n * c\n *\n * In this example, only 'b' would be included in the output. A single file may\n * switching including and excluding on and off multiple times in the same file.\n *\n * Other lines starting with triple slashes will be rendered as Markdown in between\n * the source lines. For example:\n *\n * const x = 1;\n * /// Now we're going to print x:\n * console.log(x);\n *\n * Will be rendered as:\n *\n * ```ts\n * const x = 1;\n * ```\n *\n * Now we're going to print x:\n *\n * ```ts\n * console.log(x);\n * ```\n */\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\n/**\n * Convert an annotated TypeScript source file to MarkDown\n */\nexport function typescriptSourceToMarkdown(lines: string[], codeBlockAnnotations: string[]): string[] {\n const relevantLines = findRelevantLines(lines);\n const markdownLines = markdownify(relevantLines, codeBlockAnnotations);\n return markdownLines;\n}\n\nexport interface LoadedFile {\n readonly fullPath: string;\n readonly lines: string[];\n}\n\nexport type FileLoader = (relativePath: string) => LoadedFile;\n\n/**\n * Given MarkDown source, find source files to include and render\n *\n * We recognize links on a line by themselves if the link text starts\n * with the string \"example\" (case insensitive). For example:\n *\n * [example](test/integ.bucket.ts)\n */\nexport function includeAndRenderExamples(lines: string[], loader: FileLoader, projectRoot: string): string[] {\n const ret: string[] = [];\n\n const regex = /^\\[([^\\]]*)\\]\\(([^)]+\\.lit\\.ts)\\)/i;\n for (const line of lines) {\n const m = regex.exec(line);\n if (m) {\n // Found an include\n const filename = m[2];\n // eslint-disable-next-line no-await-in-loop\n const { lines: source, fullPath } = loader(filename);\n // 'lit' source attribute will make snippet compiler know to extract the same source\n // Needs to be relative to the project root.\n const imported = typescriptSourceToMarkdown(source, [`lit=${toUnixPath(path.relative(projectRoot, fullPath))}`]);\n ret.push(...imported);\n } else {\n ret.push(line);\n }\n }\n\n return ret;\n}\n\n/**\n * Load a file into a string array\n */\nexport function loadFromFile(fileName: string): string[] {\n const content = fs.readFileSync(fileName, { encoding: 'utf-8' });\n return contentToLines(content);\n}\n\n/**\n * Turn file content string into an array of lines ready for processing using the other functions\n */\nexport function contentToLines(content: string): string[] {\n return content.split('\\n').map((x) => x.trimRight());\n}\n\n/**\n * Return a file system loader given a base directory\n */\nexport function fileSystemLoader(directory: string): FileLoader {\n return (fileName) => {\n const fullPath = path.resolve(directory, fileName);\n return { fullPath, lines: loadFromFile(fullPath) };\n };\n}\n\nconst RELEVANT_TAG = '/// !show';\nconst DETAIL_TAG = '/// !hide';\nconst INLINE_MD_REGEX = /^\\s*\\/\\/\\/ (.*)$/;\n\n/**\n * Find the relevant lines of the input source\n *\n * Respects switching tags, returns everything if no switching found.\n *\n * Strips common indentation from the blocks it finds.\n */\nfunction findRelevantLines(lines: string[]): string[] {\n let inRelevant = false;\n let didFindRelevant = false;\n const ret: string[] = [];\n\n for (const line of lines) {\n if (line.trim() === RELEVANT_TAG) {\n inRelevant = true;\n didFindRelevant = true;\n } else if (line.trim() === DETAIL_TAG) {\n inRelevant = false;\n } else {\n if (inRelevant) {\n ret.push(line);\n }\n }\n }\n\n // Return full lines list if no switching found\n return stripCommonIndent(didFindRelevant ? ret : lines);\n}\n\n/**\n * Remove common leading whitespace from the given lines\n */\nfunction stripCommonIndent(lines: string[]): string[] {\n const leadingWhitespace = /^(\\s*)/;\n const indents = lines.map((l) => leadingWhitespace.exec(l)![1].length);\n const commonIndent = Math.min(...indents);\n return lines.map((l) => l.slice(commonIndent));\n}\n\n/**\n * Turn source lines into Markdown, starting in TypeScript mode\n */\nfunction markdownify(lines: string[], codeBlockAnnotations: string[]): string[] {\n const typescriptLines: string[] = [];\n const ret: string[] = [];\n\n for (const line of lines) {\n const m = INLINE_MD_REGEX.exec(line);\n if (m) {\n // Literal MarkDown line\n flushTS();\n ret.push(m[1]);\n } else {\n typescriptLines.push(line);\n }\n }\n\n flushTS();\n\n return ret;\n\n /**\n * Flush typescript lines with a triple-backtick-ts block around it.\n */\n function flushTS() {\n if (typescriptLines.length !== 0) {\n // eslint-disable-next-line prefer-template\n ret.push(\n `\\`\\`\\`ts${codeBlockAnnotations.length > 0 ? ` ${codeBlockAnnotations.join(' ')}` : ''}`,\n ...typescriptLines,\n '```',\n );\n typescriptLines.splice(0); // Clear\n }\n }\n}\n\nfunction toUnixPath(x: string) {\n return x.replace(/\\\\/g, '/');\n}\n"]}
|
package/lib/main.js
CHANGED
|
@@ -143,11 +143,13 @@ const ruleSets = {
|
|
|
143
143
|
validateTypeScriptConfig,
|
|
144
144
|
compressAssembly: argv['compress-assembly'],
|
|
145
145
|
});
|
|
146
|
+
const startTime = Date.now();
|
|
146
147
|
const emitResult = argv.watch ? await compiler.watch() : compiler.emit();
|
|
147
148
|
const allDiagnostics = [...projectInfoDiagnostics, ...emitResult.diagnostics];
|
|
148
149
|
for (const diagnostic of allDiagnostics) {
|
|
149
150
|
utils.logDiagnostic(diagnostic, projectRoot);
|
|
150
151
|
}
|
|
152
|
+
console.log(utils.formatCompilationSummary(allDiagnostics, emitResult.emitSkipped, Date.now() - startTime));
|
|
151
153
|
if (emitResult.emitSkipped) {
|
|
152
154
|
process.exitCode = 1;
|
|
153
155
|
}
|
package/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,C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E;aACF;YACD,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;gBAClB,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE;oBACN,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;iBACjD;aACF;SACF;QACD,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;YACvD,CAAC,KAAK,CAAC,UAAU,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"]}
|
|
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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AO,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 startTime = Date.now();\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\n console.log(utils.formatCompilationSummary(allDiagnostics, emitResult.emitSkipped, Date.now() - startTime));\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.d.ts
CHANGED
|
@@ -42,6 +42,10 @@ export declare function formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot:
|
|
|
42
42
|
*/
|
|
43
43
|
export declare function _formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string): string;
|
|
44
44
|
export declare function logDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Format a compilation summary with status line and counts line.
|
|
47
|
+
*/
|
|
48
|
+
export declare function formatCompilationSummary(diagnostics: readonly ts.Diagnostic[], emitSkipped: boolean, elapsedMs: number): string;
|
|
45
49
|
/**
|
|
46
50
|
* Parses a string-formatted person entry from `package.json`.
|
|
47
51
|
* @param value the string-formatted person entry.
|
package/lib/utils.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.diagnosticsLogger = diagnosticsLogger;
|
|
|
5
5
|
exports.formatDiagnostic = formatDiagnostic;
|
|
6
6
|
exports._formatDiagnostic = _formatDiagnostic;
|
|
7
7
|
exports.logDiagnostic = logDiagnostic;
|
|
8
|
+
exports.formatCompilationSummary = formatCompilationSummary;
|
|
8
9
|
exports.parsePerson = parsePerson;
|
|
9
10
|
exports.parseRepository = parseRepository;
|
|
10
11
|
exports.stripAnsi = stripAnsi;
|
|
@@ -88,9 +89,7 @@ function _formatDiagnostic(diagnostic, projectRoot) {
|
|
|
88
89
|
getCanonicalFileName: (fileName) => fileName,
|
|
89
90
|
getNewLine: () => ts.sys.newLine,
|
|
90
91
|
};
|
|
91
|
-
const message = diagnostic
|
|
92
|
-
? ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost)
|
|
93
|
-
: ts.formatDiagnostic(diagnostic, formatDiagnosticsHost);
|
|
92
|
+
const message = ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost);
|
|
94
93
|
if (!jsii_diagnostic_1.JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {
|
|
95
94
|
return message;
|
|
96
95
|
}
|
|
@@ -117,6 +116,31 @@ function logDiagnostic(diagnostic, projectRoot) {
|
|
|
117
116
|
}
|
|
118
117
|
logFunc(formatDiagnostic(diagnostic, projectRoot).trim());
|
|
119
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Format a compilation summary with status line and counts line.
|
|
121
|
+
*/
|
|
122
|
+
function formatCompilationSummary(diagnostics, emitSkipped, elapsedMs) {
|
|
123
|
+
let errors = 0;
|
|
124
|
+
let warnings = 0;
|
|
125
|
+
let silenced = 0;
|
|
126
|
+
for (const d of diagnostics) {
|
|
127
|
+
if (d.category === ts.DiagnosticCategory.Error) {
|
|
128
|
+
errors++;
|
|
129
|
+
}
|
|
130
|
+
else if (d.category === ts.DiagnosticCategory.Warning) {
|
|
131
|
+
if ((0, warnings_1.isSilenced)(d)) {
|
|
132
|
+
silenced++;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
warnings++;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const status = emitSkipped ? '❌ Failed with errors' : warnings > 0 ? '✨ Successful with warnings' : '✨ Successful';
|
|
140
|
+
const parts = [`Errors: ${errors}`, `Warnings: ${warnings}${silenced > 0 ? ` (+${silenced} silenced)` : ''}`];
|
|
141
|
+
parts.push(`Time: ${(elapsedMs / 1000).toFixed(2)}s`);
|
|
142
|
+
return `\n${status}\n${parts.join(' | ')}`;
|
|
143
|
+
}
|
|
120
144
|
const PERSON_REGEX = /^\s*(.+?)(?:\s*<([^>]+)>)?(?:\s*\(([^)]+)\))?\s*$/;
|
|
121
145
|
/**
|
|
122
146
|
* Parses a string-formatted person entry from `package.json`.
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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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EAAE,CAAC;QACX,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACxB,CAAC;IACD,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC;IAC7B,QAAQ,IAAI,IAAI,QAAQ,EAAE,CAAC;QACzB,KAAK,QAAQ;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 { 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"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AA2BA,8CA2BC;AAUD,4CAMC;AAYD,8CAyBC;AAED,sCASC;AAKD,4DA0BC;AAWD,kCAgBC;AAGD,0CAkBC;AAMD,8BAEC;AA7MD,iCAAiC;AACjC,iCAAiC;AAEjC,uDAAyD;AACzD,yCAAwC;AAExC;;GAEG;AACU,QAAA,UAAU,GAAG,UAAU,CAAC;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C;IAC7B,QAAQ,IAAI,IAAI,QAAQ,EAAE,CAAC;QACzB,KAAK,QAAQ;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 { 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 = ts.formatDiagnosticsWithColorAndContext([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\n/**\n * Format a compilation summary with status line and counts line.\n */\nexport function formatCompilationSummary(\n diagnostics: readonly ts.Diagnostic[],\n emitSkipped: boolean,\n elapsedMs: number,\n): string {\n let errors = 0;\n let warnings = 0;\n let silenced = 0;\n for (const d of diagnostics) {\n if (d.category === ts.DiagnosticCategory.Error) {\n errors++;\n } else if (d.category === ts.DiagnosticCategory.Warning) {\n if (isSilenced(d)) {\n silenced++;\n } else {\n warnings++;\n }\n }\n }\n\n const status = emitSkipped ? '❌ Failed with errors' : warnings > 0 ? '✨ Successful with warnings' : '✨ Successful';\n\n const parts = [`Errors: ${errors}`, `Warnings: ${warnings}${silenced > 0 ? ` (+${silenced} silenced)` : ''}`];\n parts.push(`Time: ${(elapsedMs / 1000).toFixed(2)}s`);\n\n return `\\n${status}\\n${parts.join(' | ')}`;\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/validator.js
CHANGED
|
@@ -47,9 +47,11 @@ function _defaultValidations() {
|
|
|
47
47
|
if (!spec.isEnumType(type)) {
|
|
48
48
|
continue;
|
|
49
49
|
}
|
|
50
|
+
const enumNode = bindings.getEnumRelatedNode(type);
|
|
50
51
|
for (const member of type.members) {
|
|
51
52
|
if (member.name && !isConstantCase(member.name)) {
|
|
52
|
-
|
|
53
|
+
const memberNode = enumNode?.members.find((m) => m.name.getText() === member.name);
|
|
54
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_8001_ALL_CAPS_ENUM_MEMBERS.create(memberNode?.name ?? declarationName(enumNode), member.name, type.fqn));
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
}
|
|
@@ -60,7 +62,7 @@ function _defaultValidations() {
|
|
|
60
62
|
continue;
|
|
61
63
|
}
|
|
62
64
|
if (member.name && member.name !== Case.camel(member.name)) {
|
|
63
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_8002_CAMEL_CASED_MEMBERS.
|
|
65
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_8002_CAMEL_CASED_MEMBERS.create(declarationName(bindings.getRelatedNode(member)), member.name, type.fqn));
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
}
|
|
@@ -73,7 +75,7 @@ function _defaultValidations() {
|
|
|
73
75
|
!isConstantCase(member.name) &&
|
|
74
76
|
member.name !== Case.pascal(member.name) &&
|
|
75
77
|
member.name !== Case.camel(member.name)) {
|
|
76
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_8003_STATIC_CONST_CASING.
|
|
78
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_8003_STATIC_CONST_CASING.create(declarationName(bindings.getRelatedNode(member)), member.name, type.name));
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
}
|
|
@@ -84,10 +86,10 @@ function _defaultValidations() {
|
|
|
84
86
|
}
|
|
85
87
|
const snakeName = Case.snake(member.name);
|
|
86
88
|
if (snakeName.startsWith('get_') && _isEmpty(member.parameters)) {
|
|
87
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5000_JAVA_GETTERS.
|
|
89
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5000_JAVA_GETTERS.create(declarationName(bindings.getRelatedNode(member)), member.name, type.name));
|
|
88
90
|
}
|
|
89
91
|
else if (snakeName.startsWith('set_') && (member.parameters ?? []).length === 1) {
|
|
90
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5001_JAVA_SETTERS.
|
|
92
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5001_JAVA_SETTERS.create(declarationName(bindings.getRelatedNode(member)), member.name, type.name));
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
}
|
|
@@ -103,11 +105,11 @@ function _defaultValidations() {
|
|
|
103
105
|
}
|
|
104
106
|
const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);
|
|
105
107
|
if (!foreignAssm) {
|
|
106
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_9000_UNKNOWN_MODULE.
|
|
108
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_9000_UNKNOWN_MODULE.create(typeRef.node, assm));
|
|
107
109
|
continue;
|
|
108
110
|
}
|
|
109
111
|
if (!(typeRef.fqn in (foreignAssm.types ?? {}))) {
|
|
110
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_9001_TYPE_NOT_FOUND.
|
|
112
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_9001_TYPE_NOT_FOUND.create(typeRef.node, typeRef));
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
}
|
|
@@ -263,10 +265,12 @@ function _defaultValidations() {
|
|
|
263
265
|
return false;
|
|
264
266
|
}
|
|
265
267
|
function _assertSignaturesMatch(expected, actual, label, action, opts) {
|
|
268
|
+
const actualNode = bindings.getMethodRelatedNode(actual);
|
|
269
|
+
const expectedNode = bindings.getMethodRelatedNode(expected);
|
|
266
270
|
if (!!expected.protected !== !!actual.protected) {
|
|
267
271
|
const expVisibility = expected.protected ? 'protected' : 'public';
|
|
268
272
|
const actVisibility = actual.protected ? 'protected' : 'public';
|
|
269
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.
|
|
273
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.create(actualNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword) ?? declarationName(actualNode), label, action, actVisibility, expVisibility).maybeAddRelatedInformation(expectedNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword) ?? declarationName(expectedNode), 'The implemented declaration is here.'));
|
|
270
274
|
}
|
|
271
275
|
// Types must generally be the same, but can be covariant sometimes
|
|
272
276
|
if (!deepEqual(actual.returns, expected.returns)) {
|
|
@@ -284,27 +288,29 @@ function _defaultValidations() {
|
|
|
284
288
|
else {
|
|
285
289
|
const expType = spec.describeTypeReference(expectedReturnType);
|
|
286
290
|
const actType = spec.describeTypeReference(actualReturnType);
|
|
287
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.
|
|
291
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.create(actualNode?.type ?? declarationName(actualNode), label, action, actType, expType).maybeAddRelatedInformation(expectedNode?.type ?? declarationName(expectedNode), 'The implemented declaration is here.'));
|
|
288
292
|
}
|
|
289
293
|
}
|
|
290
294
|
const expectedParams = expected.parameters ?? [];
|
|
291
295
|
const actualParams = actual.parameters ?? [];
|
|
292
296
|
if (expectedParams.length !== actualParams.length) {
|
|
293
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5005_OVERRIDE_CHANGES_PARAM_COUNT.
|
|
297
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5005_OVERRIDE_CHANGES_PARAM_COUNT.create(declarationName(actualNode), label, action, actualParams.length, expectedParams.length).maybeAddRelatedInformation(declarationName(expectedNode), 'The implemented declaration is here.'));
|
|
294
298
|
return;
|
|
295
299
|
}
|
|
296
300
|
for (let i = 0; i < expectedParams.length; i++) {
|
|
297
301
|
const expParam = expectedParams[i];
|
|
298
302
|
const actParam = actualParams[i];
|
|
303
|
+
const actParamNode = bindings.getRelatedNode(actParam);
|
|
304
|
+
const expParamNode = bindings.getRelatedNode(expParam);
|
|
299
305
|
if (!deepEqual(expParam.type, actParam.type)) {
|
|
300
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5006_OVERRIDE_CHANGES_PARAM_TYPE.
|
|
306
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5006_OVERRIDE_CHANGES_PARAM_TYPE.create(actParamNode?.type ?? declarationName(actParamNode), label, action, actParam, expParam).maybeAddRelatedInformation(expParamNode?.type ?? declarationName(expParamNode), 'The implemented declaration is here.'));
|
|
301
307
|
}
|
|
302
308
|
// Not-ing those to force the values to a strictly boolean context (they're optional, undefined means false)
|
|
303
309
|
if (expParam.variadic !== actParam.variadic) {
|
|
304
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5007_OVERRIDE_CHANGES_VARIADIC.
|
|
310
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5007_OVERRIDE_CHANGES_VARIADIC.create(actParamNode?.dotDotDotToken ?? declarationName(actParamNode), label, action, actParam.variadic, expParam.variadic).maybeAddRelatedInformation(expParamNode?.dotDotDotToken ?? declarationName(expParamNode), 'The implemented declaration is here.'));
|
|
305
311
|
}
|
|
306
312
|
if (expParam.optional !== actParam.optional) {
|
|
307
|
-
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5008_OVERRIDE_CHANGES_PARAM_OPTIONAL.
|
|
313
|
+
diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5008_OVERRIDE_CHANGES_PARAM_OPTIONAL.create(actParamNode?.questionToken ?? actParamNode?.type ?? declarationName(actParamNode), label, action, actParam, expParam).maybeAddRelatedInformation(expParamNode?.questionToken ?? expParamNode?.type ?? declarationName(expParamNode), 'The implemented declaration is here.'));
|
|
308
314
|
}
|
|
309
315
|
}
|
|
310
316
|
}
|
package/lib/validator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,mCAAmC;AACnC,6CAA6C;AAC7C,iCAAiC;AACjC,+BAA+B;AAE/B,uDAAmD;AACnD,mDAAiD;AACjD,4CAA4C;AAE5C,mDAA4D;AAC5D,qDAAsD;AAMtD,MAAa,SAAS;IAGpB,YAAmC,WAAwB,EAAkB,QAAuB;QAAjE,gBAAW,GAAX,WAAW,CAAa;QAAkB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAEjG,IAAI;QACT,MAAM,WAAW,GAAG,IAAI,KAAK,EAAiB,CAAC;QAC/C,MAAM,YAAY,GAAG,IAAI,KAAK,EAAoB,CAAC;QAEnD,KAAK,MAAM,UAAU,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;YAC/C,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAC5G,CAAC;QAED,OAAO;YACL,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,WAAW,CAAC,IAAI,C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,CAAC;YAC3C,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK;gBAAE,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,eAAe,CAAC,IAAgD;IACvE,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,gGAAgG;QAChG,OAAO,IAAW,CAAC;IACrB,CAAC;IACD,OAAO,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC/C,CAAC","sourcesContent":["import * as assert from 'node:assert';\nimport * as spec from '@jsii/spec';\nimport * as deepEqual from 'fast-deep-equal';\nimport * as ts from 'typescript';\nimport * as Case from './case';\nimport { Emitter } from './emitter';\nimport { JsiiDiagnostic } from './jsii-diagnostic';\nimport { getRelatedNode } from './node-bindings';\nimport * as bindings from './node-bindings';\nimport { ProjectInfo } from './project-info';\nimport { isAllowedCovariantSubtype } from './type-analysis';\nimport { createTypeResolver } from './type-reference';\n\nexport interface ValidationResult extends ts.EmitResult {\n readonly usedFeatures?: spec.JsiiFeature[];\n}\n\nexport class Validator implements Emitter {\n public static VALIDATIONS: ValidationFunction[] = _defaultValidations();\n\n public constructor(public readonly projectInfo: ProjectInfo, public readonly assembly: spec.Assembly) {}\n\n public emit(): ValidationResult {\n const diagnostics = new Array<ts.Diagnostic>();\n const usedFeatures = new Array<spec.JsiiFeature>();\n\n for (const validation of Validator.VALIDATIONS) {\n validation(this, this.assembly, diagnostics.push.bind(diagnostics), usedFeatures.push.bind(usedFeatures));\n }\n\n return {\n diagnostics: diagnostics,\n emitSkipped: diagnostics.some((diag) => diag.category === ts.DiagnosticCategory.Error),\n usedFeatures,\n };\n }\n}\n\nexport type DiagnosticEmitter = (diag: JsiiDiagnostic) => void;\nexport type FeatureTracker = (feat: spec.JsiiFeature) => void;\nexport type ValidationFunction = (\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n useFeatures: FeatureTracker,\n) => void;\n\nfunction _defaultValidations(): ValidationFunction[] {\n return [\n _enumMembersMustUserUpperSnakeCase,\n _memberNamesMustUseCamelCase,\n _staticConstantNamesMustUseUpperSnakeCase,\n _memberNamesMustNotLookLikeJavaGettersOrSetters,\n _allTypeReferencesAreValid,\n _inheritanceDoesNotChangeContracts,\n _staticMembersAndNestedTypesMustNotSharePascalCaseName,\n _abstractClassesMustImplementAllProperties,\n ];\n\n function _enumMembersMustUserUpperSnakeCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const type of _allTypes(assembly)) {\n if (!spec.isEnumType(type)) {\n continue;\n }\n\n for (const member of type.members) {\n if (member.name && !isConstantCase(member.name)) {\n diagnostic(JsiiDiagnostic.JSII_8001_ALL_CAPS_ENUM_MEMBERS.createDetached(member.name, type.fqn));\n }\n }\n }\n }\n\n function _memberNamesMustUseCamelCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const { member, type } of _allMembers(assembly)) {\n if (member.static && (member as spec.Property).const) {\n continue;\n }\n if (member.name && member.name !== Case.camel(member.name)) {\n diagnostic(JsiiDiagnostic.JSII_8002_CAMEL_CASED_MEMBERS.createDetached(member.name, type.fqn));\n }\n }\n }\n\n function _staticConstantNamesMustUseUpperSnakeCase(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.static || !(member as spec.Property).const) {\n continue;\n }\n if (\n member.name &&\n !isConstantCase(member.name) &&\n member.name !== Case.pascal(member.name) &&\n member.name !== Case.camel(member.name)\n ) {\n diagnostic(JsiiDiagnostic.JSII_8003_STATIC_CONST_CASING.createDetached(member.name, type.name));\n }\n }\n }\n\n function _memberNamesMustNotLookLikeJavaGettersOrSetters(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.name) {\n continue;\n }\n const snakeName = Case.snake(member.name);\n if (snakeName.startsWith('get_') && _isEmpty((member as spec.Method).parameters)) {\n diagnostic(JsiiDiagnostic.JSII_5000_JAVA_GETTERS.createDetached(member.name, type.name));\n } else if (snakeName.startsWith('set_') && ((member as spec.Method).parameters ?? []).length === 1) {\n diagnostic(JsiiDiagnostic.JSII_5001_JAVA_SETTERS.createDetached(member.name, type.name));\n }\n }\n }\n\n function _allTypeReferencesAreValid(validator: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const typeRef of _allTypeReferences(assembly)) {\n const [assm] = typeRef.fqn.split('.');\n if (assembly.name === assm) {\n if (!(typeRef.fqn in (assembly.types ?? {}))) {\n diagnostic(\n JsiiDiagnostic.JSII_3000_EXPORTED_API_USES_HIDDEN_TYPE.create(\n typeRef.node!, // Pretend there is always a value\n typeRef.fqn,\n ),\n );\n }\n continue;\n }\n const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);\n if (!foreignAssm) {\n diagnostic(JsiiDiagnostic.JSII_9000_UNKNOWN_MODULE.createDetached(assm));\n continue;\n }\n if (!(typeRef.fqn in (foreignAssm.types ?? {}))) {\n diagnostic(JsiiDiagnostic.JSII_9001_TYPE_NOT_FOUND.createDetached(typeRef));\n }\n }\n }\n\n function _inheritanceDoesNotChangeContracts(\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n useFeature: FeatureTracker,\n ) {\n const _dereference = createTypeResolver(assembly, validator.projectInfo.dependencyClosure);\n\n for (const type of _allTypes(assembly)) {\n if (spec.isClassType(type)) {\n for (const method of type.methods ?? []) {\n _validateMethodOverride(method, type);\n }\n for (const property of type.properties ?? []) {\n _validatePropertyOverride(property, type);\n }\n }\n if (spec.isClassOrInterfaceType(type) && (type.interfaces?.length ?? 0) > 0) {\n for (const method of _allImplementations(type, (t) => t.methods)) {\n _validateMethodImplementation(method, type);\n }\n for (const property of _allImplementations(type, (t) => t.properties)) {\n _validatePropertyImplementation(property, type);\n }\n }\n }\n\n /**\n * Lists all \"implementations\" from the given type, using the provided\n * implementation getter. Note that abstract members may be part of the\n * result (in particular, if `type` is an interface type, or if it's an\n * abstract class with unimplemented members) -- I just couldn't come up\n * with a name that actually describes this.\n *\n * @param type the type which implemented members are needed.\n * @param getter the getter to obtain methods or properties from the type.\n *\n * @returns a list of members (possibly empty, always defined)\n */\n function _allImplementations<T extends spec.Property | spec.Method>(\n type: spec.ClassType | spec.InterfaceType,\n getter: (type: spec.ClassType | spec.InterfaceType) => T[] | undefined,\n ): T[] {\n const result = new Array<T>();\n const known = new Set<string>();\n\n for (const member of getter(type) ?? []) {\n result.push(member);\n known.add(member.name);\n }\n\n if (spec.isClassType(type) && type.base) {\n // We have a parent class, collect their concrete members, too (recursively)...\n const base = _dereference(type.base);\n assert(base != null && spec.isClassType(base));\n for (const member of _allImplementations(base, getter)) {\n if (known.has(member.name)) {\n continue;\n }\n // The member is copied, so that its `overrides` property won't be\n // altered, since this member is \"borrowed\" from a parent type. We\n // only check it, but should not record `overrides` relationships to\n // it as those could be invalid per the parent type (i.e: the parent\n // member may not be able to implement an interface, if that type does\n // not actually declare implementing that).\n const memberCopy = { ...member };\n // Forward the related node if there's one, so diagnostics are bound.\n const node = bindings.getRelatedNode(member);\n if (node != null) {\n bindings.setRelatedNode(memberCopy, node);\n }\n\n result.push(memberCopy);\n known.add(member.name);\n }\n }\n\n return result;\n }\n\n function _validateMethodOverride(method: spec.Method, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.methods ?? []).find((m) => m.name === method.name);\n if (!overridden) {\n return _validateMethodOverride(method, baseType);\n }\n _assertSignaturesMatch(overridden, method, `${type.fqn}#${method.name}`, `overriding ${baseType.fqn}`, {\n allowReturnTypeCovariance: true,\n });\n method.overrides = baseType.fqn;\n return true;\n }\n\n function _validatePropertyOverride(property: spec.Property, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.properties ?? []).find((p) => p.name === property.name);\n if (!overridden) {\n return _validatePropertyOverride(property, baseType);\n }\n _assertPropertiesMatch(overridden, property, `${type.fqn}#${property.name}`, `overriding ${baseType.fqn}`, {\n allowCovariance: true,\n });\n property.overrides = baseType.fqn;\n return true;\n }\n\n function _validateMethodImplementation(method: spec.Method, type: spec.ClassType | spec.InterfaceType): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validateMethodImplementation(method, _dereference(type.base) as spec.ClassType);\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface) as spec.InterfaceType;\n const implemented = (ifaceType.methods ?? []).find((m) => m.name === method.name);\n if (implemented) {\n _assertSignaturesMatch(implemented, method, `${type.fqn}#${method.name}`, `implementing ${ifaceType.fqn}`, {\n allowReturnTypeCovariance: false,\n });\n // We won't replace a previous overrides declaration from a method override, as those have\n // higher precedence than an initial implementation.\n method.overrides = method.overrides ?? iface;\n return true;\n }\n if (_validateMethodImplementation(method, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _validatePropertyImplementation(\n property: spec.Property,\n type: spec.ClassType | spec.InterfaceType,\n ): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validatePropertyImplementation(property, _dereference(type.base) as spec.ClassType);\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface) as spec.InterfaceType;\n const implemented = (ifaceType.properties ?? []).find((p) => p.name === property.name);\n if (implemented) {\n _assertPropertiesMatch(\n implemented,\n property,\n `${type.fqn}#${property.name}`,\n `implementing ${ifaceType.fqn}`,\n { allowCovariance: false },\n );\n // We won't replace a previous overrides declaration from a property override, as those\n // have higher precedence than an initial implementation.\n property.overrides = property.overrides ?? ifaceType.fqn;\n return true;\n }\n if (_validatePropertyImplementation(property, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _assertSignaturesMatch(\n expected: spec.Method,\n actual: spec.Method,\n label: string,\n action: string,\n opts: {\n allowReturnTypeCovariance: boolean;\n },\n ) {\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.createDetached(\n label,\n action,\n actVisibility,\n expVisibility,\n ),\n );\n }\n\n // Types must generally be the same, but can be covariant sometimes\n if (!deepEqual(actual.returns, expected.returns)) {\n const actualReturnType = actual.returns?.type;\n const expectedReturnType = expected.returns?.type;\n\n if (\n // return type covariance is allowed\n opts.allowReturnTypeCovariance &&\n // static members can never change\n !actual.static &&\n // this is a valid covariant return type (actual is more specific than expected)\n isAllowedCovariantSubtype(actualReturnType, expectedReturnType, _dereference)\n ) {\n useFeature('class-covariant-overrides');\n } else {\n const expType = spec.describeTypeReference(expectedReturnType);\n const actType = spec.describeTypeReference(actualReturnType);\n diagnostic(\n JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.createDetached(label, action, actType, expType),\n );\n }\n }\n const expectedParams = expected.parameters ?? [];\n const actualParams = actual.parameters ?? [];\n if (expectedParams.length !== actualParams.length) {\n diagnostic(\n JsiiDiagnostic.JSII_5005_OVERRIDE_CHANGES_PARAM_COUNT.createDetached(\n label,\n action,\n actualParams.length,\n expectedParams.length,\n ),\n );\n return;\n }\n for (let i = 0; i < expectedParams.length; i++) {\n const expParam = expectedParams[i];\n const actParam = actualParams[i];\n if (!deepEqual(expParam.type, actParam.type)) {\n diagnostic(\n JsiiDiagnostic.JSII_5006_OVERRIDE_CHANGES_PARAM_TYPE.createDetached(label, action, actParam, expParam),\n );\n }\n // Not-ing those to force the values to a strictly boolean context (they're optional, undefined means false)\n if (expParam.variadic !== actParam.variadic) {\n diagnostic(\n JsiiDiagnostic.JSII_5007_OVERRIDE_CHANGES_VARIADIC.createDetached(\n label,\n action,\n actParam.variadic,\n expParam.variadic,\n ),\n );\n }\n if (expParam.optional !== actParam.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5008_OVERRIDE_CHANGES_PARAM_OPTIONAL.createDetached(label, action, actParam, expParam),\n );\n }\n }\n }\n\n function _assertPropertiesMatch(\n expected: spec.Property,\n actual: spec.Property,\n label: string,\n action: string,\n opts: {\n allowCovariance: boolean;\n },\n ) {\n const actualNode = bindings.getPropertyRelatedNode(actual);\n const expectedNode = bindings.getPropertyRelatedNode(expected);\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.create(\n actualNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(actualNode),\n label,\n action,\n actVisibility,\n expVisibility,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n\n // Types must generally be the same, but can be covariant sometimes\n if (!deepEqual(actual.type, expected.type)) {\n if (\n // return type covariance is allowed\n opts.allowCovariance &&\n // static members can never change\n !actual.static &&\n // immutable properties may change in some case, as long as they are covariant\n actual.immutable &&\n isAllowedCovariantSubtype(actual.type, expected.type, _dereference)\n ) {\n useFeature('class-covariant-overrides');\n } else {\n diagnostic(\n JsiiDiagnostic.JSII_5004_OVERRIDE_CHANGES_PROP_TYPE.create(\n actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.type,\n expected.type,\n ).maybeAddRelatedInformation(\n expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n }\n if (expected.immutable !== actual.immutable) {\n diagnostic(\n JsiiDiagnostic.JSII_5010_OVERRIDE_CHANGES_MUTABILITY.create(\n actualNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(actualNode),\n label,\n action,\n actual.immutable,\n expected.immutable,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n if (expected.optional !== actual.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5009_OVERRIDE_CHANGES_PROP_OPTIONAL.create(\n actualNode?.questionToken ?? actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.optional,\n expected.optional,\n ).maybeAddRelatedInformation(\n expectedNode?.questionToken ?? expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n }\n }\n\n /**\n * Abstract classes that implement an interface should have a declaration for every member.\n *\n * For non-optional members, TypeScript already enforces this. This leaves the user the\n * ability to forget optional properties (`readonly prop?: string`).\n *\n * At least our codegen for this case fails in C#, and I'm not convinced it does the right\n * thing in Java either. So we will disallow this, and require users to declare these\n * fields on the class. It can always be `public abstract readonly prop?: string` if they\n * don't want to give an implementation yet.\n */\n function _abstractClassesMustImplementAllProperties(\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n const _dereference = createTypeResolver(assembly, validator.projectInfo.dependencyClosure);\n\n for (const type of _allTypes(assembly)) {\n if (!spec.isClassType(type) || !type.abstract) {\n continue;\n }\n\n const classProps = collectClassProps(type, new Set());\n\n for (const implFqn of type.interfaces ?? []) {\n checkInterfacePropsImplemented(implFqn, type, classProps);\n }\n }\n\n /**\n * Return all property names declared on this class and its base classes\n */\n function collectClassProps(type: spec.ClassType, into: Set<string>): Set<string> {\n for (const prop of type.properties ?? []) {\n into.add(prop.name);\n }\n\n if (type.base) {\n const base = _dereference(type.base);\n if (spec.isClassType(base)) {\n collectClassProps(base, into);\n }\n }\n\n return into;\n }\n\n function checkInterfacePropsImplemented(interfaceFqn: string, cls: spec.ClassType, propNames: Set<string>) {\n const intf = _dereference(interfaceFqn);\n if (!spec.isInterfaceType(intf)) {\n return;\n }\n\n // We only have to check for optional properties, because anything required\n // would have been caught by the TypeScript compiler already.\n for (const prop of intf.properties ?? []) {\n if (!prop.optional) {\n continue;\n }\n\n if (!propNames.has(prop.name)) {\n diagnostic(\n JsiiDiagnostic.JSII_5021_ABSTRACT_CLASS_MISSING_PROP_IMPL.create(\n bindings.getClassOrInterfaceRelatedNode(cls),\n intf,\n cls,\n prop.name,\n ).maybeAddRelatedInformation(bindings.getPropertyRelatedNode(prop), 'The implemented declaration is here.'),\n );\n }\n }\n\n for (const extFqn of intf.interfaces ?? []) {\n checkInterfacePropsImplemented(extFqn, cls, propNames);\n }\n }\n }\n\n function _staticMembersAndNestedTypesMustNotSharePascalCaseName(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const nestedType of Object.values(assembly.types ?? {})) {\n if (nestedType.namespace == null) {\n continue;\n }\n const nestingType = assembly.types![`${assembly.name}.${nestedType.namespace}`];\n if (nestingType == null) {\n continue;\n }\n const nestedTypeName = Case.pascal(nestedType.name);\n for (const { name, member } of staticMembers(nestingType)) {\n if (name === nestedTypeName) {\n let diag = JsiiDiagnostic.JSII_5020_STATIC_MEMBER_CONFLICTS_WITH_NESTED_TYPE.create(\n getRelatedNode(member)!,\n nestingType,\n member,\n nestedType,\n );\n const nestedTypeNode = getRelatedNode(nestedType);\n if (nestedTypeNode != null) {\n diag = diag.addRelatedInformation(nestedTypeNode, 'This is the conflicting nested type declaration');\n }\n diagnostic(diag);\n }\n }\n }\n\n function staticMembers(type: spec.Type) {\n if (spec.isClassOrInterfaceType(type)) {\n return [\n ...(type.methods?.filter((method) => method.static) ?? []),\n ...(type.properties?.filter((prop) => prop.static) ?? []),\n ].map((member) => ({ name: Case.pascal(member.name), member }));\n }\n return type.members.map((member) => ({ name: member.name, member }));\n }\n }\n}\n\nfunction _allTypes(assm: spec.Assembly): spec.Type[] {\n return Object.values(assm.types ?? {});\n}\n\nfunction _allMethods(assm: spec.Assembly): Array<{ member: spec.Method; type: spec.Type }> {\n const methods = new Array<{ member: spec.Method; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.methods) {\n continue;\n }\n for (const method of type.methods) methods.push({ member: method, type });\n }\n return methods;\n}\n\nfunction _allProperties(assm: spec.Assembly): Array<{ member: spec.Property; type: spec.Type }> {\n const properties = new Array<{ member: spec.Property; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.properties) {\n continue;\n }\n for (const property of type.properties) properties.push({ member: property, type });\n }\n return properties;\n}\n\nfunction _allMembers(assm: spec.Assembly): Array<{ member: spec.Property | spec.Method; type: spec.Type }> {\n return [..._allMethods(assm), ..._allProperties(assm)];\n}\n\ninterface AnnotatedTypeReference extends spec.NamedTypeReference {\n readonly node: ts.Node | undefined;\n}\n\nfunction _allTypeReferences(assm: spec.Assembly): readonly AnnotatedTypeReference[] {\n const typeReferences = new Array<AnnotatedTypeReference>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (spec.isClassType(type)) {\n const node = bindings.getClassRelatedNode(type);\n if (type.base) {\n typeReferences.push({\n fqn: type.base,\n node: node?.heritageClauses?.find((hc) => hc.token === ts.SyntaxKind.ExtendsKeyword)?.types[0],\n });\n }\n if (type.initializer?.parameters) {\n for (const param of type.initializer.parameters) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n }\n if (type.interfaces) {\n const node = bindings.getClassOrInterfaceRelatedNode(type);\n for (const iface of type.interfaces) {\n typeReferences.push({\n fqn: iface,\n node: node?.heritageClauses?.find(\n (hc) =>\n hc.token ===\n (spec.isInterfaceType(type) ? ts.SyntaxKind.ImplementsKeyword : ts.SyntaxKind.ExtendsKeyword),\n ),\n });\n }\n }\n }\n for (const { member: prop } of _allProperties(assm)) {\n _collectTypeReferences(prop.type, bindings.getPropertyRelatedNode(prop)?.type);\n }\n for (const { member: meth } of _allMethods(assm)) {\n if (meth.returns) {\n _collectTypeReferences(meth.returns.type, bindings.getMethodRelatedNode(meth)?.type);\n }\n for (const param of meth.parameters ?? []) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n return typeReferences;\n\n function _collectTypeReferences(type: spec.TypeReference, node: ts.Node | undefined): void {\n if (spec.isNamedTypeReference(type)) {\n typeReferences.push({ ...type, node });\n } else if (spec.isCollectionTypeReference(type)) {\n _collectTypeReferences(type.collection.elementtype, node);\n } else if (spec.isUnionTypeReference(type)) {\n for (const t of type.union.types) _collectTypeReferences(t, node);\n }\n }\n}\n\nfunction _isEmpty(array: undefined | any[]): array is undefined {\n return array == null || array.length === 0;\n}\n\n/**\n * Return whether an identifier only consists of upperchase characters, digits and underscores\n *\n * We have our own check here (isConstantCase) which is more lenient than what\n * `case.constant()` prescribes. We also want to allow combinations of letters\n * and digits without underscores: `C5A`, which `case` would force to `C5_A`.\n * The hint we print will still use `case.constant()` but that is fine.\n */\nfunction isConstantCase(x: string) {\n return !/[^A-Z0-9_]/.exec(x);\n}\n\n/**\n * Obtains the name of the given declaration, if it has one, or returns the declaration itself.\n * This function is meant to be used as a convenience to obtain the `ts.Node` to bind a\n * `JsiiDianostic` instance on.\n *\n * It may return `undefined` but is typed as `ts.Node` so that it is easier to use with\n * `JsiiDiagnostic` factories.\n *\n * @param decl the declaration which name is needed.\n *\n * @returns the name of the declaration if it has one, or the declaration itself. Might return\n * `undefined` if the provided declaration is undefined.\n */\nfunction declarationName(decl: ts.Declaration | ts.Expression | undefined): ts.Node {\n if (decl == null) {\n // Pretend we returned a node - this is used to create diagnostics, worst case it'll be unbound.\n return decl as any;\n }\n return ts.getNameOfDeclaration(decl) ?? decl;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,mCAAmC;AACnC,6CAA6C;AAC7C,iCAAiC;AACjC,+BAA+B;AAE/B,uDAAmD;AACnD,mDAAiD;AACjD,4CAA4C;AAE5C,mDAA4D;AAC5D,qDAAsD;AAMtD,MAAa,SAAS;IAGpB,YAAmC,WAAwB,EAAkB,QAAuB;QAAjE,gBAAW,GAAX,WAAW,CAAa;QAAkB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAEjG,IAAI;QACT,MAAM,WAAW,GAAG,IAAI,KAAK,EAAiB,CAAC;QAC/C,MAAM,YAAY,GAAG,IAAI,KAAK,EAAoB,CAAC;QAEnD,KAAK,MAAM,UAAU,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;YAC/C,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAC5G,CAAC;QAED,OAAO;YACL,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAA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AAI,EAAE,CAAC;QACjB,gGAAgG;QAChG,OAAO,IAAW,CAAC;IACrB,CAAC;IACD,OAAO,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC/C,CAAC","sourcesContent":["import * as assert from 'node:assert';\nimport * as spec from '@jsii/spec';\nimport * as deepEqual from 'fast-deep-equal';\nimport * as ts from 'typescript';\nimport * as Case from './case';\nimport { Emitter } from './emitter';\nimport { JsiiDiagnostic } from './jsii-diagnostic';\nimport { getRelatedNode } from './node-bindings';\nimport * as bindings from './node-bindings';\nimport { ProjectInfo } from './project-info';\nimport { isAllowedCovariantSubtype } from './type-analysis';\nimport { createTypeResolver } from './type-reference';\n\nexport interface ValidationResult extends ts.EmitResult {\n readonly usedFeatures?: spec.JsiiFeature[];\n}\n\nexport class Validator implements Emitter {\n public static VALIDATIONS: ValidationFunction[] = _defaultValidations();\n\n public constructor(public readonly projectInfo: ProjectInfo, public readonly assembly: spec.Assembly) {}\n\n public emit(): ValidationResult {\n const diagnostics = new Array<ts.Diagnostic>();\n const usedFeatures = new Array<spec.JsiiFeature>();\n\n for (const validation of Validator.VALIDATIONS) {\n validation(this, this.assembly, diagnostics.push.bind(diagnostics), usedFeatures.push.bind(usedFeatures));\n }\n\n return {\n diagnostics: diagnostics,\n emitSkipped: diagnostics.some((diag) => diag.category === ts.DiagnosticCategory.Error),\n usedFeatures,\n };\n }\n}\n\nexport type DiagnosticEmitter = (diag: JsiiDiagnostic) => void;\nexport type FeatureTracker = (feat: spec.JsiiFeature) => void;\nexport type ValidationFunction = (\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n useFeatures: FeatureTracker,\n) => void;\n\nfunction _defaultValidations(): ValidationFunction[] {\n return [\n _enumMembersMustUserUpperSnakeCase,\n _memberNamesMustUseCamelCase,\n _staticConstantNamesMustUseUpperSnakeCase,\n _memberNamesMustNotLookLikeJavaGettersOrSetters,\n _allTypeReferencesAreValid,\n _inheritanceDoesNotChangeContracts,\n _staticMembersAndNestedTypesMustNotSharePascalCaseName,\n _abstractClassesMustImplementAllProperties,\n ];\n\n function _enumMembersMustUserUpperSnakeCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const type of _allTypes(assembly)) {\n if (!spec.isEnumType(type)) {\n continue;\n }\n\n const enumNode = bindings.getEnumRelatedNode(type);\n for (const member of type.members) {\n if (member.name && !isConstantCase(member.name)) {\n const memberNode = enumNode?.members.find((m) => m.name.getText() === member.name);\n diagnostic(\n JsiiDiagnostic.JSII_8001_ALL_CAPS_ENUM_MEMBERS.create(\n memberNode?.name ?? declarationName(enumNode),\n member.name,\n type.fqn,\n ),\n );\n }\n }\n }\n }\n\n function _memberNamesMustUseCamelCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const { member, type } of _allMembers(assembly)) {\n if (member.static && (member as spec.Property).const) {\n continue;\n }\n if (member.name && member.name !== Case.camel(member.name)) {\n diagnostic(\n JsiiDiagnostic.JSII_8002_CAMEL_CASED_MEMBERS.create(\n declarationName(bindings.getRelatedNode(member)),\n member.name,\n type.fqn,\n ),\n );\n }\n }\n }\n\n function _staticConstantNamesMustUseUpperSnakeCase(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.static || !(member as spec.Property).const) {\n continue;\n }\n if (\n member.name &&\n !isConstantCase(member.name) &&\n member.name !== Case.pascal(member.name) &&\n member.name !== Case.camel(member.name)\n ) {\n diagnostic(\n JsiiDiagnostic.JSII_8003_STATIC_CONST_CASING.create(\n declarationName(bindings.getRelatedNode(member)),\n member.name,\n type.name,\n ),\n );\n }\n }\n }\n\n function _memberNamesMustNotLookLikeJavaGettersOrSetters(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.name) {\n continue;\n }\n const snakeName = Case.snake(member.name);\n if (snakeName.startsWith('get_') && _isEmpty((member as spec.Method).parameters)) {\n diagnostic(\n JsiiDiagnostic.JSII_5000_JAVA_GETTERS.create(\n declarationName(bindings.getRelatedNode(member)),\n member.name,\n type.name,\n ),\n );\n } else if (snakeName.startsWith('set_') && ((member as spec.Method).parameters ?? []).length === 1) {\n diagnostic(\n JsiiDiagnostic.JSII_5001_JAVA_SETTERS.create(\n declarationName(bindings.getRelatedNode(member)),\n member.name,\n type.name,\n ),\n );\n }\n }\n }\n\n function _allTypeReferencesAreValid(validator: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const typeRef of _allTypeReferences(assembly)) {\n const [assm] = typeRef.fqn.split('.');\n if (assembly.name === assm) {\n if (!(typeRef.fqn in (assembly.types ?? {}))) {\n diagnostic(\n JsiiDiagnostic.JSII_3000_EXPORTED_API_USES_HIDDEN_TYPE.create(\n typeRef.node!, // Pretend there is always a value\n typeRef.fqn,\n ),\n );\n }\n continue;\n }\n const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);\n if (!foreignAssm) {\n diagnostic(JsiiDiagnostic.JSII_9000_UNKNOWN_MODULE.create(typeRef.node, assm));\n continue;\n }\n if (!(typeRef.fqn in (foreignAssm.types ?? {}))) {\n diagnostic(JsiiDiagnostic.JSII_9001_TYPE_NOT_FOUND.create(typeRef.node, typeRef));\n }\n }\n }\n\n function _inheritanceDoesNotChangeContracts(\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n useFeature: FeatureTracker,\n ) {\n const _dereference = createTypeResolver(assembly, validator.projectInfo.dependencyClosure);\n\n for (const type of _allTypes(assembly)) {\n if (spec.isClassType(type)) {\n for (const method of type.methods ?? []) {\n _validateMethodOverride(method, type);\n }\n for (const property of type.properties ?? []) {\n _validatePropertyOverride(property, type);\n }\n }\n if (spec.isClassOrInterfaceType(type) && (type.interfaces?.length ?? 0) > 0) {\n for (const method of _allImplementations(type, (t) => t.methods)) {\n _validateMethodImplementation(method, type);\n }\n for (const property of _allImplementations(type, (t) => t.properties)) {\n _validatePropertyImplementation(property, type);\n }\n }\n }\n\n /**\n * Lists all \"implementations\" from the given type, using the provided\n * implementation getter. Note that abstract members may be part of the\n * result (in particular, if `type` is an interface type, or if it's an\n * abstract class with unimplemented members) -- I just couldn't come up\n * with a name that actually describes this.\n *\n * @param type the type which implemented members are needed.\n * @param getter the getter to obtain methods or properties from the type.\n *\n * @returns a list of members (possibly empty, always defined)\n */\n function _allImplementations<T extends spec.Property | spec.Method>(\n type: spec.ClassType | spec.InterfaceType,\n getter: (type: spec.ClassType | spec.InterfaceType) => T[] | undefined,\n ): T[] {\n const result = new Array<T>();\n const known = new Set<string>();\n\n for (const member of getter(type) ?? []) {\n result.push(member);\n known.add(member.name);\n }\n\n if (spec.isClassType(type) && type.base) {\n // We have a parent class, collect their concrete members, too (recursively)...\n const base = _dereference(type.base);\n assert(base != null && spec.isClassType(base));\n for (const member of _allImplementations(base, getter)) {\n if (known.has(member.name)) {\n continue;\n }\n // The member is copied, so that its `overrides` property won't be\n // altered, since this member is \"borrowed\" from a parent type. We\n // only check it, but should not record `overrides` relationships to\n // it as those could be invalid per the parent type (i.e: the parent\n // member may not be able to implement an interface, if that type does\n // not actually declare implementing that).\n const memberCopy = { ...member };\n // Forward the related node if there's one, so diagnostics are bound.\n const node = bindings.getRelatedNode(member);\n if (node != null) {\n bindings.setRelatedNode(memberCopy, node);\n }\n\n result.push(memberCopy);\n known.add(member.name);\n }\n }\n\n return result;\n }\n\n function _validateMethodOverride(method: spec.Method, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.methods ?? []).find((m) => m.name === method.name);\n if (!overridden) {\n return _validateMethodOverride(method, baseType);\n }\n _assertSignaturesMatch(overridden, method, `${type.fqn}#${method.name}`, `overriding ${baseType.fqn}`, {\n allowReturnTypeCovariance: true,\n });\n method.overrides = baseType.fqn;\n return true;\n }\n\n function _validatePropertyOverride(property: spec.Property, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.properties ?? []).find((p) => p.name === property.name);\n if (!overridden) {\n return _validatePropertyOverride(property, baseType);\n }\n _assertPropertiesMatch(overridden, property, `${type.fqn}#${property.name}`, `overriding ${baseType.fqn}`, {\n allowCovariance: true,\n });\n property.overrides = baseType.fqn;\n return true;\n }\n\n function _validateMethodImplementation(method: spec.Method, type: spec.ClassType | spec.InterfaceType): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validateMethodImplementation(method, _dereference(type.base) as spec.ClassType);\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface) as spec.InterfaceType;\n const implemented = (ifaceType.methods ?? []).find((m) => m.name === method.name);\n if (implemented) {\n _assertSignaturesMatch(implemented, method, `${type.fqn}#${method.name}`, `implementing ${ifaceType.fqn}`, {\n allowReturnTypeCovariance: false,\n });\n // We won't replace a previous overrides declaration from a method override, as those have\n // higher precedence than an initial implementation.\n method.overrides = method.overrides ?? iface;\n return true;\n }\n if (_validateMethodImplementation(method, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _validatePropertyImplementation(\n property: spec.Property,\n type: spec.ClassType | spec.InterfaceType,\n ): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validatePropertyImplementation(property, _dereference(type.base) as spec.ClassType);\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface) as spec.InterfaceType;\n const implemented = (ifaceType.properties ?? []).find((p) => p.name === property.name);\n if (implemented) {\n _assertPropertiesMatch(\n implemented,\n property,\n `${type.fqn}#${property.name}`,\n `implementing ${ifaceType.fqn}`,\n { allowCovariance: false },\n );\n // We won't replace a previous overrides declaration from a property override, as those\n // have higher precedence than an initial implementation.\n property.overrides = property.overrides ?? ifaceType.fqn;\n return true;\n }\n if (_validatePropertyImplementation(property, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _assertSignaturesMatch(\n expected: spec.Method,\n actual: spec.Method,\n label: string,\n action: string,\n opts: {\n allowReturnTypeCovariance: boolean;\n },\n ) {\n const actualNode = bindings.getMethodRelatedNode(actual);\n const expectedNode = bindings.getMethodRelatedNode(expected);\n\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.create(\n actualNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(actualNode),\n label,\n action,\n actVisibility,\n expVisibility,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n\n // Types must generally be the same, but can be covariant sometimes\n if (!deepEqual(actual.returns, expected.returns)) {\n const actualReturnType = actual.returns?.type;\n const expectedReturnType = expected.returns?.type;\n\n if (\n // return type covariance is allowed\n opts.allowReturnTypeCovariance &&\n // static members can never change\n !actual.static &&\n // this is a valid covariant return type (actual is more specific than expected)\n isAllowedCovariantSubtype(actualReturnType, expectedReturnType, _dereference)\n ) {\n useFeature('class-covariant-overrides');\n } else {\n const expType = spec.describeTypeReference(expectedReturnType);\n const actType = spec.describeTypeReference(actualReturnType);\n diagnostic(\n JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.create(\n actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actType,\n expType,\n ).maybeAddRelatedInformation(\n expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n }\n const expectedParams = expected.parameters ?? [];\n const actualParams = actual.parameters ?? [];\n if (expectedParams.length !== actualParams.length) {\n diagnostic(\n JsiiDiagnostic.JSII_5005_OVERRIDE_CHANGES_PARAM_COUNT.create(\n declarationName(actualNode),\n label,\n action,\n actualParams.length,\n expectedParams.length,\n ).maybeAddRelatedInformation(declarationName(expectedNode), 'The implemented declaration is here.'),\n );\n return;\n }\n for (let i = 0; i < expectedParams.length; i++) {\n const expParam = expectedParams[i];\n const actParam = actualParams[i];\n const actParamNode = bindings.getRelatedNode<ts.ParameterDeclaration>(actParam);\n const expParamNode = bindings.getRelatedNode<ts.ParameterDeclaration>(expParam);\n if (!deepEqual(expParam.type, actParam.type)) {\n diagnostic(\n JsiiDiagnostic.JSII_5006_OVERRIDE_CHANGES_PARAM_TYPE.create(\n actParamNode?.type ?? declarationName(actParamNode),\n label,\n action,\n actParam,\n expParam,\n ).maybeAddRelatedInformation(\n expParamNode?.type ?? declarationName(expParamNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n // Not-ing those to force the values to a strictly boolean context (they're optional, undefined means false)\n if (expParam.variadic !== actParam.variadic) {\n diagnostic(\n JsiiDiagnostic.JSII_5007_OVERRIDE_CHANGES_VARIADIC.create(\n actParamNode?.dotDotDotToken ?? declarationName(actParamNode),\n label,\n action,\n actParam.variadic,\n expParam.variadic,\n ).maybeAddRelatedInformation(\n expParamNode?.dotDotDotToken ?? declarationName(expParamNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n if (expParam.optional !== actParam.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5008_OVERRIDE_CHANGES_PARAM_OPTIONAL.create(\n actParamNode?.questionToken ?? actParamNode?.type ?? declarationName(actParamNode),\n label,\n action,\n actParam,\n expParam,\n ).maybeAddRelatedInformation(\n expParamNode?.questionToken ?? expParamNode?.type ?? declarationName(expParamNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n }\n }\n\n function _assertPropertiesMatch(\n expected: spec.Property,\n actual: spec.Property,\n label: string,\n action: string,\n opts: {\n allowCovariance: boolean;\n },\n ) {\n const actualNode = bindings.getPropertyRelatedNode(actual);\n const expectedNode = bindings.getPropertyRelatedNode(expected);\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.create(\n actualNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(actualNode),\n label,\n action,\n actVisibility,\n expVisibility,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n\n // Types must generally be the same, but can be covariant sometimes\n if (!deepEqual(actual.type, expected.type)) {\n if (\n // return type covariance is allowed\n opts.allowCovariance &&\n // static members can never change\n !actual.static &&\n // immutable properties may change in some case, as long as they are covariant\n actual.immutable &&\n isAllowedCovariantSubtype(actual.type, expected.type, _dereference)\n ) {\n useFeature('class-covariant-overrides');\n } else {\n diagnostic(\n JsiiDiagnostic.JSII_5004_OVERRIDE_CHANGES_PROP_TYPE.create(\n actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.type,\n expected.type,\n ).maybeAddRelatedInformation(\n expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n }\n if (expected.immutable !== actual.immutable) {\n diagnostic(\n JsiiDiagnostic.JSII_5010_OVERRIDE_CHANGES_MUTABILITY.create(\n actualNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(actualNode),\n label,\n action,\n actual.immutable,\n expected.immutable,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n if (expected.optional !== actual.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5009_OVERRIDE_CHANGES_PROP_OPTIONAL.create(\n actualNode?.questionToken ?? actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.optional,\n expected.optional,\n ).maybeAddRelatedInformation(\n expectedNode?.questionToken ?? expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n }\n }\n\n /**\n * Abstract classes that implement an interface should have a declaration for every member.\n *\n * For non-optional members, TypeScript already enforces this. This leaves the user the\n * ability to forget optional properties (`readonly prop?: string`).\n *\n * At least our codegen for this case fails in C#, and I'm not convinced it does the right\n * thing in Java either. So we will disallow this, and require users to declare these\n * fields on the class. It can always be `public abstract readonly prop?: string` if they\n * don't want to give an implementation yet.\n */\n function _abstractClassesMustImplementAllProperties(\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n const _dereference = createTypeResolver(assembly, validator.projectInfo.dependencyClosure);\n\n for (const type of _allTypes(assembly)) {\n if (!spec.isClassType(type) || !type.abstract) {\n continue;\n }\n\n const classProps = collectClassProps(type, new Set());\n\n for (const implFqn of type.interfaces ?? []) {\n checkInterfacePropsImplemented(implFqn, type, classProps);\n }\n }\n\n /**\n * Return all property names declared on this class and its base classes\n */\n function collectClassProps(type: spec.ClassType, into: Set<string>): Set<string> {\n for (const prop of type.properties ?? []) {\n into.add(prop.name);\n }\n\n if (type.base) {\n const base = _dereference(type.base);\n if (spec.isClassType(base)) {\n collectClassProps(base, into);\n }\n }\n\n return into;\n }\n\n function checkInterfacePropsImplemented(interfaceFqn: string, cls: spec.ClassType, propNames: Set<string>) {\n const intf = _dereference(interfaceFqn);\n if (!spec.isInterfaceType(intf)) {\n return;\n }\n\n // We only have to check for optional properties, because anything required\n // would have been caught by the TypeScript compiler already.\n for (const prop of intf.properties ?? []) {\n if (!prop.optional) {\n continue;\n }\n\n if (!propNames.has(prop.name)) {\n diagnostic(\n JsiiDiagnostic.JSII_5021_ABSTRACT_CLASS_MISSING_PROP_IMPL.create(\n bindings.getClassOrInterfaceRelatedNode(cls),\n intf,\n cls,\n prop.name,\n ).maybeAddRelatedInformation(bindings.getPropertyRelatedNode(prop), 'The implemented declaration is here.'),\n );\n }\n }\n\n for (const extFqn of intf.interfaces ?? []) {\n checkInterfacePropsImplemented(extFqn, cls, propNames);\n }\n }\n }\n\n function _staticMembersAndNestedTypesMustNotSharePascalCaseName(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const nestedType of Object.values(assembly.types ?? {})) {\n if (nestedType.namespace == null) {\n continue;\n }\n const nestingType = assembly.types![`${assembly.name}.${nestedType.namespace}`];\n if (nestingType == null) {\n continue;\n }\n const nestedTypeName = Case.pascal(nestedType.name);\n for (const { name, member } of staticMembers(nestingType)) {\n if (name === nestedTypeName) {\n let diag = JsiiDiagnostic.JSII_5020_STATIC_MEMBER_CONFLICTS_WITH_NESTED_TYPE.create(\n getRelatedNode(member)!,\n nestingType,\n member,\n nestedType,\n );\n const nestedTypeNode = getRelatedNode(nestedType);\n if (nestedTypeNode != null) {\n diag = diag.addRelatedInformation(nestedTypeNode, 'This is the conflicting nested type declaration');\n }\n diagnostic(diag);\n }\n }\n }\n\n function staticMembers(type: spec.Type) {\n if (spec.isClassOrInterfaceType(type)) {\n return [\n ...(type.methods?.filter((method) => method.static) ?? []),\n ...(type.properties?.filter((prop) => prop.static) ?? []),\n ].map((member) => ({ name: Case.pascal(member.name), member }));\n }\n return type.members.map((member) => ({ name: member.name, member }));\n }\n }\n}\n\nfunction _allTypes(assm: spec.Assembly): spec.Type[] {\n return Object.values(assm.types ?? {});\n}\n\nfunction _allMethods(assm: spec.Assembly): Array<{ member: spec.Method; type: spec.Type }> {\n const methods = new Array<{ member: spec.Method; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.methods) {\n continue;\n }\n for (const method of type.methods) methods.push({ member: method, type });\n }\n return methods;\n}\n\nfunction _allProperties(assm: spec.Assembly): Array<{ member: spec.Property; type: spec.Type }> {\n const properties = new Array<{ member: spec.Property; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.properties) {\n continue;\n }\n for (const property of type.properties) properties.push({ member: property, type });\n }\n return properties;\n}\n\nfunction _allMembers(assm: spec.Assembly): Array<{ member: spec.Property | spec.Method; type: spec.Type }> {\n return [..._allMethods(assm), ..._allProperties(assm)];\n}\n\ninterface AnnotatedTypeReference extends spec.NamedTypeReference {\n readonly node: ts.Node | undefined;\n}\n\nfunction _allTypeReferences(assm: spec.Assembly): readonly AnnotatedTypeReference[] {\n const typeReferences = new Array<AnnotatedTypeReference>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (spec.isClassType(type)) {\n const node = bindings.getClassRelatedNode(type);\n if (type.base) {\n typeReferences.push({\n fqn: type.base,\n node: node?.heritageClauses?.find((hc) => hc.token === ts.SyntaxKind.ExtendsKeyword)?.types[0],\n });\n }\n if (type.initializer?.parameters) {\n for (const param of type.initializer.parameters) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n }\n if (type.interfaces) {\n const node = bindings.getClassOrInterfaceRelatedNode(type);\n for (const iface of type.interfaces) {\n typeReferences.push({\n fqn: iface,\n node: node?.heritageClauses?.find(\n (hc) =>\n hc.token ===\n (spec.isInterfaceType(type) ? ts.SyntaxKind.ImplementsKeyword : ts.SyntaxKind.ExtendsKeyword),\n ),\n });\n }\n }\n }\n for (const { member: prop } of _allProperties(assm)) {\n _collectTypeReferences(prop.type, bindings.getPropertyRelatedNode(prop)?.type);\n }\n for (const { member: meth } of _allMethods(assm)) {\n if (meth.returns) {\n _collectTypeReferences(meth.returns.type, bindings.getMethodRelatedNode(meth)?.type);\n }\n for (const param of meth.parameters ?? []) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n return typeReferences;\n\n function _collectTypeReferences(type: spec.TypeReference, node: ts.Node | undefined): void {\n if (spec.isNamedTypeReference(type)) {\n typeReferences.push({ ...type, node });\n } else if (spec.isCollectionTypeReference(type)) {\n _collectTypeReferences(type.collection.elementtype, node);\n } else if (spec.isUnionTypeReference(type)) {\n for (const t of type.union.types) _collectTypeReferences(t, node);\n }\n }\n}\n\nfunction _isEmpty(array: undefined | any[]): array is undefined {\n return array == null || array.length === 0;\n}\n\n/**\n * Return whether an identifier only consists of upperchase characters, digits and underscores\n *\n * We have our own check here (isConstantCase) which is more lenient than what\n * `case.constant()` prescribes. We also want to allow combinations of letters\n * and digits without underscores: `C5A`, which `case` would force to `C5_A`.\n * The hint we print will still use `case.constant()` but that is fine.\n */\nfunction isConstantCase(x: string) {\n return !/[^A-Z0-9_]/.exec(x);\n}\n\n/**\n * Obtains the name of the given declaration, if it has one, or returns the declaration itself.\n * This function is meant to be used as a convenience to obtain the `ts.Node` to bind a\n * `JsiiDianostic` instance on.\n *\n * It may return `undefined` but is typed as `ts.Node` so that it is easier to use with\n * `JsiiDiagnostic` factories.\n *\n * @param decl the declaration which name is needed.\n *\n * @returns the name of the declaration if it has one, or the declaration itself. Might return\n * `undefined` if the provided declaration is undefined.\n */\nfunction declarationName(decl: ts.Declaration | ts.Expression | undefined): ts.Node {\n if (decl == null) {\n // Pretend we returned a node - this is used to create diagnostics, worst case it'll be unbound.\n return decl as any;\n }\n return ts.getNameOfDeclaration(decl) ?? decl;\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.
|
|
2
|
+
export declare const SHORT_VERSION = "5.9.30-dev.0";
|
|
3
3
|
/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
|
|
4
|
-
export declare const VERSION = "5.9.
|
|
4
|
+
export declare const VERSION = "5.9.30-dev.0 (build 7add866)";
|
|
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.
|
|
7
|
+
exports.SHORT_VERSION = '5.9.30-dev.0';
|
|
8
8
|
/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
|
|
9
|
-
exports.VERSION = '5.9.
|
|
9
|
+
exports.VERSION = '5.9.30-dev.0 (build 7add866)';
|
|
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
|
package/lib/version.js.map
CHANGED
|
@@ -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,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.
|
|
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.30-dev.0';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.9.30-dev.0 (build 7add866)';\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
|
@@ -13,7 +13,7 @@ export declare const silencedWarnings: Set<number>;
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function parseWarningCodes(input: string): number[];
|
|
15
15
|
/**
|
|
16
|
-
* Check if a diagnostic is a silenced warning.
|
|
16
|
+
* Check if a diagnostic is a silenced warning (globally or inline).
|
|
17
17
|
*/
|
|
18
18
|
export declare function isSilenced(diagnostic: ts.Diagnostic): boolean;
|
|
19
19
|
//# sourceMappingURL=warnings.d.ts.map
|
package/lib/warnings.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.silencedWarnings = void 0;
|
|
|
4
4
|
exports.parseWarningCodes = parseWarningCodes;
|
|
5
5
|
exports.isSilenced = isSilenced;
|
|
6
6
|
const ts = require("typescript");
|
|
7
|
+
const directives_1 = require("./directives");
|
|
7
8
|
const jsii_diagnostic_1 = require("./jsii-diagnostic");
|
|
8
9
|
/**
|
|
9
10
|
* Set of silenced warning codes (numeric JSII codes).
|
|
@@ -36,18 +37,55 @@ function parseWarningCodes(input) {
|
|
|
36
37
|
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
|
}
|
|
38
39
|
/**
|
|
39
|
-
* Check if a diagnostic is a silenced warning.
|
|
40
|
+
* Check if a diagnostic is a silenced warning (globally or inline).
|
|
40
41
|
*/
|
|
41
42
|
function isSilenced(diagnostic) {
|
|
42
|
-
if (exports.silencedWarnings.size === 0) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
43
|
if (diagnostic.category !== ts.DiagnosticCategory.Warning) {
|
|
46
44
|
return false;
|
|
47
45
|
}
|
|
48
46
|
if (!jsii_diagnostic_1.JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {
|
|
49
47
|
return false;
|
|
50
48
|
}
|
|
51
|
-
|
|
49
|
+
if (exports.silencedWarnings.has(diagnostic.jsiiCode)) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return isInlineSuppressed(diagnostic);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if a diagnostic is suppressed inline via a `@jsii suppress` directive.
|
|
56
|
+
*
|
|
57
|
+
* Diagnostics reference a source position (typically the name identifier of a
|
|
58
|
+
* declaration), but JSDoc tags are attached to the enclosing declaration node,
|
|
59
|
+
* not the identifier. We therefore start at the token at the diagnostic
|
|
60
|
+
* position and walk up the AST, checking each ancestor for `@jsii suppress`
|
|
61
|
+
* directives. This means a directive on a class suppresses matching warnings
|
|
62
|
+
* on all its members.
|
|
63
|
+
*/
|
|
64
|
+
function isInlineSuppressed(diagnostic) {
|
|
65
|
+
if (diagnostic.file == null || diagnostic.start == null) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
// `getTokenAtPosition` is exported from the `typescript` module but is not
|
|
69
|
+
// included in the public type declarations. It has been stable since TS 2.0
|
|
70
|
+
// and is used extensively by the language service. We cast through `any` to
|
|
71
|
+
// access it. Internally it descends through `node.getChildren()` to find the
|
|
72
|
+
// deepest node at a given position.
|
|
73
|
+
const getTokenAtPosition = ts.getTokenAtPosition;
|
|
74
|
+
let current = getTokenAtPosition(diagnostic.file, diagnostic.start);
|
|
75
|
+
while (current) {
|
|
76
|
+
const directives = directives_1.Directives.of(current, () => { });
|
|
77
|
+
for (const code of directives.suppressions) {
|
|
78
|
+
try {
|
|
79
|
+
if (parseWarningCodes(code).includes(diagnostic.jsiiCode)) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// Unknown code — ignore
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
current = current.parent;
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
52
90
|
}
|
|
53
91
|
//# sourceMappingURL=warnings.js.map
|
package/lib/warnings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warnings.js","sourceRoot":"","sources":["../src/warnings.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"warnings.js","sourceRoot":"","sources":["../src/warnings.ts"],"names":[],"mappings":";;;AAkBA,8CAsBC;AAKD,gCAWC;AAxDD,iCAAiC;AAEjC,6CAA0C;AAC1C,uDAAyD;AAEzD;;GAEG;AACU,QAAA,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;AAElD;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,sBAAsB;IACtB,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;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AkB,CAAC;IACvG,IAAI,OAAO,GAAwB,kBAAkB,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACzF,OAAO,OAAO,EAAE,CAAC;QACf,MAAM,UAAU,GAAG,uBAAU,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACpD,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;YAC3C,IAAI,CAAC;gBACH,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC1D,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,wBAAwB;YAC1B,CAAC;QACH,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAC3B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import * as ts from 'typescript';\n\nimport { Directives } from './directives';\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 (globally or inline).\n */\nexport function isSilenced(diagnostic: ts.Diagnostic): boolean {\n if (diagnostic.category !== ts.DiagnosticCategory.Warning) {\n return false;\n }\n if (!JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n return false;\n }\n if (silencedWarnings.has(diagnostic.jsiiCode)) {\n return true;\n }\n return isInlineSuppressed(diagnostic);\n}\n\n/**\n * Check if a diagnostic is suppressed inline via a `@jsii suppress` directive.\n *\n * Diagnostics reference a source position (typically the name identifier of a\n * declaration), but JSDoc tags are attached to the enclosing declaration node,\n * not the identifier. We therefore start at the token at the diagnostic\n * position and walk up the AST, checking each ancestor for `@jsii suppress`\n * directives. This means a directive on a class suppresses matching warnings\n * on all its members.\n */\nfunction isInlineSuppressed(diagnostic: JsiiDiagnostic): boolean {\n if (diagnostic.file == null || diagnostic.start == null) {\n return false;\n }\n\n // `getTokenAtPosition` is exported from the `typescript` module but is not\n // included in the public type declarations. It has been stable since TS 2.0\n // and is used extensively by the language service. We cast through `any` to\n // access it. Internally it descends through `node.getChildren()` to find the\n // deepest node at a given position.\n const getTokenAtPosition: (sf: ts.SourceFile, pos: number) => ts.Node = (ts as any).getTokenAtPosition;\n let current: ts.Node | undefined = getTokenAtPosition(diagnostic.file, diagnostic.start);\n while (current) {\n const directives = Directives.of(current, () => {});\n for (const code of directives.suppressions) {\n try {\n if (parseWarningCodes(code).includes(diagnostic.jsiiCode)) {\n return true;\n }\n } catch {\n // Unknown code — ignore\n }\n }\n current = current.parent;\n }\n return false;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"npm": "^9.9.4",
|
|
65
65
|
"npm-check-updates": "^16",
|
|
66
66
|
"prettier": "^2.8.8",
|
|
67
|
-
"projen": "^0.99.
|
|
67
|
+
"projen": "^0.99.17",
|
|
68
68
|
"tar": "^7.5.9",
|
|
69
69
|
"ts-jest": "^29.4.6",
|
|
70
70
|
"ts-node": "^10.9.2"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@jsii/check-node": "1.
|
|
74
|
-
"@jsii/spec": "1.
|
|
73
|
+
"@jsii/check-node": "1.127.0",
|
|
74
|
+
"@jsii/spec": "1.127.0",
|
|
75
75
|
"case": "^1.6.3",
|
|
76
76
|
"chalk": "^4",
|
|
77
77
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
|
94
94
|
},
|
|
95
|
-
"version": "5.9.
|
|
95
|
+
"version": "5.9.30-dev.0",
|
|
96
96
|
"types": "lib/index.d.ts",
|
|
97
97
|
"exports": {
|
|
98
98
|
".": "./lib/index.js",
|