@next-core/brick-utils 2.50.4 → 2.51.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/dist/index.bundle.js +38 -2
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +38 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/types/scanStoryboard.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -17684,7 +17684,7 @@ function parseBrick(brick, options) {
|
|
|
17684
17684
|
}, parseBrickProperties(brick.properties)), {}, {
|
|
17685
17685
|
context: parseContext(brick.context)
|
|
17686
17686
|
})), {}, {
|
|
17687
|
-
children: parseSlots(brick.slots, options)
|
|
17687
|
+
children: parseSlots(childrenToSlots(brick.children, brick.slots), options)
|
|
17688
17688
|
});
|
|
17689
17689
|
}
|
|
17690
17690
|
function parseCondition(condition) {
|
|
@@ -17792,6 +17792,29 @@ function parseLifeCycles(lifeCycle) {
|
|
|
17792
17792
|
});
|
|
17793
17793
|
}
|
|
17794
17794
|
}
|
|
17795
|
+
function childrenToSlots(children, originalSlots) {
|
|
17796
|
+
var newSlots = originalSlots;
|
|
17797
|
+
// istanbul ignore next
|
|
17798
|
+
if (process.env.NODE_ENV === "development" && children && !Array.isArray(children)) {
|
|
17799
|
+
// eslint-disable-next-line no-console
|
|
17800
|
+
console.warn("Specified brick children but not array:", "<".concat(typeof children, ">"), children);
|
|
17801
|
+
}
|
|
17802
|
+
if (Array.isArray(children) && !newSlots) {
|
|
17803
|
+
newSlots = {};
|
|
17804
|
+
for (var child of children) {
|
|
17805
|
+
var _slot;
|
|
17806
|
+
var slot = (_slot = child.slot) !== null && _slot !== void 0 ? _slot : "";
|
|
17807
|
+
if (!Object.prototype.hasOwnProperty.call(newSlots, slot)) {
|
|
17808
|
+
newSlots[slot] = {
|
|
17809
|
+
type: "bricks",
|
|
17810
|
+
bricks: []
|
|
17811
|
+
};
|
|
17812
|
+
}
|
|
17813
|
+
newSlots[slot].bricks.push(child);
|
|
17814
|
+
}
|
|
17815
|
+
}
|
|
17816
|
+
return newSlots;
|
|
17817
|
+
}
|
|
17795
17818
|
function parseSlots(slots, options) {
|
|
17796
17819
|
if (isObject(slots)) {
|
|
17797
17820
|
return Object.entries(slots).map(_ref2 => {
|
|
@@ -18236,10 +18259,21 @@ function getDllAndDepsByResource(_ref, brickPackages) {
|
|
|
18236
18259
|
var v3Processors = new Set();
|
|
18237
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) {
|
|
18238
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
|
+
}
|
|
18239
18274
|
[...(bricks !== null && bricks !== void 0 ? bricks : []).map(n => [n]), ...(processors !== null && processors !== void 0 ? processors : []).map(n => [n, true])].forEach(_ref2 => {
|
|
18240
18275
|
var [name, isProcessor] = _ref2;
|
|
18241
18276
|
// ignore custom template
|
|
18242
|
-
// istanbul ignore else
|
|
18243
18277
|
if (name.includes(".")) {
|
|
18244
18278
|
var namespace = name.split(".")[0];
|
|
18245
18279
|
// processor 是 camelCase 格式,转成 brick 的 param-case 格式,统一去判断
|
|
@@ -18262,6 +18296,8 @@ function getDllAndDepsByResource(_ref, brickPackages) {
|
|
|
18262
18296
|
// eslint-disable-next-line no-console
|
|
18263
18297
|
console.error("".concat(isProcessor ? "Processor" : "Brick", " `").concat(name, "` does not match any brick package"));
|
|
18264
18298
|
}
|
|
18299
|
+
} else if (!name.startsWith("tpl-") && v3DefinedBricks.has(name)) {
|
|
18300
|
+
v3Bricks.add(name);
|
|
18265
18301
|
}
|
|
18266
18302
|
});
|
|
18267
18303
|
editorBricks === null || editorBricks === void 0 ? void 0 : editorBricks.forEach(editor => {
|