jsii 5.9.44-dev.0 → 6.0.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +73 -289
  2. package/lib/assembler.js +95 -46
  3. package/lib/assembler.js.map +1 -1
  4. package/lib/case.js +13 -10
  5. package/lib/case.js.map +1 -1
  6. package/lib/common/find-utils.js +35 -2
  7. package/lib/common/find-utils.js.map +1 -1
  8. package/lib/common/symbol-id.js +39 -7
  9. package/lib/common/symbol-id.js.map +1 -1
  10. package/lib/compiler.js +51 -8
  11. package/lib/compiler.js.map +1 -1
  12. package/lib/directives.js +48 -16
  13. package/lib/directives.js.map +1 -1
  14. package/lib/docs.js +36 -4
  15. package/lib/docs.js.map +1 -1
  16. package/lib/helpers.js +38 -4
  17. package/lib/helpers.js.map +1 -1
  18. package/lib/jsii-diagnostic.js +524 -497
  19. package/lib/jsii-diagnostic.js.map +1 -1
  20. package/lib/literate.js +35 -2
  21. package/lib/literate.js.map +1 -1
  22. package/lib/main.js +40 -7
  23. package/lib/main.js.map +1 -1
  24. package/lib/project-info.d.ts +1 -1
  25. package/lib/project-info.js +41 -11
  26. package/lib/project-info.js.map +1 -1
  27. package/lib/support.js +7 -4
  28. package/lib/support.js.map +1 -1
  29. package/lib/transforms/deprecated-remover.js +65 -23
  30. package/lib/transforms/deprecated-remover.js.map +1 -1
  31. package/lib/transforms/deprecation-warnings.js +50 -10
  32. package/lib/transforms/deprecation-warnings.js.map +1 -1
  33. package/lib/transforms/runtime-info.js +36 -2
  34. package/lib/transforms/runtime-info.js.map +1 -1
  35. package/lib/tsconfig/compiler-options.js +40 -5
  36. package/lib/tsconfig/compiler-options.js.map +1 -1
  37. package/lib/tsconfig/rulesets/configurable-options.js +10 -1
  38. package/lib/tsconfig/rulesets/configurable-options.js.map +1 -1
  39. package/lib/tsconfig/rulesets/deprecated-options.js +16 -1
  40. package/lib/tsconfig/rulesets/deprecated-options.js.map +1 -1
  41. package/lib/tsconfig/rulesets/generated.public.js +7 -2
  42. package/lib/tsconfig/rulesets/generated.public.js.map +1 -1
  43. package/lib/tsconfig/rulesets/jsii-configured-options.js +0 -1
  44. package/lib/tsconfig/rulesets/jsii-configured-options.js.map +1 -1
  45. package/lib/tsconfig/rulesets/minimal.public.js +4 -1
  46. package/lib/tsconfig/rulesets/minimal.public.js.map +1 -1
  47. package/lib/tsconfig/rulesets/strict.public.js +12 -9
  48. package/lib/tsconfig/rulesets/strict.public.js.map +1 -1
  49. package/lib/tsconfig/tsconfig-validator.js +9 -3
  50. package/lib/tsconfig/tsconfig-validator.js.map +1 -1
  51. package/lib/tsconfig/validator.d.ts +5 -0
  52. package/lib/tsconfig/validator.js +26 -16
  53. package/lib/tsconfig/validator.js.map +1 -1
  54. package/lib/type-analysis.js +39 -3
  55. package/lib/type-analysis.js.map +1 -1
  56. package/lib/type-reference.js +34 -1
  57. package/lib/type-reference.js.map +1 -1
  58. package/lib/type-tracker.js +35 -4
  59. package/lib/type-tracker.js.map +1 -1
  60. package/lib/type-visitor.js +34 -1
  61. package/lib/type-visitor.js.map +1 -1
  62. package/lib/utils.js +37 -2
  63. package/lib/utils.js.map +1 -1
  64. package/lib/validator.js +49 -11
  65. package/lib/validator.js.map +1 -1
  66. package/lib/version.d.ts +3 -3
  67. package/lib/version.js +2 -2
  68. package/lib/version.js.map +1 -1
  69. package/lib/warnings.js +34 -1
  70. package/lib/warnings.js.map +1 -1
  71. package/package.json +6 -8
  72. package/releases.json +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"deprecation-warnings.js","sourceRoot":"","sources":["../../src/transforms/deprecation-warnings.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kCAAkC;AAClC,mCAAmC;AAEnC,iCAAiC;AAEjC,mDAAuD;AAI1C,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,qBAAqB,GAAG,OAAO,CAAC;AACtC,MAAM,cAAc,GAAG,GAAG,C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EACD,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;gBACrB,EAAE,CAAC,OAAO,CAAC,yBAAyB,CAClC,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAC7B,EAAE,CAAC,OAAO,CAAC,8BAA8B,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,EACpG,SAAS,EACT,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAC/C,CACF;aACF,CAAC,CACH;YACD,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;SACtE,CAAC,CACH,EACD,SAAS,CACV;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,QAAQ,CAAC,QAAgB;IAChC,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as spec from '@jsii/spec';\nimport { Assembly } from '@jsii/spec';\nimport * as ts from 'typescript';\n\nimport { symbolIdentifier } from '../common/symbol-id';\nimport { ProjectInfo } from '../project-info';\nimport { TypeTracker } from '../type-tracker';\n\nexport const WARNINGSCODE_FILE_NAME = '.warnings.jsii.js';\nconst WARNING_FUNCTION_NAME = 'print';\nconst PARAMETER_NAME = 'p';\nconst FOR_LOOP_ITEM_NAME = 'o';\nconst NAMESPACE = 'jsiiDeprecationWarnings';\nconst VISITED_OBJECTS_SET_NAME = 'visitedObjects';\nconst DEPRECATION_ERROR = 'DeprecationError';\nconst GET_PROPERTY_DESCRIPTOR = 'getPropertyDescriptor';\nconst VALIDATORS_OBJ = 'VALIDATORS';\n\nexport class DeprecationWarningsInjector {\n private transformers: ts.CustomTransformers = {\n before: [],\n };\n\n private shouldRenderValidatorCache: Record<string, boolean> = {};\n private validatorCacheSeenSet = new Set<string>();\n\n public constructor(private readonly typeChecker: ts.TypeChecker, private readonly typeTracker: TypeTracker) {}\n\n public process(assembly: Assembly, projectInfo: ProjectInfo) {\n const projectRoot = projectInfo.projectRoot;\n const validationFunctions: ts.ObjectLiteralElementLike[] = [];\n\n const types = assembly.types ?? {};\n for (const type of Object.values(types)) {\n const fnStatements = this.generateTypeValidation(type, assembly, projectInfo, types);\n if (fnStatements.length === 0) {\n continue;\n }\n\n const paramValue = ts.factory.createParameterDeclaration(undefined, undefined, PARAMETER_NAME);\n const functionName = fnName(type.fqn);\n const functionExpr = ts.factory.createFunctionExpression(\n undefined,\n undefined,\n ts.factory.createIdentifier(functionName),\n [],\n [paramValue],\n undefined,\n createFunctionBlock(fnStatements),\n );\n validationFunctions.push(ts.factory.createPropertyAssignment(functionName, functionExpr));\n }\n\n const fileStatements: ts.Statement[] = [];\n fileStatements.push(\n ts.factory.createVariableStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [\n ts.factory.createVariableDeclaration(\n VALIDATORS_OBJ,\n undefined,\n undefined,\n ts.factory.createObjectLiteralExpression(validationFunctions),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n );\n\n this.transformers = {\n before: [\n (context) => {\n const transformer = new Transformer(\n this.typeChecker,\n context,\n projectRoot,\n this.buildTypeIndex(assembly),\n assembly,\n );\n return transformer.transform.bind(transformer);\n },\n ],\n };\n\n generateWarningsFile(projectRoot, fileStatements);\n }\n\n public get customTransformers(): ts.CustomTransformers {\n return this.transformers;\n }\n\n private buildTypeIndex(assembly: Assembly): Map<string, spec.Type> {\n const result = new Map<string, spec.Type>();\n\n for (const type of Object.values(assembly.types ?? {})) {\n const symbolId = type.symbolId;\n if (symbolId) {\n result.set(symbolId, type);\n }\n }\n\n return result;\n }\n\n /**\n * Whether the validator for the given type should be rendered\n *\n * A validator should be rendered if:\n *\n * - It contains any deprecated members (base case).\n * - It references any other types whose validators should be rendered.\n * - It inherits from other types whose validators should be rendered.\n * - It references types that reference this type (recursive types).\n * - It references types from another assembly.\n *\n * For the last one we technically return `true`, indicating that a validator\n * *should* be rendered, but when we get to rendering no statements are\n * actually produced and the validator function is never rendered. This was\n * pre-existing behavior that I didn't change because introducing calls into\n * other assemblies out of the blue introduces risk.\n */\n private shouldRenderValidator(type: spec.Type, assembly: Assembly): boolean {\n if (this.shouldRenderValidatorCache[type.fqn] !== undefined) {\n return this.shouldRenderValidatorCache[type.fqn];\n }\n\n if (this.validatorCacheSeenSet.has(type.fqn)) {\n // To be safe we need to say this is true.\n return true;\n }\n if (!type.fqn.startsWith(`${assembly.name}.`)) {\n // Foreign type, always check\n return true;\n }\n this.validatorCacheSeenSet.add(type.fqn);\n\n this.shouldRenderValidatorCache[type.fqn] = calculate.call(this);\n this.validatorCacheSeenSet.delete(type.fqn);\n\n return this.shouldRenderValidatorCache[type.fqn];\n\n function calculate(this: DeprecationWarningsInjector): boolean {\n if (spec.isDeprecated(type)) {\n return true;\n }\n if (spec.isEnumType(type)) {\n return (type.members ?? []).some(spec.isDeprecated);\n }\n if (spec.isInterfaceType(type) && type.datatype) {\n for (const prop of type.properties ?? []) {\n if (spec.isDeprecated(prop)) {\n return true;\n }\n\n const typesToInspect = spec.isCollectionTypeReference(prop.type)\n ? [prop.type.collection.elementtype]\n : spec.isUnionTypeReference(prop.type)\n ? prop.type.union.types\n : [prop.type];\n\n for (const typeToInspect of typesToInspect) {\n if (!spec.isNamedTypeReference(typeToInspect)) {\n continue;\n }\n\n // Is from a different assembly?\n const typeObj = findType2(typeToInspect.fqn, assembly);\n if (typeObj === 'other-assembly') {\n return true;\n }\n if (this.shouldRenderValidator(typeObj, assembly)) {\n return true;\n }\n }\n }\n\n for (const interfaceName of type.interfaces ?? []) {\n const typeObj = findType2(interfaceName, assembly);\n if (typeObj === 'other-assembly') {\n return true;\n }\n if (this.shouldRenderValidator(typeObj, assembly)) {\n return true;\n }\n }\n }\n\n return false;\n }\n }\n\n private generateTypeValidation(\n type: spec.Type,\n assembly: Assembly,\n projectInfo: ProjectInfo,\n types: Record<string, spec.Type>,\n ): ts.Statement[] {\n if (!this.shouldRenderValidator(type, assembly)) {\n return [];\n }\n\n const statements: ts.Statement[] = [];\n let isEmpty = true;\n\n // This will add the parameter to the set of visited objects, to prevent infinite recursion\n statements.push(\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME), 'add'),\n undefined,\n [ts.factory.createIdentifier(PARAMETER_NAME)],\n ),\n ),\n );\n\n const tryStatements = [];\n if (spec.isDeprecated(type) && spec.isEnumType(type)) {\n // The type is deprecated\n tryStatements.push(createWarningFunctionCall(type.fqn, type.docs?.deprecated));\n isEmpty = false;\n }\n\n if (spec.isEnumType(type) && type.locationInModule?.filename) {\n // Check for deprecated enum members\n //\n // We need to compare to the value of the deprecated enum. We can do that in one of 2 ways:\n //\n // - Compare against `require('./actual-file').EnumType.SOME_ENUM_MEMBER`\n // - Look up the enum member value and compare against `'some-enum-member'`.\n //\n // The first one introduces a circular dependency between this file and `actual-file.js`, so we\n // will go with the second.\n //\n // One complication: two enum members can have the same value (shouldn't, but can!) where\n // one symbolic name is deprecated but the other isn't. In that case we don't treat it as deprecated.\n const memDecls = this.typeTracker.getEnumMembers(type.fqn);\n\n const nonDeprecatedValues = new Set(\n (type.members ?? [])\n .filter((m) => !spec.isDeprecated(m))\n .map((m) => this.typeChecker.getConstantValue(memDecls[m.name])!),\n );\n const deprecatedMembers = (type.members ?? []).filter(spec.isDeprecated);\n\n for (const member of deprecatedMembers) {\n const constantValue = this.typeChecker.getConstantValue(memDecls[member.name])!;\n if (nonDeprecatedValues.has(constantValue)) {\n // Collission with non-deprecated enum member\n continue;\n }\n\n const condition = ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(PARAMETER_NAME),\n ts.SyntaxKind.EqualsEqualsEqualsToken,\n typeof constantValue === 'string'\n ? ts.factory.createStringLiteral(constantValue)\n : ts.factory.createNumericLiteral(constantValue),\n );\n tryStatements.push(createWarningFunctionCall(`${type.fqn}#${member.name}`, member.docs?.deprecated, condition));\n isEmpty = false;\n }\n } else if (spec.isInterfaceType(type) && type.datatype) {\n const { statementsByProp, excludedProps } = this.processInterfaceType(\n type,\n types,\n assembly,\n projectInfo,\n undefined,\n undefined,\n );\n\n for (const [name, statement] of statementsByProp.entries()) {\n if (!excludedProps.has(name)) {\n tryStatements.push(statement);\n isEmpty = false;\n }\n }\n }\n\n statements.push(\n ts.factory.createTryStatement(\n ts.factory.createBlock(tryStatements),\n undefined,\n ts.factory.createBlock([\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME),\n 'delete',\n ),\n undefined,\n [ts.factory.createIdentifier(PARAMETER_NAME)],\n ),\n ),\n ]),\n ),\n );\n\n return isEmpty ? [] : statements;\n }\n\n private processInterfaceType(\n type: spec.InterfaceType,\n types: { [p: string]: spec.Type },\n assembly: Assembly,\n projectInfo: ProjectInfo,\n statementsByProp: Map<string, ts.Statement> = new Map<string, ts.Statement>(),\n excludedProps: Set<string> = new Set<string>(),\n ) {\n for (const prop of Object.values(type.properties ?? {})) {\n const fqn = `${type.fqn}#${prop.name}`;\n if (spec.isDeprecated(prop) || spec.isDeprecated(type)) {\n // If the property individually is deprecated, or the entire type is deprecated\n const deprecatedDocs = prop.docs?.deprecated ?? type.docs?.deprecated;\n const statement = createWarningFunctionCall(\n fqn,\n deprecatedDocs,\n ts.factory.createBinaryExpression(\n ts.factory.createStringLiteral(prop.name),\n ts.SyntaxKind.InKeyword,\n ts.factory.createIdentifier(PARAMETER_NAME),\n ),\n undefined,\n );\n statementsByProp.set(prop.name, statement);\n } else {\n /* If a prop is not deprecated, we don't want to generate a warning for it,\n even if another property with the same name is deprecated in another\n super-interface. */\n excludedProps.add(prop.name);\n }\n\n if (spec.isNamedTypeReference(prop.type) && Object.keys(types).includes(prop.type.fqn)) {\n if (this.shouldRenderValidator(types[prop.type.fqn], assembly)) {\n const functionName = importedFunctionName(prop.type.fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`);\n statementsByProp.set(`${prop.name}_`, statement);\n }\n }\n } else if (\n spec.isCollectionTypeReference(prop.type) &&\n spec.isNamedTypeReference(prop.type.collection.elementtype)\n ) {\n const functionName = importedFunctionName(prop.type.collection.elementtype.fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(\n functionName,\n `${PARAMETER_NAME}.${prop.name}`,\n prop.type.collection.kind,\n );\n statementsByProp.set(`${prop.name}_`, statement);\n }\n } else if (\n spec.isUnionTypeReference(prop.type) &&\n spec.isNamedTypeReference(prop.type.union.types[0]) &&\n Object.keys(types).includes(prop.type.union.types[0].fqn)\n ) {\n const functionName = importedFunctionName(prop.type.union.types[0].fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`);\n statementsByProp.set(`${prop.name}_`, statement);\n }\n }\n }\n\n // We also generate calls to all the supertypes\n for (const interfaceName of type.interfaces ?? []) {\n const assemblies = projectInfo.dependencyClosure.concat(assembly);\n const superType = findType(interfaceName, assemblies);\n if (superType.type) {\n this.processInterfaceType(\n superType.type as spec.InterfaceType,\n types,\n assembly,\n projectInfo,\n statementsByProp,\n excludedProps,\n );\n }\n }\n return { statementsByProp, excludedProps };\n }\n}\n\nfunction fnName(fqn: string): string {\n return fqn.replace(/[^\\w\\d]/g, '_');\n}\n\nfunction createFunctionBlock(statements: ts.Statement[]): ts.Block {\n if (statements.length > 0) {\n const validation = ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(PARAMETER_NAME),\n ts.SyntaxKind.EqualsEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createReturnStatement(),\n );\n return ts.factory.createBlock([validation, ...statements], true);\n }\n return ts.factory.createBlock([], true);\n}\n\nfunction createWarningFunctionCall(\n fqn: string,\n message = '',\n condition?: ts.Expression,\n includeNamespace = false,\n): ts.Statement {\n const functionName = includeNamespace ? `${NAMESPACE}.${WARNING_FUNCTION_NAME}` : WARNING_FUNCTION_NAME;\n\n const mainStatement = ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createStringLiteral(fqn),\n ts.factory.createStringLiteral(message),\n ]),\n );\n\n return condition ? ts.factory.createIfStatement(condition, mainStatement) : mainStatement;\n}\n\nfunction generateWarningsFile(projectRoot: string, validatorStatements: ts.Statement[]) {\n const functionText = `function ${WARNING_FUNCTION_NAME}(name, deprecationMessage) {\n const deprecated = process.env.JSII_DEPRECATED;\n const deprecationMode = ['warn', 'fail', 'quiet'].includes(deprecated) ? deprecated : 'warn';\n const message = \\`\\${name} is deprecated.\\\\n \\${deprecationMessage.trim()}\\\\n This API will be removed in the next major release.\\`;\n switch (deprecationMode) {\n case \"fail\":\n throw new ${DEPRECATION_ERROR}(message);\n case \"warn\":\n console.warn(\"[WARNING]\", message);\n break;\n }\n}\n\nfunction ${GET_PROPERTY_DESCRIPTOR}(obj, prop) {\n const descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n if (descriptor) {\n return descriptor;\n }\n const proto = Object.getPrototypeOf(obj);\n const prototypeDescriptor = proto && getPropertyDescriptor(proto, prop);\n if (prototypeDescriptor) {\n return prototypeDescriptor;\n }\n return {};\n}\n\nconst ${VISITED_OBJECTS_SET_NAME} = new Set();\n\nclass ${DEPRECATION_ERROR} extends Error {\n constructor(...args) {\n super(...args);\n Object.defineProperty(this, 'name', {\n configurable: false,\n enumerable: true,\n value: '${DEPRECATION_ERROR}',\n writable: false,\n });\n }\n}\n\nfunction nop() {\n}\n\nmodule.exports = new Proxy({}, {\n get(target, prop, receiver) {\n if (prop === '${WARNING_FUNCTION_NAME}') return ${WARNING_FUNCTION_NAME};\n if (prop === '${GET_PROPERTY_DESCRIPTOR}') return ${GET_PROPERTY_DESCRIPTOR};\n if (prop === '${DEPRECATION_ERROR}') return ${DEPRECATION_ERROR};\n\n return ${VALIDATORS_OBJ}[prop] ?? nop;\n },\n});\n`;\n\n const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });\n const resultFile = ts.createSourceFile(\n path.join(projectRoot, WARNINGSCODE_FILE_NAME),\n functionText,\n ts.ScriptTarget.Latest,\n false,\n ts.ScriptKind.JS,\n );\n\n const declarations = validatorStatements.map((st) => printer.printNode(ts.EmitHint.Unspecified, st, resultFile));\n\n const content = declarations.concat(printer.printFile(resultFile)).join('\\n');\n\n fs.writeFileSync(path.join(projectRoot, WARNINGSCODE_FILE_NAME), content);\n}\n\nclass Transformer {\n private warningCallsWereInjected = false;\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly context: ts.TransformationContext,\n private readonly projectRoot: string,\n private readonly typeIndex: Map<string, spec.Type>,\n private readonly assembly: Assembly,\n ) {}\n\n public transform<T extends ts.Node>(node: T): T {\n this.warningCallsWereInjected = false;\n\n const result = this.visitEachChild(node);\n\n if (ts.isSourceFile(result) && this.warningCallsWereInjected) {\n const importDir = path.relative(path.dirname(result.fileName), this.projectRoot);\n const importPath = importDir.startsWith('..')\n ? unixPath(path.join(importDir, WARNINGSCODE_FILE_NAME))\n : `./${WARNINGSCODE_FILE_NAME}`;\n\n return ts.factory.updateSourceFile(result, [\n createRequireStatement(NAMESPACE, importPath),\n ...result.statements,\n ]) as any;\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 (ts.isMethodDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateMethodDeclaration(\n node,\n node.modifiers,\n node.asteriskToken,\n node.name,\n node.questionToken,\n node.typeParameters,\n node.parameters,\n node.type,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(ts.factory.createThis(), node.name.getText(node.getSourceFile())),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isGetAccessorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateGetAccessorDeclaration(\n node,\n node.modifiers,\n node.name,\n node.parameters,\n node.type,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(NAMESPACE),\n GET_PROPERTY_DESCRIPTOR,\n ),\n undefined,\n [ts.factory.createThis(), ts.factory.createStringLiteral(node.name.getText(node.getSourceFile()))],\n ),\n 'get',\n ),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isSetAccessorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateSetAccessorDeclaration(\n node,\n node.modifiers,\n node.name,\n node.parameters,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(NAMESPACE),\n GET_PROPERTY_DESCRIPTOR,\n ),\n undefined,\n [ts.factory.createThis(), ts.factory.createStringLiteral(node.name.getText(node.getSourceFile()))],\n ),\n 'set',\n ),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isConstructorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateConstructorDeclaration(\n node,\n node.modifiers,\n node.parameters,\n ts.factory.updateBlock(node.body, insertStatements(node.body, wrapWithRethrow(statements, node.parent.name!))),\n ) as any;\n }\n\n return this.visitEachChild(node);\n }\n\n /**\n * @param getOrSet for property accessors, determines which of the getter or\n * setter should be used to get the caller function value.\n */\n private getStatementsForDeclaration(\n node: ts.MethodDeclaration | ts.GetAccessorDeclaration | ts.SetAccessorDeclaration | ts.ConstructorDeclaration,\n ): ts.Statement[] {\n const klass = node.parent;\n const classSymbolId = symbolIdentifier(this.typeChecker, this.typeChecker.getTypeAtLocation(klass).symbol);\n if (classSymbolId && this.typeIndex.has(classSymbolId)) {\n const classType = this.typeIndex.get(classSymbolId)! as spec.ClassType;\n\n if (ts.isConstructorDeclaration(node)) {\n const initializer = classType?.initializer;\n if (initializer) {\n return this.getStatements(classType, initializer);\n }\n }\n\n const methods = classType?.methods ?? [];\n const method = methods.find((m) => m.name === node.name?.getText());\n if (method) {\n return this.getStatements(classType, method);\n }\n\n const properties = classType?.properties ?? [];\n const property = properties.find((p) => p.name === node.name?.getText());\n if (property) {\n return createWarningStatementForElement(property, classType);\n }\n }\n return [];\n }\n\n private getStatements(classType: spec.ClassType, method: spec.Method | spec.Initializer) {\n const statements = createWarningStatementForElement(method, classType);\n for (const parameter of Object.values(method.parameters ?? {})) {\n const parameterType =\n this.assembly.types && spec.isNamedTypeReference(parameter.type)\n ? this.assembly.types[parameter.type.fqn]\n : undefined;\n\n if (parameterType) {\n const functionName = `${NAMESPACE}.${fnName(parameterType.fqn)}`;\n statements.push(\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createIdentifier(parameter.name),\n ]),\n ),\n );\n }\n }\n\n return statements;\n }\n}\n\nfunction findType2(fqn: string, assembly: Assembly): spec.Type | 'other-assembly' {\n // Is from a different assembly?\n if (!fqn.startsWith(`${assembly.name}.`)) {\n return 'other-assembly';\n }\n\n const type = (assembly.types ?? {})[fqn];\n if (!type) {\n throw new Error(`Could not find type in same assembly: ${fqn}`);\n }\n return type;\n}\n\nfunction createWarningStatementForElement(\n element: spec.Callable | spec.Property,\n classType: spec.ClassType,\n): ts.Statement[] {\n if (spec.isDeprecated(element)) {\n const elementName = (element as spec.Method | spec.Property).name;\n const fqn = elementName ? `${classType.fqn}#${elementName}` : classType.fqn;\n const message = element.docs?.deprecated ?? classType.docs?.deprecated;\n return [createWarningFunctionCall(fqn, message, undefined, true)];\n }\n return [];\n}\n\n/**\n * Inserts a list of statements in the correct position inside a block of statements.\n * If there is a `super` call, It inserts the statements just after it. Otherwise,\n * insert the statements right at the beginning of the block.\n */\nfunction insertStatements(block: ts.Block, newStatements: ts.Statement[]) {\n function splicePoint(statement: ts.Statement | undefined) {\n if (statement == null) {\n return 0;\n }\n let isSuper = false;\n statement.forEachChild((node) => {\n if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.SuperKeyword) {\n isSuper = true;\n }\n });\n return isSuper ? 1 : 0;\n }\n\n const result = [...block.statements];\n result.splice(splicePoint(block.statements[0]), 0, ...newStatements);\n return ts.factory.createNodeArray(result);\n}\n\nfunction createRequireStatement(name: string, importPath: string): ts.Statement {\n return ts.factory.createVariableStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [\n ts.factory.createVariableDeclaration(\n name,\n undefined,\n undefined,\n ts.factory.createCallExpression(ts.factory.createIdentifier('require'), undefined, [\n ts.factory.createStringLiteral(importPath),\n ]),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n );\n}\n\n/**\n * Returns a ready-to-used function name (including a `require`, if necessary)\n */\nfunction importedFunctionName(typeName: string, assembly: Assembly, projectInfo: ProjectInfo) {\n const assemblies = projectInfo.dependencyClosure.concat(assembly);\n const { type, moduleName } = findType(typeName, assemblies);\n if (type) {\n return moduleName !== assembly.name\n ? `require(\"${moduleName}/${WARNINGSCODE_FILE_NAME}\").${fnName(type.fqn)}`\n : `module.exports.${fnName(type.fqn)}`;\n }\n return undefined;\n}\n\n/**\n * Find the type and module name in an array of assemblies\n * matching a given type name\n */\nfunction findType(typeName: string, assemblies: Assembly[]) {\n for (const asm of assemblies) {\n if (asm.metadata?.jsii?.compiledWithDeprecationWarnings) {\n const types = asm.types ?? {};\n for (const name of Object.keys(types)) {\n if (typeName === name) {\n return { type: types[name], moduleName: asm.name };\n }\n }\n }\n }\n return {};\n}\n\nfunction createTypeHandlerCall(\n functionName: string,\n parameter: string,\n collectionKind?: spec.CollectionKind,\n): ts.Statement {\n switch (collectionKind) {\n case spec.CollectionKind.Array:\n return ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(parameter),\n ts.SyntaxKind.ExclamationEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createForOfStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [ts.factory.createVariableDeclaration(FOR_LOOP_ITEM_NAME)],\n ts.NodeFlags.Const,\n ),\n ts.factory.createIdentifier(parameter),\n createTypeHandlerCall(functionName, FOR_LOOP_ITEM_NAME),\n ),\n );\n case spec.CollectionKind.Map:\n return ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(parameter),\n ts.SyntaxKind.ExclamationEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createForOfStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [ts.factory.createVariableDeclaration(FOR_LOOP_ITEM_NAME)],\n ts.NodeFlags.Const,\n ),\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Object'), 'values'),\n undefined,\n [ts.factory.createIdentifier(parameter)],\n ),\n createTypeHandlerCall(functionName, FOR_LOOP_ITEM_NAME),\n ),\n );\n case undefined:\n return ts.factory.createIfStatement(\n ts.factory.createPrefixUnaryExpression(\n ts.SyntaxKind.ExclamationToken,\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME),\n ts.factory.createIdentifier('has'),\n ),\n undefined,\n [ts.factory.createIdentifier(parameter)],\n ),\n ),\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createIdentifier(parameter),\n ]),\n ),\n );\n }\n}\n\n// We try-then-rethrow exceptions to avoid runtimes displaying an uncanny wall of text if the place\n// where the error was thrown is webpacked. For example, jest somehow manages to capture the throw\n// location and renders the source line (which may be the whole file) when bundled.\nfunction wrapWithRethrow(statements: ts.Statement[], caller: ts.Expression): ts.Statement[] {\n if (statements.length === 0) {\n return statements;\n }\n return [\n ts.factory.createTryStatement(\n ts.factory.createBlock(statements),\n ts.factory.createCatchClause(\n ts.factory.createVariableDeclaration('error'),\n ts.factory.createBlock([\n // If this is a DeprecationError, trim its stack trace to surface level before re-throwing,\n // so we don't carry out possibly confusing frames from injected code. That can be toggled\n // off by setting JSII_DEBUG=1, so we can also diagnose in-injected code faults.\n ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createBinaryExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('process'), 'env'),\n 'JSII_DEBUG',\n ),\n ts.SyntaxKind.ExclamationEqualsEqualsToken,\n ts.factory.createStringLiteral('1'),\n ),\n ts.SyntaxKind.AmpersandAmpersandToken,\n ts.factory.createBinaryExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('error'), 'name'),\n ts.SyntaxKind.EqualsEqualsEqualsToken,\n ts.factory.createStringLiteral(DEPRECATION_ERROR),\n ),\n ),\n ts.factory.createBlock([\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Error'), 'captureStackTrace'),\n undefined,\n [ts.factory.createIdentifier('error'), caller],\n ),\n ),\n ]),\n ),\n ts.factory.createThrowStatement(ts.factory.createIdentifier('error')),\n ]),\n ),\n undefined,\n ),\n ];\n}\n\n/**\n * Force a path to be UNIXy (use `/` as a separator)\n *\n * `path.join()` etc. will use the system-dependent path separator (either `/` or `\\`\n * depending on your platform).\n *\n * However, if we actually emit the path-dependent separator to the `.js` files, then\n * files compiled with jsii on Windows cannot be used on any other platform. That seems\n * like an unnecessary restriction, especially since a `/` will work fine on Windows,\n * so make sure to always emit `/`.\n *\n * TSC itself always strictly emits `/` (or at least, emits the same what you put in).\n */\nfunction unixPath(filePath: string) {\n if (path.sep === '\\\\') {\n return filePath.replace(/\\\\/g, '/');\n }\n return filePath;\n}\n"]}
