@next-core/brick-utils 2.51.0 → 2.51.2
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.esm.js
CHANGED
|
@@ -18259,10 +18259,21 @@ function getDllAndDepsByResource(_ref, brickPackages) {
|
|
|
18259
18259
|
var v3Processors = new Set();
|
|
18260
18260
|
if ((bricks === null || bricks === void 0 ? void 0 : bricks.length) > 0 || (processors === null || processors === void 0 ? void 0 : processors.length) > 0 || (editorBricks === null || editorBricks === void 0 ? void 0 : editorBricks.length) > 0) {
|
|
18261
18261
|
var brickMap = getBrickToPackageMap(brickPackages);
|
|
18262
|
+
var v3DefinedBricks = new Set();
|
|
18263
|
+
for (var pkg of brickPackages) {
|
|
18264
|
+
var {
|
|
18265
|
+
id,
|
|
18266
|
+
elements
|
|
18267
|
+
} = pkg;
|
|
18268
|
+
if (id && elements !== null && elements !== void 0 && elements.length) {
|
|
18269
|
+
for (var element of elements) {
|
|
18270
|
+
v3DefinedBricks.add(element);
|
|
18271
|
+
}
|
|
18272
|
+
}
|
|
18273
|
+
}
|
|
18262
18274
|
[...(bricks !== null && bricks !== void 0 ? bricks : []).map(n => [n]), ...(processors !== null && processors !== void 0 ? processors : []).map(n => [n, true])].forEach(_ref2 => {
|
|
18263
18275
|
var [name, isProcessor] = _ref2;
|
|
18264
18276
|
// ignore custom template
|
|
18265
|
-
// istanbul ignore else
|
|
18266
18277
|
if (name.includes(".")) {
|
|
18267
18278
|
var namespace = name.split(".")[0];
|
|
18268
18279
|
// processor 是 camelCase 格式,转成 brick 的 param-case 格式,统一去判断
|
|
@@ -18285,6 +18296,8 @@ function getDllAndDepsByResource(_ref, brickPackages) {
|
|
|
18285
18296
|
// eslint-disable-next-line no-console
|
|
18286
18297
|
console.error("".concat(isProcessor ? "Processor" : "Brick", " `").concat(name, "` does not match any brick package"));
|
|
18287
18298
|
}
|
|
18299
|
+
} else if (!name.startsWith("tpl-") && v3DefinedBricks.has(name)) {
|
|
18300
|
+
v3Bricks.add(name);
|
|
18288
18301
|
}
|
|
18289
18302
|
});
|
|
18290
18303
|
editorBricks === null || editorBricks === void 0 ? void 0 : editorBricks.forEach(editor => {
|
|
@@ -20012,11 +20025,12 @@ var jsonFieldsInBrick = ["properties", "events", "lifeCycle", "params", "if", "t
|
|
|
20012
20025
|
var yamlFieldsInBrick = ["permissionsPreCheck", "transformFrom"];
|
|
20013
20026
|
|
|
20014
20027
|
// Fields started with `_` will be removed by default.
|
|
20015
|
-
var fieldsToRemoveInRoute = ["appId", "children", "creator", "ctime", "id", "graphInfo", "modifier", "mountPoint", "mtime", "org", "parent", "sort", "name", "providersBak", "providers_bak", "previewSettings", "screenshot", "deleteAuthorizers", "readAuthorizers", "updateAuthorizers"];
|
|
20028
|
+
var fieldsToRemoveInRoute = ["appId", "children", "creator", "ctime", "id", "graphInfo", "modifier", "mountPoint", "mtime", "org", "parent", "sort", "name", "providersBak", "providers_bak", "previewSettings", "screenshot", "lock", "deleteAuthorizers", "readAuthorizers", "updateAuthorizers"];
|
|
20016
20029
|
var fieldsToRemoveInBrick = fieldsToRemoveInRoute.concat("type", "alias");
|
|
20017
20030
|
|
|
20018
20031
|
// Those fields can be disposed if value is null.
|
|
20019
|
-
var disposableNullFields = ["alias", "documentId", "
|
|
20032
|
+
var disposableNullFields = ["alias", "documentId", "context", "exports", "ref", "analyticsData"];
|
|
20033
|
+
var disposableFalseOrNullFields = ["hybrid", "bg", "portal", "public", "exact"];
|
|
20020
20034
|
function normalizeBuilderNode(node) {
|
|
20021
20035
|
if (isBrickNode(node)) {
|
|
20022
20036
|
return normalize(node, fieldsToRemoveInBrick, jsonFieldsInBrick, yamlFieldsInBrick, "brick");
|
|
@@ -20032,7 +20046,7 @@ function normalize(node, fieldsToRemove, jsonFields, yamlFields, type) {
|
|
|
20032
20046
|
// Consider fields started with `_` as unused.
|
|
20033
20047
|
.filter(_ref => {
|
|
20034
20048
|
var [key, value] = _ref;
|
|
20035
|
-
return !(key[0] === "_" || fieldsToRemove.includes(key) || value === null && disposableNullFields.includes(key));
|
|
20049
|
+
return !(key[0] === "_" || fieldsToRemove.includes(key) || (value === false || value === null) && disposableFalseOrNullFields.includes(key) || value === null && disposableNullFields.includes(key) || value === true && key === "injectDeep");
|
|
20036
20050
|
})
|
|
20037
20051
|
// Parse specific fields.
|
|
20038
20052
|
.map(_ref2 => {
|
|
@@ -20346,7 +20360,7 @@ function removeDeadConditionsInTpl(tplConstructor, options) {
|
|
|
20346
20360
|
}
|
|
20347
20361
|
function computeConstantCondition(ifContainer) {
|
|
20348
20362
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20349
|
-
if (hasOwnProperty$1(ifContainer, "if")) {
|
|
20363
|
+
if (hasOwnProperty$1(ifContainer, "if") && ifContainer.if !== undefined) {
|
|
20350
20364
|
if (typeof ifContainer.if === "string" && isEvaluable(ifContainer.if)) {
|
|
20351
20365
|
try {
|
|
20352
20366
|
var {
|