@uniformdev/transformer 1.1.46 → 1.1.48
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 +37 -11
- 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) {
|
|
@@ -7218,6 +7235,15 @@ var RootSlotPropagatorService = class {
|
|
|
7218
7235
|
this.logger.debug(
|
|
7219
7236
|
`Found ${compositions.length} composition(s) matching types [${compositionTypes.join(", ")}]`
|
|
7220
7237
|
);
|
|
7238
|
+
const allowedFromSource = /* @__PURE__ */ new Set();
|
|
7239
|
+
for (const { sourceComponent } of sourceComponents) {
|
|
7240
|
+
for (const slotName of slotNames) {
|
|
7241
|
+
const slotDef = this.componentService.findSlot(sourceComponent, slotName, findOptions);
|
|
7242
|
+
for (const allowed of slotDef?.allowedComponents ?? []) {
|
|
7243
|
+
allowedFromSource.add(allowed);
|
|
7244
|
+
}
|
|
7245
|
+
}
|
|
7246
|
+
}
|
|
7221
7247
|
const componentTypesInSlot = /* @__PURE__ */ new Set();
|
|
7222
7248
|
for (const { composition } of compositions) {
|
|
7223
7249
|
const rootSlots = composition.composition.slots ?? {};
|
|
@@ -7230,9 +7256,9 @@ var RootSlotPropagatorService = class {
|
|
|
7230
7256
|
}
|
|
7231
7257
|
}
|
|
7232
7258
|
}
|
|
7233
|
-
const collectedTypes =
|
|
7259
|
+
const collectedTypes = [.../* @__PURE__ */ new Set([...allowedFromSource, ...componentTypesInSlot])].sort();
|
|
7234
7260
|
this.logger.info(
|
|
7235
|
-
`Collected
|
|
7261
|
+
`Collected allowedComponents: [${collectedTypes.join(", ")}] (from source definitions: [${[...allowedFromSource].sort().join(", ")}], from slot contents: [${[...componentTypesInSlot].sort().join(", ")}])`
|
|
7236
7262
|
);
|
|
7237
7263
|
let modifiedComponent = { ...targetComponent };
|
|
7238
7264
|
let componentModified = false;
|
|
@@ -7447,7 +7473,7 @@ function createPropagateRootSlotCommand() {
|
|
|
7447
7473
|
// package.json
|
|
7448
7474
|
var package_default = {
|
|
7449
7475
|
name: "@uniformdev/transformer",
|
|
7450
|
-
version: "1.1.
|
|
7476
|
+
version: "1.1.48",
|
|
7451
7477
|
description: "CLI tool for transforming Uniform.dev serialization files offline",
|
|
7452
7478
|
type: "module",
|
|
7453
7479
|
bin: {
|