@next-core/brick-utils 2.30.1 → 2.31.1
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/CHANGELOG.md +38 -0
- package/dist/index.bundle.js +342 -255
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +337 -253
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/index.bundle.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('lodash'), require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/objectSpread2'), require('@
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', 'lodash', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/objectSpread2', '@
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickUtils = {}, global._asyncToGenerator, global.lodash, global._defineProperty, global._objectSpread, global.
|
|
5
|
-
})(this, (function (exports, _asyncToGenerator, lodash, _defineProperty, _objectSpread,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('lodash'), require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@next-core/pipes'), require('js-yaml')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', 'lodash', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@next-core/pipes', 'js-yaml'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickUtils = {}, global._asyncToGenerator, global.lodash, global._defineProperty, global._objectSpread, global._objectWithoutProperties, global.pipes, global.yaml));
|
|
5
|
+
})(this, (function (exports, _asyncToGenerator, lodash, _defineProperty, _objectSpread, _objectWithoutProperties, pipes, yaml) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -18391,7 +18391,72 @@
|
|
|
18391
18391
|
|
|
18392
18392
|
var parse_1 = lib.parse = parse$1;
|
|
18393
18393
|
var parseExpression_1 = lib.parseExpression = parseExpression;
|
|
18394
|
-
lib.tokTypes = tokTypes;
|
|
18394
|
+
var tokTypes_1 = lib.tokTypes = tokTypes;
|
|
18395
|
+
|
|
18396
|
+
function parseAsEstreeExpression(source) {
|
|
18397
|
+
return parseExpression_1(source, {
|
|
18398
|
+
plugins: ["estree", ["pipelineOperator", {
|
|
18399
|
+
proposal: "minimal"
|
|
18400
|
+
}]],
|
|
18401
|
+
attachComment: false
|
|
18402
|
+
});
|
|
18403
|
+
}
|
|
18404
|
+
function parseAsEstree(source) {
|
|
18405
|
+
var {
|
|
18406
|
+
typescript
|
|
18407
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18408
|
+
var file = parse_1(source, {
|
|
18409
|
+
plugins: ["estree", typescript && "typescript"].filter(Boolean),
|
|
18410
|
+
strictMode: true,
|
|
18411
|
+
attachComment: false
|
|
18412
|
+
});
|
|
18413
|
+
var body = file.program.body;
|
|
18414
|
+
var jsNodes = typescript ? [] : body;
|
|
18415
|
+
|
|
18416
|
+
if (typescript) {
|
|
18417
|
+
for (var node of body) {
|
|
18418
|
+
if (node.type.startsWith("TS")) {
|
|
18419
|
+
if (/Enum|Import|Export/.test(node.type)) {
|
|
18420
|
+
throw new SyntaxError("Unsupported TypeScript syntax: ".concat(node.type));
|
|
18421
|
+
}
|
|
18422
|
+
} else {
|
|
18423
|
+
jsNodes.push(node);
|
|
18424
|
+
}
|
|
18425
|
+
}
|
|
18426
|
+
}
|
|
18427
|
+
|
|
18428
|
+
if (jsNodes.length === 0) {
|
|
18429
|
+
throw new SyntaxError("Function declaration not found");
|
|
18430
|
+
}
|
|
18431
|
+
|
|
18432
|
+
if (jsNodes.length > 1 || jsNodes[0].type !== "FunctionDeclaration") {
|
|
18433
|
+
throw new SyntaxError("Expect a single function declaration at top level, but received: ".concat(jsNodes.map(node => "\"".concat(node.type, "\"")).join(", ")));
|
|
18434
|
+
}
|
|
18435
|
+
|
|
18436
|
+
return jsNodes[0];
|
|
18437
|
+
}
|
|
18438
|
+
/** For next-core internal or devtools usage only. */
|
|
18439
|
+
|
|
18440
|
+
function parseForAnalysis(source) {
|
|
18441
|
+
var {
|
|
18442
|
+
typescript,
|
|
18443
|
+
tokens
|
|
18444
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18445
|
+
|
|
18446
|
+
try {
|
|
18447
|
+
return parse_1(source, {
|
|
18448
|
+
plugins: ["estree", typescript && "typescript"].filter(Boolean),
|
|
18449
|
+
strictMode: true,
|
|
18450
|
+
attachComment: false,
|
|
18451
|
+
// Allow export/import declarations to make analyser handle errors.
|
|
18452
|
+
sourceType: "unambiguous",
|
|
18453
|
+
tokens
|
|
18454
|
+
});
|
|
18455
|
+
} catch (e) {
|
|
18456
|
+
// Return no errors if parse failed.
|
|
18457
|
+
return null;
|
|
18458
|
+
}
|
|
18459
|
+
}
|
|
18395
18460
|
|
|
18396
18461
|
function hasOwnProperty(object, property) {
|
|
18397
18462
|
return Object.prototype.hasOwnProperty.call(object, property);
|
|
@@ -18437,6 +18502,7 @@
|
|
|
18437
18502
|
var {
|
|
18438
18503
|
expressionOnly,
|
|
18439
18504
|
visitors,
|
|
18505
|
+
withParent,
|
|
18440
18506
|
hooks = {}
|
|
18441
18507
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18442
18508
|
var attemptToVisitGlobals = new Set();
|
|
@@ -18457,102 +18523,107 @@
|
|
|
18457
18523
|
}
|
|
18458
18524
|
}
|
|
18459
18525
|
|
|
18460
|
-
function
|
|
18526
|
+
function EvaluateChildren(node, keys, parent) {
|
|
18527
|
+
for (var key of keys) {
|
|
18528
|
+
Evaluate(node[key], parent === null || parent === void 0 ? void 0 : parent.concat({
|
|
18529
|
+
node,
|
|
18530
|
+
key
|
|
18531
|
+
}));
|
|
18532
|
+
}
|
|
18533
|
+
}
|
|
18534
|
+
|
|
18535
|
+
function Evaluate(node, parent) {
|
|
18461
18536
|
if (Array.isArray(node)) {
|
|
18462
|
-
|
|
18463
|
-
Evaluate(n)
|
|
18464
|
-
|
|
18537
|
+
node.forEach((n, index) => {
|
|
18538
|
+
Evaluate(n, parent ? parent.slice(0, -1).concat(_objectSpread__default["default"](_objectSpread__default["default"]({}, parent[parent.length - 1]), {}, {
|
|
18539
|
+
index
|
|
18540
|
+
})) : parent);
|
|
18541
|
+
});
|
|
18465
18542
|
} else if (node) {
|
|
18466
|
-
var _hooks$beforeVisit; // `node` maybe `null` in some cases.
|
|
18543
|
+
var _hooks$beforeVisit, _hooks$beforeVisitUnk; // `node` maybe `null` in some cases.
|
|
18467
18544
|
|
|
18468
18545
|
|
|
18469
|
-
(_hooks$beforeVisit = hooks.beforeVisit) === null || _hooks$beforeVisit === void 0 ? void 0 : _hooks$beforeVisit.call(hooks, node);
|
|
18546
|
+
(_hooks$beforeVisit = hooks.beforeVisit) === null || _hooks$beforeVisit === void 0 ? void 0 : _hooks$beforeVisit.call(hooks, node, parent);
|
|
18470
18547
|
visitors && visit(node); // Expressions:
|
|
18471
18548
|
|
|
18472
18549
|
switch (node.type) {
|
|
18473
18550
|
case "Identifier":
|
|
18474
18551
|
if (!ResolveBinding(node.name)) {
|
|
18475
|
-
|
|
18552
|
+
var _hooks$beforeVisitGlo;
|
|
18476
18553
|
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
}
|
|
18554
|
+
(_hooks$beforeVisitGlo = hooks.beforeVisitGlobal) === null || _hooks$beforeVisitGlo === void 0 ? void 0 : _hooks$beforeVisitGlo.call(hooks, node, parent);
|
|
18555
|
+
attemptToVisitGlobals.add(node.name);
|
|
18480
18556
|
}
|
|
18481
18557
|
|
|
18482
18558
|
return;
|
|
18483
18559
|
|
|
18484
18560
|
case "ArrayExpression":
|
|
18485
18561
|
case "ArrayPattern":
|
|
18486
|
-
|
|
18562
|
+
EvaluateChildren(node, ["elements"], parent);
|
|
18487
18563
|
return;
|
|
18488
18564
|
|
|
18489
18565
|
case "ArrowFunctionExpression":
|
|
18490
18566
|
{
|
|
18491
18567
|
var env = getRunningContext().LexicalEnvironment;
|
|
18492
18568
|
var closure = OrdinaryFunctionCreate(node, env);
|
|
18493
|
-
CallFunction(closure);
|
|
18569
|
+
CallFunction(closure, parent);
|
|
18494
18570
|
return;
|
|
18495
18571
|
}
|
|
18496
18572
|
|
|
18497
18573
|
case "AssignmentPattern":
|
|
18498
18574
|
case "BinaryExpression":
|
|
18499
18575
|
case "LogicalExpression":
|
|
18500
|
-
|
|
18501
|
-
Evaluate(node.right);
|
|
18576
|
+
EvaluateChildren(node, ["left", "right"], parent);
|
|
18502
18577
|
return;
|
|
18503
18578
|
|
|
18504
18579
|
case "CallExpression":
|
|
18505
18580
|
case "NewExpression":
|
|
18506
|
-
|
|
18507
|
-
Evaluate(node.arguments);
|
|
18581
|
+
EvaluateChildren(node, ["callee", "arguments"], parent);
|
|
18508
18582
|
return;
|
|
18509
18583
|
|
|
18510
18584
|
case "ChainExpression":
|
|
18511
|
-
|
|
18585
|
+
EvaluateChildren(node, ["expression"], parent);
|
|
18512
18586
|
return;
|
|
18513
18587
|
|
|
18514
18588
|
case "ConditionalExpression":
|
|
18515
|
-
|
|
18516
|
-
Evaluate(node.consequent);
|
|
18517
|
-
Evaluate(node.alternate);
|
|
18589
|
+
EvaluateChildren(node, ["test", "consequent", "alternate"], parent);
|
|
18518
18590
|
return;
|
|
18519
18591
|
|
|
18520
18592
|
case "MemberExpression":
|
|
18521
|
-
|
|
18593
|
+
EvaluateChildren(node, ["object"], parent);
|
|
18522
18594
|
|
|
18523
18595
|
if (node.computed) {
|
|
18524
|
-
|
|
18596
|
+
EvaluateChildren(node, ["property"], parent);
|
|
18525
18597
|
}
|
|
18526
18598
|
|
|
18527
18599
|
return;
|
|
18528
18600
|
|
|
18529
18601
|
case "ObjectExpression":
|
|
18530
18602
|
case "ObjectPattern":
|
|
18531
|
-
|
|
18603
|
+
EvaluateChildren(node, ["properties"], parent);
|
|
18532
18604
|
return;
|
|
18533
18605
|
|
|
18534
18606
|
case "Property":
|
|
18535
18607
|
if (node.computed) {
|
|
18536
|
-
|
|
18608
|
+
EvaluateChildren(node, ["key"], parent);
|
|
18537
18609
|
}
|
|
18538
18610
|
|
|
18539
|
-
|
|
18611
|
+
EvaluateChildren(node, ["value"], parent);
|
|
18540
18612
|
return;
|
|
18541
18613
|
|
|
18542
18614
|
case "RestElement":
|
|
18543
18615
|
case "SpreadElement":
|
|
18544
18616
|
case "UnaryExpression":
|
|
18545
|
-
|
|
18617
|
+
EvaluateChildren(node, ["argument"], parent);
|
|
18546
18618
|
return;
|
|
18547
18619
|
|
|
18548
18620
|
case "SequenceExpression":
|
|
18549
18621
|
case "TemplateLiteral":
|
|
18550
|
-
|
|
18622
|
+
EvaluateChildren(node, ["expressions"], parent);
|
|
18551
18623
|
return;
|
|
18552
18624
|
|
|
18553
18625
|
case "TaggedTemplateExpression":
|
|
18554
|
-
|
|
18555
|
-
Evaluate(node.quasi);
|
|
18626
|
+
EvaluateChildren(node, ["tag", "quasi"], parent);
|
|
18556
18627
|
return;
|
|
18557
18628
|
|
|
18558
18629
|
case "Literal":
|
|
@@ -18563,8 +18634,7 @@
|
|
|
18563
18634
|
// Statements and assignments:
|
|
18564
18635
|
switch (node.type) {
|
|
18565
18636
|
case "AssignmentExpression":
|
|
18566
|
-
|
|
18567
|
-
Evaluate(node.left);
|
|
18637
|
+
EvaluateChildren(node, ["right", "left"], parent);
|
|
18568
18638
|
return;
|
|
18569
18639
|
|
|
18570
18640
|
case "BlockStatement":
|
|
@@ -18578,7 +18648,7 @@
|
|
|
18578
18648
|
var blockEnv = new AnalysisEnvironment(oldEnv);
|
|
18579
18649
|
BlockDeclarationInstantiation(node.body, blockEnv);
|
|
18580
18650
|
runningContext.LexicalEnvironment = blockEnv;
|
|
18581
|
-
|
|
18651
|
+
EvaluateChildren(node, ["body"], parent);
|
|
18582
18652
|
runningContext.LexicalEnvironment = oldEnv;
|
|
18583
18653
|
return;
|
|
18584
18654
|
}
|
|
@@ -18596,20 +18666,18 @@
|
|
|
18596
18666
|
var catchEnv = new AnalysisEnvironment(_oldEnv);
|
|
18597
18667
|
BoundNamesInstantiation(node.param, catchEnv);
|
|
18598
18668
|
_runningContext.LexicalEnvironment = catchEnv;
|
|
18599
|
-
|
|
18600
|
-
Evaluate(node.body);
|
|
18669
|
+
EvaluateChildren(node, ["param", "body"], parent);
|
|
18601
18670
|
_runningContext.LexicalEnvironment = _oldEnv;
|
|
18602
18671
|
return;
|
|
18603
18672
|
}
|
|
18604
18673
|
|
|
18605
18674
|
case "DoWhileStatement":
|
|
18606
|
-
|
|
18607
|
-
Evaluate(node.test);
|
|
18675
|
+
EvaluateChildren(node, ["body", "test"], parent);
|
|
18608
18676
|
return;
|
|
18609
18677
|
|
|
18610
18678
|
case "ExpressionStatement":
|
|
18611
18679
|
case "TSAsExpression":
|
|
18612
|
-
|
|
18680
|
+
EvaluateChildren(node, ["expression"], parent);
|
|
18613
18681
|
return;
|
|
18614
18682
|
|
|
18615
18683
|
case "ForInStatement":
|
|
@@ -18628,7 +18696,7 @@
|
|
|
18628
18696
|
_runningContext2.LexicalEnvironment = newEnv;
|
|
18629
18697
|
}
|
|
18630
18698
|
|
|
18631
|
-
|
|
18699
|
+
EvaluateChildren(node, ["right"], parent);
|
|
18632
18700
|
_runningContext2.LexicalEnvironment = _oldEnv2; // ForIn/OfBodyEvaluation
|
|
18633
18701
|
|
|
18634
18702
|
if (lexicalBinding) {
|
|
@@ -18637,8 +18705,7 @@
|
|
|
18637
18705
|
_runningContext2.LexicalEnvironment = iterationEnv;
|
|
18638
18706
|
}
|
|
18639
18707
|
|
|
18640
|
-
|
|
18641
|
-
Evaluate(node.body);
|
|
18708
|
+
EvaluateChildren(node, ["left", "body"], parent);
|
|
18642
18709
|
_runningContext2.LexicalEnvironment = _oldEnv2;
|
|
18643
18710
|
return;
|
|
18644
18711
|
}
|
|
@@ -18659,10 +18726,7 @@
|
|
|
18659
18726
|
_runningContext3.LexicalEnvironment = loopEnv;
|
|
18660
18727
|
}
|
|
18661
18728
|
|
|
18662
|
-
|
|
18663
|
-
Evaluate(node.test);
|
|
18664
|
-
Evaluate(node.body);
|
|
18665
|
-
Evaluate(node.update);
|
|
18729
|
+
EvaluateChildren(node, ["init", "test", "body", "update"], parent);
|
|
18666
18730
|
_runningContext3.LexicalEnvironment = _oldEnv3;
|
|
18667
18731
|
return;
|
|
18668
18732
|
}
|
|
@@ -18675,7 +18739,7 @@
|
|
|
18675
18739
|
|
|
18676
18740
|
_env.CreateBinding(fn);
|
|
18677
18741
|
|
|
18678
|
-
CallFunction(fo);
|
|
18742
|
+
CallFunction(fo, parent);
|
|
18679
18743
|
return;
|
|
18680
18744
|
}
|
|
18681
18745
|
|
|
@@ -18683,30 +18747,27 @@
|
|
|
18683
18747
|
{
|
|
18684
18748
|
var _closure = InstantiateOrdinaryFunctionExpression(node);
|
|
18685
18749
|
|
|
18686
|
-
CallFunction(_closure);
|
|
18750
|
+
CallFunction(_closure, parent);
|
|
18687
18751
|
return;
|
|
18688
18752
|
}
|
|
18689
18753
|
|
|
18690
18754
|
case "IfStatement":
|
|
18691
|
-
|
|
18692
|
-
Evaluate(node.consequent);
|
|
18693
|
-
Evaluate(node.alternate);
|
|
18755
|
+
EvaluateChildren(node, ["test", "consequent", "alternate"], parent);
|
|
18694
18756
|
return;
|
|
18695
18757
|
|
|
18696
18758
|
case "ReturnStatement":
|
|
18697
18759
|
case "ThrowStatement":
|
|
18698
18760
|
case "UpdateExpression":
|
|
18699
|
-
|
|
18761
|
+
EvaluateChildren(node, ["argument"], parent);
|
|
18700
18762
|
return;
|
|
18701
18763
|
|
|
18702
18764
|
case "SwitchCase":
|
|
18703
|
-
|
|
18704
|
-
Evaluate(node.consequent);
|
|
18765
|
+
EvaluateChildren(node, ["test", "consequent"], parent);
|
|
18705
18766
|
return;
|
|
18706
18767
|
|
|
18707
18768
|
case "SwitchStatement":
|
|
18708
18769
|
{
|
|
18709
|
-
|
|
18770
|
+
EvaluateChildren(node, ["discriminant"], parent);
|
|
18710
18771
|
|
|
18711
18772
|
var _runningContext4 = getRunningContext();
|
|
18712
18773
|
|
|
@@ -18716,36 +18777,32 @@
|
|
|
18716
18777
|
|
|
18717
18778
|
BlockDeclarationInstantiation(node.cases, _blockEnv);
|
|
18718
18779
|
_runningContext4.LexicalEnvironment = _blockEnv;
|
|
18719
|
-
|
|
18780
|
+
EvaluateChildren(node, ["cases"], parent);
|
|
18720
18781
|
_runningContext4.LexicalEnvironment = _oldEnv4;
|
|
18721
18782
|
return;
|
|
18722
18783
|
}
|
|
18723
18784
|
|
|
18724
18785
|
case "TryStatement":
|
|
18725
|
-
|
|
18726
|
-
Evaluate(node.handler);
|
|
18727
|
-
Evaluate(node.finalizer);
|
|
18786
|
+
EvaluateChildren(node, ["block", "handler", "finalizer"], parent);
|
|
18728
18787
|
return;
|
|
18729
18788
|
|
|
18730
18789
|
case "VariableDeclaration":
|
|
18731
|
-
|
|
18790
|
+
EvaluateChildren(node, ["declarations"], parent);
|
|
18732
18791
|
return;
|
|
18733
18792
|
|
|
18734
18793
|
case "VariableDeclarator":
|
|
18735
|
-
|
|
18736
|
-
Evaluate(node.init);
|
|
18794
|
+
EvaluateChildren(node, ["id", "init"], parent);
|
|
18737
18795
|
return;
|
|
18738
18796
|
|
|
18739
18797
|
case "WhileStatement":
|
|
18740
|
-
|
|
18741
|
-
Evaluate(node.body);
|
|
18798
|
+
EvaluateChildren(node, ["test", "body"], parent);
|
|
18742
18799
|
return;
|
|
18743
18800
|
}
|
|
18744
18801
|
}
|
|
18745
18802
|
|
|
18746
|
-
|
|
18747
|
-
|
|
18748
|
-
|
|
18803
|
+
var silent = (_hooks$beforeVisitUnk = hooks.beforeVisitUnknown) === null || _hooks$beforeVisitUnk === void 0 ? void 0 : _hooks$beforeVisitUnk.call(hooks, node, parent);
|
|
18804
|
+
|
|
18805
|
+
if (!silent) {
|
|
18749
18806
|
// eslint-disable-next-line no-console
|
|
18750
18807
|
console.warn("Unsupported node type `".concat(node.type, "`"));
|
|
18751
18808
|
}
|
|
@@ -18775,10 +18832,16 @@
|
|
|
18775
18832
|
BoundNamesInstantiation(declarations, env);
|
|
18776
18833
|
}
|
|
18777
18834
|
|
|
18778
|
-
function CallFunction(closure) {
|
|
18835
|
+
function CallFunction(closure, parent) {
|
|
18779
18836
|
PrepareOrdinaryCall(closure);
|
|
18780
|
-
FunctionDeclarationInstantiation(closure);
|
|
18781
|
-
Evaluate(closure.ECMAScriptCode
|
|
18837
|
+
FunctionDeclarationInstantiation(closure, parent);
|
|
18838
|
+
Evaluate(closure.ECMAScriptCode, parent === null || parent === void 0 ? void 0 : parent.concat({
|
|
18839
|
+
node: closure.Function,
|
|
18840
|
+
key: "body"
|
|
18841
|
+
}).concat(closure.Function.body.type === "BlockStatement" ? {
|
|
18842
|
+
node: closure.Function.body,
|
|
18843
|
+
key: "body"
|
|
18844
|
+
} : []));
|
|
18782
18845
|
analysisContextStack.pop();
|
|
18783
18846
|
}
|
|
18784
18847
|
|
|
@@ -18790,7 +18853,7 @@
|
|
|
18790
18853
|
analysisContextStack.push(calleeContext);
|
|
18791
18854
|
}
|
|
18792
18855
|
|
|
18793
|
-
function FunctionDeclarationInstantiation(func) {
|
|
18856
|
+
function FunctionDeclarationInstantiation(func, parent) {
|
|
18794
18857
|
var calleeContext = getRunningContext();
|
|
18795
18858
|
var code = func.ECMAScriptCode;
|
|
18796
18859
|
var formals = func.FormalParameters;
|
|
@@ -18802,7 +18865,10 @@
|
|
|
18802
18865
|
var varNames = collectBoundNames(varDeclarations);
|
|
18803
18866
|
var env = calleeContext.LexicalEnvironment;
|
|
18804
18867
|
BoundNamesInstantiation(formals, env);
|
|
18805
|
-
Evaluate(formals
|
|
18868
|
+
Evaluate(formals, parent === null || parent === void 0 ? void 0 : parent.concat({
|
|
18869
|
+
node: func.Function,
|
|
18870
|
+
key: "params"
|
|
18871
|
+
}));
|
|
18806
18872
|
var varEnv;
|
|
18807
18873
|
|
|
18808
18874
|
if (!hasParameterExpressions) {
|
|
@@ -18847,19 +18913,16 @@
|
|
|
18847
18913
|
return OrdinaryFunctionCreate(functionExpression, funcEnv);
|
|
18848
18914
|
}
|
|
18849
18915
|
|
|
18850
|
-
function OrdinaryFunctionCreate(
|
|
18851
|
-
var {
|
|
18852
|
-
params,
|
|
18853
|
-
body
|
|
18854
|
-
} = _ref;
|
|
18916
|
+
function OrdinaryFunctionCreate(func, scope) {
|
|
18855
18917
|
return {
|
|
18856
|
-
|
|
18857
|
-
|
|
18918
|
+
Function: func,
|
|
18919
|
+
FormalParameters: func.params,
|
|
18920
|
+
ECMAScriptCode: func.body.type === "BlockStatement" ? func.body.body : func.body,
|
|
18858
18921
|
Environment: scope
|
|
18859
18922
|
};
|
|
18860
18923
|
}
|
|
18861
18924
|
|
|
18862
|
-
Evaluate(rootAst);
|
|
18925
|
+
Evaluate(rootAst, withParent ? [] : undefined);
|
|
18863
18926
|
return attemptToVisitGlobals;
|
|
18864
18927
|
}
|
|
18865
18928
|
|
|
@@ -18871,17 +18934,11 @@
|
|
|
18871
18934
|
rules
|
|
18872
18935
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18873
18936
|
var errors = [];
|
|
18874
|
-
var file
|
|
18937
|
+
var file = typeof source === "string" ? parseForAnalysis(source, {
|
|
18938
|
+
typescript
|
|
18939
|
+
}) : source;
|
|
18875
18940
|
|
|
18876
|
-
|
|
18877
|
-
file = parse_1(source, {
|
|
18878
|
-
plugins: ["estree", typescript && "typescript"].filter(Boolean),
|
|
18879
|
-
strictMode: true,
|
|
18880
|
-
attachComment: false,
|
|
18881
|
-
// Allow export/import declarations to make linter handle errors.
|
|
18882
|
-
sourceType: "unambiguous"
|
|
18883
|
-
});
|
|
18884
|
-
} catch (e) {
|
|
18941
|
+
if (!file) {
|
|
18885
18942
|
// Return no errors if parse failed.
|
|
18886
18943
|
return errors;
|
|
18887
18944
|
}
|
|
@@ -18937,93 +18994,100 @@
|
|
|
18937
18994
|
}
|
|
18938
18995
|
});
|
|
18939
18996
|
} else {
|
|
18940
|
-
var FunctionVisitor = node => {
|
|
18941
|
-
if (node.async || node.generator) {
|
|
18942
|
-
errors.push({
|
|
18943
|
-
type: "SyntaxError",
|
|
18944
|
-
message: "".concat(node.async ? "Async" : "Generator", " function is not allowed"),
|
|
18945
|
-
loc: node.loc
|
|
18946
|
-
});
|
|
18947
|
-
}
|
|
18948
|
-
};
|
|
18949
|
-
|
|
18950
18997
|
precook(func, {
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
|
|
18958
|
-
if (node.value === null) {
|
|
18959
|
-
errors.push({
|
|
18960
|
-
type: "SyntaxError",
|
|
18961
|
-
message: "Invalid regular expression",
|
|
18962
|
-
loc: node.loc
|
|
18963
|
-
});
|
|
18964
|
-
} else if (node.regex.flags.includes("u")) {
|
|
18965
|
-
errors.push({
|
|
18966
|
-
type: "SyntaxError",
|
|
18967
|
-
message: "Unsupported unicode flag in regular expression",
|
|
18968
|
-
loc: node.loc
|
|
18969
|
-
});
|
|
18970
|
-
}
|
|
18971
|
-
}
|
|
18972
|
-
},
|
|
18973
|
-
|
|
18974
|
-
ObjectExpression(node) {
|
|
18975
|
-
for (var prop of node.properties) {
|
|
18976
|
-
if (prop.type === "Property") {
|
|
18977
|
-
if (prop.kind !== "init") {
|
|
18998
|
+
hooks: {
|
|
18999
|
+
beforeVisit(node) {
|
|
19000
|
+
switch (node.type) {
|
|
19001
|
+
case "ArrowFunctionExpression":
|
|
19002
|
+
case "FunctionDeclaration":
|
|
19003
|
+
case "FunctionExpression":
|
|
19004
|
+
if (node.async || node.generator) {
|
|
18978
19005
|
errors.push({
|
|
18979
19006
|
type: "SyntaxError",
|
|
18980
|
-
message: "
|
|
18981
|
-
loc:
|
|
19007
|
+
message: "".concat(node.async ? "Async" : "Generator", " function is not allowed"),
|
|
19008
|
+
loc: node.loc
|
|
18982
19009
|
});
|
|
18983
|
-
}
|
|
19010
|
+
}
|
|
19011
|
+
|
|
19012
|
+
break;
|
|
19013
|
+
|
|
19014
|
+
case "Literal":
|
|
19015
|
+
if (node.regex) {
|
|
19016
|
+
if (node.value === null) {
|
|
19017
|
+
errors.push({
|
|
19018
|
+
type: "SyntaxError",
|
|
19019
|
+
message: "Invalid regular expression",
|
|
19020
|
+
loc: node.loc
|
|
19021
|
+
});
|
|
19022
|
+
} else if (node.regex.flags.includes("u")) {
|
|
19023
|
+
errors.push({
|
|
19024
|
+
type: "SyntaxError",
|
|
19025
|
+
message: "Unsupported unicode flag in regular expression",
|
|
19026
|
+
loc: node.loc
|
|
19027
|
+
});
|
|
19028
|
+
}
|
|
19029
|
+
}
|
|
19030
|
+
|
|
19031
|
+
break;
|
|
19032
|
+
|
|
19033
|
+
case "ObjectExpression":
|
|
19034
|
+
for (var prop of node.properties) {
|
|
19035
|
+
if (prop.type === "Property") {
|
|
19036
|
+
if (prop.kind !== "init") {
|
|
19037
|
+
errors.push({
|
|
19038
|
+
type: "SyntaxError",
|
|
19039
|
+
message: "Unsupported object getter/setter property",
|
|
19040
|
+
loc: prop.loc
|
|
19041
|
+
});
|
|
19042
|
+
} else if (!prop.computed && prop.key.type === "Identifier" && prop.key.name === "__proto__") {
|
|
19043
|
+
errors.push({
|
|
19044
|
+
type: "TypeError",
|
|
19045
|
+
message: "Setting '__proto__' property is not allowed",
|
|
19046
|
+
loc: prop.key.loc
|
|
19047
|
+
});
|
|
19048
|
+
}
|
|
19049
|
+
}
|
|
19050
|
+
}
|
|
19051
|
+
|
|
19052
|
+
break;
|
|
19053
|
+
|
|
19054
|
+
case "VariableDeclaration":
|
|
19055
|
+
if (node.kind === "var" && rules !== null && rules !== void 0 && rules.noVar) {
|
|
18984
19056
|
errors.push({
|
|
18985
|
-
type: "
|
|
18986
|
-
message: "
|
|
18987
|
-
loc:
|
|
19057
|
+
type: "SyntaxError",
|
|
19058
|
+
message: "Var declaration is not recommended, use `let` or `const` instead",
|
|
19059
|
+
loc: {
|
|
19060
|
+
start: node.loc.start,
|
|
19061
|
+
end: {
|
|
19062
|
+
line: node.loc.end.line,
|
|
19063
|
+
// Only decorate the "var".
|
|
19064
|
+
column: node.loc.start.column + 3
|
|
19065
|
+
}
|
|
19066
|
+
}
|
|
18988
19067
|
});
|
|
18989
19068
|
}
|
|
18990
|
-
|
|
19069
|
+
|
|
19070
|
+
break;
|
|
18991
19071
|
}
|
|
18992
19072
|
},
|
|
18993
19073
|
|
|
18994
|
-
|
|
18995
|
-
if (node.
|
|
19074
|
+
beforeVisitGlobal(node) {
|
|
19075
|
+
if (node.name === "arguments") {
|
|
18996
19076
|
errors.push({
|
|
18997
19077
|
type: "SyntaxError",
|
|
18998
|
-
message: "
|
|
18999
|
-
loc:
|
|
19000
|
-
start: node.loc.start,
|
|
19001
|
-
end: {
|
|
19002
|
-
line: node.loc.end.line,
|
|
19003
|
-
// Only decorate the "var".
|
|
19004
|
-
column: node.loc.start.column + 3
|
|
19005
|
-
}
|
|
19006
|
-
}
|
|
19078
|
+
message: "Use the rest parameters instead of 'arguments'",
|
|
19079
|
+
loc: node.loc
|
|
19007
19080
|
});
|
|
19008
19081
|
}
|
|
19009
19082
|
},
|
|
19010
19083
|
|
|
19011
|
-
|
|
19084
|
+
beforeVisitUnknown(node) {
|
|
19012
19085
|
errors.push({
|
|
19013
19086
|
type: "SyntaxError",
|
|
19014
19087
|
message: "Unsupported syntax: `".concat(node.type, "`"),
|
|
19015
19088
|
loc: node.loc
|
|
19016
19089
|
});
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
__GlobalVariable(node) {
|
|
19020
|
-
if (node.name === "arguments") {
|
|
19021
|
-
errors.push({
|
|
19022
|
-
type: "SyntaxError",
|
|
19023
|
-
message: "Use the rest parameters instead of 'arguments'",
|
|
19024
|
-
loc: node.loc
|
|
19025
|
-
});
|
|
19026
|
-
}
|
|
19090
|
+
return true;
|
|
19027
19091
|
}
|
|
19028
19092
|
|
|
19029
19093
|
}
|
|
@@ -19033,49 +19097,6 @@
|
|
|
19033
19097
|
return errors;
|
|
19034
19098
|
}
|
|
19035
19099
|
|
|
19036
|
-
function parseAsEstreeExpression(source) {
|
|
19037
|
-
return parseExpression_1(source, {
|
|
19038
|
-
plugins: ["estree", ["pipelineOperator", {
|
|
19039
|
-
proposal: "minimal"
|
|
19040
|
-
}]],
|
|
19041
|
-
attachComment: false
|
|
19042
|
-
});
|
|
19043
|
-
}
|
|
19044
|
-
function parseAsEstree(source) {
|
|
19045
|
-
var {
|
|
19046
|
-
typescript
|
|
19047
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19048
|
-
var file = parse_1(source, {
|
|
19049
|
-
plugins: ["estree", typescript && "typescript"].filter(Boolean),
|
|
19050
|
-
strictMode: true,
|
|
19051
|
-
attachComment: false
|
|
19052
|
-
});
|
|
19053
|
-
var body = file.program.body;
|
|
19054
|
-
var jsNodes = typescript ? [] : body;
|
|
19055
|
-
|
|
19056
|
-
if (typescript) {
|
|
19057
|
-
for (var node of body) {
|
|
19058
|
-
if (node.type.startsWith("TS")) {
|
|
19059
|
-
if (/Enum|Import|Export/.test(node.type)) {
|
|
19060
|
-
throw new SyntaxError("Unsupported TypeScript syntax: ".concat(node.type));
|
|
19061
|
-
}
|
|
19062
|
-
} else {
|
|
19063
|
-
jsNodes.push(node);
|
|
19064
|
-
}
|
|
19065
|
-
}
|
|
19066
|
-
}
|
|
19067
|
-
|
|
19068
|
-
if (jsNodes.length === 0) {
|
|
19069
|
-
throw new SyntaxError("Function declaration not found");
|
|
19070
|
-
}
|
|
19071
|
-
|
|
19072
|
-
if (jsNodes.length > 1 || jsNodes[0].type !== "FunctionDeclaration") {
|
|
19073
|
-
throw new SyntaxError("Expect a single function declaration at top level, but received: ".concat(jsNodes.map(node => "\"".concat(node.type, "\"")).join(", ")));
|
|
19074
|
-
}
|
|
19075
|
-
|
|
19076
|
-
return jsNodes[0];
|
|
19077
|
-
}
|
|
19078
|
-
|
|
19079
19100
|
var _excluded = ["typescript"];
|
|
19080
19101
|
function precookFunction(source) {
|
|
19081
19102
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
@@ -19161,12 +19182,16 @@
|
|
|
19161
19182
|
if (typeof data === "string") {
|
|
19162
19183
|
if (data.includes(PROCESSORS) && isEvaluable(data)) {
|
|
19163
19184
|
preevaluate(data, {
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19185
|
+
withParent: true,
|
|
19186
|
+
hooks: {
|
|
19187
|
+
beforeVisitGlobal(node, parent) {
|
|
19188
|
+
if (node.name === PROCESSORS) {
|
|
19189
|
+
var memberParent = parent[parent.length - 1];
|
|
19190
|
+
var outerMemberParent = parent[parent.length - 2];
|
|
19191
|
+
|
|
19192
|
+
if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object" && !memberParent.node.computed && memberParent.node.property.type === "Identifier" && (outerMemberParent === null || outerMemberParent === void 0 ? void 0 : outerMemberParent.node.type) === "MemberExpression" && outerMemberParent.key === "object" && !outerMemberParent.node.computed && outerMemberParent.node.property.type === "Identifier") {
|
|
19193
|
+
collection.push("".concat(memberParent.node.property.name, ".").concat(outerMemberParent.node.property.name));
|
|
19194
|
+
}
|
|
19170
19195
|
}
|
|
19171
19196
|
}
|
|
19172
19197
|
|
|
@@ -19957,12 +19982,18 @@
|
|
|
19957
19982
|
if (typeof data === "string") {
|
|
19958
19983
|
if (data.includes(PERMISSIONS) && isEvaluable(data)) {
|
|
19959
19984
|
preevaluate(data, {
|
|
19960
|
-
|
|
19961
|
-
|
|
19962
|
-
|
|
19963
|
-
|
|
19964
|
-
|
|
19965
|
-
|
|
19985
|
+
withParent: true,
|
|
19986
|
+
hooks: {
|
|
19987
|
+
beforeVisitGlobal(node, parent) {
|
|
19988
|
+
if (node.name === PERMISSIONS) {
|
|
19989
|
+
var memberParent = parent[parent.length - 1];
|
|
19990
|
+
var callParent = parent[parent.length - 2];
|
|
19991
|
+
|
|
19992
|
+
if ((callParent === null || callParent === void 0 ? void 0 : callParent.node.type) === "CallExpression" && (callParent === null || callParent === void 0 ? void 0 : callParent.key) === "callee" && (memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object" && !memberParent.node.computed && memberParent.node.property.type === "Identifier" && memberParent.node.property.name === check) {
|
|
19993
|
+
for (var arg of callParent.node.arguments) {
|
|
19994
|
+
if (arg.type === "Literal" && typeof arg.value === "string") {
|
|
19995
|
+
collection.add(arg.value);
|
|
19996
|
+
}
|
|
19966
19997
|
}
|
|
19967
19998
|
}
|
|
19968
19999
|
}
|
|
@@ -20045,39 +20076,47 @@
|
|
|
20045
20076
|
|
|
20046
20077
|
var I18N = "I18N";
|
|
20047
20078
|
function scanI18NInStoryboard(storyboard) {
|
|
20048
|
-
|
|
20049
|
-
|
|
20079
|
+
var _storyboard$meta;
|
|
20080
|
+
|
|
20081
|
+
var collection = new Map();
|
|
20082
|
+
var beforeVisitGlobal = beforeVisitGlobalFactory(collection); // Notice: `menus` may contain evaluations of I18N too.
|
|
20083
|
+
|
|
20084
|
+
var {
|
|
20085
|
+
customTemplates,
|
|
20086
|
+
menus,
|
|
20087
|
+
functions
|
|
20088
|
+
} = (_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 ? _storyboard$meta : {};
|
|
20089
|
+
collectI18N([storyboard.routes, customTemplates, menus], beforeVisitGlobal);
|
|
20090
|
+
|
|
20091
|
+
if (Array.isArray(functions)) {
|
|
20092
|
+
for (var fn of functions) {
|
|
20093
|
+
precookFunction(fn.source, {
|
|
20094
|
+
typescript: fn.typescript,
|
|
20095
|
+
withParent: true,
|
|
20096
|
+
hooks: {
|
|
20097
|
+
beforeVisitGlobal
|
|
20098
|
+
}
|
|
20099
|
+
});
|
|
20100
|
+
}
|
|
20101
|
+
}
|
|
20102
|
+
|
|
20103
|
+
return collection;
|
|
20050
20104
|
}
|
|
20051
20105
|
function scanI18NInAny(data) {
|
|
20052
20106
|
var collection = new Map();
|
|
20053
|
-
collectI18N(data, collection);
|
|
20107
|
+
collectI18N(data, beforeVisitGlobalFactory(collection));
|
|
20054
20108
|
return collection;
|
|
20055
20109
|
}
|
|
20056
20110
|
|
|
20057
|
-
function collectI18N(data,
|
|
20111
|
+
function collectI18N(data, beforeVisitGlobal) {
|
|
20058
20112
|
var memo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new WeakSet();
|
|
20059
20113
|
|
|
20060
20114
|
if (typeof data === "string") {
|
|
20061
20115
|
if (data.includes(I18N) && isEvaluable(data)) {
|
|
20062
20116
|
preevaluate(data, {
|
|
20063
|
-
|
|
20064
|
-
|
|
20065
|
-
|
|
20066
|
-
|
|
20067
|
-
if (node.callee.type === "Identifier" && node.callee.name === I18N && keyNode && keyNode.type === "Literal" && typeof keyNode.value === "string") {
|
|
20068
|
-
var valueSet = collection.get(keyNode.value);
|
|
20069
|
-
|
|
20070
|
-
if (!valueSet) {
|
|
20071
|
-
valueSet = new Set();
|
|
20072
|
-
collection.set(keyNode.value, valueSet);
|
|
20073
|
-
}
|
|
20074
|
-
|
|
20075
|
-
if (defaultNode && defaultNode.type === "Literal" && typeof defaultNode.value === "string") {
|
|
20076
|
-
valueSet.add(defaultNode.value);
|
|
20077
|
-
}
|
|
20078
|
-
}
|
|
20079
|
-
}
|
|
20080
|
-
|
|
20117
|
+
withParent: true,
|
|
20118
|
+
hooks: {
|
|
20119
|
+
beforeVisitGlobal
|
|
20081
20120
|
}
|
|
20082
20121
|
});
|
|
20083
20122
|
}
|
|
@@ -20091,16 +20130,41 @@
|
|
|
20091
20130
|
|
|
20092
20131
|
if (Array.isArray(data)) {
|
|
20093
20132
|
for (var item of data) {
|
|
20094
|
-
collectI18N(item,
|
|
20133
|
+
collectI18N(item, beforeVisitGlobal, memo);
|
|
20095
20134
|
}
|
|
20096
20135
|
} else {
|
|
20097
20136
|
for (var _item of Object.values(data)) {
|
|
20098
|
-
collectI18N(_item,
|
|
20137
|
+
collectI18N(_item, beforeVisitGlobal, memo);
|
|
20099
20138
|
}
|
|
20100
20139
|
}
|
|
20101
20140
|
}
|
|
20102
20141
|
}
|
|
20103
20142
|
|
|
20143
|
+
function beforeVisitGlobalFactory(collection) {
|
|
20144
|
+
return function beforeVisitGlobal(node, parent) {
|
|
20145
|
+
if (node.name === I18N) {
|
|
20146
|
+
var callParent = parent[parent.length - 1];
|
|
20147
|
+
|
|
20148
|
+
if ((callParent === null || callParent === void 0 ? void 0 : callParent.node.type) === "CallExpression" && callParent.key === "callee") {
|
|
20149
|
+
var [keyNode, defaultNode] = callParent.node.arguments;
|
|
20150
|
+
|
|
20151
|
+
if (keyNode && keyNode.type === "Literal" && typeof keyNode.value === "string") {
|
|
20152
|
+
var valueSet = collection.get(keyNode.value);
|
|
20153
|
+
|
|
20154
|
+
if (!valueSet) {
|
|
20155
|
+
valueSet = new Set();
|
|
20156
|
+
collection.set(keyNode.value, valueSet);
|
|
20157
|
+
}
|
|
20158
|
+
|
|
20159
|
+
if (defaultNode && defaultNode.type === "Literal" && typeof defaultNode.value === "string") {
|
|
20160
|
+
valueSet.add(defaultNode.value);
|
|
20161
|
+
}
|
|
20162
|
+
}
|
|
20163
|
+
}
|
|
20164
|
+
}
|
|
20165
|
+
};
|
|
20166
|
+
}
|
|
20167
|
+
|
|
20104
20168
|
var LexicalStatus;
|
|
20105
20169
|
|
|
20106
20170
|
(function (LexicalStatus) {
|
|
@@ -20771,23 +20835,35 @@
|
|
|
20771
20835
|
|
|
20772
20836
|
return depsMap;
|
|
20773
20837
|
}
|
|
20774
|
-
var CTX = "CTX";
|
|
20838
|
+
var CTX$1 = "CTX";
|
|
20775
20839
|
|
|
20776
20840
|
function collectContexts(data, stats) {
|
|
20777
20841
|
var memo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new WeakSet();
|
|
20778
20842
|
|
|
20779
20843
|
if (typeof data === "string") {
|
|
20780
|
-
if (data.includes(CTX) && isEvaluable(data)) {
|
|
20844
|
+
if (data.includes(CTX$1) && isEvaluable(data)) {
|
|
20781
20845
|
preevaluate(data, {
|
|
20782
|
-
|
|
20783
|
-
|
|
20784
|
-
|
|
20785
|
-
|
|
20786
|
-
|
|
20787
|
-
|
|
20846
|
+
withParent: true,
|
|
20847
|
+
hooks: {
|
|
20848
|
+
beforeVisitGlobal(node, parent) {
|
|
20849
|
+
if (node.name === CTX$1) {
|
|
20850
|
+
var memberParent = parent[parent.length - 1];
|
|
20851
|
+
|
|
20852
|
+
if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object") {
|
|
20853
|
+
var memberNode = memberParent.node;
|
|
20854
|
+
var dep;
|
|
20855
|
+
|
|
20856
|
+
if (!memberNode.computed && memberNode.property.type === "Identifier") {
|
|
20857
|
+
dep = memberNode.property.name;
|
|
20858
|
+
} else if (memberNode.computed && memberNode.property.type === "Literal" && typeof memberNode.property.value === "string") {
|
|
20859
|
+
dep = memberNode.property.value;
|
|
20860
|
+
} else {
|
|
20861
|
+
stats.includesComputed = true;
|
|
20862
|
+
}
|
|
20863
|
+
|
|
20864
|
+
if (dep !== undefined && !stats.dependencies.includes(dep)) {
|
|
20865
|
+
stats.dependencies.push(dep);
|
|
20788
20866
|
}
|
|
20789
|
-
} else {
|
|
20790
|
-
stats.includesComputed = true;
|
|
20791
20867
|
}
|
|
20792
20868
|
}
|
|
20793
20869
|
}
|
|
@@ -21085,6 +21161,7 @@
|
|
|
21085
21161
|
}
|
|
21086
21162
|
|
|
21087
21163
|
var TRACK_CONTEXT = "track context";
|
|
21164
|
+
var CTX = "CTX";
|
|
21088
21165
|
/**
|
|
21089
21166
|
* Get tracking CTX for an evaluable expression in `track context` mode.
|
|
21090
21167
|
*
|
|
@@ -21118,13 +21195,20 @@
|
|
|
21118
21195
|
var {
|
|
21119
21196
|
expression
|
|
21120
21197
|
} = preevaluate(raw, {
|
|
21121
|
-
|
|
21122
|
-
|
|
21123
|
-
|
|
21124
|
-
|
|
21125
|
-
|
|
21126
|
-
|
|
21127
|
-
|
|
21198
|
+
withParent: true,
|
|
21199
|
+
hooks: {
|
|
21200
|
+
beforeVisitGlobal(node, parent) {
|
|
21201
|
+
if (node.name === CTX) {
|
|
21202
|
+
var memberParent = parent[parent.length - 1];
|
|
21203
|
+
|
|
21204
|
+
if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object") {
|
|
21205
|
+
var memberNode = memberParent.node;
|
|
21206
|
+
|
|
21207
|
+
if (!memberNode.computed && memberNode.property.type === "Identifier") {
|
|
21208
|
+
contexts.add(memberNode.property.name);
|
|
21209
|
+
} else if (memberNode.computed && memberNode.property.type === "Literal" && typeof memberNode.property.value === "string") {
|
|
21210
|
+
contexts.add(memberNode.property.value);
|
|
21211
|
+
}
|
|
21128
21212
|
}
|
|
21129
21213
|
}
|
|
21130
21214
|
}
|
|
@@ -21181,6 +21265,8 @@
|
|
|
21181
21265
|
exports.matchPath = matchPath;
|
|
21182
21266
|
exports.normalizeBuilderNode = normalizeBuilderNode;
|
|
21183
21267
|
exports.normalizeMenu = normalizeMenu;
|
|
21268
|
+
exports.parseForAnalysis = parseForAnalysis;
|
|
21269
|
+
exports.precook = precook;
|
|
21184
21270
|
exports.precookFunction = precookFunction;
|
|
21185
21271
|
exports.preevaluate = preevaluate;
|
|
21186
21272
|
exports.prefetchScript = prefetchScript;
|
|
@@ -21202,6 +21288,7 @@
|
|
|
21202
21288
|
exports.shouldAllowRecursiveEvaluations = shouldAllowRecursiveEvaluations;
|
|
21203
21289
|
exports.smartDisplayForEvaluableString = smartDisplayForEvaluableString;
|
|
21204
21290
|
exports.toPath = toPath;
|
|
21291
|
+
exports.tokTypes = tokTypes_1;
|
|
21205
21292
|
exports.trackContext = trackContext;
|
|
21206
21293
|
exports.transform = transform;
|
|
21207
21294
|
exports.transformAndInject = transformAndInject;
|