@uniformdev/transformer 1.1.17 → 1.1.19

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
@@ -664,9 +664,26 @@ var CompositionConverterService = class {
664
664
  for (const inst of instances) {
665
665
  const existingId = this.findExistingEntryBySourceItem(inst, sourceItemMap);
666
666
  if (existingId) {
667
- this.logger.info(
668
- `Reusing existing entry ${existingId} for ${flattenType} (sourceItem match)`
667
+ const existingEntryPath = this.fileSystem.joinPath(
668
+ entriesDirFull,
669
+ `${existingId}.json`
669
670
  );
671
+ this.logger.action(
672
+ whatIf,
673
+ "UPDATE",
674
+ `${entriesDir}/${existingId}.json (${flattenType}, merged fields from "${this.truncate(compositionName, 50)}")`
675
+ );
676
+ if (!whatIf) {
677
+ const existingEntry = await this.fileSystem.readFile(existingEntryPath);
678
+ if (existingEntry?.entry) {
679
+ const instanceFields = inst.instance.parameters ?? {};
680
+ existingEntry.entry.fields = {
681
+ ...existingEntry.entry.fields,
682
+ ...instanceFields
683
+ };
684
+ await this.fileSystem.writeFile(existingEntryPath, existingEntry);
685
+ }
686
+ }
670
687
  entriesReused++;
671
688
  continue;
672
689
  }
@@ -1786,9 +1803,23 @@ var ComponentAdderService = class {
1786
1803
  throw error;
1787
1804
  }
1788
1805
  let allowedComponentsUpdated = false;
1806
+ const resolvedParentTypes = [];
1789
1807
  for (const parentType of parentTypes) {
1790
- this.logger.info(`Loading parent component: ${parentType}`);
1791
- const { component: parentComponent, filePath: parentComponentFilePath } = await this.componentService.loadComponent(fullComponentsDir, parentType, findOptions);
1808
+ this.logger.info(`Loading component: ${parentType}`);
1809
+ let parentComponent;
1810
+ let parentComponentFilePath;
1811
+ try {
1812
+ const result = await this.componentService.loadComponent(fullComponentsDir, parentType, findOptions);
1813
+ parentComponent = result.component;
1814
+ parentComponentFilePath = result.filePath;
1815
+ } catch (error) {
1816
+ if (error instanceof ComponentNotFoundError) {
1817
+ this.logger.warn(`Component not found: ${parentType} (searched: ${fullComponentsDir})`);
1818
+ continue;
1819
+ }
1820
+ throw error;
1821
+ }
1822
+ resolvedParentTypes.push(parentType);
1792
1823
  if (!parentComponent.slots) {
1793
1824
  parentComponent.slots = [];
1794
1825
  }
@@ -1856,7 +1887,7 @@ var ComponentAdderService = class {
1856
1887
  );
1857
1888
  this.logger.info("");
1858
1889
  this.logger.info(
1859
- `Summary: ${allowedComponentsUpdated ? `${parentTypes.length} component definition(s) updated, ` : ""}${compositionsResult} composition(s), ${compositionPatternsResult} composition pattern(s), ${componentPatternsResult} component pattern(s) updated. ${compositionsResult + compositionPatternsResult + componentPatternsResult} instance(s) added.`
1890
+ `Summary: ${allowedComponentsUpdated ? `${resolvedParentTypes.length} component definition(s) updated, ` : ""}${compositionsResult} composition(s), ${compositionPatternsResult} composition pattern(s), ${componentPatternsResult} component pattern(s) updated. ${compositionsResult + compositionPatternsResult + componentPatternsResult} instance(s) added.`
1860
1891
  );
1861
1892
  return {
1862
1893
  allowedComponentsUpdated,
@@ -1905,9 +1936,23 @@ var ComponentAdderService = class {
1905
1936
  }
1906
1937
  const componentTypeInPattern = patternDefinition.type;
1907
1938
  let allowedComponentsUpdated = false;
1939
+ const resolvedParentTypes = [];
1908
1940
  for (const parentType of parentTypes) {
1909
- this.logger.info(`Loading parent component: ${parentType}`);
1910
- const { component: parentComponent, filePath: parentComponentFilePath } = await this.componentService.loadComponent(fullComponentsDir, parentType, findOptions);
1941
+ this.logger.info(`Loading component: ${parentType}`);
1942
+ let parentComponent;
1943
+ let parentComponentFilePath;
1944
+ try {
1945
+ const result = await this.componentService.loadComponent(fullComponentsDir, parentType, findOptions);
1946
+ parentComponent = result.component;
1947
+ parentComponentFilePath = result.filePath;
1948
+ } catch (error) {
1949
+ if (error instanceof ComponentNotFoundError) {
1950
+ this.logger.warn(`Component not found: ${parentType} (searched: ${fullComponentsDir})`);
1951
+ continue;
1952
+ }
1953
+ throw error;
1954
+ }
1955
+ resolvedParentTypes.push(parentType);
1911
1956
  if (!parentComponent.slots) {
1912
1957
  parentComponent.slots = [];
1913
1958
  }
@@ -1978,7 +2023,7 @@ var ComponentAdderService = class {
1978
2023
  );
1979
2024
  this.logger.info("");
1980
2025
  this.logger.info(
1981
- `Summary: ${allowedComponentsUpdated ? `${parentTypes.length} component definition(s) updated, ` : ""}${compositionsResult} composition(s), ${compositionPatternsResult} composition pattern(s), ${componentPatternsResult} component pattern(s) updated. ${compositionsResult + compositionPatternsResult + componentPatternsResult} instance(s) added.`
2026
+ `Summary: ${allowedComponentsUpdated ? `${resolvedParentTypes.length} component definition(s) updated, ` : ""}${compositionsResult} composition(s), ${compositionPatternsResult} composition pattern(s), ${componentPatternsResult} component pattern(s) updated. ${compositionsResult + compositionPatternsResult + componentPatternsResult} instance(s) added.`
1982
2027
  );
1983
2028
  return {
1984
2029
  allowedComponentsUpdated,