1
+ {"version":3,"file":"deprecation-warnings.js","sourceRoot":"","sources":["../../src/transforms/deprecation-warnings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAClC,iDAAmC;AAEnC,+CAAiC;AAEjC,mDAAuD;AAI1C,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,qBAAqB,GAAG,OAAO,CAAC;AACtC,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,SAAS,GAAG,yBAAyB,CAAC;AAC5C,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AAClD,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAC7C,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AACxD,MAAM,cAAc,GAAG,YAAY,CAAC;AAEpC,MAAa,2BAA2B;IAQF;IAA8C;IAP1E,YAAY,GAA0B;QAC5C,MAAM,EAAE,EAAE;KACX,CAAC;IAEM,0BAA0B,GAA4B,EAAE,CAAC;IACzD,qBAAqB,GAAG,IAAI,GAAG,EAAU,CAAC;IAElD,YAAoC,WAA2B,EAAmB,WAAwB;QAAtE,gBAAW,GAAX,WAAW,CAAgB;QAAmB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;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C;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,QAAQ,CAAC,QAAgB;IAChC,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as spec from '@jsii/spec';\nimport { Assembly } from '@jsii/spec';\nimport * as ts from 'typescript';\n\nimport { symbolIdentifier } from '../common/symbol-id';\nimport { ProjectInfo } from '../project-info';\nimport { TypeTracker } from '../type-tracker';\n\nexport const WARNINGSCODE_FILE_NAME = '.warnings.jsii.js';\nconst WARNING_FUNCTION_NAME = 'print';\nconst PARAMETER_NAME = 'p';\nconst FOR_LOOP_ITEM_NAME = 'o';\nconst NAMESPACE = 'jsiiDeprecationWarnings';\nconst VISITED_OBJECTS_SET_NAME = 'visitedObjects';\nconst DEPRECATION_ERROR = 'DeprecationError';\nconst GET_PROPERTY_DESCRIPTOR = 'getPropertyDescriptor';\nconst VALIDATORS_OBJ = 'VALIDATORS';\n\nexport class DeprecationWarningsInjector {\n private transformers: ts.CustomTransformers = {\n before: [],\n };\n\n private shouldRenderValidatorCache: Record<string, boolean> = {};\n private validatorCacheSeenSet = new Set<string>();\n\n public constructor(private readonly typeChecker: ts.TypeChecker, private readonly typeTracker: TypeTracker) {}\n\n public process(assembly: Assembly, projectInfo: ProjectInfo) {\n const projectRoot = projectInfo.projectRoot;\n const validationFunctions: ts.ObjectLiteralElementLike[] = [];\n\n const types = assembly.types ?? {};\n for (const type of Object.values(types)) {\n const fnStatements = this.generateTypeValidation(type, assembly, projectInfo, types);\n if (fnStatements.length === 0) {\n continue;\n }\n\n const paramValue = ts.factory.createParameterDeclaration(undefined, undefined, PARAMETER_NAME);\n const functionName = fnName(type.fqn);\n const functionExpr = ts.factory.createFunctionExpression(\n undefined,\n undefined,\n ts.factory.createIdentifier(functionName),\n [],\n [paramValue],\n undefined,\n createFunctionBlock(fnStatements),\n );\n validationFunctions.push(ts.factory.createPropertyAssignment(functionName, functionExpr));\n }\n\n const fileStatements: ts.Statement[] = [];\n fileStatements.push(\n ts.factory.createVariableStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [\n ts.factory.createVariableDeclaration(\n VALIDATORS_OBJ,\n undefined,\n undefined,\n ts.factory.createObjectLiteralExpression(validationFunctions),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n );\n\n this.transformers = {\n before: [\n (context) => {\n const transformer = new Transformer(\n this.typeChecker,\n context,\n projectRoot,\n this.buildTypeIndex(assembly),\n assembly,\n );\n return transformer.transform.bind(transformer);\n },\n ],\n };\n\n generateWarningsFile(projectRoot, fileStatements);\n }\n\n public get customTransformers(): ts.CustomTransformers {\n return this.transformers;\n }\n\n private buildTypeIndex(assembly: Assembly): Map<string, spec.Type> {\n const result = new Map<string, spec.Type>();\n\n for (const type of Object.values(assembly.types ?? {})) {\n const symbolId = type.symbolId;\n if (symbolId) {\n result.set(symbolId, type);\n }\n }\n\n return result;\n }\n\n /**\n * Whether the validator for the given type should be rendered\n *\n * A validator should be rendered if:\n *\n * - It contains any deprecated members (base case).\n * - It references any other types whose validators should be rendered.\n * - It inherits from other types whose validators should be rendered.\n * - It references types that reference this type (recursive types).\n * - It references types from another assembly.\n *\n * For the last one we technically return `true`, indicating that a validator\n * *should* be rendered, but when we get to rendering no statements are\n * actually produced and the validator function is never rendered. This was\n * pre-existing behavior that I didn't change because introducing calls into\n * other assemblies out of the blue introduces risk.\n */\n private shouldRenderValidator(type: spec.Type, assembly: Assembly): boolean {\n if (this.shouldRenderValidatorCache[type.fqn] !== undefined) {\n return this.shouldRenderValidatorCache[type.fqn];\n }\n\n if (this.validatorCacheSeenSet.has(type.fqn)) {\n // To be safe we need to say this is true.\n return true;\n }\n if (!type.fqn.startsWith(`${assembly.name}.`)) {\n // Foreign type, always check\n return true;\n }\n this.validatorCacheSeenSet.add(type.fqn);\n\n this.shouldRenderValidatorCache[type.fqn] = calculate.call(this);\n this.validatorCacheSeenSet.delete(type.fqn);\n\n return this.shouldRenderValidatorCache[type.fqn];\n\n function calculate(this: DeprecationWarningsInjector): boolean {\n if (spec.isDeprecated(type)) {\n return true;\n }\n if (spec.isEnumType(type)) {\n return (type.members ?? []).some(spec.isDeprecated);\n }\n if (spec.isInterfaceType(type) && type.datatype) {\n for (const prop of type.properties ?? []) {\n if (spec.isDeprecated(prop)) {\n return true;\n }\n\n const typesToInspect = spec.isCollectionTypeReference(prop.type)\n ? [prop.type.collection.elementtype]\n : spec.isUnionTypeReference(prop.type)\n ? prop.type.union.types\n : [prop.type];\n\n for (const typeToInspect of typesToInspect) {\n if (!spec.isNamedTypeReference(typeToInspect)) {\n continue;\n }\n\n // Is from a different assembly?\n const typeObj = findType2(typeToInspect.fqn, assembly);\n if (typeObj === 'other-assembly') {\n return true;\n }\n if (this.shouldRenderValidator(typeObj, assembly)) {\n return true;\n }\n }\n }\n\n for (const interfaceName of type.interfaces ?? []) {\n const typeObj = findType2(interfaceName, assembly);\n if (typeObj === 'other-assembly') {\n return true;\n }\n if (this.shouldRenderValidator(typeObj, assembly)) {\n return true;\n }\n }\n }\n\n return false;\n }\n }\n\n private generateTypeValidation(\n type: spec.Type,\n assembly: Assembly,\n projectInfo: ProjectInfo,\n types: Record<string, spec.Type>,\n ): ts.Statement[] {\n if (!this.shouldRenderValidator(type, assembly)) {\n return [];\n }\n\n const statements: ts.Statement[] = [];\n let isEmpty = true;\n\n // This will add the parameter to the set of visited objects, to prevent infinite recursion\n statements.push(\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME), 'add'),\n undefined,\n [ts.factory.createIdentifier(PARAMETER_NAME)],\n ),\n ),\n );\n\n const tryStatements = [];\n if (spec.isDeprecated(type) && spec.isEnumType(type)) {\n // The type is deprecated\n tryStatements.push(createWarningFunctionCall(type.fqn, type.docs?.deprecated));\n isEmpty = false;\n }\n\n if (spec.isEnumType(type) && type.locationInModule?.filename) {\n // Check for deprecated enum members\n //\n // We need to compare to the value of the deprecated enum. We can do that in one of 2 ways:\n //\n // - Compare against `require('./actual-file').EnumType.SOME_ENUM_MEMBER`\n // - Look up the enum member value and compare against `'some-enum-member'`.\n //\n // The first one introduces a circular dependency between this file and `actual-file.js`, so we\n // will go with the second.\n //\n // One complication: two enum members can have the same value (shouldn't, but can!) where\n // one symbolic name is deprecated but the other isn't. In that case we don't treat it as deprecated.\n const memDecls = this.typeTracker.getEnumMembers(type.fqn);\n\n const nonDeprecatedValues = new Set(\n (type.members ?? [])\n .filter((m) => !spec.isDeprecated(m))\n .map((m) => this.typeChecker.getConstantValue(memDecls[m.name])!),\n );\n const deprecatedMembers = (type.members ?? []).filter(spec.isDeprecated);\n\n for (const member of deprecatedMembers) {\n const constantValue = this.typeChecker.getConstantValue(memDecls[member.name])!;\n if (nonDeprecatedValues.has(constantValue)) {\n // Collission with non-deprecated enum member\n continue;\n }\n\n const condition = ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(PARAMETER_NAME),\n ts.SyntaxKind.EqualsEqualsEqualsToken,\n typeof constantValue === 'string'\n ? ts.factory.createStringLiteral(constantValue)\n : ts.factory.createNumericLiteral(constantValue),\n );\n tryStatements.push(createWarningFunctionCall(`${type.fqn}#${member.name}`, member.docs?.deprecated, condition));\n isEmpty = false;\n }\n } else if (spec.isInterfaceType(type) && type.datatype) {\n const { statementsByProp, excludedProps } = this.processInterfaceType(\n type,\n types,\n assembly,\n projectInfo,\n undefined,\n undefined,\n );\n\n for (const [name, statement] of statementsByProp.entries()) {\n if (!excludedProps.has(name)) {\n tryStatements.push(statement);\n isEmpty = false;\n }\n }\n }\n\n statements.push(\n ts.factory.createTryStatement(\n ts.factory.createBlock(tryStatements),\n undefined,\n ts.factory.createBlock([\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME),\n 'delete',\n ),\n undefined,\n [ts.factory.createIdentifier(PARAMETER_NAME)],\n ),\n ),\n ]),\n ),\n );\n\n return isEmpty ? [] : statements;\n }\n\n private processInterfaceType(\n type: spec.InterfaceType,\n types: { [p: string]: spec.Type },\n assembly: Assembly,\n projectInfo: ProjectInfo,\n statementsByProp: Map<string, ts.Statement> = new Map<string, ts.Statement>(),\n excludedProps: Set<string> = new Set<string>(),\n ) {\n for (const prop of Object.values(type.properties ?? {})) {\n const fqn = `${type.fqn}#${prop.name}`;\n if (spec.isDeprecated(prop) || spec.isDeprecated(type)) {\n // If the property individually is deprecated, or the entire type is deprecated\n const deprecatedDocs = prop.docs?.deprecated ?? type.docs?.deprecated;\n const statement = createWarningFunctionCall(\n fqn,\n deprecatedDocs,\n ts.factory.createBinaryExpression(\n ts.factory.createStringLiteral(prop.name),\n ts.SyntaxKind.InKeyword,\n ts.factory.createIdentifier(PARAMETER_NAME),\n ),\n undefined,\n );\n statementsByProp.set(prop.name, statement);\n } else {\n /* If a prop is not deprecated, we don't want to generate a warning for it,\n even if another property with the same name is deprecated in another\n super-interface. */\n excludedProps.add(prop.name);\n }\n\n if (spec.isNamedTypeReference(prop.type) && Object.keys(types).includes(prop.type.fqn)) {\n if (this.shouldRenderValidator(types[prop.type.fqn], assembly)) {\n const functionName = importedFunctionName(prop.type.fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`);\n statementsByProp.set(`${prop.name}_`, statement);\n }\n }\n } else if (\n spec.isCollectionTypeReference(prop.type) &&\n spec.isNamedTypeReference(prop.type.collection.elementtype)\n ) {\n const functionName = importedFunctionName(prop.type.collection.elementtype.fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(\n functionName,\n `${PARAMETER_NAME}.${prop.name}`,\n prop.type.collection.kind,\n );\n statementsByProp.set(`${prop.name}_`, statement);\n }\n } else if (\n spec.isUnionTypeReference(prop.type) &&\n spec.isNamedTypeReference(prop.type.union.types[0]) &&\n Object.keys(types).includes(prop.type.union.types[0].fqn)\n ) {\n const functionName = importedFunctionName(prop.type.union.types[0].fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`);\n statementsByProp.set(`${prop.name}_`, statement);\n }\n }\n }\n\n // We also generate calls to all the supertypes\n for (const interfaceName of type.interfaces ?? []) {\n const assemblies = projectInfo.dependencyClosure.concat(assembly);\n const superType = findType(interfaceName, assemblies);\n if (superType.type) {\n this.processInterfaceType(\n superType.type as spec.InterfaceType,\n types,\n assembly,\n projectInfo,\n statementsByProp,\n excludedProps,\n );\n }\n }\n return { statementsByProp, excludedProps };\n }\n}\n\nfunction fnName(fqn: string): string {\n return fqn.replace(/[^\\w\\d]/g, '_');\n}\n\nfunction createFunctionBlock(statements: ts.Statement[]): ts.Block {\n if (statements.length > 0) {\n const validation = ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(PARAMETER_NAME),\n ts.SyntaxKind.EqualsEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createReturnStatement(),\n );\n return ts.factory.createBlock([validation, ...statements], true);\n }\n return ts.factory.createBlock([], true);\n}\n\nfunction createWarningFunctionCall(\n fqn: string,\n message = '',\n condition?: ts.Expression,\n includeNamespace = false,\n): ts.Statement {\n const functionName = includeNamespace ? `${NAMESPACE}.${WARNING_FUNCTION_NAME}` : WARNING_FUNCTION_NAME;\n\n const mainStatement = ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createStringLiteral(fqn),\n ts.factory.createStringLiteral(message),\n ]),\n );\n\n return condition ? ts.factory.createIfStatement(condition, mainStatement) : mainStatement;\n}\n\nfunction generateWarningsFile(projectRoot: string, validatorStatements: ts.Statement[]) {\n const functionText = `function ${WARNING_FUNCTION_NAME}(name, deprecationMessage) {\n const deprecated = process.env.JSII_DEPRECATED;\n const deprecationMode = ['warn', 'fail', 'quiet'].includes(deprecated) ? deprecated : 'warn';\n const message = \\`\\${name} is deprecated.\\\\n \\${deprecationMessage.trim()}\\\\n This API will be removed in the next major release.\\`;\n switch (deprecationMode) {\n case \"fail\":\n throw new ${DEPRECATION_ERROR}(message);\n case \"warn\":\n console.warn(\"[WARNING]\", message);\n break;\n }\n}\n\nfunction ${GET_PROPERTY_DESCRIPTOR}(obj, prop) {\n const descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n if (descriptor) {\n return descriptor;\n }\n const proto = Object.getPrototypeOf(obj);\n const prototypeDescriptor = proto && getPropertyDescriptor(proto, prop);\n if (prototypeDescriptor) {\n return prototypeDescriptor;\n }\n return {};\n}\n\nconst ${VISITED_OBJECTS_SET_NAME} = new Set();\n\nclass ${DEPRECATION_ERROR} extends Error {\n constructor(...args) {\n super(...args);\n Object.defineProperty(this, 'name', {\n configurable: false,\n enumerable: true,\n value: '${DEPRECATION_ERROR}',\n writable: false,\n });\n }\n}\n\nfunction nop() {\n}\n\nmodule.exports = new Proxy({}, {\n get(target, prop, receiver) {\n if (prop === '${WARNING_FUNCTION_NAME}') return ${WARNING_FUNCTION_NAME};\n if (prop === '${GET_PROPERTY_DESCRIPTOR}') return ${GET_PROPERTY_DESCRIPTOR};\n if (prop === '${DEPRECATION_ERROR}') return ${DEPRECATION_ERROR};\n\n return ${VALIDATORS_OBJ}[prop] ?? nop;\n },\n});\n`;\n\n const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });\n const resultFile = ts.createSourceFile(\n path.join(projectRoot, WARNINGSCODE_FILE_NAME),\n functionText,\n ts.ScriptTarget.Latest,\n false,\n ts.ScriptKind.JS,\n );\n\n const declarations = validatorStatements.map((st) => printer.printNode(ts.EmitHint.Unspecified, st, resultFile));\n\n const content = declarations.concat(printer.printFile(resultFile)).join('\\n');\n\n fs.writeFileSync(path.join(projectRoot, WARNINGSCODE_FILE_NAME), content);\n}\n\nclass Transformer {\n private warningCallsWereInjected = false;\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly context: ts.TransformationContext,\n private readonly projectRoot: string,\n private readonly typeIndex: Map<string, spec.Type>,\n private readonly assembly: Assembly,\n ) {}\n\n public transform<T extends ts.Node>(node: T): T {\n this.warningCallsWereInjected = false;\n\n const result = this.visitEachChild(node);\n\n if (ts.isSourceFile(result) && this.warningCallsWereInjected) {\n const importDir = path.relative(path.dirname(result.fileName), this.projectRoot);\n const importPath = importDir.startsWith('..')\n ? unixPath(path.join(importDir, WARNINGSCODE_FILE_NAME))\n : `./${WARNINGSCODE_FILE_NAME}`;\n\n return ts.factory.updateSourceFile(result, [\n createRequireStatement(NAMESPACE, importPath),\n ...result.statements,\n ]) as any;\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 (ts.isMethodDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateMethodDeclaration(\n node,\n node.modifiers,\n node.asteriskToken,\n node.name,\n node.questionToken,\n node.typeParameters,\n node.parameters,\n node.type,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(ts.factory.createThis(), node.name.getText(node.getSourceFile())),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isGetAccessorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateGetAccessorDeclaration(\n node,\n node.modifiers,\n node.name,\n node.parameters,\n node.type,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(NAMESPACE),\n GET_PROPERTY_DESCRIPTOR,\n ),\n undefined,\n [ts.factory.createThis(), ts.factory.createStringLiteral(node.name.getText(node.getSourceFile()))],\n ),\n 'get',\n ),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isSetAccessorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateSetAccessorDeclaration(\n node,\n node.modifiers,\n node.name,\n node.parameters,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(NAMESPACE),\n GET_PROPERTY_DESCRIPTOR,\n ),\n undefined,\n [ts.factory.createThis(), ts.factory.createStringLiteral(node.name.getText(node.getSourceFile()))],\n ),\n 'set',\n ),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isConstructorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateConstructorDeclaration(\n node,\n node.modifiers,\n node.parameters,\n ts.factory.updateBlock(node.body, insertStatements(node.body, wrapWithRethrow(statements, node.parent.name!))),\n ) as any;\n }\n\n return this.visitEachChild(node);\n }\n\n /**\n * @param getOrSet for property accessors, determines which of the getter or\n * setter should be used to get the caller function value.\n */\n private getStatementsForDeclaration(\n node: ts.MethodDeclaration | ts.GetAccessorDeclaration | ts.SetAccessorDeclaration | ts.ConstructorDeclaration,\n ): ts.Statement[] {\n const klass = node.parent;\n const classSymbolId = symbolIdentifier(this.typeChecker, this.typeChecker.getTypeAtLocation(klass).symbol);\n if (classSymbolId && this.typeIndex.has(classSymbolId)) {\n const classType = this.typeIndex.get(classSymbolId)! as spec.ClassType;\n\n if (ts.isConstructorDeclaration(node)) {\n const initializer = classType?.initializer;\n if (initializer) {\n return this.getStatements(classType, initializer);\n }\n }\n\n const methods = classType?.methods ?? [];\n const method = methods.find((m) => m.name === node.name?.getText());\n if (method) {\n return this.getStatements(classType, method);\n }\n\n const properties = classType?.properties ?? [];\n const property = properties.find((p) => p.name === node.name?.getText());\n if (property) {\n return createWarningStatementForElement(property, classType);\n }\n }\n return [];\n }\n\n private getStatements(classType: spec.ClassType, method: spec.Method | spec.Initializer) {\n const statements = createWarningStatementForElement(method, classType);\n for (const parameter of Object.values(method.parameters ?? {})) {\n const parameterType =\n this.assembly.types && spec.isNamedTypeReference(parameter.type)\n ? this.assembly.types[parameter.type.fqn]\n : undefined;\n\n if (parameterType) {\n const functionName = `${NAMESPACE}.${fnName(parameterType.fqn)}`;\n statements.push(\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createIdentifier(parameter.name),\n ]),\n ),\n );\n }\n }\n\n return statements;\n }\n}\n\nfunction findType2(fqn: string, assembly: Assembly): spec.Type | 'other-assembly' {\n // Is from a different assembly?\n if (!fqn.startsWith(`${assembly.name}.`)) {\n return 'other-assembly';\n }\n\n const type = (assembly.types ?? {})[fqn];\n if (!type) {\n throw new Error(`Could not find type in same assembly: ${fqn}`);\n }\n return type;\n}\n\nfunction createWarningStatementForElement(\n element: spec.Callable | spec.Property,\n classType: spec.ClassType,\n): ts.Statement[] {\n if (spec.isDeprecated(element)) {\n const elementName = (element as spec.Method | spec.Property).name;\n const fqn = elementName ? `${classType.fqn}#${elementName}` : classType.fqn;\n const message = element.docs?.deprecated ?? classType.docs?.deprecated;\n return [createWarningFunctionCall(fqn, message, undefined, true)];\n }\n return [];\n}\n\n/**\n * Inserts a list of statements in the correct position inside a block of statements.\n * If there is a `super` call, It inserts the statements just after it. Otherwise,\n * insert the statements right at the beginning of the block.\n */\nfunction insertStatements(block: ts.Block, newStatements: ts.Statement[]) {\n function splicePoint(statement: ts.Statement | undefined) {\n if (statement == null) {\n return 0;\n }\n let isSuper = false;\n statement.forEachChild((node) => {\n if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.SuperKeyword) {\n isSuper = true;\n }\n });\n return isSuper ? 1 : 0;\n }\n\n const result = [...block.statements];\n result.splice(splicePoint(block.statements[0]), 0, ...newStatements);\n return ts.factory.createNodeArray(result);\n}\n\nfunction createRequireStatement(name: string, importPath: string): ts.Statement {\n return ts.factory.createVariableStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [\n ts.factory.createVariableDeclaration(\n name,\n undefined,\n undefined,\n ts.factory.createCallExpression(ts.factory.createIdentifier('require'), undefined, [\n ts.factory.createStringLiteral(importPath),\n ]),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n );\n}\n\n/**\n * Returns a ready-to-used function name (including a `require`, if necessary)\n */\nfunction importedFunctionName(typeName: string, assembly: Assembly, projectInfo: ProjectInfo) {\n const assemblies = projectInfo.dependencyClosure.concat(assembly);\n const { type, moduleName } = findType(typeName, assemblies);\n if (type) {\n return moduleName !== assembly.name\n ? `require(\"${moduleName}/${WARNINGSCODE_FILE_NAME}\").${fnName(type.fqn)}`\n : `module.exports.${fnName(type.fqn)}`;\n }\n return undefined;\n}\n\n/**\n * Find the type and module name in an array of assemblies\n * matching a given type name\n */\nfunction findType(typeName: string, assemblies: Assembly[]) {\n for (const asm of assemblies) {\n if (asm.metadata?.jsii?.compiledWithDeprecationWarnings) {\n const types = asm.types ?? {};\n for (const name of Object.keys(types)) {\n if (typeName === name) {\n return { type: types[name], moduleName: asm.name };\n }\n }\n }\n }\n return {};\n}\n\nfunction createTypeHandlerCall(\n functionName: string,\n parameter: string,\n collectionKind?: spec.CollectionKind,\n): ts.Statement {\n switch (collectionKind) {\n case spec.CollectionKind.Array:\n return ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(parameter),\n ts.SyntaxKind.ExclamationEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createForOfStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [ts.factory.createVariableDeclaration(FOR_LOOP_ITEM_NAME)],\n ts.NodeFlags.Const,\n ),\n ts.factory.createIdentifier(parameter),\n createTypeHandlerCall(functionName, FOR_LOOP_ITEM_NAME),\n ),\n );\n case spec.CollectionKind.Map:\n return ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(parameter),\n ts.SyntaxKind.ExclamationEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createForOfStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [ts.factory.createVariableDeclaration(FOR_LOOP_ITEM_NAME)],\n ts.NodeFlags.Const,\n ),\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Object'), 'values'),\n undefined,\n [ts.factory.createIdentifier(parameter)],\n ),\n createTypeHandlerCall(functionName, FOR_LOOP_ITEM_NAME),\n ),\n );\n case undefined:\n return ts.factory.createIfStatement(\n ts.factory.createPrefixUnaryExpression(\n ts.SyntaxKind.ExclamationToken,\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME),\n ts.factory.createIdentifier('has'),\n ),\n undefined,\n [ts.factory.createIdentifier(parameter)],\n ),\n ),\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createIdentifier(parameter),\n ]),\n ),\n );\n }\n}\n\n// We try-then-rethrow exceptions to avoid runtimes displaying an uncanny wall of text if the place\n// where the error was thrown is webpacked. For example, jest somehow manages to capture the throw\n// location and renders the source line (which may be the whole file) when bundled.\nfunction wrapWithRethrow(statements: ts.Statement[], caller: ts.Expression): ts.Statement[] {\n if (statements.length === 0) {\n return statements;\n }\n return [\n ts.factory.createTryStatement(\n ts.factory.createBlock(statements),\n ts.factory.createCatchClause(\n ts.factory.createVariableDeclaration('error'),\n ts.factory.createBlock([\n // If this is a DeprecationError, trim its stack trace to surface level before re-throwing,\n // so we don't carry out possibly confusing frames from injected code. That can be toggled\n // off by setting JSII_DEBUG=1, so we can also diagnose in-injected code faults.\n ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createBinaryExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('process'), 'env'),\n 'JSII_DEBUG',\n ),\n ts.SyntaxKind.ExclamationEqualsEqualsToken,\n ts.factory.createStringLiteral('1'),\n ),\n ts.SyntaxKind.AmpersandAmpersandToken,\n ts.factory.createBinaryExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('error'), 'name'),\n ts.SyntaxKind.EqualsEqualsEqualsToken,\n ts.factory.createStringLiteral(DEPRECATION_ERROR),\n ),\n ),\n ts.factory.createBlock([\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Error'), 'captureStackTrace'),\n undefined,\n [ts.factory.createIdentifier('error'), caller],\n ),\n ),\n ]),\n ),\n ts.factory.createThrowStatement(ts.factory.createIdentifier('error')),\n ]),\n ),\n undefined,\n ),\n ];\n}\n\n/**\n * Force a path to be UNIXy (use `/` as a separator)\n *\n * `path.join()` etc. will use the system-dependent path separator (either `/` or `\\`\n * depending on your platform).\n *\n * However, if we actually emit the path-dependent separator to the `.js` files, then\n * files compiled with jsii on Windows cannot be used on any other platform. That seems\n * like an unnecessary restriction, especially since a `/` will work fine on Windows,\n * so make sure to always emit `/`.\n *\n * TSC itself always strictly emits `/` (or at least, emits the same what you put in).\n */\nfunction unixPath(filePath: string) {\n if (path.sep === '\\\\') {\n return filePath.replace(/\\\\/g, '/');\n }\n return filePath;\n}\n"]}
@@ -1,7 +1,40 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.RuntimeTypeInfoInjector = void 0;
4
- const ts = require("typescript");
37
+ const ts = __importStar(require("typescript"));
5
38
  /**
6
39
  * Provides a TransformerFactory to annotate classes with runtime information
7
40
  * (e.g., fully-qualified name, version).
@@ -18,9 +51,10 @@ const ts = require("typescript");
18
51
  * ```
19
52
  */
