@uniformdev/transformer 1.1.47 → 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 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) {
@@ -7456,7 +7473,7 @@ function createPropagateRootSlotCommand() {
7456
7473
  // package.json
7457
7474
  var package_default = {
7458
7475
  name: "@uniformdev/transformer",
7459
- version: "1.1.47",
7476
+ version: "1.1.48",
7460
7477
  description: "CLI tool for transforming Uniform.dev serialization files offline",
7461
7478
  type: "module",
7462
7479
  bin: {