@babel/traverse 7.22.17 → 7.22.19
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.
Potentially problematic release.
This version of @babel/traverse might be problematic. Click here for more details.
- package/lib/index.js +0 -9
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
package/lib/index.js
CHANGED
@@ -1,13 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
if (typeof process === "object" && process.version === "v20.6.0") {
|
4
|
-
if (exports["___internal__alreadyRunning" + ""]) return;
|
5
|
-
Object.defineProperty(exports, "___internal__alreadyRunning", {
|
6
|
-
value: true,
|
7
|
-
enumerable: false,
|
8
|
-
configurable: true
|
9
|
-
});
|
10
|
-
}
|
11
3
|
Object.defineProperty(exports, "__esModule", {
|
12
4
|
value: true
|
13
5
|
});
|
@@ -99,6 +91,5 @@ traverse.hasType = function (tree, type, denylistTypes) {
|
|
99
91
|
return state.has;
|
100
92
|
};
|
101
93
|
traverse.cache = cache;
|
102
|
-
if (typeof process === "object" && process.version === "v20.6.0") delete exports["___internal__alreadyRunning" + ""];
|
103
94
|
|
104
95
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["visitors","require","exports","_t","cache","_traverseNode","_index","_index2","_hub","VISITOR_KEYS","removeProperties","traverseFast","traverse","parent","opts","scope","state","parentPath","visitSelf","noScope","type","Error","explode","traverseNode","_default","default","verify","cheap","node","enter","path","skipKeys","clearNode","tree","hasDenylistedType","has","stop","hasType","denylistTypes","includes","denylist"
|
1
|
+
{"version":3,"names":["visitors","require","exports","_t","cache","_traverseNode","_index","_index2","_hub","VISITOR_KEYS","removeProperties","traverseFast","traverse","parent","opts","scope","state","parentPath","visitSelf","noScope","type","Error","explode","traverseNode","_default","default","verify","cheap","node","enter","path","skipKeys","clearNode","tree","hasDenylistedType","has","stop","hasType","denylistTypes","includes","denylist"],"sources":["../src/index.ts"],"sourcesContent":["import * as visitors from \"./visitors.ts\";\nimport {\n VISITOR_KEYS,\n removeProperties,\n type RemovePropertiesOptions,\n traverseFast,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as cache from \"./cache.ts\";\nimport type NodePath from \"./path/index.ts\";\nimport type { default as Scope, Binding } from \"./scope/index.ts\";\nimport type { ExplodedVisitor, Visitor } from \"./types.ts\";\nimport { traverseNode } from \"./traverse-node.ts\";\n\nexport type { ExplodedVisitor, Visitor, Binding };\nexport { default as NodePath } from \"./path/index.ts\";\nexport { default as Scope } from \"./scope/index.ts\";\nexport { default as Hub } from \"./hub.ts\";\nexport type { HubInterface } from \"./hub.ts\";\n\nexport { visitors };\n\nexport type TraverseOptions<S = t.Node> = {\n scope?: Scope;\n noScope?: boolean;\n denylist?: string[];\n shouldSkip?: (node: NodePath) => boolean;\n} & Visitor<S>;\n\nexport type ExplodedTraverseOptions<S = t.Node> = TraverseOptions<S> &\n ExplodedVisitor<S>;\n\nfunction traverse<S>(\n parent: t.Node,\n opts: TraverseOptions<S>,\n scope: Scope | undefined,\n state: S,\n parentPath?: NodePath,\n visitSelf?: boolean,\n): void;\n\nfunction traverse(\n parent: t.Node,\n opts: TraverseOptions,\n scope?: Scope,\n state?: any,\n parentPath?: NodePath,\n visitSelf?: boolean,\n): void;\n\nfunction traverse<Options extends TraverseOptions>(\n parent: t.Node,\n // @ts-expect-error provide {} as default value for Options\n opts: Options = {},\n scope?: Scope,\n state?: any,\n parentPath?: NodePath,\n visitSelf?: boolean,\n) {\n if (!parent) return;\n\n if (!opts.noScope && !scope) {\n if (parent.type !== \"Program\" && parent.type !== \"File\") {\n throw new Error(\n \"You must pass a scope and parentPath unless traversing a Program/File. \" +\n `Instead of that you tried to traverse a ${parent.type} node without ` +\n \"passing scope and parentPath.\",\n );\n }\n }\n\n if (!parentPath && visitSelf) {\n throw new Error(\"visitSelf can only be used when providing a NodePath.\");\n }\n\n if (!VISITOR_KEYS[parent.type]) {\n return;\n }\n\n visitors.explode(opts as Visitor);\n\n traverseNode(\n parent,\n opts as ExplodedVisitor,\n scope,\n state,\n parentPath,\n /* skipKeys */ null,\n visitSelf,\n );\n}\n\nexport default traverse;\n\ntraverse.visitors = visitors;\ntraverse.verify = visitors.verify;\ntraverse.explode = visitors.explode;\n\ntraverse.cheap = function (node: t.Node, enter: (node: t.Node) => void) {\n traverseFast(node, enter);\n return;\n};\n\ntraverse.node = function (\n node: t.Node,\n opts: ExplodedTraverseOptions,\n scope?: Scope,\n state?: any,\n path?: NodePath,\n skipKeys?: Record<string, boolean>,\n) {\n traverseNode(node, opts, scope, state, path, skipKeys);\n // traverse.node always returns undefined\n};\n\ntraverse.clearNode = function (node: t.Node, opts?: RemovePropertiesOptions) {\n removeProperties(node, opts);\n};\n\ntraverse.removeProperties = function (\n tree: t.Node,\n opts?: RemovePropertiesOptions,\n) {\n traverseFast(tree, traverse.clearNode, opts);\n return tree;\n};\n\ntype HasDenylistedTypeState = {\n has: boolean;\n type: t.Node[\"type\"];\n};\nfunction hasDenylistedType(path: NodePath, state: HasDenylistedTypeState) {\n if (path.node.type === state.type) {\n state.has = true;\n path.stop();\n }\n}\n\ntraverse.hasType = function (\n tree: t.Node,\n type: t.Node[\"type\"],\n denylistTypes?: Array<string>,\n): boolean {\n // the node we're searching in is denylisted\n if (denylistTypes?.includes(tree.type)) return false;\n\n // the type we're looking for is the same as the passed node\n if (tree.type === type) return true;\n\n const state: HasDenylistedTypeState = {\n has: false,\n type: type,\n };\n\n traverse(\n tree,\n {\n noScope: true,\n denylist: denylistTypes,\n enter: hasDenylistedType,\n },\n null,\n state,\n );\n\n return state.has;\n};\n\ntraverse.cache = cache;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAA0CC,OAAA,CAAAF,QAAA,GAAAA,QAAA;AAC1C,IAAAG,EAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AAIA,IAAAI,a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vBT,KAAK,EAAEK;EACT,CAAC,EACD,IAAI,EACJlB,KACF,CAAC;EAED,OAAOA,KAAK,CAACmB,GAAG;AAClB,CAAC;AAEDvB,QAAQ,CAACR,KAAK,GAAGA,KAAK"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babel/traverse",
|
3
|
-
"version": "7.22.
|
3
|
+
"version": "7.22.19",
|
4
4
|
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
|
5
5
|
"author": "The Babel Team (https://babel.dev/team)",
|
6
6
|
"homepage": "https://babel.dev/docs/en/next/babel-traverse",
|
@@ -23,12 +23,12 @@
|
|
23
23
|
"@babel/helper-hoist-variables": "^7.22.5",
|
24
24
|
"@babel/helper-split-export-declaration": "^7.22.6",
|
25
25
|
"@babel/parser": "^7.22.16",
|
26
|
-
"@babel/types": "^7.22.
|
26
|
+
"@babel/types": "^7.22.19",
|
27
27
|
"debug": "^4.1.0",
|
28
28
|
"globals": "^11.1.0"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
|
-
"@babel/core": "^7.22.
|
31
|
+
"@babel/core": "^7.22.19",
|
32
32
|
"@babel/helper-plugin-test-runner": "^7.22.5"
|
33
33
|
},
|
34
34
|
"engines": {
|