20
53
  class RuntimeTypeInfoInjector {
54
+ version;
55
+ fqnsByClass = new Map();
21
56
  constructor(version) {
22
57
  this.version = version;
23
- this.fqnsByClass = new Map();
24
58
  }
25
59
  /**
26
60
  * Register the fully-qualified name (fqn) of a class with its ClassDeclaration.
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-info.js","sourceRoot":"","sources":["../../src/transforms/runtime-info.ts"],"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CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACjH,CAAC,CAAC;QAEH,MAAM,eAAe,GAAG,OAAO,CAAC,yBAAyB,CACvD;YACE,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC;YACpD,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC;YACnD,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC;SACtD,EACD,OAAO,CAAC,0BAA0B,CAAC,UAAU,CAAC,EAC9C,SAAS,EACT,SAAS,EACT,WAAW,CACZ,CAAC;QAEF,OAAO,OAAO,CAAC,sBAAsB,CACnC,IAAI,EACJ,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,eAAe,EACpB,OAAO,CAAC,eAAe,CAAC,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAC5D,CAAC;IACJ,CAAC;CACF;AAlHD,0DAkHC","sourcesContent":["import * as ts from 'typescript';\n\n/**\n * Provides a TransformerFactory to annotate classes with runtime information\n * (e.g., fully-qualified name, version).\n *\n * It does this by first inserting this definition at the top of each source file:\n * ```\n * var JSII_RTTI_SYMBOL_1 = Symbol.for(\"jsii.rtti\");\n * ```\n *\n * Then, for each class that has registered runtime information during assembly,\n * insert a static member to the class with its fqn and version:\n * ```\n * private static readonly [JSII_RTTI_SYMBOL_1] = { fqn: \"ModuleName.ClassName\", version: \"1.2.3\" }\n * ```\n */\nexport class RuntimeTypeInfoInjector {\n private readonly fqnsByClass = new Map<ts.ClassDeclaration, string>();\n\n public constructor(private readonly version: string) {}\n\n /**\n * Register the fully-qualified name (fqn) of a class with its ClassDeclaration.\n * Only ClassDeclarations with registered fqns will be annotated.\n */\n public registerClassFqn(clazz: ts.ClassDeclaration, fqn: string) {\n this.fqnsByClass.set(clazz, fqn);\n }\n\n /**\n * Return the set of Transformers to be used in TSC's program.emit()\n */\n public makeTransformers(): ts.CustomTransformers {\n return {\n before: [this.runtimeTypeTransformer()],\n };\n }\n\n public runtimeTypeTransformer(): ts.TransformerFactory<ts.SourceFile> {\n return (context) => {\n const { factory } = context;\n\n return (sourceFile): ts.SourceFile => {\n const rttiSymbolIdentifier = factory.createUniqueName('JSII_RTTI_SYMBOL');\n\n let classesAnnotated = false;\n const visitor = (node: ts.Node): ts.Node => {\n if (ts.isClassDeclaration(node)) {\n const fqn = this.getClassFqn(node);\n if (fqn) {\n classesAnnotated = true;\n return this.addRuntimeInfoToClass(node, fqn, rttiSymbolIdentifier, factory);\n }\n }\n return ts.visitEachChild(node, visitor, context);\n };\n\n // Visit the source file, annotating the classes.\n let annotatedSourceFile = ts.visitNode(sourceFile, visitor) as ts.SourceFile;\n\n // Only add the symbol definition if it's actually used.\n if (classesAnnotated) {\n const rttiSymbol = factory.createCallExpression(\n factory.createPropertyAccessExpression(factory.createIdentifier('Symbol'), factory.createIdentifier('for')),\n undefined,\n [factory.createStringLiteral('jsii.rtti')],\n );\n const rttiSymbolDeclaration = factory.createVariableDeclaration(\n rttiSymbolIdentifier,\n undefined,\n undefined,\n rttiSymbol,\n );\n const variableDeclaration = factory.createVariableStatement(\n [],\n factory.createVariableDeclarationList([rttiSymbolDeclaration], ts.NodeFlags.Const),\n );\n\n annotatedSourceFile = factory.updateSourceFile(annotatedSourceFile, [\n variableDeclaration,\n ...annotatedSourceFile.statements,\n ]);\n }\n\n return annotatedSourceFile;\n };\n };\n }\n\n /** Used instead of direct access to the map to faciliate testing. */\n protected getClassFqn(clazz: ts.ClassDeclaration): string | undefined {\n return this.fqnsByClass.get(clazz);\n }\n\n /**\n * If the ClassDeclaration has an associated fully-qualified name registered,\n * will append a static property to the class with the fqn and version.\n */\n private addRuntimeInfoToClass(\n node: ts.ClassDeclaration,\n fqn: string,\n rttiSymbol: ts.Identifier,\n factory: ts.NodeFactory,\n ): ts.ClassDeclaration {\n const runtimeInfo = factory.createObjectLiteralExpression([\n factory.createPropertyAssignment(factory.createIdentifier('fqn'), factory.createStringLiteral(fqn)),\n factory.createPropertyAssignment(factory.createIdentifier('version'), factory.createStringLiteral(this.version)),\n ]);\n\n const runtimeProperty = factory.createPropertyDeclaration(\n [\n factory.createModifier(ts.SyntaxKind.PrivateKeyword),\n factory.createModifier(ts.SyntaxKind.StaticKeyword),\n factory.createModifier(ts.SyntaxKind.ReadonlyKeyword),\n ],\n factory.createComputedPropertyName(rttiSymbol),\n undefined,\n undefined,\n runtimeInfo,\n );\n\n return factory.updateClassDeclaration(\n node,\n node.modifiers,\n node.name,\n node.typeParameters,\n node.heritageClauses,\n factory.createNodeArray([runtimeProperty, ...node.members]),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"runtime-info.js","sourceRoot":"","sources":["../../src/transforms/runtime-info.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,MAAa,uBAAuB;IAGE;IAFnB,WAAW,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEtE,YAAoC,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAEvD;;;OAGG;IACI,gBAAgB,CAAC,KAA0B,EAAE,GAAW;QAC7D,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO;YACL,MAAM,EAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;SACxC,CAAC;IACJ,CAAC;IAEM,sBAAsB;QAC3B,OAAO,CAAC,OAAO,EAAE,EAAE;YACjB,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;YAE5B,OAAO,CAAC,UAAU,EAAiB,EAAE;gBACnC,MAAM,oBAAo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OAAO,CAAC,eAAe,CAAC,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAC5D,CAAC;IACJ,CAAC;CACF;AAlHD,0DAkHC","sourcesContent":["import * as ts from 'typescript';\n\n/**\n * Provides a TransformerFactory to annotate classes with runtime information\n * (e.g., fully-qualified name, version).\n *\n * It does this by first inserting this definition at the top of each source file:\n * ```\n * var JSII_RTTI_SYMBOL_1 = Symbol.for(\"jsii.rtti\");\n * ```\n *\n * Then, for each class that has registered runtime information during assembly,\n * insert a static member to the class with its fqn and version:\n * ```\n * private static readonly [JSII_RTTI_SYMBOL_1] = { fqn: \"ModuleName.ClassName\", version: \"1.2.3\" }\n * ```\n */\nexport class RuntimeTypeInfoInjector {\n private readonly fqnsByClass = new Map<ts.ClassDeclaration, string>();\n\n public constructor(private readonly version: string) {}\n\n /**\n * Register the fully-qualified name (fqn) of a class with its ClassDeclaration.\n * Only ClassDeclarations with registered fqns will be annotated.\n */\n public registerClassFqn(clazz: ts.ClassDeclaration, fqn: string) {\n this.fqnsByClass.set(clazz, fqn);\n }\n\n /**\n * Return the set of Transformers to be used in TSC's program.emit()\n */\n public makeTransformers(): ts.CustomTransformers {\n return {\n before: [this.runtimeTypeTransformer()],\n };\n }\n\n public runtimeTypeTransformer(): ts.TransformerFactory<ts.SourceFile> {\n return (context) => {\n const { factory } = context;\n\n return (sourceFile): ts.SourceFile => {\n const rttiSymbolIdentifier = factory.createUniqueName('JSII_RTTI_SYMBOL');\n\n let classesAnnotated = false;\n const visitor = (node: ts.Node): ts.Node => {\n if (ts.isClassDeclaration(node)) {\n const fqn = this.getClassFqn(node);\n if (fqn) {\n classesAnnotated = true;\n return this.addRuntimeInfoToClass(node, fqn, rttiSymbolIdentifier, factory);\n }\n }\n return ts.visitEachChild(node, visitor, context);\n };\n\n // Visit the source file, annotating the classes.\n let annotatedSourceFile = ts.visitNode(sourceFile, visitor) as ts.SourceFile;\n\n // Only add the symbol definition if it's actually used.\n if (classesAnnotated) {\n const rttiSymbol = factory.createCallExpression(\n factory.createPropertyAccessExpression(factory.createIdentifier('Symbol'), factory.createIdentifier('for')),\n undefined,\n [factory.createStringLiteral('jsii.rtti')],\n );\n const rttiSymbolDeclaration = factory.createVariableDeclaration(\n rttiSymbolIdentifier,\n undefined,\n undefined,\n rttiSymbol,\n );\n const variableDeclaration = factory.createVariableStatement(\n [],\n factory.createVariableDeclarationList([rttiSymbolDeclaration], ts.NodeFlags.Const),\n );\n\n annotatedSourceFile = factory.updateSourceFile(annotatedSourceFile, [\n variableDeclaration,\n ...annotatedSourceFile.statements,\n ]);\n }\n\n return annotatedSourceFile;\n };\n };\n }\n\n /** Used instead of direct access to the map to faciliate testing. */\n protected getClassFqn(clazz: ts.ClassDeclaration): string | undefined {\n return this.fqnsByClass.get(clazz);\n }\n\n /**\n * If the ClassDeclaration has an associated fully-qualified name registered,\n * will append a static property to the class with the fqn and version.\n */\n private addRuntimeInfoToClass(\n node: ts.ClassDeclaration,\n fqn: string,\n rttiSymbol: ts.Identifier,\n factory: ts.NodeFactory,\n ): ts.ClassDeclaration {\n const runtimeInfo = factory.createObjectLiteralExpression([\n factory.createPropertyAssignment(factory.createIdentifier('fqn'), factory.createStringLiteral(fqn)),\n factory.createPropertyAssignment(factory.createIdentifier('version'), factory.createStringLiteral(this.version)),\n ]);\n\n const runtimeProperty = factory.createPropertyDeclaration(\n [\n factory.createModifier(ts.SyntaxKind.PrivateKeyword),\n factory.createModifier(ts.SyntaxKind.StaticKeyword),\n factory.createModifier(ts.SyntaxKind.ReadonlyKeyword),\n ],\n factory.createComputedPropertyName(rttiSymbol),\n undefined,\n undefined,\n runtimeInfo,\n );\n\n return factory.updateClassDeclaration(\n node,\n node.modifiers,\n node.name,\n node.typeParameters,\n node.heritageClauses,\n factory.createNodeArray([runtimeProperty, ...node.members]),\n );\n }\n}\n"]}
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.BASE_COMPILER_OPTIONS = void 0;
4
37
  exports.enumAsCamel = enumAsCamel;
@@ -8,19 +41,21 @@ exports.convertForJson = convertForJson;
8
41
  exports.convertEnumToJson = convertEnumToJson;
9
42
  exports.convertLibForJson = convertLibForJson;
10
43
  exports.convertNewLineForJson = convertNewLineForJson;
11
- const ts = require("typescript");
12
- const Case = require("../case");
44
+ const ts = __importStar(require("typescript"));
45
+ const Case = __importStar(require("../case"));
13
46
  exports.BASE_COMPILER_OPTIONS = {
14
47
  alwaysStrict: true,
15
48
  declaration: true,
49
+ esModuleInterop: true,
16
50
  incremental: true,
17
- lib: ['lib.es2020.d.ts'],
18
- module: ts.ModuleKind.CommonJS,
51
+ lib: ['lib.es2023.d.ts'],
52
+ module: ts.ModuleKind.Node20,
19
53
  noEmitOnError: true,
20
54
  noFallthroughCasesInSwitch: true,
21
55
  noImplicitAny: true,
22
56
  noImplicitReturns: true,
23
57
  noImplicitThis: true,
58
+ noUncheckedSideEffectImports: true,
24
59
  noUnusedLocals: true,
25
60
  noUnusedParameters: true,
26
61
  resolveJsonModule: true,
@@ -29,7 +64,7 @@ exports.BASE_COMPILER_OPTIONS = {
29
64
  strictNullChecks: true,
30
65
  strictPropertyInitialization: true,
31
66
  stripInternal: false,
32
- target: ts.ScriptTarget.ES2020,
67
+ target: ts.ScriptTarget.ES2023,
33
68
  };
34
69
  /**
35
70
  * Helper function to convert a TS enum into a list of allowed values,
@@ -1 +1 @@
1
- {"version":3,"file":"compiler-options.js","sourceRoot":"","sources":["../../src/tsconfig/compiler-options.ts"],"names":[],"mappings":";;;AA8BA,kCAIC;AAOD,kCAIC;AAOD,kCAIC;AASD,wCAkBC;AAqCD,8CAMC;AAOD,8CAEC;AAWD,sDAOC;AAzJD,iCAAiC;AACjC,gCAAgC;AAEnB,QAAA,qBAAqB,GAAuB;IACvD,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,IAAI;IACjB,GAAG,EAAE,CAAC,iBAAiB,CAAC;IACxB,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ;IAC9B,aAAa,EAAE,IAAI;IACnB,0BAA0B,EAAE,IAAI;IAChC,aAAa,EAAE,IAAI;IACnB,iBAAiB,EAAE,IAAI;IACvB,cAAc,EAAE,IAAI;IACpB,cAAc,EAAE,IAAI;IACpB,kBAAkB,EAAE,IAAI;IACxB,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB,MAAM,EAAE,IAAI;IACZ,gBAAgB,EAAE,IAAI;IACtB,4BAA4B,EAAE,IAAI;IAClC,aAAa,EAAE,KAAK;IACpB,MAAM,EAAE,EA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AO,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,OAAuB;IAC3D,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,EAAE,CAAC,WAAW,CAAC,sBAAsB;YACxC,OAAO,MAAM,CAAC;QAChB,KAAK,EAAE,CAAC,WAAW,CAAC,QAAQ;YAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC","sourcesContent":["import * as ts from 'typescript';\nimport * as Case from '../case';\n\nexport const BASE_COMPILER_OPTIONS: ts.CompilerOptions = {\n alwaysStrict: true,\n declaration: true,\n incremental: true,\n lib: ['lib.es2020.d.ts'],\n module: ts.ModuleKind.CommonJS,\n noEmitOnError: true,\n noFallthroughCasesInSwitch: true,\n noImplicitAny: true,\n noImplicitReturns: true,\n noImplicitThis: true,\n noUnusedLocals: true,\n noUnusedParameters: true,\n resolveJsonModule: true,\n skipLibCheck: true,\n strict: true,\n strictNullChecks: true,\n strictPropertyInitialization: true,\n stripInternal: false,\n target: ts.ScriptTarget.ES2020,\n};\n\n/**\n * Helper function to convert a TS enum into a list of allowed values,\n * converting everything to camel case.\n * This is used for example for the watch options\n */\nexport function enumAsCamel(enumData: Record<string, string | number>): string[] {\n return Object.keys(enumData)\n .filter((v) => isNaN(Number(v)))\n .map(Case.camel);\n}\n\n/**\n * Helper function to convert a TS enum into a list of allowed values,\n * converting everything to lower case.\n * This is used for example for the \"target\" compiler option\n */\nexport function enumAsLower(enumData: Record<string, string | number>): string[] {\n return Object.keys(enumData)\n .filter((v) => isNaN(Number(v)) && v !== 'None')\n .map((v) => v.toLowerCase());\n}\n\n/**\n * Helper function to convert a TS enum into a list of allowed values,\n * converting everything to kebab case.\n * This is used for example for the \"jsx\" compiler option\n */\nexport function enumAsKebab(enumData: Record<string, string | number>): string[] {\n return Object.keys(enumData)\n .filter((v) => isNaN(Number(v)) && v !== 'None')\n .map(Case.kebab);\n}\n\n/**\n * The compilerOptions in the programmatic API are slightly differently than the format used in tsconfig.json\n * This helper performs the necessary conversion from the programmatic API format the one used in tsconfig.json\n *\n * @param opt compilerOptions in programmatic API format\n * @returns compilerOptions ready to be written on disk\n */\nexport function convertForJson(opt: ts.CompilerOptions): ts.CompilerOptions {\n return {\n ...opt,\n\n // Drop the \"lib.\" prefix and \".d.ts\" suffix before writing up the tsconfig.json file\n ...valueHelper('lib', opt.lib, convertLibForJson),\n\n // Re-write the module, targets & jsx to be the JSON format instead of Programmatic API\n ...enumHelper('importsNotUsedAsValues', opt.importsNotUsedAsValues, ts.ImportsNotUsedAsValues),\n ...enumHelper('jsx', opt.jsx, ts.JsxEmit, Case.kebab),\n ...enumHelper('module', opt.module, ts.ModuleKind),\n ...enumHelper('moduleResolution', opt.moduleResolution, ts.ModuleResolutionKind),\n ...enumHelper('moduleDetection', opt.moduleDetection, ts.ModuleDetectionKind),\n ...enumHelper('target', opt.target, ts.ScriptTarget),\n\n // rewrite newline to be the JSON format instead of Programmatic API\n ...valueHelper('newLine', opt.newLine, convertNewLineForJson),\n };\n}\n\nfunction valueHelper<T, U>(\n name: string,\n value: T | undefined,\n converter: (value: T) => U,\n): {\n [name: string]: U;\n} {\n if (!value) {\n return {};\n }\n return { [name]: converter(value) };\n}\n\nfunction enumHelper<T>(\n name: string,\n value: any,\n enumObj: T,\n converter?: (value: string) => string,\n): {\n [name: string]: string;\n} {\n if (!value) {\n return {};\n }\n return { [name]: convertEnumToJson(value, enumObj, converter) };\n}\n\n/**\n * Convert an internal enum value to what a user would write in tsconfig.json\n * Possibly using a converter function to adjust casing.\n * @param value The internal enum value\n * @param enumObj The enum object to convert from\n * @param converter The converter function, defaults to lowercase\n * @returns The humanized version of the enum value\n */\nexport function convertEnumToJson<T>(\n value: keyof T,\n enumObj: T,\n converter: (value: string) => string = (v) => v.toLowerCase(),\n): string {\n return converter(enumObj[value] as any);\n}\n\n/**\n * Convert the internal lib strings to what a user would write in tsconfig.json\n * @param input The input libs array\n * @returns The humanized version lib array\n */\nexport function convertLibForJson(input: string[]): string[] {\n return input.map((lib) => lib.slice(4, lib.length - 5));\n}\n\n/**\n * This is annoying - the values expected in the tsconfig.json file are not\n * the same as the enum constant names, or their values. So we need this\n * function to map the \"compiler API version\" to the \"tsconfig.json version\"\n *\n * @param newLine the compiler form of the new line configuration\n *\n * @return the equivalent value to put in tsconfig.json\n */\nexport function convertNewLineForJson(newLine: ts.NewLineKind): string {\n switch (newLine) {\n case ts.NewLineKind.CarriageReturnLineFeed:\n return 'crlf';\n case ts.NewLineKind.LineFeed:\n return 'lf';\n }\n}\n"]}
1
+ {"version":3,"file":"compiler-options.js","sourceRoot":"","sources":["../../src/tsconfig/compiler-options.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,kCAIC;AAOD,kCAIC;AAOD,kCAIC;AASD,wCAkBC;AAqCD,8CAMC;AAOD,8CAEC;AAWD,sDAOC;AA3JD,+CAAiC;AACjC,8CAAgC;AAEnB,QAAA,qBAAqB,GAAuB;IACvD,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,IAAI;IACrB,WAAW,EAAE,IAAI;IACjB,GAAG,EAAE,CAAC,iBAAiB,CAAC;IACxB,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM;IAC5B,aAAa,EAAE,IAAI;IACnB,0BAA0B,EAAE,IAAI;IAChC,aAAa,EAAE,IAAI;IACnB,iBAAiB,EAAE,IAAI;IACvB,cAAc,EAAE,IAAI;IACpB,4BAA4B,EAAE,IAAI;IAClC,cAAc,EAAE,IAAI;IACpB,kBAAkB,EAAE,IAAI;IACxB,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB,MAAM,EAAE,IAAI;IACZ,gBAAgB,E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CAAC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,KAAe;IAC/C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,OAAuB;IAC3D,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,EAAE,CAAC,WAAW,CAAC,sBAAsB;YACxC,OAAO,MAAM,CAAC;QAChB,KAAK,EAAE,CAAC,WAAW,CAAC,QAAQ;YAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC","sourcesContent":["import * as ts from 'typescript';\nimport * as Case from '../case';\n\nexport const BASE_COMPILER_OPTIONS: ts.CompilerOptions = {\n alwaysStrict: true,\n declaration: true,\n esModuleInterop: true,\n incremental: true,\n lib: ['lib.es2023.d.ts'],\n module: ts.ModuleKind.Node20,\n noEmitOnError: true,\n noFallthroughCasesInSwitch: true,\n noImplicitAny: true,\n noImplicitReturns: true,\n noImplicitThis: true,\n noUncheckedSideEffectImports: true,\n noUnusedLocals: true,\n noUnusedParameters: true,\n resolveJsonModule: true,\n skipLibCheck: true,\n strict: true,\n strictNullChecks: true,\n strictPropertyInitialization: true,\n stripInternal: false,\n target: ts.ScriptTarget.ES2023,\n};\n\n/**\n * Helper function to convert a TS enum into a list of allowed values,\n * converting everything to camel case.\n * This is used for example for the watch options\n */\nexport function enumAsCamel(enumData: Record<string, string | number>): string[] {\n return Object.keys(enumData)\n .filter((v) => isNaN(Number(v)))\n .map(Case.camel);\n}\n\n/**\n * Helper function to convert a TS enum into a list of allowed values,\n * converting everything to lower case.\n * This is used for example for the \"target\" compiler option\n */\nexport function enumAsLower(enumData: Record<string, string | number>): string[] {\n return Object.keys(enumData)\n .filter((v) => isNaN(Number(v)) && v !== 'None')\n .map((v) => v.toLowerCase());\n}\n\n/**\n * Helper function to convert a TS enum into a list of allowed values,\n * converting everything to kebab case.\n * This is used for example for the \"jsx\" compiler option\n */\nexport function enumAsKebab(enumData: Record<string, string | number>): string[] {\n return Object.keys(enumData)\n .filter((v) => isNaN(Number(v)) && v !== 'None')\n .map(Case.kebab);\n}\n\n/**\n * The compilerOptions in the programmatic API are slightly differently than the format used in tsconfig.json\n * This helper performs the necessary conversion from the programmatic API format the one used in tsconfig.json\n *\n * @param opt compilerOptions in programmatic API format\n * @returns compilerOptions ready to be written on disk\n */\nexport function convertForJson(opt: ts.CompilerOptions): ts.CompilerOptions {\n return {\n ...opt,\n\n // Drop the \"lib.\" prefix and \".d.ts\" suffix before writing up the tsconfig.json file\n ...valueHelper('lib', opt.lib, convertLibForJson),\n\n // Re-write the module, targets & jsx to be the JSON format instead of Programmatic API\n ...enumHelper('importsNotUsedAsValues', opt.importsNotUsedAsValues, ts.ImportsNotUsedAsValues),\n ...enumHelper('jsx', opt.jsx, ts.JsxEmit, Case.kebab),\n ...enumHelper('module', opt.module, ts.ModuleKind),\n ...enumHelper('moduleResolution', opt.moduleResolution, ts.ModuleResolutionKind),\n ...enumHelper('moduleDetection', opt.moduleDetection, ts.ModuleDetectionKind),\n ...enumHelper('target', opt.target, ts.ScriptTarget),\n\n // rewrite newline to be the JSON format instead of Programmatic API\n ...valueHelper('newLine', opt.newLine, convertNewLineForJson),\n };\n}\n\nfunction valueHelper<T, U>(\n name: string,\n value: T | undefined,\n converter: (value: T) => U,\n): {\n [name: string]: U;\n} {\n if (!value) {\n return {};\n }\n return { [name]: converter(value) };\n}\n\nfunction enumHelper<T>(\n name: string,\n value: any,\n enumObj: T,\n converter?: (value: string) => string,\n): {\n [name: string]: string;\n} {\n if (!value) {\n return {};\n }\n return { [name]: convertEnumToJson(value, enumObj, converter) };\n}\n\n/**\n * Convert an internal enum value to what a user would write in tsconfig.json\n * Possibly using a converter function to adjust casing.\n * @param value The internal enum value\n * @param enumObj The enum object to convert from\n * @param converter The converter function, defaults to lowercase\n * @returns The humanized version of the enum value\n */\nexport function convertEnumToJson<T>(\n value: keyof T,\n enumObj: T,\n converter: (value: string) => string = (v) => v.toLowerCase(),\n): string {\n return converter(enumObj[value] as any);\n}\n\n/**\n * Convert the internal lib strings to what a user would write in tsconfig.json\n * @param input The input libs array\n * @returns The humanized version lib array\n */\nexport function convertLibForJson(input: string[]): string[] {\n return input.map((lib) => lib.slice(4, lib.length - 5));\n}\n\n/**\n * This is annoying - the values expected in the tsconfig.json file are not\n * the same as the enum constant names, or their values. So we need this\n * function to map the \"compiler API version\" to the \"tsconfig.json version\"\n *\n * @param newLine the compiler form of the new line configuration\n *\n * @return the equivalent value to put in tsconfig.json\n */\nexport function convertNewLineForJson(newLine: ts.NewLineKind): string {\n switch (newLine) {\n case ts.NewLineKind.CarriageReturnLineFeed:\n return 'crlf';\n case ts.NewLineKind.LineFeed:\n return 'lf';\n }\n}\n"]}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsii_configured_options_1 = require("./jsii-configured-options");
6
+ const jsii_configured_options_1 = __importDefault(require("./jsii-configured-options"));
4
7
  const validator_1 = require("../validator");
5
8
  // A rule set defining all compilerOptions that can be configured by users with or without constraints.
6
9
  // These are options jsii doesn't have a particular opinion about
@@ -19,5 +22,11 @@ configurableOptions.shouldPass('noFallthroughCasesInSwitch', validator_1.Match.A
19
22
  configurableOptions.shouldPass('verbatimModuleSyntax', validator_1.Match.ANY);
20
23
  configurableOptions.shouldPass('isolatedModules', validator_1.Match.ANY);
21
24
  configurableOptions.shouldPass('isolatedDeclarations', validator_1.Match.ANY);
25
+ configurableOptions.shouldPass('useDefineForClassFields', validator_1.Match.ANY);
26
+ // Authoring options the user may opt into; some jsii language features won't be
27
+ // usable under them, but that is the user's choice (TS reports any violations).
28
+ configurableOptions.shouldPass('erasableSyntaxOnly', validator_1.Match.ANY);
29
+ configurableOptions.shouldPass('allowImportingTsExtensions', validator_1.Match.ANY);
30
+ configurableOptions.shouldPass('rewriteRelativeImportExtensions', validator_1.Match.ANY);
22
31
  exports.default = configurableOptions;
23
32
  //# 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;AACxE,mBAAmB,CAAC,UAAU,CAAC,sBAAsB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAClE,mBAAmB,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC7D,mBAAmB,CAAC,UAAU,CAAC,sBAAsB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAElE,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);\nconfigurableOptions.shouldPass('isolatedDeclarations', 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,wFAA8D;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;AAC7D,mBAAmB,CAAC,UAAU,CAAC,sBAAsB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAClE,mBAAmB,CAAC,UAAU,CAAC,yBAAyB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACrE,gFAAgF;AAChF,gFAAgF;AAChF,mBAAmB,CAAC,UAAU,CAAC,oBAAoB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAChE,mBAAmB,CAAC,UAAU,CAAC,4BAA4B,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACxE,mBAAmB,CAAC,UAAU,CAAC,iCAAiC,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAE7E,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);\nconfigurableOptions.shouldPass('isolatedDeclarations', Match.ANY);\nconfigurableOptions.shouldPass('useDefineForClassFields', Match.ANY);\n// Authoring options the user may opt into; some jsii language features won't be\n// usable under them, but that is the user's choice (TS reports any violations).\nconfigurableOptions.shouldPass('erasableSyntaxOnly', Match.ANY);\nconfigurableOptions.shouldPass('allowImportingTsExtensions', Match.ANY);\nconfigurableOptions.shouldPass('rewriteRelativeImportExtensions', Match.ANY);\n\nexport default configurableOptions;\n"]}
@@ -1,9 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const validator_1 = require("../validator");
4
- // A rule set for deprecated compilerOptions that should not be used with jsii
4
+ // A rule set for deprecated compilerOptions that should not be used with jsii.
5
+ // These options are deprecated in TypeScript 6.0 and will be removed in TypeScript 7.0.
5
6
  // This is an internal rule set, that may be used by other rule sets.
6
7
  const deprecatedOptions = new validator_1.RuleSet();
7
8
  deprecatedOptions.shouldPass('prepend', validator_1.Match.MISSING);
9
+ deprecatedOptions.shouldPass('downlevelIteration', validator_1.Match.MISSING);
10
+ deprecatedOptions.shouldPass('outFile', validator_1.Match.MISSING);
11
+ deprecatedOptions.shouldPass('baseUrl', validator_1.Match.MISSING);
12
+ // esModuleInterop: false and allowSyntheticDefaultImports: false are deprecated
13
+ deprecatedOptions.shouldPass('esModuleInterop', validator_1.Match.optional(validator_1.Match.TRUE));
14
+ deprecatedOptions.shouldPass('allowSyntheticDefaultImports', validator_1.Match.optional(validator_1.Match.TRUE));
15
+ // alwaysStrict: false is deprecated
16
+ deprecatedOptions.shouldPass('alwaysStrict', validator_1.Match.optional(validator_1.Match.TRUE));
17
+ // target: es5 is deprecated
18
+ deprecatedOptions.shouldFail('target', validator_1.Match.eq('es5'));
19
+ // Deprecated module values: amd, umd, systemjs, none
20
+ deprecatedOptions.shouldFail('module', validator_1.Match.oneOf('amd', 'umd', 'systemjs', 'none'));
21
+ // Deprecated moduleResolution values: node (node10), classic
22
+ deprecatedOptions.shouldFail('moduleResolution', validator_1.Match.oneOf('node', 'node10', 'classic'));
8
23
  exports.default = deprecatedOptions;
9
24
  //# sourceMappingURL=deprecated-options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/deprecated-options.ts"],"names":[],"mappings":";;AAAA,4CAA8C;AAE9C,8EAA8E;AAC9E,qEAAqE;AACrE,MAAM,iBAAiB,GAAG,IAAI,mBAAO,EAAE,CAAC;AACxC,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AAEvD,kBAAe,iBAAiB,CAAC","sourcesContent":["import { Match, RuleSet } from '../validator';\n\n// A rule set for deprecated compilerOptions that should not be used with jsii\n// This is an internal rule set, that may be used by other rule sets.\nconst deprecatedOptions = new RuleSet();\ndeprecatedOptions.shouldPass('prepend', Match.MISSING);\n\nexport default deprecatedOptions;\n"]}
1
+ {"version":3,"file":"deprecated-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/deprecated-options.ts"],"names":[],"mappings":";;AAAA,4CAA8C;AAE9C,+EAA+E;AAC/E,wFAAwF;AACxF,qEAAqE;AACrE,MAAM,iBAAiB,GAAG,IAAI,mBAAO,EAAE,CAAC;AACxC,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AACvD,iBAAiB,CAAC,UAAU,CAAC,oBAAoB,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AAClE,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AACvD,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AAEvD,gFAAgF;AAChF,iBAAiB,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5E,iBAAiB,CAAC,UAAU,CAAC,8BAA8B,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAEzF,oCAAoC;AACpC,iBAAiB,CAAC,UAAU,CAAC,cAAc,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAEzE,4BAA4B;AAC5B,iBAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAExD,qDAAqD;AACrD,iBAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEtF,6DAA6D;AAC7D,iBAAiB,CAAC,UAAU,CAAC,kBAAkB,EAAE,iBAAK,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAE3F,kBAAe,iBAAiB,CAAC","sourcesContent":["import { Match, RuleSet } from '../validator';\n\n// A rule set for deprecated compilerOptions that should not be used with jsii.\n// These options are deprecated in TypeScript 6.0 and will be removed in TypeScript 7.0.\n// This is an internal rule set, that may be used by other rule sets.\nconst deprecatedOptions = new RuleSet();\ndeprecatedOptions.shouldPass('prepend', Match.MISSING);\ndeprecatedOptions.shouldPass('downlevelIteration', Match.MISSING);\ndeprecatedOptions.shouldPass('outFile', Match.MISSING);\ndeprecatedOptions.shouldPass('baseUrl', Match.MISSING);\n\n// esModuleInterop: false and allowSyntheticDefaultImports: false are deprecated\ndeprecatedOptions.shouldPass('esModuleInterop', Match.optional(Match.TRUE));\ndeprecatedOptions.shouldPass('allowSyntheticDefaultImports', Match.optional(Match.TRUE));\n\n// alwaysStrict: false is deprecated\ndeprecatedOptions.shouldPass('alwaysStrict', Match.optional(Match.TRUE));\n\n// target: es5 is deprecated\ndeprecatedOptions.shouldFail('target', Match.eq('es5'));\n\n// Deprecated module values: amd, umd, systemjs, none\ndeprecatedOptions.shouldFail('module', Match.oneOf('amd', 'umd', 'systemjs', 'none'));\n\n// Deprecated moduleResolution values: node (node10), classic\ndeprecatedOptions.shouldFail('moduleResolution', Match.oneOf('node', 'node10', 'classic'));\n\nexport default deprecatedOptions;\n"]}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsii_configured_options_1 = require("./jsii-configured-options");
6
+ const jsii_configured_options_1 = __importDefault(require("./jsii-configured-options"));
4
7
  const compiler_options_1 = require("../compiler-options");
5
8
  const validator_1 = require("../validator");
6
9
  // The public rule set used for the "generated" tsconfig validation setting.\
@@ -12,7 +15,9 @@ const generated = new validator_1.RuleSet({
12
15
  });
13
16
  // import all options that are configurable via jsii settings
14
17
  generated.import(jsii_configured_options_1.default);
15
- // ... and all generated options
18
+ // ... and all generated options. Deprecated options need no explicit handling here: this is a
19
+ // closed whitelist, so any deprecated option is either pinned to its generated value below or
20
+ // rejected as an unexpected field.
16
21
  for (const [field, value] of Object.entries((0, compiler_options_1.convertForJson)(compiler_options_1.BASE_COMPILER_OPTIONS))) {
17
22
  if (typeof value === 'string') {
18
23
  generated.shouldPass(field, validator_1.Match.strEq(value, true));
@@ -1 +1 @@
1
- {"version":3,"file":"generated.public.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/generated.public.ts"],"names":[],"mappings":";;AAAA,uEAA8D;AAC9D,0DAA4E;AAC5E,4CAAwD;AAExD,6EAA6E;AAC7E,+GAA+G;AAC/G,qFAAqF;AACrF,iGAAiG;AACjG,MAAM,SAAS,GAAG,IAAI,mBAAO,CAAC;IAC5B,gBAAgB,EAAE,oBAAQ,CAAC,IAAI;CAChC,CAAC,CAAC;AAEH,6DAA6D;AAC7D,SAAS,CAAC,MAAM,CAAC,iCAAqB,CAAC,CAAC;AAExC,gCAAgC;AAChC,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAA,iCAAc,EAAC,wCAAqB,CAAC,CAAC,EAAE,CAAC;IACnF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QACtD,SAAS;IACX,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,SAAS;IACX,CAAC;IAED,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,kBAAe,SAAS,CAAC","sourcesContent":["import jsiiConfiguredOptions from './jsii-configured-options';\nimport { BASE_COMPILER_OPTIONS, convertForJson } from '../compiler-options';\nimport { Match, RuleSet, RuleType } from '../validator';\n\n// The public rule set used for the \"generated\" tsconfig validation setting.\\\n// The goal of this rule set is to ensure a tsconfig is compatible to the one jsii would generate for the user.\n// It is explicitly enforcing option values that are used for the generated tsconfig,\n// as well as options that can be configured via jsii settings. All other options are disallowed.\nconst generated = new RuleSet({\n unexpectedFields: RuleType.FAIL,\n});\n\n// import all options that are configurable via jsii settings\ngenerated.import(jsiiConfiguredOptions);\n\n// ... and all generated options\nfor (const [field, value] of Object.entries(convertForJson(BASE_COMPILER_OPTIONS))) {\n if (typeof value === 'string') {\n generated.shouldPass(field, Match.strEq(value, true));\n continue;\n }\n\n if (Array.isArray(value)) {\n generated.shouldPass(field, Match.arrEq(value));\n continue;\n }\n\n generated.shouldPass(field, Match.eq(value));\n}\n\nexport default generated;\n"]}
1
+ {"version":3,"file":"generated.public.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/generated.public.ts"],"names":[],"mappings":";;;;;AAAA,wFAA8D;AAC9D,0DAA4E;AAC5E,4CAAwD;AAExD,6EAA6E;AAC7E,+GAA+G;AAC/G,qFAAqF;AACrF,iGAAiG;AACjG,MAAM,SAAS,GAAG,IAAI,mBAAO,CAAC;IAC5B,gBAAgB,EAAE,oBAAQ,CAAC,IAAI;CAChC,CAAC,CAAC;AAEH,6DAA6D;AAC7D,SAAS,CAAC,MAAM,CAAC,iCAAqB,CAAC,CAAC;AAExC,8FAA8F;AAC9F,8FAA8F;AAC9F,mCAAmC;AACnC,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAA,iCAAc,EAAC,wCAAqB,CAAC,CAAC,EAAE,CAAC;IACnF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QACtD,SAAS;IACX,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,SAAS;IACX,CAAC;IAED,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,kBAAe,SAAS,CAAC","sourcesContent":["import jsiiConfiguredOptions from './jsii-configured-options';\nimport { BASE_COMPILER_OPTIONS, convertForJson } from '../compiler-options';\nimport { Match, RuleSet, RuleType } from '../validator';\n\n// The public rule set used for the \"generated\" tsconfig validation setting.\\\n// The goal of this rule set is to ensure a tsconfig is compatible to the one jsii would generate for the user.\n// It is explicitly enforcing option values that are used for the generated tsconfig,\n// as well as options that can be configured via jsii settings. All other options are disallowed.\nconst generated = new RuleSet({\n unexpectedFields: RuleType.FAIL,\n});\n\n// import all options that are configurable via jsii settings\ngenerated.import(jsiiConfiguredOptions);\n\n// ... and all generated options. Deprecated options need no explicit handling here: this is a\n// closed whitelist, so any deprecated option is either pinned to its generated value below or\n// rejected as an unexpected field.\nfor (const [field, value] of Object.entries(convertForJson(BASE_COMPILER_OPTIONS))) {\n if (typeof value === 'string') {\n generated.shouldPass(field, Match.strEq(value, true));\n continue;\n }\n\n if (Array.isArray(value)) {\n generated.shouldPass(field, Match.arrEq(value));\n continue;\n }\n\n generated.shouldPass(field, Match.eq(value));\n}\n\nexport default generated;\n"]}