@uniformdev/transformer 1.1.13 → 1.1.15
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 +17 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1770,11 +1770,12 @@ var CompositionConverterService = class {
|
|
|
1770
1770
|
if (flattenComponentIds.length > 0) {
|
|
1771
1771
|
this.transformContentReferences(entry);
|
|
1772
1772
|
}
|
|
1773
|
-
const
|
|
1773
|
+
const entryId = entry.entry._id;
|
|
1774
|
+
const entryFilePath = this.fileSystem.joinPath(entriesDirFull, `${entryId}.json`);
|
|
1774
1775
|
this.logger.action(
|
|
1775
1776
|
whatIf,
|
|
1776
1777
|
"WRITE",
|
|
1777
|
-
`${entriesDir}/${
|
|
1778
|
+
`${entriesDir}/${entryId}.json (${compositionType}, "${this.truncate(compositionName, 50)}")`
|
|
1778
1779
|
);
|
|
1779
1780
|
if (!whatIf) {
|
|
1780
1781
|
await this.fileSystem.writeFile(entryFilePath, entry);
|
|
@@ -1906,10 +1907,12 @@ var CompositionConverterService = class {
|
|
|
1906
1907
|
extraWrapperProps[key] = value;
|
|
1907
1908
|
}
|
|
1908
1909
|
}
|
|
1910
|
+
const entryId = computeGuidHash(`entry${comp._id}`);
|
|
1911
|
+
const entryName = this.truncateName(comp._name ?? comp._id, 60);
|
|
1909
1912
|
return {
|
|
1910
1913
|
entry: {
|
|
1911
|
-
_id:
|
|
1912
|
-
_name:
|
|
1914
|
+
_id: entryId,
|
|
1915
|
+
_name: entryName,
|
|
1913
1916
|
type: comp.type,
|
|
1914
1917
|
fields: { ...comp.parameters ?? {} },
|
|
1915
1918
|
...extraRootProps
|
|
@@ -1918,10 +1921,14 @@ var CompositionConverterService = class {
|
|
|
1918
1921
|
};
|
|
1919
1922
|
}
|
|
1920
1923
|
generateEntryFromFlattenedInstance(inst) {
|
|
1924
|
+
const entryName = this.truncateName(
|
|
1925
|
+
`${inst.componentType} (from ${inst.compositionName})`,
|
|
1926
|
+
60
|
|
1927
|
+
);
|
|
1921
1928
|
return {
|
|
1922
1929
|
entry: {
|
|
1923
1930
|
_id: inst.determinisiticId,
|
|
1924
|
-
_name:
|
|
1931
|
+
_name: entryName,
|
|
1925
1932
|
type: inst.componentType,
|
|
1926
1933
|
fields: { ...inst.instance.parameters ?? {} }
|
|
1927
1934
|
}
|
|
@@ -2003,6 +2010,10 @@ var CompositionConverterService = class {
|
|
|
2003
2010
|
if (str.length <= maxLength) return str;
|
|
2004
2011
|
return str.substring(0, maxLength - 3) + "...";
|
|
2005
2012
|
}
|
|
2013
|
+
truncateName(name, maxLength) {
|
|
2014
|
+
if (name.length <= maxLength) return name;
|
|
2015
|
+
return name.substring(0, maxLength);
|
|
2016
|
+
}
|
|
2006
2017
|
};
|
|
2007
2018
|
function computeGuidHash(guidOrSeed) {
|
|
2008
2019
|
let uuidStr;
|