@babel/traverse 7.12.10 → 7.13.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/context.js +1 -0
- package/lib/index.js +4 -4
- package/lib/path/ancestry.js +2 -2
- package/lib/path/context.js +1 -0
- package/lib/path/conversion.js +11 -11
- package/lib/path/evaluation.js +16 -19
- package/lib/path/family.js +2 -0
- package/lib/path/generated/asserts.js +11 -0
- package/lib/path/generated/validators.js +11 -0
- package/lib/path/generated/virtual-types.js +7 -0
- package/lib/path/index.js +4 -2
- package/lib/path/inference/index.js +4 -2
- package/lib/path/introspection.js +17 -8
- package/lib/path/lib/hoister.js +8 -1
- package/lib/path/modification.js +26 -13
- package/lib/path/removal.js +5 -1
- package/lib/scope/binding.js +4 -0
- package/lib/scope/index.js +48 -38
- package/lib/scope/lib/renamer.js +24 -5
- package/lib/types.js +11 -0
- package/lib/visitors.js +4 -4
- package/package.json +10 -9
- package/scripts/generators/asserts.js +25 -0
- package/scripts/generators/validators.js +34 -0
- package/scripts/generators/virtual-types.js +24 -0
- package/scripts/package.json +1 -0
package/lib/context.js
CHANGED
package/lib/index.js
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default = traverse;
|
7
6
|
Object.defineProperty(exports, "NodePath", {
|
8
7
|
enumerable: true,
|
9
8
|
get: function () {
|
@@ -22,7 +21,7 @@ Object.defineProperty(exports, "Hub", {
|
|
22
21
|
return _hub.default;
|
23
22
|
}
|
24
23
|
});
|
25
|
-
exports.visitors = void 0;
|
24
|
+
exports.visitors = exports.default = void 0;
|
26
25
|
|
27
26
|
var _context = _interopRequireDefault(require("./context"));
|
28
27
|
|
@@ -46,9 +45,8 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
46
45
|
|
47
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
48
47
|
|
49
|
-
function traverse(parent, opts, scope, state, parentPath) {
|
48
|
+
function traverse(parent, opts = {}, scope, state, parentPath) {
|
50
49
|
if (!parent) return;
|
51
|
-
if (!opts) opts = {};
|
52
50
|
|
53
51
|
if (!opts.noScope && !scope) {
|
54
52
|
if (parent.type !== "Program" && parent.type !== "File") {
|
@@ -64,6 +62,8 @@ function traverse(parent, opts, scope, state, parentPath) {
|
|
64
62
|
traverse.node(parent, opts, scope, state, parentPath);
|
65
63
|
}
|
66
64
|
|
65
|
+
var _default = traverse;
|
66
|
+
exports.default = _default;
|
67
67
|
traverse.visitors = visitors;
|
68
68
|
traverse.verify = visitors.verify;
|
69
69
|
traverse.explode = visitors.explode;
|
package/lib/path/ancestry.js
CHANGED
@@ -167,11 +167,11 @@ function isDescendant(maybeAncestor) {
|
|
167
167
|
return !!this.findParent(parent => parent === maybeAncestor);
|
168
168
|
}
|
169
169
|
|
170
|
-
function inType() {
|
170
|
+
function inType(...candidateTypes) {
|
171
171
|
let path = this;
|
172
172
|
|
173
173
|
while (path) {
|
174
|
-
for (const type of
|
174
|
+
for (const type of candidateTypes) {
|
175
175
|
if (path.node.type === type) return true;
|
176
176
|
}
|
177
177
|
|
package/lib/path/context.js
CHANGED
package/lib/path/conversion.js
CHANGED
@@ -20,18 +20,17 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
20
20
|
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; }
|
21
21
|
|
22
22
|
function toComputedKey() {
|
23
|
-
const node = this.node;
|
24
23
|
let key;
|
25
24
|
|
26
25
|
if (this.isMemberExpression()) {
|
27
|
-
key = node.property;
|
26
|
+
key = this.node.property;
|
28
27
|
} else if (this.isProperty() || this.isMethod()) {
|
29
|
-
key = node.key;
|
28
|
+
key = this.node.key;
|
30
29
|
} else {
|
31
30
|
throw new ReferenceError("todo");
|
32
31
|
}
|
33
32
|
|
34
|
-
if (!node.computed) {
|
33
|
+
if (!this.node.computed) {
|
35
34
|
if (t.isIdentifier(key)) key = t.stringLiteral(key.name);
|
36
35
|
}
|
37
36
|
|
@@ -96,17 +95,18 @@ function unwrapFunctionEnvironment() {
|
|
96
95
|
|
97
96
|
function arrowFunctionToExpression({
|
98
97
|
allowInsertArrow = true,
|
99
|
-
specCompliant = false
|
98
|
+
specCompliant = false,
|
99
|
+
noNewArrows = !specCompliant
|
100
100
|
} = {}) {
|
101
101
|
if (!this.isArrowFunctionExpression()) {
|
102
102
|
throw this.buildCodeFrameError("Cannot convert non-arrow function to a function expression.");
|
103
103
|
}
|
104
104
|
|
105
|
-
const thisBinding = hoistFunctionEnvironment(this,
|
105
|
+
const thisBinding = hoistFunctionEnvironment(this, noNewArrows, allowInsertArrow);
|
106
106
|
this.ensureBlock();
|
107
107
|
this.node.type = "FunctionExpression";
|
108
108
|
|
109
|
-
if (
|
109
|
+
if (!noNewArrows) {
|
110
110
|
const checkBinding = thisBinding ? null : this.parentPath.scope.generateUidIdentifier("arrowCheckId");
|
111
111
|
|
112
112
|
if (checkBinding) {
|
@@ -121,7 +121,7 @@ function arrowFunctionToExpression({
|
|
121
121
|
}
|
122
122
|
}
|
123
123
|
|
124
|
-
function hoistFunctionEnvironment(fnPath,
|
124
|
+
function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow = true) {
|
125
125
|
const thisEnvFn = fnPath.findParent(p => {
|
126
126
|
return p.isFunction() && !p.isArrowFunctionExpression() || p.isProgram() || p.isClassProperty({
|
127
127
|
static: false
|
@@ -231,16 +231,16 @@ function hoistFunctionEnvironment(fnPath, specCompliant = false, allowInsertArro
|
|
231
231
|
|
232
232
|
let thisBinding;
|
233
233
|
|
234
|
-
if (thisPaths.length > 0 ||
|
234
|
+
if (thisPaths.length > 0 || !noNewArrows) {
|
235
235
|
thisBinding = getThisBinding(thisEnvFn, inConstructor);
|
236
236
|
|
237
|
-
if (
|
237
|
+
if (noNewArrows || inConstructor && hasSuperClass(thisEnvFn)) {
|
238
238
|
thisPaths.forEach(thisChild => {
|
239
239
|
const thisRef = thisChild.isJSX() ? t.jsxIdentifier(thisBinding) : t.identifier(thisBinding);
|
240
240
|
thisRef.loc = thisChild.node.loc;
|
241
241
|
thisChild.replaceWith(thisRef);
|
242
242
|
});
|
243
|
-
if (
|
243
|
+
if (!noNewArrows) thisBinding = null;
|
244
244
|
}
|
245
245
|
}
|
246
246
|
|
package/lib/path/evaluation.js
CHANGED
@@ -55,9 +55,6 @@ function evaluateCached(path, state) {
|
|
55
55
|
|
56
56
|
function _evaluate(path, state) {
|
57
57
|
if (!state.confident) return;
|
58
|
-
const {
|
59
|
-
node
|
60
|
-
} = path;
|
61
58
|
|
62
59
|
if (path.isSequenceExpression()) {
|
63
60
|
const exprs = path.get("expressions");
|
@@ -65,7 +62,7 @@ function _evaluate(path, state) {
|
|
65
62
|
}
|
66
63
|
|
67
64
|
if (path.isStringLiteral() || path.isNumericLiteral() || path.isBooleanLiteral()) {
|
68
|
-
return node.value;
|
65
|
+
return path.node.value;
|
69
66
|
}
|
70
67
|
|
71
68
|
if (path.isNullLiteral()) {
|
@@ -73,7 +70,7 @@ function _evaluate(path, state) {
|
|
73
70
|
}
|
74
71
|
|
75
72
|
if (path.isTemplateLiteral()) {
|
76
|
-
return evaluateQuasis(path, node.quasis, state);
|
73
|
+
return evaluateQuasis(path, path.node.quasis, state);
|
77
74
|
}
|
78
75
|
|
79
76
|
if (path.isTaggedTemplateExpression() && path.get("tag").isMemberExpression()) {
|
@@ -85,8 +82,8 @@ function _evaluate(path, state) {
|
|
85
82
|
} = object;
|
86
83
|
const property = path.get("tag.property");
|
87
84
|
|
88
|
-
if (object.isIdentifier() && name === "String" && !path.scope.getBinding(name
|
89
|
-
return evaluateQuasis(path, node.quasi.quasis, state, true);
|
85
|
+
if (object.isIdentifier() && name === "String" && !path.scope.getBinding(name) && property.isIdentifier() && property.node.name === "raw") {
|
86
|
+
return evaluateQuasis(path, path.node.quasi.quasis, state, true);
|
90
87
|
}
|
91
88
|
}
|
92
89
|
|
@@ -106,7 +103,7 @@ function _evaluate(path, state) {
|
|
106
103
|
}
|
107
104
|
|
108
105
|
if (path.isMemberExpression() && !path.parentPath.isCallExpression({
|
109
|
-
callee: node
|
106
|
+
callee: path.node
|
110
107
|
})) {
|
111
108
|
const property = path.get("property");
|
112
109
|
const object = path.get("object");
|
@@ -122,7 +119,7 @@ function _evaluate(path, state) {
|
|
122
119
|
}
|
123
120
|
|
124
121
|
if (path.isReferencedIdentifier()) {
|
125
|
-
const binding = path.scope.getBinding(node.name);
|
122
|
+
const binding = path.scope.getBinding(path.node.name);
|
126
123
|
|
127
124
|
if (binding && binding.constantViolations.length > 0) {
|
128
125
|
return deopt(binding.path, state);
|
@@ -135,11 +132,11 @@ function _evaluate(path, state) {
|
|
135
132
|
if (binding == null ? void 0 : binding.hasValue) {
|
136
133
|
return binding.value;
|
137
134
|
} else {
|
138
|
-
if (node.name === "undefined") {
|
135
|
+
if (path.node.name === "undefined") {
|
139
136
|
return binding ? deopt(binding.path, state) : undefined;
|
140
|
-
} else if (node.name === "Infinity") {
|
137
|
+
} else if (path.node.name === "Infinity") {
|
141
138
|
return binding ? deopt(binding.path, state) : Infinity;
|
142
|
-
} else if (node.name === "NaN") {
|
139
|
+
} else if (path.node.name === "NaN") {
|
143
140
|
return binding ? deopt(binding.path, state) : NaN;
|
144
141
|
}
|
145
142
|
|
@@ -156,20 +153,20 @@ function _evaluate(path, state) {
|
|
156
153
|
if (path.isUnaryExpression({
|
157
154
|
prefix: true
|
158
155
|
})) {
|
159
|
-
if (node.operator === "void") {
|
156
|
+
if (path.node.operator === "void") {
|
160
157
|
return undefined;
|
161
158
|
}
|
162
159
|
|
163
160
|
const argument = path.get("argument");
|
164
161
|
|
165
|
-
if (node.operator === "typeof" && (argument.isFunction() || argument.isClass())) {
|
162
|
+
if (path.node.operator === "typeof" && (argument.isFunction() || argument.isClass())) {
|
166
163
|
return "function";
|
167
164
|
}
|
168
165
|
|
169
166
|
const arg = evaluateCached(argument, state);
|
170
167
|
if (!state.confident) return;
|
171
168
|
|
172
|
-
switch (node.operator) {
|
169
|
+
switch (path.node.operator) {
|
173
170
|
case "!":
|
174
171
|
return !arg;
|
175
172
|
|
@@ -252,7 +249,7 @@ function _evaluate(path, state) {
|
|
252
249
|
const right = evaluateCached(path.get("right"), state);
|
253
250
|
const rightConfident = state.confident;
|
254
251
|
|
255
|
-
switch (node.operator) {
|
252
|
+
switch (path.node.operator) {
|
256
253
|
case "||":
|
257
254
|
state.confident = leftConfident && (!!left || rightConfident);
|
258
255
|
if (!state.confident) return;
|
@@ -271,7 +268,7 @@ function _evaluate(path, state) {
|
|
271
268
|
const right = evaluateCached(path.get("right"), state);
|
272
269
|
if (!state.confident) return;
|
273
270
|
|
274
|
-
switch (node.operator) {
|
271
|
+
switch (path.node.operator) {
|
275
272
|
case "-":
|
276
273
|
return left - right;
|
277
274
|
|
@@ -339,8 +336,8 @@ function _evaluate(path, state) {
|
|
339
336
|
let context;
|
340
337
|
let func;
|
341
338
|
|
342
|
-
if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name
|
343
|
-
func = global[node.
|
339
|
+
if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name) && VALID_CALLEES.indexOf(callee.node.name) >= 0) {
|
340
|
+
func = global[callee.node.name];
|
344
341
|
}
|
345
342
|
|
346
343
|
if (callee.isMemberExpression()) {
|
package/lib/path/family.js
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var t = _interopRequireWildcard(require("@babel/types"));
|
4
|
+
|
5
|
+
var _index = _interopRequireDefault(require("../index"));
|
6
|
+
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
+
|
9
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
10
|
+
|
11
|
+
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; }
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var t = _interopRequireWildcard(require("@babel/types"));
|
4
|
+
|
5
|
+
var _index = _interopRequireDefault(require("../index"));
|
6
|
+
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
+
|
9
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
10
|
+
|
11
|
+
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; }
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var t = _interopRequireWildcard(require("@babel/types"));
|
4
|
+
|
5
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
6
|
+
|
7
|
+
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; }
|
package/lib/path/index.js
CHANGED
@@ -221,7 +221,6 @@ class NodePath {
|
|
221
221
|
|
222
222
|
}
|
223
223
|
|
224
|
-
exports.default = NodePath;
|
225
224
|
Object.assign(NodePath.prototype, NodePath_ancestry, NodePath_inference, NodePath_replacement, NodePath_evaluation, NodePath_conversion, NodePath_introspection, NodePath_context, NodePath_removal, NodePath_modification, NodePath_family, NodePath_comments);
|
226
225
|
|
227
226
|
for (const type of t.TYPES) {
|
@@ -247,4 +246,7 @@ for (const type of Object.keys(virtualTypes)) {
|
|
247
246
|
NodePath.prototype[`is${type}`] = function (opts) {
|
248
247
|
return virtualType.checkPath(this, opts);
|
249
248
|
};
|
250
|
-
}
|
249
|
+
}
|
250
|
+
|
251
|
+
var _default = NodePath;
|
252
|
+
exports.default = _default;
|
@@ -123,13 +123,15 @@ function couldBeBaseType(name) {
|
|
123
123
|
}
|
124
124
|
}
|
125
125
|
|
126
|
-
function baseTypeStrictlyMatches(
|
126
|
+
function baseTypeStrictlyMatches(rightArg) {
|
127
127
|
const left = this.getTypeAnnotation();
|
128
|
-
right =
|
128
|
+
const right = rightArg.getTypeAnnotation();
|
129
129
|
|
130
130
|
if (!t.isAnyTypeAnnotation(left) && t.isFlowBaseAnnotation(left)) {
|
131
131
|
return right.type === left.type;
|
132
132
|
}
|
133
|
+
|
134
|
+
return false;
|
133
135
|
}
|
134
136
|
|
135
137
|
function isGenericType(genericName) {
|
@@ -111,7 +111,17 @@ function isStatementOrBlock() {
|
|
111
111
|
}
|
112
112
|
|
113
113
|
function referencesImport(moduleSource, importName) {
|
114
|
-
if (!this.isReferencedIdentifier())
|
114
|
+
if (!this.isReferencedIdentifier()) {
|
115
|
+
if ((this.isMemberExpression() || this.isOptionalMemberExpression()) && (this.node.computed ? t.isStringLiteral(this.node.property, {
|
116
|
+
value: importName
|
117
|
+
}) : this.node.property.name === importName)) {
|
118
|
+
const object = this.get("object");
|
119
|
+
return object.isReferencedIdentifier() && object.referencesImport(moduleSource, "*");
|
120
|
+
}
|
121
|
+
|
122
|
+
return false;
|
123
|
+
}
|
124
|
+
|
115
125
|
const binding = this.scope.getBinding(this.node.name);
|
116
126
|
if (!binding || binding.kind !== "module") return false;
|
117
127
|
const path = binding.path;
|
@@ -132,7 +142,9 @@ function referencesImport(moduleSource, importName) {
|
|
132
142
|
return true;
|
133
143
|
}
|
134
144
|
|
135
|
-
if (path.isImportSpecifier() && path.node.imported
|
145
|
+
if (path.isImportSpecifier() && t.isIdentifier(path.node.imported, {
|
146
|
+
name: importName
|
147
|
+
})) {
|
136
148
|
return true;
|
137
149
|
}
|
138
150
|
|
@@ -377,7 +389,7 @@ function isConstantExpression() {
|
|
377
389
|
}
|
378
390
|
|
379
391
|
if (this.isUnaryExpression()) {
|
380
|
-
if (this.
|
392
|
+
if (this.node.operator !== "void") {
|
381
393
|
return false;
|
382
394
|
}
|
383
395
|
|
@@ -404,12 +416,9 @@ function isInStrictMode() {
|
|
404
416
|
return false;
|
405
417
|
}
|
406
418
|
|
407
|
-
|
408
|
-
node
|
409
|
-
} = path;
|
410
|
-
if (path.isFunction()) node = node.body;
|
419
|
+
const body = path.isFunction() ? path.node.body : path.node;
|
411
420
|
|
412
|
-
for (const directive of
|
421
|
+
for (const directive of body.directives) {
|
413
422
|
if (directive.value.value === "use strict") {
|
414
423
|
return true;
|
415
424
|
}
|
package/lib/path/lib/hoister.js
CHANGED
@@ -48,6 +48,13 @@ const referenceVisitor = {
|
|
48
48
|
|
49
49
|
class PathHoister {
|
50
50
|
constructor(path, scope) {
|
51
|
+
this.breakOnScopePaths = void 0;
|
52
|
+
this.bindings = void 0;
|
53
|
+
this.mutableBinding = void 0;
|
54
|
+
this.scopes = void 0;
|
55
|
+
this.scope = void 0;
|
56
|
+
this.path = void 0;
|
57
|
+
this.attachAfter = void 0;
|
51
58
|
this.breakOnScopePaths = [];
|
52
59
|
this.bindings = {};
|
53
60
|
this.mutableBinding = false;
|
@@ -181,7 +188,7 @@ class PathHoister {
|
|
181
188
|
const parent = this.path.parentPath;
|
182
189
|
|
183
190
|
if (parent.isJSXElement() && this.path.container === parent.node.children) {
|
184
|
-
uid = t.
|
191
|
+
uid = t.jsxExpressionContainer(uid);
|
185
192
|
}
|
186
193
|
|
187
194
|
this.path.replaceWith(t.cloneNode(uid));
|
package/lib/path/modification.js
CHANGED
@@ -28,10 +28,11 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
28
28
|
|
29
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
30
30
|
|
31
|
-
function insertBefore(
|
31
|
+
function insertBefore(nodes_) {
|
32
32
|
this._assertUnremoved();
|
33
33
|
|
34
|
-
nodes = this._verifyNodeList(
|
34
|
+
const nodes = this._verifyNodeList(nodes_);
|
35
|
+
|
35
36
|
const {
|
36
37
|
parentPath
|
37
38
|
} = this;
|
@@ -44,8 +45,9 @@ function insertBefore(nodes) {
|
|
44
45
|
} else if (Array.isArray(this.container)) {
|
45
46
|
return this._containerInsertBefore(nodes);
|
46
47
|
} else if (this.isStatementOrBlock()) {
|
47
|
-
const
|
48
|
-
this.
|
48
|
+
const node = this.node;
|
49
|
+
const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
|
50
|
+
this.replaceWith(t.blockStatement(shouldInsertCurrentNode ? [node] : []));
|
49
51
|
return this.unshiftContainer("body", nodes);
|
50
52
|
} else {
|
51
53
|
throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
|
@@ -89,10 +91,11 @@ function _containerInsertAfter(nodes) {
|
|
89
91
|
return this._containerInsert(this.key + 1, nodes);
|
90
92
|
}
|
91
93
|
|
92
|
-
function insertAfter(
|
94
|
+
function insertAfter(nodes_) {
|
93
95
|
this._assertUnremoved();
|
94
96
|
|
95
|
-
nodes = this._verifyNodeList(
|
97
|
+
const nodes = this._verifyNodeList(nodes_);
|
98
|
+
|
96
99
|
const {
|
97
100
|
parentPath
|
98
101
|
} = this;
|
@@ -103,19 +106,27 @@ function insertAfter(nodes) {
|
|
103
106
|
}));
|
104
107
|
} else if (this.isNodeType("Expression") && !this.isJSXElement() && !parentPath.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
|
105
108
|
if (this.node) {
|
109
|
+
const node = this.node;
|
106
110
|
let {
|
107
111
|
scope
|
108
112
|
} = this;
|
109
113
|
|
114
|
+
if (scope.path.isPattern()) {
|
115
|
+
t.assertExpression(node);
|
116
|
+
this.replaceWith(t.callExpression(t.arrowFunctionExpression([], node), []));
|
117
|
+
this.get("callee.body").insertAfter(nodes);
|
118
|
+
return [this];
|
119
|
+
}
|
120
|
+
|
110
121
|
if (parentPath.isMethod({
|
111
122
|
computed: true,
|
112
|
-
key:
|
123
|
+
key: node
|
113
124
|
})) {
|
114
125
|
scope = scope.parent;
|
115
126
|
}
|
116
127
|
|
117
128
|
const temp = scope.generateDeclaredUidIdentifier();
|
118
|
-
nodes.unshift(t.expressionStatement(t.assignmentExpression("=", t.cloneNode(temp),
|
129
|
+
nodes.unshift(t.expressionStatement(t.assignmentExpression("=", t.cloneNode(temp), node)));
|
119
130
|
nodes.push(t.expressionStatement(t.cloneNode(temp)));
|
120
131
|
}
|
121
132
|
|
@@ -123,8 +134,9 @@ function insertAfter(nodes) {
|
|
123
134
|
} else if (Array.isArray(this.container)) {
|
124
135
|
return this._containerInsertAfter(nodes);
|
125
136
|
} else if (this.isStatementOrBlock()) {
|
126
|
-
const
|
127
|
-
this.
|
137
|
+
const node = this.node;
|
138
|
+
const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
|
139
|
+
this.replaceWith(t.blockStatement(shouldInsertCurrentNode ? [node] : []));
|
128
140
|
return this.pushContainer("body", nodes);
|
129
141
|
} else {
|
130
142
|
throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
|
@@ -148,7 +160,7 @@ function _verifyNodeList(nodes) {
|
|
148
160
|
return [];
|
149
161
|
}
|
150
162
|
|
151
|
-
if (nodes
|
163
|
+
if (!Array.isArray(nodes)) {
|
152
164
|
nodes = [nodes];
|
153
165
|
}
|
154
166
|
|
@@ -194,7 +206,8 @@ function unshiftContainer(listKey, nodes) {
|
|
194
206
|
function pushContainer(listKey, nodes) {
|
195
207
|
this._assertUnremoved();
|
196
208
|
|
197
|
-
|
209
|
+
const verifiedNodes = this._verifyNodeList(nodes);
|
210
|
+
|
198
211
|
const container = this.node[listKey];
|
199
212
|
|
200
213
|
const path = _index.default.get({
|
@@ -205,7 +218,7 @@ function pushContainer(listKey, nodes) {
|
|
205
218
|
key: container.length
|
206
219
|
}).setContext(this.context);
|
207
220
|
|
208
|
-
return path.replaceWithMultiple(
|
221
|
+
return path.replaceWithMultiple(verifiedNodes);
|
209
222
|
}
|
210
223
|
|
211
224
|
function hoist(scope = this.scope) {
|
package/lib/path/removal.js
CHANGED
@@ -14,7 +14,11 @@ var _removalHooks = require("./lib/removal-hooks");
|
|
14
14
|
|
15
15
|
var _cache = require("../cache");
|
16
16
|
|
17
|
-
var _index = require("./index");
|
17
|
+
var _index = _interopRequireWildcard(require("./index"));
|
18
|
+
|
19
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
20
|
+
|
21
|
+
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; }
|
18
22
|
|
19
23
|
function remove() {
|
20
24
|
var _this$opts;
|
package/lib/scope/binding.js
CHANGED
package/lib/scope/index.js
CHANGED
@@ -27,11 +27,11 @@ function gatherNodeParts(node, parts) {
|
|
27
27
|
switch (node == null ? void 0 : node.type) {
|
28
28
|
default:
|
29
29
|
if (t.isModuleDeclaration(node)) {
|
30
|
-
if (node.source) {
|
30
|
+
if ((t.isExportAllDeclaration(node) || t.isExportNamedDeclaration(node) || t.isImportDeclaration(node)) && node.source) {
|
31
31
|
gatherNodeParts(node.source, parts);
|
32
|
-
} else if (node.specifiers && node.specifiers.length) {
|
32
|
+
} else if ((t.isExportNamedDeclaration(node) || t.isImportDeclaration(node)) && node.specifiers && node.specifiers.length) {
|
33
33
|
for (const e of node.specifiers) gatherNodeParts(e, parts);
|
34
|
-
} else if (node.declaration) {
|
34
|
+
} else if ((t.isExportDefaultDeclaration(node) || t.isExportNamedDeclaration(node)) && node.declaration) {
|
35
35
|
gatherNodeParts(node.declaration, parts);
|
36
36
|
}
|
37
37
|
} else if (t.isModuleSpecifier(node)) {
|
@@ -178,11 +178,7 @@ const collectorVisitor = {
|
|
178
178
|
|
179
179
|
Declaration(path) {
|
180
180
|
if (path.isBlockScoped()) return;
|
181
|
-
|
182
|
-
if (path.isExportDeclaration() && path.get("declaration").isDeclaration()) {
|
183
|
-
return;
|
184
|
-
}
|
185
|
-
|
181
|
+
if (path.isExportDeclaration()) return;
|
186
182
|
const parent = path.scope.getFunctionParent() || path.scope.getProgramParent();
|
187
183
|
parent.registerDeclaration(path);
|
188
184
|
},
|
@@ -205,6 +201,7 @@ const collectorVisitor = {
|
|
205
201
|
node,
|
206
202
|
scope
|
207
203
|
} = path;
|
204
|
+
if (t.isExportAllDeclaration(node)) return;
|
208
205
|
const declar = node.declaration;
|
209
206
|
|
210
207
|
if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) {
|
@@ -225,7 +222,6 @@ const collectorVisitor = {
|
|
225
222
|
},
|
226
223
|
|
227
224
|
LabeledStatement(path) {
|
228
|
-
path.scope.getProgramParent().addGlobal(path.node);
|
229
225
|
path.scope.getBlockParent().registerDeclaration(path);
|
230
226
|
},
|
231
227
|
|
@@ -256,16 +252,6 @@ const collectorVisitor = {
|
|
256
252
|
}
|
257
253
|
},
|
258
254
|
|
259
|
-
Block(path) {
|
260
|
-
const paths = path.get("body");
|
261
|
-
|
262
|
-
for (const bodyPath of paths) {
|
263
|
-
if (bodyPath.isFunctionDeclaration()) {
|
264
|
-
path.scope.getBlockParent().registerDeclaration(bodyPath);
|
265
|
-
}
|
266
|
-
}
|
267
|
-
},
|
268
|
-
|
269
255
|
CatchClause(path) {
|
270
256
|
path.scope.registerBinding("let", path);
|
271
257
|
},
|
@@ -293,6 +279,17 @@ let uid = 0;
|
|
293
279
|
|
294
280
|
class Scope {
|
295
281
|
constructor(path) {
|
282
|
+
this.uid = void 0;
|
283
|
+
this.path = void 0;
|
284
|
+
this.block = void 0;
|
285
|
+
this.labels = void 0;
|
286
|
+
this.inited = void 0;
|
287
|
+
this.bindings = void 0;
|
288
|
+
this.references = void 0;
|
289
|
+
this.globals = void 0;
|
290
|
+
this.uids = void 0;
|
291
|
+
this.data = void 0;
|
292
|
+
this.crawling = void 0;
|
296
293
|
const {
|
297
294
|
node
|
298
295
|
} = path;
|
@@ -313,8 +310,19 @@ class Scope {
|
|
313
310
|
}
|
314
311
|
|
315
312
|
get parent() {
|
316
|
-
|
317
|
-
|
313
|
+
var _parent;
|
314
|
+
|
315
|
+
let parent,
|
316
|
+
path = this.path;
|
317
|
+
|
318
|
+
do {
|
319
|
+
const isKey = path.key === "key";
|
320
|
+
path = path.parentPath;
|
321
|
+
if (isKey && path.isMethod()) path = path.parentPath;
|
322
|
+
if (path && path.isScope()) parent = path;
|
323
|
+
} while (path && !parent);
|
324
|
+
|
325
|
+
return (_parent = parent) == null ? void 0 : _parent.scope;
|
318
326
|
}
|
319
327
|
|
320
328
|
get parentBlock() {
|
@@ -458,7 +466,7 @@ class Scope {
|
|
458
466
|
console.log(sep);
|
459
467
|
}
|
460
468
|
|
461
|
-
toArray(node, i,
|
469
|
+
toArray(node, i, arrayLikeIsIterable) {
|
462
470
|
if (t.isIdentifier(node)) {
|
463
471
|
const binding = this.getBinding(node.name);
|
464
472
|
|
@@ -489,7 +497,7 @@ class Scope {
|
|
489
497
|
helperName = "toArray";
|
490
498
|
}
|
491
499
|
|
492
|
-
if (
|
500
|
+
if (arrayLikeIsIterable) {
|
493
501
|
args.unshift(this.hub.addHelper(helperName));
|
494
502
|
helperName = "maybeArrayLike";
|
495
503
|
}
|
@@ -711,19 +719,6 @@ class Scope {
|
|
711
719
|
this.globals = Object.create(null);
|
712
720
|
this.uids = Object.create(null);
|
713
721
|
this.data = Object.create(null);
|
714
|
-
|
715
|
-
if (path.isFunction()) {
|
716
|
-
if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[t.NOT_LOCAL_BINDING]) {
|
717
|
-
this.registerBinding("local", path.get("id"), path);
|
718
|
-
}
|
719
|
-
|
720
|
-
const params = path.get("params");
|
721
|
-
|
722
|
-
for (const param of params) {
|
723
|
-
this.registerBinding("param", param);
|
724
|
-
}
|
725
|
-
}
|
726
|
-
|
727
722
|
const programParent = this.getProgramParent();
|
728
723
|
if (programParent.crawling) return;
|
729
724
|
const state = {
|
@@ -732,6 +727,21 @@ class Scope {
|
|
732
727
|
assignments: []
|
733
728
|
};
|
734
729
|
this.crawling = true;
|
730
|
+
|
731
|
+
if (path.type !== "Program" && collectorVisitor._exploded) {
|
732
|
+
for (const visit of collectorVisitor.enter) {
|
733
|
+
visit(path, state);
|
734
|
+
}
|
735
|
+
|
736
|
+
const typeVisitors = collectorVisitor[path.type];
|
737
|
+
|
738
|
+
if (typeVisitors) {
|
739
|
+
for (const visit of typeVisitors.enter) {
|
740
|
+
visit(path, state);
|
741
|
+
}
|
742
|
+
}
|
743
|
+
}
|
744
|
+
|
735
745
|
path.traverse(collectorVisitor, state);
|
736
746
|
this.crawling = false;
|
737
747
|
|
@@ -848,10 +858,10 @@ class Scope {
|
|
848
858
|
return ids;
|
849
859
|
}
|
850
860
|
|
851
|
-
getAllBindingsOfKind() {
|
861
|
+
getAllBindingsOfKind(...kinds) {
|
852
862
|
const ids = Object.create(null);
|
853
863
|
|
854
|
-
for (const kind of
|
864
|
+
for (const kind of kinds) {
|
855
865
|
let scope = this;
|
856
866
|
|
857
867
|
do {
|
package/lib/scope/lib/renamer.js
CHANGED
@@ -28,7 +28,7 @@ const renameVisitor = {
|
|
28
28
|
|
29
29
|
Scope(path, state) {
|
30
30
|
if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) {
|
31
|
-
path
|
31
|
+
skipAllButComputedMethodKey(path);
|
32
32
|
}
|
33
33
|
},
|
34
34
|
|
@@ -104,7 +104,15 @@ class Renamer {
|
|
104
104
|
}
|
105
105
|
}
|
106
106
|
|
107
|
-
|
107
|
+
const blockToTraverse = block || scope.block;
|
108
|
+
|
109
|
+
if ((blockToTraverse == null ? void 0 : blockToTraverse.type) === "SwitchStatement") {
|
110
|
+
blockToTraverse.cases.forEach(c => {
|
111
|
+
scope.traverse(c, renameVisitor, this);
|
112
|
+
});
|
113
|
+
} else {
|
114
|
+
scope.traverse(blockToTraverse, renameVisitor, this);
|
115
|
+
}
|
108
116
|
|
109
117
|
if (!block) {
|
110
118
|
scope.removeOwnBinding(oldName);
|
@@ -112,8 +120,6 @@ class Renamer {
|
|
112
120
|
this.binding.identifier.name = newName;
|
113
121
|
}
|
114
122
|
|
115
|
-
if (binding.type === "hoisted") {}
|
116
|
-
|
117
123
|
if (parentDeclar) {
|
118
124
|
this.maybeConvertFromClassFunctionDeclaration(parentDeclar);
|
119
125
|
this.maybeConvertFromClassFunctionExpression(parentDeclar);
|
@@ -122,4 +128,17 @@ class Renamer {
|
|
122
128
|
|
123
129
|
}
|
124
130
|
|
125
|
-
exports.default = Renamer;
|
131
|
+
exports.default = Renamer;
|
132
|
+
|
133
|
+
function skipAllButComputedMethodKey(path) {
|
134
|
+
if (!path.isMethod() || !path.node.computed) {
|
135
|
+
path.skip();
|
136
|
+
return;
|
137
|
+
}
|
138
|
+
|
139
|
+
const keys = t.VISITOR_KEYS[path.type];
|
140
|
+
|
141
|
+
for (const key of keys) {
|
142
|
+
if (key !== "key") path.skipKey(key);
|
143
|
+
}
|
144
|
+
}
|
package/lib/types.js
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var t = _interopRequireWildcard(require("@babel/types"));
|
4
|
+
|
5
|
+
var _index = require("./index");
|
6
|
+
|
7
|
+
var _virtualTypes = require("./path/generated/virtual-types");
|
8
|
+
|
9
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
10
|
+
|
11
|
+
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; }
|
package/lib/visitors.js
CHANGED
@@ -65,11 +65,11 @@ function explode(visitor) {
|
|
65
65
|
if (shouldIgnoreKey(nodeType)) continue;
|
66
66
|
const fns = visitor[nodeType];
|
67
67
|
let aliases = t.FLIPPED_ALIAS_KEYS[nodeType];
|
68
|
-
const
|
68
|
+
const deprecatedKey = t.DEPRECATED_KEYS[nodeType];
|
69
69
|
|
70
|
-
if (
|
71
|
-
console.trace(`Visitor defined for ${nodeType} but it has been renamed to ${
|
72
|
-
aliases = [
|
70
|
+
if (deprecatedKey) {
|
71
|
+
console.trace(`Visitor defined for ${nodeType} but it has been renamed to ${deprecatedKey}`);
|
72
|
+
aliases = [deprecatedKey];
|
73
73
|
}
|
74
74
|
|
75
75
|
if (!aliases) continue;
|
package/package.json
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babel/traverse",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.13.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
|
-
"homepage": "https://
|
6
|
+
"homepage": "https://babel.dev/docs/en/next/babel-traverse",
|
7
|
+
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20traverse%22+is%3Aopen",
|
7
8
|
"license": "MIT",
|
8
9
|
"publishConfig": {
|
9
10
|
"access": "public"
|
@@ -15,17 +16,17 @@
|
|
15
16
|
},
|
16
17
|
"main": "lib/index.js",
|
17
18
|
"dependencies": {
|
18
|
-
"@babel/code-frame": "^7.
|
19
|
-
"@babel/generator": "^7.
|
20
|
-
"@babel/helper-function-name": "^7.
|
21
|
-
"@babel/helper-split-export-declaration": "^7.
|
22
|
-
"@babel/parser": "^7.
|
23
|
-
"@babel/types": "^7.
|
19
|
+
"@babel/code-frame": "^7.12.13",
|
20
|
+
"@babel/generator": "^7.13.0",
|
21
|
+
"@babel/helper-function-name": "^7.12.13",
|
22
|
+
"@babel/helper-split-export-declaration": "^7.12.13",
|
23
|
+
"@babel/parser": "^7.13.0",
|
24
|
+
"@babel/types": "^7.13.0",
|
24
25
|
"debug": "^4.1.0",
|
25
26
|
"globals": "^11.1.0",
|
26
27
|
"lodash": "^4.17.19"
|
27
28
|
},
|
28
29
|
"devDependencies": {
|
29
|
-
"@babel/helper-plugin-test-runner": "7.
|
30
|
+
"@babel/helper-plugin-test-runner": "7.12.13"
|
30
31
|
}
|
31
32
|
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import t from "@babel/types";
|
2
|
+
|
3
|
+
export default function generateAsserts() {
|
4
|
+
let output = `/*
|
5
|
+
* This file is auto-generated! Do not modify it directly.
|
6
|
+
* To re-generate run 'make build'
|
7
|
+
*/
|
8
|
+
import * as t from "@babel/types";
|
9
|
+
import NodePath from "../index";
|
10
|
+
|
11
|
+
|
12
|
+
export interface NodePathAssetions {`;
|
13
|
+
|
14
|
+
for (const type of [...t.TYPES].sort()) {
|
15
|
+
output += `
|
16
|
+
assert${type}(
|
17
|
+
opts?: object,
|
18
|
+
): asserts this is NodePath<t.${type}>;`;
|
19
|
+
}
|
20
|
+
|
21
|
+
output += `
|
22
|
+
}`;
|
23
|
+
|
24
|
+
return output;
|
25
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import t from "@babel/types";
|
2
|
+
import virtualTypes from "../../lib/path/lib/virtual-types.js";
|
3
|
+
import definitions from "@babel/types/lib/definitions/index.js";
|
4
|
+
|
5
|
+
export default function generateValidators() {
|
6
|
+
let output = `/*
|
7
|
+
* This file is auto-generated! Do not modify it directly.
|
8
|
+
* To re-generate run 'make build'
|
9
|
+
*/
|
10
|
+
import * as t from "@babel/types";
|
11
|
+
import NodePath from "../index";
|
12
|
+
|
13
|
+
export interface NodePathValidators {
|
14
|
+
`;
|
15
|
+
|
16
|
+
for (const type of [...t.TYPES].sort()) {
|
17
|
+
output += `is${type}(opts?: object): this is NodePath<t.${type}>;`;
|
18
|
+
}
|
19
|
+
|
20
|
+
for (const type of Object.keys(virtualTypes)) {
|
21
|
+
if (type[0] === "_") continue;
|
22
|
+
if (definitions.NODE_FIELDS[type] || definitions.FLIPPED_ALIAS_KEYS[type]) {
|
23
|
+
output += `is${type}(opts?: object): this is NodePath<t.${type}>;`;
|
24
|
+
} else {
|
25
|
+
output += `is${type}(opts?: object): boolean;`;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
output += `
|
30
|
+
}
|
31
|
+
`;
|
32
|
+
|
33
|
+
return output;
|
34
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import virtualTypes from "../../lib/path/lib/virtual-types.js";
|
2
|
+
|
3
|
+
export default function generateValidators() {
|
4
|
+
let output = `/*
|
5
|
+
* This file is auto-generated! Do not modify it directly.
|
6
|
+
* To re-generate run 'make build'
|
7
|
+
*/
|
8
|
+
import * as t from "@babel/types";
|
9
|
+
|
10
|
+
export interface VirtualTypeAliases {
|
11
|
+
`;
|
12
|
+
|
13
|
+
for (const type of Object.keys(virtualTypes)) {
|
14
|
+
output += ` ${type}: ${(virtualTypes[type].types || ["Node"])
|
15
|
+
.map(t => `t.${t}`)
|
16
|
+
.join(" | ")};`;
|
17
|
+
}
|
18
|
+
|
19
|
+
output += `
|
20
|
+
}
|
21
|
+
`;
|
22
|
+
|
23
|
+
return output;
|
24
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{ "type": "module" }
|