@uniformdev/transformer 1.1.49 → 1.1.50

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.d.ts CHANGED
@@ -136,6 +136,7 @@ interface AddComponentPatternOptions extends GlobalOptions {
136
136
  parentComponentType: string;
137
137
  slot: string;
138
138
  componentPatternId: string;
139
+ compositionIds?: string;
139
140
  }
140
141
  interface PropagateRootComponentSlotOptions extends GlobalOptions {
141
142
  compositionType: string;
@@ -441,6 +442,7 @@ interface AddComponentInternalOptions {
441
442
  newComponentType?: string;
442
443
  componentPatternId?: string;
443
444
  parameters?: string;
445
+ compositionIds?: string[];
444
446
  whatIf: boolean;
445
447
  strict: boolean;
446
448
  }
package/dist/index.js CHANGED
@@ -2512,6 +2512,7 @@ var ComponentAdderService = class {
2512
2512
  parentComponentType,
2513
2513
  slot,
2514
2514
  componentPatternId,
2515
+ compositionIds,
2515
2516
  whatIf,
2516
2517
  strict
2517
2518
  } = options;
@@ -2605,7 +2606,8 @@ var ComponentAdderService = class {
2605
2606
  newInstance,
2606
2607
  whatIf,
2607
2608
  strict,
2608
- "composition"
2609
+ "composition",
2610
+ compositionIds
2609
2611
  );
2610
2612
  const compositionPatternsResult = await this.addComponentToDirectory(
2611
2613
  fullCompositionPatternsDir,
@@ -2614,7 +2616,8 @@ var ComponentAdderService = class {
2614
2616
  newInstance,
2615
2617
  whatIf,
2616
2618
  strict,
2617
- "compositionPattern"
2619
+ "compositionPattern",
2620
+ compositionIds
2618
2621
  );
2619
2622
  const componentPatternsResult = await this.addComponentToDirectory(
2620
2623
  fullComponentPatternsDir,
@@ -2678,7 +2681,7 @@ var ComponentAdderService = class {
2678
2681
  }
2679
2682
  return raw;
2680
2683
  }
2681
- async addComponentToDirectory(directory, parentTypes, slot, newInstance, whatIf, strict, dirType) {
2684
+ async addComponentToDirectory(directory, parentTypes, slot, newInstance, whatIf, strict, dirType, compositionIds) {
2682
2685
  const exists = await this.fileSystem.fileExists(directory);
2683
2686
  if (!exists) {
2684
2687
  this.logger.detail(`${dirType} directory does not exist, skipping`);
@@ -2710,6 +2713,12 @@ var ComponentAdderService = class {
2710
2713
  continue;
2711
2714
  }
2712
2715
  const rootInstance = composition.composition;
2716
+ if (compositionIds && compositionIds.length > 0) {
2717
+ const compositionId = rootInstance._id;
2718
+ if (!compositionId || !compositionIds.some((id) => this.compareIds(compositionId, id, strict))) {
2719
+ continue;
2720
+ }
2721
+ }
2713
2722
  const rootPath = `${rootInstance._id ?? ""}${rootInstance.type}`;
2714
2723
  let modified = false;
2715
2724
  if (this.matchesAnyParentType(rootInstance.type, parentTypes, strict)) {