diff --git a/package.json b/package.json index 2c3423f8..9accf3db 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "@types/node": "^11.9.5", "@types/resolve": "0.0.8", "@wessberg/browserslist-generator": "1.0.11", + "@wessberg/stringutil": "^1.0.18", "browserslist": "^4.4.1", "find-up": "^3.0.0", "magic-string": "^0.25.2", diff --git a/src/service/transformer/declaration-bundler/update-exports/update-exports-visitor-options.ts b/src/service/transformer/declaration-bundler/update-exports/update-exports-visitor-options.ts index 2773bcf7..ee9e4b4f 100644 --- a/src/service/transformer/declaration-bundler/update-exports/update-exports-visitor-options.ts +++ b/src/service/transformer/declaration-bundler/update-exports/update-exports-visitor-options.ts @@ -7,8 +7,4 @@ export interface UpdateExportsVisitorOptions extends VisitorOpti getExportedSpecifiersFromModule(moduleName: string): Set; parsedExportedSymbols: Set; exportedSpecifiersFromModule: Set; - - isIdentifierFree(identifier: string): boolean; - rootLevelIdentifiersForModule: Set; - generateUniqueVariableName(candidate: string): string; } diff --git a/src/service/transformer/declaration-bundler/update-exports/update-exports.ts b/src/service/transformer/declaration-bundler/update-exports/update-exports.ts index 7b31e245..e6b8021e 100644 --- a/src/service/transformer/declaration-bundler/update-exports/update-exports.ts +++ b/src/service/transformer/declaration-bundler/update-exports/update-exports.ts @@ -38,8 +38,6 @@ import {setExtension} from "../../../../util/path/path-util"; export function updateExports({usedExports, ...rest}: IDeclarationBundlerOptions): TransformerFactory { const parsedExportedSymbolsMap: Map> = new Map(); const exportedSpecifiersFromModuleMap: Map> = new Map(); - const rootLevelIdentifiersForModuleMap: Map> = new Map(); - const generatedVariableNamesForChunkMap: Map> = new Map(); return context => { return sourceFile => { @@ -49,14 +47,7 @@ export function updateExports({usedExports, ...rest}: IDeclarationBundlerOptions const chunkFilename = getChunkFilename(sourceFile.fileName, rest.supportedExtensions, rest.chunkToOriginalFileMap); let parsedExportedSymbols = parsedExportedSymbolsMap.get(sourceFile.fileName); - let rootLevelIdentifiersForModule = rootLevelIdentifiersForModuleMap.get(sourceFile.fileName); let exportedSpecifiersFromModule = exportedSpecifiersFromModuleMap.get(sourceFile.fileName); - let generatedVariableNamesForChunk = generatedVariableNamesForChunkMap.get(chunkFilename); - - if (rootLevelIdentifiersForModule == null) { - rootLevelIdentifiersForModule = new Set(); - rootLevelIdentifiersForModuleMap.set(sourceFile.fileName, rootLevelIdentifiersForModule); - } if (parsedExportedSymbols == null) { parsedExportedSymbols = new Set(); @@ -68,11 +59,6 @@ export function updateExports({usedExports, ...rest}: IDeclarationBundlerOptions exportedSpecifiersFromModuleMap.set(sourceFile.fileName, exportedSpecifiersFromModule); } - if (generatedVariableNamesForChunk == null) { - generatedVariableNamesForChunk = new Set(); - generatedVariableNamesForChunkMap.set(chunkFilename, generatedVariableNamesForChunk); - } - // Prepare some VisitorOptions const visitorOptions = { usedExports, @@ -81,17 +67,6 @@ export function updateExports({usedExports, ...rest}: IDeclarationBundlerOptions ...rest, continuation: (node: U) => visitEachChild(node, visitor, context), - isIdentifierFree(identifier: string): boolean { - for (const module of rest.localModuleNames) { - // Skip the current module - if (module === sourceFile.fileName) continue; - - const identifiersForModule = rootLevelIdentifiersForModuleMap.get(module); - if (identifiersForModule != null && identifiersForModule.has(identifier)) return false; - } - return true; - }, - getParsedExportedSymbolsForModule(moduleName: string): Set { let matched: Set | undefined; for (const extension of ["", ...rest.supportedExtensions]) { @@ -119,22 +94,7 @@ export function updateExports({usedExports, ...rest}: IDeclarationBundlerOptions return matched; }, parsedExportedSymbols, - rootLevelIdentifiersForModule, - exportedSpecifiersFromModule, - generateUniqueVariableName(candidate: string): string { - const suffix = "_$"; - let counter = 0; - - while (true) { - let currentCandidate = candidate + suffix + counter; - if (generatedVariableNamesForChunk!.has(currentCandidate)) { - counter++; - } else { - generatedVariableNamesForChunk!.add(currentCandidate); - return currentCandidate; - } - } - } + exportedSpecifiersFromModule }; /** diff --git a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-class-declaration.ts b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-class-declaration.ts index c23d9f5a..039cc3e6 100644 --- a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-class-declaration.ts +++ b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-class-declaration.ts @@ -14,13 +14,8 @@ export function visitClassDeclaration({ isEntry, exportedSpecifiersFromModule, parsedExportedSymbols, - identifiersForDefaultExportsForModules, - rootLevelIdentifiersForModule + identifiersForDefaultExportsForModules }: UpdateExportsVisitorOptions): ClassDeclaration | undefined { - if (node.name != null) { - rootLevelIdentifiersForModule.add(node.name.text); - } - // If the node has no export modifier, leave it as it is if (!hasExportModifier(node)) return continuation(node); diff --git a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-enum-declaration.ts b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-enum-declaration.ts index e3faf6b8..58cb924e 100644 --- a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-enum-declaration.ts +++ b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-enum-declaration.ts @@ -14,11 +14,8 @@ export function visitEnumDeclaration({ isEntry, exportedSpecifiersFromModule, parsedExportedSymbols, - identifiersForDefaultExportsForModules, - rootLevelIdentifiersForModule + identifiersForDefaultExportsForModules }: UpdateExportsVisitorOptions): EnumDeclaration | undefined { - rootLevelIdentifiersForModule.add(node.name.text); - // If the node has no export modifier, leave it as it is if (!hasExportModifier(node)) return continuation(node); diff --git a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-function-declaration.ts b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-function-declaration.ts index 24d0ad6c..a5357a96 100644 --- a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-function-declaration.ts +++ b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-function-declaration.ts @@ -14,13 +14,8 @@ export function visitFunctionDeclaration({ isEntry, exportedSpecifiersFromModule, parsedExportedSymbols, - identifiersForDefaultExportsForModules, - rootLevelIdentifiersForModule + identifiersForDefaultExportsForModules }: UpdateExportsVisitorOptions): FunctionDeclaration | undefined { - if (node.name != null) { - rootLevelIdentifiersForModule.add(node.name.text); - } - // If the node has no export modifier, leave it as it is if (!hasExportModifier(node)) return continuation(node); diff --git a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-interface-declaration.ts b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-interface-declaration.ts index 2d38df22..1e12895c 100644 --- a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-interface-declaration.ts +++ b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-interface-declaration.ts @@ -14,11 +14,8 @@ export function visitInterfaceDeclaration({ isEntry, exportedSpecifiersFromModule, parsedExportedSymbols, - identifiersForDefaultExportsForModules, - rootLevelIdentifiersForModule + identifiersForDefaultExportsForModules }: UpdateExportsVisitorOptions): InterfaceDeclaration | undefined { - rootLevelIdentifiersForModule.add(node.name.text); - // If the node has no export modifier, leave it as it is if (!hasExportModifier(node)) return continuation(node); diff --git a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-module-declaration.ts b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-module-declaration.ts index f6cf1282..32606e99 100644 --- a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-module-declaration.ts +++ b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-module-declaration.ts @@ -14,11 +14,8 @@ export function visitModuleDeclaration({ isEntry, exportedSpecifiersFromModule, parsedExportedSymbols, - identifiersForDefaultExportsForModules, - rootLevelIdentifiersForModule + identifiersForDefaultExportsForModules }: UpdateExportsVisitorOptions): ModuleDeclaration | undefined { - rootLevelIdentifiersForModule.add(node.name.text); - // If the node has no export modifier, leave it as it is if (!hasExportModifier(node)) return continuation(node); diff --git a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-type-alias-declaration.ts b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-type-alias-declaration.ts index e61183b6..130cef21 100644 --- a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-type-alias-declaration.ts +++ b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-type-alias-declaration.ts @@ -14,11 +14,8 @@ export function visitTypeAliasDeclaration({ isEntry, exportedSpecifiersFromModule, parsedExportedSymbols, - identifiersForDefaultExportsForModules, - rootLevelIdentifiersForModule + identifiersForDefaultExportsForModules }: UpdateExportsVisitorOptions): TypeAliasDeclaration | undefined { - rootLevelIdentifiersForModule.add(node.name.text); - // If the node has no export modifier, leave it as it is if (!hasExportModifier(node)) return continuation(node); diff --git a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-variable-statement.ts b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-variable-statement.ts index f95dc925..fba9164f 100644 --- a/src/service/transformer/declaration-bundler/update-exports/visitor/visit-variable-statement.ts +++ b/src/service/transformer/declaration-bundler/update-exports/visitor/visit-variable-statement.ts @@ -2,6 +2,9 @@ import {createVariableDeclaration, isIdentifier, updateVariableDeclarationList, import {UpdateExportsVisitorOptions} from "../update-exports-visitor-options"; import {hasDefaultExportModifier, removeExportModifier} from "../../util/modifier/modifier-util"; import {getIdentifiersForBindingName} from "../../util/binding-name/get-identifiers-for-binding-name"; +import {pascalCase} from "@wessberg/stringutil"; +import {basename} from "path"; +import {stripExtension} from "../../../../../util/path/path-util"; /** * Visits the given VariableStatement. @@ -15,18 +18,14 @@ export function visitVariableStatement({ isEntry, identifiersForDefaultExportsForModules, parsedExportedSymbols, - exportedSpecifiersFromModule, - generateUniqueVariableName, - rootLevelIdentifiersForModule + exportedSpecifiersFromModule }: UpdateExportsVisitorOptions): VariableStatement | undefined { - for (const declaration of node.declarationList.declarations) { - // Add all of the named bindings to the exported symbols - for (const identifier of getIdentifiersForBindingName(declaration.name)) { - if (isEntry && !hasDefaultExportModifier(node.modifiers)) { + if (isEntry && !hasDefaultExportModifier(node.modifiers)) { + for (const declaration of node.declarationList.declarations) { + // Add all of the named bindings to the exported symbols + for (const identifier of getIdentifiersForBindingName(declaration.name)) { exportedSpecifiersFromModule.add(identifier); } - - rootLevelIdentifiersForModule.add(identifier); } } @@ -42,7 +41,7 @@ export function visitVariableStatement({ // If the name of the declaration is '_default', it is an assignment to a const before exporting it as default if (isIdentifier(declaration.name) && declaration.name.text === "_default") { // Give it a unique variable name and bind it to a new variable - const name = generateUniqueVariableName(declaration.name.text); + const name = `default${pascalCase(stripExtension(basename(sourceFile.fileName)))}Export`; identifiersForDefaultExportsForModules.set(sourceFile.fileName, name); return continuation( diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/is-referenced.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/is-referenced.ts index ffd8491d..686bcf3a 100644 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/is-referenced.ts +++ b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/is-referenced.ts @@ -1,102 +1,10 @@ -import { - forEachChild, - isArrayBindingPattern, - isArrayTypeNode, - isBindingElement, - isCallSignatureDeclaration, - isClassDeclaration, - isConditionalTypeNode, - isConstructorDeclaration, - isEnumDeclaration, - isEnumMember, - isExportAssignment, - isExportDeclaration, - isExportSpecifier, - isExpressionWithTypeArguments, - isFunctionDeclaration, - isFunctionTypeNode, - isIdentifier, - isImportDeclaration, - isIndexedAccessTypeNode, - isIndexSignatureDeclaration, - isInterfaceDeclaration, - isIntersectionTypeNode, - isLiteralTypeNode, - isMethodDeclaration, - isMethodSignature, - isObjectBindingPattern, - isParameter, - isParenthesizedTypeNode, - isPropertyAccessExpression, - isPropertyDeclaration, - isPropertySignature, - isQualifiedName, - isToken, - isTupleTypeNode, - isTypeAliasDeclaration, - isTypeLiteralNode, - isTypeParameterDeclaration, - isTypePredicateNode, - isTypeQueryNode, - isTypeReferenceNode, - isUnionTypeNode, - isVariableDeclaration, - isVariableDeclarationList, - isVariableStatement, - Node, - OptionalTypeNode, - SyntaxKind -} from "typescript"; +import {forEachChild, isExportAssignment, isExportDeclaration, isExportSpecifier, isIdentifier, Node} from "typescript"; import {IsReferencedOptions} from "./is-referenced-options"; import {nodeContainsChild} from "../../util/node-contains-child"; import {getIdentifiersForNode} from "../../util/get-identifiers-for-node"; -import {isKeywordTypeNode} from "../../util/is-keyword-type-node"; import {hasExportModifier} from "../../../declaration-bundler/util/modifier/modifier-util"; import {ReferenceVisitorOptions} from "./reference-visitor-options"; -import {checkExportDeclaration} from "./visitor/reference-visitor/check-export-declaration"; -import {checkMethodDeclaration} from "./visitor/reference-visitor/check-method-declaration"; -import {checkFunctionTypeNode} from "./visitor/reference-visitor/check-function-type-node"; -import {checkBindingElement} from "./visitor/reference-visitor/check-binding-element"; -import {checkParenthesizedTypeNode} from "./visitor/reference-visitor/check-parenthesized-type-node"; -import {checkExportSpecifier} from "./visitor/reference-visitor/check-export-specifier"; -import {checkVariableDeclaration} from "./visitor/reference-visitor/check-variable-declaration"; -import {checkInterfaceDeclaration} from "./visitor/reference-visitor/check-interface-declaration"; -import {checkOptionalTypeNode} from "./visitor/reference-visitor/check-optional-type-node"; -import {checkTypeAliasDeclaration} from "./visitor/reference-visitor/check-type-alias-declaration"; -import {checkExportAssignment} from "./visitor/reference-visitor/check-export-assignment"; -import {checkKeywordTypeNode} from "./visitor/reference-visitor/check-keyword-type-node"; -import {checkTypeLiteralNode} from "./visitor/reference-visitor/check-type-literal-node"; -import {checkParameterDeclaration} from "./visitor/reference-visitor/check-parameter-declaration"; -import {checkUnionTypeNode} from "./visitor/reference-visitor/check-union-type-node"; -import {checkExpressionWithTypeArguments} from "./visitor/reference-visitor/check-expression-with-type-arguments"; -import {checkTypeParameterDeclaration} from "./visitor/reference-visitor/check-type-parameter-declaration"; -import {checkConstructorDeclaration} from "./visitor/reference-visitor/check-constructor-declaration"; -import {checkPropertyDeclaration} from "./visitor/reference-visitor/check-property-declaration"; -import {checkTypePredicateNode} from "./visitor/reference-visitor/check-type-predicate-node"; -import {checkIdentifier} from "./visitor/reference-visitor/check-identifier"; -import {checkEnumMember} from "./visitor/reference-visitor/check-enum-member"; -import {checkQualifiedName} from "./visitor/reference-visitor/check-qualified-name"; -import {checkTupleTypeNode} from "./visitor/reference-visitor/check-tuple-type-node"; -import {checkFunctionDeclaration} from "./visitor/reference-visitor/check-function-declaration"; -import {checkIndexSignatureDeclaration} from "./visitor/reference-visitor/check-index-signature-declaration"; -import {checkArrayTypeNode} from "./visitor/reference-visitor/check-array-type-node"; -import {checkPropertySignature} from "./visitor/reference-visitor/check-property-signature"; -import {checkBindingPattern} from "./visitor/reference-visitor/check-binding-pattern"; -import {checkTypeReferenceNode} from "./visitor/reference-visitor/check-type-reference-node"; -import {checkLiteralTypeNode} from "./visitor/reference-visitor/check-literal-type-node"; -import {checkIndexedAccessTypeNode} from "./visitor/reference-visitor/check-indexed-access-type-node"; -import {checkTypeQueryNode} from "./visitor/reference-visitor/check-type-query-node"; -import {checkPropertyAccessExpression} from "./visitor/reference-visitor/check-property-access-expression"; -import {checkIntersectionTypeNode} from "./visitor/reference-visitor/check-intersection-type-node"; -import {checkEnumDeclaration} from "./visitor/reference-visitor/check-enum-declaration"; -import {checkToken} from "./visitor/reference-visitor/check-token"; -import {checkClassDeclaration} from "./visitor/reference-visitor/check-class-declaration"; -import {checkImportDeclaration} from "./visitor/reference-visitor/check-import-declaration"; -import {checkVariableStatement} from "./visitor/reference-visitor/check-variable-statement"; -import {checkMethodSignature} from "./visitor/reference-visitor/check-method-signature"; -import {checkConditionalTypeNode} from "./visitor/reference-visitor/check-conditional-type-node"; -import {checkCallSignatureDeclaration} from "./visitor/reference-visitor/check-call-signature-declaration"; -import {checkVariableDeclarationList} from "./visitor/reference-visitor/check-variable-declaration-list"; +import {checkIdentifier} from "./visitor/check-identifier"; import {isAmbientModuleRootLevelNode} from "../../util/is-ambient-module-root-level-node"; /** @@ -107,52 +15,9 @@ import {isAmbientModuleRootLevelNode} from "../../util/is-ambient-module-root-le */ function checkNode(currentNode: Node, options: ReferenceVisitorOptions): boolean { if (options.node === currentNode || nodeContainsChild(options.node, currentNode)) return false; - if (isExportDeclaration(currentNode)) return checkExportDeclaration(currentNode, options); - else if (isExportAssignment(currentNode)) return checkExportAssignment(currentNode, options); - else if (isImportDeclaration(currentNode)) return checkImportDeclaration(currentNode, options); - else if (isExportSpecifier(currentNode)) return checkExportSpecifier(currentNode, options); - else if (isParameter(currentNode)) return checkParameterDeclaration(currentNode, options); - else if (isIdentifier(currentNode)) return checkIdentifier(currentNode, options); - else if (isTypeReferenceNode(currentNode)) return checkTypeReferenceNode(currentNode, options); - else if (isUnionTypeNode(currentNode)) return checkUnionTypeNode(currentNode, options); - else if (isIntersectionTypeNode(currentNode)) return checkIntersectionTypeNode(currentNode, options); - else if (isInterfaceDeclaration(currentNode)) return checkInterfaceDeclaration(currentNode, options); - else if (isEnumDeclaration(currentNode)) return checkEnumDeclaration(currentNode, options); - else if (isEnumMember(currentNode)) return checkEnumMember(currentNode, options); - else if (isConditionalTypeNode(currentNode)) return checkConditionalTypeNode(currentNode, options); - else if (isTupleTypeNode(currentNode)) return checkTupleTypeNode(currentNode, options); - else if (isPropertyAccessExpression(currentNode)) return checkPropertyAccessExpression(currentNode, options); - else if (isClassDeclaration(currentNode)) return checkClassDeclaration(currentNode, options); - else if (isLiteralTypeNode(currentNode)) return checkLiteralTypeNode(currentNode, options); - else if (isParenthesizedTypeNode(currentNode)) return checkParenthesizedTypeNode(currentNode, options); - else if (isTypeParameterDeclaration(currentNode)) return checkTypeParameterDeclaration(currentNode, options); - else if (isTypeAliasDeclaration(currentNode)) return checkTypeAliasDeclaration(currentNode, options); - else if (isFunctionDeclaration(currentNode)) return checkFunctionDeclaration(currentNode, options); - else if (isConstructorDeclaration(currentNode)) return checkConstructorDeclaration(currentNode, options); - else if (isVariableStatement(currentNode)) return checkVariableStatement(currentNode, options); - else if (isVariableDeclarationList(currentNode)) return checkVariableDeclarationList(currentNode, options); - else if (isVariableDeclaration(currentNode)) return checkVariableDeclaration(currentNode, options); - else if (isIndexedAccessTypeNode(currentNode)) return checkIndexedAccessTypeNode(currentNode, options); - else if (isPropertySignature(currentNode)) return checkPropertySignature(currentNode, options); - else if (isPropertyDeclaration(currentNode)) return checkPropertyDeclaration(currentNode, options); - else if (isMethodDeclaration(currentNode)) return checkMethodDeclaration(currentNode, options); - else if (isCallSignatureDeclaration(currentNode)) return checkCallSignatureDeclaration(currentNode, options); - else if (isFunctionTypeNode(currentNode)) return checkFunctionTypeNode(currentNode, options); - else if (isMethodSignature(currentNode)) return checkMethodSignature(currentNode, options); - else if (isIndexSignatureDeclaration(currentNode)) return checkIndexSignatureDeclaration(currentNode, options); - else if (isExpressionWithTypeArguments(currentNode)) return checkExpressionWithTypeArguments(currentNode, options); - else if (isTypeQueryNode(currentNode)) return checkTypeQueryNode(currentNode, options); - else if (isTypeLiteralNode(currentNode)) return checkTypeLiteralNode(currentNode, options); - else if (isArrayTypeNode(currentNode)) return checkArrayTypeNode(currentNode, options); - else if (isTypePredicateNode(currentNode)) return checkTypePredicateNode(currentNode, options); - else if (isKeywordTypeNode(currentNode)) return checkKeywordTypeNode(currentNode, options); - else if (isBindingElement(currentNode)) return checkBindingElement(currentNode, options); - else if (isObjectBindingPattern(currentNode) || isArrayBindingPattern(currentNode)) return checkBindingPattern(currentNode, options); - else if (isToken(currentNode)) return checkToken(currentNode, options); - else if (isQualifiedName(currentNode)) return checkQualifiedName(currentNode, options); - else if (currentNode.kind === SyntaxKind.OptionalType) return checkOptionalTypeNode(currentNode as OptionalTypeNode, options); - throw new TypeError(`Could not handle Node of kind: ${SyntaxKind[currentNode.kind]}`); + if (isIdentifier(currentNode)) return checkIdentifier(currentNode, options); + else return options.continuation(currentNode); } /** @@ -207,7 +72,10 @@ function collectReferences(options: IsReferencedOptions): Nod ...options, referencingNodes: new Set(), identifiers: getIdentifiersForNode(options.node, options.cache), - continuation: (node: Node): boolean => checkNode(node, visitorOptions) + continuation: (node: Node): boolean => { + const result = forEachChild(node, nextNode => checkNode(nextNode, visitorOptions)); + return result === true; + } }; const sourceFile = options.node.getSourceFile(); diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-identifier.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/check-identifier.ts similarity index 85% rename from src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-identifier.ts rename to src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/check-identifier.ts index e70b488e..c1fe20cc 100644 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-identifier.ts +++ b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/check-identifier.ts @@ -1,5 +1,5 @@ import {Identifier} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; +import {ReferenceVisitorOptions} from "../reference-visitor-options"; /** * Visits the given Identifier. diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-array-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-array-type-node.ts deleted file mode 100644 index 7e227bd8..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-array-type-node.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {ArrayTypeNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ArrayTypeNode. - * @param {ArrayTypeNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkArrayTypeNode(currentNode: ArrayTypeNode, {continuation}: ReferenceVisitorOptions): boolean { - return continuation(currentNode.elementType); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-binding-element.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-binding-element.ts deleted file mode 100644 index b2918acb..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-binding-element.ts +++ /dev/null @@ -1,21 +0,0 @@ -import {BindingElement, isIdentifier} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given BindingElement. - * @param {BindingElement} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkBindingElement(currentNode: BindingElement, {continuation}: ReferenceVisitorOptions): boolean { - if (currentNode.initializer != null && continuation(currentNode.initializer)) { - return true; - } - - currentNode.propertyName; - if (!isIdentifier(currentNode.name) && continuation(currentNode.name)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-binding-pattern.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-binding-pattern.ts deleted file mode 100644 index 49832338..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-binding-pattern.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {BindingPattern} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given BindingPattern. - * @param {BindingPattern} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkBindingPattern(currentNode: BindingPattern, {continuation}: ReferenceVisitorOptions): boolean { - for (const element of currentNode.elements) { - if (continuation(element)) return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-call-signature-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-call-signature-declaration.ts deleted file mode 100644 index e995497c..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-call-signature-declaration.ts +++ /dev/null @@ -1,35 +0,0 @@ -import {CallSignatureDeclaration, isComputedPropertyName} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given CallSignatureDeclaration. - * @param {CallSignatureDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkCallSignatureDeclaration(currentNode: CallSignatureDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the type parameters references the Node - if (currentNode.typeParameters != null) { - for (const typeParameter of currentNode.typeParameters) { - if (continuation(typeParameter)) return true; - } - } - - // Check if any of the parameters references the node - if (currentNode.parameters != null) { - for (const parameter of currentNode.parameters) { - if (continuation(parameter)) return true; - } - } - - // Check if the type of the function references the Node - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - if (currentNode.name != null && isComputedPropertyName(currentNode.name) && continuation(currentNode.name)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-class-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-class-declaration.ts deleted file mode 100644 index e6c45614..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-class-declaration.ts +++ /dev/null @@ -1,32 +0,0 @@ -import {ClassDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ClassDeclaration. - * @param {ClassDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - */ -export function checkClassDeclaration(currentNode: ClassDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the heritage clauses references the Node - if (currentNode.heritageClauses != null) { - for (const heritageClause of currentNode.heritageClauses) { - for (const type of heritageClause.types) { - if (continuation(type)) return true; - } - } - } - - // Check if any of the type parameters references the Node - if (currentNode.typeParameters != null) { - for (const typeParameter of currentNode.typeParameters) { - if (continuation(typeParameter)) return true; - } - } - - // Check if any of the members references the Node - for (const member of currentNode.members) { - if (continuation(member)) return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-conditional-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-conditional-type-node.ts deleted file mode 100644 index 208e5164..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-conditional-type-node.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {ConditionalTypeNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ConditionalTypeNode. - * @param {ConditionalTypeNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkConditionalTypeNode(currentNode: ConditionalTypeNode, {continuation}: ReferenceVisitorOptions): boolean { - if (continuation(currentNode.checkType)) return true; - if (continuation(currentNode.extendsType)) return true; - if (continuation(currentNode.falseType)) return true; - if (continuation(currentNode.trueType)) return true; - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-constructor-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-constructor-declaration.ts deleted file mode 100644 index 02f12908..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-constructor-declaration.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {ConstructorDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ConstructorDeclaration. - * @param {ConstructorDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkConstructorDeclaration(currentNode: ConstructorDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the type parameters references the Node - if (currentNode.typeParameters != null) { - for (const typeParameter of currentNode.typeParameters) { - if (continuation(typeParameter)) return true; - } - } - - // Check if any of the parameters references the node - if (currentNode.parameters != null) { - for (const parameter of currentNode.parameters) { - if (continuation(parameter)) return true; - } - } - - // Check if the type of the function references the Node - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - // Check if the body references the Node - if (currentNode.body != null && continuation(currentNode.body)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-enum-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-enum-declaration.ts deleted file mode 100644 index fe79479b..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-enum-declaration.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {EnumDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given EnumDeclaration. - * @param {EnumDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - */ -export function checkEnumDeclaration(currentNode: EnumDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - for (const member of currentNode.members) { - if (continuation(member)) return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-enum-member.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-enum-member.ts deleted file mode 100644 index 7470b9b4..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-enum-member.ts +++ /dev/null @@ -1,21 +0,0 @@ -import {EnumMember, isComputedPropertyName} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given EnumMember. - * @param {EnumMember} currentNode - * @param {ReferenceVisitorOptions} options - */ -export function checkEnumMember(currentNode: EnumMember, {continuation}: ReferenceVisitorOptions): boolean { - // Check if the initializer references the Node - if (currentNode.initializer != null && continuation(currentNode.initializer)) { - return true; - } - - // Check if the name is a binding pattern that references the identifier - if (isComputedPropertyName(currentNode.name) && continuation(currentNode.name)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-export-assignment.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-export-assignment.ts deleted file mode 100644 index ac8a6074..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-export-assignment.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {ExportAssignment} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ExportDeclaration. - * @param {ExportAssignment} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkExportAssignment(currentNode: ExportAssignment, {continuation}: ReferenceVisitorOptions): boolean { - return continuation(currentNode.expression); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-export-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-export-declaration.ts deleted file mode 100644 index 2308270e..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-export-declaration.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {ExportDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ExportDeclaration. - * @param {ExportDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkExportDeclaration(currentNode: ExportDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - if (currentNode.exportClause != null) { - for (const element of currentNode.exportClause.elements) { - if (continuation(element)) return true; - } - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-export-specifier.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-export-specifier.ts deleted file mode 100644 index 8d59f10f..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-export-specifier.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {ExportSpecifier} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ExportSpecifier. - * @param {ExportSpecifier} currentNode - * @param {ReferenceVisitorOptions} options - */ -export function checkExportSpecifier(currentNode: ExportSpecifier, {continuation}: ReferenceVisitorOptions): boolean { - if (currentNode.propertyName != null) { - if (continuation(currentNode.propertyName)) return true; - } else { - if (continuation(currentNode.name)) return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-expression-with-type-arguments.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-expression-with-type-arguments.ts deleted file mode 100644 index 4800b555..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-expression-with-type-arguments.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {ExpressionWithTypeArguments} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ExpressionWithTypeArguments. - * @param {ExpressionWithTypeArguments} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkExpressionWithTypeArguments(currentNode: ExpressionWithTypeArguments, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the type arguments references the Node - if (currentNode.typeArguments != null) { - for (const typeArgument of currentNode.typeArguments) { - if (continuation(typeArgument)) return true; - } - } - - return continuation(currentNode.expression); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-function-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-function-declaration.ts deleted file mode 100644 index 46b80699..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-function-declaration.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {FunctionDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given FunctionDeclaration. - * @param {FunctionDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkFunctionDeclaration(currentNode: FunctionDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the type parameters references the Node - if (currentNode.typeParameters != null) { - for (const typeParameter of currentNode.typeParameters) { - if (continuation(typeParameter)) return true; - } - } - - // Check if any of the parameters references the node - if (currentNode.parameters != null) { - for (const parameter of currentNode.parameters) { - if (continuation(parameter)) return true; - } - } - - // Check if the type of the function references the Node - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - // Check if the body references the Node - if (currentNode.body != null && continuation(currentNode.body)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-function-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-function-type-node.ts deleted file mode 100644 index 1097e23c..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-function-type-node.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {FunctionTypeNode, isIdentifier} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given FunctionTypeNode. - * @param {FunctionTypeNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkFunctionTypeNode(currentNode: FunctionTypeNode, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the type parameters references the Node - if (currentNode.typeParameters != null) { - for (const typeParameter of currentNode.typeParameters) { - if (continuation(typeParameter)) return true; - } - } - - // Check if any of the parameters references the node - if (currentNode.parameters != null) { - for (const parameter of currentNode.parameters) { - if (continuation(parameter)) return true; - } - } - - // Check if the type of the function references the Node - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - // Check if the name is a binding pattern that references the identifier - if (currentNode.name != null && !isIdentifier(currentNode.name) && continuation(currentNode.name)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-import-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-import-declaration.ts deleted file mode 100644 index c03a387b..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-import-declaration.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {ImportDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ImportDeclaration. - * @param {ImportDeclaration} _currentNode - * @param {VisitorOptions} _options - * @returns {boolean} - */ -export function checkImportDeclaration(_currentNode: ImportDeclaration, _options: ReferenceVisitorOptions): boolean { - // An ImportDeclaration may reference an identifier of the Node, but it shouldn't be enough to preserve it - // since the Import may exist only to define the Node within the scope - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-index-signature-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-index-signature-declaration.ts deleted file mode 100644 index 9f92404f..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-index-signature-declaration.ts +++ /dev/null @@ -1,35 +0,0 @@ -import {IndexSignatureDeclaration, isComputedPropertyName} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given IndexSignatureDeclaration. - * @param {IndexSignatureDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkIndexSignatureDeclaration(currentNode: IndexSignatureDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the type parameters references the Node - if (currentNode.typeParameters != null) { - for (const typeParameter of currentNode.typeParameters) { - if (continuation(typeParameter)) return true; - } - } - - // Check if any of the parameters references the node - if (currentNode.parameters != null) { - for (const parameter of currentNode.parameters) { - if (continuation(parameter)) return true; - } - } - - // Check if the type of the function references the Node - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - if (currentNode.name != null && isComputedPropertyName(currentNode.name) && continuation(currentNode.name)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-indexed-access-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-indexed-access-type-node.ts deleted file mode 100644 index a17acf17..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-indexed-access-type-node.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {IndexedAccessTypeNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given IndexedAccessTypeNode. - * @param {IndexedAccessTypeNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkIndexedAccessTypeNode(currentNode: IndexedAccessTypeNode, {continuation}: ReferenceVisitorOptions): boolean { - if (continuation(currentNode.indexType)) return true; - if (continuation(currentNode.objectType)) return true; - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-interface-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-interface-declaration.ts deleted file mode 100644 index f2282d5f..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-interface-declaration.ts +++ /dev/null @@ -1,32 +0,0 @@ -import {InterfaceDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given InterfaceDeclaration. - * @param {InterfaceDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - */ -export function checkInterfaceDeclaration(currentNode: InterfaceDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the heritage clauses references the Node - if (currentNode.heritageClauses != null) { - for (const heritageClause of currentNode.heritageClauses) { - for (const type of heritageClause.types) { - if (continuation(type)) return true; - } - } - } - - // Check if any of the type parameters references the Node - if (currentNode.typeParameters != null) { - for (const typeParameter of currentNode.typeParameters) { - if (continuation(typeParameter)) return true; - } - } - - // Check if any of the members references the Node - for (const member of currentNode.members) { - if (continuation(member)) return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-intersection-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-intersection-type-node.ts deleted file mode 100644 index 4ade787e..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-intersection-type-node.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {IntersectionTypeNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given IntersectionTypeNode. - * @param {IntersectionTypeNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkIntersectionTypeNode(currentNode: IntersectionTypeNode, {continuation}: ReferenceVisitorOptions): boolean { - for (const type of currentNode.types) { - if (continuation(type)) return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-keyword-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-keyword-type-node.ts deleted file mode 100644 index 718c0303..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-keyword-type-node.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {KeywordTypeNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given KeywordTypeNode. - * @param {KeywordTypeNode} _currentNode - * @param {VisitorOptions} _options - * @returns {boolean} - */ -export function checkKeywordTypeNode(_currentNode: KeywordTypeNode, _options: ReferenceVisitorOptions): boolean { - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-literal-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-literal-type-node.ts deleted file mode 100644 index 0326eaa0..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-literal-type-node.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {LiteralTypeNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given LiteralTypeNode. - * @param {LiteralTypeNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkLiteralTypeNode(currentNode: LiteralTypeNode, {continuation}: ReferenceVisitorOptions): boolean { - return continuation(currentNode.literal); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-method-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-method-declaration.ts deleted file mode 100644 index 97f8756c..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-method-declaration.ts +++ /dev/null @@ -1,41 +0,0 @@ -import {isIdentifier, MethodDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given MethodDeclaration. - * @param {MethodDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkMethodDeclaration(currentNode: MethodDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the type parameters references the Node - if (currentNode.typeParameters != null) { - for (const typeParameter of currentNode.typeParameters) { - if (continuation(typeParameter)) return true; - } - } - - // Check if any of the parameters references the node - if (currentNode.parameters != null) { - for (const parameter of currentNode.parameters) { - if (continuation(parameter)) return true; - } - } - - // Check if the type of the function references the Node - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - // Check if the body references the Node - if (currentNode.body != null && continuation(currentNode.body)) { - return true; - } - - // Check if the name is a binding pattern that references the identifier - if (!isIdentifier(currentNode.name) && continuation(currentNode.name)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-method-signature.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-method-signature.ts deleted file mode 100644 index a12e0d6c..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-method-signature.ts +++ /dev/null @@ -1,35 +0,0 @@ -import {isComputedPropertyName, MethodSignature} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given MethodSignature. - * @param {MethodSignature} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkMethodSignature(currentNode: MethodSignature, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the type parameters references the Node - if (currentNode.typeParameters != null) { - for (const typeParameter of currentNode.typeParameters) { - if (continuation(typeParameter)) return true; - } - } - - // Check if any of the parameters references the node - if (currentNode.parameters != null) { - for (const parameter of currentNode.parameters) { - if (continuation(parameter)) return true; - } - } - - // Check if the type of the function references the Node - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - if (isComputedPropertyName(currentNode.name) && continuation(currentNode.name)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-optional-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-optional-type-node.ts deleted file mode 100644 index 0c418645..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-optional-type-node.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {OptionalTypeNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given OptionalTypeNode. - * @param {OptionalTypeNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkOptionalTypeNode(currentNode: OptionalTypeNode, {continuation}: ReferenceVisitorOptions): boolean { - return continuation(currentNode.type); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-parameter-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-parameter-declaration.ts deleted file mode 100644 index 5fcc1ce3..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-parameter-declaration.ts +++ /dev/null @@ -1,26 +0,0 @@ -import {isIdentifier, ParameterDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ParameterDeclaration. - * @param {ParameterDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - */ -export function checkParameterDeclaration(currentNode: ParameterDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if the initializer references the Node - if (currentNode.initializer != null && continuation(currentNode.initializer)) { - return true; - } - - // Check if the type references the Node - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - // Check if the name is a binding pattern that references the identifier - if (!isIdentifier(currentNode.name) && continuation(currentNode.name)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-parenthesized-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-parenthesized-type-node.ts deleted file mode 100644 index 282dd9b1..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-parenthesized-type-node.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {ParenthesizedTypeNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given ParenthesizedTypeNode. - * @param {ParenthesizedTypeNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkParenthesizedTypeNode(currentNode: ParenthesizedTypeNode, {continuation}: ReferenceVisitorOptions): boolean { - return continuation(currentNode.type); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-property-access-expression.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-property-access-expression.ts deleted file mode 100644 index 0e1c0b7c..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-property-access-expression.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {PropertyAccessExpression} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given PropertyAccessExpression. - * @param {PropertyAccessExpression} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkPropertyAccessExpression(currentNode: PropertyAccessExpression, {continuation}: ReferenceVisitorOptions): boolean { - return continuation(currentNode.expression); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-property-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-property-declaration.ts deleted file mode 100644 index e19d42c0..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-property-declaration.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {isComputedPropertyName, PropertyDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given PropertyDeclaration. - * @param {PropertyDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkPropertyDeclaration(currentNode: PropertyDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if the initializer references the Node - if (currentNode.initializer != null && continuation(currentNode.initializer)) { - return true; - } - - // Check if the type references the Node - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - // Check if the name is a binding pattern that references the identifier - if (isComputedPropertyName(currentNode.name) && continuation(currentNode.name)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-property-signature.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-property-signature.ts deleted file mode 100644 index 569af3d9..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-property-signature.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {isComputedPropertyName, PropertySignature} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given PropertySignature. - * @param {PropertySignature} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkPropertySignature(currentNode: PropertySignature, {continuation}: ReferenceVisitorOptions): boolean { - if (currentNode.initializer != null && continuation(currentNode.initializer)) { - return true; - } - - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - if (isComputedPropertyName(currentNode.name) && continuation(currentNode.name)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-qualified-name.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-qualified-name.ts deleted file mode 100644 index 788a8874..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-qualified-name.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {QualifiedName} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given QualifiedName. - * @param {QualifiedName} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkQualifiedName(currentNode: QualifiedName, {continuation}: ReferenceVisitorOptions): boolean { - return continuation(currentNode.left); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-token.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-token.ts deleted file mode 100644 index b44f02e0..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-token.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {SyntaxKind, Token} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given Token. - * @param {Token} _currentNode - * @param {VisitorOptions} _options - * @returns {boolean} - */ -export function checkToken(_currentNode: Token, _options: ReferenceVisitorOptions): boolean { - // A Token can never reference an identifier - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-tuple-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-tuple-type-node.ts deleted file mode 100644 index 04675d91..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-tuple-type-node.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {TupleTypeNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given TupleTypeNode. - * @param {TupleTypeNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkTupleTypeNode(currentNode: TupleTypeNode, {continuation}: ReferenceVisitorOptions): boolean { - for (const typeNode of currentNode.elementTypes) { - if (continuation(typeNode)) return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-alias-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-alias-declaration.ts deleted file mode 100644 index 12c0b2fb..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-alias-declaration.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {TypeAliasDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given TypeAliasDeclaration. - * @param {TypeAliasDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkTypeAliasDeclaration(currentNode: TypeAliasDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the type parameters references the Node - if (currentNode.typeParameters != null) { - for (const typeParameter of currentNode.typeParameters) { - if (continuation(typeParameter)) return true; - } - } - - return continuation(currentNode.type); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-literal-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-literal-node.ts deleted file mode 100644 index 88e9209b..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-literal-node.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {TypeLiteralNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given TypeLiteralNode. - * @param {TypeLiteralNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkTypeLiteralNode(currentNode: TypeLiteralNode, {continuation}: ReferenceVisitorOptions): boolean { - for (const member of currentNode.members) { - if (continuation(member)) return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-parameter-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-parameter-declaration.ts deleted file mode 100644 index fafa908f..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-parameter-declaration.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {TypeParameterDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given TypeParameterDeclaration. - * @param {TypeParameterDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkTypeParameterDeclaration(currentNode: TypeParameterDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - if (currentNode.constraint != null && continuation(currentNode.constraint)) { - return true; - } - - if (currentNode.default != null && continuation(currentNode.default)) { - return true; - } - - if (currentNode.expression != null && continuation(currentNode.expression)) { - return true; - } - - return continuation(currentNode.name); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-predicate-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-predicate-node.ts deleted file mode 100644 index f17f4e51..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-predicate-node.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {TypePredicateNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given TypePredicateNode. - * @param {TypePredicateNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkTypePredicateNode(currentNode: TypePredicateNode, {continuation}: ReferenceVisitorOptions): boolean { - return continuation(currentNode.type); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-query-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-query-node.ts deleted file mode 100644 index f23e36e1..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-query-node.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {TypeQueryNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given TypeQueryNode. - * @param {TypeQueryNode} currentNode - * @param {ReferenceVisitorOptions} options - * ®returns {boolean} - */ -export function checkTypeQueryNode(currentNode: TypeQueryNode, {continuation}: ReferenceVisitorOptions): boolean { - return continuation(currentNode.exprName); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-reference-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-reference-node.ts deleted file mode 100644 index ce240acc..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-type-reference-node.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {TypeReferenceNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given TypeReferenceNode. - * @param {TypeReferenceNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkTypeReferenceNode(currentNode: TypeReferenceNode, {continuation}: ReferenceVisitorOptions): boolean { - // If any of the identifiers are equal to the text of this identifier, return true - return continuation(currentNode.typeName); -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-union-type-node.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-union-type-node.ts deleted file mode 100644 index 36632242..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-union-type-node.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {UnionTypeNode} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given UnionTypeNode. - * @param {UnionTypeNode} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkUnionTypeNode(currentNode: UnionTypeNode, {continuation}: ReferenceVisitorOptions): boolean { - for (const type of currentNode.types) { - if (continuation(type)) return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-variable-declaration-list.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-variable-declaration-list.ts deleted file mode 100644 index f065ee15..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-variable-declaration-list.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {VariableDeclarationList} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given VariableDeclarationList. - * @param {VariableDeclarationList} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkVariableDeclarationList(currentNode: VariableDeclarationList, {continuation}: ReferenceVisitorOptions): boolean { - // Check if any of the declaration references the Node - for (const declaration of currentNode.declarations) { - if (continuation(declaration)) return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-variable-declaration.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-variable-declaration.ts deleted file mode 100644 index 78800f0a..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-variable-declaration.ts +++ /dev/null @@ -1,22 +0,0 @@ -import {VariableDeclaration} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given VariableDeclaration. - * @param {VariableDeclaration} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkVariableDeclaration(currentNode: VariableDeclaration, {continuation}: ReferenceVisitorOptions): boolean { - // Check if the initializer references the Node - if (currentNode.initializer != null && continuation(currentNode.initializer)) { - return true; - } - - // Check if the type references the Node - if (currentNode.type != null && continuation(currentNode.type)) { - return true; - } - - return false; -} diff --git a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-variable-statement.ts b/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-variable-statement.ts deleted file mode 100644 index 559e9799..00000000 --- a/src/service/transformer/declaration-tree-shaker/reference/is-referenced/visitor/reference-visitor/check-variable-statement.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {VariableStatement} from "typescript"; -import {ReferenceVisitorOptions} from "../../reference-visitor-options"; - -/** - * Visits the given VariableStatement. - * @param {VariableStatement} currentNode - * @param {ReferenceVisitorOptions} options - * @returns {boolean} - */ -export function checkVariableStatement(currentNode: VariableStatement, {continuation}: ReferenceVisitorOptions): boolean { - return continuation(currentNode.declarationList); -}