jsii 5.4.34-dev.1 → 5.4.34-dev.2

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.
@@ -23,10 +23,10 @@ function loadProjectInfo(projectRoot) {
23
23
  for (const name of pkg.bundleDependencies ?? pkg.bundledDependencies ?? []) {
24
24
  const version = pkg.dependencies?.[name];
25
25
  if (!version) {
26
- throw new Error(`The "package.json" file has "${name}" in "bundleDependencies", but it is not declared in "dependencies"`);
26
+ throw new utils_1.JsiiError(`The "package.json" file has "${name}" in "bundleDependencies", but it is not declared in "dependencies"`);
27
27
  }
28
28
  if (pkg.peerDependencies && name in pkg.peerDependencies) {
29
- throw new Error(`The "package.json" file has "${name}" in "bundleDependencies", and also in "peerDependencies"`);
29
+ throw new utils_1.JsiiError(`The "package.json" file has "${name}" in "bundleDependencies", and also in "peerDependencies"`);
30
30
  }
31
31
  bundleDependencies = bundleDependencies ?? {};
32
32
  bundleDependencies[name] = _resolveVersion(version, projectRoot).version;
@@ -119,7 +119,7 @@ function _guessRepositoryType(url) {
119
119
  if (parts?.[1] !== 'http' && parts?.[1] !== 'https') {
120
120
  return parts[1];
121
121
  }
122
- throw new Error(`The "package.json" file must specify the "repository.type" attribute (could not guess from ${url})`);
122
+ throw new utils_1.JsiiError(`The "package.json" file must specify the "repository.type" attribute (could not guess from ${url})`);
123
123
  }
124
124
  function _sourceMapPreferences({ declarationMap, inlineSourceMap, inlineSources, sourceMap } = {}) {
125
125
  // If none of the options are specified, use the default configuration from jsii <= 1.58.0, which
@@ -162,7 +162,7 @@ class DependencyResolver {
162
162
  }
163
163
  const actualVersion = resolved.dependencyInfo.assembly.version;
164
164
  if (!semver.satisfies(actualVersion, declaration)) {
165
- throw new Error(`Declared dependency on version ${declaration} of ${name}, but version ${actualVersion} was found`);
165
+ throw new utils_1.JsiiError(`Declared dependency on version ${declaration} of ${name}, but version ${actualVersion} was found`);
166
166
  }
167
167
  ret[name] = resolved.resolvedFile;
168
168
  }
@@ -192,7 +192,7 @@ class DependencyResolver {
192
192
  const { version: versionString, localPackage } = _resolveVersion(declaration, root);
193
193
  const version = new semver.Range(versionString);
194
194
  if (!version) {
195
- throw new Error(`Invalid semver expression for ${name}: ${versionString}`);
195
+ throw new utils_1.JsiiError(`Invalid semver expression for ${name}: ${versionString}`);
196
196
  }
197
197
  const jsiiFile = _tryResolveAssembly(name, localPackage, root);
198
198
  LOG.debug(`Resolved dependency ${name} to ${jsiiFile}`);
@@ -222,7 +222,7 @@ class DependencyResolver {
222
222
  }
223
223
  function _required(value, message) {
224
224
  if (value == null) {
225
- throw new Error(message);
225
+ throw new utils_1.JsiiError(message);
226
226
  }
227
227
  return value;
228
228
  }
@@ -252,7 +252,7 @@ function _tryResolveAssembly(mod, localPackage, searchPath) {
252
252
  if (localPackage) {
253
253
  const result = (0, spec_1.findAssemblyFile)(localPackage);
254
254
  if (!fs.existsSync(result)) {
255
- throw new Error(`Assembly does not exist: ${result}`);
255
+ throw new utils_1.JsiiError(`Assembly does not exist: ${result}`);
256
256
  }
257
257
  return result;
258
258
  }
@@ -261,24 +261,24 @@ function _tryResolveAssembly(mod, localPackage, searchPath) {
261
261
  return (0, spec_1.findAssemblyFile)(dependencyDir);
262
262
  }
263
263
  catch (e) {
264
- throw new Error(`Unable to locate jsii assembly for "${mod}". If this module is not jsii-enabled, it must also be declared under bundledDependencies: ${e}`);
264
+ throw new utils_1.JsiiError(`Unable to locate jsii assembly for "${mod}". If this module is not jsii-enabled, it must also be declared under bundledDependencies: ${e}`);
265
265
  }
266
266
  }
267
267
  function _validateLicense(id) {
268
268
  if (id == null) {
269
- throw new Error('No "license" was specified in "package.json", see valid license identifiers at https://spdx.org/licenses/');
269
+ throw new utils_1.JsiiError('No "license" was specified in "package.json", see valid license identifiers at https://spdx.org/licenses/');
270
270
  }
271
271
  if (id === 'UNLICENSED') {
272
272
  return id;
273
273
  }
274
274
  if (!spdx.has(id)) {
275
- throw new Error(`Invalid license identifier "${id}", see valid license identifiers at https://spdx.org/licenses/`);
275
+ throw new utils_1.JsiiError(`Invalid license identifier "${id}", see valid license identifiers at https://spdx.org/licenses/`);
276
276
  }
277
277
  return id;
278
278
  }
279
279
  function _validateVersionFormat(format) {
280
280
  if (format !== 'short' && format !== 'full') {
281
- throw new Error(`Invalid jsii.versionFormat "${format}", it must be either "short" or "full" (the default)`);
281
+ throw new utils_1.JsiiError(`Invalid jsii.versionFormat "${format}", it must be either "short" or "full" (the default)`);
282
282
  }
283
283
  return format;
284
284
  }
@@ -293,7 +293,7 @@ function _validateStability(stability, deprecated) {
293
293
  return undefined;
294
294
  }
295
295
  if (!Object.values(spec.Stability).includes(stability)) {
296
- throw new Error(`Invalid stability "${stability}", it must be one of ${Object.values(spec.Stability).join(', ')}`);
296
+ throw new utils_1.JsiiError(`Invalid stability "${stability}", it must be one of ${Object.values(spec.Stability).join(', ')}`);
297
297
  }
298
298
  return stability;
299
299
  }
@@ -302,7 +302,7 @@ function _validateTsconfigRuleSet(ruleSet) {
302
302
  return undefined;
303
303
  }
304
304
  if (!Object.values(tsconfig_1.TypeScriptConfigValidationRuleSet).includes(ruleSet)) {
305
- throw new Error(`Invalid validateTsconfig "${ruleSet}", it must be one of ${Object.values(tsconfig_1.TypeScriptConfigValidationRuleSet).join(', ')}`);
305
+ throw new utils_1.JsiiError(`Invalid validateTsconfig "${ruleSet}", it must be one of ${Object.values(tsconfig_1.TypeScriptConfigValidationRuleSet).join(', ')}`);
306
306
  }
307
307
  return ruleSet;
308
308
  }
@@ -378,7 +378,7 @@ function _loadDiagnostics(entries) {
378
378
  category = ts.DiagnosticCategory.Message;
379
379
  break;
380
380
  default:
381
- throw new Error(`Invalid category '${entries[code]}' for code '${code}'`);
381
+ throw new utils_1.JsiiError(`Invalid category '${entries[code]}' for code '${code}'`);
382
382
  }
383
383
  result[code] = category;
384
384
  }
