@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/cli/index.js +54 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +53 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -674,9 +674,26 @@ var CompositionConverterService = class {
|
|
|
674
674
|
for (const inst of instances) {
|
|
675
675
|
const existingId = this.findExistingEntryBySourceItem(inst, sourceItemMap);
|
|
676
676
|
if (existingId) {
|
|
677
|
-
this.
|
|
678
|
-
|
|
677
|
+
const existingEntryPath = this.fileSystem.joinPath(
|
|
678
|
+
entriesDirFull,
|
|
679
|
+
`${existingId}.json`
|
|
679
680
|
);
|
|
681
|
+
this.logger.action(
|
|
682
|
+
whatIf,
|
|
683
|
+
"UPDATE",
|
|
684
|
+
`${entriesDir}/${existingId}.json (${flattenType}, merged fields from "${this.truncate(compositionName, 50)}")`
|
|
685
|
+
);
|
|
686
|
+
if (!whatIf) {
|
|
687
|
+
const existingEntry = await this.fileSystem.readFile(existingEntryPath);
|
|
688
|
+
if (existingEntry?.entry) {
|
|
689
|
+
const instanceFields = inst.instance.parameters ?? {};
|
|
690
|
+
existingEntry.entry.fields = {
|
|
691
|
+
...existingEntry.entry.fields,
|
|
692
|
+
...instanceFields
|
|
693
|
+
};
|
|
694
|
+
await this.fileSystem.writeFile(existingEntryPath, existingEntry);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
680
697
|
entriesReused++;
|
|
681
698
|
continue;
|
|
682
699
|
}
|
|
@@ -3299,9 +3316,23 @@ var ComponentAdderService = class {
|
|
|
3299
3316
|
throw error;
|
|
3300
3317
|
}
|
|
3301
3318
|
let allowedComponentsUpdated = false;
|
|
3319
|
+
const resolvedParentTypes = [];
|
|
3302
3320
|
for (const parentType of parentTypes) {
|
|
3303
|
-
this.logger.info(`Loading
|
|
3304
|
-
|
|
3321
|
+
this.logger.info(`Loading component: ${parentType}`);
|
|
3322
|
+
let parentComponent;
|
|
3323
|
+
let parentComponentFilePath;
|
|
3324
|
+
try {
|
|
3325
|
+
const result = await this.componentService.loadComponent(fullComponentsDir, parentType, findOptions);
|
|
3326
|
+
parentComponent = result.component;
|
|
3327
|
+
parentComponentFilePath = result.filePath;
|
|
3328
|
+
} catch (error) {
|
|
3329
|
+
if (error instanceof ComponentNotFoundError) {
|
|
3330
|
+
this.logger.warn(`Component not found: ${parentType} (searched: ${fullComponentsDir})`);
|
|
3331
|
+
continue;
|
|
3332
|
+
}
|
|
3333
|
+
throw error;
|
|
3334
|
+
}
|
|
3335
|
+
resolvedParentTypes.push(parentType);
|
|
3305
3336
|
if (!parentComponent.slots) {
|
|
3306
3337
|
parentComponent.slots = [];
|
|
3307
3338
|
}
|
|
@@ -3369,7 +3400,7 @@ var ComponentAdderService = class {
|
|
|
3369
3400
|
);
|
|
3370
3401
|
this.logger.info("");
|
|
3371
3402
|
this.logger.info(
|
|
3372
|
-
`Summary: ${allowedComponentsUpdated ? `${
|
|
3403
|
+
`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.`
|
|
3373
3404
|
);
|
|
3374
3405
|
return {
|
|
3375
3406
|
allowedComponentsUpdated,
|
|
@@ -3418,9 +3449,23 @@ var ComponentAdderService = class {
|
|
|
3418
3449
|
}
|
|
3419
3450
|
const componentTypeInPattern = patternDefinition.type;
|
|
3420
3451
|
let allowedComponentsUpdated = false;
|
|
3452
|
+
const resolvedParentTypes = [];
|
|
3421
3453
|
for (const parentType of parentTypes) {
|
|
3422
|
-
this.logger.info(`Loading
|
|
3423
|
-
|
|
3454
|
+
this.logger.info(`Loading component: ${parentType}`);
|
|
3455
|
+
let parentComponent;
|
|
3456
|
+
let parentComponentFilePath;
|
|
3457
|
+
try {
|
|
3458
|
+
const result = await this.componentService.loadComponent(fullComponentsDir, parentType, findOptions);
|
|
3459
|
+
parentComponent = result.component;
|
|
3460
|
+
parentComponentFilePath = result.filePath;
|
|
3461
|
+
} catch (error) {
|
|
3462
|
+
if (error instanceof ComponentNotFoundError) {
|
|
3463
|
+
this.logger.warn(`Component not found: ${parentType} (searched: ${fullComponentsDir})`);
|
|
3464
|
+
continue;
|
|
3465
|
+
}
|
|
3466
|
+
throw error;
|
|
3467
|
+
}
|
|
3468
|
+
resolvedParentTypes.push(parentType);
|
|
3424
3469
|
if (!parentComponent.slots) {
|
|
3425
3470
|
parentComponent.slots = [];
|
|
3426
3471
|
}
|
|
@@ -3491,7 +3536,7 @@ var ComponentAdderService = class {
|
|
|
3491
3536
|
);
|
|
3492
3537
|
this.logger.info("");
|
|
3493
3538
|
this.logger.info(
|
|
3494
|
-
`Summary: ${allowedComponentsUpdated ? `${
|
|
3539
|
+
`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.`
|
|
3495
3540
|
);
|
|
3496
3541
|
return {
|
|
3497
3542
|
allowedComponentsUpdated,
|
|
@@ -4676,7 +4721,7 @@ function createRemoveFieldCommand() {
|
|
|
4676
4721
|
// package.json
|
|
4677
4722
|
var package_default = {
|
|
4678
4723
|
name: "@uniformdev/transformer",
|
|
4679
|
-
version: "1.1.
|
|
4724
|
+
version: "1.1.19",
|
|
4680
4725
|
description: "CLI tool for transforming Uniform.dev serialization files offline",
|
|
4681
4726
|
type: "module",
|
|
4682
4727
|
bin: {
|