jsii 5.2.45-dev.0 → 5.3.1-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.
@@ -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;AAG1C,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,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AAClD,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAC7C,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AAExD,MAAa,2BAA2B;IAKtC,YAAoC,WAA2B;QAA3B,gBAAW,GAAX,WAAW,CAAgB;QAJvD,iBAAY,GAA0B;YAC5C,MAAM,EAAE,EAAE;SACX,CAAC;IAEgE,CAAC;IAE5D,OAAO,CAAC,QAAkB,EAAE,WAAwB;QACzD,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;QAC5C,MAAM,oBAAoB,GAA6B,EAAE,CAAC;QAE1D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;QACnC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YACvC,MAAM,UAAU,GAAmB,EAAE,CAAC;YACtC,IAAI,OAAO,GAAG,IAAI,CAAC;YAEnB,2FAA2F;YAC3F,UAAU,CAAC,IAAI,CACb,EAAE,CAAC,OAAO,CAAC,yBAAyB,CAClC,EAAE,CAAC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J,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,QAAQ,CAAC,QAAgB;IAChC,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE;QACrB,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;KACrC;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';\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 LOCAL_ENUM_NAMESPACE = 'ns';\nconst VISITED_OBJECTS_SET_NAME = 'visitedObjects';\nconst DEPRECATION_ERROR = 'DeprecationError';\nconst GET_PROPERTY_DESCRIPTOR = 'getPropertyDescriptor';\n\nexport class DeprecationWarningsInjector {\n private transformers: ts.CustomTransformers = {\n before: [],\n };\n\n public constructor(private readonly typeChecker: ts.TypeChecker) {}\n\n public process(assembly: Assembly, projectInfo: ProjectInfo) {\n const projectRoot = projectInfo.projectRoot;\n const functionDeclarations: ts.FunctionDeclaration[] = [];\n\n const types = assembly.types ?? {};\n for (const type of Object.values(types)) {\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 tryStatements.push(createEnumRequireStatement(type.locationInModule?.filename));\n tryStatements.push(createDuplicateEnumValuesCheck(type));\n\n for (const member of Object.values(type.members ?? [])) {\n if (spec.isDeprecated(member)) {\n // The enum member is deprecated\n const condition = ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(PARAMETER_NAME),\n ts.SyntaxKind.EqualsEqualsEqualsToken,\n ts.factory.createPropertyAccessExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(LOCAL_ENUM_NAMESPACE), type.name),\n member.name,\n ),\n );\n tryStatements.push(\n createWarningFunctionCall(`${type.fqn}#${member.name}`, member.docs?.deprecated, condition),\n );\n isEmpty = false;\n }\n }\n } else if (spec.isInterfaceType(type) && type.datatype) {\n const { statementsByProp, excludedProps } = 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 const paramValue = ts.factory.createParameterDeclaration(undefined, undefined, PARAMETER_NAME);\n const functionName = fnName(type.fqn);\n const functionDeclaration = ts.factory.createFunctionDeclaration(\n undefined,\n undefined,\n ts.factory.createIdentifier(functionName),\n [],\n [paramValue],\n undefined,\n createFunctionBlock(isEmpty ? [] : statements),\n );\n functionDeclarations.push(functionDeclaration);\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 generateWarningsFile(projectRoot, functionDeclarations);\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\nfunction 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 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 } 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 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\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, functionDeclarations: ts.FunctionDeclaration[]) {\n const names = [...functionDeclarations].map((d) => d.name?.text).filter(Boolean);\n const exportedSymbols = [WARNING_FUNCTION_NAME, GET_PROPERTY_DESCRIPTOR, DEPRECATION_ERROR, ...names].join(',');\n\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\nmodule.exports = {${exportedSymbols}}\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 = functionDeclarations.map((declaration) =>\n printer.printNode(ts.EmitHint.Unspecified, declaration, resultFile),\n );\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 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 createEnumRequireStatement(typeLocation: string): ts.Statement {\n const { ext } = path.parse(typeLocation);\n const jsFileName = typeLocation.replace(ext, '.js');\n\n return createRequireStatement(LOCAL_ENUM_NAMESPACE, `./${jsFileName}`);\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 : 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/**\n * There is a chance an enum contains duplicates values with distinct keys,\n * with one of those keys being deprecated. This is a potential pattern to \"rename\" an enum.\n * In this case, we can't concretely determine if the deprecated member was used or not,\n * so in those cases we skip the warnings altogether, rather than erroneously warning for valid usage.\n * This create a statement to check if the enum value is a duplicate:\n *\n * if (Object.values(Foo).filter(x => x === p).length > 1) { return; }\n *\n * Note that we can't just check the assembly for these duplicates, due to:\n * https://github.com/aws/jsii/issues/2782\n */\nfunction createDuplicateEnumValuesCheck(type: spec.TypeBase & spec.EnumType): ts.Statement {\n return ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Object'), 'values'),\n undefined,\n [ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(LOCAL_ENUM_NAMESPACE), type.name)],\n ),\n ts.factory.createIdentifier('filter'),\n ),\n undefined,\n [\n ts.factory.createArrowFunction(\n undefined,\n undefined,\n [ts.factory.createParameterDeclaration(undefined, undefined, 'x')],\n undefined,\n ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier('x'),\n ts.factory.createToken(ts.SyntaxKind.EqualsEqualsEqualsToken),\n ts.factory.createIdentifier(PARAMETER_NAME),\n ),\n ),\n ],\n ),\n ts.factory.createIdentifier('length'),\n ),\n ts.factory.createToken(ts.SyntaxKind.GreaterThanToken),\n ts.factory.createNumericLiteral('1'),\n ),\n ts.factory.createReturnStatement(),\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,8BAA8B;AAC9B,kCAAkC;AAClC,mCAAmC;AAEnC,iCAAiC;AAEjC,mDAAuD;AAG1C,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,M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,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';\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 LOCAL_ENUM_NAMESPACE = 'ns';\nconst VISITED_OBJECTS_SET_NAME = 'visitedObjects';\nconst DEPRECATION_ERROR = 'DeprecationError';\nconst GET_PROPERTY_DESCRIPTOR = 'getPropertyDescriptor';\n\nexport class DeprecationWarningsInjector {\n private transformers: ts.CustomTransformers = {\n before: [],\n };\n\n public constructor(private readonly typeChecker: ts.TypeChecker) {}\n\n public process(assembly: Assembly, projectInfo: ProjectInfo) {\n const projectRoot = projectInfo.projectRoot;\n const functionDeclarations: ts.FunctionDeclaration[] = [];\n\n const types = assembly.types ?? {};\n for (const type of Object.values(types)) {\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 tryStatements.push(createEnumRequireStatement(type.locationInModule?.filename));\n tryStatements.push(createDuplicateEnumValuesCheck(type));\n\n for (const member of Object.values(type.members ?? [])) {\n if (spec.isDeprecated(member)) {\n // The enum member is deprecated\n const condition = ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(PARAMETER_NAME),\n ts.SyntaxKind.EqualsEqualsEqualsToken,\n ts.factory.createPropertyAccessExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(LOCAL_ENUM_NAMESPACE), type.name),\n member.name,\n ),\n );\n tryStatements.push(\n createWarningFunctionCall(`${type.fqn}#${member.name}`, member.docs?.deprecated, condition),\n );\n isEmpty = false;\n }\n }\n } else if (spec.isInterfaceType(type) && type.datatype) {\n const { statementsByProp, excludedProps } = 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 const paramValue = ts.factory.createParameterDeclaration(undefined, undefined, PARAMETER_NAME);\n const functionName = fnName(type.fqn);\n const functionDeclaration = ts.factory.createFunctionDeclaration(\n undefined,\n undefined,\n ts.factory.createIdentifier(functionName),\n [],\n [paramValue],\n undefined,\n createFunctionBlock(isEmpty ? [] : statements),\n );\n functionDeclarations.push(functionDeclaration);\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 generateWarningsFile(projectRoot, functionDeclarations);\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\nfunction 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 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 } 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 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\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, functionDeclarations: ts.FunctionDeclaration[]) {\n const names = [...functionDeclarations].map((d) => d.name?.text).filter(Boolean);\n const exportedSymbols = [WARNING_FUNCTION_NAME, GET_PROPERTY_DESCRIPTOR, DEPRECATION_ERROR, ...names].join(',');\n\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\nmodule.exports = {${exportedSymbols}}\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 = functionDeclarations.map((declaration) =>\n printer.printNode(ts.EmitHint.Unspecified, declaration, resultFile),\n );\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 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 createEnumRequireStatement(typeLocation: string): ts.Statement {\n const { ext } = path.parse(typeLocation);\n const jsFileName = typeLocation.replace(ext, '.js');\n\n return createRequireStatement(LOCAL_ENUM_NAMESPACE, `./${jsFileName}`);\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 : 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/**\n * There is a chance an enum contains duplicates values with distinct keys,\n * with one of those keys being deprecated. This is a potential pattern to \"rename\" an enum.\n * In this case, we can't concretely determine if the deprecated member was used or not,\n * so in those cases we skip the warnings altogether, rather than erroneously warning for valid usage.\n * This create a statement to check if the enum value is a duplicate:\n *\n * if (Object.values(Foo).filter(x => x === p).length > 1) { return; }\n *\n * Note that we can't just check the assembly for these duplicates, due to:\n * https://github.com/aws/jsii/issues/2782\n */\nfunction createDuplicateEnumValuesCheck(type: spec.TypeBase & spec.EnumType): ts.Statement {\n return ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Object'), 'values'),\n undefined,\n [ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(LOCAL_ENUM_NAMESPACE), type.name)],\n ),\n ts.factory.createIdentifier('filter'),\n ),\n undefined,\n [\n ts.factory.createArrowFunction(\n undefined,\n undefined,\n [ts.factory.createParameterDeclaration(undefined, undefined, 'x')],\n undefined,\n ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier('x'),\n ts.factory.createToken(ts.SyntaxKind.EqualsEqualsEqualsToken),\n ts.factory.createIdentifier(PARAMETER_NAME),\n ),\n ),\n ],\n ),\n ts.factory.createIdentifier('length'),\n ),\n ts.factory.createToken(ts.SyntaxKind.GreaterThanToken),\n ts.factory.createNumericLiteral('1'),\n ),\n ts.factory.createReturnStatement(),\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 +1 @@
1
- {"version":3,"file":"runtime-info.js","sourceRoot":"","sources":["../../src/transforms/runtime-info.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,MAAa,uBAAuB;IAGlC,YAAoC,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAFlC,gBAAW,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEhB,CAAC;IAEvD;;;OAGG;IACI,gBAAgB,CAAC,KAA0B,EAAE,GAAW;Q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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,iCAAiC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,MAAa,uBAAuB;IAGlC,YAAoC,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAFlC,gBAAW,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEhB,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,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;gBAE1E,IAAI,gBAAgB,GAAG,KAAK,CAAC;gBAC7B,MAAM,OAAO,GAAG,CAAC,IAAa,EAAW,EAAE;oBACzC,IAAI,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;wBAChC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;wBACnC,IAAI,GAAG,EAAE,CAAC;4BACR,gBAA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C,CAAC;IACrC,CAAC;IAED;;;OAGG;IACK,qBAAqB,CAC3B,IAAyB,EACzB,GAAW,EACX,UAAyB,EACzB,OAAuB;QAEvB,MAAM,WAAW,GAAG,OAAO,CAAC,6BAA6B,CAAC;YACxD,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;YACnG,OAAO,CAAC,wBAAwB,CAAC,OAAO,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"]}
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,iCAAiC;AAEjC,uDAAmD;AAEnD;;GAEG;AACU,QAAA,WAAW,GAAG,aAAa,CAAC;AACzC;;GAEG;AACU,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAE1C;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,MAAqB,EACrB,UAAyB;IAEzB,QAAQ,UAAU,CAAC,QAAQ,EAAE;QAC3B,KAAK,EAAE,CAAC,kBAAkB,CAAC,KAAK;Y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iiDiagnostic } from './jsii-diagnostic';\n\n/**\n * Name of the logger for diagnostics information\n */\nexport const DIAGNOSTICS = 'diagnostics';\n/**\n * Diagnostic code for JSII-generated messages.\n */\nexport const JSII_DIAGNOSTICS_CODE = 9999;\n\n/**\n * Obtains the relevant logger to be used for a given diagnostic message.\n *\n * @param logger the ``log4js.Logger`` to use for emitting the message.\n * @param diagnostic the message for which a logger is requested.\n *\n * @returns a logger method of the ``logger`` for the appropriate level.\n */\nexport function diagnosticsLogger(\n logger: log4js.Logger,\n diagnostic: ts.Diagnostic,\n): ((message: any, ...args: any[]) => void) | undefined {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Error:\n if (!logger.isErrorEnabled()) {\n return undefined;\n }\n return logger.error.bind(logger);\n case ts.DiagnosticCategory.Warning:\n if (!logger.isWarnEnabled()) {\n return undefined;\n }\n return logger.warn.bind(logger);\n case ts.DiagnosticCategory.Message:\n if (!logger.isDebugEnabled()) {\n return undefined;\n }\n return logger.debug.bind(logger);\n case ts.DiagnosticCategory.Suggestion:\n default:\n if (!logger.isTraceEnabled()) {\n return undefined;\n }\n return logger.trace.bind(logger);\n }\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n if (JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n // Ensure we leverage pre-rendered diagnostics where available.\n return diagnostic.format(projectRoot);\n }\n return _formatDiagnostic(diagnostic, projectRoot);\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible. Users\n * should use `formatDiagnostic` instead, as this implementation is intended for\n * internal usafe only.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function _formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const formatDiagnosticsHost: ts.FormatDiagnosticsHost = {\n getCurrentDirectory: () => projectRoot,\n getCanonicalFileName: (fileName) => fileName,\n getNewLine: () => ts.sys.newLine,\n };\n\n const message =\n diagnostic.file != null\n ? ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost)\n : ts.formatDiagnostic(diagnostic, formatDiagnosticsHost);\n\n if (!JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n return message;\n }\n\n // This is our own diagnostics, so we'll format appropriately (replacing TS#### with JSII####).\n return message.replace(` TS${JSII_DIAGNOSTICS_CODE}: `, ` JSII${diagnostic.jsiiCode}: `);\n}\n\nexport function logDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const logFunc = diagnosticsLogger(log4js.getLogger(DIAGNOSTICS), diagnostic);\n if (!logFunc) {\n return;\n }\n logFunc(formatDiagnostic(diagnostic, projectRoot).trim());\n}\n\nconst PERSON_REGEX = /^\\s*(.+?)(?:\\s*<([^>]+)>)?(?:\\s*\\(([^)]+)\\))?\\s*$/;\n/**\n * Parses a string-formatted person entry from `package.json`.\n * @param value the string-formatted person entry.\n *\n * @example\n * parsePerson(\"Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)\");\n * // => { name: \"Barney Rubble\", email: \"b@rubble.com\", url: \"http://barnyrubble.tumblr.com/\" }\n */\nexport function parsePerson(value: string) {\n const match = PERSON_REGEX.exec(value);\n if (!match) {\n throw new Error(`Invalid stringified \"person\" value: ${value}`);\n }\n const [, name, email, url] = match;\n const result: { name: string; email?: string; url?: string } = {\n name: name.trim(),\n };\n if (email) {\n result.email = email.trim();\n }\n if (url) {\n result.url = url.trim();\n }\n return result;\n}\n\nconst REPOSITORY_REGEX = /^(?:(github|gist|bitbucket|gitlab):)?([A-Za-z\\d_-]+\\/[A-Za-z\\d_-]+)$/;\nexport function parseRepository(value: string): { url: string } {\n const match = REPOSITORY_REGEX.exec(value);\n if (!match) {\n return { url: value };\n }\n const [, host, slug] = match;\n switch (host ?? 'github') {\n case 'github':\n return { url: `https://github.com/${slug}.git` };\n case 'gist':\n return { url: `https://gist.github.com/${slug}.git` };\n case 'bitbucket':\n return { url: `https://bitbucket.org/${slug}.git` };\n case 'gitlab':\n return { url: `https://gitlab.com/${slug}.git` };\n default:\n throw new Error(`Unknown host service: ${host}`);\n }\n}\n\nconst ANSI_REGEX =\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;\n\nexport function stripAnsi(x: string): string {\n return x.replace(ANSI_REGEX, '');\n}\n\n/**\n * Maps the provided type to stip all `readonly` modifiers from its properties.\n */\nexport type Mutable<T> = { -readonly [K in keyof T]: Mutable<T[K]> };\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,iCAAiC;AAEjC,uDAAmD;AAEnD;;GAEG;AACU,QAAA,WAAW,GAAG,aAAa,CAAC;AACzC;;GAEG;AACU,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAE1C;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,MAAqB,EACrB,UAAyB;IAEzB,QAAQ,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC5B,KAAK,EAAE,CAAC,kBAAkB,CAAC,KAAK;YAC9B,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC7B,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,KAAK,EAAE,CAAC,kBAAkB,CAAC,OAAO;YAChC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC;gBAC5B,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,KAAK,EAAE,CAAC,kBAAkB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AAgB,GAAG,sEAAsE,CAAC;AAChG,SAAgB,eAAe,CAAC,KAAa;IAC3C,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACxB,CAAC;IACD,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC;IAC7B,QAAQ,IAAI,IAAI,QAAQ,EAAE,CAAC;QACzB,KAAK,QAAQ;YACX,OAAO,EAAE,GAAG,EAAE,sBAAsB,IAAI,MAAM,EAAE,CAAC;QACnD,KAAK,MAAM;YACT,OAAO,EAAE,GAAG,EAAE,2BAA2B,IAAI,MAAM,EAAE,CAAC;QACxD,KAAK,WAAW;YACd,OAAO,EAAE,GAAG,EAAE,yBAAyB,IAAI,MAAM,EAAE,CAAC;QACtD,KAAK,QAAQ;YACX,OAAO,EAAE,GAAG,EAAE,sBAAsB,IAAI,MAAM,EAAE,CAAC;QACnD;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC;AAlBD,0CAkBC;AAED,MAAM,UAAU;AACd,4CAA4C;AAC5C,6EAA6E,CAAC;AAEhF,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAFD,8BAEC","sourcesContent":["import * as log4js from 'log4js';\nimport * as ts from 'typescript';\n\nimport { JsiiDiagnostic } from './jsii-diagnostic';\n\n/**\n * Name of the logger for diagnostics information\n */\nexport const DIAGNOSTICS = 'diagnostics';\n/**\n * Diagnostic code for JSII-generated messages.\n */\nexport const JSII_DIAGNOSTICS_CODE = 9999;\n\n/**\n * Obtains the relevant logger to be used for a given diagnostic message.\n *\n * @param logger the ``log4js.Logger`` to use for emitting the message.\n * @param diagnostic the message for which a logger is requested.\n *\n * @returns a logger method of the ``logger`` for the appropriate level.\n */\nexport function diagnosticsLogger(\n logger: log4js.Logger,\n diagnostic: ts.Diagnostic,\n): ((message: any, ...args: any[]) => void) | undefined {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Error:\n if (!logger.isErrorEnabled()) {\n return undefined;\n }\n return logger.error.bind(logger);\n case ts.DiagnosticCategory.Warning:\n if (!logger.isWarnEnabled()) {\n return undefined;\n }\n return logger.warn.bind(logger);\n case ts.DiagnosticCategory.Message:\n if (!logger.isDebugEnabled()) {\n return undefined;\n }\n return logger.debug.bind(logger);\n case ts.DiagnosticCategory.Suggestion:\n default:\n if (!logger.isTraceEnabled()) {\n return undefined;\n }\n return logger.trace.bind(logger);\n }\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n if (JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n // Ensure we leverage pre-rendered diagnostics where available.\n return diagnostic.format(projectRoot);\n }\n return _formatDiagnostic(diagnostic, projectRoot);\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible. Users\n * should use `formatDiagnostic` instead, as this implementation is intended for\n * internal usafe only.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function _formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const formatDiagnosticsHost: ts.FormatDiagnosticsHost = {\n getCurrentDirectory: () => projectRoot,\n getCanonicalFileName: (fileName) => fileName,\n getNewLine: () => ts.sys.newLine,\n };\n\n const message =\n diagnostic.file != null\n ? ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost)\n : ts.formatDiagnostic(diagnostic, formatDiagnosticsHost);\n\n if (!JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n return message;\n }\n\n // This is our own diagnostics, so we'll format appropriately (replacing TS#### with JSII####).\n return message.replace(` TS${JSII_DIAGNOSTICS_CODE}: `, ` JSII${diagnostic.jsiiCode}: `);\n}\n\nexport function logDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const logFunc = diagnosticsLogger(log4js.getLogger(DIAGNOSTICS), diagnostic);\n if (!logFunc) {\n return;\n }\n logFunc(formatDiagnostic(diagnostic, projectRoot).trim());\n}\n\nconst PERSON_REGEX = /^\\s*(.+?)(?:\\s*<([^>]+)>)?(?:\\s*\\(([^)]+)\\))?\\s*$/;\n/**\n * Parses a string-formatted person entry from `package.json`.\n * @param value the string-formatted person entry.\n *\n * @example\n * parsePerson(\"Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)\");\n * // => { name: \"Barney Rubble\", email: \"b@rubble.com\", url: \"http://barnyrubble.tumblr.com/\" }\n */\nexport function parsePerson(value: string) {\n const match = PERSON_REGEX.exec(value);\n if (!match) {\n throw new Error(`Invalid stringified \"person\" value: ${value}`);\n }\n const [, name, email, url] = match;\n const result: { name: string; email?: string; url?: string } = {\n name: name.trim(),\n };\n if (email) {\n result.email = email.trim();\n }\n if (url) {\n result.url = url.trim();\n }\n return result;\n}\n\nconst REPOSITORY_REGEX = /^(?:(github|gist|bitbucket|gitlab):)?([A-Za-z\\d_-]+\\/[A-Za-z\\d_-]+)$/;\nexport function parseRepository(value: string): { url: string } {\n const match = REPOSITORY_REGEX.exec(value);\n if (!match) {\n return { url: value };\n }\n const [, host, slug] = match;\n switch (host ?? 'github') {\n case 'github':\n return { url: `https://github.com/${slug}.git` };\n case 'gist':\n return { url: `https://gist.github.com/${slug}.git` };\n case 'bitbucket':\n return { url: `https://bitbucket.org/${slug}.git` };\n case 'gitlab':\n return { url: `https://gitlab.com/${slug}.git` };\n default:\n throw new Error(`Unknown host service: ${host}`);\n }\n}\n\nconst ANSI_REGEX =\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;\n\nexport function stripAnsi(x: string): string {\n return x.replace(ANSI_REGEX, '');\n}\n\n/**\n * Maps the provided type to stip all `readonly` modifiers from its properties.\n */\nexport type Mutable<T> = { -readonly [K in keyof T]: Mutable<T[K]> };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,mCAAmC;AACnC,6CAA6C;AAC7C,iCAAiC;AAEjC,+BAA+B;AAE/B,uDAAmD;AACnD,mDAAiD;AACjD,4CAA4C;AAG5C,MAAa,SAAS;IAGpB,YAAmC,WAAwB,EAAkB,QAAuB;QAAjE,gBAAW,GAAX,WAAW,CAAa;QAAkB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAEjG,IAAI;QACT,MAAM,WAAW,GAAG,IAAI,KAAK,EAAiB,CAAC;QAE/C,KAAK,MAAM,UAAU,IAAI,SAAS,CAAC,WAAW,EAAE;YAC9C,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;SACrE;QAED,OAAO;YACL,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC;SACvF,CAAC;IACJ,CAAC;;AAhBH,8BAiBC;AAhBe,qBAAW,GAAyB,mBAAmB,EAAE,CAAC;AAqB1E,SAAS,mBAAmB;IAC1B,OAAO;QACL,kCAAkC;QAClC,4BAA4B;QAC5B,yCAAyC;QACzC,+CAA+C;QAC/C,0BAA0B;QAC1B,kCAAkC;QAClC,sDAAsD;KACvD,CAAC;IAEF,SAAS,kCAAkC,CAAC,CA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,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC7F,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,eAAe,CAAC,IAAgD;IACvE,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,gGAAgG;QAChG,OAAO,IAAW,CAAC;KACpB;IACD,OAAO,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC/C,CAAC","sourcesContent":["import * as assert from 'node:assert';\nimport * as spec from '@jsii/spec';\nimport * as deepEqual from 'fast-deep-equal';\nimport * as ts from 'typescript';\n\nimport * as Case from './case';\nimport { Emitter } from './emitter';\nimport { JsiiDiagnostic } from './jsii-diagnostic';\nimport { getRelatedNode } from './node-bindings';\nimport * as bindings from './node-bindings';\nimport { ProjectInfo } from './project-info';\n\nexport class Validator implements Emitter {\n public static VALIDATIONS: ValidationFunction[] = _defaultValidations();\n\n public constructor(public readonly projectInfo: ProjectInfo, public readonly assembly: spec.Assembly) {}\n\n public emit(): ts.EmitResult {\n const diagnostics = new Array<ts.Diagnostic>();\n\n for (const validation of Validator.VALIDATIONS) {\n validation(this, this.assembly, diagnostics.push.bind(diagnostics));\n }\n\n return {\n diagnostics: diagnostics,\n emitSkipped: diagnostics.some((diag) => diag.category === ts.DiagnosticCategory.Error),\n };\n }\n}\n\nexport type DiagnosticEmitter = (diag: JsiiDiagnostic) => void;\nexport type ValidationFunction = (validator: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) => void;\n\nfunction _defaultValidations(): ValidationFunction[] {\n return [\n _enumMembersMustUserUpperSnakeCase,\n _memberNamesMustUseCamelCase,\n _staticConstantNamesMustUseUpperSnakeCase,\n _memberNamesMustNotLookLikeJavaGettersOrSetters,\n _allTypeReferencesAreValid,\n _inehritanceDoesNotChangeContracts,\n _staticMembersAndNestedTypesMustNotSharePascalCaseName,\n ];\n\n function _enumMembersMustUserUpperSnakeCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const type of _allTypes(assembly)) {\n if (!spec.isEnumType(type)) {\n continue;\n }\n\n for (const member of type.members) {\n if (member.name && !isConstantCase(member.name)) {\n diagnostic(JsiiDiagnostic.JSII_8001_ALL_CAPS_ENUM_MEMBERS.createDetached(member.name, type.fqn));\n }\n }\n }\n }\n\n function _memberNamesMustUseCamelCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const { member, type } of _allMembers(assembly)) {\n if (member.static && (member as spec.Property).const) {\n continue;\n }\n if (member.name && member.name !== Case.camel(member.name)) {\n diagnostic(JsiiDiagnostic.JSII_8002_CAMEL_CASED_MEMBERS.createDetached(member.name, type.fqn));\n }\n }\n }\n\n function _staticConstantNamesMustUseUpperSnakeCase(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.static || !(member as spec.Property).const) {\n continue;\n }\n if (\n member.name &&\n !isConstantCase(member.name) &&\n member.name !== Case.pascal(member.name) &&\n member.name !== Case.camel(member.name)\n ) {\n diagnostic(JsiiDiagnostic.JSII_8003_STATIC_CONST_CASING.createDetached(member.name, type.name));\n }\n }\n }\n\n function _memberNamesMustNotLookLikeJavaGettersOrSetters(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.name) {\n continue;\n }\n const snakeName = Case.snake(member.name);\n if (snakeName.startsWith('get_') && _isEmpty((member as spec.Method).parameters)) {\n diagnostic(JsiiDiagnostic.JSII_5000_JAVA_GETTERS.createDetached(member.name, type.name));\n } else if (snakeName.startsWith('set_') && ((member as spec.Method).parameters ?? []).length === 1) {\n diagnostic(JsiiDiagnostic.JSII_5001_JAVA_SETTERS.createDetached(member.name, type.name));\n }\n }\n }\n\n function _allTypeReferencesAreValid(validator: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const typeRef of _allTypeReferences(assembly)) {\n const [assm] = typeRef.fqn.split('.');\n if (assembly.name === assm) {\n if (!(typeRef.fqn in (assembly.types ?? {}))) {\n diagnostic(\n JsiiDiagnostic.JSII_3000_EXPORTED_API_USES_HIDDEN_TYPE.create(\n typeRef.node!, // Pretend there is always a value\n typeRef.fqn,\n ),\n );\n }\n continue;\n }\n const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);\n if (!foreignAssm) {\n diagnostic(JsiiDiagnostic.JSII_9000_UNKNOWN_MODULE.createDetached(assm));\n continue;\n }\n if (!(typeRef.fqn in (foreignAssm.types ?? {}))) {\n diagnostic(JsiiDiagnostic.JSII_9001_TYPE_NOT_FOUND.createDetached(typeRef));\n }\n }\n }\n\n function _inehritanceDoesNotChangeContracts(\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const type of _allTypes(assembly)) {\n if (spec.isClassType(type)) {\n for (const method of type.methods ?? []) {\n _validateMethodOverride(method, type);\n }\n for (const property of type.properties ?? []) {\n _validatePropertyOverride(property, type);\n }\n }\n if (spec.isClassOrInterfaceType(type) && (type.interfaces?.length ?? 0) > 0) {\n for (const method of _allImplementations(type, (t) => t.methods)) {\n _validateMethodImplementation(method, type);\n }\n for (const property of _allImplementations(type, (t) => t.properties)) {\n _validatePropertyImplementation(property, type);\n }\n }\n }\n\n /**\n * Lists all \"implementations\" from the given type, using the provided\n * implementation getter. Note that abstract members may be part of the\n * result (in particular, if `type` is an interface type, or if it's an\n * abstract class with unimplemented members) -- I just couldn't come up\n * with a name that actually describes this.\n *\n * @param type the type which implemented members are needed.\n * @param getter the getter to obtain methods or properties from the type.\n *\n * @returns a list of members (possibly empty, always defined)\n */\n function _allImplementations<T extends spec.Property | spec.Method>(\n type: spec.ClassType | spec.InterfaceType,\n getter: (type: spec.ClassType | spec.InterfaceType) => T[] | undefined,\n ): T[] {\n const result = new Array<T>();\n const known = new Set<string>();\n\n for (const member of getter(type) ?? []) {\n result.push(member);\n known.add(member.name);\n }\n\n if (spec.isClassType(type) && type.base) {\n // We have a parent class, collect their concrete members, too (recursively)...\n const base = _dereference(type.base, assembly, validator);\n assert(base != null && spec.isClassType(base));\n for (const member of _allImplementations(base, getter)) {\n if (known.has(member.name)) {\n continue;\n }\n // The member is copied, so that its `overrides` property won't be\n // altered, since this member is \"borrowed\" from a parent type. We\n // only check it, but should not record `overrides` relationships to\n // it as those could be invalid per the parent type (i.e: the parent\n // member may not be able to implement an interface, if that type does\n // not actually declare implementing that).\n const memberCopy = { ...member };\n // Forward the related node if there's one, so diagnostics are bound.\n const node = bindings.getRelatedNode(member);\n if (node != null) {\n bindings.setRelatedNode(memberCopy, node);\n }\n\n result.push(memberCopy);\n known.add(member.name);\n }\n }\n\n return result;\n }\n\n function _validateMethodOverride(method: spec.Method, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base, assembly, validator) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.methods ?? []).find((m) => m.name === method.name);\n if (!overridden) {\n return _validateMethodOverride(method, baseType);\n }\n _assertSignaturesMatch(overridden, method, `${type.fqn}#${method.name}`, `overriding ${baseType.fqn}`);\n method.overrides = baseType.fqn;\n return true;\n }\n\n function _validatePropertyOverride(property: spec.Property, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base, assembly, validator) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.properties ?? []).find((p) => p.name === property.name);\n if (!overridden) {\n return _validatePropertyOverride(property, baseType);\n }\n _assertPropertiesMatch(overridden, property, `${type.fqn}#${property.name}`, `overriding ${baseType.fqn}`);\n property.overrides = baseType.fqn;\n return true;\n }\n\n function _validateMethodImplementation(method: spec.Method, type: spec.ClassType | spec.InterfaceType): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validateMethodImplementation(method, _dereference(type.base, assembly, validator) as spec.ClassType);\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType;\n const implemented = (ifaceType.methods ?? []).find((m) => m.name === method.name);\n if (implemented) {\n _assertSignaturesMatch(implemented, method, `${type.fqn}#${method.name}`, `implementing ${ifaceType.fqn}`);\n // We won't replace a previous overrides declaration from a method override, as those have\n // higher precedence than an initial implementation.\n method.overrides = method.overrides ?? iface;\n return true;\n }\n if (_validateMethodImplementation(method, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _validatePropertyImplementation(\n property: spec.Property,\n type: spec.ClassType | spec.InterfaceType,\n ): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validatePropertyImplementation(\n property,\n _dereference(type.base, assembly, validator) as spec.ClassType,\n );\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType;\n const implemented = (ifaceType.properties ?? []).find((p) => p.name === property.name);\n if (implemented) {\n _assertPropertiesMatch(\n implemented,\n property,\n `${type.fqn}#${property.name}`,\n `implementing ${ifaceType.fqn}`,\n );\n // We won't replace a previous overrides declaration from a property override, as those\n // have higher precedence than an initial implementation.\n property.overrides = property.overrides ?? ifaceType.fqn;\n return true;\n }\n if (_validatePropertyImplementation(property, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _assertSignaturesMatch(expected: spec.Method, actual: spec.Method, label: string, action: string) {\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.createDetached(\n label,\n action,\n actVisibility,\n expVisibility,\n ),\n );\n }\n if (!deepEqual(actual.returns, expected.returns)) {\n const expType = spec.describeTypeReference(expected.returns?.type);\n const actType = spec.describeTypeReference(actual.returns?.type);\n diagnostic(\n JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.createDetached(label, action, actType, expType),\n );\n }\n const expectedParams = expected.parameters ?? [];\n const actualParams = actual.parameters ?? [];\n if (expectedParams.length !== actualParams.length) {\n diagnostic(\n JsiiDiagnostic.JSII_5005_OVERRIDE_CHANGES_PARAM_COUNT.createDetached(\n label,\n action,\n actualParams.length,\n expectedParams.length,\n ),\n );\n return;\n }\n for (let i = 0; i < expectedParams.length; i++) {\n const expParam = expectedParams[i];\n const actParam = actualParams[i];\n if (!deepEqual(expParam.type, actParam.type)) {\n diagnostic(\n JsiiDiagnostic.JSII_5006_OVERRIDE_CHANGES_PARAM_TYPE.createDetached(label, action, actParam, expParam),\n );\n }\n // Not-ing those to force the values to a strictly boolean context (they're optional, undefined means false)\n if (expParam.variadic !== actParam.variadic) {\n diagnostic(\n JsiiDiagnostic.JSII_5007_OVERRIDE_CHANGES_VARIADIC.createDetached(\n label,\n action,\n actParam.variadic,\n expParam.variadic,\n ),\n );\n }\n if (expParam.optional !== actParam.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5008_OVERRIDE_CHANGES_PARAM_OPTIONAL.createDetached(label, action, actParam, expParam),\n );\n }\n }\n }\n\n function _assertPropertiesMatch(expected: spec.Property, actual: spec.Property, label: string, action: string) {\n const actualNode = bindings.getPropertyRelatedNode(actual);\n const expectedNode = bindings.getPropertyRelatedNode(expected);\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.create(\n actualNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(actualNode),\n label,\n action,\n actVisibility,\n expVisibility,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(expectedNode),\n 'The implemented delcaration is here.',\n ),\n );\n }\n if (!deepEqual(expected.type, actual.type)) {\n diagnostic(\n JsiiDiagnostic.JSII_5004_OVERRIDE_CHANGES_PROP_TYPE.create(\n actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.type,\n expected.type,\n ).maybeAddRelatedInformation(\n expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented delcaration is here.',\n ),\n );\n }\n if (expected.immutable !== actual.immutable) {\n diagnostic(\n JsiiDiagnostic.JSII_5010_OVERRIDE_CHANGES_MUTABILITY.create(\n actualNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(actualNode),\n label,\n action,\n actual.immutable,\n expected.immutable,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(expectedNode),\n 'The implemented delcaration is here.',\n ),\n );\n }\n if (expected.optional !== actual.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5009_OVERRIDE_CHANGES_PROP_OPTIONAL.create(\n actualNode?.questionToken ?? actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.optional,\n expected.optional,\n ).maybeAddRelatedInformation(\n expectedNode?.questionToken ?? expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented delcaration is here.',\n ),\n );\n }\n }\n }\n\n function _staticMembersAndNestedTypesMustNotSharePascalCaseName(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const nestedType of Object.values(assembly.types ?? {})) {\n if (nestedType.namespace == null) {\n continue;\n }\n const nestingType = assembly.types![`${assembly.name}.${nestedType.namespace}`];\n if (nestingType == null) {\n continue;\n }\n const nestedTypeName = Case.pascal(nestedType.name);\n for (const { name, member } of staticMembers(nestingType)) {\n if (name === nestedTypeName) {\n let diag = JsiiDiagnostic.JSII_5020_STATIC_MEMBER_CONFLICTS_WITH_NESTED_TYPE.create(\n getRelatedNode(member)!,\n nestingType,\n member,\n nestedType,\n );\n const nestedTypeNode = getRelatedNode(nestedType);\n if (nestedTypeNode != null) {\n diag = diag.addRelatedInformation(nestedTypeNode, 'This is the conflicting nested type declaration');\n }\n diagnostic(diag);\n }\n }\n }\n\n function staticMembers(type: spec.Type) {\n if (spec.isClassOrInterfaceType(type)) {\n return [\n ...(type.methods?.filter((method) => method.static) ?? []),\n ...(type.properties?.filter((prop) => prop.static) ?? []),\n ].map((member) => ({ name: Case.pascal(member.name), member }));\n }\n return type.members.map((member) => ({ name: member.name, member }));\n }\n }\n}\n\nfunction _allTypes(assm: spec.Assembly): spec.Type[] {\n return Object.values(assm.types ?? {});\n}\n\nfunction _allMethods(assm: spec.Assembly): Array<{ member: spec.Method; type: spec.Type }> {\n const methods = new Array<{ member: spec.Method; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.methods) {\n continue;\n }\n for (const method of type.methods) methods.push({ member: method, type });\n }\n return methods;\n}\n\nfunction _allProperties(assm: spec.Assembly): Array<{ member: spec.Property; type: spec.Type }> {\n const properties = new Array<{ member: spec.Property; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.properties) {\n continue;\n }\n for (const property of type.properties) properties.push({ member: property, type });\n }\n return properties;\n}\n\nfunction _allMembers(assm: spec.Assembly): Array<{ member: spec.Property | spec.Method; type: spec.Type }> {\n return [..._allMethods(assm), ..._allProperties(assm)];\n}\n\ninterface AnnotatedTypeReference extends spec.NamedTypeReference {\n readonly node: ts.Node | undefined;\n}\n\nfunction _allTypeReferences(assm: spec.Assembly): readonly AnnotatedTypeReference[] {\n const typeReferences = new Array<AnnotatedTypeReference>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (spec.isClassType(type)) {\n const node = bindings.getClassRelatedNode(type);\n if (type.base) {\n typeReferences.push({\n fqn: type.base,\n node: node?.heritageClauses?.find((hc) => hc.token === ts.SyntaxKind.ExtendsKeyword)?.types[0],\n });\n }\n if (type.initializer?.parameters) {\n for (const param of type.initializer.parameters) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n }\n if (type.interfaces) {\n const node = bindings.getClassOrInterfaceRelatedNode(type);\n for (const iface of type.interfaces) {\n typeReferences.push({\n fqn: iface,\n node: node?.heritageClauses?.find(\n (hc) =>\n hc.token ===\n (spec.isInterfaceType(type) ? ts.SyntaxKind.ImplementsKeyword : ts.SyntaxKind.ExtendsKeyword),\n ),\n });\n }\n }\n }\n for (const { member: prop } of _allProperties(assm)) {\n _collectTypeReferences(prop.type, bindings.getPropertyRelatedNode(prop)?.type);\n }\n for (const { member: meth } of _allMethods(assm)) {\n if (meth.returns) {\n _collectTypeReferences(meth.returns.type, bindings.getMethodRelatedNode(meth)?.type);\n }\n for (const param of meth.parameters ?? []) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n return typeReferences;\n\n function _collectTypeReferences(type: spec.TypeReference, node: ts.Node | undefined): void {\n if (spec.isNamedTypeReference(type)) {\n typeReferences.push({ ...type, node });\n } else if (spec.isCollectionTypeReference(type)) {\n _collectTypeReferences(type.collection.elementtype, node);\n } else if (spec.isUnionTypeReference(type)) {\n for (const t of type.union.types) _collectTypeReferences(t, node);\n }\n }\n}\n\nfunction _dereference(\n typeRef: string | spec.NamedTypeReference,\n assembly: spec.Assembly,\n validator: Validator,\n): spec.Type | undefined {\n if (typeof typeRef !== 'string') {\n typeRef = typeRef.fqn;\n }\n const [assm] = typeRef.split('.');\n if (assembly.name === assm) {\n return assembly.types?.[typeRef];\n }\n const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);\n return foreignAssm?.types?.[typeRef];\n}\n\nfunction _isEmpty(array: undefined | any[]): array is undefined {\n return array == null || array.length === 0;\n}\n\n/**\n * Return whether an identifier only consists of upperchase characters, digits and underscores\n *\n * We have our own check here (isConstantCase) which is more lenient than what\n * `case.constant()` prescribes. We also want to allow combinations of letters\n * and digits without underscores: `C5A`, which `case` would force to `C5_A`.\n * The hint we print will still use `case.constant()` but that is fine.\n */\nfunction isConstantCase(x: string) {\n return !/[^A-Z0-9_]/.exec(x);\n}\n\n/**\n * Obtains the name of the given declaration, if it has one, or returns the declaration itself.\n * This function is meant to be used as a convenience to obtain the `ts.Node` to bind a\n * `JsiiDianostic` instance on.\n *\n * It may return `undefined` but is typed as `ts.Node` so that it is easier to use with\n * `JsiiDiagnostic` factories.\n *\n * @param decl the declaration which name is needed.\n *\n * @returns the name of the declaration if it has one, or the declaration itself. Might return\n * `undefined` if the provided declaration is undefined.\n */\nfunction declarationName(decl: ts.Declaration | ts.Expression | undefined): ts.Node {\n if (decl == null) {\n // Pretend we returned a node - this is used to create diagnostics, worst case it'll be unbound.\n return decl as any;\n }\n return ts.getNameOfDeclaration(decl) ?? decl;\n}\n"]}
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,mCAAmC;AACnC,6CAA6C;AAC7C,iCAAiC;AAEjC,+BAA+B;AAE/B,uDAAmD;AACnD,mDAAiD;AACjD,4CAA4C;AAG5C,MAAa,S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I,CAAC,IAAI,IAAI,CAAC;AAC/C,CAAC","sourcesContent":["import * as assert from 'node:assert';\nimport * as spec from '@jsii/spec';\nimport * as deepEqual from 'fast-deep-equal';\nimport * as ts from 'typescript';\n\nimport * as Case from './case';\nimport { Emitter } from './emitter';\nimport { JsiiDiagnostic } from './jsii-diagnostic';\nimport { getRelatedNode } from './node-bindings';\nimport * as bindings from './node-bindings';\nimport { ProjectInfo } from './project-info';\n\nexport class Validator implements Emitter {\n public static VALIDATIONS: ValidationFunction[] = _defaultValidations();\n\n public constructor(public readonly projectInfo: ProjectInfo, public readonly assembly: spec.Assembly) {}\n\n public emit(): ts.EmitResult {\n const diagnostics = new Array<ts.Diagnostic>();\n\n for (const validation of Validator.VALIDATIONS) {\n validation(this, this.assembly, diagnostics.push.bind(diagnostics));\n }\n\n return {\n diagnostics: diagnostics,\n emitSkipped: diagnostics.some((diag) => diag.category === ts.DiagnosticCategory.Error),\n };\n }\n}\n\nexport type DiagnosticEmitter = (diag: JsiiDiagnostic) => void;\nexport type ValidationFunction = (validator: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) => void;\n\nfunction _defaultValidations(): ValidationFunction[] {\n return [\n _enumMembersMustUserUpperSnakeCase,\n _memberNamesMustUseCamelCase,\n _staticConstantNamesMustUseUpperSnakeCase,\n _memberNamesMustNotLookLikeJavaGettersOrSetters,\n _allTypeReferencesAreValid,\n _inehritanceDoesNotChangeContracts,\n _staticMembersAndNestedTypesMustNotSharePascalCaseName,\n ];\n\n function _enumMembersMustUserUpperSnakeCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const type of _allTypes(assembly)) {\n if (!spec.isEnumType(type)) {\n continue;\n }\n\n for (const member of type.members) {\n if (member.name && !isConstantCase(member.name)) {\n diagnostic(JsiiDiagnostic.JSII_8001_ALL_CAPS_ENUM_MEMBERS.createDetached(member.name, type.fqn));\n }\n }\n }\n }\n\n function _memberNamesMustUseCamelCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const { member, type } of _allMembers(assembly)) {\n if (member.static && (member as spec.Property).const) {\n continue;\n }\n if (member.name && member.name !== Case.camel(member.name)) {\n diagnostic(JsiiDiagnostic.JSII_8002_CAMEL_CASED_MEMBERS.createDetached(member.name, type.fqn));\n }\n }\n }\n\n function _staticConstantNamesMustUseUpperSnakeCase(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.static || !(member as spec.Property).const) {\n continue;\n }\n if (\n member.name &&\n !isConstantCase(member.name) &&\n member.name !== Case.pascal(member.name) &&\n member.name !== Case.camel(member.name)\n ) {\n diagnostic(JsiiDiagnostic.JSII_8003_STATIC_CONST_CASING.createDetached(member.name, type.name));\n }\n }\n }\n\n function _memberNamesMustNotLookLikeJavaGettersOrSetters(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.name) {\n continue;\n }\n const snakeName = Case.snake(member.name);\n if (snakeName.startsWith('get_') && _isEmpty((member as spec.Method).parameters)) {\n diagnostic(JsiiDiagnostic.JSII_5000_JAVA_GETTERS.createDetached(member.name, type.name));\n } else if (snakeName.startsWith('set_') && ((member as spec.Method).parameters ?? []).length === 1) {\n diagnostic(JsiiDiagnostic.JSII_5001_JAVA_SETTERS.createDetached(member.name, type.name));\n }\n }\n }\n\n function _allTypeReferencesAreValid(validator: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const typeRef of _allTypeReferences(assembly)) {\n const [assm] = typeRef.fqn.split('.');\n if (assembly.name === assm) {\n if (!(typeRef.fqn in (assembly.types ?? {}))) {\n diagnostic(\n JsiiDiagnostic.JSII_3000_EXPORTED_API_USES_HIDDEN_TYPE.create(\n typeRef.node!, // Pretend there is always a value\n typeRef.fqn,\n ),\n );\n }\n continue;\n }\n const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);\n if (!foreignAssm) {\n diagnostic(JsiiDiagnostic.JSII_9000_UNKNOWN_MODULE.createDetached(assm));\n continue;\n }\n if (!(typeRef.fqn in (foreignAssm.types ?? {}))) {\n diagnostic(JsiiDiagnostic.JSII_9001_TYPE_NOT_FOUND.createDetached(typeRef));\n }\n }\n }\n\n function _inehritanceDoesNotChangeContracts(\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const type of _allTypes(assembly)) {\n if (spec.isClassType(type)) {\n for (const method of type.methods ?? []) {\n _validateMethodOverride(method, type);\n }\n for (const property of type.properties ?? []) {\n _validatePropertyOverride(property, type);\n }\n }\n if (spec.isClassOrInterfaceType(type) && (type.interfaces?.length ?? 0) > 0) {\n for (const method of _allImplementations(type, (t) => t.methods)) {\n _validateMethodImplementation(method, type);\n }\n for (const property of _allImplementations(type, (t) => t.properties)) {\n _validatePropertyImplementation(property, type);\n }\n }\n }\n\n /**\n * Lists all \"implementations\" from the given type, using the provided\n * implementation getter. Note that abstract members may be part of the\n * result (in particular, if `type` is an interface type, or if it's an\n * abstract class with unimplemented members) -- I just couldn't come up\n * with a name that actually describes this.\n *\n * @param type the type which implemented members are needed.\n * @param getter the getter to obtain methods or properties from the type.\n *\n * @returns a list of members (possibly empty, always defined)\n */\n function _allImplementations<T extends spec.Property | spec.Method>(\n type: spec.ClassType | spec.InterfaceType,\n getter: (type: spec.ClassType | spec.InterfaceType) => T[] | undefined,\n ): T[] {\n const result = new Array<T>();\n const known = new Set<string>();\n\n for (const member of getter(type) ?? []) {\n result.push(member);\n known.add(member.name);\n }\n\n if (spec.isClassType(type) && type.base) {\n // We have a parent class, collect their concrete members, too (recursively)...\n const base = _dereference(type.base, assembly, validator);\n assert(base != null && spec.isClassType(base));\n for (const member of _allImplementations(base, getter)) {\n if (known.has(member.name)) {\n continue;\n }\n // The member is copied, so that its `overrides` property won't be\n // altered, since this member is \"borrowed\" from a parent type. We\n // only check it, but should not record `overrides` relationships to\n // it as those could be invalid per the parent type (i.e: the parent\n // member may not be able to implement an interface, if that type does\n // not actually declare implementing that).\n const memberCopy = { ...member };\n // Forward the related node if there's one, so diagnostics are bound.\n const node = bindings.getRelatedNode(member);\n if (node != null) {\n bindings.setRelatedNode(memberCopy, node);\n }\n\n result.push(memberCopy);\n known.add(member.name);\n }\n }\n\n return result;\n }\n\n function _validateMethodOverride(method: spec.Method, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base, assembly, validator) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.methods ?? []).find((m) => m.name === method.name);\n if (!overridden) {\n return _validateMethodOverride(method, baseType);\n }\n _assertSignaturesMatch(overridden, method, `${type.fqn}#${method.name}`, `overriding ${baseType.fqn}`);\n method.overrides = baseType.fqn;\n return true;\n }\n\n function _validatePropertyOverride(property: spec.Property, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base, assembly, validator) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.properties ?? []).find((p) => p.name === property.name);\n if (!overridden) {\n return _validatePropertyOverride(property, baseType);\n }\n _assertPropertiesMatch(overridden, property, `${type.fqn}#${property.name}`, `overriding ${baseType.fqn}`);\n property.overrides = baseType.fqn;\n return true;\n }\n\n function _validateMethodImplementation(method: spec.Method, type: spec.ClassType | spec.InterfaceType): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validateMethodImplementation(method, _dereference(type.base, assembly, validator) as spec.ClassType);\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType;\n const implemented = (ifaceType.methods ?? []).find((m) => m.name === method.name);\n if (implemented) {\n _assertSignaturesMatch(implemented, method, `${type.fqn}#${method.name}`, `implementing ${ifaceType.fqn}`);\n // We won't replace a previous overrides declaration from a method override, as those have\n // higher precedence than an initial implementation.\n method.overrides = method.overrides ?? iface;\n return true;\n }\n if (_validateMethodImplementation(method, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _validatePropertyImplementation(\n property: spec.Property,\n type: spec.ClassType | spec.InterfaceType,\n ): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validatePropertyImplementation(\n property,\n _dereference(type.base, assembly, validator) as spec.ClassType,\n );\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType;\n const implemented = (ifaceType.properties ?? []).find((p) => p.name === property.name);\n if (implemented) {\n _assertPropertiesMatch(\n implemented,\n property,\n `${type.fqn}#${property.name}`,\n `implementing ${ifaceType.fqn}`,\n );\n // We won't replace a previous overrides declaration from a property override, as those\n // have higher precedence than an initial implementation.\n property.overrides = property.overrides ?? ifaceType.fqn;\n return true;\n }\n if (_validatePropertyImplementation(property, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _assertSignaturesMatch(expected: spec.Method, actual: spec.Method, label: string, action: string) {\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.createDetached(\n label,\n action,\n actVisibility,\n expVisibility,\n ),\n );\n }\n if (!deepEqual(actual.returns, expected.returns)) {\n const expType = spec.describeTypeReference(expected.returns?.type);\n const actType = spec.describeTypeReference(actual.returns?.type);\n diagnostic(\n JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.createDetached(label, action, actType, expType),\n );\n }\n const expectedParams = expected.parameters ?? [];\n const actualParams = actual.parameters ?? [];\n if (expectedParams.length !== actualParams.length) {\n diagnostic(\n JsiiDiagnostic.JSII_5005_OVERRIDE_CHANGES_PARAM_COUNT.createDetached(\n label,\n action,\n actualParams.length,\n expectedParams.length,\n ),\n );\n return;\n }\n for (let i = 0; i < expectedParams.length; i++) {\n const expParam = expectedParams[i];\n const actParam = actualParams[i];\n if (!deepEqual(expParam.type, actParam.type)) {\n diagnostic(\n JsiiDiagnostic.JSII_5006_OVERRIDE_CHANGES_PARAM_TYPE.createDetached(label, action, actParam, expParam),\n );\n }\n // Not-ing those to force the values to a strictly boolean context (they're optional, undefined means false)\n if (expParam.variadic !== actParam.variadic) {\n diagnostic(\n JsiiDiagnostic.JSII_5007_OVERRIDE_CHANGES_VARIADIC.createDetached(\n label,\n action,\n actParam.variadic,\n expParam.variadic,\n ),\n );\n }\n if (expParam.optional !== actParam.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5008_OVERRIDE_CHANGES_PARAM_OPTIONAL.createDetached(label, action, actParam, expParam),\n );\n }\n }\n }\n\n function _assertPropertiesMatch(expected: spec.Property, actual: spec.Property, label: string, action: string) {\n const actualNode = bindings.getPropertyRelatedNode(actual);\n const expectedNode = bindings.getPropertyRelatedNode(expected);\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.create(\n actualNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(actualNode),\n label,\n action,\n actVisibility,\n expVisibility,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(expectedNode),\n 'The implemented delcaration is here.',\n ),\n );\n }\n if (!deepEqual(expected.type, actual.type)) {\n diagnostic(\n JsiiDiagnostic.JSII_5004_OVERRIDE_CHANGES_PROP_TYPE.create(\n actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.type,\n expected.type,\n ).maybeAddRelatedInformation(\n expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented delcaration is here.',\n ),\n );\n }\n if (expected.immutable !== actual.immutable) {\n diagnostic(\n JsiiDiagnostic.JSII_5010_OVERRIDE_CHANGES_MUTABILITY.create(\n actualNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(actualNode),\n label,\n action,\n actual.immutable,\n expected.immutable,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(expectedNode),\n 'The implemented delcaration is here.',\n ),\n );\n }\n if (expected.optional !== actual.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5009_OVERRIDE_CHANGES_PROP_OPTIONAL.create(\n actualNode?.questionToken ?? actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.optional,\n expected.optional,\n ).maybeAddRelatedInformation(\n expectedNode?.questionToken ?? expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented delcaration is here.',\n ),\n );\n }\n }\n }\n\n function _staticMembersAndNestedTypesMustNotSharePascalCaseName(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const nestedType of Object.values(assembly.types ?? {})) {\n if (nestedType.namespace == null) {\n continue;\n }\n const nestingType = assembly.types![`${assembly.name}.${nestedType.namespace}`];\n if (nestingType == null) {\n continue;\n }\n const nestedTypeName = Case.pascal(nestedType.name);\n for (const { name, member } of staticMembers(nestingType)) {\n if (name === nestedTypeName) {\n let diag = JsiiDiagnostic.JSII_5020_STATIC_MEMBER_CONFLICTS_WITH_NESTED_TYPE.create(\n getRelatedNode(member)!,\n nestingType,\n member,\n nestedType,\n );\n const nestedTypeNode = getRelatedNode(nestedType);\n if (nestedTypeNode != null) {\n diag = diag.addRelatedInformation(nestedTypeNode, 'This is the conflicting nested type declaration');\n }\n diagnostic(diag);\n }\n }\n }\n\n function staticMembers(type: spec.Type) {\n if (spec.isClassOrInterfaceType(type)) {\n return [\n ...(type.methods?.filter((method) => method.static) ?? []),\n ...(type.properties?.filter((prop) => prop.static) ?? []),\n ].map((member) => ({ name: Case.pascal(member.name), member }));\n }\n return type.members.map((member) => ({ name: member.name, member }));\n }\n }\n}\n\nfunction _allTypes(assm: spec.Assembly): spec.Type[] {\n return Object.values(assm.types ?? {});\n}\n\nfunction _allMethods(assm: spec.Assembly): Array<{ member: spec.Method; type: spec.Type }> {\n const methods = new Array<{ member: spec.Method; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.methods) {\n continue;\n }\n for (const method of type.methods) methods.push({ member: method, type });\n }\n return methods;\n}\n\nfunction _allProperties(assm: spec.Assembly): Array<{ member: spec.Property; type: spec.Type }> {\n const properties = new Array<{ member: spec.Property; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.properties) {\n continue;\n }\n for (const property of type.properties) properties.push({ member: property, type });\n }\n return properties;\n}\n\nfunction _allMembers(assm: spec.Assembly): Array<{ member: spec.Property | spec.Method; type: spec.Type }> {\n return [..._allMethods(assm), ..._allProperties(assm)];\n}\n\ninterface AnnotatedTypeReference extends spec.NamedTypeReference {\n readonly node: ts.Node | undefined;\n}\n\nfunction _allTypeReferences(assm: spec.Assembly): readonly AnnotatedTypeReference[] {\n const typeReferences = new Array<AnnotatedTypeReference>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (spec.isClassType(type)) {\n const node = bindings.getClassRelatedNode(type);\n if (type.base) {\n typeReferences.push({\n fqn: type.base,\n node: node?.heritageClauses?.find((hc) => hc.token === ts.SyntaxKind.ExtendsKeyword)?.types[0],\n });\n }\n if (type.initializer?.parameters) {\n for (const param of type.initializer.parameters) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n }\n if (type.interfaces) {\n const node = bindings.getClassOrInterfaceRelatedNode(type);\n for (const iface of type.interfaces) {\n typeReferences.push({\n fqn: iface,\n node: node?.heritageClauses?.find(\n (hc) =>\n hc.token ===\n (spec.isInterfaceType(type) ? ts.SyntaxKind.ImplementsKeyword : ts.SyntaxKind.ExtendsKeyword),\n ),\n });\n }\n }\n }\n for (const { member: prop } of _allProperties(assm)) {\n _collectTypeReferences(prop.type, bindings.getPropertyRelatedNode(prop)?.type);\n }\n for (const { member: meth } of _allMethods(assm)) {\n if (meth.returns) {\n _collectTypeReferences(meth.returns.type, bindings.getMethodRelatedNode(meth)?.type);\n }\n for (const param of meth.parameters ?? []) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n return typeReferences;\n\n function _collectTypeReferences(type: spec.TypeReference, node: ts.Node | undefined): void {\n if (spec.isNamedTypeReference(type)) {\n typeReferences.push({ ...type, node });\n } else if (spec.isCollectionTypeReference(type)) {\n _collectTypeReferences(type.collection.elementtype, node);\n } else if (spec.isUnionTypeReference(type)) {\n for (const t of type.union.types) _collectTypeReferences(t, node);\n }\n }\n}\n\nfunction _dereference(\n typeRef: string | spec.NamedTypeReference,\n assembly: spec.Assembly,\n validator: Validator,\n): spec.Type | undefined {\n if (typeof typeRef !== 'string') {\n typeRef = typeRef.fqn;\n }\n const [assm] = typeRef.split('.');\n if (assembly.name === assm) {\n return assembly.types?.[typeRef];\n }\n const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);\n return foreignAssm?.types?.[typeRef];\n}\n\nfunction _isEmpty(array: undefined | any[]): array is undefined {\n return array == null || array.length === 0;\n}\n\n/**\n * Return whether an identifier only consists of upperchase characters, digits and underscores\n *\n * We have our own check here (isConstantCase) which is more lenient than what\n * `case.constant()` prescribes. We also want to allow combinations of letters\n * and digits without underscores: `C5A`, which `case` would force to `C5_A`.\n * The hint we print will still use `case.constant()` but that is fine.\n */\nfunction isConstantCase(x: string) {\n return !/[^A-Z0-9_]/.exec(x);\n}\n\n/**\n * Obtains the name of the given declaration, if it has one, or returns the declaration itself.\n * This function is meant to be used as a convenience to obtain the `ts.Node` to bind a\n * `JsiiDianostic` instance on.\n *\n * It may return `undefined` but is typed as `ts.Node` so that it is easier to use with\n * `JsiiDiagnostic` factories.\n *\n * @param decl the declaration which name is needed.\n *\n * @returns the name of the declaration if it has one, or the declaration itself. Might return\n * `undefined` if the provided declaration is undefined.\n */\nfunction declarationName(decl: ts.Declaration | ts.Expression | undefined): ts.Node {\n if (decl == null) {\n // Pretend we returned a node - this is used to create diagnostics, worst case it'll be unbound.\n return decl as any;\n }\n return ts.getNameOfDeclaration(decl) ?? decl;\n}\n"]}
package/lib/version.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
2
- export declare const SHORT_VERSION = "5.2.45-dev.0";
2
+ export declare const SHORT_VERSION = "5.3.1-dev.0";
3
3
  /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
4
- export declare const VERSION = "5.2.45-dev.0 (build 26535dd)";
4
+ export declare const VERSION = "5.3.1-dev.0 (build 847b207)";
5
5
  /** The release line identifier for this JSII compiler (e.g: `X.Y`) */
6
- export declare const RELEASE_LINE = "5.2";
6
+ export declare const RELEASE_LINE = "5.3";
7
7
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -4,9 +4,9 @@ exports.RELEASE_LINE = exports.VERSION = exports.SHORT_VERSION = void 0;
4
4
  const typescript_1 = require("typescript");
5
5
  // GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!
6
6
  /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
7
- exports.SHORT_VERSION = '5.2.45-dev.0';
7
+ exports.SHORT_VERSION = '5.3.1-dev.0';
8
8
  /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
9
- exports.VERSION = '5.2.45-dev.0 (build 26535dd)';
9
+ exports.VERSION = '5.3.1-dev.0 (build 847b207)';
10
10
  /** The release line identifier for this JSII compiler (e.g: `X.Y`) */
11
11
  exports.RELEASE_LINE = typescript_1.versionMajorMinor;
12
12
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2CAA8C;AAE9C,uFAAuF;AAEvF,qEAAqE;AACxD,QAAA,aAAa,GAAG,cAAc,CAAC;AAE5C,yFAAyF;AAC5E,QAAA,OAAO,GAAG,8BAA8B,CAAC;AAEtD,sEAAsE;AACzD,QAAA,YAAY,GAAG,8BAAiB,CAAC","sourcesContent":["import { versionMajorMinor } from 'typescript'\n\n// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!\n\n/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */\nexport const SHORT_VERSION = '5.2.45-dev.0';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.2.45-dev.0 (build 26535dd)';\n\n/** The release line identifier for this JSII compiler (e.g: `X.Y`) */\nexport const RELEASE_LINE = versionMajorMinor;\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2CAA8C;AAE9C,uFAAuF;AAEvF,qEAAqE;AACxD,QAAA,aAAa,GAAG,aAAa,CAAC;AAE3C,yFAAyF;AAC5E,QAAA,OAAO,GAAG,6BAA6B,CAAC;AAErD,sEAAsE;AACzD,QAAA,YAAY,GAAG,8BAAiB,CAAC","sourcesContent":["import { versionMajorMinor } from 'typescript'\n\n// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!\n\n/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */\nexport const SHORT_VERSION = '5.3.1-dev.0';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.3.1-dev.0 (build 847b207)';\n\n/** The release line identifier for this JSII compiler (e.g: `X.Y`) */\nexport const RELEASE_LINE = versionMajorMinor;\n"]}