@babel/traverse 7.10.5 → 7.11.0
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 +5 -5
- package/lib/path/context.js +7 -5
- package/lib/visitors.js +1 -1
- package/package.json +6 -7
package/lib/index.js
CHANGED
@@ -93,15 +93,15 @@ traverse.removeProperties = function (tree, opts) {
|
|
93
93
|
return tree;
|
94
94
|
};
|
95
95
|
|
96
|
-
function
|
96
|
+
function hasDenylistedType(path, state) {
|
97
97
|
if (path.node.type === state.type) {
|
98
98
|
state.has = true;
|
99
99
|
path.stop();
|
100
100
|
}
|
101
101
|
}
|
102
102
|
|
103
|
-
traverse.hasType = function (tree, type,
|
104
|
-
if (
|
103
|
+
traverse.hasType = function (tree, type, denylistTypes) {
|
104
|
+
if (denylistTypes == null ? void 0 : denylistTypes.includes(tree.type)) return false;
|
105
105
|
if (tree.type === type) return true;
|
106
106
|
const state = {
|
107
107
|
has: false,
|
@@ -109,8 +109,8 @@ traverse.hasType = function (tree, type, blacklistTypes) {
|
|
109
109
|
};
|
110
110
|
traverse(tree, {
|
111
111
|
noScope: true,
|
112
|
-
|
113
|
-
enter:
|
112
|
+
denylist: denylistTypes,
|
113
|
+
enter: hasDenylistedType
|
114
114
|
}, null, state);
|
115
115
|
return state.has;
|
116
116
|
};
|
package/lib/path/context.js
CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.call = call;
|
7
7
|
exports._call = _call;
|
8
|
-
exports.isBlacklisted =
|
8
|
+
exports.isBlacklisted = exports.isDenylisted = isDenylisted;
|
9
9
|
exports.visit = visit;
|
10
10
|
exports.skip = skip;
|
11
11
|
exports.skipKey = skipKey;
|
@@ -69,9 +69,11 @@ function _call(fns) {
|
|
69
69
|
return false;
|
70
70
|
}
|
71
71
|
|
72
|
-
function
|
73
|
-
|
74
|
-
|
72
|
+
function isDenylisted() {
|
73
|
+
var _this$opts$denylist;
|
74
|
+
|
75
|
+
const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist;
|
76
|
+
return denylist && denylist.indexOf(this.node.type) > -1;
|
75
77
|
}
|
76
78
|
|
77
79
|
function visit() {
|
@@ -79,7 +81,7 @@ function visit() {
|
|
79
81
|
return false;
|
80
82
|
}
|
81
83
|
|
82
|
-
if (this.
|
84
|
+
if (this.isDenylisted()) {
|
83
85
|
return false;
|
84
86
|
}
|
85
87
|
|
package/lib/visitors.js
CHANGED
@@ -226,7 +226,7 @@ function shouldIgnoreKey(key) {
|
|
226
226
|
if (key[0] === "_") return true;
|
227
227
|
if (key === "enter" || key === "exit" || key === "shouldSkip") return true;
|
228
228
|
|
229
|
-
if (key === "
|
229
|
+
if (key === "denylist" || key === "noScope" || key === "skipKeys" || key === "blacklist") {
|
230
230
|
return true;
|
231
231
|
}
|
232
232
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babel/traverse",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.11.0",
|
4
4
|
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
|
5
5
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
6
6
|
"homepage": "https://babeljs.io/",
|
@@ -16,17 +16,16 @@
|
|
16
16
|
"main": "lib/index.js",
|
17
17
|
"dependencies": {
|
18
18
|
"@babel/code-frame": "^7.10.4",
|
19
|
-
"@babel/generator": "^7.
|
19
|
+
"@babel/generator": "^7.11.0",
|
20
20
|
"@babel/helper-function-name": "^7.10.4",
|
21
|
-
"@babel/helper-split-export-declaration": "^7.
|
22
|
-
"@babel/parser": "^7.
|
23
|
-
"@babel/types": "^7.
|
21
|
+
"@babel/helper-split-export-declaration": "^7.11.0",
|
22
|
+
"@babel/parser": "^7.11.0",
|
23
|
+
"@babel/types": "^7.11.0",
|
24
24
|
"debug": "^4.1.0",
|
25
25
|
"globals": "^11.1.0",
|
26
26
|
"lodash": "^4.17.19"
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
29
|
"@babel/helper-plugin-test-runner": "^7.10.4"
|
30
|
-
}
|
31
|
-
"gitHead": "f7964a9ac51356f7df6404a25b27ba1cffba1ba7"
|
30
|
+
}
|
32
31
|
}
|