@uniformdev/transformer 1.1.53 → 1.1.54

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;