Skip to content

Commit

Permalink
fix(estree-ast-utils): add missing d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken committed Dec 22, 2023
1 parent 5ef2b3d commit 440476a
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
4 changes: 4 additions & 0 deletions workspaces/estree-ast-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -20,6 +21,9 @@
"ast",
"utils"
],
"files": [
"src"
],
"author": "GENTILHOMME Thomas <gentilhomme.thomas@gmail.com>",
"license": "MIT",
"bugs": {
Expand Down
28 changes: 28 additions & 0 deletions workspaces/estree-ast-utils/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Import Internal Dependencies
import { VariableTracer } from "./utils/VariableTracer";

export { VariableTracer };

export function arrayExpressionToString(
node: any, options?: { tracer?: VariableTracer }
): IterableIterator<string>;

export function concatBinaryExpression(
node: any, options?: { tracer?: VariableTracer, stopOnUnsupportedNode?: boolean }
): IterableIterator<string>;

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<string>;

export function getVariableDeclarationIdentifiers(
node: any, options?: { prefix?: string | null }
): IterableIterator<{ name: string; assignmentId: any }>;
27 changes: 27 additions & 0 deletions workspaces/estree-ast-utils/src/utils/VariableTracer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Import Node.js Dependencies
import EventEmitter from "node:events";

declare class VariableTracer extends EventEmitter {
static AssignmentEvent: Symbol;

literalIdentifiers: Map<string, string>;
importedModules: Set<string>;

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
}

0 comments on commit 440476a

Please sign in to comment.