jsii 5.9.5-dev.3 → 5.9.5-dev.4

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":"deprecated-remover.js","sourceRoot":"","sources":["../../src/transforms/deprecated-remover.ts"],"names":[],"mappings":";;;AAAA,yCAAwD;AACxD,qCAkBoB;AACpB,iCAAiC;AAEjC,wDAAoD;AACpD,6CAA6C;AAC7C,oCAAqC;AAErC,MAAa,iBAAiB;IAI5B,YACmB,WAA2B,EAC3B,uBAAgD;QADhD,gBAAW,GAAX,WAAW,CAAgB;QAC3B,4BAAuB,GAAvB,uBAAuB,CAAyB;QALlD,oBAAe,GAAG,IAAI,KAAK,EAAkB,CAAC;QAC9C,kBAAa,GAAG,IAAI,GAAG,EAAW,CAAC;IAKjD,CAAC;IAEJ;;;;;;OAMG;IACH,IAAW,kBAAkB;QAC3B,OAAO;YACL,iBAAiB,EAAE;gBACjB,CAAC,OAAO,EAAE,EAAE;oBACV,MAAM,WAAW,GAAG,IAAI,6BAA6B,CACnD,IAAI,CAAC,WAAW,EAChB,OAAO,EACP,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,aAAa,CACnB,CAAC;oBACF,OAAO,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACjD,CAAC;aACF;SACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;OASG;IACI,UAAU,CAAC,QAAkB;QAClC,IAAI,QAAQ,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;YAC3B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;QACvC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;QACnD,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAA6B,CAAC;QAEnE,2CAA2C;QAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IA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C/G,CAAC;IACJ,CAAC;;AApJD;;;;;;GAMG;AACqB,6CAAe,GAA+B,IAAI,GAAG,CAAC;IAC5E,EAAE,CAAC,UAAU,CAAC,WAAW;IACzB,EAAE,CAAC,UAAU,CAAC,mBAAmB;IACjC,EAAE,CAAC,UAAU,CAAC,WAAW;IACzB,EAAE,CAAC,UAAU,CAAC,iBAAiB;IAC/B,EAAE,CAAC,UAAU,CAAC,eAAe;IAC7B,EAAE,CAAC,UAAU,CAAC,iBAAiB;IAC/B,EAAE,CAAC,UAAU,CAAC,mBAAmB;IACjC,EAAE,CAAC,UAAU,CAAC,WAAW;IACzB,EAAE,CAAC,UAAU,CAAC,mBAAmB;CAClC,CAAC,AAVqC,CAUpC","sourcesContent":["import { basename, dirname, relative } from 'node:path';\nimport {\n Assembly,\n ClassType,\n EnumMember,\n Initializer,\n InterfaceType,\n isClassOrInterfaceType,\n isClassType,\n isCollectionTypeReference,\n isEnumType,\n isMethod,\n isNamedTypeReference,\n isPrimitiveTypeReference,\n Method,\n Parameter,\n Property,\n Stability,\n TypeReference,\n} from '@jsii/spec';\nimport * as ts from 'typescript';\n\nimport { JsiiDiagnostic } from '../jsii-diagnostic';\nimport * as bindings from '../node-bindings';\nimport { JsiiError } from '../utils';\n\nexport class DeprecatedRemover {\n private readonly transformations = new Array<Transformation>();\n private readonly nodesToRemove = new Set<ts.Node>();\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly allowlistedDeprecations: Set<string> | undefined,\n ) {}\n\n /**\n * Obtains the configuration for the TypeScript transform(s) that will remove\n * `@deprecated` members from the generated declarations (`.d.ts`) files. It\n * will leverage information accumulated during `#removeFrom(Assembly)` in\n * order to apply corrections to inheritance chains, ensuring a valid output\n * is produced.\n */\n public get customTransformers(): ts.CustomTransformers {\n return {\n afterDeclarations: [\n (context) => {\n const transformer = new DeprecationRemovalTransformer(\n this.typeChecker,\n context,\n this.transformations,\n this.nodesToRemove,\n );\n return transformer.transform.bind(transformer);\n },\n ],\n };\n }\n\n /**\n * Removes all `@deprecated` API elements from the provided assembly, and\n * records the operations needed in order to fix the inheritance chains that\n * mix `@deprecated` and non-`@deprecated` types.\n *\n * @param assembly the assembly to be modified.\n *\n * @returns diagnostic messages produced when validating no remaining API\n * makes use of a `@deprecated` type that was removed.\n */\n public removeFrom(assembly: Assembly): readonly JsiiDiagnostic[] {\n if (assembly.types == null) {\n return [];\n }\n\n const strippedFqns = new Set<string>();\n const replaceWithClass = new Map<string, string>();\n const replaceWithInterfaces = new Map<string, readonly string[]>();\n\n // Find all types that will be stripped out\n for (const [fqn, typeInfo] of Object.entries(assembly.types)) {\n if (typeInfo.docs?.stability === Stability.Deprecated) {\n if (!this.shouldFqnBeStripped(fqn)) {\n continue;\n }\n strippedFqns.add(fqn);\n\n if (isClassType(typeInfo) && typeInfo.base != null) {\n replaceWithClass.set(fqn, typeInfo.base);\n }\n if (isClassOrInterfaceType(typeInfo) && typeInfo.interfaces != null) {\n replaceWithInterfaces.set(fqn, typeInfo.interfaces);\n }\n\n this.nodesToRemove.add(bindings.getRelatedNode(typeInfo)!);\n }\n }\n\n for (const [fqn, typeInfo] of Object.entries(assembly.types)) {\n // Ignore `@deprecated` types\n if (strippedFqns.has(fqn)) {\n continue;\n }\n\n // Enums cannot have references to `@deprecated` types, but can have deprecated members\n if (isEnumType(typeInfo)) {\n const enumNode = bindings.getEnumRelatedNode(typeInfo)!;\n const members: EnumMember[] = [];\n for (const mem of typeInfo.members) {\n if (mem.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${mem.name}`)) {\n const matchingMemberNode = enumNode.members.find((enumMem) => enumMem.name.getText() === mem.name);\n if (matchingMemberNode) {\n this.nodesToRemove.add(matchingMemberNode);\n }\n } else {\n members.push(mem);\n }\n }\n typeInfo.members = members;\n continue;\n }\n\n // For classes, we erase `@deprecated` base classes, replacing as needed\n const additionalInterfaces = new Set<string>();\n if (isClassType(typeInfo) && typeInfo.base != null && strippedFqns.has(typeInfo.base)) {\n while (typeInfo.base != null && strippedFqns.has(typeInfo.base)) {\n const oldBase = assembly.types[typeInfo.base] as ClassType;\n if (oldBase.interfaces) for (const addFqn of oldBase.interfaces) additionalInterfaces.add(addFqn);\n typeInfo.base = replaceWithClass.get(typeInfo.base);\n }\n this.transformations.push(\n typeInfo.base != null\n ? Transformation.replaceBaseClass(\n this.typeChecker,\n bindings.getClassRelatedNode(typeInfo)!,\n typeInfo.base in assembly.types\n ? bindings.getClassRelatedNode(assembly.types[typeInfo.base] as ClassType) ?? typeInfo.base\n : typeInfo.base,\n )\n : Transformation.removeBaseClass(this.typeChecker, bindings.getClassRelatedNode(typeInfo)!),\n );\n }\n\n // Be defensive in case we add other kinds in the future\n if (!isClassOrInterfaceType(typeInfo)) {\n throw new Error(`Unhandled type encountered! ${JSON.stringify(typeInfo, null, 2)}`);\n }\n\n // Strip all `@deprecated` interfaces from the inheritance tree, replacing as needed\n if (typeInfo.interfaces?.some((addFqn) => strippedFqns.has(addFqn)) || additionalInterfaces.size > 0) {\n const originalSet = new Set(typeInfo.interfaces ?? []);\n const newSet = new Set<string>();\n\n const candidates = Array.from(new Set([...originalSet, ...additionalInterfaces]));\n while (candidates.length > 0) {\n const candidateFqn = candidates.pop()!;\n if (!strippedFqns.has(candidateFqn)) {\n newSet.add(candidateFqn);\n if (!originalSet.has(candidateFqn)) {\n this.transformations.push(\n Transformation.addInterface(\n this.typeChecker,\n bindings.getClassOrInterfaceRelatedNode(typeInfo)!,\n candidateFqn in assembly.types\n ? bindings.getInterfaceRelatedNode(assembly.types[candidateFqn] as InterfaceType) ?? candidateFqn\n : candidateFqn,\n ),\n );\n }\n continue;\n }\n if (originalSet.has(candidateFqn)) {\n this.transformations.push(\n Transformation.removeInterface(\n this.typeChecker,\n bindings.getClassOrInterfaceRelatedNode(typeInfo)!,\n bindings.getInterfaceRelatedNode(assembly.types[candidateFqn] as InterfaceType)!,\n ),\n );\n }\n const replacement = replaceWithInterfaces.get(candidateFqn);\n if (replacement != null) {\n candidates.push(...replacement);\n }\n }\n\n typeInfo.interfaces = newSet.size > 0 ? Array.from(newSet).sort() : undefined;\n }\n\n // Drop all `@deprecated` members, and remove \"overrides\" from stripped types\n const methods: Method[] = [];\n const properties: Property[] = [];\n if (typeInfo.methods) {\n for (const meth of typeInfo.methods) {\n if (meth.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${meth.name}`)) {\n this.nodesToRemove.add(bindings.getMethodRelatedNode(meth)!);\n } else {\n methods.push(\n meth.overrides != null && strippedFqns.has(meth.overrides) ? { ...meth, overrides: undefined } : meth,\n );\n }\n }\n }\n typeInfo.methods = typeInfo.methods ? methods : undefined;\n if (typeInfo.properties) {\n for (const prop of typeInfo.properties) {\n if (prop.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${prop.name}`)) {\n this.nodesToRemove.add(bindings.getParameterRelatedNode(prop)!);\n } else {\n properties.push(\n prop.overrides != null && strippedFqns.has(prop.overrides) ? { ...prop, overrides: undefined } : prop,\n );\n }\n }\n }\n typeInfo.properties = typeInfo.properties ? properties : undefined;\n }\n\n const diagnostics = this.findLeftoverUseOfDeprecatedAPIs(assembly, strippedFqns);\n\n // Remove all `@deprecated` types, after we did everything, so we could\n // still access the related nodes from the assembly object.\n for (const fqn of strippedFqns) {\n if (this.shouldFqnBeStripped(fqn)) {\n delete assembly.types[fqn];\n }\n }\n\n return diagnostics;\n }\n\n private findLeftoverUseOfDeprecatedAPIs(assembly: Assembly, strippedFqns: Set<string>): readonly JsiiDiagnostic[] {\n if (assembly.types == null) {\n return [];\n }\n\n const result = new Array<JsiiDiagnostic>();\n\n for (const type of Object.values(assembly.types)) {\n if (isEnumType(type) || strippedFqns.has(type.fqn)) {\n continue;\n }\n if (isClassType(type) && type.initializer) {\n result.push(...this.verifyCallable(assembly, strippedFqns, type.initializer));\n }\n if (type.methods) {\n for (const method of type.methods) result.push(...this.verifyCallable(assembly, strippedFqns, method));\n }\n if (type.properties) {\n for (const property of type.properties) result.push(...this.verifyProperty(assembly, strippedFqns, property));\n }\n }\n\n return result;\n }\n\n private verifyCallable(\n assembly: Assembly,\n strippedFqns: ReadonlySet<string>,\n method: Method | Initializer,\n ): readonly JsiiDiagnostic[] {\n const diagnostics = new Array<JsiiDiagnostic>();\n const deprecatedReturnFqn =\n isMethod(method) && method.returns && this.tryFindReference(method.returns.type, strippedFqns);\n if (deprecatedReturnFqn) {\n diagnostics.push(this.makeDiagnostic(deprecatedReturnFqn, 'Method', method, assembly));\n }\n\n if (method.parameters) {\n for (const parameter of method.parameters) {\n const deprecatedTypeFqn = this.tryFindReference(parameter.type, strippedFqns);\n if (deprecatedTypeFqn) {\n diagnostics.push(this.makeDiagnostic(deprecatedTypeFqn, 'Parameter', parameter, assembly));\n }\n }\n }\n return diagnostics;\n }\n\n private verifyProperty(\n assembly: Assembly,\n strippedFqns: ReadonlySet<string>,\n property: Property,\n ): readonly JsiiDiagnostic[] {\n const deprecatedTypeFqn = this.tryFindReference(property.type, strippedFqns);\n if (deprecatedTypeFqn) {\n return [this.makeDiagnostic(deprecatedTypeFqn, 'Property', property, assembly)];\n }\n return [];\n }\n\n /**\n * Determines whether a `TypeReference` contains an FQN within a given set.\n *\n * @param ref the tested `TypeReference`.\n * @param fqns the set of FQNs that are being searched for.\n *\n * @returns the first FQN that was identified.\n */\n private tryFindReference(ref: TypeReference, fqns: ReadonlySet<string>): string | undefined {\n if (isNamedTypeReference(ref)) {\n return fqns.has(ref.fqn) ? ref.fqn : undefined;\n }\n if (isPrimitiveTypeReference(ref)) {\n return undefined;\n }\n if (isCollectionTypeReference(ref)) {\n return this.tryFindReference(ref.collection.elementtype, fqns);\n }\n return ref.union.types.map((type) => this.tryFindReference(type, fqns)).find((typeRef) => typeRef != null);\n }\n\n private shouldFqnBeStripped(fqn: string) {\n return this.allowlistedDeprecations?.has(fqn) ?? true;\n }\n\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Method',\n context: Method | Initializer,\n assembly: Assembly,\n ): JsiiDiagnostic;\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Parameter',\n context: Parameter,\n assembly: Assembly,\n ): JsiiDiagnostic;\n private makeDiagnostic(fqn: string, messagePrefix: 'Property', context: Property, assembly: Assembly): JsiiDiagnostic;\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Method' | 'Property' | 'Parameter',\n context: Method | Initializer | Parameter | Property,\n assembly: Assembly,\n ): JsiiDiagnostic {\n const node = bindings.getRelatedNode<\n | ts.AccessorDeclaration\n | ts.MethodDeclaration\n | ts.MethodSignature\n | ts.ParameterDeclaration\n | ts.PropertyDeclaration\n | ts.PropertySignature\n >(context);\n const diagnostic = JsiiDiagnostic.JSII_3999_INCOHERENT_TYPE_MODEL.create(\n node?.type ?? node!,\n `${messagePrefix} has @deprecated type ${fqn}, and it is erased by --strip-deprecated.`,\n );\n\n const typeInfo = assembly.types?.[fqn];\n const typeNode = typeInfo && bindings.getTypeRelatedNode(typeInfo);\n if (typeNode == null) {\n return diagnostic;\n }\n return diagnostic.addRelatedInformation(\n ts.getNameOfDeclaration(typeNode) ?? typeNode,\n 'The @deprecated type is declared here',\n );\n }\n}\n\nclass Transformation {\n public static addInterface(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration | ts.InterfaceDeclaration,\n iface: ts.InterfaceDeclaration | string,\n ) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration) && !ts.isInterfaceDeclaration(declaration)) {\n throw new JsiiError(\n `Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`,\n );\n }\n\n const { typeExpression: newInterface, syntheticImport } = Transformation.typeReference(\n iface,\n declaration,\n typeChecker,\n );\n if (ts.isClassDeclaration(declaration)) {\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n addInterfaceTo(ts.SyntaxKind.ImplementsKeyword, declaration.heritageClauses),\n declaration.members,\n ),\n syntheticImport,\n };\n }\n return {\n node: ts.factory.updateInterfaceDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n addInterfaceTo(ts.SyntaxKind.ExtendsKeyword, declaration.heritageClauses),\n declaration.members,\n ),\n syntheticImport,\n };\n\n function addInterfaceTo(\n token: ts.HeritageClause['token'],\n clauses: readonly ts.HeritageClause[] = [],\n ): ts.HeritageClause[] {\n const existingClause = clauses.find((clause) => clause.token === token);\n if (existingClause == null) {\n return [...clauses, ts.factory.createHeritageClause(token, [newInterface])];\n }\n return [\n ...clauses.filter((clause) => clause !== existingClause),\n ts.factory.updateHeritageClause(existingClause, [...existingClause.types, newInterface]),\n ];\n }\n });\n }\n\n public static replaceBaseClass(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration,\n baseClass: ts.ClassDeclaration | string,\n ) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration)) {\n throw new JsiiError(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);\n }\n const { typeExpression: newBaseClass, syntheticImport } = Transformation.typeReference(\n baseClass,\n declaration,\n typeChecker,\n );\n const existingClause = declaration.heritageClauses?.find(\n (clause) => clause.token === ts.SyntaxKind.ExtendsKeyword,\n );\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n [\n ...(declaration.heritageClauses ?? []).filter((clause) => clause !== existingClause),\n existingClause\n ? ts.factory.updateHeritageClause(existingClause, [newBaseClass])\n : ts.factory.createHeritageClause(ts.SyntaxKind.ExtendsKeyword, [newBaseClass]),\n ],\n declaration.members,\n ),\n syntheticImports: syntheticImport && [syntheticImport],\n };\n });\n }\n\n public static removeBaseClass(typeChecker: ts.TypeChecker, node: ts.ClassDeclaration) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration)) {\n throw new JsiiError(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);\n }\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n declaration.heritageClauses?.filter((clause) => clause.token !== ts.SyntaxKind.ExtendsKeyword),\n declaration.members,\n ),\n };\n });\n }\n\n public static removeInterface(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration | ts.InterfaceDeclaration,\n iface: ts.InterfaceDeclaration,\n ) {\n const ifaceName = Transformation.fullyQualifiedName(typeChecker, iface)!;\n\n return new Transformation(typeChecker, node, (declaration) => {\n if (ts.isClassDeclaration(declaration)) {\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n removeInterfaceHeritage(declaration.heritageClauses),\n declaration.members,\n ),\n };\n } else if (ts.isInterfaceDeclaration(declaration)) {\n return {\n node: ts.factory.updateInterfaceDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n removeInterfaceHeritage(declaration.heritageClauses),\n declaration.members,\n ),\n };\n }\n throw new JsiiError(\n `Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`,\n );\n });\n\n function removeInterfaceHeritage(\n clauses: readonly ts.HeritageClause[] | undefined,\n ): ts.HeritageClause[] | undefined {\n if (clauses == null) {\n return clauses;\n }\n return clauses\n .map((clause) => {\n const types = clause.types.filter(\n (type) => Transformation.fullyQualifiedName(typeChecker, type.expression) !== ifaceName,\n );\n if (types.length === clause.types.length) {\n // Means the interface was only transitively present...\n return clause;\n }\n if (types.length === 0) {\n return undefined;\n }\n return ts.factory.updateHeritageClause(clause, types);\n })\n .filter((clause) => clause != null) as ts.HeritageClause[];\n }\n }\n\n private static fullyQualifiedName(typeChecker: ts.TypeChecker, node: ts.Node): string | undefined {\n const symbol = typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(node as ts.Declaration) ?? node);\n // This symbol ☝️ does not contain enough information in some cases - when\n // an imported type is part of a heritage clause - to produce the fqn.\n // Round tripping this to its type and back to a symbol seems to fix this.\n const type = symbol && typeChecker.getDeclaredTypeOfSymbol(symbol);\n return type?.symbol && typeChecker.getFullyQualifiedName(type.symbol);\n }\n\n private static typeReference(\n type: ts.ClassDeclaration | ts.InterfaceDeclaration | string,\n context: ts.ClassDeclaration | ts.InterfaceDeclaration,\n typeChecker: ts.TypeChecker,\n ): {\n typeExpression: ts.ExpressionWithTypeArguments;\n syntheticImport?: ts.ImportDeclaration;\n } {\n context = ts.getOriginalNode(context) as any;\n\n const [, contextSource] = /^\"([^\"]+)\"\\..*$/.exec(\n typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(context)!)!),\n )!;\n\n let expression: ts.Expression;\n let syntheticImport: ts.ImportDeclaration | undefined;\n\n if (typeof type === 'string') {\n const [root, ...tail] = type.split('.');\n const syntheticImportName = ts.factory.createUniqueName(root);\n syntheticImport = ts.factory.createImportDeclaration(\n undefined /* decorators */,\n ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(syntheticImportName)),\n ts.factory.createStringLiteral(root),\n );\n expression = tail.reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n syntheticImportName as ts.Expression,\n );\n } else {\n const [, typeSource, qualifiedName] = /^\"([^\"]+)\"\\.(.*)$/.exec(\n typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(type)!)!),\n )!;\n\n if (typeSource === contextSource) {\n const [root, ...tail] = qualifiedName.split('.');\n expression = tail.reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n ts.factory.createIdentifier(root) as ts.Expression,\n );\n } else {\n const syntheticImportName = ts.factory.createUniqueName(basename(typeSource));\n syntheticImport = ts.factory.createImportDeclaration(\n undefined /* modifiers */,\n ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(syntheticImportName)),\n ts.factory.createStringLiteral(`./${relative(dirname(contextSource), typeSource)}`),\n undefined,\n );\n expression = qualifiedName\n .split('.')\n .reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n syntheticImportName as ts.Expression,\n );\n }\n }\n\n return {\n typeExpression: ts.factory.createExpressionWithTypeArguments(expression, undefined),\n syntheticImport,\n };\n }\n\n private readonly nodeName: string;\n\n private constructor(\n private readonly typeChecker: ts.TypeChecker,\n node: ts.Declaration,\n public readonly apply: (\n this: Transformation,\n node: ts.Node,\n ) => { node: ts.Node; syntheticImport?: ts.ImportDeclaration },\n ) {\n this.nodeName = Transformation.fullyQualifiedName(typeChecker, node)!;\n }\n\n public targets(node: ts.Declaration) {\n return this.nodeName === Transformation.fullyQualifiedName(this.typeChecker, node);\n }\n}\n\nclass DeprecationRemovalTransformer {\n /**\n * A list of SyntaxKinds for which it is not necessary to evaluate children,\n * since they are never of interest to this transform. This opens up a wee\n * optimization, which is particularly useful when trying to troubleshoot the\n * transform in a debugger (saves a TON of time stepping into useless nodes\n * then).\n */\n private static readonly IGNORE_CHILDREN: ReadonlySet<ts.SyntaxKind> = new Set([\n ts.SyntaxKind.Constructor,\n ts.SyntaxKind.FunctionDeclaration,\n ts.SyntaxKind.GetAccessor,\n ts.SyntaxKind.MethodDeclaration,\n ts.SyntaxKind.MethodSignature,\n ts.SyntaxKind.PropertySignature,\n ts.SyntaxKind.PropertyDeclaration,\n ts.SyntaxKind.SetAccessor,\n ts.SyntaxKind.VariableDeclaration,\n ]);\n\n private syntheticImports = new Array<ts.ImportDeclaration>();\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly context: ts.TransformationContext,\n private readonly transformations: readonly Transformation[],\n private readonly nodesToRemove: Set<ts.Node>,\n ) {}\n\n public transform<T extends ts.Node>(node: T): T {\n let result = this.visitEachChild(node);\n\n // If there are any synthetic imports, add them to the source file\n if (ts.isSourceFile(result) && this.syntheticImports.length > 0) {\n result = this.context.factory.updateSourceFile(\n result,\n [...this.syntheticImports, ...result.statements],\n result.isDeclarationFile,\n result.referencedFiles,\n result.typeReferenceDirectives,\n result.hasNoDefaultLib,\n result.libReferenceDirectives,\n ) as any;\n this.syntheticImports = new Array<ts.ImportDeclaration>();\n }\n\n return result;\n }\n\n private visitEachChild<T extends ts.Node>(node: T): T {\n return ts.visitEachChild(node, this.visitor.bind(this), this.context);\n }\n\n private visitor<T extends ts.Node>(node: T): ts.VisitResult<T> {\n if (this.isDeprecated(node)) {\n // Removing deprecated members by substituting \"nothing\" to them\n return [];\n }\n\n if (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) {\n for (const transformation of this.transformations) {\n // 👇 as any because the assignment below confuses type checker\n if (transformation.targets(node as any)) {\n const { node: transformedNode, syntheticImport } = transformation.apply(node);\n node = transformedNode as any;\n if (syntheticImport) {\n this.syntheticImports.push(syntheticImport);\n }\n }\n }\n }\n\n // Remove named imports of `@deprecated` members from the source...\n if (\n ts.isImportDeclaration(node) &&\n node.importClause &&\n node.importClause.namedBindings &&\n ts.isNamedImports(node.importClause.namedBindings)\n ) {\n const filteredElements = node.importClause.namedBindings.elements.filter((element) => {\n // This symbol is local (it's declaration points back to the named import)\n const symbol = this.typeChecker.getSymbolAtLocation(element.name);\n const exportedSymbol =\n // This \"resolves\" the imported type, so we can get to it's declaration(s)\n symbol && this.typeChecker.getDeclaredTypeOfSymbol(symbol)?.symbol;\n return !exportedSymbol?.declarations?.some((decl) => this.isDeprecated(decl));\n });\n if (filteredElements.length !== node.importClause.namedBindings.elements.length) {\n return this.context.factory.updateImportDeclaration(\n node,\n node.modifiers,\n node.importClause.name != null || filteredElements.length > 0\n ? this.context.factory.updateImportClause(\n node.importClause,\n node.importClause.isTypeOnly,\n node.importClause.name,\n this.context.factory.updateNamedImports(node.importClause.namedBindings, filteredElements),\n )\n : undefined,\n node.moduleSpecifier,\n node.assertClause,\n ) as any;\n }\n\n return node;\n }\n\n // Replace \"export ... from ...\" places that no longer export anything\n // with an \"import from ...\", so side effects are preserved.\n if (ts.isExportDeclaration(node) && node.moduleSpecifier) {\n const symbol = this.typeChecker.getSymbolAtLocation(node.moduleSpecifier);\n const moduleExports =\n symbol &&\n this.typeChecker\n .getExportsOfModule(symbol)\n ?.filter((sym) => !sym.declarations?.some((decl) => this.isDeprecated(decl)));\n if ((node.exportClause == null || ts.isNamespaceExport(node.exportClause)) && moduleExports?.length === 0) {\n return this.context.factory.createImportDeclaration(\n undefined /* modifiers */,\n undefined /* importClause */,\n node.moduleSpecifier,\n ) as any;\n }\n\n if (node.exportClause != null && moduleExports) {\n const namedExports = node.exportClause as ts.NamedExports;\n const exportedNames = new Set(moduleExports.map((sym) => sym.name));\n const filteredElements = namedExports.elements?.filter((elt) => exportedNames.has(elt.name.text));\n if (filteredElements?.length !== namedExports.elements?.length) {\n return this.context.factory.updateExportDeclaration(\n node,\n node.modifiers,\n node.isTypeOnly,\n this.context.factory.updateNamedExports(namedExports, filteredElements),\n node.moduleSpecifier,\n node.assertClause,\n ) as any;\n }\n }\n }\n\n return DeprecationRemovalTransformer.IGNORE_CHILDREN.has(node.kind) ? node : this.visitEachChild(node);\n }\n\n private isDeprecated(node: ts.Node): boolean {\n const original = ts.getOriginalNode(node);\n return (\n this.nodesToRemove.has(original) && ts.getJSDocTags(original).some((tag) => tag.tagName.text === 'deprecated')\n );\n }\n}\n"]}
1
+ {"version":3,"file":"deprecated-remover.js","sourceRoot":"","sources":["../../src/transforms/deprecated-remover.ts"],"names":[],"mappings":";;;AAAA,yCAAwD;AACxD,qCAqBoB;AACpB,iCAAiC;AAEjC,wDAAoD;AACpD,6CAA6C;AAC7C,oCAAqC;AAErC,MAAa,iBAAiB;IAI5B,YACmB,WAA2B,EAC3B,uBAAgD;QADhD,gBAAW,GAAX,WAAW,CAAgB;QAC3B,4BAAuB,GAAvB,uBAAuB,CAAyB;QALlD,oBAAe,GAAG,IAAI,KAAK,EAAkB,CAAC;QAC9C,kBAAa,GAAG,IAAI,GAAG,EAAW,CAAC;IAKjD,CAAC;IAEJ;;;;;;OAMG;IACH,IAAW,k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C,KAAK,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC;IAC9B,CAAC;AACH,CAAC","sourcesContent":["import { basename, dirname, relative } from 'node:path';\nimport {\n Assembly,\n ClassType,\n EnumMember,\n Initializer,\n InterfaceType,\n IntersectionTypeReference,\n isClassOrInterfaceType,\n isClassType,\n isCollectionTypeReference,\n isEnumType,\n isMethod,\n isNamedTypeReference,\n isPrimitiveTypeReference,\n isUnionTypeReference,\n Method,\n Parameter,\n Property,\n Stability,\n TypeReference,\n UnionTypeReference,\n} from '@jsii/spec';\nimport * as ts from 'typescript';\n\nimport { JsiiDiagnostic } from '../jsii-diagnostic';\nimport * as bindings from '../node-bindings';\nimport { JsiiError } from '../utils';\n\nexport class DeprecatedRemover {\n private readonly transformations = new Array<Transformation>();\n private readonly nodesToRemove = new Set<ts.Node>();\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly allowlistedDeprecations: Set<string> | undefined,\n ) {}\n\n /**\n * Obtains the configuration for the TypeScript transform(s) that will remove\n * `@deprecated` members from the generated declarations (`.d.ts`) files. It\n * will leverage information accumulated during `#removeFrom(Assembly)` in\n * order to apply corrections to inheritance chains, ensuring a valid output\n * is produced.\n */\n public get customTransformers(): ts.CustomTransformers {\n return {\n afterDeclarations: [\n (context) => {\n const transformer = new DeprecationRemovalTransformer(\n this.typeChecker,\n context,\n this.transformations,\n this.nodesToRemove,\n );\n return transformer.transform.bind(transformer);\n },\n ],\n };\n }\n\n /**\n * Removes all `@deprecated` API elements from the provided assembly, and\n * records the operations needed in order to fix the inheritance chains that\n * mix `@deprecated` and non-`@deprecated` types.\n *\n * @param assembly the assembly to be modified.\n *\n * @returns diagnostic messages produced when validating no remaining API\n * makes use of a `@deprecated` type that was removed.\n */\n public removeFrom(assembly: Assembly): readonly JsiiDiagnostic[] {\n if (assembly.types == null) {\n return [];\n }\n\n const strippedFqns = new Set<string>();\n const replaceWithClass = new Map<string, string>();\n const replaceWithInterfaces = new Map<string, readonly string[]>();\n\n // Find all types that will be stripped out\n for (const [fqn, typeInfo] of Object.entries(assembly.types)) {\n if (typeInfo.docs?.stability === Stability.Deprecated) {\n if (!this.shouldFqnBeStripped(fqn)) {\n continue;\n }\n strippedFqns.add(fqn);\n\n if (isClassType(typeInfo) && typeInfo.base != null) {\n replaceWithClass.set(fqn, typeInfo.base);\n }\n if (isClassOrInterfaceType(typeInfo) && typeInfo.interfaces != null) {\n replaceWithInterfaces.set(fqn, typeInfo.interfaces);\n }\n\n this.nodesToRemove.add(bindings.getRelatedNode(typeInfo)!);\n }\n }\n\n for (const [fqn, typeInfo] of Object.entries(assembly.types)) {\n // Ignore `@deprecated` types\n if (strippedFqns.has(fqn)) {\n continue;\n }\n\n // Enums cannot have references to `@deprecated` types, but can have deprecated members\n if (isEnumType(typeInfo)) {\n const enumNode = bindings.getEnumRelatedNode(typeInfo)!;\n const members: EnumMember[] = [];\n for (const mem of typeInfo.members) {\n if (mem.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${mem.name}`)) {\n const matchingMemberNode = enumNode.members.find((enumMem) => enumMem.name.getText() === mem.name);\n if (matchingMemberNode) {\n this.nodesToRemove.add(matchingMemberNode);\n }\n } else {\n members.push(mem);\n }\n }\n typeInfo.members = members;\n continue;\n }\n\n // For classes, we erase `@deprecated` base classes, replacing as needed\n const additionalInterfaces = new Set<string>();\n if (isClassType(typeInfo) && typeInfo.base != null && strippedFqns.has(typeInfo.base)) {\n while (typeInfo.base != null && strippedFqns.has(typeInfo.base)) {\n const oldBase = assembly.types[typeInfo.base] as ClassType;\n if (oldBase.interfaces) for (const addFqn of oldBase.interfaces) additionalInterfaces.add(addFqn);\n typeInfo.base = replaceWithClass.get(typeInfo.base);\n }\n this.transformations.push(\n typeInfo.base != null\n ? Transformation.replaceBaseClass(\n this.typeChecker,\n bindings.getClassRelatedNode(typeInfo)!,\n typeInfo.base in assembly.types\n ? bindings.getClassRelatedNode(assembly.types[typeInfo.base] as ClassType) ?? typeInfo.base\n : typeInfo.base,\n )\n : Transformation.removeBaseClass(this.typeChecker, bindings.getClassRelatedNode(typeInfo)!),\n );\n }\n\n // Be defensive in case we add other kinds in the future\n if (!isClassOrInterfaceType(typeInfo)) {\n throw new Error(`Unhandled type encountered! ${JSON.stringify(typeInfo, null, 2)}`);\n }\n\n // Strip all `@deprecated` interfaces from the inheritance tree, replacing as needed\n if (typeInfo.interfaces?.some((addFqn) => strippedFqns.has(addFqn)) || additionalInterfaces.size > 0) {\n const originalSet = new Set(typeInfo.interfaces ?? []);\n const newSet = new Set<string>();\n\n const candidates = Array.from(new Set([...originalSet, ...additionalInterfaces]));\n while (candidates.length > 0) {\n const candidateFqn = candidates.pop()!;\n if (!strippedFqns.has(candidateFqn)) {\n newSet.add(candidateFqn);\n if (!originalSet.has(candidateFqn)) {\n this.transformations.push(\n Transformation.addInterface(\n this.typeChecker,\n bindings.getClassOrInterfaceRelatedNode(typeInfo)!,\n candidateFqn in assembly.types\n ? bindings.getInterfaceRelatedNode(assembly.types[candidateFqn] as InterfaceType) ?? candidateFqn\n : candidateFqn,\n ),\n );\n }\n continue;\n }\n if (originalSet.has(candidateFqn)) {\n this.transformations.push(\n Transformation.removeInterface(\n this.typeChecker,\n bindings.getClassOrInterfaceRelatedNode(typeInfo)!,\n bindings.getInterfaceRelatedNode(assembly.types[candidateFqn] as InterfaceType)!,\n ),\n );\n }\n const replacement = replaceWithInterfaces.get(candidateFqn);\n if (replacement != null) {\n candidates.push(...replacement);\n }\n }\n\n typeInfo.interfaces = newSet.size > 0 ? Array.from(newSet).sort() : undefined;\n }\n\n // Drop all `@deprecated` members, and remove \"overrides\" from stripped types\n const methods: Method[] = [];\n const properties: Property[] = [];\n if (typeInfo.methods) {\n for (const meth of typeInfo.methods) {\n if (meth.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${meth.name}`)) {\n this.nodesToRemove.add(bindings.getMethodRelatedNode(meth)!);\n } else {\n methods.push(\n meth.overrides != null && strippedFqns.has(meth.overrides) ? { ...meth, overrides: undefined } : meth,\n );\n }\n }\n }\n typeInfo.methods = typeInfo.methods ? methods : undefined;\n if (typeInfo.properties) {\n for (const prop of typeInfo.properties) {\n if (prop.docs?.stability === Stability.Deprecated && this.shouldFqnBeStripped(`${fqn}#${prop.name}`)) {\n this.nodesToRemove.add(bindings.getParameterRelatedNode(prop)!);\n } else {\n properties.push(\n prop.overrides != null && strippedFqns.has(prop.overrides) ? { ...prop, overrides: undefined } : prop,\n );\n }\n }\n }\n typeInfo.properties = typeInfo.properties ? properties : undefined;\n }\n\n const diagnostics = this.findLeftoverUseOfDeprecatedAPIs(assembly, strippedFqns);\n\n // Remove all `@deprecated` types, after we did everything, so we could\n // still access the related nodes from the assembly object.\n for (const fqn of strippedFqns) {\n if (this.shouldFqnBeStripped(fqn)) {\n delete assembly.types[fqn];\n }\n }\n\n return diagnostics;\n }\n\n private findLeftoverUseOfDeprecatedAPIs(assembly: Assembly, strippedFqns: Set<string>): readonly JsiiDiagnostic[] {\n if (assembly.types == null) {\n return [];\n }\n\n const result = new Array<JsiiDiagnostic>();\n\n for (const type of Object.values(assembly.types)) {\n if (isEnumType(type) || strippedFqns.has(type.fqn)) {\n continue;\n }\n if (isClassType(type) && type.initializer) {\n result.push(...this.verifyCallable(assembly, strippedFqns, type.initializer));\n }\n if (type.methods) {\n for (const method of type.methods) result.push(...this.verifyCallable(assembly, strippedFqns, method));\n }\n if (type.properties) {\n for (const property of type.properties) result.push(...this.verifyProperty(assembly, strippedFqns, property));\n }\n }\n\n return result;\n }\n\n private verifyCallable(\n assembly: Assembly,\n strippedFqns: ReadonlySet<string>,\n method: Method | Initializer,\n ): readonly JsiiDiagnostic[] {\n const diagnostics = new Array<JsiiDiagnostic>();\n const deprecatedReturnFqn =\n isMethod(method) && method.returns && this.tryFindReference(method.returns.type, strippedFqns);\n if (deprecatedReturnFqn) {\n diagnostics.push(this.makeDiagnostic(deprecatedReturnFqn, 'Method', method, assembly));\n }\n\n if (method.parameters) {\n for (const parameter of method.parameters) {\n const deprecatedTypeFqn = this.tryFindReference(parameter.type, strippedFqns);\n if (deprecatedTypeFqn) {\n diagnostics.push(this.makeDiagnostic(deprecatedTypeFqn, 'Parameter', parameter, assembly));\n }\n }\n }\n return diagnostics;\n }\n\n private verifyProperty(\n assembly: Assembly,\n strippedFqns: ReadonlySet<string>,\n property: Property,\n ): readonly JsiiDiagnostic[] {\n const deprecatedTypeFqn = this.tryFindReference(property.type, strippedFqns);\n if (deprecatedTypeFqn) {\n return [this.makeDiagnostic(deprecatedTypeFqn, 'Property', property, assembly)];\n }\n return [];\n }\n\n /**\n * Determines whether a `TypeReference` contains an FQN within a given set.\n *\n * @param ref the tested `TypeReference`.\n * @param fqns the set of FQNs that are being searched for.\n *\n * @returns the first FQN that was identified.\n */\n private tryFindReference(ref: TypeReference, fqns: ReadonlySet<string>): string | undefined {\n if (isNamedTypeReference(ref)) {\n return fqns.has(ref.fqn) ? ref.fqn : undefined;\n }\n if (isPrimitiveTypeReference(ref)) {\n return undefined;\n }\n if (isCollectionTypeReference(ref)) {\n return this.tryFindReference(ref.collection.elementtype, fqns);\n }\n\n return setTypeMembers(ref)\n .map((type) => this.tryFindReference(type, fqns))\n .find((typeRef) => typeRef != null);\n }\n\n private shouldFqnBeStripped(fqn: string) {\n return this.allowlistedDeprecations?.has(fqn) ?? true;\n }\n\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Method',\n context: Method | Initializer,\n assembly: Assembly,\n ): JsiiDiagnostic;\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Parameter',\n context: Parameter,\n assembly: Assembly,\n ): JsiiDiagnostic;\n private makeDiagnostic(fqn: string, messagePrefix: 'Property', context: Property, assembly: Assembly): JsiiDiagnostic;\n private makeDiagnostic(\n fqn: string,\n messagePrefix: 'Method' | 'Property' | 'Parameter',\n context: Method | Initializer | Parameter | Property,\n assembly: Assembly,\n ): JsiiDiagnostic {\n const node = bindings.getRelatedNode<\n | ts.AccessorDeclaration\n | ts.MethodDeclaration\n | ts.MethodSignature\n | ts.ParameterDeclaration\n | ts.PropertyDeclaration\n | ts.PropertySignature\n >(context);\n const diagnostic = JsiiDiagnostic.JSII_3999_INCOHERENT_TYPE_MODEL.create(\n node?.type ?? node!,\n `${messagePrefix} has @deprecated type ${fqn}, and it is erased by --strip-deprecated.`,\n );\n\n const typeInfo = assembly.types?.[fqn];\n const typeNode = typeInfo && bindings.getTypeRelatedNode(typeInfo);\n if (typeNode == null) {\n return diagnostic;\n }\n return diagnostic.addRelatedInformation(\n ts.getNameOfDeclaration(typeNode) ?? typeNode,\n 'The @deprecated type is declared here',\n );\n }\n}\n\nclass Transformation {\n public static addInterface(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration | ts.InterfaceDeclaration,\n iface: ts.InterfaceDeclaration | string,\n ) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration) && !ts.isInterfaceDeclaration(declaration)) {\n throw new JsiiError(\n `Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`,\n );\n }\n\n const { typeExpression: newInterface, syntheticImport } = Transformation.typeReference(\n iface,\n declaration,\n typeChecker,\n );\n if (ts.isClassDeclaration(declaration)) {\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n addInterfaceTo(ts.SyntaxKind.ImplementsKeyword, declaration.heritageClauses),\n declaration.members,\n ),\n syntheticImport,\n };\n }\n return {\n node: ts.factory.updateInterfaceDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n addInterfaceTo(ts.SyntaxKind.ExtendsKeyword, declaration.heritageClauses),\n declaration.members,\n ),\n syntheticImport,\n };\n\n function addInterfaceTo(\n token: ts.HeritageClause['token'],\n clauses: readonly ts.HeritageClause[] = [],\n ): ts.HeritageClause[] {\n const existingClause = clauses.find((clause) => clause.token === token);\n if (existingClause == null) {\n return [...clauses, ts.factory.createHeritageClause(token, [newInterface])];\n }\n return [\n ...clauses.filter((clause) => clause !== existingClause),\n ts.factory.updateHeritageClause(existingClause, [...existingClause.types, newInterface]),\n ];\n }\n });\n }\n\n public static replaceBaseClass(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration,\n baseClass: ts.ClassDeclaration | string,\n ) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration)) {\n throw new JsiiError(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);\n }\n const { typeExpression: newBaseClass, syntheticImport } = Transformation.typeReference(\n baseClass,\n declaration,\n typeChecker,\n );\n const existingClause = declaration.heritageClauses?.find(\n (clause) => clause.token === ts.SyntaxKind.ExtendsKeyword,\n );\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n [\n ...(declaration.heritageClauses ?? []).filter((clause) => clause !== existingClause),\n existingClause\n ? ts.factory.updateHeritageClause(existingClause, [newBaseClass])\n : ts.factory.createHeritageClause(ts.SyntaxKind.ExtendsKeyword, [newBaseClass]),\n ],\n declaration.members,\n ),\n syntheticImports: syntheticImport && [syntheticImport],\n };\n });\n }\n\n public static removeBaseClass(typeChecker: ts.TypeChecker, node: ts.ClassDeclaration) {\n return new Transformation(typeChecker, node, (declaration) => {\n if (!ts.isClassDeclaration(declaration)) {\n throw new JsiiError(`Expected a ClassDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`);\n }\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n declaration.heritageClauses?.filter((clause) => clause.token !== ts.SyntaxKind.ExtendsKeyword),\n declaration.members,\n ),\n };\n });\n }\n\n public static removeInterface(\n typeChecker: ts.TypeChecker,\n node: ts.ClassDeclaration | ts.InterfaceDeclaration,\n iface: ts.InterfaceDeclaration,\n ) {\n const ifaceName = Transformation.fullyQualifiedName(typeChecker, iface)!;\n\n return new Transformation(typeChecker, node, (declaration) => {\n if (ts.isClassDeclaration(declaration)) {\n return {\n node: ts.factory.updateClassDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n removeInterfaceHeritage(declaration.heritageClauses),\n declaration.members,\n ),\n };\n } else if (ts.isInterfaceDeclaration(declaration)) {\n return {\n node: ts.factory.updateInterfaceDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n removeInterfaceHeritage(declaration.heritageClauses),\n declaration.members,\n ),\n };\n }\n throw new JsiiError(\n `Expected a ClassDeclaration or InterfaceDeclaration, found a ${ts.SyntaxKind[declaration.kind]}`,\n );\n });\n\n function removeInterfaceHeritage(\n clauses: readonly ts.HeritageClause[] | undefined,\n ): ts.HeritageClause[] | undefined {\n if (clauses == null) {\n return clauses;\n }\n return clauses\n .map((clause) => {\n const types = clause.types.filter(\n (type) => Transformation.fullyQualifiedName(typeChecker, type.expression) !== ifaceName,\n );\n if (types.length === clause.types.length) {\n // Means the interface was only transitively present...\n return clause;\n }\n if (types.length === 0) {\n return undefined;\n }\n return ts.factory.updateHeritageClause(clause, types);\n })\n .filter((clause) => clause != null) as ts.HeritageClause[];\n }\n }\n\n private static fullyQualifiedName(typeChecker: ts.TypeChecker, node: ts.Node): string | undefined {\n const symbol = typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(node as ts.Declaration) ?? node);\n // This symbol ☝️ does not contain enough information in some cases - when\n // an imported type is part of a heritage clause - to produce the fqn.\n // Round tripping this to its type and back to a symbol seems to fix this.\n const type = symbol && typeChecker.getDeclaredTypeOfSymbol(symbol);\n return type?.symbol && typeChecker.getFullyQualifiedName(type.symbol);\n }\n\n private static typeReference(\n type: ts.ClassDeclaration | ts.InterfaceDeclaration | string,\n context: ts.ClassDeclaration | ts.InterfaceDeclaration,\n typeChecker: ts.TypeChecker,\n ): {\n typeExpression: ts.ExpressionWithTypeArguments;\n syntheticImport?: ts.ImportDeclaration;\n } {\n context = ts.getOriginalNode(context) as any;\n\n const [, contextSource] = /^\"([^\"]+)\"\\..*$/.exec(\n typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(context)!)!),\n )!;\n\n let expression: ts.Expression;\n let syntheticImport: ts.ImportDeclaration | undefined;\n\n if (typeof type === 'string') {\n const [root, ...tail] = type.split('.');\n const syntheticImportName = ts.factory.createUniqueName(root);\n syntheticImport = ts.factory.createImportDeclaration(\n undefined /* decorators */,\n ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(syntheticImportName)),\n ts.factory.createStringLiteral(root),\n );\n expression = tail.reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n syntheticImportName as ts.Expression,\n );\n } else {\n const [, typeSource, qualifiedName] = /^\"([^\"]+)\"\\.(.*)$/.exec(\n typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(type)!)!),\n )!;\n\n if (typeSource === contextSource) {\n const [root, ...tail] = qualifiedName.split('.');\n expression = tail.reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n ts.factory.createIdentifier(root) as ts.Expression,\n );\n } else {\n const syntheticImportName = ts.factory.createUniqueName(basename(typeSource));\n syntheticImport = ts.factory.createImportDeclaration(\n undefined /* modifiers */,\n ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(syntheticImportName)),\n ts.factory.createStringLiteral(`./${relative(dirname(contextSource), typeSource)}`),\n undefined,\n );\n expression = qualifiedName\n .split('.')\n .reduce(\n (curr, elt) => ts.factory.createPropertyAccessExpression(curr, elt),\n syntheticImportName as ts.Expression,\n );\n }\n }\n\n return {\n typeExpression: ts.factory.createExpressionWithTypeArguments(expression, undefined),\n syntheticImport,\n };\n }\n\n private readonly nodeName: string;\n\n private constructor(\n private readonly typeChecker: ts.TypeChecker,\n node: ts.Declaration,\n public readonly apply: (\n this: Transformation,\n node: ts.Node,\n ) => { node: ts.Node; syntheticImport?: ts.ImportDeclaration },\n ) {\n this.nodeName = Transformation.fullyQualifiedName(typeChecker, node)!;\n }\n\n public targets(node: ts.Declaration) {\n return this.nodeName === Transformation.fullyQualifiedName(this.typeChecker, node);\n }\n}\n\nclass DeprecationRemovalTransformer {\n /**\n * A list of SyntaxKinds for which it is not necessary to evaluate children,\n * since they are never of interest to this transform. This opens up a wee\n * optimization, which is particularly useful when trying to troubleshoot the\n * transform in a debugger (saves a TON of time stepping into useless nodes\n * then).\n */\n private static readonly IGNORE_CHILDREN: ReadonlySet<ts.SyntaxKind> = new Set([\n ts.SyntaxKind.Constructor,\n ts.SyntaxKind.FunctionDeclaration,\n ts.SyntaxKind.GetAccessor,\n ts.SyntaxKind.MethodDeclaration,\n ts.SyntaxKind.MethodSignature,\n ts.SyntaxKind.PropertySignature,\n ts.SyntaxKind.PropertyDeclaration,\n ts.SyntaxKind.SetAccessor,\n ts.SyntaxKind.VariableDeclaration,\n ]);\n\n private syntheticImports = new Array<ts.ImportDeclaration>();\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly context: ts.TransformationContext,\n private readonly transformations: readonly Transformation[],\n private readonly nodesToRemove: Set<ts.Node>,\n ) {}\n\n public transform<T extends ts.Node>(node: T): T {\n let result = this.visitEachChild(node);\n\n // If there are any synthetic imports, add them to the source file\n if (ts.isSourceFile(result) && this.syntheticImports.length > 0) {\n result = this.context.factory.updateSourceFile(\n result,\n [...this.syntheticImports, ...result.statements],\n result.isDeclarationFile,\n result.referencedFiles,\n result.typeReferenceDirectives,\n result.hasNoDefaultLib,\n result.libReferenceDirectives,\n ) as any;\n this.syntheticImports = new Array<ts.ImportDeclaration>();\n }\n\n return result;\n }\n\n private visitEachChild<T extends ts.Node>(node: T): T {\n return ts.visitEachChild(node, this.visitor.bind(this), this.context);\n }\n\n private visitor<T extends ts.Node>(node: T): ts.VisitResult<T> {\n if (this.isDeprecated(node)) {\n // Removing deprecated members by substituting \"nothing\" to them\n return [];\n }\n\n if (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) {\n for (const transformation of this.transformations) {\n // 👇 as any because the assignment below confuses type checker\n if (transformation.targets(node as any)) {\n const { node: transformedNode, syntheticImport } = transformation.apply(node);\n node = transformedNode as any;\n if (syntheticImport) {\n this.syntheticImports.push(syntheticImport);\n }\n }\n }\n }\n\n // Remove named imports of `@deprecated` members from the source...\n if (\n ts.isImportDeclaration(node) &&\n node.importClause &&\n node.importClause.namedBindings &&\n ts.isNamedImports(node.importClause.namedBindings)\n ) {\n const filteredElements = node.importClause.namedBindings.elements.filter((element) => {\n // This symbol is local (it's declaration points back to the named import)\n const symbol = this.typeChecker.getSymbolAtLocation(element.name);\n const exportedSymbol =\n // This \"resolves\" the imported type, so we can get to it's declaration(s)\n symbol && this.typeChecker.getDeclaredTypeOfSymbol(symbol)?.symbol;\n return !exportedSymbol?.declarations?.some((decl) => this.isDeprecated(decl));\n });\n if (filteredElements.length !== node.importClause.namedBindings.elements.length) {\n return this.context.factory.updateImportDeclaration(\n node,\n node.modifiers,\n node.importClause.name != null || filteredElements.length > 0\n ? this.context.factory.updateImportClause(\n node.importClause,\n node.importClause.isTypeOnly,\n node.importClause.name,\n this.context.factory.updateNamedImports(node.importClause.namedBindings, filteredElements),\n )\n : undefined,\n node.moduleSpecifier,\n node.assertClause,\n ) as any;\n }\n\n return node;\n }\n\n // Replace \"export ... from ...\" places that no longer export anything\n // with an \"import from ...\", so side effects are preserved.\n if (ts.isExportDeclaration(node) && node.moduleSpecifier) {\n const symbol = this.typeChecker.getSymbolAtLocation(node.moduleSpecifier);\n const moduleExports =\n symbol &&\n this.typeChecker\n .getExportsOfModule(symbol)\n ?.filter((sym) => !sym.declarations?.some((decl) => this.isDeprecated(decl)));\n if ((node.exportClause == null || ts.isNamespaceExport(node.exportClause)) && moduleExports?.length === 0) {\n return this.context.factory.createImportDeclaration(\n undefined /* modifiers */,\n undefined /* importClause */,\n node.moduleSpecifier,\n ) as any;\n }\n\n if (node.exportClause != null && moduleExports) {\n const namedExports = node.exportClause as ts.NamedExports;\n const exportedNames = new Set(moduleExports.map((sym) => sym.name));\n const filteredElements = namedExports.elements?.filter((elt) => exportedNames.has(elt.name.text));\n if (filteredElements?.length !== namedExports.elements?.length) {\n return this.context.factory.updateExportDeclaration(\n node,\n node.modifiers,\n node.isTypeOnly,\n this.context.factory.updateNamedExports(namedExports, filteredElements),\n node.moduleSpecifier,\n node.assertClause,\n ) as any;\n }\n }\n }\n\n return DeprecationRemovalTransformer.IGNORE_CHILDREN.has(node.kind) ? node : this.visitEachChild(node);\n }\n\n private isDeprecated(node: ts.Node): boolean {\n const original = ts.getOriginalNode(node);\n return (\n this.nodesToRemove.has(original) && ts.getJSDocTags(original).some((tag) => tag.tagName.text === 'deprecated')\n );\n }\n}\n\nfunction setTypeMembers(x: UnionTypeReference | IntersectionTypeReference) {\n if (isUnionTypeReference(x)) {\n return x.union.types;\n } else {\n return x.intersection.types;\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import * as spec from '@jsii/spec';
2
+ /**
3
+ * Convert a type reference to a string
4
+ */
5
+ export declare function typeReferenceToString(x: spec.TypeReference): string;
6
+ /**
7
+ * Return whether the given type references are equal
8
+ */
9
+ export declare function typeReferenceEqual(a: spec.TypeReference, b: spec.TypeReference): boolean;
10
+ //# sourceMappingURL=type-reference.d.ts.map
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typeReferenceToString = typeReferenceToString;
4
+ exports.typeReferenceEqual = typeReferenceEqual;
5
+ const spec = require("@jsii/spec");
6
+ const type_visitor_1 = require("./type-visitor");
7
+ /**
8
+ * Convert a type reference to a string
9
+ */
10
+ function typeReferenceToString(x) {
11
+ return (0, type_visitor_1.visitTypeReference)(x, {
12
+ named: function (ref) {
13
+ return ref.fqn;
14
+ },
15
+ primitive: function (ref) {
16
+ return ref.primitive;
17
+ },
18
+ collection: function (ref) {
19
+ return `${ref.collection.kind}<${typeReferenceToString(ref.collection.elementtype)}>`;
20
+ },
21
+ union: function (ref) {
22
+ return ref.union.types.map(typeReferenceToString).join(' | ');
23
+ },
24
+ intersection: function (ref) {
25
+ return ref.intersection.types.map(typeReferenceToString).join(' & ');
26
+ },
27
+ });
28
+ }
29
+ /**
30
+ * Return whether the given type references are equal
31
+ */
32
+ function typeReferenceEqual(a, b) {
33
+ if (spec.isNamedTypeReference(a) && spec.isNamedTypeReference(b)) {
34
+ return a.fqn === b.fqn;
35
+ }
36
+ if (spec.isPrimitiveTypeReference(a) && spec.isPrimitiveTypeReference(b)) {
37
+ return a.primitive === b.primitive;
38
+ }
39
+ if (spec.isCollectionTypeReference(a) && spec.isCollectionTypeReference(b)) {
40
+ return (a.collection.kind === b.collection.kind && typeReferenceEqual(a.collection.elementtype, b.collection.elementtype));
41
+ }
42
+ if (spec.isUnionTypeReference(a) && spec.isUnionTypeReference(b)) {
43
+ return (a.union.types.length === b.union.types.length &&
44
+ a.union.types.every((aType, i) => typeReferenceEqual(aType, b.union.types[i])));
45
+ }
46
+ if (spec.isIntersectionTypeReference(a) && spec.isIntersectionTypeReference(b)) {
47
+ return (a.intersection.types.length === b.intersection.types.length &&
48
+ a.intersection.types.every((aType, i) => typeReferenceEqual(aType, b.intersection.types[i])));
49
+ }
50
+ return false;
51
+ }
52
+ //# sourceMappingURL=type-reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-reference.js","sourceRoot":"","sources":["../src/type-reference.ts"],"names":[],"mappings":";;AAMA,sDAkBC;AAKD,gDAyBC;AAtDD,mCAAmC;AACnC,iDAAoD;AAEpD;;GAEG;AACH,SAAgB,qBAAqB,CAAC,CAAqB;IACzD,OAAO,IAAA,iCAAkB,EAAS,CAAC,EAAE;QACnC,KAAK,EAAE,UAAU,GAA4B;YAC3C,OAAO,GAAG,CAAC,GAAG,CAAC;QACjB,CAAC;QACD,SAAS,EAAE,UAAU,GAAgC;YACnD,OAAO,GAAG,CAA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IACJ,CAAC;IACD,IAAI,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,OAAO,CACL,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM;YAC7C,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/E,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,OAAO,CACL,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM;YAC3D,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAC7F,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import * as spec from '@jsii/spec';\nimport { visitTypeReference } from './type-visitor';\n\n/**\n * Convert a type reference to a string\n */\nexport function typeReferenceToString(x: spec.TypeReference): string {\n return visitTypeReference<string>(x, {\n named: function (ref: spec.NamedTypeReference) {\n return ref.fqn;\n },\n primitive: function (ref: spec.PrimitiveTypeReference) {\n return ref.primitive;\n },\n collection: function (ref: spec.CollectionTypeReference) {\n return `${ref.collection.kind}<${typeReferenceToString(ref.collection.elementtype)}>`;\n },\n union: function (ref: spec.UnionTypeReference) {\n return ref.union.types.map(typeReferenceToString).join(' | ');\n },\n intersection: function (ref: spec.IntersectionTypeReference) {\n return ref.intersection.types.map(typeReferenceToString).join(' & ');\n },\n });\n}\n\n/**\n * Return whether the given type references are equal\n */\nexport function typeReferenceEqual(a: spec.TypeReference, b: spec.TypeReference): boolean {\n if (spec.isNamedTypeReference(a) && spec.isNamedTypeReference(b)) {\n return a.fqn === b.fqn;\n }\n if (spec.isPrimitiveTypeReference(a) && spec.isPrimitiveTypeReference(b)) {\n return a.primitive === b.primitive;\n }\n if (spec.isCollectionTypeReference(a) && spec.isCollectionTypeReference(b)) {\n return (\n a.collection.kind === b.collection.kind && typeReferenceEqual(a.collection.elementtype, b.collection.elementtype)\n );\n }\n if (spec.isUnionTypeReference(a) && spec.isUnionTypeReference(b)) {\n return (\n a.union.types.length === b.union.types.length &&\n a.union.types.every((aType, i) => typeReferenceEqual(aType, b.union.types[i]))\n );\n }\n if (spec.isIntersectionTypeReference(a) && spec.isIntersectionTypeReference(b)) {\n return (\n a.intersection.types.length === b.intersection.types.length &&\n a.intersection.types.every((aType, i) => typeReferenceEqual(aType, b.intersection.types[i]))\n );\n }\n return false;\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import * as spec from '@jsii/spec';
2
+ export interface TypeReferenceVisitor<A = void> {
3
+ named(ref: spec.NamedTypeReference): A;
4
+ primitive(ref: spec.PrimitiveTypeReference): A;
5
+ collection(ref: spec.CollectionTypeReference): A;
6
+ union(ref: spec.UnionTypeReference): A;
7
+ intersection(ref: spec.IntersectionTypeReference): A;
8
+ }
9
+ export declare function visitTypeReference<A>(typeRef: spec.TypeReference, visitor: TypeReferenceVisitor<A>): A;
10
+ export interface TypeVisitor<A = void> {
11
+ classType(t: spec.ClassType): A;
12
+ interfaceType(t: spec.InterfaceType): A;
13
+ dataType(t: spec.InterfaceType): A;
14
+ enumType(t: spec.EnumType): A;
15
+ }
16
+ export declare function visitType<A>(t: spec.Type, visitor: TypeVisitor<A>): A;
17
+ export declare function isDataType(t: spec.Type): t is spec.InterfaceType;
18
+ export declare function isBehavioralInterfaceType(t: spec.Type): t is spec.InterfaceType;
19
+ //# sourceMappingURL=type-visitor.d.ts.map
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.visitTypeReference = visitTypeReference;
4
+ exports.visitType = visitType;
5
+ exports.isDataType = isDataType;
6
+ exports.isBehavioralInterfaceType = isBehavioralInterfaceType;
7
+ const spec = require("@jsii/spec");
8
+ function visitTypeReference(typeRef, visitor) {
9
+ if (spec.isNamedTypeReference(typeRef)) {
10
+ return visitor.named(typeRef);
11
+ }
12
+ else if (spec.isPrimitiveTypeReference(typeRef)) {
13
+ return visitor.primitive(typeRef);
14
+ }
15
+ else if (spec.isCollectionTypeReference(typeRef)) {
16
+ return visitor.collection(typeRef);
17
+ }
18
+ else if (spec.isUnionTypeReference(typeRef)) {
19
+ return visitor.union(typeRef);
20
+ }
21
+ else if (spec.isIntersectionTypeReference(typeRef)) {
22
+ return visitor.intersection(typeRef);
23
+ }
24
+ else {
25
+ throw new Error(`Unknown type reference: ${JSON.stringify(typeRef)}`);
26
+ }
27
+ }
28
+ function visitType(t, visitor) {
29
+ if (spec.isClassType(t)) {
30
+ return visitor.classType(t);
31
+ }
32
+ else if (spec.isInterfaceType(t) && t.datatype) {
33
+ return visitor.dataType(t);
34
+ }
35
+ else if (spec.isInterfaceType(t)) {
36
+ return visitor.interfaceType(t);
37
+ }
38
+ else if (spec.isEnumType(t)) {
39
+ return visitor.enumType(t);
40
+ }
41
+ else {
42
+ throw new Error(`Unknown type: ${JSON.stringify(t)}`);
43
+ }
44
+ }
45
+ function isDataType(t) {
46
+ return spec.isInterfaceType(t) && !!t.datatype;
47
+ }
48
+ function isBehavioralInterfaceType(t) {
49
+ return spec.isInterfaceType(t) && !t.datatype;
50
+ }
51
+ //# sourceMappingURL=type-visitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-visitor.js","sourceRoot":"","sources":["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,CAAC;SAAM,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9B,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;AACH,CAAC;AAED,SAAgB,UAAU,CAAC,CAAY;IACrC,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACjD,CAAC;AAED,SAAgB,yBAAyB,CAAC,CAAY;IACpD,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChD,CAAC","sourcesContent":["import * as spec from '@jsii/spec';\n\nexport interface TypeReferenceVisitor<A = void> {\n named(ref: spec.NamedTypeReference): A;\n primitive(ref: spec.PrimitiveTypeReference): A;\n collection(ref: spec.CollectionTypeReference): A;\n union(ref: spec.UnionTypeReference): A;\n intersection(ref: spec.IntersectionTypeReference): A;\n}\n\nexport function visitTypeReference<A>(typeRef: spec.TypeReference, visitor: TypeReferenceVisitor<A>) {\n if (spec.isNamedTypeReference(typeRef)) {\n return visitor.named(typeRef);\n } else if (spec.isPrimitiveTypeReference(typeRef)) {\n return visitor.primitive(typeRef);\n } else if (spec.isCollectionTypeReference(typeRef)) {\n return visitor.collection(typeRef);\n } else if (spec.isUnionTypeReference(typeRef)) {\n return visitor.union(typeRef);\n } else if (spec.isIntersectionTypeReference(typeRef)) {\n return visitor.intersection(typeRef);\n } else {\n throw new Error(`Unknown type reference: ${JSON.stringify(typeRef)}`);\n }\n}\n\nexport interface TypeVisitor<A = void> {\n classType(t: spec.ClassType): A;\n interfaceType(t: spec.InterfaceType): A;\n dataType(t: spec.InterfaceType): A;\n enumType(t: spec.EnumType): A;\n}\n\nexport function visitType<A>(t: spec.Type, visitor: TypeVisitor<A>) {\n if (spec.isClassType(t)) {\n return visitor.classType(t);\n } else if (spec.isInterfaceType(t) && t.datatype) {\n return visitor.dataType(t);\n } else if (spec.isInterfaceType(t)) {\n return visitor.interfaceType(t);\n } else if (spec.isEnumType(t)) {\n return visitor.enumType(t);\n } else {\n throw new Error(`Unknown type: ${JSON.stringify(t)}`);\n }\n}\n\nexport function isDataType(t: spec.Type): t is spec.InterfaceType {\n return spec.isInterfaceType(t) && !!t.datatype;\n}\n\nexport function isBehavioralInterfaceType(t: spec.Type): t is spec.InterfaceType {\n return spec.isInterfaceType(t) && !t.datatype;\n}\n"]}
package/lib/validator.js CHANGED
@@ -111,14 +111,10 @@ function _defaultValidations() {
111
111
  for (const type of _allTypes(assembly)) {
112
112
  if (spec.isClassType(type)) {
113
113
  for (const method of type.methods ?? []) {
114
- if (!method.static) {
115
- _validateMethodOverride(method, type);
116
- }
114
+ _validateMethodOverride(method, type);
117
115
  }
118
116
  for (const property of type.properties ?? []) {
119
- if (!property.static) {
120
- _validatePropertyOverride(property, type);
121
- }
117
+ _validatePropertyOverride(property, type);
122
118
  }
123
119
  }
124
120
  if (spec.isClassOrInterfaceType(type) && (type.interfaces?.length ?? 0) > 0) {
@@ -130,24 +126,6 @@ function _defaultValidations() {
130
126
  }
131
127
  }
132
128
  }
133
- // Validate static members separately - they cannot be covariant
134
- for (const type of _allTypes(assembly)) {
135
- if (spec.isClassType(type) && type.base) {
136
- const baseType = _dereference(type.base, assembly, validator);
137
- if (baseType) {
138
- for (const method of type.methods ?? []) {
139
- if (method.static) {
140
- _validateStaticMethodOverride(method, type, baseType);
141
- }
142
- }
143
- for (const property of type.properties ?? []) {
144
- if (property.static) {
145
- _validateStaticPropertyOverride(property, type, baseType);
146
- }
147
- }
148
- }
149
- }
150
- }
151
129
  /**
152
130
  * Lists all "implementations" from the given type, using the provided
153
131
  * implementation getter. Note that abstract members may be part of the
@@ -279,17 +257,10 @@ function _defaultValidations() {
279
257
  const actVisibility = actual.protected ? 'protected' : 'public';
280
258
  diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.createDetached(label, action, actVisibility, expVisibility));
281
259
  }
282
- // Allow covariant return types - actual return type can be more specific than expected
283
260
  if (!deepEqual(actual.returns, expected.returns)) {
284
- const actualReturnType = actual.returns?.type;
285
- const expectedReturnType = expected.returns?.type;
286
- // Check if this is a valid covariant return type (actual is more specific than expected)
287
- const isCovariantReturn = actualReturnType && expectedReturnType && _isCovariantOf(actualReturnType, expectedReturnType);
288
- if (!isCovariantReturn) {
289
- const expType = spec.describeTypeReference(expectedReturnType);
290
- const actType = spec.describeTypeReference(actualReturnType);
291
- diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.createDetached(label, action, actType, expType));
292
- }
261
+ const expType = spec.describeTypeReference(expected.returns?.type);
262
+ const actType = spec.describeTypeReference(actual.returns?.type);
263
+ diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.createDetached(label, action, actType, expType));
293
264
  }
294
265
  const expectedParams = expected.parameters ?? [];
295
266
  const actualParams = actual.parameters ?? [];
@@ -312,102 +283,6 @@ function _defaultValidations() {
312
283
  }
313
284
  }
314
285
  }
315
- function _isCovariantOf(candidateType, expectedType) {
316
- // Same type is always covariant
317
- if (deepEqual(candidateType, expectedType)) {
318
- return true;
319
- }
320
- if (!spec.isNamedTypeReference(candidateType) || !spec.isNamedTypeReference(expectedType)) {
321
- return false;
322
- }
323
- const candidateTypeSpec = _dereference(candidateType.fqn, assembly, validator);
324
- const expectedTypeSpec = _dereference(expectedType.fqn, assembly, validator);
325
- if (!candidateTypeSpec || !expectedTypeSpec) {
326
- return false;
327
- }
328
- // Handle class-to-class inheritance
329
- if (spec.isClassType(candidateTypeSpec) && spec.isClassType(expectedTypeSpec)) {
330
- // Check if candidateType extends expectedType (directly or indirectly)
331
- return _classExtendsClass(candidateTypeSpec, expectedType.fqn);
332
- }
333
- // Handle class implementing interface
334
- if (spec.isClassType(candidateTypeSpec) && spec.isInterfaceType(expectedTypeSpec)) {
335
- return _classImplementsInterface(candidateTypeSpec, expectedType.fqn);
336
- }
337
- return false;
338
- }
339
- function _classExtendsClass(classType, targetFqn) {
340
- let current = classType;
341
- while (current.base) {
342
- if (current.base === targetFqn) {
343
- return true;
344
- }
345
- const baseType = _dereference(current.base, assembly, validator);
346
- if (!spec.isClassType(baseType)) {
347
- break;
348
- }
349
- current = baseType;
350
- }
351
- return false;
352
- }
353
- function _classImplementsInterface(classType, interfaceFqn) {
354
- // Check direct interfaces
355
- if (classType.interfaces?.includes(interfaceFqn)) {
356
- return true;
357
- }
358
- // Check inherited interfaces
359
- if (classType.interfaces) {
360
- for (const iface of classType.interfaces) {
361
- const ifaceType = _dereference(iface, assembly, validator);
362
- if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, interfaceFqn)) {
363
- return true;
364
- }
365
- }
366
- }
367
- // Check base class interfaces
368
- if (classType.base) {
369
- const baseType = _dereference(classType.base, assembly, validator);
370
- if (spec.isClassType(baseType)) {
371
- return _classImplementsInterface(baseType, interfaceFqn);
372
- }
373
- }
374
- return false;
375
- }
376
- function _interfaceExtendsInterface(interfaceType, targetFqn) {
377
- if (interfaceType.fqn === targetFqn) {
378
- return true;
379
- }
380
- if (interfaceType.interfaces) {
381
- for (const iface of interfaceType.interfaces) {
382
- if (iface === targetFqn) {
383
- return true;
384
- }
385
- const ifaceType = _dereference(iface, assembly, validator);
386
- if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, targetFqn)) {
387
- return true;
388
- }
389
- }
390
- }
391
- return false;
392
- }
393
- function _validateStaticMethodOverride(method, type, baseType) {
394
- const overridden = (baseType.methods ?? []).find((m) => m.name === method.name && m.static);
395
- if (overridden) {
396
- // Static methods must have exact same signature - no covariance allowed
397
- if (!deepEqual(method.returns, overridden.returns)) {
398
- diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.createDetached(`${type.fqn}#${method.name}`, `overriding ${baseType.fqn}`, spec.describeTypeReference(method.returns?.type), spec.describeTypeReference(overridden.returns?.type)));
399
- }
400
- }
401
- }
402
- function _validateStaticPropertyOverride(property, type, baseType) {
403
- const overridden = (baseType.properties ?? []).find((p) => p.name === property.name && p.static);
404
- if (overridden) {
405
- // Static properties must have exact same type - no covariance allowed
406
- if (!deepEqual(property.type, overridden.type)) {
407
- diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5004_OVERRIDE_CHANGES_PROP_TYPE.createDetached(`${type.fqn}#${property.name}`, `overriding ${baseType.fqn}`, property.type, overridden.type));
408
- }
409
- }
410
- }
411
286
  function _assertPropertiesMatch(expected, actual, label, action) {
412
287
  const actualNode = bindings.getPropertyRelatedNode(actual);
413
288
  const expectedNode = bindings.getPropertyRelatedNode(expected);
@@ -416,7 +291,7 @@ function _defaultValidations() {
416
291
  const actVisibility = actual.protected ? 'protected' : 'public';
417
292
  diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.create(actualNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword) ?? declarationName(actualNode), label, action, actVisibility, expVisibility).maybeAddRelatedInformation(expectedNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword) ?? declarationName(expectedNode), 'The implemented declaration is here.'));
418
293
  }
419
- if (!_isCovariantOf(actual.type, expected.type)) {
294
+ if (!deepEqual(expected.type, actual.type)) {
420
295
  diagnostic(jsii_diagnostic_1.JsiiDiagnostic.JSII_5004_OVERRIDE_CHANGES_PROP_TYPE.create(actualNode?.type ?? declarationName(actualNode), label, action, actual.type, expected.type).maybeAddRelatedInformation(expectedNode?.type ?? declarationName(expectedNode), 'The implemented declaration is here.'));
421
296
  }
422
297
  if (expected.immutable !== actual.immutable) {