@@ -1 +1 @@
1
- {"version":3,"file":"project-info.js","sourceRoot":"","sources":["../src/project-info.ts"],"names":[],"mappings":";;;A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BACzC,MAAM;YACR,KAAK,YAAY;gBACf,QAAQ,GAAG,EAAE,CAAC,kBAAkB,CAAC,UAAU,CAAC;gBAC5C,MAAM;YACR,KAAK,SAAS;gBACZ,QAAQ,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;gBACzC,MAAM;YACR;gBACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,OAAO,CAAC,IAAI,CAAC,eAAe,IAAI,GAAG,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,eAAe,CAAI,EAAqB,EAAE,SAAmC;IACpF,MAAM,GAAG,GAAsB,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QAC9C,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as spec from '@jsii/spec';\nimport { findAssemblyFile, loadAssemblyFromFile } from '@jsii/spec';\nimport * as log4js from 'log4js';\nimport * as semver from 'semver';\nimport * as ts from 'typescript';\n\nimport { findDependencyDirectory } from './common/find-utils';\nimport { JsiiDiagnostic } from './jsii-diagnostic';\nimport { TypeScriptConfigValidationRuleSet } from './tsconfig';\nimport { parsePerson, parseRepository } from './utils';\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports\nconst spdx: Set<string> = require('spdx-license-list/simple');\n\nconst LOG = log4js.getLogger('jsii/package-info');\n\nexport type TSCompilerOptions = Partial<\n Pick<\n ts.CompilerOptions,\n // Directory preferences\n | 'outDir'\n | 'rootDir'\n // TypeScript path mapping\n | 'baseUrl'\n | 'paths'\n // Style preferences\n | 'forceConsistentCasingInFileNames'\n | 'noImplicitOverride'\n | 'noPropertyAccessFromIndexSignature'\n | 'noUncheckedIndexedAccess'\n // Source map preferences\n | 'declarationMap'\n | 'inlineSourceMap'\n | 'inlineSources'\n | 'sourceMap'\n // Types limitations\n | 'types'\n >\n>;\n\nexport interface ProjectInfo {\n readonly projectRoot: string;\n readonly packageJson: PackageJson;\n\n readonly name: string;\n readonly version: string;\n readonly author: spec.Person;\n readonly deprecated?: string;\n readonly stability?: spec.Stability;\n readonly license: string;\n readonly repository: {\n readonly type: string;\n readonly url: string;\n readonly directory?: string;\n };\n readonly keywords?: readonly string[];\n\n readonly main: string;\n readonly types: string;\n\n readonly dependencies: { readonly [name: string]: string };\n readonly peerDependencies: { readonly [name: string]: string };\n readonly dependencyClosure: readonly spec.Assembly[];\n readonly bundleDependencies?: { readonly [name: string]: string };\n readonly targets: spec.AssemblyTargets;\n readonly metadata?: { readonly [key: string]: any };\n readonly jsiiVersionFormat: 'short' | 'full';\n readonly diagnostics?: { readonly [code: string]: ts.DiagnosticCategory };\n readonly description?: string;\n readonly homepage?: string;\n readonly contributors?: readonly spec.Person[];\n readonly excludeTypescript: readonly string[];\n readonly projectReferences?: boolean;\n readonly tsc?: TSCompilerOptions;\n readonly bin?: { readonly [name: string]: string };\n readonly exports?: {\n readonly [name: string]: string | { readonly [name: string]: string };\n };\n\n // user-provided tsconfig\n readonly tsconfig?: string;\n readonly validateTsconfig?: TypeScriptConfigValidationRuleSet;\n}\n\nexport interface PackageJson {\n readonly description?: string;\n readonly homepage?: string;\n readonly name?: string;\n readonly version?: string;\n readonly keywords?: readonly string[];\n readonly license?: string;\n readonly private?: boolean;\n\n readonly exports?: { readonly [path: string]: string | { readonly [name: string]: string } };\n readonly main?: string;\n readonly types?: string;\n /**\n * @example { \"<4.0\": { \"*\": [\"ts3.9/*\"] } }\n * @example { \"<4.0\": { \"index.d.ts\": [\"index.ts3-9.d.ts\"] } }\n */\n readonly typesVersions?: {\n readonly [versionRange: string]: { readonly [pattern: string]: readonly string[] };\n };\n\n readonly bin?: { readonly [name: string]: string };\n\n readonly stability?: string;\n readonly deprecated?: string;\n\n readonly dependencies?: { readonly [name: string]: string };\n readonly devDependencies?: { readonly [name: string]: string };\n readonly peerDependencies?: { readonly [name: string]: string };\n\n readonly bundleDependencies?: readonly string[];\n readonly bundledDependencies?: readonly string[];\n\n readonly jsii?: {\n // main jsii config\n readonly diagnostics?: { readonly [id: string]: 'error' | 'warning' | 'suggestion' | 'message' };\n readonly metadata?: { readonly [key: string]: unknown };\n readonly targets?: { readonly [name: string]: unknown };\n readonly versionFormat?: 'short' | 'full';\n\n // Either user-provided config ...\n readonly tsconfig?: string;\n readonly validateTsconfig?: string;\n\n // ... or configure tsc here\n readonly excludeTypescript?: readonly string[];\n readonly projectReferences?: boolean;\n readonly tsc?: TSCompilerOptions;\n\n // unexpected options\n readonly [key: string]: unknown;\n };\n\n readonly [key: string]: unknown;\n}\n\nexport interface ProjectInfoResult {\n readonly projectInfo: ProjectInfo;\n readonly diagnostics: readonly ts.Diagnostic[];\n}\n\nexport function loadProjectInfo(projectRoot: string): ProjectInfoResult {\n const packageJsonPath = path.join(projectRoot, 'package.json');\n const pkg: PackageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n\n const diagnostics: ts.Diagnostic[] = [];\n\n let bundleDependencies: { [name: string]: string } | undefined;\n for (const name of pkg.bundleDependencies ?? pkg.bundledDependencies ?? []) {\n const version = pkg.dependencies?.[name];\n if (!version) {\n throw new Error(\n `The \"package.json\" file has \"${name}\" in \"bundleDependencies\", but it is not declared in \"dependencies\"`,\n );\n }\n\n if (pkg.peerDependencies && name in pkg.peerDependencies) {\n throw new Error(`The \"package.json\" file has \"${name}\" in \"bundleDependencies\", and also in \"peerDependencies\"`);\n }\n\n bundleDependencies = bundleDependencies ?? {};\n bundleDependencies[name] = _resolveVersion(version, projectRoot).version;\n }\n\n // Check peerDependencies are also in devDependencies\n // You need this to write tests properly. There are probably cases where\n // it makes sense to have this different, so most of what this checking\n // produces is warnings, not errors.\n const devDependencies = pkg.devDependencies ?? {};\n for (const [name, rng] of Object.entries(pkg.peerDependencies ?? {})) {\n const range = new semver.Range(_resolveVersion(rng as string, projectRoot).version);\n const minVersion = semver.minVersion(range)?.raw;\n\n if (!(name in devDependencies) || devDependencies[name] !== `${minVersion}`) {\n diagnostics.push(\n JsiiDiagnostic.JSII_0006_MISSING_DEV_DEPENDENCY.createDetached(\n name,\n `${rng as any}`,\n `${minVersion}`,\n `${devDependencies[name]}`,\n ),\n );\n continue;\n }\n }\n\n const bundled = new Set(Object.keys(bundleDependencies ?? {}));\n const dependencies: Record<string, string> = filterDictByKey(\n pkg.dependencies ?? {},\n (depName) => !bundled.has(depName),\n );\n const peerDependencies: Record<string, string> = pkg.peerDependencies ?? {};\n\n const resolver = new DependencyResolver();\n const resolved = resolver.discoverDependencyTree(projectRoot, {\n ...dependencies,\n ...peerDependencies,\n });\n const transitiveDependencies = resolver.assemblyClosure(resolved);\n\n const metadata = mergeMetadata(\n {\n jsii: {\n pacmak: {\n // When `true`, `jsii-pacmak` will use the `Jsii$Default` implementation in code generation even for dependencies.\n hasDefaultInterfaces: true,\n },\n },\n },\n pkg.jsii?.metadata,\n );\n\n const projectInfo: ProjectInfo = {\n projectRoot,\n packageJson: pkg,\n\n name: _required(pkg.name, 'The \"package.json\" file must specify the \"name\" attribute'),\n version: _required(pkg.version, 'The \"package.json\" file must specify the \"version\" attribute'),\n deprecated: pkg.deprecated,\n stability: _validateStability(pkg.stability, pkg.deprecated),\n author: _toPerson(_required(pkg.author, 'The \"package.json\" file must specify the \"author\" attribute'), 'author'),\n repository: _toRepository(\n _required(pkg.repository, 'The \"package.json\" file must specify the \"repository\" attribute'),\n ),\n license: _validateLicense(pkg.license),\n keywords: pkg.keywords,\n\n main: _required(pkg.main, 'The \"package.json\" file must specify the \"main\" attribute'),\n types: _required(pkg.types, 'The \"package.json\" file must specify the \"types\" attribute'),\n\n dependencies,\n peerDependencies,\n dependencyClosure: transitiveDependencies,\n bundleDependencies,\n targets: {\n ..._required(pkg.jsii, 'The \"package.json\" file must specify the \"jsii\" attribute').targets,\n js: { npm: pkg.name },\n },\n metadata,\n jsiiVersionFormat: _validateVersionFormat(pkg.jsii?.versionFormat ?? 'full'),\n\n description: pkg.description,\n homepage: pkg.homepage,\n contributors: (pkg.contributors as any[])?.map((contrib, index) =>\n _toPerson(contrib, `contributors[${index}]`, 'contributor'),\n ),\n\n excludeTypescript: pkg.jsii?.excludeTypescript ?? [],\n projectReferences: pkg.jsii?.projectReferences,\n tsc: {\n outDir: pkg.jsii?.tsc?.outDir,\n rootDir: pkg.jsii?.tsc?.rootDir,\n baseUrl: pkg.jsii?.tsc?.baseUrl,\n paths: pkg.jsii?.tsc?.paths,\n forceConsistentCasingInFileNames: pkg.jsii?.tsc?.forceConsistentCasingInFileNames,\n noImplicitOverride: pkg.jsii?.tsc?.noImplicitOverride,\n noPropertyAccessFromIndexSignature: pkg.jsii?.tsc?.noPropertyAccessFromIndexSignature,\n noUncheckedIndexedAccess: pkg.jsii?.tsc?.noUncheckedIndexedAccess,\n ..._sourceMapPreferences(pkg.jsii?.tsc),\n types: pkg.jsii?.tsc?.types,\n },\n bin: pkg.bin,\n exports: pkg.exports,\n diagnostics: _loadDiagnostics(pkg.jsii?.diagnostics),\n\n // user-provided tsconfig\n tsconfig: pkg.jsii?.tsconfig,\n validateTsconfig: _validateTsconfigRuleSet(pkg.jsii?.validateTsconfig ?? 'strict'),\n };\n return { projectInfo, diagnostics };\n}\n\nfunction _guessRepositoryType(url: string): string {\n if (url.endsWith('.git')) {\n return 'git';\n }\n const parts = /^([^:]+):\\/\\//.exec(url);\n if (parts?.[1] !== 'http' && parts?.[1] !== 'https') {\n return parts![1];\n }\n throw new Error(`The \"package.json\" file must specify the \"repository.type\" attribute (could not guess from ${url})`);\n}\n\nfunction _sourceMapPreferences({ declarationMap, inlineSourceMap, inlineSources, sourceMap }: TSCompilerOptions = {}) {\n // If none of the options are specified, use the default configuration from jsii <= 1.58.0, which\n // means inline source maps with embedded source information.\n if (declarationMap == null && inlineSourceMap == null && inlineSources == null && sourceMap == null) {\n declarationMap = false;\n inlineSourceMap = true;\n inlineSources = true;\n sourceMap = undefined;\n }\n\n return {\n declarationMap,\n inlineSourceMap,\n inlineSources,\n sourceMap,\n };\n}\n\ninterface DependencyInfo {\n readonly assembly: spec.Assembly;\n readonly resolvedDependencies: Record<string, string>;\n}\n\nclass DependencyResolver {\n private readonly cache = new Map<string, DependencyInfo>();\n\n /**\n * Discover the dependency tree starting at 'root', validating versions as we go along\n *\n * This primes the data structures in this class and should be called first.\n *\n * Return the resolved jsii dependency paths\n */\n public discoverDependencyTree(root: string, dependencies: Record<string, string>): Record<string, string> {\n const ret: Record<string, string> = {};\n for (const [name, declaration] of Object.entries(dependencies)) {\n // eslint-disable-next-line no-await-in-loop\n let resolved;\n try {\n resolved = this.resolveDependency(root, name, declaration);\n } catch (e) {\n LOG.error(\n `Unable to find a JSII dependency named \"${name}\" as \"${declaration}\". If you meant to include a non-JSII dependency, try adding it to bundledDependencies instead.`,\n );\n throw e;\n }\n\n const actualVersion = resolved.dependencyInfo.assembly.version;\n if (!semver.satisfies(actualVersion, declaration)) {\n throw new Error(\n `Declared dependency on version ${declaration} of ${name}, but version ${actualVersion} was found`,\n );\n }\n\n ret[name] = resolved.resolvedFile;\n }\n return ret;\n }\n\n /**\n * From a set of resolved paths, recursively return all assemblies\n */\n public assemblyClosure(resolved: Record<string, string>): spec.Assembly[] {\n const closure = new Map<string, spec.Assembly>();\n const queue = Array.from(Object.values(resolved));\n while (queue.length > 0) {\n const next = queue.shift()!;\n const depInfo = this.cache.get(next);\n if (!depInfo) {\n throw new Error(`Path ${next} not seen before`);\n }\n if (closure.has(next)) {\n continue;\n }\n\n closure.set(next, depInfo.assembly);\n queue.push(...Object.values(depInfo.resolvedDependencies));\n }\n return Array.from(closure.values());\n }\n\n private resolveDependency(root: string, name: string, declaration: string) {\n const { version: versionString, localPackage } = _resolveVersion(declaration, root);\n const version = new semver.Range(versionString);\n if (!version) {\n throw new Error(`Invalid semver expression for ${name}: ${versionString}`);\n }\n const jsiiFile = _tryResolveAssembly(name, localPackage, root);\n LOG.debug(`Resolved dependency ${name} to ${jsiiFile}`);\n return {\n resolvedVersion: versionString,\n resolvedFile: jsiiFile,\n dependencyInfo: this.loadAssemblyAndRecurse(jsiiFile),\n };\n }\n\n private loadAssemblyAndRecurse(jsiiFile: string) {\n // Only recurse if we haven't seen this assembly yet\n if (this.cache.has(jsiiFile)) {\n return this.cache.get(jsiiFile)!;\n }\n\n const assembly = loadAssemblyFromFile(jsiiFile);\n\n // Continue loading any dependencies declared in the asm\n const resolvedDependencies = assembly.dependencies\n ? this.discoverDependencyTree(path.dirname(jsiiFile), assembly.dependencies)\n : {};\n\n const depInfo: DependencyInfo = {\n assembly,\n resolvedDependencies,\n };\n this.cache.set(jsiiFile, depInfo);\n return depInfo;\n }\n}\n\nfunction _required<T>(value: T | undefined, message: string): T {\n if (value == null) {\n throw new Error(message);\n }\n return value;\n}\n\nfunction _toPerson(value: any, field: string, defaultRole: string = field): spec.Person {\n if (typeof value === 'string') {\n value = parsePerson(value);\n }\n return {\n name: _required(value.name, `The \"package.json\" file must specify the \"${field}.name\" attribute`),\n roles: value.roles ? [...new Set(value.roles as string[])] : [defaultRole],\n email: value.email,\n url: value.url,\n organization: value.organization ? value.organization : undefined,\n };\n}\n\nfunction _toRepository(value: any): {\n type: string;\n url: string;\n directory?: string;\n} {\n if (typeof value === 'string') {\n value = parseRepository(value);\n }\n return {\n url: _required(value.url, 'The \"package.json\" file must specify the \"repository.url\" attribute'),\n type: value.type || _guessRepositoryType(value.url),\n directory: value.directory,\n };\n}\n\nfunction _tryResolveAssembly(mod: string, localPackage: string | undefined, searchPath: string): string {\n if (localPackage) {\n const result = findAssemblyFile(localPackage);\n if (!fs.existsSync(result)) {\n throw new Error(`Assembly does not exist: ${result}`);\n }\n return result;\n }\n try {\n const dependencyDir = findDependencyDirectory(mod, searchPath);\n return findAssemblyFile(dependencyDir);\n } catch (e: any) {\n throw new Error(\n `Unable to locate jsii assembly for \"${mod}\". If this module is not jsii-enabled, it must also be declared under bundledDependencies: ${e}`,\n );\n }\n}\n\nfunction _validateLicense(id: string | undefined): string {\n if (id == null) {\n throw new Error(\n 'No \"license\" was specified in \"package.json\", see valid license identifiers at https://spdx.org/licenses/',\n );\n }\n if (id === 'UNLICENSED') {\n return id;\n }\n if (!spdx.has(id)) {\n throw new Error(`Invalid license identifier \"${id}\", see valid license identifiers at https://spdx.org/licenses/`);\n }\n return id;\n}\n\nfunction _validateVersionFormat(format: string): 'short' | 'full' {\n if (format !== 'short' && format !== 'full') {\n throw new Error(`Invalid jsii.versionFormat \"${format}\", it must be either \"short\" or \"full\" (the default)`);\n }\n return format;\n}\n\nfunction _validateStability(stability: string | undefined, deprecated: string | undefined): spec.Stability | undefined {\n if (!stability && deprecated) {\n stability = spec.Stability.Deprecated;\n } else if (deprecated && stability !== spec.Stability.Deprecated) {\n console.warn(\n `Package is deprecated (${deprecated}), but it's stability is ${stability} and not ${spec.Stability.Deprecated}`,\n );\n }\n if (!stability) {\n return undefined;\n }\n if (!Object.values(spec.Stability).includes(stability as any)) {\n throw new Error(`Invalid stability \"${stability}\", it must be one of ${Object.values(spec.Stability).join(', ')}`);\n }\n return stability as spec.Stability;\n}\n\nfunction _validateTsconfigRuleSet(ruleSet: string): TypeScriptConfigValidationRuleSet | undefined {\n if (ruleSet == null) {\n return undefined;\n }\n if (!Object.values(TypeScriptConfigValidationRuleSet).includes(ruleSet as any)) {\n throw new Error(\n `Invalid validateTsconfig \"${ruleSet}\", it must be one of ${Object.values(TypeScriptConfigValidationRuleSet).join(\n ', ',\n )}`,\n );\n }\n\n return ruleSet as TypeScriptConfigValidationRuleSet;\n}\n\n/**\n * Resolves an NPM package specifier to a version range\n *\n * If it was already a version range, return it. If it the\n * package references a local file, return the version that\n * package is at.\n */\nfunction _resolveVersion(dep: string, searchPath: string): { version: string; localPackage?: string } {\n const matches = /^file:(.+)$/.exec(dep);\n if (!matches) {\n return { version: dep };\n }\n const localPackage = path.resolve(searchPath, matches[1]);\n return {\n // Rendering as a caret version to maintain uniformity against the \"standard\".\n // eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires\n version: `^${JSON.parse(fs.readFileSync(path.join(localPackage, 'package.json'), 'utf-8')).version}`,\n localPackage,\n };\n}\n\n/**\n * Merges two metadata blocks together.\n *\n * @param base the base values\n * @param user the user-supplied values, which can override the `base` values\n *\n * @returns the merged metadata block\n */\nfunction mergeMetadata(\n base: NonNullable<ProjectInfo['metadata']>,\n user: ProjectInfo['metadata'],\n): ProjectInfo['metadata'] {\n if (user == null) {\n return base;\n }\n return mergeObjects(base, user);\n\n function mergeObjects(baseObj: Record<string, any>, override: Record<string, any>): Record<string, any> {\n const result: Record<string, any> = {};\n const allKeys = Array.from(new Set([...Object.keys(baseObj), ...Object.keys(override)])).sort();\n for (const key of allKeys) {\n const baseValue = baseObj[key];\n const overrideValue = override[key];\n\n if (typeof baseValue === 'object' && typeof overrideValue === 'object') {\n if (overrideValue != null) {\n result[key] = mergeObjects(baseValue, overrideValue);\n }\n } else {\n result[key] = overrideValue ?? baseValue;\n }\n }\n return result;\n }\n}\n\nfunction _loadDiagnostics(entries?: { [key: string]: string }):\n | {\n readonly [key: string]: ts.DiagnosticCategory;\n }\n | undefined {\n if (entries === undefined || Object.keys(entries).length === 0) {\n return undefined;\n }\n const result: { [key: string]: ts.DiagnosticCategory } = {};\n for (const code of Object.keys(entries)) {\n let category: ts.DiagnosticCategory;\n switch (entries[code].trim().toLowerCase()) {\n case 'error':\n category = ts.DiagnosticCategory.Error;\n break;\n case 'warning':\n category = ts.DiagnosticCategory.Warning;\n break;\n case 'suggestion':\n category = ts.DiagnosticCategory.Suggestion;\n break;\n case 'message':\n category = ts.DiagnosticCategory.Message;\n break;\n default:\n throw new Error(`Invalid category '${entries[code]}' for code '${code}'`);\n }\n result[code] = category;\n }\n return result;\n}\n\nfunction filterDictByKey<A>(xs: Record<string, A>, predicate: (key: string) => boolean): Record<string, A> {\n const ret: Record<string, A> = {};\n for (const [key, value] of Object.entries(xs)) {\n if (predicate(key)) {\n ret[key] = value;\n }\n }\n return ret;\n}\n"]}
1
+ {"version":3,"file":"project-info.js","sourceRoot":"","sources":["../src/project-info.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kCAAkC;AAClC,mCAAmC;AACnC,qCAAoE;AACpE,iCAAiC;AACjC,iCAAiC;AACjC,iCAAiC;AAEjC,oDAA8D;AAC9D,uDAAmD;AACnD,yCAA+D;AAC/D,mCAAkE;AAElE,qGAAqG;AACrG,MAAM,IAAI,GAAgB,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAE9D,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;AAkIlD,SAAgB,eAAe,CAAC,WAAmB;IACjD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAC/D,MAAM,GAAG,GAAgB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IAE/E,MAAM,WAAW,GAAoB,EAAE,CAAC;IAExC,IAAI,kBAA0D,CAAC;IAC/D,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,kBAAkB,IAAI,GAAG,CAAC,mBAAmB,IAAI,EAAE,EAAE,CAAC;QAC3E,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,iBAAS,CACjB,gCAAgC,IAAI,qEAAqE,CAC1G,CAAC;QACJ,CAAC;QAED,IAAI,GAAG,CAAC,gBAAgB,IAAI,IAAI,IAAI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CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,IAAI,QAA+B,CAAC;QACpC,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;YAC3C,KAAK,OAAO;gBACV,QAAQ,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC;gBACvC,MAAM;YACR,KAAK,SAAS;gBACZ,QAAQ,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;gBACzC,MAAM;YACR,KAAK,YAAY;gBACf,QAAQ,GAAG,EAAE,CAAC,kBAAkB,CAAC,UAAU,CAAC;gBAC5C,MAAM;YACR,KAAK,SAAS;gBACZ,QAAQ,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;gBACzC,MAAM;YACR;gBACE,MAAM,IAAI,iBAAS,CAAC,qBAAqB,OAAO,CAAC,IAAI,CAAC,eAAe,IAAI,GAAG,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,eAAe,CAAI,EAAqB,EAAE,SAAmC;IACpF,MAAM,GAAG,GAAsB,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QAC9C,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as spec from '@jsii/spec';\nimport { findAssemblyFile, loadAssemblyFromFile } from '@jsii/spec';\nimport * as log4js from 'log4js';\nimport * as semver from 'semver';\nimport * as ts from 'typescript';\n\nimport { findDependencyDirectory } from './common/find-utils';\nimport { JsiiDiagnostic } from './jsii-diagnostic';\nimport { TypeScriptConfigValidationRuleSet } from './tsconfig';\nimport { JsiiError, parsePerson, parseRepository } from './utils';\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports\nconst spdx: Set<string> = require('spdx-license-list/simple');\n\nconst LOG = log4js.getLogger('jsii/package-info');\n\nexport type TSCompilerOptions = Partial<\n Pick<\n ts.CompilerOptions,\n // Directory preferences\n | 'outDir'\n | 'rootDir'\n // TypeScript path mapping\n | 'baseUrl'\n | 'paths'\n // Style preferences\n | 'forceConsistentCasingInFileNames'\n | 'noImplicitOverride'\n | 'noPropertyAccessFromIndexSignature'\n | 'noUncheckedIndexedAccess'\n // Source map preferences\n | 'declarationMap'\n | 'inlineSourceMap'\n | 'inlineSources'\n | 'sourceMap'\n // Types limitations\n | 'types'\n >\n>;\n\nexport interface ProjectInfo {\n readonly projectRoot: string;\n readonly packageJson: PackageJson;\n\n readonly name: string;\n readonly version: string;\n readonly author: spec.Person;\n readonly deprecated?: string;\n readonly stability?: spec.Stability;\n readonly license: string;\n readonly repository: {\n readonly type: string;\n readonly url: string;\n readonly directory?: string;\n };\n readonly keywords?: readonly string[];\n\n readonly main: string;\n readonly types: string;\n\n readonly dependencies: { readonly [name: string]: string };\n readonly peerDependencies: { readonly [name: string]: string };\n readonly dependencyClosure: readonly spec.Assembly[];\n readonly bundleDependencies?: { readonly [name: string]: string };\n readonly targets: spec.AssemblyTargets;\n readonly metadata?: { readonly [key: string]: any };\n readonly jsiiVersionFormat: 'short' | 'full';\n readonly diagnostics?: { readonly [code: string]: ts.DiagnosticCategory };\n readonly description?: string;\n readonly homepage?: string;\n readonly contributors?: readonly spec.Person[];\n readonly excludeTypescript: readonly string[];\n readonly projectReferences?: boolean;\n readonly tsc?: TSCompilerOptions;\n readonly bin?: { readonly [name: string]: string };\n readonly exports?: {\n readonly [name: string]: string | { readonly [name: string]: string };\n };\n\n // user-provided tsconfig\n readonly tsconfig?: string;\n readonly validateTsconfig?: TypeScriptConfigValidationRuleSet;\n}\n\nexport interface PackageJson {\n readonly description?: string;\n readonly homepage?: string;\n readonly name?: string;\n readonly version?: string;\n readonly keywords?: readonly string[];\n readonly license?: string;\n readonly private?: boolean;\n\n readonly exports?: { readonly [path: string]: string | { readonly [name: string]: string } };\n readonly main?: string;\n readonly types?: string;\n /**\n * @example { \"<4.0\": { \"*\": [\"ts3.9/*\"] } }\n * @example { \"<4.0\": { \"index.d.ts\": [\"index.ts3-9.d.ts\"] } }\n */\n readonly typesVersions?: {\n readonly [versionRange: string]: { readonly [pattern: string]: readonly string[] };\n };\n\n readonly bin?: { readonly [name: string]: string };\n\n readonly stability?: string;\n readonly deprecated?: string;\n\n readonly dependencies?: { readonly [name: string]: string };\n readonly devDependencies?: { readonly [name: string]: string };\n readonly peerDependencies?: { readonly [name: string]: string };\n\n readonly bundleDependencies?: readonly string[];\n readonly bundledDependencies?: readonly string[];\n\n readonly jsii?: {\n // main jsii config\n readonly diagnostics?: { readonly [id: string]: 'error' | 'warning' | 'suggestion' | 'message' };\n readonly metadata?: { readonly [key: string]: unknown };\n readonly targets?: { readonly [name: string]: unknown };\n readonly versionFormat?: 'short' | 'full';\n\n // Either user-provided config ...\n readonly tsconfig?: string;\n readonly validateTsconfig?: string;\n\n // ... or configure tsc here\n readonly excludeTypescript?: readonly string[];\n readonly projectReferences?: boolean;\n readonly tsc?: TSCompilerOptions;\n\n // unexpected options\n readonly [key: string]: unknown;\n };\n\n readonly [key: string]: unknown;\n}\n\nexport interface ProjectInfoResult {\n readonly projectInfo: ProjectInfo;\n readonly diagnostics: readonly ts.Diagnostic[];\n}\n\nexport function loadProjectInfo(projectRoot: string): ProjectInfoResult {\n const packageJsonPath = path.join(projectRoot, 'package.json');\n const pkg: PackageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n\n const diagnostics: ts.Diagnostic[] = [];\n\n let bundleDependencies: { [name: string]: string } | undefined;\n for (const name of pkg.bundleDependencies ?? pkg.bundledDependencies ?? []) {\n const version = pkg.dependencies?.[name];\n if (!version) {\n throw new JsiiError(\n `The \"package.json\" file has \"${name}\" in \"bundleDependencies\", but it is not declared in \"dependencies\"`,\n );\n }\n\n if (pkg.peerDependencies && name in pkg.peerDependencies) {\n throw new JsiiError(\n `The \"package.json\" file has \"${name}\" in \"bundleDependencies\", and also in \"peerDependencies\"`,\n );\n }\n\n bundleDependencies = bundleDependencies ?? {};\n bundleDependencies[name] = _resolveVersion(version, projectRoot).version;\n }\n\n // Check peerDependencies are also in devDependencies\n // You need this to write tests properly. There are probably cases where\n // it makes sense to have this different, so most of what this checking\n // produces is warnings, not errors.\n const devDependencies = pkg.devDependencies ?? {};\n for (const [name, rng] of Object.entries(pkg.peerDependencies ?? {})) {\n const range = new semver.Range(_resolveVersion(rng as string, projectRoot).version);\n const minVersion = semver.minVersion(range)?.raw;\n\n if (!(name in devDependencies) || devDependencies[name] !== `${minVersion}`) {\n diagnostics.push(\n JsiiDiagnostic.JSII_0006_MISSING_DEV_DEPENDENCY.createDetached(\n name,\n `${rng as any}`,\n `${minVersion}`,\n `${devDependencies[name]}`,\n ),\n );\n continue;\n }\n }\n\n const bundled = new Set(Object.keys(bundleDependencies ?? {}));\n const dependencies: Record<string, string> = filterDictByKey(\n pkg.dependencies ?? {},\n (depName) => !bundled.has(depName),\n );\n const peerDependencies: Record<string, string> = pkg.peerDependencies ?? {};\n\n const resolver = new DependencyResolver();\n const resolved = resolver.discoverDependencyTree(projectRoot, {\n ...dependencies,\n ...peerDependencies,\n });\n const transitiveDependencies = resolver.assemblyClosure(resolved);\n\n const metadata = mergeMetadata(\n {\n jsii: {\n pacmak: {\n // When `true`, `jsii-pacmak` will use the `Jsii$Default` implementation in code generation even for dependencies.\n hasDefaultInterfaces: true,\n },\n },\n },\n pkg.jsii?.metadata,\n );\n\n const projectInfo: ProjectInfo = {\n projectRoot,\n packageJson: pkg,\n\n name: _required(pkg.name, 'The \"package.json\" file must specify the \"name\" attribute'),\n version: _required(pkg.version, 'The \"package.json\" file must specify the \"version\" attribute'),\n deprecated: pkg.deprecated,\n stability: _validateStability(pkg.stability, pkg.deprecated),\n author: _toPerson(_required(pkg.author, 'The \"package.json\" file must specify the \"author\" attribute'), 'author'),\n repository: _toRepository(\n _required(pkg.repository, 'The \"package.json\" file must specify the \"repository\" attribute'),\n ),\n license: _validateLicense(pkg.license),\n keywords: pkg.keywords,\n\n main: _required(pkg.main, 'The \"package.json\" file must specify the \"main\" attribute'),\n types: _required(pkg.types, 'The \"package.json\" file must specify the \"types\" attribute'),\n\n dependencies,\n peerDependencies,\n dependencyClosure: transitiveDependencies,\n bundleDependencies,\n targets: {\n ..._required(pkg.jsii, 'The \"package.json\" file must specify the \"jsii\" attribute').targets,\n js: { npm: pkg.name },\n },\n metadata,\n jsiiVersionFormat: _validateVersionFormat(pkg.jsii?.versionFormat ?? 'full'),\n\n description: pkg.description,\n homepage: pkg.homepage,\n contributors: (pkg.contributors as any[])?.map((contrib, index) =>\n _toPerson(contrib, `contributors[${index}]`, 'contributor'),\n ),\n\n excludeTypescript: pkg.jsii?.excludeTypescript ?? [],\n projectReferences: pkg.jsii?.projectReferences,\n tsc: {\n outDir: pkg.jsii?.tsc?.outDir,\n rootDir: pkg.jsii?.tsc?.rootDir,\n baseUrl: pkg.jsii?.tsc?.baseUrl,\n paths: pkg.jsii?.tsc?.paths,\n forceConsistentCasingInFileNames: pkg.jsii?.tsc?.forceConsistentCasingInFileNames,\n noImplicitOverride: pkg.jsii?.tsc?.noImplicitOverride,\n noPropertyAccessFromIndexSignature: pkg.jsii?.tsc?.noPropertyAccessFromIndexSignature,\n noUncheckedIndexedAccess: pkg.jsii?.tsc?.noUncheckedIndexedAccess,\n ..._sourceMapPreferences(pkg.jsii?.tsc),\n types: pkg.jsii?.tsc?.types,\n },\n bin: pkg.bin,\n exports: pkg.exports,\n diagnostics: _loadDiagnostics(pkg.jsii?.diagnostics),\n\n // user-provided tsconfig\n tsconfig: pkg.jsii?.tsconfig,\n validateTsconfig: _validateTsconfigRuleSet(pkg.jsii?.validateTsconfig ?? 'strict'),\n };\n return { projectInfo, diagnostics };\n}\n\nfunction _guessRepositoryType(url: string): string {\n if (url.endsWith('.git')) {\n return 'git';\n }\n const parts = /^([^:]+):\\/\\//.exec(url);\n if (parts?.[1] !== 'http' && parts?.[1] !== 'https') {\n return parts![1];\n }\n throw new JsiiError(\n `The \"package.json\" file must specify the \"repository.type\" attribute (could not guess from ${url})`,\n );\n}\n\nfunction _sourceMapPreferences({ declarationMap, inlineSourceMap, inlineSources, sourceMap }: TSCompilerOptions = {}) {\n // If none of the options are specified, use the default configuration from jsii <= 1.58.0, which\n // means inline source maps with embedded source information.\n if (declarationMap == null && inlineSourceMap == null && inlineSources == null && sourceMap == null) {\n declarationMap = false;\n inlineSourceMap = true;\n inlineSources = true;\n sourceMap = undefined;\n }\n\n return {\n declarationMap,\n inlineSourceMap,\n inlineSources,\n sourceMap,\n };\n}\n\ninterface DependencyInfo {\n readonly assembly: spec.Assembly;\n readonly resolvedDependencies: Record<string, string>;\n}\n\nclass DependencyResolver {\n private readonly cache = new Map<string, DependencyInfo>();\n\n /**\n * Discover the dependency tree starting at 'root', validating versions as we go along\n *\n * This primes the data structures in this class and should be called first.\n *\n * Return the resolved jsii dependency paths\n */\n public discoverDependencyTree(root: string, dependencies: Record<string, string>): Record<string, string> {\n const ret: Record<string, string> = {};\n for (const [name, declaration] of Object.entries(dependencies)) {\n // eslint-disable-next-line no-await-in-loop\n let resolved;\n try {\n resolved = this.resolveDependency(root, name, declaration);\n } catch (e) {\n LOG.error(\n `Unable to find a JSII dependency named \"${name}\" as \"${declaration}\". If you meant to include a non-JSII dependency, try adding it to bundledDependencies instead.`,\n );\n throw e;\n }\n\n const actualVersion = resolved.dependencyInfo.assembly.version;\n if (!semver.satisfies(actualVersion, declaration)) {\n throw new JsiiError(\n `Declared dependency on version ${declaration} of ${name}, but version ${actualVersion} was found`,\n );\n }\n\n ret[name] = resolved.resolvedFile;\n }\n return ret;\n }\n\n /**\n * From a set of resolved paths, recursively return all assemblies\n */\n public assemblyClosure(resolved: Record<string, string>): spec.Assembly[] {\n const closure = new Map<string, spec.Assembly>();\n const queue = Array.from(Object.values(resolved));\n while (queue.length > 0) {\n const next = queue.shift()!;\n const depInfo = this.cache.get(next);\n if (!depInfo) {\n throw new Error(`Path ${next} not seen before`);\n }\n if (closure.has(next)) {\n continue;\n }\n\n closure.set(next, depInfo.assembly);\n queue.push(...Object.values(depInfo.resolvedDependencies));\n }\n return Array.from(closure.values());\n }\n\n private resolveDependency(root: string, name: string, declaration: string) {\n const { version: versionString, localPackage } = _resolveVersion(declaration, root);\n const version = new semver.Range(versionString);\n if (!version) {\n throw new JsiiError(`Invalid semver expression for ${name}: ${versionString}`);\n }\n const jsiiFile = _tryResolveAssembly(name, localPackage, root);\n LOG.debug(`Resolved dependency ${name} to ${jsiiFile}`);\n return {\n resolvedVersion: versionString,\n resolvedFile: jsiiFile,\n dependencyInfo: this.loadAssemblyAndRecurse(jsiiFile),\n };\n }\n\n private loadAssemblyAndRecurse(jsiiFile: string) {\n // Only recurse if we haven't seen this assembly yet\n if (this.cache.has(jsiiFile)) {\n return this.cache.get(jsiiFile)!;\n }\n\n const assembly = loadAssemblyFromFile(jsiiFile);\n\n // Continue loading any dependencies declared in the asm\n const resolvedDependencies = assembly.dependencies\n ? this.discoverDependencyTree(path.dirname(jsiiFile), assembly.dependencies)\n : {};\n\n const depInfo: DependencyInfo = {\n assembly,\n resolvedDependencies,\n };\n this.cache.set(jsiiFile, depInfo);\n return depInfo;\n }\n}\n\nfunction _required<T>(value: T | undefined, message: string): T {\n if (value == null) {\n throw new JsiiError(message);\n }\n return value;\n}\n\nfunction _toPerson(value: any, field: string, defaultRole: string = field): spec.Person {\n if (typeof value === 'string') {\n value = parsePerson(value);\n }\n return {\n name: _required(value.name, `The \"package.json\" file must specify the \"${field}.name\" attribute`),\n roles: value.roles ? [...new Set(value.roles as string[])] : [defaultRole],\n email: value.email,\n url: value.url,\n organization: value.organization ? value.organization : undefined,\n };\n}\n\nfunction _toRepository(value: any): {\n type: string;\n url: string;\n directory?: string;\n} {\n if (typeof value === 'string') {\n value = parseRepository(value);\n }\n return {\n url: _required(value.url, 'The \"package.json\" file must specify the \"repository.url\" attribute'),\n type: value.type || _guessRepositoryType(value.url),\n directory: value.directory,\n };\n}\n\nfunction _tryResolveAssembly(mod: string, localPackage: string | undefined, searchPath: string): string {\n if (localPackage) {\n const result = findAssemblyFile(localPackage);\n if (!fs.existsSync(result)) {\n throw new JsiiError(`Assembly does not exist: ${result}`);\n }\n return result;\n }\n try {\n const dependencyDir = findDependencyDirectory(mod, searchPath);\n return findAssemblyFile(dependencyDir);\n } catch (e: any) {\n throw new JsiiError(\n `Unable to locate jsii assembly for \"${mod}\". If this module is not jsii-enabled, it must also be declared under bundledDependencies: ${e}`,\n );\n }\n}\n\nfunction _validateLicense(id: string | undefined): string {\n if (id == null) {\n throw new JsiiError(\n 'No \"license\" was specified in \"package.json\", see valid license identifiers at https://spdx.org/licenses/',\n );\n }\n if (id === 'UNLICENSED') {\n return id;\n }\n if (!spdx.has(id)) {\n throw new JsiiError(\n `Invalid license identifier \"${id}\", see valid license identifiers at https://spdx.org/licenses/`,\n );\n }\n return id;\n}\n\nfunction _validateVersionFormat(format: string): 'short' | 'full' {\n if (format !== 'short' && format !== 'full') {\n throw new JsiiError(`Invalid jsii.versionFormat \"${format}\", it must be either \"short\" or \"full\" (the default)`);\n }\n return format;\n}\n\nfunction _validateStability(stability: string | undefined, deprecated: string | undefined): spec.Stability | undefined {\n if (!stability && deprecated) {\n stability = spec.Stability.Deprecated;\n } else if (deprecated && stability !== spec.Stability.Deprecated) {\n console.warn(\n `Package is deprecated (${deprecated}), but it's stability is ${stability} and not ${spec.Stability.Deprecated}`,\n );\n }\n if (!stability) {\n return undefined;\n }\n if (!Object.values(spec.Stability).includes(stability as any)) {\n throw new JsiiError(\n `Invalid stability \"${stability}\", it must be one of ${Object.values(spec.Stability).join(', ')}`,\n );\n }\n return stability as spec.Stability;\n}\n\nfunction _validateTsconfigRuleSet(ruleSet: string): TypeScriptConfigValidationRuleSet | undefined {\n if (ruleSet == null) {\n return undefined;\n }\n if (!Object.values(TypeScriptConfigValidationRuleSet).includes(ruleSet as any)) {\n throw new JsiiError(\n `Invalid validateTsconfig \"${ruleSet}\", it must be one of ${Object.values(TypeScriptConfigValidationRuleSet).join(\n ', ',\n )}`,\n );\n }\n\n return ruleSet as TypeScriptConfigValidationRuleSet;\n}\n\n/**\n * Resolves an NPM package specifier to a version range\n *\n * If it was already a version range, return it. If it the\n * package references a local file, return the version that\n * package is at.\n */\nfunction _resolveVersion(dep: string, searchPath: string): { version: string; localPackage?: string } {\n const matches = /^file:(.+)$/.exec(dep);\n if (!matches) {\n return { version: dep };\n }\n const localPackage = path.resolve(searchPath, matches[1]);\n return {\n // Rendering as a caret version to maintain uniformity against the \"standard\".\n // eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires\n version: `^${JSON.parse(fs.readFileSync(path.join(localPackage, 'package.json'), 'utf-8')).version}`,\n localPackage,\n };\n}\n\n/**\n * Merges two metadata blocks together.\n *\n * @param base the base values\n * @param user the user-supplied values, which can override the `base` values\n *\n * @returns the merged metadata block\n */\nfunction mergeMetadata(\n base: NonNullable<ProjectInfo['metadata']>,\n user: ProjectInfo['metadata'],\n): ProjectInfo['metadata'] {\n if (user == null) {\n return base;\n }\n return mergeObjects(base, user);\n\n function mergeObjects(baseObj: Record<string, any>, override: Record<string, any>): Record<string, any> {\n const result: Record<string, any> = {};\n const allKeys = Array.from(new Set([...Object.keys(baseObj), ...Object.keys(override)])).sort();\n for (const key of allKeys) {\n const baseValue = baseObj[key];\n const overrideValue = override[key];\n\n if (typeof baseValue === 'object' && typeof overrideValue === 'object') {\n if (overrideValue != null) {\n result[key] = mergeObjects(baseValue, overrideValue);\n }\n } else {\n result[key] = overrideValue ?? baseValue;\n }\n }\n return result;\n }\n}\n\nfunction _loadDiagnostics(entries?: { [key: string]: string }):\n | {\n readonly [key: string]: ts.DiagnosticCategory;\n }\n | undefined {\n if (entries === undefined || Object.keys(entries).length === 0) {\n return undefined;\n }\n const result: { [key: string]: ts.DiagnosticCategory } = {};\n for (const code of Object.keys(entries)) {\n let category: ts.DiagnosticCategory;\n switch (entries[code].trim().toLowerCase()) {\n case 'error':\n category = ts.DiagnosticCategory.Error;\n break;\n case 'warning':\n category = ts.DiagnosticCategory.Warning;\n break;\n case 'suggestion':\n category = ts.DiagnosticCategory.Suggestion;\n break;\n case 'message':\n category = ts.DiagnosticCategory.Message;\n break;\n default:\n throw new JsiiError(`Invalid category '${entries[code]}' for code '${code}'`);\n }\n result[code] = category;\n }\n return result;\n}\n\nfunction filterDictByKey<A>(xs: Record<string, A>, predicate: (key: string) => boolean): Record<string, A> {\n const ret: Record<string, A> = {};\n for (const [key, value] of Object.entries(xs)) {\n if (predicate(key)) {\n ret[key] = value;\n }\n }\n return ret;\n}\n"]}
@@ -6,6 +6,7 @@ const spec_1 = require("@jsii/spec");
6
6
  const ts = require("typescript");
