@uniformdev/transformer 1.1.53 → 1.1.55

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.js CHANGED
@@ -700,32 +700,12 @@ var CompositionConverterService = class {
700
700
  this.logger.debug(`Generated reference content type "${targetType}" with ${contentType.fields.length} field(s): ${contentType.fields.map((f) => f.id).join(", ")}`);
701
701
  }
702
702
  if (isBlockType) {
703
- let blockId = targetType;
704
- let needsRename = false;
705
- if (isRefType) {
706
- needsRename = true;
707
- }
708
- if (!needsRename) {
709
- const existingPath = this.fileSystem.joinPath(contentTypesDirFull, `${targetType}.json`);
710
- if (await this.fileSystem.fileExists(existingPath)) {
711
- try {
712
- const existing = await this.fileSystem.readFile(existingPath);
713
- if (existing?.type !== "block") {
714
- needsRename = true;
715
- }
716
- } catch {
717
- }
718
- }
719
- }
720
- if (needsRename) {
721
- blockId = `${targetType}Block`;
722
- this.logger.info(`Content type "${targetType}" already exists as non-block, using "${blockId}" for block`);
723
- }
703
+ const blockId = `${targetType}Block`;
724
704
  blockTypeIdMap.set(targetType, blockId);
725
705
  const blockContentType = this.generateContentType(component);
726
706
  blockContentType.type = "block";
727
707
  blockContentType.id = blockId;
728
- blockContentType.name = needsRename ? `${blockContentType.name} Block` : blockContentType.name;
708
+ blockContentType.name = `${blockContentType.name} Block`;
729
709
  targetContentTypeMap.set(blockId, blockContentType);
730
710
  this.logger.debug(`Generated block content type "${blockId}" with ${blockContentType.fields.length} field(s): ${blockContentType.fields.map((f) => f.id).join(", ")}`);
731
711
  }
@@ -740,7 +720,7 @@ var CompositionConverterService = class {
740
720
  this.logger.info(`Component type not found: ${targetType}`);
741
721
  missingTargetTypes.push(targetType);
742
722
  if (isBlockType) {
743
- blockTypeIdMap.set(targetType, targetType);
723
+ blockTypeIdMap.set(targetType, `${targetType}Block`);
744
724
  }
745
725
  continue;
746
726
  }
@@ -791,34 +771,19 @@ var CompositionConverterService = class {
791
771
  this.logger.debug(`Generated slot reference content type "${targetType}" with ${contentType.fields.length} field(s)`);
792
772
  }
793
773
  if (isSlotBlockType && !blockTypeIdMap.has(targetType)) {
794
- let blockId = targetType;
795
- let needsRename = isSlotRefType;
796
- if (!needsRename) {
797
- const existingPath = this.fileSystem.joinPath(contentTypesDirFull, `${targetType}.json`);
798
- if (await this.fileSystem.fileExists(existingPath)) {
799
- try {
800
- const existing = await this.fileSystem.readFile(existingPath);
801
- if (existing?.type !== "block") needsRename = true;
802
- } catch {
803
- }
804
- }
805
- }
806
- if (needsRename) {
807
- blockId = `${targetType}Block`;
808
- this.logger.info(`Content type "${targetType}" already exists as non-block, using "${blockId}" for block`);
809
- }
774
+ const blockId = `${targetType}Block`;
810
775
  blockTypeIdMap.set(targetType, blockId);
811
776
  const blockContentType = this.generateContentType(component);
812
777
  blockContentType.type = "block";
813
778
  blockContentType.id = blockId;
814
- blockContentType.name = needsRename ? `${blockContentType.name} Block` : blockContentType.name;
779
+ blockContentType.name = `${blockContentType.name} Block`;
815
780
  targetContentTypeMap.set(blockId, blockContentType);
816
781
  this.logger.debug(`Generated slot block content type "${blockId}" with ${blockContentType.fields.length} field(s)`);
817
782
  }
818
783
  } catch (error) {
819
784
  if (error instanceof ComponentNotFoundError) {
820
785
  this.logger.info(`Component type not found: ${targetType}`);
821
- if (isSlotBlockType && !blockTypeIdMap.has(targetType)) blockTypeIdMap.set(targetType, targetType);
786
+ if (isSlotBlockType && !blockTypeIdMap.has(targetType)) blockTypeIdMap.set(targetType, `${targetType}Block`);
822
787
  continue;
823
788
  }
824
789
  throw error;
@@ -2465,7 +2430,7 @@ var ComponentAdderService = class {
2465
2430
  const newInstance = this.createComponentInstance(newComponentType, parsedParams);
2466
2431
  const compositionsResult = await this.addComponentToDirectory(
2467
2432
  fullCompositionsDir,
2468
- parentTypes,
2433
+ resolvedParentTypes,
2469
2434
  slot,
2470
2435
  newInstance,
2471
2436
  whatIf,
@@ -2474,7 +2439,7 @@ var ComponentAdderService = class {
2474
2439
  );
2475
2440
  const compositionPatternsResult = await this.addComponentToDirectory(
2476
2441
  fullCompositionPatternsDir,
2477
- parentTypes,
2442
+ resolvedParentTypes,
2478
2443
  slot,
2479
2444
  newInstance,
2480
2445
  whatIf,
@@ -2483,7 +2448,7 @@ var ComponentAdderService = class {
2483
2448
  );
2484
2449
  const componentPatternsResult = await this.addComponentToDirectory(
2485
2450
  fullComponentPatternsDir,
2486
- parentTypes,
2451
+ resolvedParentTypes,
2487
2452
  slot,
2488
2453
  newInstance,
2489
2454
  whatIf,
@@ -2601,7 +2566,7 @@ var ComponentAdderService = class {
2601
2566
  };
2602
2567
  const compositionsResult = await this.addComponentToDirectory(
2603
2568
  fullCompositionsDir,
2604
- parentTypes,
2569
+ resolvedParentTypes,
2605
2570
  slot,
2606
2571
  newInstance,
2607
2572
  whatIf,
@@ -2611,7 +2576,7 @@ var ComponentAdderService = class {
2611
2576
  );
2612
2577
  const compositionPatternsResult = await this.addComponentToDirectory(
2613
2578
  fullCompositionPatternsDir,
2614
- parentTypes,
2579
+ resolvedParentTypes,
2615
2580
  slot,
2616
2581
  newInstance,
2617
2582
  whatIf,
@@ -2621,7 +2586,7 @@ var ComponentAdderService = class {
2621
2586
  );
2622
2587
  const componentPatternsResult = await this.addComponentToDirectory(
2623
2588
  fullComponentPatternsDir,
2624
- parentTypes,
2589
+ resolvedParentTypes,
2625
2590
  slot,
2626
2591
  newInstance,
2627
2592
  whatIf,