@babel/traverse 7.18.8 → 7.18.9
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.
@@ -441,13 +441,20 @@ function isInStrictMode() {
|
|
441
441
|
sourceType: "module"
|
442
442
|
})) return true;
|
443
443
|
if (path.isClass()) return true;
|
444
|
-
if (!path.isProgram() && !path.isFunction()) return false;
|
445
444
|
|
446
445
|
if (path.isArrowFunctionExpression() && !path.get("body").isBlockStatement()) {
|
447
446
|
return false;
|
448
447
|
}
|
449
448
|
|
450
|
-
|
449
|
+
let body;
|
450
|
+
|
451
|
+
if (path.isFunction()) {
|
452
|
+
body = path.node.body;
|
453
|
+
} else if (path.isProgram()) {
|
454
|
+
body = path.node;
|
455
|
+
} else {
|
456
|
+
return false;
|
457
|
+
}
|
451
458
|
|
452
459
|
for (const directive of body.directives) {
|
453
460
|
if (directive.value.value === "use strict") {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babel/traverse",
|
3
|
-
"version": "7.18.
|
3
|
+
"version": "7.18.9",
|
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",
|
@@ -17,13 +17,13 @@
|
|
17
17
|
"main": "./lib/index.js",
|
18
18
|
"dependencies": {
|
19
19
|
"@babel/code-frame": "^7.18.6",
|
20
|
-
"@babel/generator": "^7.18.
|
21
|
-
"@babel/helper-environment-visitor": "^7.18.
|
22
|
-
"@babel/helper-function-name": "^7.18.
|
20
|
+
"@babel/generator": "^7.18.9",
|
21
|
+
"@babel/helper-environment-visitor": "^7.18.9",
|
22
|
+
"@babel/helper-function-name": "^7.18.9",
|
23
23
|
"@babel/helper-hoist-variables": "^7.18.6",
|
24
24
|
"@babel/helper-split-export-declaration": "^7.18.6",
|
25
|
-
"@babel/parser": "^7.18.
|
26
|
-
"@babel/types": "^7.18.
|
25
|
+
"@babel/parser": "^7.18.9",
|
26
|
+
"@babel/types": "^7.18.9",
|
27
27
|
"debug": "^4.1.0",
|
28
28
|
"globals": "^11.1.0"
|
29
29
|
},
|
@@ -14,7 +14,7 @@ export interface NodePathValidators {
|
|
14
14
|
`;
|
15
15
|
|
16
16
|
for (const type of [...t.TYPES].sort()) {
|
17
|
-
output += `is${type}(opts?: object): this is NodePath<t.${type}>;`;
|
17
|
+
output += `is${type}<T extends t.Node>(this: NodePath<T>, opts?: object): this is NodePath<T & t.${type}>;`;
|
18
18
|
}
|
19
19
|
|
20
20
|
for (const type of Object.keys(virtualTypes)) {
|
@@ -24,9 +24,9 @@ export interface NodePathValidators {
|
|
24
24
|
const { types } = virtualTypes[type];
|
25
25
|
if (type[0] === "_") continue;
|
26
26
|
if (t.NODE_FIELDS[type] || t.FLIPPED_ALIAS_KEYS[type]) {
|
27
|
-
output += `is${type}(opts?: object): this is NodePath<t.${type}>;`;
|
27
|
+
output += `is${type}<T extends t.Node>(this: NodePath<T>, opts?: object): this is NodePath<T & t.${type}>;`;
|
28
28
|
} else if (types /* in VirtualTypeAliases */) {
|
29
|
-
output += `is${type}(opts?: object): this is NodePath<VirtualTypeAliases["${type}"]>;`;
|
29
|
+
output += `is${type}<T extends t.Node>(this: NodePath<T>, opts?: object): this is NodePath<T & VirtualTypeAliases["${type}"]>;`;
|
30
30
|
} else if (type === "Pure") {
|
31
31
|
output += `isPure(constantsOnly?: boolean): boolean;`;
|
32
32
|
} else {
|