7
7
  const jsii_diagnostic_1 = require("../jsii-diagnostic");
8
8
  const bindings = require("../node-bindings");
9
+ const utils_1 = require("../utils");
9
10
  class DeprecatedRemover {
10
11
  constructor(typeChecker, allowlistedDeprecations) {
11
12
  this.typeChecker = typeChecker;
@@ -251,7 +252,7 @@ class Transformation {
251
252
  static addInterface(typeChecker, node, iface) {
252
253
  return new Transformation(typeChecker, node, (declaration) => {
253
254
  if (!ts.isClassDeclaration(declaration) && !ts.isInterfaceDeclaration(declaration)) {
254
- throw new Error(`Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);
255
+ throw new utils_1.JsiiError(`Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);
255
256
  }
256
257
  const { typeExpression: newInterface, syntheticImport } = Transformation.typeReference(iface, declaration, typeChecker);
257
258
  if (ts.isClassDeclaration(declaration)) {
@@ -279,7 +280,7 @@ class Transformation {
279
280
  static replaceBaseClass(typeChecker, node, baseClass) {
280
281
  return new Transformation(typeChecker, node, (declaration) => {
281
282
  if (!ts.isClassDeclaration(declaration)) {
282
- throw new Error(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);
283
+ throw new utils_1.JsiiError(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);
283
284
  }
284
285
  const { typeExpression: newBaseClass, syntheticImport } = Transformation.typeReference(baseClass, declaration, typeChecker);
285
286
  const existingClause = declaration.heritageClauses?.find((clause) => clause.token === ts.SyntaxKind.ExtendsKeyword);
@@ -297,7 +298,7 @@ class Transformation {
297
298
  static removeBaseClass(typeChecker, node) {
298
299
  return new Transformation(typeChecker, node, (declaration) => {
299
300
  if (!ts.isClassDeclaration(declaration)) {
300
- throw new Error(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);
301
+ throw new utils_1.JsiiError(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);
301
302
  }
302
303
  return {
303
304
  node: ts.factory.updateClassDeclaration(declaration, declaration.modifiers, declaration.name, declaration.typeParameters, declaration.heritageClauses?.filter((clause) => clause.token !== ts.SyntaxKind.ExtendsKeyword), declaration.members),
@@ -317,7 +318,7 @@ class Transformation {
317
318
  node: ts.factory.updateInterfaceDeclaration(declaration, declaration.modifiers, declaration.name, declaration.typeParameters, removeInterfaceHeritage(declaration.heritageClauses), declaration.members),
318
319
  };
319
320
  }
320
- throw new Error(`Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);
321
+ throw new utils_1.JsiiError(`Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);
321
322
  });
322
323
  function removeInterfaceHeritage(clauses) {
323
324
  if (clauses == null) {
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated-remover.js","sourceRoot":"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/B,EAAE,CAAC,UAAU,CAAC,eAAe;IAC7B,EAAE,CAAC,UAAU,CAAC,iBAAiB;IAC/B,EAAE,CAAC,UAAU,CAAC,mBAAmB;IACjC,EAAE,CAAC,UAAU,CAAC,WAAW;IACzB,EAAE,CAAC,UAAU,CAAC,mBAAmB;CAClC,CAAC,AAVqC,CAUpC","sourcesContent":["import { basename, dirname, relative } from 'node:path';\nimport {\n Assembly,\n ClassType,\n EnumMember,\n Initializer,\n InterfaceType,\n isClassOrInterfaceType,\n isClassType,\n isCollectionTypeReference,\n isEnumType,\n isMethod,\n isNamedTypeReference,\n isPrimitiveTypeReference,\n Method,\n Parameter,\n Property,\n Stability,\n TypeReference,\n} from '@jsii/spec';\nimport * as ts from 'typescript';\n\nimport { JsiiDiagnostic } from '../jsii-diagnostic';\nimport * as bindings from '../node-bindings';\n\nexport class DeprecatedRemover {\n private readonly transformations = new Array<Transformation>();\n private readonly nodesToRemove = new Set<ts.Node>();\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly allowlistedDeprecations: Set<string> | undefined,\n ) {}\n\n /**\n * Obtains the configuration for the TypeScript transform(s) that will remove\n * `@deprecated` members from the generated declarations (`.d.ts`) files. It\n * will leverage information accumulated during `#removeFrom(Assembly)` in\n * order to apply corrections to inheritance chains, ensuring a valid output\n * is produced.\n */\n public get customTransformers(): ts.CustomTransformers {\n return {\n afterDeclarations: [\n (context) => {\n const transformer = new DeprecationRemovalTransformer(\n this.typeChecker,\n context,\n this.transformations,\n this.nodesToRemove,\n );\n return transformer.transform.bind(transformer);\n },\n ],\n };\n }\n\n /**\n * Removes all `@deprecated` API elements from the provided assembly, and\n * records the operations needed in order to fix the inheritance chains that\n * mix `@deprecated` and non-`@deprecated` types.\n *\n * @param assembly the assembly to be modified.\n *\n * @returns diagnostic messages produced when validating no remaining API\n * makes use of a `@deprecated` type that was removed.\n */\n public removeFrom(assembly: Assembly): readonly JsiiDiagnostic[] {\n if (assembly.types == null) {\n return [];\n }\n\n const strippedFqns = new Set<string>();\n const replaceWithClass = new Map<string, string>();\n const replaceWithInterfaces = new Map<string, readonly string[]>();\n\n // Find all types that will be stripped out\n for (const [fqn, typeInfo] of Object.entries(assembly.types)) {\n if (typeInfo.docs?.stability === Stability.Deprecated) {\n if (!this.shouldFqnBeStripped(fqn)) {\n continue;\n }\n strippedFqns.add(fqn);\n\n if (isClassType(typeInfo) && typeInfo.base != null) {\n replaceWithClass.set(fqn, typeInfo.base);\n }\n if (isClassOrInterfaceType(typeInfo) && typeInfo.interfaces != null) {\n replaceWithInterfaces.set(fqn, typeInfo.interfaces);\n }\n\n this.nodesToRemove.add(bindings.getRelatedNode(typeInfo)!);\n }\n }\n\n for (const [fqn, typeInfo] of Object.entries(assembly.types)) {\n // Ignore `@deprecated` types\n if (strippedFqns.has(fqn)) {\n continue;\n }\n\n // Enums cannot have references to `@deprecated` types, but can have deprecated members\n if (isEnumType(typeInfo)) {\n const enumNode = bindings.getEnumRelatedNode(typeInfo)!;\n const members: EnumMember[] = [];\n for (const mem of typeInfo.members) {\n if (mem.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${mem.name}`)) {\n const matchingMemberNode = enumNode.members.find((enumMem) => enumMem.name.getText() === mem.name);\n if (matchingMemberNode) {\n this.nodesToRemove.add(matchingMemberNode);\n }\n } else {\n members.push(mem);\n }\n }\n typeInfo.members = members;\n continue;\n }\n\n // For classes, we erase `@deprecated` base classes, replacing as needed\n const additionalInterfaces = new Set<string>();\n if (isClassType(typeInfo) && typeInfo.base != null && strippedFqns.has(typeInfo.base)) {\n while (typeInfo.base != null && strippedFqns.has(typeInfo.base)) {\n const oldBase = assembly.types[typeInfo.base] as ClassType;\n if (oldBase.interfaces) for (const addFqn of oldBase.interfaces) additionalInterfaces.add(addFqn);\n typeInfo.base = replaceWithClass.get(typeInfo.base);\n }\n this.transformations.push(\n typeInfo.base != null\n ? Transformation.replaceBaseClass(\n this.typeChecker,\n bindings.getClassRelatedNode(typeInfo)!,\n typeInfo.base in assembly.types\n ? bindings.getClassRelatedNode(assembly.types[typeInfo.base] as ClassType) ?? typeInfo.base\n : typeInfo.base,\n )\n : Transformation.removeBaseClass(this.typeChecker, bindings.getClassRelatedNode(typeInfo)!),\n );\n }\n\n // Be defensive in case we add other kinds in the future\n if (!isClassOrInterfaceType(typeInfo)) {\n throw new Error(`Unhandled type encountered! ${JSON.stringify(typeInfo, null, 2)}`);\n }\n\n // Strip all `@deprecated` interfaces from the inheritance tree, replacing as needed\n if (typeInfo.interfaces?.some((addFqn) => strippedFqns.has(addFqn)) || additionalInterfaces.size > 0) {\n const originalSet = new Set(typeInfo.interfaces ?? []);\n const newSet = new Set<string>();\n\n const candidates = Array.from(new Set([...originalSet, ...additionalInterfaces]));\n while (candidates.length > 0) {\n const candidateFqn = candidates.pop()!;\n if (!strippedFqns.has(candidateFqn)) {\n newSet.add(candidateFqn);\n if (!originalSet.has(candidateFqn)) {\n this.transformations.push(\n Transformation.addInterface(\n this.typeChecker,\n bindings.getClassOrInterfaceRelatedNode(typeInfo)!,\n candidateFqn in assembly.types\n ? bindings.getInterfaceRelatedNode(assembly.types[candidateFqn] as InterfaceType) ?? candidateFqn\n : candidateFqn,\n ),\n );\n }\n continue;\n }\n if (originalSet.has(candidateFqn)) {\n this.transformations.push(\n Transformation.removeInterface(\n this.typeChecker,\n bindings.getClassOrInterfaceRelatedNode(typeInfo)!,\n bindings.getInterfaceRelatedNode(assembly.types[candidateFqn] as InterfaceType)!,\n ),\n );\n }\n const replacement = replaceWithInterfaces.get(candidateFqn);\n if (replacement != null) {\n candidates.push(...replacement);\n }\n }\n\n typeInfo.interfaces = newSet.size > 0 ? Array.from(newSet).sort() : undefined;\n }\n\n // Drop all `@deprecated` members, and remove \"overrides\" from stripped types\n const methods: Method[] = [];\n const properties: Property[] = [];\n if (typeInfo.methods) {\n for (const meth of typeInfo.methods) {\n if (meth.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${meth.name}`)) {\n this.nodesToRemove.add(bindings.getMethodRelatedNode(meth)!);\n } else {\n methods.push(\n meth.overrides != null && strippedFqns.has(meth.overrides) ? { ...meth, overrides: undefined } : meth,\n );\n }\n }\n }\n typeInfo.methods = typeInfo.methods ? methods : undefined;\n if (typeInfo.properties) {\n for (const prop of typeInfo.properties) {\n if (prop.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${prop.name}`)) {\n this.nodesToRemove.add(bindings.getParameterRelatedNode(prop)!);\n } else {\n properties.push(\n prop.overrides != null && strippedFqns.has(prop.overrides) ? { ...prop, overrides: undefined } : prop,\n );\n }\n }\n }\n typeInfo.properties = typeInfo.properties ? properties : undefined;\n }\n\n const diagnostics = this.findLeftoverUseOfDeprecatedAPIs(assembly, strippedFqns);\n\n // Remove all `@deprecated` types, after we did everything, so we could\n // still access the related nodes from the assembly object.\n for (const fqn of strippedFqns) {\n if (this.shouldFqnBeStripped(fqn)) {\n delete assembly.types[fqn];\n }\n }\n\n return diagnostics;\n }\n\n private findLeftoverUseOfDeprecatedAPIs(assembly: Assembly, strippedFqns: Set<string>): readonly JsiiDiagnostic[] {\n if (assembly.types == null) {\n return [];\n }\n\n const result = new Array<JsiiDiagnostic>();\n\n for (const type of Object.values(assembly.types)) {\n if (isEnumType(type) || strippedFqns.has(type.fqn)) {\n continue;\n }\n if (isClassType(type) && type.initializer) {\n result.push(...this.verifyCallable(assembly, strippedFqns, type.initializer));\n }\n if (type.methods)\n for (const method of type.methods) result.push(...this.verifyCallable(assembly, strippedFqns, method));\n if (type.properties)\n for (const property of type.properties) result.push(...this.verifyProperty(assembly, strippedFqns, property));\n }\n\n return result;\n }\n\n private verifyCallable(\n assembly: Assembly,\n strippedFqns: ReadonlySet<string>,\n method: Method | Initializer,\n ): readonly JsiiDiagnostic[] {\n const diagnostics = new Array<JsiiDiagnostic>();\n const deprecatedReturnFqn =\n isMethod(method) && method.returns && this.tryFindReference(method.returns.type, strippedFqns);\n if (deprecatedReturnFqn) {\n diagnostics.push(this.makeDiagnostic(deprecatedReturnFqn, 'Method', method, assembly));\n }\n\n if (method.parameters) {\n for (const parameter of method.parameters) {\n const deprecatedTypeFqn = this.tryFindReference(parameter.type, strippedFqns);\n if (deprecatedTypeFqn) {\n diagnostics.push(this.makeDiagnostic(deprecatedTypeFqn, 'Parameter', parameter, assembly));\n }\n }\n }\n return diagnostics;\n }\n\n private verifyProperty(\n assembly: Assembly,\n strippedFqns: ReadonlySet<string>,\n property: Property,\n ): readonly JsiiDiagnostic[] {\n const deprecatedTypeFqn = this.tryFindReference(property.type, strippedFqns);\n if (deprecatedTypeFqn) {\n return [this.makeDiagnostic(deprecatedTypeFqn, 'Property', property, assembly)];\n }\n return [];\n }\n\n /**\n * Determines whether a `TypeReference` contains an FQN within a given set.\n *\n * @param ref the tested `TypeReference`.\n * @param fqns the set of FQNs that are being searched for.\n *\n * @returns the first FQN that was identified.\n */\n private tryFindReference(ref: TypeReference, fqns: ReadonlySet<string>): string | undefined {\n if (isNamedTypeReference(ref)) {\n return fqns.has(ref.fqn) ? ref.fqn : undefined;\n }\n if (isPrimitiveTypeReference(ref)) {\n return undefined;\n }\n if (isCollectionTypeReference(ref)) {\n return this.tryFindReference(ref.collection.elementtype, fqns);\n }\n return ref.union.types.map((type) => this.tryFindReference(type, fqns)).find((typeRef) => typeRef != null);\n }\n\n private shouldFqnBeStripped(fqn: string) {\n return this.allowlistedDeprecations?.has(fqn) ?? true;\n }\n\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Method',\n context: Method | Initializer,\n assembly: Assembly,\n ): JsiiDiagnostic;\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Parameter',\n context: Parameter,\n assembly: Assembly,\n ): JsiiDiagnostic;\n private makeDiagnostic(fqn: string, messagePrefix: 'Property', context: Property, assembly: Assembly): JsiiDiagnostic;\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Method' | 'Property' | 'Parameter',\n context: Method | Initializer | Parameter | Property,\n assembly: Assembly,\n ): JsiiDiagnostic {\n const node = bindings.getRelatedNode<\n | ts.AccessorDeclaration\n | ts.MethodDeclaration\n | ts.MethodSignature\n | ts.ParameterDeclaration\n | ts.PropertyDeclaration\n | ts.PropertySignature\n >(context);\n const diagnostic = JsiiDiagnostic.JSII_3999_INCOHERENT_TYPE_MODEL.create(\n node?.type ?? node!,\n `${messagePrefix} has @deprecated type ${fqn}, and it is erased by --strip-deprecated.`,\n );\n\n const typeInfo = assembly.types?.[fqn];\n const typeNode = typeInfo && bindings.getTypeRelatedNode(typeInfo);\n if (typeNode == null) {\n return diagnostic;\n }\n return diagnostic.addRelatedInformation(\n ts.getNameOfDeclaration(typeNode) ?? typeNode,\n 'The @deprecated type is declared here',\n );\n }\n}\n\nclass Transformation {\n public static addInterface(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration | ts.InterfaceDeclaration,\n iface: ts.InterfaceDeclaration | string,\n ) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration) && !ts.isInterfaceDeclaration(declaration)) {\n throw new Error(\n `Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`,\n );\n }\n\n const { typeExpression: newInterface, syntheticImport } = Transformation.typeReference(\n iface,\n declaration,\n typeChecker,\n );\n if (ts.isClassDeclaration(declaration)) {\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n addInterfaceTo(ts.SyntaxKind.ImplementsKeyword, declaration.heritageClauses),\n declaration.members,\n ),\n syntheticImport,\n };\n }\n return {\n node: ts.factory.updateInterfaceDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n addInterfaceTo(ts.SyntaxKind.ExtendsKeyword, declaration.heritageClauses),\n declaration.members,\n ),\n syntheticImport,\n };\n\n function addInterfaceTo(\n token: ts.HeritageClause['token'],\n clauses: readonly ts.HeritageClause[] = [],\n ): ts.HeritageClause[] {\n const existingClause = clauses.find((clause) => clause.token === token);\n if (existingClause == null) {\n return [...clauses, ts.factory.createHeritageClause(token, [newInterface])];\n }\n return [\n ...clauses.filter((clause) => clause !== existingClause),\n ts.factory.updateHeritageClause(existingClause, [...existingClause.types, newInterface]),\n ];\n }\n });\n }\n\n public static replaceBaseClass(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration,\n baseClass: ts.ClassDeclaration | string,\n ) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration)) {\n throw new Error(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);\n }\n const { typeExpression: newBaseClass, syntheticImport } = Transformation.typeReference(\n baseClass,\n declaration,\n typeChecker,\n );\n const existingClause = declaration.heritageClauses?.find(\n (clause) => clause.token === ts.SyntaxKind.ExtendsKeyword,\n );\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n [\n ...(declaration.heritageClauses ?? []).filter((clause) => clause !== existingClause),\n existingClause\n ? ts.factory.updateHeritageClause(existingClause, [newBaseClass])\n : ts.factory.createHeritageClause(ts.SyntaxKind.ExtendsKeyword, [newBaseClass]),\n ],\n declaration.members,\n ),\n syntheticImports: syntheticImport && [syntheticImport],\n };\n });\n }\n\n public static removeBaseClass(typeChecker: ts.TypeChecker, node: ts.ClassDeclaration) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration)) {\n throw new Error(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);\n }\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n declaration.heritageClauses?.filter((clause) => clause.token !== ts.SyntaxKind.ExtendsKeyword),\n declaration.members,\n ),\n };\n });\n }\n\n public static removeInterface(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration | ts.InterfaceDeclaration,\n iface: ts.InterfaceDeclaration,\n ) {\n const ifaceName = Transformation.fullyQualifiedName(typeChecker, iface)!;\n\n return new Transformation(typeChecker, node, (declaration) => {\n if (ts.isClassDeclaration(declaration)) {\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n removeInterfaceHeritage(declaration.heritageClauses),\n declaration.members,\n ),\n };\n } else if (ts.isInterfaceDeclaration(declaration)) {\n return {\n node: ts.factory.updateInterfaceDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n removeInterfaceHeritage(declaration.heritageClauses),\n declaration.members,\n ),\n };\n }\n throw new Error(\n `Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`,\n );\n });\n\n function removeInterfaceHeritage(\n clauses: readonly ts.HeritageClause[] | undefined,\n ): ts.HeritageClause[] | undefined {\n if (clauses == null) {\n return clauses;\n }\n return clauses\n .map((clause) => {\n const types = clause.types.filter(\n (type) => Transformation.fullyQualifiedName(typeChecker, type.expression) !== ifaceName,\n );\n if (types.length === clause.types.length) {\n // Means the interface was only transitively present...\n return clause;\n }\n if (types.length === 0) {\n return undefined;\n }\n return ts.factory.updateHeritageClause(clause, types);\n })\n .filter((clause) => clause != null) as ts.HeritageClause[];\n }\n }\n\n private static fullyQualifiedName(typeChecker: ts.TypeChecker, node: ts.Node): string | undefined {\n const symbol = typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(node as ts.Declaration) ?? node);\n // This symbol ☝️ does not contain enough information in some cases - when\n // an imported type is part of a heritage clause - to produce the fqn.\n // Round tripping this to its type and back to a symbol seems to fix this.\n const type = symbol && typeChecker.getDeclaredTypeOfSymbol(symbol);\n return type?.symbol && typeChecker.getFullyQualifiedName(type.symbol);\n }\n\n private static typeReference(\n type: ts.ClassDeclaration | ts.InterfaceDeclaration | string,\n context: ts.ClassDeclaration | ts.InterfaceDeclaration,\n typeChecker: ts.TypeChecker,\n ): {\n typeExpression: ts.ExpressionWithTypeArguments;\n syntheticImport?: ts.ImportDeclaration;\n } {\n context = ts.getOriginalNode(context) as any;\n\n const [, contextSource] = /^\"([^\"]+)\"\\..*$/.exec(\n typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(context)!)!),\n )!;\n\n let expression: ts.Expression;\n let syntheticImport: ts.ImportDeclaration | undefined;\n\n if (typeof type === 'string') {\n const [root, ...tail] = type.split('.');\n const syntheticImportName = ts.factory.createUniqueName(root);\n syntheticImport = ts.factory.createImportDeclaration(\n undefined /* decorators */,\n ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(syntheticImportName)),\n ts.factory.createStringLiteral(root),\n );\n expression = tail.reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n syntheticImportName as ts.Expression,\n );\n } else {\n const [, typeSource, qualifiedName] = /^\"([^\"]+)\"\\.(.*)$/.exec(\n typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(type)!)!),\n )!;\n\n if (typeSource === contextSource) {\n const [root, ...tail] = qualifiedName.split('.');\n expression = tail.reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n ts.factory.createIdentifier(root) as ts.Expression,\n );\n } else {\n const syntheticImportName = ts.factory.createUniqueName(basename(typeSource));\n syntheticImport = ts.factory.createImportDeclaration(\n undefined /* modifiers */,\n ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(syntheticImportName)),\n ts.factory.createStringLiteral(`./${relative(dirname(contextSource), typeSource)}`),\n undefined,\n );\n expression = qualifiedName\n .split('.')\n .reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n syntheticImportName as ts.Expression,\n );\n }\n }\n\n return {\n typeExpression: ts.factory.createExpressionWithTypeArguments(expression, undefined),\n syntheticImport,\n };\n }\n\n private readonly nodeName: string;\n\n private constructor(\n private readonly typeChecker: ts.TypeChecker,\n node: ts.Declaration,\n public readonly apply: (\n this: Transformation,\n node: ts.Node,\n ) => { node: ts.Node; syntheticImport?: ts.ImportDeclaration },\n ) {\n this.nodeName = Transformation.fullyQualifiedName(typeChecker, node)!;\n }\n\n public targets(node: ts.Declaration) {\n return this.nodeName === Transformation.fullyQualifiedName(this.typeChecker, node);\n }\n}\n\nclass DeprecationRemovalTransformer {\n /**\n * A list of SyntaxKinds for which it is not necessary to evaluate children,\n * since they are never of interest to this transform. This opens up a wee\n * optimization, which is particularly useful when trying to troubleshoot the\n * transform in a debugger (saves a TON of time stepping into useless nodes\n * then).\n */\n private static readonly IGNORE_CHILDREN: ReadonlySet<ts.SyntaxKind> = new Set([\n ts.SyntaxKind.Constructor,\n ts.SyntaxKind.FunctionDeclaration,\n ts.SyntaxKind.GetAccessor,\n ts.SyntaxKind.MethodDeclaration,\n ts.SyntaxKind.MethodSignature,\n ts.SyntaxKind.PropertySignature,\n ts.SyntaxKind.PropertyDeclaration,\n ts.SyntaxKind.SetAccessor,\n ts.SyntaxKind.VariableDeclaration,\n ]);\n\n private syntheticImports = new Array<ts.ImportDeclaration>();\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly context: ts.TransformationContext,\n private readonly transformations: readonly Transformation[],\n private readonly nodesToRemove: Set<ts.Node>,\n ) {}\n\n public transform<T extends ts.Node>(node: T): T {\n let result = this.visitEachChild(node);\n\n // If there are any synthetic imports, add them to the source file\n if (ts.isSourceFile(result) && this.syntheticImports.length > 0) {\n result = this.context.factory.updateSourceFile(\n result,\n [...this.syntheticImports, ...result.statements],\n result.isDeclarationFile,\n result.referencedFiles,\n result.typeReferenceDirectives,\n result.hasNoDefaultLib,\n result.libReferenceDirectives,\n ) as any;\n this.syntheticImports = new Array<ts.ImportDeclaration>();\n }\n\n return result;\n }\n\n private visitEachChild<T extends ts.Node>(node: T): T {\n return ts.visitEachChild(node, this.visitor.bind(this), this.context);\n }\n\n private visitor<T extends ts.Node>(node: T): ts.VisitResult<T> {\n if (this.isDeprecated(node)) {\n // Removing deprecated members by substituting \"nothing\" to them\n return [];\n }\n\n if (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) {\n for (const transformation of this.transformations) {\n // 👇 as any because the assignment below confuses type checker\n if (transformation.targets(node as any)) {\n const { node: transformedNode, syntheticImport } = transformation.apply(node);\n node = transformedNode as any;\n if (syntheticImport) {\n this.syntheticImports.push(syntheticImport);\n }\n }\n }\n }\n\n // Remove named imports of `@deprecated` members from the source...\n if (\n ts.isImportDeclaration(node) &&\n node.importClause &&\n node.importClause.namedBindings &&\n ts.isNamedImports(node.importClause.namedBindings)\n ) {\n const filteredElements = node.importClause.namedBindings.elements.filter((element) => {\n // This symbol is local (it's declaration points back to the named import)\n const symbol = this.typeChecker.getSymbolAtLocation(element.name);\n const exportedSymbol =\n // This \"resolves\" the imported type, so we can get to it's declaration(s)\n symbol && this.typeChecker.getDeclaredTypeOfSymbol(symbol)?.symbol;\n return !exportedSymbol?.declarations?.some((decl) => this.isDeprecated(decl));\n });\n if (filteredElements.length !== node.importClause.namedBindings.elements.length) {\n return this.context.factory.updateImportDeclaration(\n node,\n node.modifiers,\n node.importClause.name != null || filteredElements.length > 0\n ? this.context.factory.updateImportClause(\n node.importClause,\n node.importClause.isTypeOnly,\n node.importClause.name,\n this.context.factory.updateNamedImports(node.importClause.namedBindings, filteredElements),\n )\n : undefined,\n node.moduleSpecifier,\n node.assertClause,\n ) as any;\n }\n\n return node;\n }\n\n // Replace \"export ... from ...\" places that no longer export anything\n // with an \"import from ...\", so side effects are preserved.\n if (ts.isExportDeclaration(node) && node.moduleSpecifier) {\n const symbol = this.typeChecker.getSymbolAtLocation(node.moduleSpecifier);\n const moduleExports =\n symbol &&\n this.typeChecker\n .getExportsOfModule(symbol)\n ?.filter((sym) => !sym.declarations?.some((decl) => this.isDeprecated(decl)));\n if ((node.exportClause == null || ts.isNamespaceExport(node.exportClause)) && moduleExports?.length === 0) {\n return this.context.factory.createImportDeclaration(\n undefined /* modifiers */,\n undefined /* importClause */,\n node.moduleSpecifier,\n ) as any;\n }\n\n if (node.exportClause != null && moduleExports) {\n const namedExports = node.exportClause as ts.NamedExports;\n const exportedNames = new Set(moduleExports.map((sym) => sym.name));\n const filteredElements = namedExports.elements?.filter((elt) => exportedNames.has(elt.name.text));\n if (filteredElements?.length !== namedExports.elements?.length) {\n return this.context.factory.updateExportDeclaration(\n node,\n node.modifiers,\n node.isTypeOnly,\n this.context.factory.updateNamedExports(namedExports, filteredElements),\n node.moduleSpecifier,\n node.assertClause,\n ) as any;\n }\n }\n }\n\n return DeprecationRemovalTransformer.IGNORE_CHILDREN.has(node.kind) ? node : this.visitEachChild(node);\n }\n\n private isDeprecated(node: ts.Node): boolean {\n const original = ts.getOriginalNode(node);\n return (\n this.nodesToRemove.has(original) && ts.getJSDocTags(original).some((tag) => tag.tagName.text === 'deprecated')\n );\n }\n}\n"]}
1
+ {"version":3,"file":"deprecated-remover.js","sourceRoot":"","sources":["../../src/transforms/deprecated-remover.ts"],"names":[],"mappings":";;;AAAA,yCAAwD;AACxD,qCAkBoB;AACpB,iCAAiC;AAEjC,wDAAoD;AACpD,6CAA6C;AAC7C,oCAAqC;AAErC,MAAa,iBAAiB;IAI5B,YACmB,WAA2B,EAC3B,uBAAgD;QADhD,gBAAW,GAAX,WAAW,CAAgB;QAC3B,4BAAuB,GAAvB,uBAAuB,CAAyB;QALlD,oBAAe,GAAG,IAAI,KAAK,EAAkB,CAAC;QAC9C,kBAAa,GAAG,IAAI,GAAG,EAAW,CAAC;IAKjD,CAAC;IAEJ;;;;;;OAMG;IACH,IAAW,kBAAkB;QAC3B,OAAO;YACL,iBAAiB,EAAE;gBACjB,CAAC,OAAO,EAAE,EAAE;oBACV,MAAM,WAAW,GAAG,IAAI,6BAA6B,CACnD,IAAI,CAAC,WAAW,EAChB,OAAO,EACP,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,aAAa,CACnB,CAAC;oBACF,OAAO,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACjD,C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Ac,CAAC,IAAI,CAAC,CAAC;IACzG,CAAC;IAEO,YAAY,CAAC,IAAa;QAChC,MAAM,QAAQ,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,CACL,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,CAC/G,CAAC;IACJ,CAAC;;AApJD;;;;;;GAMG;AACqB,6CAAe,GAA+B,IAAI,GAAG,CAAC;IAC5E,EAAE,CAAC,UAAU,CAAC,WAAW;IACzB,EAAE,CAAC,UAAU,CAAC,mBAAmB;IACjC,EAAE,CAAC,UAAU,CAAC,WAAW;IACzB,EAAE,CAAC,UAAU,CAAC,iBAAiB;IAC/B,EAAE,CAAC,UAAU,CAAC,eAAe;IAC7B,EAAE,CAAC,UAAU,CAAC,iBAAiB;IAC/B,EAAE,CAAC,UAAU,CAAC,mBAAmB;IACjC,EAAE,CAAC,UAAU,CAAC,WAAW;IACzB,EAAE,CAAC,UAAU,CAAC,mBAAmB;CAClC,CAAC,AAVqC,CAUpC","sourcesContent":["import { basename, dirname, relative } from 'node:path';\nimport {\n Assembly,\n ClassType,\n EnumMember,\n Initializer,\n InterfaceType,\n isClassOrInterfaceType,\n isClassType,\n isCollectionTypeReference,\n isEnumType,\n isMethod,\n isNamedTypeReference,\n isPrimitiveTypeReference,\n Method,\n Parameter,\n Property,\n Stability,\n TypeReference,\n} from '@jsii/spec';\nimport * as ts from 'typescript';\n\nimport { JsiiDiagnostic } from '../jsii-diagnostic';\nimport * as bindings from '../node-bindings';\nimport { JsiiError } from '../utils';\n\nexport class DeprecatedRemover {\n private readonly transformations = new Array<Transformation>();\n private readonly nodesToRemove = new Set<ts.Node>();\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly allowlistedDeprecations: Set<string> | undefined,\n ) {}\n\n /**\n * Obtains the configuration for the TypeScript transform(s) that will remove\n * `@deprecated` members from the generated declarations (`.d.ts`) files. It\n * will leverage information accumulated during `#removeFrom(Assembly)` in\n * order to apply corrections to inheritance chains, ensuring a valid output\n * is produced.\n */\n public get customTransformers(): ts.CustomTransformers {\n return {\n afterDeclarations: [\n (context) => {\n const transformer = new DeprecationRemovalTransformer(\n this.typeChecker,\n context,\n this.transformations,\n this.nodesToRemove,\n );\n return transformer.transform.bind(transformer);\n },\n ],\n };\n }\n\n /**\n * Removes all `@deprecated` API elements from the provided assembly, and\n * records the operations needed in order to fix the inheritance chains that\n * mix `@deprecated` and non-`@deprecated` types.\n *\n * @param assembly the assembly to be modified.\n *\n * @returns diagnostic messages produced when validating no remaining API\n * makes use of a `@deprecated` type that was removed.\n */\n public removeFrom(assembly: Assembly): readonly JsiiDiagnostic[] {\n if (assembly.types == null) {\n return [];\n }\n\n const strippedFqns = new Set<string>();\n const replaceWithClass = new Map<string, string>();\n const replaceWithInterfaces = new Map<string, readonly string[]>();\n\n // Find all types that will be stripped out\n for (const [fqn, typeInfo] of Object.entries(assembly.types)) {\n if (typeInfo.docs?.stability === Stability.Deprecated) {\n if (!this.shouldFqnBeStripped(fqn)) {\n continue;\n }\n strippedFqns.add(fqn);\n\n if (isClassType(typeInfo) && typeInfo.base != null) {\n replaceWithClass.set(fqn, typeInfo.base);\n }\n if (isClassOrInterfaceType(typeInfo) && typeInfo.interfaces != null) {\n replaceWithInterfaces.set(fqn, typeInfo.interfaces);\n }\n\n this.nodesToRemove.add(bindings.getRelatedNode(typeInfo)!);\n }\n }\n\n for (const [fqn, typeInfo] of Object.entries(assembly.types)) {\n // Ignore `@deprecated` types\n if (strippedFqns.has(fqn)) {\n continue;\n }\n\n // Enums cannot have references to `@deprecated` types, but can have deprecated members\n if (isEnumType(typeInfo)) {\n const enumNode = bindings.getEnumRelatedNode(typeInfo)!;\n const members: EnumMember[] = [];\n for (const mem of typeInfo.members) {\n if (mem.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${mem.name}`)) {\n const matchingMemberNode = enumNode.members.find((enumMem) => enumMem.name.getText() === mem.name);\n if (matchingMemberNode) {\n this.nodesToRemove.add(matchingMemberNode);\n }\n } else {\n members.push(mem);\n }\n }\n typeInfo.members = members;\n continue;\n }\n\n // For classes, we erase `@deprecated` base classes, replacing as needed\n const additionalInterfaces = new Set<string>();\n if (isClassType(typeInfo) && typeInfo.base != null && strippedFqns.has(typeInfo.base)) {\n while (typeInfo.base != null && strippedFqns.has(typeInfo.base)) {\n const oldBase = assembly.types[typeInfo.base] as ClassType;\n if (oldBase.interfaces) for (const addFqn of oldBase.interfaces) additionalInterfaces.add(addFqn);\n typeInfo.base = replaceWithClass.get(typeInfo.base);\n }\n this.transformations.push(\n typeInfo.base != null\n ? Transformation.replaceBaseClass(\n this.typeChecker,\n bindings.getClassRelatedNode(typeInfo)!,\n typeInfo.base in assembly.types\n ? bindings.getClassRelatedNode(assembly.types[typeInfo.base] as ClassType) ?? typeInfo.base\n : typeInfo.base,\n )\n : Transformation.removeBaseClass(this.typeChecker, bindings.getClassRelatedNode(typeInfo)!),\n );\n }\n\n // Be defensive in case we add other kinds in the future\n if (!isClassOrInterfaceType(typeInfo)) {\n throw new Error(`Unhandled type encountered! ${JSON.stringify(typeInfo, null, 2)}`);\n }\n\n // Strip all `@deprecated` interfaces from the inheritance tree, replacing as needed\n if (typeInfo.interfaces?.some((addFqn) => strippedFqns.has(addFqn)) || additionalInterfaces.size > 0) {\n const originalSet = new Set(typeInfo.interfaces ?? []);\n const newSet = new Set<string>();\n\n const candidates = Array.from(new Set([...originalSet, ...additionalInterfaces]));\n while (candidates.length > 0) {\n const candidateFqn = candidates.pop()!;\n if (!strippedFqns.has(candidateFqn)) {\n newSet.add(candidateFqn);\n if (!originalSet.has(candidateFqn)) {\n this.transformations.push(\n Transformation.addInterface(\n this.typeChecker,\n bindings.getClassOrInterfaceRelatedNode(typeInfo)!,\n candidateFqn in assembly.types\n ? bindings.getInterfaceRelatedNode(assembly.types[candidateFqn] as InterfaceType) ?? candidateFqn\n : candidateFqn,\n ),\n );\n }\n continue;\n }\n if (originalSet.has(candidateFqn)) {\n this.transformations.push(\n Transformation.removeInterface(\n this.typeChecker,\n bindings.getClassOrInterfaceRelatedNode(typeInfo)!,\n bindings.getInterfaceRelatedNode(assembly.types[candidateFqn] as InterfaceType)!,\n ),\n );\n }\n const replacement = replaceWithInterfaces.get(candidateFqn);\n if (replacement != null) {\n candidates.push(...replacement);\n }\n }\n\n typeInfo.interfaces = newSet.size > 0 ? Array.from(newSet).sort() : undefined;\n }\n\n // Drop all `@deprecated` members, and remove \"overrides\" from stripped types\n const methods: Method[] = [];\n const properties: Property[] = [];\n if (typeInfo.methods) {\n for (const meth of typeInfo.methods) {\n if (meth.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${meth.name}`)) {\n this.nodesToRemove.add(bindings.getMethodRelatedNode(meth)!);\n } else {\n methods.push(\n meth.overrides != null && strippedFqns.has(meth.overrides) ? { ...meth, overrides: undefined } : meth,\n );\n }\n }\n }\n typeInfo.methods = typeInfo.methods ? methods : undefined;\n if (typeInfo.properties) {\n for (const prop of typeInfo.properties) {\n if (prop.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${prop.name}`)) {\n this.nodesToRemove.add(bindings.getParameterRelatedNode(prop)!);\n } else {\n properties.push(\n prop.overrides != null && strippedFqns.has(prop.overrides) ? { ...prop, overrides: undefined } : prop,\n );\n }\n }\n }\n typeInfo.properties = typeInfo.properties ? properties : undefined;\n }\n\n const diagnostics = this.findLeftoverUseOfDeprecatedAPIs(assembly, strippedFqns);\n\n // Remove all `@deprecated` types, after we did everything, so we could\n // still access the related nodes from the assembly object.\n for (const fqn of strippedFqns) {\n if (this.shouldFqnBeStripped(fqn)) {\n delete assembly.types[fqn];\n }\n }\n\n return diagnostics;\n }\n\n private findLeftoverUseOfDeprecatedAPIs(assembly: Assembly, strippedFqns: Set<string>): readonly JsiiDiagnostic[] {\n if (assembly.types == null) {\n return [];\n }\n\n const result = new Array<JsiiDiagnostic>();\n\n for (const type of Object.values(assembly.types)) {\n if (isEnumType(type) || strippedFqns.has(type.fqn)) {\n continue;\n }\n if (isClassType(type) && type.initializer) {\n result.push(...this.verifyCallable(assembly, strippedFqns, type.initializer));\n }\n if (type.methods)\n for (const method of type.methods) result.push(...this.verifyCallable(assembly, strippedFqns, method));\n if (type.properties)\n for (const property of type.properties) result.push(...this.verifyProperty(assembly, strippedFqns, property));\n }\n\n return result;\n }\n\n private verifyCallable(\n assembly: Assembly,\n strippedFqns: ReadonlySet<string>,\n method: Method | Initializer,\n ): readonly JsiiDiagnostic[] {\n const diagnostics = new Array<JsiiDiagnostic>();\n const deprecatedReturnFqn =\n isMethod(method) && method.returns && this.tryFindReference(method.returns.type, strippedFqns);\n if (deprecatedReturnFqn) {\n diagnostics.push(this.makeDiagnostic(deprecatedReturnFqn, 'Method', method, assembly));\n }\n\n if (method.parameters) {\n for (const parameter of method.parameters) {\n const deprecatedTypeFqn = this.tryFindReference(parameter.type, strippedFqns);\n if (deprecatedTypeFqn) {\n diagnostics.push(this.makeDiagnostic(deprecatedTypeFqn, 'Parameter', parameter, assembly));\n }\n }\n }\n return diagnostics;\n }\n\n private verifyProperty(\n assembly: Assembly,\n strippedFqns: ReadonlySet<string>,\n property: Property,\n ): readonly JsiiDiagnostic[] {\n const deprecatedTypeFqn = this.tryFindReference(property.type, strippedFqns);\n if (deprecatedTypeFqn) {\n return [this.makeDiagnostic(deprecatedTypeFqn, 'Property', property, assembly)];\n }\n return [];\n }\n\n /**\n * Determines whether a `TypeReference` contains an FQN within a given set.\n *\n * @param ref the tested `TypeReference`.\n * @param fqns the set of FQNs that are being searched for.\n *\n * @returns the first FQN that was identified.\n */\n private tryFindReference(ref: TypeReference, fqns: ReadonlySet<string>): string | undefined {\n if (isNamedTypeReference(ref)) {\n return fqns.has(ref.fqn) ? ref.fqn : undefined;\n }\n if (isPrimitiveTypeReference(ref)) {\n return undefined;\n }\n if (isCollectionTypeReference(ref)) {\n return this.tryFindReference(ref.collection.elementtype, fqns);\n }\n return ref.union.types.map((type) => this.tryFindReference(type, fqns)).find((typeRef) => typeRef != null);\n }\n\n private shouldFqnBeStripped(fqn: string) {\n return this.allowlistedDeprecations?.has(fqn) ?? true;\n }\n\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Method',\n context: Method | Initializer,\n assembly: Assembly,\n ): JsiiDiagnostic;\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Parameter',\n context: Parameter,\n assembly: Assembly,\n ): JsiiDiagnostic;\n private makeDiagnostic(fqn: string, messagePrefix: 'Property', context: Property, assembly: Assembly): JsiiDiagnostic;\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Method' | 'Property' | 'Parameter',\n context: Method | Initializer | Parameter | Property,\n assembly: Assembly,\n ): JsiiDiagnostic {\n const node = bindings.getRelatedNode<\n | ts.AccessorDeclaration\n | ts.MethodDeclaration\n | ts.MethodSignature\n | ts.ParameterDeclaration\n | ts.PropertyDeclaration\n | ts.PropertySignature\n >(context);\n const diagnostic = JsiiDiagnostic.JSII_3999_INCOHERENT_TYPE_MODEL.create(\n node?.type ?? node!,\n `${messagePrefix} has @deprecated type ${fqn}, and it is erased by --strip-deprecated.`,\n );\n\n const typeInfo = assembly.types?.[fqn];\n const typeNode = typeInfo && bindings.getTypeRelatedNode(typeInfo);\n if (typeNode == null) {\n return diagnostic;\n }\n return diagnostic.addRelatedInformation(\n ts.getNameOfDeclaration(typeNode) ?? typeNode,\n 'The @deprecated type is declared here',\n );\n }\n}\n\nclass Transformation {\n public static addInterface(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration | ts.InterfaceDeclaration,\n iface: ts.InterfaceDeclaration | string,\n ) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration) && !ts.isInterfaceDeclaration(declaration)) {\n throw new JsiiError(\n `Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`,\n );\n }\n\n const { typeExpression: newInterface, syntheticImport } = Transformation.typeReference(\n iface,\n declaration,\n typeChecker,\n );\n if (ts.isClassDeclaration(declaration)) {\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n addInterfaceTo(ts.SyntaxKind.ImplementsKeyword, declaration.heritageClauses),\n declaration.members,\n ),\n syntheticImport,\n };\n }\n return {\n node: ts.factory.updateInterfaceDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n addInterfaceTo(ts.SyntaxKind.ExtendsKeyword, declaration.heritageClauses),\n declaration.members,\n ),\n syntheticImport,\n };\n\n function addInterfaceTo(\n token: ts.HeritageClause['token'],\n clauses: readonly ts.HeritageClause[] = [],\n ): ts.HeritageClause[] {\n const existingClause = clauses.find((clause) => clause.token === token);\n if (existingClause == null) {\n return [...clauses, ts.factory.createHeritageClause(token, [newInterface])];\n }\n return [\n ...clauses.filter((clause) => clause !== existingClause),\n ts.factory.updateHeritageClause(existingClause, [...existingClause.types, newInterface]),\n ];\n }\n });\n }\n\n public static replaceBaseClass(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration,\n baseClass: ts.ClassDeclaration | string,\n ) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration)) {\n throw new JsiiError(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);\n }\n const { typeExpression: newBaseClass, syntheticImport } = Transformation.typeReference(\n baseClass,\n declaration,\n typeChecker,\n );\n const existingClause = declaration.heritageClauses?.find(\n (clause) => clause.token === ts.SyntaxKind.ExtendsKeyword,\n );\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n [\n ...(declaration.heritageClauses ?? []).filter((clause) => clause !== existingClause),\n existingClause\n ? ts.factory.updateHeritageClause(existingClause, [newBaseClass])\n : ts.factory.createHeritageClause(ts.SyntaxKind.ExtendsKeyword, [newBaseClass]),\n ],\n declaration.members,\n ),\n syntheticImports: syntheticImport && [syntheticImport],\n };\n });\n }\n\n public static removeBaseClass(typeChecker: ts.TypeChecker, node: ts.ClassDeclaration) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration)) {\n throw new JsiiError(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);\n }\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n declaration.heritageClauses?.filter((clause) => clause.token !== ts.SyntaxKind.ExtendsKeyword),\n declaration.members,\n ),\n };\n });\n }\n\n public static removeInterface(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration | ts.InterfaceDeclaration,\n iface: ts.InterfaceDeclaration,\n ) {\n const ifaceName = Transformation.fullyQualifiedName(typeChecker, iface)!;\n\n return new Transformation(typeChecker, node, (declaration) => {\n if (ts.isClassDeclaration(declaration)) {\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n removeInterfaceHeritage(declaration.heritageClauses),\n declaration.members,\n ),\n };\n } else if (ts.isInterfaceDeclaration(declaration)) {\n return {\n node: ts.factory.updateInterfaceDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n removeInterfaceHeritage(declaration.heritageClauses),\n declaration.members,\n ),\n };\n }\n throw new JsiiError(\n `Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`,\n );\n });\n\n function removeInterfaceHeritage(\n clauses: readonly ts.HeritageClause[] | undefined,\n ): ts.HeritageClause[] | undefined {\n if (clauses == null) {\n return clauses;\n }\n return clauses\n .map((clause) => {\n const types = clause.types.filter(\n (type) => Transformation.fullyQualifiedName(typeChecker, type.expression) !== ifaceName,\n );\n if (types.length === clause.types.length) {\n // Means the interface was only transitively present...\n return clause;\n }\n if (types.length === 0) {\n return undefined;\n }\n return ts.factory.updateHeritageClause(clause, types);\n })\n .filter((clause) => clause != null) as ts.HeritageClause[];\n }\n }\n\n private static fullyQualifiedName(typeChecker: ts.TypeChecker, node: ts.Node): string | undefined {\n const symbol = typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(node as ts.Declaration) ?? node);\n // This symbol ☝️ does not contain enough information in some cases - when\n // an imported type is part of a heritage clause - to produce the fqn.\n // Round tripping this to its type and back to a symbol seems to fix this.\n const type = symbol && typeChecker.getDeclaredTypeOfSymbol(symbol);\n return type?.symbol && typeChecker.getFullyQualifiedName(type.symbol);\n }\n\n private static typeReference(\n type: ts.ClassDeclaration | ts.InterfaceDeclaration | string,\n context: ts.ClassDeclaration | ts.InterfaceDeclaration,\n typeChecker: ts.TypeChecker,\n ): {\n typeExpression: ts.ExpressionWithTypeArguments;\n syntheticImport?: ts.ImportDeclaration;\n } {\n context = ts.getOriginalNode(context) as any;\n\n const [, contextSource] = /^\"([^\"]+)\"\\..*$/.exec(\n typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(context)!)!),\n )!;\n\n let expression: ts.Expression;\n let syntheticImport: ts.ImportDeclaration | undefined;\n\n if (typeof type === 'string') {\n const [root, ...tail] = type.split('.');\n const syntheticImportName = ts.factory.createUniqueName(root);\n syntheticImport = ts.factory.createImportDeclaration(\n undefined /* decorators */,\n ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(syntheticImportName)),\n ts.factory.createStringLiteral(root),\n );\n expression = tail.reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n syntheticImportName as ts.Expression,\n );\n } else {\n const [, typeSource, qualifiedName] = /^\"([^\"]+)\"\\.(.*)$/.exec(\n typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(type)!)!),\n )!;\n\n if (typeSource === contextSource) {\n const [root, ...tail] = qualifiedName.split('.');\n expression = tail.reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n ts.factory.createIdentifier(root) as ts.Expression,\n );\n } else {\n const syntheticImportName = ts.factory.createUniqueName(basename(typeSource));\n syntheticImport = ts.factory.createImportDeclaration(\n undefined /* modifiers */,\n ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(syntheticImportName)),\n ts.factory.createStringLiteral(`./${relative(dirname(contextSource), typeSource)}`),\n undefined,\n );\n expression = qualifiedName\n .split('.')\n .reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n syntheticImportName as ts.Expression,\n );\n }\n }\n\n return {\n typeExpression: ts.factory.createExpressionWithTypeArguments(expression, undefined),\n syntheticImport,\n };\n }\n\n private readonly nodeName: string;\n\n private constructor(\n private readonly typeChecker: ts.TypeChecker,\n node: ts.Declaration,\n public readonly apply: (\n this: Transformation,\n node: ts.Node,\n ) => { node: ts.Node; syntheticImport?: ts.ImportDeclaration },\n ) {\n this.nodeName = Transformation.fullyQualifiedName(typeChecker, node)!;\n }\n\n public targets(node: ts.Declaration) {\n return this.nodeName === Transformation.fullyQualifiedName(this.typeChecker, node);\n }\n}\n\nclass DeprecationRemovalTransformer {\n /**\n * A list of SyntaxKinds for which it is not necessary to evaluate children,\n * since they are never of interest to this transform. This opens up a wee\n * optimization, which is particularly useful when trying to troubleshoot the\n * transform in a debugger (saves a TON of time stepping into useless nodes\n * then).\n */\n private static readonly IGNORE_CHILDREN: ReadonlySet<ts.SyntaxKind> = new Set([\n ts.SyntaxKind.Constructor,\n ts.SyntaxKind.FunctionDeclaration,\n ts.SyntaxKind.GetAccessor,\n ts.SyntaxKind.MethodDeclaration,\n ts.SyntaxKind.MethodSignature,\n ts.SyntaxKind.PropertySignature,\n ts.SyntaxKind.PropertyDeclaration,\n ts.SyntaxKind.SetAccessor,\n ts.SyntaxKind.VariableDeclaration,\n ]);\n\n private syntheticImports = new Array<ts.ImportDeclaration>();\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly context: ts.TransformationContext,\n private readonly transformations: readonly Transformation[],\n private readonly nodesToRemove: Set<ts.Node>,\n ) {}\n\n public transform<T extends ts.Node>(node: T): T {\n let result = this.visitEachChild(node);\n\n // If there are any synthetic imports, add them to the source file\n if (ts.isSourceFile(result) && this.syntheticImports.length > 0) {\n result = this.context.factory.updateSourceFile(\n result,\n [...this.syntheticImports, ...result.statements],\n result.isDeclarationFile,\n result.referencedFiles,\n result.typeReferenceDirectives,\n result.hasNoDefaultLib,\n result.libReferenceDirectives,\n ) as any;\n this.syntheticImports = new Array<ts.ImportDeclaration>();\n }\n\n return result;\n }\n\n private visitEachChild<T extends ts.Node>(node: T): T {\n return ts.visitEachChild(node, this.visitor.bind(this), this.context);\n }\n\n private visitor<T extends ts.Node>(node: T): ts.VisitResult<T> {\n if (this.isDeprecated(node)) {\n // Removing deprecated members by substituting \"nothing\" to them\n return [];\n }\n\n if (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) {\n for (const transformation of this.transformations) {\n // 👇 as any because the assignment below confuses type checker\n if (transformation.targets(node as any)) {\n const { node: transformedNode, syntheticImport } = transformation.apply(node);\n node = transformedNode as any;\n if (syntheticImport) {\n this.syntheticImports.push(syntheticImport);\n }\n }\n }\n }\n\n // Remove named imports of `@deprecated` members from the source...\n if (\n ts.isImportDeclaration(node) &&\n node.importClause &&\n node.importClause.namedBindings &&\n ts.isNamedImports(node.importClause.namedBindings)\n ) {\n const filteredElements = node.importClause.namedBindings.elements.filter((element) => {\n // This symbol is local (it's declaration points back to the named import)\n const symbol = this.typeChecker.getSymbolAtLocation(element.name);\n const exportedSymbol =\n // This \"resolves\" the imported type, so we can get to it's declaration(s)\n symbol && this.typeChecker.getDeclaredTypeOfSymbol(symbol)?.symbol;\n return !exportedSymbol?.declarations?.some((decl) => this.isDeprecated(decl));\n });\n if (filteredElements.length !== node.importClause.namedBindings.elements.length) {\n return this.context.factory.updateImportDeclaration(\n node,\n node.modifiers,\n node.importClause.name != null || filteredElements.length > 0\n ? this.context.factory.updateImportClause(\n node.importClause,\n node.importClause.isTypeOnly,\n node.importClause.name,\n this.context.factory.updateNamedImports(node.importClause.namedBindings, filteredElements),\n )\n : undefined,\n node.moduleSpecifier,\n node.assertClause,\n ) as any;\n }\n\n return node;\n }\n\n // Replace \"export ... from ...\" places that no longer export anything\n // with an \"import from ...\", so side effects are preserved.\n if (ts.isExportDeclaration(node) && node.moduleSpecifier) {\n const symbol = this.typeChecker.getSymbolAtLocation(node.moduleSpecifier);\n const moduleExports =\n symbol &&\n this.typeChecker\n .getExportsOfModule(symbol)\n ?.filter((sym) => !sym.declarations?.some((decl) => this.isDeprecated(decl)));\n if ((node.exportClause == null || ts.isNamespaceExport(node.exportClause)) && moduleExports?.length === 0) {\n return this.context.factory.createImportDeclaration(\n undefined /* modifiers */,\n undefined /* importClause */,\n node.moduleSpecifier,\n ) as any;\n }\n\n if (node.exportClause != null && moduleExports) {\n const namedExports = node.exportClause as ts.NamedExports;\n const exportedNames = new Set(moduleExports.map((sym) => sym.name));\n const filteredElements = namedExports.elements?.filter((elt) => exportedNames.has(elt.name.text));\n if (filteredElements?.length !== namedExports.elements?.length) {\n return this.context.factory.updateExportDeclaration(\n node,\n node.modifiers,\n node.isTypeOnly,\n this.context.factory.updateNamedExports(namedExports, filteredElements),\n node.moduleSpecifier,\n node.assertClause,\n ) as any;\n }\n }\n }\n\n return DeprecationRemovalTransformer.IGNORE_CHILDREN.has(node.kind) ? node : this.visitEachChild(node);\n }\n\n private isDeprecated(node: ts.Node): boolean {\n const original = ts.getOriginalNode(node);\n return (\n this.nodesToRemove.has(original) && ts.getJSDocTags(original).some((tag) => tag.tagName.text === 'deprecated')\n );\n }\n}\n"]}
@@ -16,5 +16,7 @@ configurableOptions.shouldPass('noUnusedParameters', validator_1.Match.ANY);
16
16
  configurableOptions.shouldPass('resolveJsonModule', validator_1.Match.ANY);
17
17
  configurableOptions.shouldPass('experimentalDecorators', validator_1.Match.ANY);
18
18
  configurableOptions.shouldPass('noFallthroughCasesInSwitch', validator_1.Match.ANY);
19
+ configurableOptions.shouldPass('verbatimModuleSyntax', validator_1.Match.ANY);
20
+ configurableOptions.shouldPass('isolatedModules', validator_1.Match.ANY);
19
21
  exports.default = configurableOptions;
20
22
  //# sourceMappingURL=configurable-options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"configurable-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/configurable-options.ts"],"names":[],"mappings":";;AAAA,uEAA8D;AAC9D,4CAA8C;AAE9C,uGAAuG;AACvG,iEAAiE;AACjE,qEAAqE;AAErE,MAAM,mBAAmB,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE1C,6DAA6D;AAC7D,mBAAmB,CAAC,MAAM,CAAC,iCAAqB,CAAC,CAAC;AAElD,uCAAuC;AACvC,mBAAmB,CAAC,UAAU,CAAC,aAAa,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACzD,mBAAmB,CAAC,UAAU,CAAC,mBAAmB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC/D,mBAAmB,CAAC,UAAU,CAAC,gBAAgB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC5D,mBAAmB,CAAC,UAAU,CAAC,oBAAoB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAChE,mBAAmB,CAAC,UAAU,CAAC,mBAAmB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC/D,mBAAmB,CAAC,UAAU,CAAC,wBAAwB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACpE,mBAAmB,CAAC,UAAU,CAAC,4BAA4B,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAExE,kBAAe,mBAAmB,CAAC","sourcesContent":["import jsiiConfiguredOptions from './jsii-configured-options';\nimport { Match, RuleSet } from '../validator';\n\n// A rule set defining all compilerOptions that can be configured by users with or without constraints.\n// These are options jsii doesn't have a particular opinion about\n// This is an internal rule set, that may be used by other rule sets.\n\nconst configurableOptions = new RuleSet();\n\n// import all options that are configurable via jsii settings\nconfigurableOptions.import(jsiiConfiguredOptions);\n\n// options jsii allows to be configured\nconfigurableOptions.shouldPass('incremental', Match.ANY);\nconfigurableOptions.shouldPass('noImplicitReturns', Match.ANY);\nconfigurableOptions.shouldPass('noUnusedLocals', Match.ANY);\nconfigurableOptions.shouldPass('noUnusedParameters', Match.ANY);\nconfigurableOptions.shouldPass('resolveJsonModule', Match.ANY);\nconfigurableOptions.shouldPass('experimentalDecorators', Match.ANY);\nconfigurableOptions.shouldPass('noFallthroughCasesInSwitch', Match.ANY);\n\nexport default configurableOptions;\n"]}
1
+ {"version":3,"file":"configurable-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/configurable-options.ts"],"names":[],"mappings":";;AAAA,uEAA8D;AAC9D,4CAA8C;AAE9C,uGAAuG;AACvG,iEAAiE;AACjE,qEAAqE;AAErE,MAAM,mBAAmB,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE1C,6DAA6D;AAC7D,mBAAmB,CAAC,MAAM,CAAC,iCAAqB,CAAC,CAAC;AAElD,uCAAuC;AACvC,mBAAmB,CAAC,UAAU,CAAC,aAAa,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACzD,mBAAmB,CAAC,UAAU,CAAC,mBAAmB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC/D,mBAAmB,CAAC,UAAU,CAAC,gBAAgB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC5D,mBAAmB,CAAC,UAAU,CAAC,oBAAoB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAChE,mBAAmB,CAAC,UAAU,CAAC,mBAAmB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC/D,mBAAmB,CAAC,UAAU,CAAC,wBAAwB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACpE,mBAAmB,CAAC,UAAU,CAAC,4BAA4B,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACxE,mBAAmB,CAAC,UAAU,CAAC,sBAAsB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAClE,mBAAmB,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAE7D,kBAAe,mBAAmB,CAAC","sourcesContent":["import jsiiConfiguredOptions from './jsii-configured-options';\nimport { Match, RuleSet } from '../validator';\n\n// A rule set defining all compilerOptions that can be configured by users with or without constraints.\n// These are options jsii doesn't have a particular opinion about\n// This is an internal rule set, that may be used by other rule sets.\n\nconst configurableOptions = new RuleSet();\n\n// import all options that are configurable via jsii settings\nconfigurableOptions.import(jsiiConfiguredOptions);\n\n// options jsii allows to be configured\nconfigurableOptions.shouldPass('incremental', Match.ANY);\nconfigurableOptions.shouldPass('noImplicitReturns', Match.ANY);\nconfigurableOptions.shouldPass('noUnusedLocals', Match.ANY);\nconfigurableOptions.shouldPass('noUnusedParameters', Match.ANY);\nconfigurableOptions.shouldPass('resolveJsonModule', Match.ANY);\nconfigurableOptions.shouldPass('experimentalDecorators', Match.ANY);\nconfigurableOptions.shouldPass('noFallthroughCasesInSwitch', Match.ANY);\nconfigurableOptions.shouldPass('verbatimModuleSyntax', Match.ANY);\nconfigurableOptions.shouldPass('isolatedModules', Match.ANY);\n\nexport default configurableOptions;\n"]}