@babel/traverse 7.13.0 → 7.13.13
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/context.js +1 -1
- package/lib/index.js +1 -1
- package/lib/path/evaluation.js +1 -1
- package/lib/path/index.js +3 -3
- package/lib/path/inference/index.js +1 -1
- package/lib/path/removal.js +1 -1
- package/lib/scope/index.js +5 -5
- package/package.json +6 -7
package/lib/context.js
CHANGED
@@ -32,7 +32,7 @@ class TraversalContext {
|
|
32
32
|
if (opts.enter || opts.exit) return true;
|
33
33
|
if (opts[node.type]) return true;
|
34
34
|
const keys = t.VISITOR_KEYS[node.type];
|
35
|
-
if (!(keys
|
35
|
+
if (!(keys != null && keys.length)) return false;
|
36
36
|
|
37
37
|
for (const key of keys) {
|
38
38
|
if (node[key]) return true;
|
package/lib/index.js
CHANGED
@@ -101,7 +101,7 @@ function hasDenylistedType(path, state) {
|
|
101
101
|
}
|
102
102
|
|
103
103
|
traverse.hasType = function (tree, type, denylistTypes) {
|
104
|
-
if (denylistTypes
|
104
|
+
if (denylistTypes != null && denylistTypes.includes(tree.type)) return false;
|
105
105
|
if (tree.type === type) return true;
|
106
106
|
const state = {
|
107
107
|
has: false,
|
package/lib/path/evaluation.js
CHANGED
@@ -129,7 +129,7 @@ function _evaluate(path, state) {
|
|
129
129
|
return deopt(binding.path, state);
|
130
130
|
}
|
131
131
|
|
132
|
-
if (binding
|
132
|
+
if (binding != null && binding.hasValue) {
|
133
133
|
return binding.value;
|
134
134
|
} else {
|
135
135
|
if (path.node.name === "undefined") {
|
package/lib/path/index.js
CHANGED
@@ -7,8 +7,6 @@ exports.default = exports.SHOULD_SKIP = exports.SHOULD_STOP = exports.REMOVED =
|
|
7
7
|
|
8
8
|
var virtualTypes = _interopRequireWildcard(require("./lib/virtual-types"));
|
9
9
|
|
10
|
-
var _debug = _interopRequireDefault(require("debug"));
|
11
|
-
|
12
10
|
var _index = _interopRequireDefault(require("../index"));
|
13
11
|
|
14
12
|
var _scope = _interopRequireDefault(require("../scope"));
|
@@ -47,7 +45,9 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
47
45
|
|
48
46
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
49
47
|
|
50
|
-
const
|
48
|
+
const buildDebug = require("debug");
|
49
|
+
|
50
|
+
const debug = buildDebug("babel");
|
51
51
|
const REMOVED = 1 << 0;
|
52
52
|
exports.REMOVED = REMOVED;
|
53
53
|
const SHOULD_STOP = 1 << 1;
|
@@ -70,7 +70,7 @@ function _getTypeAnnotation() {
|
|
70
70
|
|
71
71
|
inferer = inferers[this.parentPath.type];
|
72
72
|
|
73
|
-
if ((_inferer = inferer)
|
73
|
+
if ((_inferer = inferer) != null && _inferer.validParent) {
|
74
74
|
return this.parentPath.getTypeAnnotation();
|
75
75
|
}
|
76
76
|
} finally {
|
package/lib/path/removal.js
CHANGED
package/lib/scope/index.js
CHANGED
@@ -11,8 +11,6 @@ var _index = _interopRequireDefault(require("../index"));
|
|
11
11
|
|
12
12
|
var _binding = _interopRequireDefault(require("./binding"));
|
13
13
|
|
14
|
-
var _globals = _interopRequireDefault(require("globals"));
|
15
|
-
|
16
14
|
var t = _interopRequireWildcard(require("@babel/types"));
|
17
15
|
|
18
16
|
var _cache = require("../cache");
|
@@ -23,6 +21,8 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
23
21
|
|
24
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
23
|
|
24
|
+
const globals = require("globals");
|
25
|
+
|
26
26
|
function gatherNodeParts(node, parts) {
|
27
27
|
switch (node == null ? void 0 : node.type) {
|
28
28
|
default:
|
@@ -470,7 +470,7 @@ class Scope {
|
|
470
470
|
if (t.isIdentifier(node)) {
|
471
471
|
const binding = this.getBinding(node.name);
|
472
472
|
|
473
|
-
if (
|
473
|
+
if (binding != null && binding.constant && binding.path.isGenericType("Array")) {
|
474
474
|
return node;
|
475
475
|
}
|
476
476
|
}
|
@@ -891,7 +891,7 @@ class Scope {
|
|
891
891
|
if (binding) {
|
892
892
|
var _previousPath;
|
893
893
|
|
894
|
-
if ((
|
894
|
+
if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param") {} else {
|
895
895
|
return binding;
|
896
896
|
}
|
897
897
|
}
|
@@ -965,5 +965,5 @@ class Scope {
|
|
965
965
|
}
|
966
966
|
|
967
967
|
exports.default = Scope;
|
968
|
-
Scope.globals = Object.keys(
|
968
|
+
Scope.globals = Object.keys(globals.builtin);
|
969
969
|
Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babel/traverse",
|
3
|
-
"version": "7.13.
|
3
|
+
"version": "7.13.13",
|
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://babel.dev/docs/en/next/babel-traverse",
|
@@ -17,16 +17,15 @@
|
|
17
17
|
"main": "lib/index.js",
|
18
18
|
"dependencies": {
|
19
19
|
"@babel/code-frame": "^7.12.13",
|
20
|
-
"@babel/generator": "^7.13.
|
20
|
+
"@babel/generator": "^7.13.9",
|
21
21
|
"@babel/helper-function-name": "^7.12.13",
|
22
22
|
"@babel/helper-split-export-declaration": "^7.12.13",
|
23
|
-
"@babel/parser": "^7.13.
|
24
|
-
"@babel/types": "^7.13.
|
23
|
+
"@babel/parser": "^7.13.13",
|
24
|
+
"@babel/types": "^7.13.13",
|
25
25
|
"debug": "^4.1.0",
|
26
|
-
"globals": "^11.1.0"
|
27
|
-
"lodash": "^4.17.19"
|
26
|
+
"globals": "^11.1.0"
|
28
27
|
},
|
29
28
|
"devDependencies": {
|
30
|
-
"@babel/helper-plugin-test-runner": "7.
|
29
|
+
"@babel/helper-plugin-test-runner": "7.13.10"
|
31
30
|
}
|
32
31
|
}
|