@uniformdev/transformer 1.1.47 → 1.1.49
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/cli/index.js +30 -10
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4523,11 +4523,28 @@ var SlotPropagatorService = class {
|
|
|
4523
4523
|
}
|
|
4524
4524
|
}
|
|
4525
4525
|
this.logger.info(`Resolved slots: ${resolvedSlotIds.join(", ")}`);
|
|
4526
|
+
const compositions = await this.compositionService.findCompositionsByTypes(
|
|
4527
|
+
fullCompositionsDir,
|
|
4528
|
+
compositionTypes,
|
|
4529
|
+
findOptions
|
|
4530
|
+
);
|
|
4531
|
+
const componentTypesInSlot = /* @__PURE__ */ new Set();
|
|
4532
|
+
for (const { composition } of compositions) {
|
|
4533
|
+
const rootSlots = composition.composition.slots ?? {};
|
|
4534
|
+
for (const slotDef of resolvedSlots) {
|
|
4535
|
+
const slotContent = rootSlots[slotDef.id] ?? [];
|
|
4536
|
+
for (const instance of slotContent) {
|
|
4537
|
+
if (instance.type) {
|
|
4538
|
+
componentTypesInSlot.add(instance.type);
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
4541
|
+
}
|
|
4542
|
+
}
|
|
4526
4543
|
let modifiedComponent = { ...targetComponent };
|
|
4527
4544
|
let componentModified = false;
|
|
4528
4545
|
const existingSlot = this.componentService.findSlot(modifiedComponent, targetSlot, findOptions);
|
|
4529
4546
|
if (!existingSlot) {
|
|
4530
|
-
const mergedAllowedComponents = this.mergeAllowedComponents(resolvedSlots);
|
|
4547
|
+
const mergedAllowedComponents = this.mergeAllowedComponents(resolvedSlots, componentTypesInSlot);
|
|
4531
4548
|
this.logger.action(whatIf, "CREATE", `Slot "${targetSlot}" on ${targetComponentType}`);
|
|
4532
4549
|
modifiedComponent = this.componentService.addSlot(modifiedComponent, {
|
|
4533
4550
|
id: targetSlot,
|
|
@@ -4536,7 +4553,7 @@ var SlotPropagatorService = class {
|
|
|
4536
4553
|
});
|
|
4537
4554
|
componentModified = true;
|
|
4538
4555
|
} else {
|
|
4539
|
-
const mergedAllowedComponents = this.mergeAllowedComponents([existingSlot, ...resolvedSlots]);
|
|
4556
|
+
const mergedAllowedComponents = this.mergeAllowedComponents([existingSlot, ...resolvedSlots], componentTypesInSlot);
|
|
4540
4557
|
const existingAllowed = existingSlot.allowedComponents ?? [];
|
|
4541
4558
|
if (mergedAllowedComponents.length > existingAllowed.length) {
|
|
4542
4559
|
this.logger.action(
|
|
@@ -4558,11 +4575,6 @@ var SlotPropagatorService = class {
|
|
|
4558
4575
|
if (componentModified && !whatIf) {
|
|
4559
4576
|
await this.componentService.saveComponent(targetFilePath, modifiedComponent);
|
|
4560
4577
|
}
|
|
4561
|
-
const compositions = await this.compositionService.findCompositionsByTypes(
|
|
4562
|
-
fullCompositionsDir,
|
|
4563
|
-
compositionTypes,
|
|
4564
|
-
findOptions
|
|
4565
|
-
);
|
|
4566
4578
|
let modifiedCompositions = 0;
|
|
4567
4579
|
let propagatedInstances = 0;
|
|
4568
4580
|
for (const { composition, filePath } of compositions) {
|
|
@@ -4652,13 +4664,18 @@ var SlotPropagatorService = class {
|
|
|
4652
4664
|
propagatedInstances
|
|
4653
4665
|
};
|
|
4654
4666
|
}
|
|
4655
|
-
mergeAllowedComponents(slots) {
|
|
4667
|
+
mergeAllowedComponents(slots, additionalTypes) {
|
|
4656
4668
|
const allowed = /* @__PURE__ */ new Set();
|
|
4657
4669
|
for (const slot of slots) {
|
|
4658
4670
|
for (const comp of slot.allowedComponents ?? []) {
|
|
4659
4671
|
allowed.add(comp);
|
|
4660
4672
|
}
|
|
4661
4673
|
}
|
|
4674
|
+
if (additionalTypes) {
|
|
4675
|
+
for (const comp of additionalTypes) {
|
|
4676
|
+
allowed.add(comp);
|
|
4677
|
+
}
|
|
4678
|
+
}
|
|
4662
4679
|
return Array.from(allowed).sort();
|
|
4663
4680
|
}
|
|
4664
4681
|
deepCloneComponents(components) {
|
|
@@ -5869,8 +5886,11 @@ var BlockFieldFlattenerService = class {
|
|
|
5869
5886
|
}
|
|
5870
5887
|
const allowedTypes = blockParam.typeConfig?.allowedTypes;
|
|
5871
5888
|
if (!allowedTypes || allowedTypes.length === 0) {
|
|
5889
|
+
const paramType = blockParam.type ?? "unknown";
|
|
5890
|
+
const hasTypeConfig = !!blockParam.typeConfig;
|
|
5891
|
+
const typeConfigKeys = hasTypeConfig ? Object.keys(blockParam.typeConfig).join(", ") : "none";
|
|
5872
5892
|
throw new TransformError(
|
|
5873
|
-
`Parameter "${parameterId}" on component "${componentId}" has no allowedTypes in typeConfig`
|
|
5893
|
+
`Parameter "${parameterId}" on component "${componentId}" has no allowedTypes in typeConfig. Parameter type is "${paramType}"${paramType !== "contentBlock" ? ` (expected "contentBlock" \u2014 this parameter may not be a block field)` : ""}. typeConfig ${hasTypeConfig ? `exists with keys: [${typeConfigKeys}] but "allowedTypes" is missing or empty` : "is missing entirely \u2014 the block type was not populated during export/serialization"}`
|
|
5874
5894
|
);
|
|
5875
5895
|
}
|
|
5876
5896
|
if (allowedTypes.length > 1) {
|
|
@@ -7456,7 +7476,7 @@ function createPropagateRootSlotCommand() {
|
|
|
7456
7476
|
// package.json
|
|
7457
7477
|
var package_default = {
|
|
7458
7478
|
name: "@uniformdev/transformer",
|
|
7459
|
-
version: "1.1.
|
|
7479
|
+
version: "1.1.49",
|
|
7460
7480
|
description: "CLI tool for transforming Uniform.dev serialization files offline",
|
|
7461
7481
|
type: "module",
|
|
7462
7482
|
bin: {
|