@tinacms/app 1.0.3 → 1.0.5
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/appFiles/node_modules/.package-lock.json +27 -27
- package/appFiles/node_modules/@babel/generator/lib/buffer.js +1 -16
- package/appFiles/node_modules/@babel/generator/lib/buffer.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/base.js +0 -2
- package/appFiles/node_modules/@babel/generator/lib/generators/base.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/classes.js +0 -6
- package/appFiles/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js +1 -6
- package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/flow.js +0 -2
- package/appFiles/node_modules/@babel/generator/lib/generators/flow.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/methods.js +4 -11
- package/appFiles/node_modules/@babel/generator/lib/generators/methods.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/modules.js +0 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/modules.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/statements.js +0 -3
- package/appFiles/node_modules/@babel/generator/lib/generators/statements.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/types.js +1 -5
- package/appFiles/node_modules/@babel/generator/lib/generators/types.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/typescript.js +2 -4
- package/appFiles/node_modules/@babel/generator/lib/generators/typescript.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/index.js +0 -6
- package/appFiles/node_modules/@babel/generator/lib/index.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/node/index.js +0 -1
- package/appFiles/node_modules/@babel/generator/lib/node/index.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/node/parentheses.js +8 -15
- package/appFiles/node_modules/@babel/generator/lib/node/parentheses.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/node/whitespace.js +1 -15
- package/appFiles/node_modules/@babel/generator/lib/node/whitespace.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/printer.js +8 -47
- package/appFiles/node_modules/@babel/generator/lib/printer.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/source-map.js +0 -4
- package/appFiles/node_modules/@babel/generator/lib/source-map.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/package.json +3 -3
- package/appFiles/node_modules/@babel/parser/lib/index.js +169 -684
- package/appFiles/node_modules/@babel/parser/lib/index.js.map +1 -1
- package/appFiles/node_modules/@babel/parser/package.json +1 -1
- package/appFiles/node_modules/@babel/runtime/helpers/applyDecs.js +3 -9
- package/appFiles/node_modules/@babel/runtime/helpers/applyDecs2203.js +169 -172
- package/appFiles/node_modules/@babel/runtime/helpers/applyDecs2203R.js +188 -0
- package/appFiles/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +1 -3
- package/appFiles/node_modules/@babel/runtime/helpers/classNameTDZError.js +1 -1
- package/appFiles/node_modules/@babel/runtime/helpers/defineAccessor.js +8 -0
- package/appFiles/node_modules/@babel/runtime/helpers/esm/applyDecs.js +3 -9
- package/appFiles/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js +169 -172
- package/appFiles/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js +187 -0
- package/appFiles/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +1 -3
- package/appFiles/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +1 -1
- package/appFiles/node_modules/@babel/runtime/helpers/esm/defineAccessor.js +7 -0
- package/appFiles/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +1 -3
- package/appFiles/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js +1 -3
- package/appFiles/node_modules/@babel/runtime/helpers/esm/jsx.js +2 -6
- package/appFiles/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js +3 -9
- package/appFiles/node_modules/@babel/runtime/helpers/esm/set.js +1 -1
- package/appFiles/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +1 -3
- package/appFiles/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +1 -3
- package/appFiles/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js +1 -3
- package/appFiles/node_modules/@babel/runtime/helpers/jsx.js +2 -6
- package/appFiles/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +3 -9
- package/appFiles/node_modules/@babel/runtime/helpers/set.js +1 -1
- package/appFiles/node_modules/@babel/runtime/helpers/wrapRegExp.js +1 -3
- package/appFiles/node_modules/@babel/runtime/package.json +19 -1
- package/appFiles/node_modules/@babel/template/lib/builder.js +3 -15
- package/appFiles/node_modules/@babel/template/lib/builder.js.map +1 -0
- package/appFiles/node_modules/@babel/template/lib/formatters.js +3 -8
- package/appFiles/node_modules/@babel/template/lib/formatters.js.map +1 -0
- package/appFiles/node_modules/@babel/template/lib/index.js +2 -5
- package/appFiles/node_modules/@babel/template/lib/index.js.map +1 -0
- package/appFiles/node_modules/@babel/template/lib/literal.js +3 -13
- package/appFiles/node_modules/@babel/template/lib/literal.js.map +1 -0
- package/appFiles/node_modules/@babel/template/lib/options.js +10 -19
- package/appFiles/node_modules/@babel/template/lib/options.js.map +1 -0
- package/appFiles/node_modules/@babel/template/lib/parse.js +3 -23
- package/appFiles/node_modules/@babel/template/lib/parse.js.map +1 -0
- package/appFiles/node_modules/@babel/template/lib/populate.js +3 -15
- package/appFiles/node_modules/@babel/template/lib/populate.js.map +1 -0
- package/appFiles/node_modules/@babel/template/lib/string.js +3 -5
- package/appFiles/node_modules/@babel/template/lib/string.js.map +1 -0
- package/appFiles/node_modules/@babel/template/package.json +3 -3
- package/appFiles/node_modules/@babel/traverse/lib/context.js +2 -14
- package/appFiles/node_modules/@babel/traverse/lib/context.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/index.js +1 -4
- package/appFiles/node_modules/@babel/traverse/lib/index.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/ancestry.js +0 -19
- package/appFiles/node_modules/@babel/traverse/lib/path/ancestry.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/comments.js +0 -2
- package/appFiles/node_modules/@babel/traverse/lib/path/comments.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/context.js +5 -21
- package/appFiles/node_modules/@babel/traverse/lib/path/context.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/conversion.js +6 -30
- package/appFiles/node_modules/@babel/traverse/lib/path/conversion.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/evaluation.js +14 -20
- package/appFiles/node_modules/@babel/traverse/lib/path/evaluation.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/family.js +3 -9
- package/appFiles/node_modules/@babel/traverse/lib/path/family.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/index.js +1 -6
- package/appFiles/node_modules/@babel/traverse/lib/path/index.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/index.js +1 -9
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/index.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js +1 -13
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/inferers.js +2 -5
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/inferers.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/introspection.js +21 -62
- package/appFiles/node_modules/@babel/traverse/lib/path/introspection.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/hoister.js +1 -22
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/hoister.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js +1 -7
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js +0 -2
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/virtual-types.js +0 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/virtual-types.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/modification.js +12 -24
- package/appFiles/node_modules/@babel/traverse/lib/path/modification.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/removal.js +0 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/removal.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/replacement.js +2 -16
- package/appFiles/node_modules/@babel/traverse/lib/path/replacement.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/scope/binding.js +1 -6
- package/appFiles/node_modules/@babel/traverse/lib/scope/binding.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/scope/index.js +28 -63
- package/appFiles/node_modules/@babel/traverse/lib/scope/index.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/scope/lib/renamer.js +8 -14
- package/appFiles/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/visitors.js +2 -23
- package/appFiles/node_modules/@babel/traverse/lib/visitors.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/package.json +4 -4
- package/appFiles/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +2 -1
- package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -1
- package/appFiles/node_modules/@babel/types/package.json +3 -3
- package/appFiles/node_modules/css-to-react-native/README.md +4 -2
- package/appFiles/node_modules/css-to-react-native/index.js +13 -6
- package/appFiles/node_modules/css-to-react-native/package.json +2 -1
- package/appFiles/node_modules/css-to-react-native/src/__tests__/fontVariant.js +8 -0
- package/appFiles/node_modules/css-to-react-native/src/transforms/fontVariant.js +14 -0
- package/appFiles/node_modules/css-to-react-native/src/transforms/index.js +5 -7
- package/appFiles/src/fields/rich-text/monaco/index.tsx +12 -10
- package/appFiles/src/fields/rich-text/monaco/mdx.js +41 -35
- package/appFiles/src/lib/machines/document-machine.ts +1 -1
- package/dist/index.js +4 -2
- package/package.json +5 -4
|
@@ -29,7 +29,6 @@ const {
|
|
|
29
29
|
isImportDeclaration,
|
|
30
30
|
isLiteral,
|
|
31
31
|
isMethod,
|
|
32
|
-
isModuleDeclaration,
|
|
33
32
|
isModuleSpecifier,
|
|
34
33
|
isNullLiteral,
|
|
35
34
|
isObjectExpression,
|
|
@@ -54,12 +53,13 @@ const {
|
|
|
54
53
|
isObjectProperty,
|
|
55
54
|
isTopicReference,
|
|
56
55
|
isMetaProperty,
|
|
57
|
-
isPrivateName
|
|
56
|
+
isPrivateName,
|
|
57
|
+
isExportDeclaration
|
|
58
58
|
} = _t;
|
|
59
59
|
function gatherNodeParts(node, parts) {
|
|
60
60
|
switch (node == null ? void 0 : node.type) {
|
|
61
61
|
default:
|
|
62
|
-
if (
|
|
62
|
+
if (isImportDeclaration(node) || isExportDeclaration(node)) {
|
|
63
63
|
if ((isExportAllDeclaration(node) || isExportNamedDeclaration(node) || isImportDeclaration(node)) && node.source) {
|
|
64
64
|
gatherNodeParts(node.source, parts);
|
|
65
65
|
} else if ((isExportNamedDeclaration(node) || isImportDeclaration(node)) && node.specifiers && node.specifiers.length) {
|
|
@@ -170,7 +170,6 @@ function gatherNodeParts(node, parts) {
|
|
|
170
170
|
break;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
|
|
174
173
|
const collectorVisitor = {
|
|
175
174
|
ForStatement(path) {
|
|
176
175
|
const declar = path.get("init");
|
|
@@ -184,11 +183,8 @@ const collectorVisitor = {
|
|
|
184
183
|
},
|
|
185
184
|
Declaration(path) {
|
|
186
185
|
if (path.isBlockScoped()) return;
|
|
187
|
-
|
|
188
186
|
if (path.isImportDeclaration()) return;
|
|
189
|
-
|
|
190
187
|
if (path.isExportDeclaration()) return;
|
|
191
|
-
|
|
192
188
|
const parent = path.scope.getFunctionParent() || path.scope.getProgramParent();
|
|
193
189
|
parent.registerDeclaration(path);
|
|
194
190
|
},
|
|
@@ -203,8 +199,7 @@ const collectorVisitor = {
|
|
|
203
199
|
const left = path.get("left");
|
|
204
200
|
if (left.isPattern() || left.isIdentifier()) {
|
|
205
201
|
state.constantViolations.push(path);
|
|
206
|
-
}
|
|
207
|
-
else if (left.isVar()) {
|
|
202
|
+
} else if (left.isVar()) {
|
|
208
203
|
const {
|
|
209
204
|
scope
|
|
210
205
|
} = path;
|
|
@@ -254,7 +249,6 @@ const collectorVisitor = {
|
|
|
254
249
|
if (scope.path === path) scope = scope.parent;
|
|
255
250
|
const parent = scope.getBlockParent();
|
|
256
251
|
parent.registerDeclaration(path);
|
|
257
|
-
|
|
258
252
|
if (path.isClassDeclaration() && path.node.id) {
|
|
259
253
|
const id = path.node.id;
|
|
260
254
|
const name = id.name;
|
|
@@ -269,15 +263,12 @@ const collectorVisitor = {
|
|
|
269
263
|
for (const param of params) {
|
|
270
264
|
path.scope.registerBinding("param", param);
|
|
271
265
|
}
|
|
272
|
-
|
|
273
|
-
if (path.isFunctionExpression() && path.has("id") &&
|
|
274
|
-
!path.get("id").node[NOT_LOCAL_BINDING]) {
|
|
266
|
+
if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
|
|
275
267
|
path.scope.registerBinding("local", path.get("id"), path);
|
|
276
268
|
}
|
|
277
269
|
},
|
|
278
270
|
ClassExpression(path) {
|
|
279
|
-
if (path.has("id") &&
|
|
280
|
-
!path.get("id").node[NOT_LOCAL_BINDING]) {
|
|
271
|
+
if (path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
|
|
281
272
|
path.scope.registerBinding("local", path);
|
|
282
273
|
}
|
|
283
274
|
}
|
|
@@ -310,7 +301,6 @@ class Scope {
|
|
|
310
301
|
this.labels = new Map();
|
|
311
302
|
this.inited = false;
|
|
312
303
|
}
|
|
313
|
-
|
|
314
304
|
get parent() {
|
|
315
305
|
var _parent;
|
|
316
306
|
let parent,
|
|
@@ -332,7 +322,6 @@ class Scope {
|
|
|
332
322
|
traverse(node, opts, state) {
|
|
333
323
|
(0, _index.default)(node, opts, this, state, this.path);
|
|
334
324
|
}
|
|
335
|
-
|
|
336
325
|
generateDeclaredUidIdentifier(name) {
|
|
337
326
|
const id = this.generateUidIdentifier(name);
|
|
338
327
|
this.push({
|
|
@@ -340,11 +329,9 @@ class Scope {
|
|
|
340
329
|
});
|
|
341
330
|
return cloneNode(id);
|
|
342
331
|
}
|
|
343
|
-
|
|
344
332
|
generateUidIdentifier(name) {
|
|
345
333
|
return identifier(this.generateUid(name));
|
|
346
334
|
}
|
|
347
|
-
|
|
348
335
|
generateUid(name = "temp") {
|
|
349
336
|
name = toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
|
|
350
337
|
let uid;
|
|
@@ -358,7 +345,6 @@ class Scope {
|
|
|
358
345
|
program.uids[uid] = true;
|
|
359
346
|
return uid;
|
|
360
347
|
}
|
|
361
|
-
|
|
362
348
|
_generateUid(name, i) {
|
|
363
349
|
let id = name;
|
|
364
350
|
if (i > 1) id += i;
|
|
@@ -371,11 +357,9 @@ class Scope {
|
|
|
371
357
|
id = id.replace(/^_/, "") || defaultName || "ref";
|
|
372
358
|
return this.generateUid(id.slice(0, 20));
|
|
373
359
|
}
|
|
374
|
-
|
|
375
360
|
generateUidIdentifierBasedOnNode(node, defaultName) {
|
|
376
361
|
return identifier(this.generateUidBasedOnNode(node, defaultName));
|
|
377
362
|
}
|
|
378
|
-
|
|
379
363
|
isStatic(node) {
|
|
380
364
|
if (isThisExpression(node) || isSuper(node) || isTopicReference(node)) {
|
|
381
365
|
return true;
|
|
@@ -390,7 +374,6 @@ class Scope {
|
|
|
390
374
|
}
|
|
391
375
|
return false;
|
|
392
376
|
}
|
|
393
|
-
|
|
394
377
|
maybeGenerateMemoised(node, dontPush) {
|
|
395
378
|
if (this.isStatic(node)) {
|
|
396
379
|
return null;
|
|
@@ -407,23 +390,20 @@ class Scope {
|
|
|
407
390
|
}
|
|
408
391
|
checkBlockScopedCollisions(local, kind, name, id) {
|
|
409
392
|
if (kind === "param") return;
|
|
410
|
-
|
|
411
393
|
if (local.kind === "local") return;
|
|
412
|
-
const duplicate =
|
|
413
|
-
kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" ||
|
|
414
|
-
local.kind === "param" && kind === "const";
|
|
394
|
+
const duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && kind === "const";
|
|
415
395
|
if (duplicate) {
|
|
416
396
|
throw this.hub.buildError(id, `Duplicate declaration "${name}"`, TypeError);
|
|
417
397
|
}
|
|
418
398
|
}
|
|
419
|
-
rename(oldName, newName
|
|
399
|
+
rename(oldName, newName) {
|
|
420
400
|
const binding = this.getBinding(oldName);
|
|
421
401
|
if (binding) {
|
|
422
|
-
newName
|
|
423
|
-
|
|
402
|
+
newName || (newName = this.generateUidIdentifier(oldName).name);
|
|
403
|
+
const renamer = new _renamer.default(binding, oldName, newName);
|
|
404
|
+
return renamer.rename(arguments[2]);
|
|
424
405
|
}
|
|
425
406
|
}
|
|
426
|
-
|
|
427
407
|
_renameFromMap(map, oldName, newName, value) {
|
|
428
408
|
if (map[oldName]) {
|
|
429
409
|
map[newName] = value;
|
|
@@ -448,7 +428,6 @@ class Scope {
|
|
|
448
428
|
} while (scope = scope.parent);
|
|
449
429
|
console.log(sep);
|
|
450
430
|
}
|
|
451
|
-
|
|
452
431
|
toArray(node, i, arrayLikeIsIterable) {
|
|
453
432
|
if (isIdentifier(node)) {
|
|
454
433
|
const binding = this.getBinding(node.name);
|
|
@@ -470,7 +449,6 @@ class Scope {
|
|
|
470
449
|
helperName = "toConsumableArray";
|
|
471
450
|
} else if (typeof i === "number") {
|
|
472
451
|
args.push(numericLiteral(i));
|
|
473
|
-
|
|
474
452
|
helperName = "slicedToArray";
|
|
475
453
|
} else {
|
|
476
454
|
helperName = "toArray";
|
|
@@ -479,7 +457,6 @@ class Scope {
|
|
|
479
457
|
args.unshift(this.hub.addHelper(helperName));
|
|
480
458
|
helperName = "maybeArrayLike";
|
|
481
459
|
}
|
|
482
|
-
|
|
483
460
|
return callExpression(this.hub.addHelper(helperName), args);
|
|
484
461
|
}
|
|
485
462
|
hasLabel(name) {
|
|
@@ -508,9 +485,11 @@ class Scope {
|
|
|
508
485
|
if (path.node.declare) return;
|
|
509
486
|
this.registerBinding("let", path);
|
|
510
487
|
} else if (path.isImportDeclaration()) {
|
|
488
|
+
const isTypeDeclaration = path.node.importKind === "type" || path.node.importKind === "typeof";
|
|
511
489
|
const specifiers = path.get("specifiers");
|
|
512
490
|
for (const specifier of specifiers) {
|
|
513
|
-
|
|
491
|
+
const isTypeSpecifier = isTypeDeclaration || specifier.isImportSpecifier() && (specifier.node.importKind === "type" || specifier.node.importKind === "typeof");
|
|
492
|
+
this.registerBinding(isTypeSpecifier ? "unknown" : "module", specifier);
|
|
514
493
|
}
|
|
515
494
|
} else if (path.isExportDeclaration()) {
|
|
516
495
|
const declar = path.get("declaration");
|
|
@@ -550,7 +529,6 @@ class Scope {
|
|
|
550
529
|
if (local.identifier === id) continue;
|
|
551
530
|
this.checkBlockScopedCollisions(local, kind, name, id);
|
|
552
531
|
}
|
|
553
|
-
|
|
554
532
|
if (local) {
|
|
555
533
|
this.registerConstantViolation(bindingPath);
|
|
556
534
|
} else {
|
|
@@ -650,11 +628,9 @@ class Scope {
|
|
|
650
628
|
return isPureish(node);
|
|
651
629
|
}
|
|
652
630
|
}
|
|
653
|
-
|
|
654
631
|
setData(key, val) {
|
|
655
632
|
return this.data[key] = val;
|
|
656
633
|
}
|
|
657
|
-
|
|
658
634
|
getData(key) {
|
|
659
635
|
let scope = this;
|
|
660
636
|
do {
|
|
@@ -662,7 +638,6 @@ class Scope {
|
|
|
662
638
|
if (data != null) return data;
|
|
663
639
|
} while (scope = scope.parent);
|
|
664
640
|
}
|
|
665
|
-
|
|
666
641
|
removeData(key) {
|
|
667
642
|
let scope = this;
|
|
668
643
|
do {
|
|
@@ -704,17 +679,14 @@ class Scope {
|
|
|
704
679
|
}
|
|
705
680
|
path.traverse(collectorVisitor, state);
|
|
706
681
|
this.crawling = false;
|
|
707
|
-
|
|
708
682
|
for (const path of state.assignments) {
|
|
709
683
|
const ids = path.getBindingIdentifiers();
|
|
710
684
|
for (const name of Object.keys(ids)) {
|
|
711
685
|
if (path.scope.getBinding(name)) continue;
|
|
712
686
|
programParent.addGlobal(ids[name]);
|
|
713
687
|
}
|
|
714
|
-
|
|
715
688
|
path.scope.registerConstantViolation(path);
|
|
716
689
|
}
|
|
717
|
-
|
|
718
690
|
for (const ref of state.references) {
|
|
719
691
|
const binding = ref.scope.getBinding(ref.node.name);
|
|
720
692
|
if (binding) {
|
|
@@ -723,7 +695,6 @@ class Scope {
|
|
|
723
695
|
programParent.addGlobal(ref.node);
|
|
724
696
|
}
|
|
725
697
|
}
|
|
726
|
-
|
|
727
698
|
for (const path of state.constantViolations) {
|
|
728
699
|
path.scope.registerConstantViolation(path);
|
|
729
700
|
}
|
|
@@ -757,7 +728,6 @@ class Scope {
|
|
|
757
728
|
const len = declarPath.node.declarations.push(declarator);
|
|
758
729
|
path.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]);
|
|
759
730
|
}
|
|
760
|
-
|
|
761
731
|
getProgramParent() {
|
|
762
732
|
let scope = this;
|
|
763
733
|
do {
|
|
@@ -767,7 +737,6 @@ class Scope {
|
|
|
767
737
|
} while (scope = scope.parent);
|
|
768
738
|
throw new Error("Couldn't find a Program");
|
|
769
739
|
}
|
|
770
|
-
|
|
771
740
|
getFunctionParent() {
|
|
772
741
|
let scope = this;
|
|
773
742
|
do {
|
|
@@ -777,7 +746,6 @@ class Scope {
|
|
|
777
746
|
} while (scope = scope.parent);
|
|
778
747
|
return null;
|
|
779
748
|
}
|
|
780
|
-
|
|
781
749
|
getBlockParent() {
|
|
782
750
|
let scope = this;
|
|
783
751
|
do {
|
|
@@ -787,7 +755,6 @@ class Scope {
|
|
|
787
755
|
} while (scope = scope.parent);
|
|
788
756
|
throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...");
|
|
789
757
|
}
|
|
790
|
-
|
|
791
758
|
getPatternParent() {
|
|
792
759
|
let scope = this;
|
|
793
760
|
do {
|
|
@@ -797,7 +764,6 @@ class Scope {
|
|
|
797
764
|
} while (scope = scope.parent.parent);
|
|
798
765
|
throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...");
|
|
799
766
|
}
|
|
800
|
-
|
|
801
767
|
getAllBindings() {
|
|
802
768
|
const ids = Object.create(null);
|
|
803
769
|
let scope = this;
|
|
@@ -811,7 +777,6 @@ class Scope {
|
|
|
811
777
|
} while (scope);
|
|
812
778
|
return ids;
|
|
813
779
|
}
|
|
814
|
-
|
|
815
780
|
getAllBindingsOfKind(...kinds) {
|
|
816
781
|
const ids = Object.create(null);
|
|
817
782
|
for (const kind of kinds) {
|
|
@@ -836,9 +801,7 @@ class Scope {
|
|
|
836
801
|
const binding = scope.getOwnBinding(name);
|
|
837
802
|
if (binding) {
|
|
838
803
|
var _previousPath;
|
|
839
|
-
|
|
840
|
-
if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param" && binding.kind !== "local") {
|
|
841
|
-
} else {
|
|
804
|
+
if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param" && binding.kind !== "local") {} else {
|
|
842
805
|
return binding;
|
|
843
806
|
}
|
|
844
807
|
} else if (!binding && name === "arguments" && scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) {
|
|
@@ -850,12 +813,10 @@ class Scope {
|
|
|
850
813
|
getOwnBinding(name) {
|
|
851
814
|
return this.bindings[name];
|
|
852
815
|
}
|
|
853
|
-
|
|
854
816
|
getBindingIdentifier(name) {
|
|
855
817
|
var _this$getBinding;
|
|
856
818
|
return (_this$getBinding = this.getBinding(name)) == null ? void 0 : _this$getBinding.identifier;
|
|
857
819
|
}
|
|
858
|
-
|
|
859
820
|
getOwnBindingIdentifier(name) {
|
|
860
821
|
const binding = this.bindings[name];
|
|
861
822
|
return binding == null ? void 0 : binding.identifier;
|
|
@@ -863,20 +824,25 @@ class Scope {
|
|
|
863
824
|
hasOwnBinding(name) {
|
|
864
825
|
return !!this.getOwnBinding(name);
|
|
865
826
|
}
|
|
866
|
-
hasBinding(name,
|
|
827
|
+
hasBinding(name, opts) {
|
|
828
|
+
var _opts, _opts2, _opts3;
|
|
867
829
|
if (!name) return false;
|
|
868
830
|
if (this.hasOwnBinding(name)) return true;
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
831
|
+
{
|
|
832
|
+
if (typeof opts === "boolean") opts = {
|
|
833
|
+
noGlobals: opts
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
if (this.parentHasBinding(name, opts)) return true;
|
|
837
|
+
if (!((_opts = opts) != null && _opts.noUids) && this.hasUid(name)) return true;
|
|
838
|
+
if (!((_opts2 = opts) != null && _opts2.noGlobals) && Scope.globals.includes(name)) return true;
|
|
839
|
+
if (!((_opts3 = opts) != null && _opts3.noGlobals) && Scope.contextVariables.includes(name)) return true;
|
|
873
840
|
return false;
|
|
874
841
|
}
|
|
875
|
-
parentHasBinding(name,
|
|
842
|
+
parentHasBinding(name, opts) {
|
|
876
843
|
var _this$parent;
|
|
877
|
-
return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name,
|
|
844
|
+
return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, opts);
|
|
878
845
|
}
|
|
879
|
-
|
|
880
846
|
moveBindingTo(name, scope) {
|
|
881
847
|
const info = this.getBinding(name);
|
|
882
848
|
if (info) {
|
|
@@ -891,7 +857,6 @@ class Scope {
|
|
|
891
857
|
removeBinding(name) {
|
|
892
858
|
var _this$getBinding2;
|
|
893
859
|
(_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.scope.removeOwnBinding(name);
|
|
894
|
-
|
|
895
860
|
let scope = this;
|
|
896
861
|
do {
|
|
897
862
|
if (scope.uids[name]) {
|