@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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.30.3](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.30.2...@next-core/brick-utils@2.30.3) (2021-11-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @next-core/brick-utils
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.30.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.30.1...@next-core/brick-utils@2.30.2) (2021-11-23)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @next-core/brick-utils
|
package/dist/index.bundle.js
CHANGED
|
@@ -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);
|
|
@@ -18871,17 +18936,11 @@
|
|
|
18871
18936
|
rules
|
|
18872
18937
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18873
18938
|
var errors = [];
|
|
18874
|
-
var file
|
|
18939
|
+
var file = typeof source === "string" ? parseForAnalysis(source, {
|
|
18940
|
+
typescript
|
|
18941
|
+
}) : source;
|
|
18875
18942
|
|
|
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) {
|
|
18943
|
+
if (!file) {
|
|
18885
18944
|
// Return no errors if parse failed.
|
|
18886
18945
|
return errors;
|
|
18887
18946
|
}
|
|
@@ -19033,49 +19092,6 @@
|
|
|
19033
19092
|
return errors;
|
|
19034
19093
|
}
|
|
19035
19094
|
|
|
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
19095
|
var _excluded = ["typescript"];
|
|
19080
19096
|
function precookFunction(source) {
|
|
19081
19097
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
@@ -21181,6 +21197,8 @@
|
|
|
21181
21197
|
exports.matchPath = matchPath;
|
|
21182
21198
|
exports.normalizeBuilderNode = normalizeBuilderNode;
|
|
21183
21199
|
exports.normalizeMenu = normalizeMenu;
|
|
21200
|
+
exports.parseForAnalysis = parseForAnalysis;
|
|
21201
|
+
exports.precook = precook;
|
|
21184
21202
|
exports.precookFunction = precookFunction;
|
|
21185
21203
|
exports.preevaluate = preevaluate;
|
|
21186
21204
|
exports.prefetchScript = prefetchScript;
|
|
@@ -21202,6 +21220,7 @@
|
|
|
21202
21220
|
exports.shouldAllowRecursiveEvaluations = shouldAllowRecursiveEvaluations;
|
|
21203
21221
|
exports.smartDisplayForEvaluableString = smartDisplayForEvaluableString;
|
|
21204
21222
|
exports.toPath = toPath;
|
|
21223
|
+
exports.tokTypes = tokTypes_1;
|
|
21205
21224
|
exports.trackContext = trackContext;
|
|
21206
21225
|
exports.transform = transform;
|
|
21207
21226
|
exports.transformAndInject = transformAndInject;
|