@next-core/brick-utils 2.52.1 → 2.52.3
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/index.bundle.js +41 -19
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +41 -19
- package/dist/index.esm.js.map +1 -1
- package/dist/types/visitStoryboard.d.ts +4 -1
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -2124,8 +2124,8 @@ function cook(rootAst, codeSource) {
|
|
|
2124
2124
|
}
|
|
2125
2125
|
|
|
2126
2126
|
// https://tc39.es/ecma262/#sec-runtime-semantics-instantiatefunctionobject
|
|
2127
|
-
function InstantiateFunctionObject(func, scope) {
|
|
2128
|
-
return OrdinaryFunctionCreate(func, scope, true);
|
|
2127
|
+
function InstantiateFunctionObject(func, scope, isRoot) {
|
|
2128
|
+
return OrdinaryFunctionCreate(func, scope, true, isRoot);
|
|
2129
2129
|
}
|
|
2130
2130
|
|
|
2131
2131
|
// https://tc39.es/ecma262/#sec-runtime-semantics-instantiateordinaryfunctionexpression
|
|
@@ -2152,10 +2152,19 @@ function cook(rootAst, codeSource) {
|
|
|
2152
2152
|
}
|
|
2153
2153
|
|
|
2154
2154
|
// https://tc39.es/ecma262/#sec-ordinaryfunctioncreate
|
|
2155
|
-
function OrdinaryFunctionCreate(sourceNode, scope, isConstructor) {
|
|
2155
|
+
function OrdinaryFunctionCreate(sourceNode, scope, isConstructor, isRoot) {
|
|
2156
2156
|
var F = function () {
|
|
2157
|
+
var perf = isRoot && hooks.perfCall;
|
|
2158
|
+
var start;
|
|
2159
|
+
if (perf) {
|
|
2160
|
+
start = performance.now();
|
|
2161
|
+
}
|
|
2157
2162
|
// eslint-disable-next-line prefer-rest-params
|
|
2158
|
-
|
|
2163
|
+
var result = CallFunction(F, arguments);
|
|
2164
|
+
if (perf) {
|
|
2165
|
+
perf(performance.now() - start);
|
|
2166
|
+
}
|
|
2167
|
+
return result;
|
|
2159
2168
|
};
|
|
2160
2169
|
Object.defineProperties(F, {
|
|
2161
2170
|
[SourceNode]: {
|
|
@@ -2371,7 +2380,7 @@ function cook(rootAst, codeSource) {
|
|
|
2371
2380
|
var [fn] = collectBoundNames(rootAst);
|
|
2372
2381
|
// Create an immutable binding for the root function.
|
|
2373
2382
|
rootEnv.CreateImmutableBinding(fn, true);
|
|
2374
|
-
var fo = InstantiateFunctionObject(rootAst, rootEnv);
|
|
2383
|
+
var fo = InstantiateFunctionObject(rootAst, rootEnv, true);
|
|
2375
2384
|
rootEnv.InitializeBinding(fn, fo);
|
|
2376
2385
|
return fo;
|
|
2377
2386
|
}
|
|
@@ -17532,9 +17541,12 @@ function isObject$1(value) {
|
|
|
17532
17541
|
return value != null && (type == "object" || type == "function");
|
|
17533
17542
|
}
|
|
17534
17543
|
|
|
17535
|
-
function visitStoryboardFunctions(functions, beforeVisitGlobal) {
|
|
17544
|
+
function visitStoryboardFunctions(functions, beforeVisitGlobal, options) {
|
|
17536
17545
|
if (Array.isArray(functions)) {
|
|
17537
17546
|
for (var fn of functions) {
|
|
17547
|
+
if (options !== null && options !== void 0 && options.matchSource && !options.matchSource(fn.source)) {
|
|
17548
|
+
continue;
|
|
17549
|
+
}
|
|
17538
17550
|
try {
|
|
17539
17551
|
precookFunction(fn.source, {
|
|
17540
17552
|
typescript: fn.typescript,
|
|
@@ -18928,7 +18940,9 @@ function scanPermissionActionsInStoryboard(storyboard) {
|
|
|
18928
18940
|
functions
|
|
18929
18941
|
} = (_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 ? _storyboard$meta : {};
|
|
18930
18942
|
visitStoryboardExpressions([storyboard.routes, customTemplates], beforeVisitPermissions, PERMISSIONS);
|
|
18931
|
-
visitStoryboardFunctions(functions, beforeVisitPermissions
|
|
18943
|
+
visitStoryboardFunctions(functions, beforeVisitPermissions, {
|
|
18944
|
+
matchSource: source => source.includes(PERMISSIONS)
|
|
18945
|
+
});
|
|
18932
18946
|
return Array.from(collection);
|
|
18933
18947
|
}
|
|
18934
18948
|
function scanPermissionActionsInAny(data) {
|
|
@@ -19017,30 +19031,36 @@ function beforeVisitI18nFactory(collection) {
|
|
|
19017
19031
|
}
|
|
19018
19032
|
|
|
19019
19033
|
var APP = "APP";
|
|
19020
|
-
var
|
|
19034
|
+
var GET_MENU = "getMenu";
|
|
19021
19035
|
function scanAppGetMenuInStoryboard(storyboard) {
|
|
19022
19036
|
var _storyboard$meta;
|
|
19023
19037
|
var collection = new Set();
|
|
19024
|
-
var
|
|
19038
|
+
var beforeVisitApp = beforeVisitAppFactory(collection);
|
|
19025
19039
|
var {
|
|
19026
|
-
customTemplates
|
|
19027
|
-
functions
|
|
19040
|
+
customTemplates
|
|
19028
19041
|
} = (_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 ? _storyboard$meta : {};
|
|
19029
|
-
visitStoryboardExpressions([storyboard.routes, customTemplates],
|
|
19030
|
-
|
|
19042
|
+
visitStoryboardExpressions([storyboard.routes, customTemplates], beforeVisitApp, {
|
|
19043
|
+
matchExpressionString: matchAppGetMenu
|
|
19044
|
+
});
|
|
19045
|
+
// `APP` is not available in storyboard functions
|
|
19031
19046
|
return Array.from(collection);
|
|
19032
19047
|
}
|
|
19033
19048
|
function scanAppGetMenuInAny(data) {
|
|
19034
19049
|
var collection = new Set();
|
|
19035
|
-
visitStoryboardExpressions(data, beforeVisitAppFactory(collection),
|
|
19050
|
+
visitStoryboardExpressions(data, beforeVisitAppFactory(collection), {
|
|
19051
|
+
matchExpressionString: matchAppGetMenu
|
|
19052
|
+
});
|
|
19036
19053
|
return Array.from(collection);
|
|
19037
19054
|
}
|
|
19055
|
+
function matchAppGetMenu(source) {
|
|
19056
|
+
return source.includes(APP) && source.includes(GET_MENU);
|
|
19057
|
+
}
|
|
19038
19058
|
function beforeVisitAppFactory(collection) {
|
|
19039
19059
|
return function beforeVisitAPP(node, parent) {
|
|
19040
19060
|
if (node.name === APP) {
|
|
19041
19061
|
var memberParent = parent[parent.length - 1];
|
|
19042
19062
|
var callParent = parent[parent.length - 2];
|
|
19043
|
-
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 ===
|
|
19063
|
+
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 === GET_MENU) {
|
|
19044
19064
|
if (callParent.node.arguments.length === 1) {
|
|
19045
19065
|
var menuId = callParent.node.arguments[0];
|
|
19046
19066
|
if (menuId.type === "Literal" && typeof menuId.value === "string") {
|
|
@@ -19548,6 +19568,8 @@ var {
|
|
|
19548
19568
|
convertUnitValueByPrecision: convertValueByPrecision
|
|
19549
19569
|
} = utils;
|
|
19550
19570
|
|
|
19571
|
+
var TRACK_NAMES = ["CTX", "STATE", "FORM_STATE"];
|
|
19572
|
+
|
|
19551
19573
|
/**
|
|
19552
19574
|
* Get tracking CTX for an evaluable expression in `track context` mode.
|
|
19553
19575
|
*
|
|
@@ -19621,7 +19643,8 @@ function track(raw, trackText, variableName) {
|
|
|
19621
19643
|
return false;
|
|
19622
19644
|
}
|
|
19623
19645
|
function trackAll(raw) {
|
|
19624
|
-
if
|
|
19646
|
+
// Do not pre-evaluate a string if it doesn't include track names.
|
|
19647
|
+
if (TRACK_NAMES.some(name => raw.includes(name))) {
|
|
19625
19648
|
var usage = {
|
|
19626
19649
|
usedContexts: [],
|
|
19627
19650
|
includesComputed: false
|
|
@@ -19629,7 +19652,7 @@ function trackAll(raw) {
|
|
|
19629
19652
|
preevaluate(raw, {
|
|
19630
19653
|
withParent: true,
|
|
19631
19654
|
hooks: {
|
|
19632
|
-
beforeVisitGlobal: beforeVisitContextFactory(usage,
|
|
19655
|
+
beforeVisitGlobal: beforeVisitContextFactory(usage, TRACK_NAMES, true)
|
|
19633
19656
|
}
|
|
19634
19657
|
});
|
|
19635
19658
|
if (usage.usedContexts.length > 0) {
|
|
@@ -20202,11 +20225,10 @@ function scanInstalledAppsInStoryboard(storyboard) {
|
|
|
20202
20225
|
var beforeVisitInstalledApps = beforeVisitInstalledAppsFactory(collection);
|
|
20203
20226
|
var {
|
|
20204
20227
|
customTemplates,
|
|
20205
|
-
functions,
|
|
20206
20228
|
menus
|
|
20207
20229
|
} = (_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 ? _storyboard$meta : {};
|
|
20208
20230
|
visitStoryboardExpressions([storyboard.routes, customTemplates, menus], beforeVisitInstalledApps, INSTALLED_APPS);
|
|
20209
|
-
|
|
20231
|
+
// `INSTALLED_APPS` is not available in storyboard functions
|
|
20210
20232
|
return Array.from(collection);
|
|
20211
20233
|
}
|
|
20212
20234
|
function beforeVisitInstalledAppsFactory(collection) {
|