@tachybase/module-cloud-component 1.1.21 → 1.1.23
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.
- package/dist/client/index.js +482 -495
- package/dist/externalVersion.js +7 -7
- package/dist/node_modules/@babel/core/lib/config/files/configuration.js +5 -2
- package/dist/node_modules/@babel/core/lib/config/files/module-types.js +74 -63
- package/dist/node_modules/@babel/core/lib/config/files/plugins.js +1 -0
- package/dist/node_modules/@babel/core/lib/config/partial.js +1 -1
- package/dist/node_modules/@babel/core/lib/index.js +21 -21
- package/dist/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs +3 -1
- package/dist/node_modules/@babel/core/lib/transformation/file/file.js +10 -5
- package/dist/node_modules/@babel/core/lib/transformation/util/clone-deep.js +27 -7
- package/dist/node_modules/@babel/core/node_modules/.bin/parser +4 -4
- package/dist/node_modules/@babel/core/package.json +1 -1
- package/dist/node_modules/@babel/core/src/config/files/index-browser.ts +2 -0
- package/dist/node_modules/@babel/core/src/config/resolve-targets-browser.ts +2 -0
- package/dist/node_modules/@babel/core/src/config/resolve-targets.ts +1 -1
- package/dist/node_modules/@babel/core/src/transform-file-browser.ts +2 -0
- package/dist/node_modules/@babel/parser/bin/babel-parser.js +1 -1
- package/dist/node_modules/@babel/parser/lib/index.js +1 -1
- package/dist/node_modules/@babel/parser/package.json +1 -1
- package/dist/node_modules/@babel/parser/typings/babel-parser.d.ts +132 -164
- package/dist/node_modules/@babel/preset-env/LICENSE +22 -0
- package/dist/node_modules/@babel/preset-env/data/built-in-modules.js +3 -0
- package/dist/node_modules/@babel/preset-env/data/built-in-modules.json.js +3 -0
- package/dist/node_modules/@babel/preset-env/data/built-ins.js +4 -0
- package/dist/node_modules/@babel/preset-env/data/built-ins.json.js +4 -0
- package/dist/node_modules/@babel/preset-env/data/core-js-compat.js +3 -0
- package/dist/node_modules/@babel/preset-env/data/corejs2-built-ins.js +3 -0
- package/dist/node_modules/@babel/preset-env/data/corejs2-built-ins.json.js +3 -0
- package/dist/node_modules/@babel/preset-env/data/package.json +1 -0
- package/dist/node_modules/@babel/preset-env/data/plugins.js +3 -0
- package/dist/node_modules/@babel/preset-env/data/plugins.json.js +3 -0
- package/dist/node_modules/@babel/preset-env/data/shipped-proposals.js +4 -0
- package/dist/node_modules/@babel/preset-env/data/unreleased-labels.js +3 -0
- package/dist/node_modules/@babel/preset-env/lib/available-plugins.js +172 -0
- package/dist/node_modules/@babel/preset-env/lib/debug.js +37 -0
- package/dist/node_modules/@babel/preset-env/lib/filter-items.js +32 -0
- package/dist/node_modules/@babel/preset-env/lib/index.js +352 -0
- package/dist/node_modules/@babel/preset-env/lib/module-transformations.js +15 -0
- package/dist/node_modules/@babel/preset-env/lib/normalize-options.js +151 -0
- package/dist/node_modules/@babel/preset-env/lib/options.js +43 -0
- package/dist/node_modules/@babel/preset-env/lib/plugins-compat-data.js +28 -0
- package/dist/node_modules/@babel/preset-env/lib/polyfills/babel-7-plugins.cjs +21 -0
- package/dist/node_modules/@babel/preset-env/lib/polyfills/babel-polyfill.cjs +69 -0
- package/dist/node_modules/@babel/preset-env/lib/polyfills/regenerator.cjs +44 -0
- package/dist/node_modules/@babel/preset-env/lib/polyfills/utils.cjs +22 -0
- package/dist/node_modules/@babel/preset-env/lib/shipped-proposals.js +29 -0
- package/dist/node_modules/@babel/preset-env/lib/targets-parser.js +20 -0
- package/dist/node_modules/@babel/preset-env/node_modules/.bin/semver +21 -0
- package/dist/node_modules/@babel/preset-env/package.json +1 -0
- package/dist/node_modules/@babel/preset-react/LICENSE +22 -0
- package/dist/node_modules/@babel/preset-react/lib/index.js +231 -0
- package/dist/node_modules/@babel/preset-react/package.json +1 -0
- package/dist/node_modules/@babel/preset-typescript/LICENSE +22 -0
- package/dist/node_modules/@babel/preset-typescript/lib/index.js +227 -0
- package/dist/node_modules/@babel/preset-typescript/package.json +1 -0
- package/dist/node_modules/@babel/traverse/lib/cache.js +10 -16
- package/dist/node_modules/@babel/traverse/lib/index.js +5 -5
- package/dist/node_modules/@babel/traverse/lib/path/ancestry.js +1 -3
- package/dist/node_modules/@babel/traverse/lib/path/conversion.js +7 -4
- package/dist/node_modules/@babel/traverse/lib/path/evaluation.js +23 -2
- package/dist/node_modules/@babel/traverse/lib/path/family.js +13 -7
- package/dist/node_modules/@babel/traverse/lib/path/index.js +2 -1
- package/dist/node_modules/@babel/traverse/lib/path/modification.js +3 -2
- package/dist/node_modules/@babel/traverse/lib/path/removal.js +2 -1
- package/dist/node_modules/@babel/traverse/lib/path/replacement.js +2 -2
- package/dist/node_modules/@babel/traverse/lib/scope/binding.js +4 -3
- package/dist/node_modules/@babel/traverse/lib/scope/index.js +93 -37
- package/dist/node_modules/@babel/traverse/lib/traverse-node.js +109 -0
- package/dist/node_modules/@babel/traverse/lib/visitors.js +1 -1
- package/dist/node_modules/@babel/traverse/node_modules/.bin/parser +4 -4
- package/dist/node_modules/@babel/traverse/package.json +1 -1
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/dist/server/services/cloud-compiler.d.ts +2 -2
- package/dist/server/services/cloud-compiler.js +6 -6
- package/package.json +18 -14
- package/dist/node_modules/@babel/core/cjs-proxy.cjs +0 -68
- package/dist/node_modules/@babel/parser/index.cjs +0 -5
|
@@ -130,9 +130,7 @@ function isDescendant(maybeAncestor) {
|
|
|
130
130
|
function inType(...candidateTypes) {
|
|
131
131
|
let path = this;
|
|
132
132
|
while (path) {
|
|
133
|
-
|
|
134
|
-
if (path.node.type === type) return true;
|
|
135
|
-
}
|
|
133
|
+
if (candidateTypes.includes(path.node.type)) return true;
|
|
136
134
|
path = path.parentPath;
|
|
137
135
|
}
|
|
138
136
|
return false;
|
|
@@ -160,8 +160,7 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
|
|
|
160
160
|
let arrowParent;
|
|
161
161
|
let thisEnvFn = fnPath.findParent(p => {
|
|
162
162
|
if (p.isArrowFunctionExpression()) {
|
|
163
|
-
|
|
164
|
-
(_arrowParent = arrowParent) != null ? _arrowParent : arrowParent = p;
|
|
163
|
+
arrowParent != null ? arrowParent : arrowParent = p;
|
|
165
164
|
return false;
|
|
166
165
|
}
|
|
167
166
|
return p.isFunction() || p.isProgram() || p.isClassProperty({
|
|
@@ -571,13 +570,17 @@ function ensureFunctionName(supportUnicodeId) {
|
|
|
571
570
|
}
|
|
572
571
|
if (!state.needsRename) {
|
|
573
572
|
this.node.id = id;
|
|
574
|
-
|
|
573
|
+
{
|
|
574
|
+
scope.getProgramParent().references[id.name] = true;
|
|
575
|
+
}
|
|
575
576
|
return this;
|
|
576
577
|
}
|
|
577
578
|
if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
|
|
578
579
|
scope.rename(id.name);
|
|
579
580
|
this.node.id = id;
|
|
580
|
-
|
|
581
|
+
{
|
|
582
|
+
scope.getProgramParent().references[id.name] = true;
|
|
583
|
+
}
|
|
581
584
|
return this;
|
|
582
585
|
}
|
|
583
586
|
if (!isFunction(this.node)) return null;
|
|
@@ -121,6 +121,23 @@ function _evaluate(path, state) {
|
|
|
121
121
|
deopt(binding.path, state);
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
|
+
const bindingPathScope = binding.path.scope;
|
|
125
|
+
if (binding.kind === "var" && bindingPathScope !== binding.scope) {
|
|
126
|
+
let hasUnsafeBlock = !bindingPathScope.path.parentPath.isBlockStatement();
|
|
127
|
+
for (let scope = bindingPathScope.parent; scope; scope = scope.parent) {
|
|
128
|
+
var _scope$path$parentPat;
|
|
129
|
+
if (scope === path.scope) {
|
|
130
|
+
if (hasUnsafeBlock) {
|
|
131
|
+
deopt(binding.path, state);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
if ((_scope$path$parentPat = scope.path.parentPath) != null && _scope$path$parentPat.isBlockStatement()) {
|
|
137
|
+
hasUnsafeBlock = true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
124
141
|
if (binding.hasValue) {
|
|
125
142
|
return binding.value;
|
|
126
143
|
}
|
|
@@ -137,9 +154,13 @@ function _evaluate(path, state) {
|
|
|
137
154
|
if (resolved === path) {
|
|
138
155
|
deopt(path, state);
|
|
139
156
|
return;
|
|
140
|
-
} else {
|
|
141
|
-
return evaluateCached(resolved, state);
|
|
142
157
|
}
|
|
158
|
+
const value = evaluateCached(resolved, state);
|
|
159
|
+
if (typeof value === "object" && value !== null && binding.references > 1) {
|
|
160
|
+
deopt(resolved, state);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
return value;
|
|
143
164
|
}
|
|
144
165
|
if (path.isUnaryExpression({
|
|
145
166
|
prefix: true
|
|
@@ -119,12 +119,16 @@ function getStatementListCompletion(paths, context) {
|
|
|
119
119
|
completions.push(...lastNormalCompletions);
|
|
120
120
|
if (lastNormalCompletions.some(c => c.path.isDeclaration())) {
|
|
121
121
|
completions.push(...statementCompletions);
|
|
122
|
-
|
|
122
|
+
if (!context.shouldPreserveBreak) {
|
|
123
|
+
replaceBreakStatementInBreakCompletion(statementCompletions, true);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (!context.shouldPreserveBreak) {
|
|
127
|
+
replaceBreakStatementInBreakCompletion(statementCompletions, false);
|
|
123
128
|
}
|
|
124
|
-
replaceBreakStatementInBreakCompletion(statementCompletions, false);
|
|
125
129
|
} else {
|
|
126
130
|
completions.push(...statementCompletions);
|
|
127
|
-
if (!context.shouldPopulateBreak) {
|
|
131
|
+
if (!context.shouldPopulateBreak && !context.shouldPreserveBreak) {
|
|
128
132
|
replaceBreakStatementInBreakCompletion(statementCompletions, true);
|
|
129
133
|
}
|
|
130
134
|
}
|
|
@@ -148,7 +152,7 @@ function getStatementListCompletion(paths, context) {
|
|
|
148
152
|
} else if (paths.length) {
|
|
149
153
|
for (let i = paths.length - 1; i >= 0; i--) {
|
|
150
154
|
const pathCompletions = _getCompletionRecords(paths[i], context);
|
|
151
|
-
if (pathCompletions.length > 1 || pathCompletions.length === 1 && !pathCompletions[0].path.isVariableDeclaration()) {
|
|
155
|
+
if (pathCompletions.length > 1 || pathCompletions.length === 1 && !pathCompletions[0].path.isVariableDeclaration() && !pathCompletions[0].path.isEmptyStatement()) {
|
|
152
156
|
completions.push(...pathCompletions);
|
|
153
157
|
break;
|
|
154
158
|
}
|
|
@@ -178,7 +182,8 @@ function _getCompletionRecords(path, context) {
|
|
|
178
182
|
return getStatementListCompletion(path.get("consequent"), {
|
|
179
183
|
canHaveBreak: true,
|
|
180
184
|
shouldPopulateBreak: false,
|
|
181
|
-
inCaseClause: true
|
|
185
|
+
inCaseClause: true,
|
|
186
|
+
shouldPreserveBreak: context.shouldPreserveBreak
|
|
182
187
|
});
|
|
183
188
|
} else if (path.isBreakStatement()) {
|
|
184
189
|
records.push(BreakCompletion(path));
|
|
@@ -187,11 +192,12 @@ function _getCompletionRecords(path, context) {
|
|
|
187
192
|
}
|
|
188
193
|
return records;
|
|
189
194
|
}
|
|
190
|
-
function getCompletionRecords() {
|
|
195
|
+
function getCompletionRecords(shouldPreserveBreak = false) {
|
|
191
196
|
const records = _getCompletionRecords(this, {
|
|
192
197
|
canHaveBreak: false,
|
|
193
198
|
shouldPopulateBreak: false,
|
|
194
|
-
inCaseClause: false
|
|
199
|
+
inCaseClause: false,
|
|
200
|
+
shouldPreserveBreak
|
|
195
201
|
});
|
|
196
202
|
return records.map(r => r.path);
|
|
197
203
|
}
|
|
@@ -45,6 +45,7 @@ const NodePath_Final = exports.default = class NodePath {
|
|
|
45
45
|
this.key = null;
|
|
46
46
|
this.node = null;
|
|
47
47
|
this.type = null;
|
|
48
|
+
this._store = null;
|
|
48
49
|
this.parent = parent;
|
|
49
50
|
this.hub = hub;
|
|
50
51
|
this.data = null;
|
|
@@ -84,7 +85,7 @@ const NodePath_Final = exports.default = class NodePath {
|
|
|
84
85
|
throw new Error("To get a node path the parent needs to exist");
|
|
85
86
|
}
|
|
86
87
|
const targetNode = container[key];
|
|
87
|
-
const paths = cache.getOrCreateCachedPaths(
|
|
88
|
+
const paths = cache.getOrCreateCachedPaths(parent, parentPath);
|
|
88
89
|
let path = paths.get(targetNode);
|
|
89
90
|
if (!path) {
|
|
90
91
|
path = new NodePath(hub, parent);
|
|
@@ -13,11 +13,11 @@ exports.pushContainer = pushContainer;
|
|
|
13
13
|
exports.unshiftContainer = unshiftContainer;
|
|
14
14
|
exports.updateSiblingKeys = updateSiblingKeys;
|
|
15
15
|
var _cache = require("../cache.js");
|
|
16
|
-
var _hoister = require("./lib/hoister.js");
|
|
17
16
|
var _index = require("./index.js");
|
|
18
17
|
var _context = require("./context.js");
|
|
19
18
|
var _removal = require("./removal.js");
|
|
20
19
|
var _t = require("@babel/types");
|
|
20
|
+
var _hoister = require("./lib/hoister.js");
|
|
21
21
|
const {
|
|
22
22
|
arrowFunctionExpression,
|
|
23
23
|
assertExpression,
|
|
@@ -161,7 +161,8 @@ function insertAfter(nodes_) {
|
|
|
161
161
|
}
|
|
162
162
|
function updateSiblingKeys(fromIndex, incrementBy) {
|
|
163
163
|
if (!this.parent) return;
|
|
164
|
-
const paths = (0, _cache.getCachedPaths)(this
|
|
164
|
+
const paths = (0, _cache.getCachedPaths)(this);
|
|
165
|
+
if (!paths) return;
|
|
165
166
|
for (const [, path] of paths) {
|
|
166
167
|
if (typeof path.key === "number" && path.container === this.container && path.key >= fromIndex) {
|
|
167
168
|
path.key += incrementBy;
|
|
@@ -56,7 +56,8 @@ function _remove() {
|
|
|
56
56
|
function _markRemoved() {
|
|
57
57
|
this._traverseFlags |= _index.SHOULD_SKIP | _index.REMOVED;
|
|
58
58
|
if (this.parent) {
|
|
59
|
-
|
|
59
|
+
var _getCachedPaths;
|
|
60
|
+
(_getCachedPaths = (0, _cache.getCachedPaths)(this)) == null || _getCachedPaths.delete(this.node);
|
|
60
61
|
}
|
|
61
62
|
this.node = null;
|
|
62
63
|
}
|
|
@@ -53,7 +53,7 @@ function replaceWithMultiple(nodes) {
|
|
|
53
53
|
nodes = _modification._verifyNodeList.call(this, nodes);
|
|
54
54
|
inheritLeadingComments(nodes[0], this.node);
|
|
55
55
|
inheritTrailingComments(nodes[nodes.length - 1], this.node);
|
|
56
|
-
(_getCachedPaths = (0, _cache.getCachedPaths)(this
|
|
56
|
+
(_getCachedPaths = (0, _cache.getCachedPaths)(this)) == null || _getCachedPaths.delete(this.node);
|
|
57
57
|
this.node = this.container[this.key] = null;
|
|
58
58
|
const paths = this.insertAfter(nodes);
|
|
59
59
|
if (this.node) {
|
|
@@ -141,7 +141,7 @@ function _replaceWith(node) {
|
|
|
141
141
|
validate(this.parent, this.key, node);
|
|
142
142
|
}
|
|
143
143
|
this.debug(`Replace with ${node == null ? void 0 : node.type}`);
|
|
144
|
-
(_getCachedPaths2 = (0, _cache.getCachedPaths)(this
|
|
144
|
+
(_getCachedPaths2 = (0, _cache.getCachedPaths)(this)) == null || _getCachedPaths2.set(node, this).delete(this.node);
|
|
145
145
|
this.node = this.container[this.key] = node;
|
|
146
146
|
}
|
|
147
147
|
function replaceExpressionWithStatements(nodes) {
|
|
@@ -24,7 +24,7 @@ class Binding {
|
|
|
24
24
|
this.scope = scope;
|
|
25
25
|
this.path = path;
|
|
26
26
|
this.kind = kind;
|
|
27
|
-
if ((kind === "var" || kind === "hoisted") &&
|
|
27
|
+
if ((kind === "var" || kind === "hoisted") && isInitInLoop(path)) {
|
|
28
28
|
this.reassign(path);
|
|
29
29
|
}
|
|
30
30
|
this.clearValue();
|
|
@@ -64,7 +64,8 @@ class Binding {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
exports.default = Binding;
|
|
67
|
-
function
|
|
67
|
+
function isInitInLoop(path) {
|
|
68
|
+
const isFunctionDeclarationOrHasInit = !path.isVariableDeclarator() || path.node.init;
|
|
68
69
|
for (let {
|
|
69
70
|
parentPath,
|
|
70
71
|
key
|
|
@@ -73,7 +74,7 @@ function isDeclaredInLoop(path) {
|
|
|
73
74
|
key
|
|
74
75
|
} = parentPath) {
|
|
75
76
|
if (parentPath.isFunctionParent()) return false;
|
|
76
|
-
if (
|
|
77
|
+
if (key === "left" && parentPath.isForXStatement() || isFunctionDeclarationOrHasInit && key === "body" && parentPath.isLoop()) {
|
|
77
78
|
return true;
|
|
78
79
|
}
|
|
79
80
|
}
|
|
@@ -11,9 +11,7 @@ var _globals = require("globals");
|
|
|
11
11
|
var _t = require("@babel/types");
|
|
12
12
|
var t = _t;
|
|
13
13
|
var _cache = require("../cache.js");
|
|
14
|
-
var _visitors = require("../visitors.js");
|
|
15
14
|
const {
|
|
16
|
-
NOT_LOCAL_BINDING,
|
|
17
15
|
assignmentExpression,
|
|
18
16
|
callExpression,
|
|
19
17
|
cloneNode,
|
|
@@ -178,6 +176,17 @@ function gatherNodeParts(node, parts) {
|
|
|
178
176
|
break;
|
|
179
177
|
}
|
|
180
178
|
}
|
|
179
|
+
function resetScope(scope) {
|
|
180
|
+
{
|
|
181
|
+
scope.references = Object.create(null);
|
|
182
|
+
scope.uids = Object.create(null);
|
|
183
|
+
}
|
|
184
|
+
scope.bindings = Object.create(null);
|
|
185
|
+
scope.globals = Object.create(null);
|
|
186
|
+
}
|
|
187
|
+
{
|
|
188
|
+
var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
|
|
189
|
+
}
|
|
181
190
|
const collectorVisitor = {
|
|
182
191
|
ForStatement(path) {
|
|
183
192
|
const declar = path.get("init");
|
|
@@ -200,7 +209,15 @@ const collectorVisitor = {
|
|
|
200
209
|
const parent = path.scope.getBlockParent();
|
|
201
210
|
parent.registerDeclaration(path);
|
|
202
211
|
},
|
|
212
|
+
TSImportEqualsDeclaration(path) {
|
|
213
|
+
const parent = path.scope.getBlockParent();
|
|
214
|
+
parent.registerDeclaration(path);
|
|
215
|
+
},
|
|
203
216
|
ReferencedIdentifier(path, state) {
|
|
217
|
+
if (t.isTSQualifiedName(path.parent) && path.parent.right === path.node) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (path.parentPath.isTSImportEqualsDeclaration()) return;
|
|
204
221
|
state.references.push(path);
|
|
205
222
|
},
|
|
206
223
|
ForXStatement(path, state) {
|
|
@@ -284,6 +301,7 @@ const collectorVisitor = {
|
|
|
284
301
|
path.skip();
|
|
285
302
|
}
|
|
286
303
|
};
|
|
304
|
+
let scopeVisitor;
|
|
287
305
|
let uid = 0;
|
|
288
306
|
class Scope {
|
|
289
307
|
constructor(path) {
|
|
@@ -293,9 +311,9 @@ class Scope {
|
|
|
293
311
|
this.inited = void 0;
|
|
294
312
|
this.labels = void 0;
|
|
295
313
|
this.bindings = void 0;
|
|
296
|
-
this.
|
|
314
|
+
this.referencesSet = void 0;
|
|
297
315
|
this.globals = void 0;
|
|
298
|
-
this.
|
|
316
|
+
this.uidsSet = void 0;
|
|
299
317
|
this.data = void 0;
|
|
300
318
|
this.crawling = void 0;
|
|
301
319
|
const {
|
|
@@ -311,6 +329,22 @@ class Scope {
|
|
|
311
329
|
this.path = path;
|
|
312
330
|
this.labels = new Map();
|
|
313
331
|
this.inited = false;
|
|
332
|
+
{
|
|
333
|
+
Object.defineProperties(this, {
|
|
334
|
+
references: {
|
|
335
|
+
enumerable: true,
|
|
336
|
+
configurable: true,
|
|
337
|
+
writable: true,
|
|
338
|
+
value: Object.create(null)
|
|
339
|
+
},
|
|
340
|
+
uids: {
|
|
341
|
+
enumerable: true,
|
|
342
|
+
configurable: true,
|
|
343
|
+
writable: true,
|
|
344
|
+
value: Object.create(null)
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
314
348
|
}
|
|
315
349
|
get parent() {
|
|
316
350
|
var _parent;
|
|
@@ -325,6 +359,12 @@ class Scope {
|
|
|
325
359
|
} while (path && !parent);
|
|
326
360
|
return (_parent = parent) == null ? void 0 : _parent.scope;
|
|
327
361
|
}
|
|
362
|
+
get references() {
|
|
363
|
+
throw new Error("Scope#references is not available in Babel 8. Use Scope#referencesSet instead.");
|
|
364
|
+
}
|
|
365
|
+
get uids() {
|
|
366
|
+
throw new Error("Scope#uids is not available in Babel 8. Use Scope#uidsSet instead.");
|
|
367
|
+
}
|
|
328
368
|
generateDeclaredUidIdentifier(name) {
|
|
329
369
|
const id = this.generateUidIdentifier(name);
|
|
330
370
|
this.push({
|
|
@@ -338,15 +378,17 @@ class Scope {
|
|
|
338
378
|
generateUid(name = "temp") {
|
|
339
379
|
name = toIdentifier(name).replace(/^_+/, "").replace(/\d+$/g, "");
|
|
340
380
|
let uid;
|
|
341
|
-
let i =
|
|
381
|
+
let i = 0;
|
|
342
382
|
do {
|
|
343
383
|
uid = `_${name}`;
|
|
344
|
-
if (i
|
|
384
|
+
if (i >= 11) uid += i - 1;else if (i >= 9) uid += i - 9;else if (i >= 1) uid += i + 1;
|
|
345
385
|
i++;
|
|
346
386
|
} while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid));
|
|
347
387
|
const program = this.getProgramParent();
|
|
348
|
-
|
|
349
|
-
|
|
388
|
+
{
|
|
389
|
+
program.references[uid] = true;
|
|
390
|
+
program.uids[uid] = true;
|
|
391
|
+
}
|
|
350
392
|
return uid;
|
|
351
393
|
}
|
|
352
394
|
generateUidBasedOnNode(node, defaultName) {
|
|
@@ -486,7 +528,9 @@ class Scope {
|
|
|
486
528
|
const parent = this.getProgramParent();
|
|
487
529
|
const ids = path.getOuterBindingIdentifiers(true);
|
|
488
530
|
for (const name of Object.keys(ids)) {
|
|
489
|
-
|
|
531
|
+
{
|
|
532
|
+
parent.references[name] = true;
|
|
533
|
+
}
|
|
490
534
|
for (const id of ids[name]) {
|
|
491
535
|
const local = this.getOwnBinding(name);
|
|
492
536
|
if (local) {
|
|
@@ -510,11 +554,13 @@ class Scope {
|
|
|
510
554
|
this.globals[node.name] = node;
|
|
511
555
|
}
|
|
512
556
|
hasUid(name) {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
557
|
+
{
|
|
558
|
+
let scope = this;
|
|
559
|
+
do {
|
|
560
|
+
if (scope.uids[name]) return true;
|
|
561
|
+
} while (scope = scope.parent);
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
518
564
|
}
|
|
519
565
|
hasGlobal(name) {
|
|
520
566
|
let scope = this;
|
|
@@ -524,7 +570,9 @@ class Scope {
|
|
|
524
570
|
return false;
|
|
525
571
|
}
|
|
526
572
|
hasReference(name) {
|
|
527
|
-
|
|
573
|
+
{
|
|
574
|
+
return !!this.getProgramParent().references[name];
|
|
575
|
+
}
|
|
528
576
|
}
|
|
529
577
|
isPure(node, constantsOnly) {
|
|
530
578
|
if (isIdentifier(node)) {
|
|
@@ -627,10 +675,7 @@ class Scope {
|
|
|
627
675
|
}
|
|
628
676
|
crawl() {
|
|
629
677
|
const path = this.path;
|
|
630
|
-
this
|
|
631
|
-
this.bindings = Object.create(null);
|
|
632
|
-
this.globals = Object.create(null);
|
|
633
|
-
this.uids = Object.create(null);
|
|
678
|
+
resetScope(this);
|
|
634
679
|
this.data = Object.create(null);
|
|
635
680
|
let scope = this;
|
|
636
681
|
do {
|
|
@@ -646,18 +691,23 @@ class Scope {
|
|
|
646
691
|
assignments: []
|
|
647
692
|
};
|
|
648
693
|
this.crawling = true;
|
|
649
|
-
|
|
650
|
-
|
|
694
|
+
scopeVisitor || (scopeVisitor = _index.default.visitors.merge([{
|
|
695
|
+
Scope(path) {
|
|
696
|
+
resetScope(path.scope);
|
|
697
|
+
}
|
|
698
|
+
}, collectorVisitor]));
|
|
699
|
+
if (path.type !== "Program") {
|
|
700
|
+
for (const visit of scopeVisitor.enter) {
|
|
651
701
|
visit.call(state, path, state);
|
|
652
702
|
}
|
|
653
|
-
const typeVisitors =
|
|
703
|
+
const typeVisitors = scopeVisitor[path.type];
|
|
654
704
|
if (typeVisitors) {
|
|
655
705
|
for (const visit of typeVisitors.enter) {
|
|
656
706
|
visit.call(state, path, state);
|
|
657
707
|
}
|
|
658
708
|
}
|
|
659
709
|
}
|
|
660
|
-
path.traverse(
|
|
710
|
+
path.traverse(scopeVisitor, state);
|
|
661
711
|
this.crawling = false;
|
|
662
712
|
for (const path of state.assignments) {
|
|
663
713
|
const ids = path.getAssignmentIdentifiers();
|
|
@@ -803,20 +853,25 @@ class Scope {
|
|
|
803
853
|
}
|
|
804
854
|
hasBinding(name, opts) {
|
|
805
855
|
if (!name) return false;
|
|
806
|
-
let scope = this;
|
|
807
|
-
do {
|
|
808
|
-
if (scope.hasOwnBinding(name)) {
|
|
809
|
-
return true;
|
|
810
|
-
}
|
|
811
|
-
} while (scope = scope.parent);
|
|
812
856
|
let noGlobals;
|
|
813
857
|
let noUids;
|
|
858
|
+
let upToScope;
|
|
814
859
|
if (typeof opts === "object") {
|
|
815
860
|
noGlobals = opts.noGlobals;
|
|
816
861
|
noUids = opts.noUids;
|
|
862
|
+
upToScope = opts.upToScope;
|
|
817
863
|
} else if (typeof opts === "boolean") {
|
|
818
864
|
noGlobals = opts;
|
|
819
865
|
}
|
|
866
|
+
let scope = this;
|
|
867
|
+
do {
|
|
868
|
+
if (upToScope === scope) {
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
if (scope.hasOwnBinding(name)) {
|
|
872
|
+
return true;
|
|
873
|
+
}
|
|
874
|
+
} while (scope = scope.parent);
|
|
820
875
|
if (!noUids && this.hasUid(name)) return true;
|
|
821
876
|
if (!noGlobals && Scope.globals.includes(name)) return true;
|
|
822
877
|
if (!noGlobals && Scope.contextVariables.includes(name)) return true;
|
|
@@ -840,12 +895,14 @@ class Scope {
|
|
|
840
895
|
removeBinding(name) {
|
|
841
896
|
var _this$getBinding3;
|
|
842
897
|
(_this$getBinding3 = this.getBinding(name)) == null || _this$getBinding3.scope.removeOwnBinding(name);
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
scope.uids[name]
|
|
847
|
-
|
|
848
|
-
|
|
898
|
+
{
|
|
899
|
+
let scope = this;
|
|
900
|
+
do {
|
|
901
|
+
if (scope.uids[name]) {
|
|
902
|
+
scope.uids[name] = false;
|
|
903
|
+
}
|
|
904
|
+
} while (scope = scope.parent);
|
|
905
|
+
}
|
|
849
906
|
}
|
|
850
907
|
hoistVariables(emit = id => this.push({
|
|
851
908
|
id
|
|
@@ -868,8 +925,7 @@ class Scope {
|
|
|
868
925
|
let firstId;
|
|
869
926
|
const init = [];
|
|
870
927
|
for (const decl of parent.declarations) {
|
|
871
|
-
|
|
872
|
-
(_firstId = firstId) != null ? _firstId : firstId = decl.id;
|
|
928
|
+
firstId != null ? firstId : firstId = decl.id;
|
|
873
929
|
if (decl.init) {
|
|
874
930
|
init.push(assignmentExpression("=", decl.id, decl.init));
|
|
875
931
|
}
|
|
@@ -5,11 +5,120 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.traverseNode = traverseNode;
|
|
7
7
|
var _context = require("./context.js");
|
|
8
|
+
var _index = require("./path/index.js");
|
|
8
9
|
var _t = require("@babel/types");
|
|
10
|
+
var _context2 = require("./path/context.js");
|
|
9
11
|
const {
|
|
10
12
|
VISITOR_KEYS
|
|
11
13
|
} = _t;
|
|
14
|
+
function _visitPaths(ctx, paths) {
|
|
15
|
+
ctx.queue = paths;
|
|
16
|
+
ctx.priorityQueue = [];
|
|
17
|
+
const visited = new Set();
|
|
18
|
+
let stop = false;
|
|
19
|
+
let visitIndex = 0;
|
|
20
|
+
for (; visitIndex < paths.length;) {
|
|
21
|
+
const path = paths[visitIndex];
|
|
22
|
+
visitIndex++;
|
|
23
|
+
_context2.resync.call(path);
|
|
24
|
+
if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== ctx) {
|
|
25
|
+
_context2.pushContext.call(path, ctx);
|
|
26
|
+
}
|
|
27
|
+
if (path.key === null) continue;
|
|
28
|
+
const {
|
|
29
|
+
node
|
|
30
|
+
} = path;
|
|
31
|
+
if (visited.has(node)) continue;
|
|
32
|
+
if (node) visited.add(node);
|
|
33
|
+
if (_visit(ctx, path)) {
|
|
34
|
+
stop = true;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
if (ctx.priorityQueue.length) {
|
|
38
|
+
stop = _visitPaths(ctx, ctx.priorityQueue);
|
|
39
|
+
ctx.priorityQueue = [];
|
|
40
|
+
ctx.queue = paths;
|
|
41
|
+
if (stop) break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (let i = 0; i < visitIndex; i++) {
|
|
45
|
+
_context2.popContext.call(paths[i]);
|
|
46
|
+
}
|
|
47
|
+
ctx.queue = null;
|
|
48
|
+
return stop;
|
|
49
|
+
}
|
|
50
|
+
function _visit(ctx, path) {
|
|
51
|
+
var _opts$denylist;
|
|
52
|
+
const node = path.node;
|
|
53
|
+
if (!node) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const opts = ctx.opts;
|
|
57
|
+
const denylist = (_opts$denylist = opts.denylist) != null ? _opts$denylist : opts.blacklist;
|
|
58
|
+
if (denylist != null && denylist.includes(node.type)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (opts.shouldSkip != null && opts.shouldSkip(path)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (path.shouldSkip) return path.shouldStop;
|
|
65
|
+
if (_context2._call.call(path, opts.enter)) return path.shouldStop;
|
|
66
|
+
if (path.node) {
|
|
67
|
+
var _opts$node$type;
|
|
68
|
+
if (_context2._call.call(path, (_opts$node$type = opts[node.type]) == null ? void 0 : _opts$node$type.enter)) return path.shouldStop;
|
|
69
|
+
}
|
|
70
|
+
path.shouldStop = _traverse(path.node, opts, path.scope, ctx.state, path, path.skipKeys);
|
|
71
|
+
if (path.node) {
|
|
72
|
+
if (_context2._call.call(path, opts.exit)) return true;
|
|
73
|
+
}
|
|
74
|
+
if (path.node) {
|
|
75
|
+
var _opts$node$type2;
|
|
76
|
+
_context2._call.call(path, (_opts$node$type2 = opts[node.type]) == null ? void 0 : _opts$node$type2.exit);
|
|
77
|
+
}
|
|
78
|
+
return path.shouldStop;
|
|
79
|
+
}
|
|
80
|
+
function _traverse(node, opts, scope, state, path, skipKeys, visitSelf) {
|
|
81
|
+
const keys = VISITOR_KEYS[node.type];
|
|
82
|
+
if (!(keys != null && keys.length)) return false;
|
|
83
|
+
const ctx = new _context.default(scope, opts, state, path);
|
|
84
|
+
if (visitSelf) {
|
|
85
|
+
if (skipKeys != null && skipKeys[path.parentKey]) return false;
|
|
86
|
+
return _visitPaths(ctx, [path]);
|
|
87
|
+
}
|
|
88
|
+
for (const key of keys) {
|
|
89
|
+
if (skipKeys != null && skipKeys[key]) continue;
|
|
90
|
+
const prop = node[key];
|
|
91
|
+
if (!prop) continue;
|
|
92
|
+
if (Array.isArray(prop)) {
|
|
93
|
+
if (!prop.length) continue;
|
|
94
|
+
const paths = [];
|
|
95
|
+
for (let i = 0; i < prop.length; i++) {
|
|
96
|
+
const childPath = _index.default.get({
|
|
97
|
+
parentPath: path,
|
|
98
|
+
parent: node,
|
|
99
|
+
container: prop,
|
|
100
|
+
key: i,
|
|
101
|
+
listKey: key
|
|
102
|
+
});
|
|
103
|
+
paths.push(childPath);
|
|
104
|
+
}
|
|
105
|
+
if (_visitPaths(ctx, paths)) return true;
|
|
106
|
+
} else {
|
|
107
|
+
if (_visitPaths(ctx, [_index.default.get({
|
|
108
|
+
parentPath: path,
|
|
109
|
+
parent: node,
|
|
110
|
+
container: node,
|
|
111
|
+
key,
|
|
112
|
+
listKey: null
|
|
113
|
+
})])) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
12
120
|
function traverseNode(node, opts, scope, state, path, skipKeys, visitSelf) {
|
|
121
|
+
;
|
|
13
122
|
const keys = VISITOR_KEYS[node.type];
|
|
14
123
|
if (!keys) return false;
|
|
15
124
|
const context = new _context.default(scope, opts, state, path);
|
|
@@ -104,7 +104,7 @@ function verify$1(visitor) {
|
|
|
104
104
|
}
|
|
105
105
|
if (shouldIgnoreKey(nodeType)) continue;
|
|
106
106
|
if (!TYPES.includes(nodeType)) {
|
|
107
|
-
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.
|
|
107
|
+
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.27.4"}`);
|
|
108
108
|
}
|
|
109
109
|
const visitors = visitor[nodeType];
|
|
110
110
|
if (typeof visitors === "object") {
|
|
@@ -10,12 +10,12 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
12
|
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/runner/work/tachybase/tachybase/node_modules/.pnpm/@babel+parser@7.
|
|
13
|
+
export NODE_PATH="/home/runner/work/tachybase/tachybase/node_modules/.pnpm/@babel+parser@7.27.5/node_modules/@babel/parser/bin/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/@babel+parser@7.27.5/node_modules/@babel/parser/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/@babel+parser@7.27.5/node_modules/@babel/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/@babel+parser@7.27.5/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/node_modules"
|
|
14
14
|
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/tachybase/tachybase/node_modules/.pnpm/@babel+parser@7.
|
|
15
|
+
export NODE_PATH="/home/runner/work/tachybase/tachybase/node_modules/.pnpm/@babel+parser@7.27.5/node_modules/@babel/parser/bin/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/@babel+parser@7.27.5/node_modules/@babel/parser/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/@babel+parser@7.27.5/node_modules/@babel/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/@babel+parser@7.27.5/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../../../../../../@babel+parser@7.
|
|
18
|
+
exec "$basedir/node" "$basedir/../../../../../../@babel+parser@7.27.5/node_modules/@babel/parser/bin/babel-parser.js" "$@"
|
|
19
19
|
else
|
|
20
|
-
exec node "$basedir/../../../../../../@babel+parser@7.
|
|
20
|
+
exec node "$basedir/../../../../../../@babel+parser@7.27.5/node_modules/@babel/parser/bin/babel-parser.js" "$@"
|
|
21
21
|
fi
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@babel/traverse","version":"7.
|
|
1
|
+
{"name":"@babel/traverse","version":"7.27.4","description":"The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes","author":"The Babel Team (https://babel.dev/team)","homepage":"https://babel.dev/docs/en/next/babel-traverse","bugs":"https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20traverse%22+is%3Aopen","license":"MIT","publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/babel/babel.git","directory":"packages/babel-traverse"},"main":"./lib/index.js","dependencies":{"@babel/code-frame":"^7.27.1","@babel/generator":"^7.27.3","@babel/parser":"^7.27.4","@babel/template":"^7.27.2","@babel/types":"^7.27.3","debug":"^4.3.1","globals":"^11.1.0"},"devDependencies":{"@babel/core":"^7.27.4","@babel/helper-plugin-test-runner":"^7.27.1"},"engines":{"node":">=6.9.0"},"type":"commonjs","_lastModified":"2025-06-17T09:01:24.201Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@hapi/topo","description":"Topological sorting with grouping support","version":"6.0.2","repository":"git://github.com/hapijs/topo","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["topological","sort","toposort","topsort"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/hoek":"^11.0.2"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/lab":"^25.1.2","@types/node":"^17.0.31","typescript":"~4.6.4"},"scripts":{"test":"lab -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -a @hapi/code -t 100 -L -r html -o coverage.html"},"license":"BSD-3-Clause","_lastModified":"2025-06-
|
|
1
|
+
{"name":"@hapi/topo","description":"Topological sorting with grouping support","version":"6.0.2","repository":"git://github.com/hapijs/topo","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["topological","sort","toposort","topsort"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/hoek":"^11.0.2"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/lab":"^25.1.2","@types/node":"^17.0.31","typescript":"~4.6.4"},"scripts":{"test":"lab -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -a @hapi/code -t 100 -L -r html -o coverage.html"},"license":"BSD-3-Clause","_lastModified":"2025-06-17T09:01:24.394Z"}
|