@uniformdev/transformer 1.1.2 → 1.1.3

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
@@ -2437,25 +2437,9 @@ var ComponentAdderService = class {
2437
2437
  generateId(baseName) {
2438
2438
  return `${baseName}-${randomUUID().slice(0, 8)}`;
2439
2439
  }
2440
- cloneComponentInstance(instance) {
2441
- const clone = JSON.parse(JSON.stringify(instance));
2442
- if (clone._id) {
2443
- clone._id = this.generateId(clone.type);
2444
- }
2445
- if (clone.slots) {
2446
- for (const slotInstances of Object.values(clone.slots)) {
2447
- if (Array.isArray(slotInstances)) {
2448
- for (const nestedInstance of slotInstances) {
2449
- this.regenerateInstanceIds(nestedInstance);
2450
- }
2451
- }
2452
- }
2453
- }
2454
- return clone;
2455
- }
2456
2440
  regenerateInstanceIds(instance) {
2457
2441
  if (instance._id) {
2458
- instance._id = this.generateId(instance.type);
2442
+ instance._id = instance._pattern ? randomUUID() : this.generateId(instance.type);
2459
2443
  }
2460
2444
  if (instance.slots) {
2461
2445
  for (const slotInstances of Object.values(instance.slots)) {
@@ -2675,7 +2659,11 @@ var ComponentAdderService = class {
2675
2659
  allowedComponentsUpdated = true;
2676
2660
  }
2677
2661
  }
2678
- const newInstance = this.cloneComponentInstance(patternDefinition);
2662
+ const newInstance = {
2663
+ type: componentTypeInPattern,
2664
+ _pattern: pattern.componentPatternId,
2665
+ _id: randomUUID()
2666
+ };
2679
2667
  const compositionsResult = await this.addComponentToDirectory(
2680
2668
  fullCompositionsDir,
2681
2669
  parentComponentType,
@@ -2927,7 +2915,7 @@ function createAddComponentCommand() {
2927
2915
  import { Command as Command8 } from "commander";
2928
2916
  function createAddComponentPatternCommand() {
2929
2917
  const command = new Command8("add-component-pattern");
2930
- command.description("Adds a component pattern instance to existing component slots across all compositions.").option("--parentComponentType <type>", "The component type that owns the slot").option("--slot <slotId>", "The slot ID where the component pattern will be added").option("--componentPatternId <id>", "The component pattern ID to add").option("--parameters <params>", "Pipe-separated parameter assignments (key1:value1|key2:value2)").hook("preAction", (thisCommand) => {
2918
+ command.description("Adds a component pattern instance to existing component slots across all compositions.").option("--parentComponentType <type>", "The component type that owns the slot").option("--slot <slotId>", "The slot ID where the component pattern will be added").option("--componentPatternId <id>", "The component pattern ID to add").hook("preAction", (thisCommand) => {
2931
2919
  const opts = thisCommand.opts();
2932
2920
  const requiredOptions = [
2933
2921
  { name: "parentComponentType", flag: "--parentComponentType" },
@@ -2945,8 +2933,7 @@ function createAddComponentPatternCommand() {
2945
2933
  ...globalOpts,
2946
2934
  parentComponentType: opts.parentComponentType,
2947
2935
  slot: opts.slot,
2948
- componentPatternId: opts.componentPatternId,
2949
- parameters: opts.parameters
2936
+ componentPatternId: opts.componentPatternId
2950
2937
  };
2951
2938
  const logger = new Logger();
2952
2939
  const fileSystem = new FileSystemService();
@@ -2962,7 +2949,6 @@ function createAddComponentPatternCommand() {
2962
2949
  parentComponentType: options.parentComponentType,
2963
2950
  slot: options.slot,
2964
2951
  componentPatternId: options.componentPatternId,
2965
- parameters: options.parameters,
2966
2952
  whatIf: options.whatIf ?? false,
2967
2953
  strict: options.strict ?? false
2968
2954
  });