From 25b5dbc4c984b5afdc5f684df8f8d2d5330e9471 Mon Sep 17 00:00:00 2001 From: "Thomas.G" Date: Fri, 22 Dec 2023 18:56:07 +0100 Subject: [PATCH] fix(estree-ast-utils): add missing d.ts (#193) --- workspaces/estree-ast-utils/package.json | 4 +++ workspaces/estree-ast-utils/src/index.d.ts | 28 +++++++++++++++++++ .../src/utils/VariableTracer.d.ts | 27 ++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 workspaces/estree-ast-utils/src/index.d.ts create mode 100644 workspaces/estree-ast-utils/src/utils/VariableTracer.d.ts diff --git a/workspaces/estree-ast-utils/package.json b/workspaces/estree-ast-utils/package.json index f82e40d..d9b4275 100644 --- a/workspaces/estree-ast-utils/package.json +++ b/workspaces/estree-ast-utils/package.json @@ -4,6 +4,7 @@ "description": "Utilities for AST (ESTree compliant)", "type": "module", "exports": "./src/index.js", + "types": "./src/index.d.ts", "scripts": { "lint": "eslint src test", "prepublishOnly": "pkg-ok", @@ -20,6 +21,9 @@ "ast", "utils" ], + "files": [ + "src" + ], "author": "GENTILHOMME Thomas ", "license": "MIT", "bugs": { diff --git a/workspaces/estree-ast-utils/src/index.d.ts b/workspaces/estree-ast-utils/src/index.d.ts new file mode 100644 index 0000000..d888508 --- /dev/null +++ b/workspaces/estree-ast-utils/src/index.d.ts @@ -0,0 +1,28 @@ +// Import Internal Dependencies +import { VariableTracer } from "./utils/VariableTracer"; + +export { VariableTracer }; + +export function arrayExpressionToString( + node: any, options?: { tracer?: VariableTracer } +): IterableIterator; + +export function concatBinaryExpression( + node: any, options?: { tracer?: VariableTracer, stopOnUnsupportedNode?: boolean } +): IterableIterator; + +export function getCallExpressionArguments( + node: any, options?: { tracer?: VariableTracer } +): string[] | null; + +export function getCallExpressionIdentifier( + node: any +): string | null; + +export function getMemberExpressionIdentifier( + node: any, options?: { tracer?: VariableTracer } +): IterableIterator; + +export function getVariableDeclarationIdentifiers( + node: any, options?: { prefix?: string | null } +): IterableIterator<{ name: string; assignmentId: any }>; diff --git a/workspaces/estree-ast-utils/src/utils/VariableTracer.d.ts b/workspaces/estree-ast-utils/src/utils/VariableTracer.d.ts new file mode 100644 index 0000000..c2f61fe --- /dev/null +++ b/workspaces/estree-ast-utils/src/utils/VariableTracer.d.ts @@ -0,0 +1,27 @@ +// Import Node.js Dependencies +import EventEmitter from "node:events"; + +declare class VariableTracer extends EventEmitter { + static AssignmentEvent: Symbol; + + literalIdentifiers: Map; + importedModules: Set; + + enableDefaultTracing(): VariableTracer; + debug(): void; + trace(identifierOrMemberExpr: string, options?: { + followConsecutiveAssignment?: boolean; + moduleName?: string; + name?: string; + }): VariableTracer; + getDataFromIdentifier(identifierOrMemberExpr: string): null | { + name: string; + identifierOrMemberExpr: string; + assignmentMemory: string[]; + } + walk(node: any): void; +} + +export { + VariableTracer +}