@next-core/brick-utils 2.30.2 → 2.30.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/CHANGELOG.md +8 -0
- package/dist/index.bundle.js +73 -54
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +71 -55
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -18386,7 +18386,72 @@ function getParserClass(pluginsFromOptions) {
|
|
|
18386
18386
|
|
|
18387
18387
|
var parse_1 = lib.parse = parse$1;
|
|
18388
18388
|
var parseExpression_1 = lib.parseExpression = parseExpression;
|
|
18389
|
-
lib.tokTypes = tokTypes;
|
|
18389
|
+
var tokTypes_1 = lib.tokTypes = tokTypes;
|
|
18390
|
+
|
|
18391
|
+
function parseAsEstreeExpression(source) {
|
|
18392
|
+
return parseExpression_1(source, {
|
|
18393
|
+
plugins: ["estree", ["pipelineOperator", {
|
|
18394
|
+
proposal: "minimal"
|
|
18395
|
+
}]],
|
|
18396
|
+
attachComment: false
|
|
18397
|
+
});
|
|
18398
|
+
}
|
|
18399
|
+
function parseAsEstree(source) {
|
|
18400
|
+
var {
|
|
18401
|
+
typescript
|
|
18402
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18403
|
+
var file = parse_1(source, {
|
|
18404
|
+
plugins: ["estree", typescript && "typescript"].filter(Boolean),
|
|
18405
|
+
strictMode: true,
|
|
18406
|
+
attachComment: false
|
|
18407
|
+
});
|
|
18408
|
+
var body = file.program.body;
|
|
18409
|
+
var jsNodes = typescript ? [] : body;
|
|
18410
|
+
|
|
18411
|
+
if (typescript) {
|
|
18412
|
+
for (var node of body) {
|
|
18413
|
+
if (node.type.startsWith("TS")) {
|
|
18414
|
+
if (/Enum|Import|Export/.test(node.type)) {
|
|
18415
|
+
throw new SyntaxError("Unsupported TypeScript syntax: ".concat(node.type));
|
|
18416
|
+
}
|
|
18417
|
+
} else {
|
|
18418
|
+
jsNodes.push(node);
|
|
18419
|
+
}
|
|
18420
|
+
}
|
|
18421
|
+
}
|
|
18422
|
+
|
|
18423
|
+
if (jsNodes.length === 0) {
|
|
18424
|
+
throw new SyntaxError("Function declaration not found");
|
|
18425
|
+
}
|
|
18426
|
+
|
|
18427
|
+
if (jsNodes.length > 1 || jsNodes[0].type !== "FunctionDeclaration") {
|
|
18428
|
+
throw new SyntaxError("Expect a single function declaration at top level, but received: ".concat(jsNodes.map(node => "\"".concat(node.type, "\"")).join(", ")));
|
|
18429
|
+
}
|
|
18430
|
+
|
|
18431
|
+
return jsNodes[0];
|
|
18432
|
+
}
|
|
18433
|
+
/** For next-core internal or devtools usage only. */
|
|
18434
|
+
|
|
18435
|
+
function parseForAnalysis(source) {
|
|
18436
|
+
var {
|
|
18437
|
+
typescript,
|
|
18438
|
+
tokens
|
|
18439
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18440
|
+
|
|
18441
|
+
try {
|
|
18442
|
+
return parse_1(source, {
|
|
18443
|
+
plugins: ["estree", typescript && "typescript"].filter(Boolean),
|
|
18444
|
+
strictMode: true,
|
|
18445
|
+
attachComment: false,
|
|
18446
|
+
// Allow export/import declarations to make analyser handle errors.
|
|
18447
|
+
sourceType: "unambiguous",
|
|
18448
|
+
tokens
|
|
18449
|
+
});
|
|
18450
|
+
} catch (e) {
|
|
18451
|
+
// Return no errors if parse failed.
|
|
18452
|
+
return null;
|
|
18453
|
+
}
|
|
18454
|
+
}
|
|
18390
18455
|
|
|
18391
18456
|
function hasOwnProperty(object, property) {
|
|
18392
18457
|
return Object.prototype.hasOwnProperty.call(object, property);
|
|
@@ -18866,17 +18931,11 @@ function lint(source) {
|
|
|
18866
18931
|
rules
|
|
18867
18932
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18868
18933
|
var errors = [];
|
|
18869
|
-
var file
|
|
18934
|
+
var file = typeof source === "string" ? parseForAnalysis(source, {
|
|
18935
|
+
typescript
|
|
18936
|
+
}) : source;
|
|
18870
18937
|
|
|
18871
|
-
|
|
18872
|
-
file = parse_1(source, {
|
|
18873
|
-
plugins: ["estree", typescript && "typescript"].filter(Boolean),
|
|
18874
|
-
strictMode: true,
|
|
18875
|
-
attachComment: false,
|
|
18876
|
-
// Allow export/import declarations to make linter handle errors.
|
|
18877
|
-
sourceType: "unambiguous"
|
|
18878
|
-
});
|
|
18879
|
-
} catch (e) {
|
|
18938
|
+
if (!file) {
|
|
18880
18939
|
// Return no errors if parse failed.
|
|
18881
18940
|
return errors;
|
|
18882
18941
|
}
|
|
@@ -19028,49 +19087,6 @@ function lint(source) {
|
|
|
19028
19087
|
return errors;
|
|
19029
19088
|
}
|
|
19030
19089
|
|
|
19031
|
-
function parseAsEstreeExpression(source) {
|
|
19032
|
-
return parseExpression_1(source, {
|
|
19033
|
-
plugins: ["estree", ["pipelineOperator", {
|
|
19034
|
-
proposal: "minimal"
|
|
19035
|
-
}]],
|
|
19036
|
-
attachComment: false
|
|
19037
|
-
});
|
|
19038
|
-
}
|
|
19039
|
-
function parseAsEstree(source) {
|
|
19040
|
-
var {
|
|
19041
|
-
typescript
|
|
19042
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19043
|
-
var file = parse_1(source, {
|
|
19044
|
-
plugins: ["estree", typescript && "typescript"].filter(Boolean),
|
|
19045
|
-
strictMode: true,
|
|
19046
|
-
attachComment: false
|
|
19047
|
-
});
|
|
19048
|
-
var body = file.program.body;
|
|
19049
|
-
var jsNodes = typescript ? [] : body;
|
|
19050
|
-
|
|
19051
|
-
if (typescript) {
|
|
19052
|
-
for (var node of body) {
|
|
19053
|
-
if (node.type.startsWith("TS")) {
|
|
19054
|
-
if (/Enum|Import|Export/.test(node.type)) {
|
|
19055
|
-
throw new SyntaxError("Unsupported TypeScript syntax: ".concat(node.type));
|
|
19056
|
-
}
|
|
19057
|
-
} else {
|
|
19058
|
-
jsNodes.push(node);
|
|
19059
|
-
}
|
|
19060
|
-
}
|
|
19061
|
-
}
|
|
19062
|
-
|
|
19063
|
-
if (jsNodes.length === 0) {
|
|
19064
|
-
throw new SyntaxError("Function declaration not found");
|
|
19065
|
-
}
|
|
19066
|
-
|
|
19067
|
-
if (jsNodes.length > 1 || jsNodes[0].type !== "FunctionDeclaration") {
|
|
19068
|
-
throw new SyntaxError("Expect a single function declaration at top level, but received: ".concat(jsNodes.map(node => "\"".concat(node.type, "\"")).join(", ")));
|
|
19069
|
-
}
|
|
19070
|
-
|
|
19071
|
-
return jsNodes[0];
|
|
19072
|
-
}
|
|
19073
|
-
|
|
19074
19090
|
var _excluded = ["typescript"];
|
|
19075
19091
|
function precookFunction(source) {
|
|
19076
19092
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
@@ -21141,5 +21157,5 @@ function trackContext(raw) {
|
|
|
21141
21157
|
return false;
|
|
21142
21158
|
}
|
|
21143
21159
|
|
|
21144
|
-
export { JsonStorage, PrecookFunctionVisitor, PrecookVisitor, asyncProcessBrick, asyncProcessStoryboard, computeRealRoutePath, convertValueByPrecision, cook, createProviderClass, deepFreeze, formatValue, getDependencyMapOfContext, getDepsOfTemplates, getDllAndDepsByResource, getDllAndDepsOfBricks, getDllAndDepsOfStoryboard, getTemplateDepsOfStoryboard, hasOwnProperty$1 as hasOwnProperty, inject, isBrickNode, isCustomTemplateNode, isEvaluable, isObject, isRouteNode, isSnippetNode, lint, loadScript, mapCustomApisToNameAndNamespace, matchPath, normalizeBuilderNode, normalizeMenu, precookFunction, preevaluate, prefetchScript, resolveContextConcurrently, restoreDynamicTemplates, scanBricksInBrickConf, scanBricksInStoryboard, scanCustomApisInStoryboard, scanI18NInAny, scanI18NInStoryboard, scanPermissionActionsInAny, scanPermissionActionsInStoryboard, scanProcessorsInAny, scanProcessorsInStoryboard, scanRouteAliasInStoryboard, scanStoryboard, scanTemplatesInBrick, scanTemplatesInStoryboard, shouldAllowRecursiveEvaluations, smartDisplayForEvaluableString, toPath, trackContext, transform, transformAndInject };
|
|
21160
|
+
export { JsonStorage, PrecookFunctionVisitor, PrecookVisitor, asyncProcessBrick, asyncProcessStoryboard, computeRealRoutePath, convertValueByPrecision, cook, createProviderClass, deepFreeze, formatValue, getDependencyMapOfContext, getDepsOfTemplates, getDllAndDepsByResource, getDllAndDepsOfBricks, getDllAndDepsOfStoryboard, getTemplateDepsOfStoryboard, hasOwnProperty$1 as hasOwnProperty, inject, isBrickNode, isCustomTemplateNode, isEvaluable, isObject, isRouteNode, isSnippetNode, lint, loadScript, mapCustomApisToNameAndNamespace, matchPath, normalizeBuilderNode, normalizeMenu, parseForAnalysis, precook, precookFunction, preevaluate, prefetchScript, resolveContextConcurrently, restoreDynamicTemplates, scanBricksInBrickConf, scanBricksInStoryboard, scanCustomApisInStoryboard, scanI18NInAny, scanI18NInStoryboard, scanPermissionActionsInAny, scanPermissionActionsInStoryboard, scanProcessorsInAny, scanProcessorsInStoryboard, scanRouteAliasInStoryboard, scanStoryboard, scanTemplatesInBrick, scanTemplatesInStoryboard, shouldAllowRecursiveEvaluations, smartDisplayForEvaluableString, toPath, tokTypes_1 as tokTypes, trackContext, transform, transformAndInject };
|
|
21145
21161
|
//# sourceMappingURL=index.esm.js.map
|