@babel/traverse 7.14.8 → 7.14.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.
package/lib/path/family.js
CHANGED
@@ -158,7 +158,14 @@ function getStatementListCompletion(paths, context) {
|
|
158
158
|
}
|
159
159
|
}
|
160
160
|
} else if (paths.length) {
|
161
|
-
|
161
|
+
for (let i = paths.length - 1; i >= 0; i--) {
|
162
|
+
const pathCompletions = _getCompletionRecords(paths[i], context);
|
163
|
+
|
164
|
+
if (pathCompletions.length > 1 || pathCompletions.length === 1 && !pathCompletions[0].path.isVariableDeclaration()) {
|
165
|
+
completions = completions.concat(pathCompletions);
|
166
|
+
break;
|
167
|
+
}
|
168
|
+
}
|
162
169
|
}
|
163
170
|
|
164
171
|
return completions;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babel/traverse",
|
3
|
-
"version": "7.14.
|
3
|
+
"version": "7.14.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,12 +17,12 @@
|
|
17
17
|
"main": "./lib/index.js",
|
18
18
|
"dependencies": {
|
19
19
|
"@babel/code-frame": "^7.14.5",
|
20
|
-
"@babel/generator": "^7.14.
|
20
|
+
"@babel/generator": "^7.14.9",
|
21
21
|
"@babel/helper-function-name": "^7.14.5",
|
22
22
|
"@babel/helper-hoist-variables": "^7.14.5",
|
23
23
|
"@babel/helper-split-export-declaration": "^7.14.5",
|
24
|
-
"@babel/parser": "^7.14.
|
25
|
-
"@babel/types": "^7.14.
|
24
|
+
"@babel/parser": "^7.14.9",
|
25
|
+
"@babel/types": "^7.14.9",
|
26
26
|
"debug": "^4.1.0",
|
27
27
|
"globals": "^11.1.0"
|
28
28
|
},
|
@@ -9,6 +9,7 @@ export default function generateValidators() {
|
|
9
9
|
*/
|
10
10
|
import * as t from "@babel/types";
|
11
11
|
import NodePath from "../index";
|
12
|
+
import type { VirtualTypeAliases } from "./virtual-types";
|
12
13
|
|
13
14
|
export interface NodePathValidators {
|
14
15
|
`;
|
@@ -18,10 +19,18 @@ export interface NodePathValidators {
|
|
18
19
|
}
|
19
20
|
|
20
21
|
for (const type of Object.keys(virtualTypes)) {
|
22
|
+
const { types } = virtualTypes[type];
|
21
23
|
if (type[0] === "_") continue;
|
22
24
|
if (definitions.NODE_FIELDS[type] || definitions.FLIPPED_ALIAS_KEYS[type]) {
|
23
25
|
output += `is${type}(opts?: object): this is NodePath<t.${type}>;`;
|
26
|
+
} else if (types /* in VirtualTypeAliases */) {
|
27
|
+
output += `is${type}(opts?: object): this is NodePath<VirtualTypeAliases["${type}"]>;`;
|
24
28
|
} else {
|
29
|
+
// if it don't have types, then VirtualTypeAliases[type] is t.Node
|
30
|
+
// which TS marked as always true
|
31
|
+
// eg. if (path.isBlockScope()) return;
|
32
|
+
// path resolved to `never` here
|
33
|
+
// so we have to return boolean instead of this is NodePath<t.Node> here
|
25
34
|
output += `is${type}(opts?: object): boolean;`;
|
26
35
|
}
|
27
36
|
}
|