@uniformdev/transformer 1.1.45 → 1.1.46

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 CHANGED
@@ -6173,7 +6173,7 @@ function createFlattenBlockFieldCommand() {
6173
6173
  const command = new Command15("flatten-block-field");
6174
6174
  command.description(
6175
6175
  "Dissolves a $block parameter by lifting the block content type fields onto the component and extracting block item values into composition instances directly."
6176
- ).option("--componentId <id>", "The ID of the component that owns the block parameter").option("--parameterId <id>", "The ID of the $block parameter to flatten").option("--excludeFields <ids>", "Comma-separated list of block content type field IDs to skip when flattening").hook("preAction", (thisCommand) => {
6176
+ ).option("--componentId <id>", "The ID (or ,;|-separated list of IDs) of the component(s) that own the block parameter").option("--parameterId <id>", "The ID of the $block parameter to flatten").option("--excludeFields <ids>", "Comma-separated list of block content type field IDs to skip when flattening").hook("preAction", (thisCommand) => {
6177
6177
  const opts = thisCommand.opts();
6178
6178
  const requiredOptions = [
6179
6179
  { name: "componentId", flag: "--componentId" },
@@ -6193,31 +6193,49 @@ function createFlattenBlockFieldCommand() {
6193
6193
  excludeFields: opts.excludeFields
6194
6194
  };
6195
6195
  const logger = new Logger();
6196
+ logger.info(`componentId: ${options.componentId}`);
6197
+ logger.info(`parameterId: ${options.parameterId}`);
6198
+ logger.info(`excludeFields: ${options.excludeFields ?? ""}`);
6196
6199
  const fileSystem = new FileSystemService();
6197
6200
  const componentService = new ComponentService(fileSystem);
6198
6201
  const flattener = new BlockFieldFlattenerService(fileSystem, componentService, logger);
6202
+ const componentIds = splitList(options.componentId);
6203
+ const aggregate = {
6204
+ compositionsModified: 0,
6205
+ compositionPatternsModified: 0,
6206
+ componentPatternsModified: 0
6207
+ };
6199
6208
  try {
6200
- const result = await flattener.flatten({
6201
- rootDir: options.rootDir,
6202
- componentsDir: options.componentsDir,
6203
- compositionsDir: options.compositionsDir,
6204
- compositionPatternsDir: options.compositionPatternsDir,
6205
- componentPatternsDir: options.componentPatternsDir,
6206
- contentTypesDir: options.contentTypesDir,
6207
- componentId: options.componentId,
6208
- parameterId: options.parameterId,
6209
- whatIf: options.whatIf ?? false,
6210
- strict: options.strict ?? false,
6211
- excludeFields: options.excludeFields ? options.excludeFields.split(",").map((s) => s.trim()) : []
6212
- });
6209
+ for (const componentId of componentIds) {
6210
+ try {
6211
+ const result = await flattener.flatten({
6212
+ rootDir: options.rootDir,
6213
+ componentsDir: options.componentsDir,
6214
+ compositionsDir: options.compositionsDir,
6215
+ compositionPatternsDir: options.compositionPatternsDir,
6216
+ componentPatternsDir: options.componentPatternsDir,
6217
+ contentTypesDir: options.contentTypesDir,
6218
+ componentId,
6219
+ parameterId: options.parameterId,
6220
+ whatIf: options.whatIf ?? false,
6221
+ strict: options.strict ?? false,
6222
+ excludeFields: options.excludeFields ? options.excludeFields.split(",").map((s) => s.trim()) : []
6223
+ });
6224
+ aggregate.compositionsModified += result.compositionsModified;
6225
+ aggregate.compositionPatternsModified += result.compositionPatternsModified;
6226
+ aggregate.componentPatternsModified += result.componentPatternsModified;
6227
+ } catch (error) {
6228
+ if (error instanceof ComponentNotFoundError || error instanceof PropertyNotFoundError) {
6229
+ logger.warn(error.message);
6230
+ continue;
6231
+ }
6232
+ throw error;
6233
+ }
6234
+ }
6213
6235
  logger.success(
6214
- `Flattened parameter "${options.parameterId}" on component "${options.componentId}": ${result.compositionsModified} composition(s), ${result.compositionPatternsModified} composition pattern(s), ${result.componentPatternsModified} component pattern(s) updated`
6236
+ `Flattened parameter "${options.parameterId}" on component "${options.componentId}": ${aggregate.compositionsModified} composition(s), ${aggregate.compositionPatternsModified} composition pattern(s), ${aggregate.componentPatternsModified} component pattern(s) updated`
6215
6237
  );
6216
6238
  } catch (error) {
6217
- if (error instanceof ComponentNotFoundError || error instanceof PropertyNotFoundError) {
6218
- logger.warn(error.message);
6219
- return;
6220
- }
6221
6239
  if (error instanceof TransformError) {
6222
6240
  logger.error(error.message);
6223
6241
  process.exit(1);
@@ -7429,7 +7447,7 @@ function createPropagateRootSlotCommand() {
7429
7447
  // package.json
7430
7448
  var package_default = {
7431
7449
  name: "@uniformdev/transformer",
7432
- version: "1.1.45",
7450
+ version: "1.1.46",
7433
7451
  description: "CLI tool for transforming Uniform.dev serialization files offline",
7434
7452
  type: "module",
7435
7453
  bin: {