@yahoo/uds-create-cli 5.70.0 → 5.71.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yahoo/uds-create-cli",
3
- "version": "5.70.0",
3
+ "version": "5.71.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,10 +32,10 @@
32
32
  "@modelcontextprotocol/sdk": "^1.32.2",
33
33
  "@orpc/client": "^1.13.9",
34
34
  "@orpc/contract": "^1.13.9",
35
- "@yahoo/uds-create-config": "5.70.0",
36
- "@yahoo/uds-create-loader": "5.70.0",
37
- "@yahoo/uds-create-types": "5.70.0",
38
- "@yahoo/uds-create-utils": "5.70.0",
35
+ "@yahoo/uds-create-config": "5.71.0",
36
+ "@yahoo/uds-create-loader": "5.71.0",
37
+ "@yahoo/uds-create-types": "5.71.0",
38
+ "@yahoo/uds-create-utils": "5.71.0",
39
39
  "esbuild": "^0.27.4",
40
40
  "ts-morph": "^27.0.2",
41
41
  "get-tsconfig": "^4.10.0",
@@ -52,13 +52,13 @@
52
52
  "lodash": "^4.17.23",
53
53
  "prettier": "^3.8.1"
54
54
  },
55
- "udsSchemaVersion": 20261102185610,
55
+ "udsSchemaVersion": 20261102193912,
56
56
  "optionalDependencies": {
57
- "@yahoo/uds-create-cli-darwin-arm64": "5.70.0",
58
- "@yahoo/uds-create-cli-darwin-x64": "5.70.0",
59
- "@yahoo/uds-create-cli-linux-arm64": "5.70.0",
60
- "@yahoo/uds-create-cli-linux-x64": "5.70.0",
61
- "@yahoo/uds-create-cli-linux-arm64-musl": "5.70.0",
62
- "@yahoo/uds-create-cli-linux-x64-musl": "5.70.0"
57
+ "@yahoo/uds-create-cli-darwin-arm64": "5.71.0",
58
+ "@yahoo/uds-create-cli-darwin-x64": "5.71.0",
59
+ "@yahoo/uds-create-cli-linux-arm64": "5.71.0",
60
+ "@yahoo/uds-create-cli-linux-x64": "5.71.0",
61
+ "@yahoo/uds-create-cli-linux-arm64-musl": "5.71.0",
62
+ "@yahoo/uds-create-cli-linux-x64-musl": "5.71.0"
63
63
  }
64
64
  }
@@ -83515,6 +83515,13 @@ var propMappingRuleSchema = external_exports.object({
83515
83515
  unset: external_exports.array(external_exports.string()).optional().describe("The props to remove. A prop the rule matches on stays unless it is named here, so a removed prop has to be.")
83516
83516
  });
83517
83517
  var propMappingRulesSchema = external_exports.array(propMappingRuleSchema).min(1).describe("Every rule whose `when` matches an instance as stored applies to it, so separate props are mapped by separate rules, and a combination by one rule naming both.");
83518
+ var swapMappingRulesSchema = external_exports.array(propMappingRuleSchema).describe("The rules for the swapped instances, as a mapping has them. `when: {}` applies to every one of them (to `unset` a prop the new component lacks), and none keeps their props as they are.");
83519
+ var mapPropsRulesSchema = external_exports.array(propMappingRuleSchema).default([]).describe("Every rule whose `when` matches an instance as stored applies to it, so separate props are mapped by separate rules, and a combination by one rule naming both. A mapping needs at least one. With `from`, none keeps the swapped instances' props, and `when: {}` reaches every swapped instance.");
83520
+ var mappingScopeSchema = external_exports.object({
83521
+ canvas: external_exports.string().min(1).describe("The design file's canvas id."),
83522
+ nodes: external_exports.array(external_exports.string().min(1)).min(1).describe("The ids of the nodes it reaches, in that design file.")
83523
+ }).describe("Create only: limits the mapping to these nodes of one design file, for fixing one instance before asking about the rest. A checkout's call sites aren't nodes, so there it isn't taken.");
83524
+ var mappingFromSchema = external_exports.string().min(1).describe("The component whose instances become this one's, as a path: the one a design file still names after the system lost it (`SelectContent`, replaced by `SelectMenu`). It needn't exist. Which component replaces which is the user's call: propose it, and apply it only once they confirm.");
83518
83525
  function valueRefusal(config2, component, prop, value) {
83519
83526
  if (typeof value !== "string" || value.startsWith("[")) return void 0;
83520
83527
  if (prop.kind === "variant" || prop.kind === "slot") return prop.values && !prop.values.includes(value) ? `"${value}", which isn't one of its values (${prop.values.join(", ")})` : void 0;
@@ -83524,9 +83531,10 @@ function valueRefusal(config2, component, prop, value) {
83524
83531
  }
83525
83532
  function propMappingErrors(config2, mapping) {
83526
83533
  if (!config2.resolve("component", mapping.component)) return [`No component "${mapping.component}"`];
83534
+ if (mapping.from === mapping.component) return [`"${mapping.component}" can't replace itself: \`from\` names the component its instances are now`];
83527
83535
  const errors = [];
83528
83536
  mapping.rules.forEach((rule, i) => {
83529
- if (Object.keys(rule.when).length === 0) errors.push(`Rule ${i + 1} matches every instance: name what it matches in \`when\``);
83537
+ if (Object.keys(rule.when).length === 0 && mapping.from === void 0) errors.push(`Rule ${i + 1} matches every instance: name what it matches in \`when\``);
83530
83538
  for (const [name, value] of Object.entries(rule.set ?? {})) {
83531
83539
  const prop = surfaceProp(config2, mapping.component, name);
83532
83540
  if (!prop) {
@@ -83567,6 +83575,10 @@ function mapBag(bag, rules) {
83567
83575
  bag: next
83568
83576
  };
83569
83577
  }
83578
+ function retyped(type, to) {
83579
+ const at = type.lastIndexOf("@");
83580
+ return `component:${to}${type.includes(":") && at > 0 ? type.slice(at) : ""}`;
83581
+ }
83570
83582
  function mapProps(walk, component, props, at) {
83571
83583
  let next;
83572
83584
  if (component === walk.mapping.component) {
@@ -83617,8 +83629,10 @@ function applyPropMapping(config2, spec2, mapping) {
83617
83629
  let elements;
83618
83630
  let changed = 0;
83619
83631
  const conflicts = [];
83632
+ const reached = mapping.only ? new Set(mapping.only.nodes) : void 0;
83620
83633
  for (const [key2, element2] of Object.entries(spec2.elements ?? {})) {
83621
- if (!element2?.props) continue;
83634
+ if (!element2) continue;
83635
+ if (reached && !reached.has(key2)) continue;
83622
83636
  const walk = {
83623
83637
  config: config2,
83624
83638
  mapping,
@@ -83626,14 +83640,18 @@ function applyPropMapping(config2, spec2, mapping) {
83626
83640
  conflicts,
83627
83641
  changed: 0
83628
83642
  };
83629
- const props = mapProps(walk, componentOf(element2.type), element2.props, "props");
83630
- if (!props) continue;
83643
+ const component = componentOf(element2.type);
83644
+ const swapped = mapping.from !== void 0 && component === mapping.from && typeof element2.type === "string";
83645
+ if (!swapped && !element2.props) continue;
83646
+ const props = mapProps(walk, swapped ? mapping.component : component, element2.props ?? {}, "props");
83647
+ if (!props && !swapped) continue;
83631
83648
  elements ??= { ...spec2.elements };
83632
83649
  elements[key2] = {
83633
83650
  ...element2,
83634
- props
83651
+ ...swapped ? { type: retyped(element2.type, mapping.component) } : {},
83652
+ ...props ? { props } : {}
83635
83653
  };
83636
- changed += walk.changed;
83654
+ changed += walk.changed + (swapped && walk.changed === 0 ? 1 : 0);
83637
83655
  }
83638
83656
  return elements ? {
83639
83657
  spec: {
@@ -83655,7 +83673,7 @@ function mapComponentProps(config2, mapping, instances) {
83655
83673
  errors
83656
83674
  };
83657
83675
  const { spec: spec2, conflicts } = applyPropMapping(config2, { elements: Object.fromEntries(instances.map((props, i) => [String(i), {
83658
- type: `component:${mapping.component}`,
83676
+ type: `component:${mapping.from ?? mapping.component}`,
83659
83677
  props
83660
83678
  }])) }, mapping);
83661
83679
  return {
@@ -83664,7 +83682,7 @@ function mapComponentProps(config2, mapping, instances) {
83664
83682
  const after5 = spec2.elements?.[String(i)]?.props ?? props;
83665
83683
  return {
83666
83684
  props: after5,
83667
- changed: after5 !== props,
83685
+ changed: after5 !== props || mapping.from !== void 0,
83668
83686
  conflicts: conflicts.filter((conflict) => conflict.element === String(i)).flatMap((conflict) => conflict.props)
83669
83687
  };
83670
83688
  })
@@ -87099,12 +87117,16 @@ var ComponentEntity = defineEntity({
87099
87117
  "map-props": {
87100
87118
  input: external_exports.object({
87101
87119
  path: pathInput("component"),
87102
- data: external_exports.object({ rules: propMappingRulesSchema })
87120
+ data: external_exports.object({
87121
+ from: mappingFromSchema.optional(),
87122
+ only: mappingScopeSchema.optional(),
87123
+ rules: mapPropsRulesSchema
87124
+ })
87103
87125
  }),
87104
87126
  readOnly: false,
87105
87127
  approval: "reference-change",
87106
87128
  label: "Map props",
87107
- description: "Move a component's instances onto its props as they are now, after its API changed: `variant: 'primary'` becomes `color: 'brand', prominence: 'solid'`. It changes nothing in the config. Where it runs decides what it moves: in Create, the instances in the branch's design files; in a checkout (`uds config edit`, the local UDS MCP), the call sites in the project's source. Refuses a rule that writes a prop or value the component doesn't take. Run it with `plan: true` first: the plan says what it would move, and writes nothing.",
87129
+ description: "Move a component's instances onto its props as they are now, after its API changed: `variant: 'primary'` becomes `color: 'brand', prominence: 'solid'`. It changes nothing in the config. Where it runs decides what it moves: in Create, the instances in the branch's design files; in a checkout (`uds config edit`, the local UDS MCP), the call sites in the project's source. With `from`, it swaps the component too: instances of `from`, a component the system may no longer have, become this component's, and the rules move their props onto it (`when: {}` reaches every swapped instance). Refuses a rule that writes a prop or value the component doesn't take. Run it with `plan: true` first: the plan says what it would move, and writes nothing.",
87108
87130
  scope: "item",
87109
87131
  title: (entity) => `Map ${entity} props`,
87110
87132
  example: ({ config: config2, path: path2 }) => {
@@ -87115,10 +87137,7 @@ var ComponentEntity = defineEntity({
87115
87137
  };
87116
87138
  },
87117
87139
  handler: (input2, config2) => {
87118
- const errors = propMappingErrors(config2, {
87119
- component: String(input2.path),
87120
- rules: input2.data.rules
87121
- });
87140
+ const errors = propMappingErrors(config2, mappingOf(String(input2.path), input2.data));
87122
87141
  if (errors.length > 0) rejectData(errors.join(" "));
87123
87142
  return config2;
87124
87143
  }
@@ -87127,7 +87146,8 @@ var ComponentEntity = defineEntity({
87127
87146
  input: external_exports.object({
87128
87147
  path: pathInput("component"),
87129
87148
  data: external_exports.object({
87130
- rules: propMappingRulesSchema,
87149
+ from: mappingFromSchema.optional(),
87150
+ rules: mapPropsRulesSchema,
87131
87151
  instances: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).default([]).describe("Instances' props as they are stored or written: each comes back with the rules applied.")
87132
87152
  })
87133
87153
  }),
@@ -87139,10 +87159,7 @@ var ComponentEntity = defineEntity({
87139
87159
  example: ({ config: config2, path: path2 }) => exampleMapping(config2, path2),
87140
87160
  handler: (input2, config2) => {
87141
87161
  const data = input2.data;
87142
- return mapComponentProps(config2, {
87143
- component: String(input2.path),
87144
- rules: data.rules
87145
- }, data.instances ?? []);
87162
+ return mapComponentProps(config2, mappingOf(String(input2.path), input2.data), data.instances ?? []);
87146
87163
  }
87147
87164
  }
87148
87165
  },
@@ -87257,6 +87274,16 @@ function exampleProps(config2, componentPath) {
87257
87274
  }
87258
87275
  return {};
87259
87276
  }
87277
+ function mappingOf(component, data) {
87278
+ const { from, only, rules = [] } = data ?? {};
87279
+ if (from === void 0 && rules.length === 0) rejectData("Name at least one rule in `rules`, or `from` to swap another component's instances onto this one.");
87280
+ return {
87281
+ component,
87282
+ ...from === void 0 ? {} : { from: from.replace(/^component:/, "") },
87283
+ ...only === void 0 ? {} : { only },
87284
+ rules
87285
+ };
87286
+ }
87260
87287
  function exampleMapping(config2, componentPath) {
87261
87288
  const instance = exampleProps(config2, componentPath);
87262
87289
  const [name, value] = Object.entries(instance)[0] ?? [];
@@ -89766,7 +89793,7 @@ var Entity = class {
89766
89793
  };
89767
89794
 
89768
89795
  // ../config/dist/framework/schema-version.js
89769
- var CURRENT_SCHEMA_VERSION = 20261102185610;
89796
+ var CURRENT_SCHEMA_VERSION = 20261102193912;
89770
89797
  var SETTINGS_AS_KIND_VERSION = 20260908171448;
89771
89798
  var SchemaVersionTooNew = class extends ConfigFormatError {
89772
89799
  found;
@@ -89786,7 +89813,7 @@ function registerSchemaMigrations(...migrations) {
89786
89813
  for (const migration of migrations) {
89787
89814
  if (migration.version !== 1 && !isMintTimestamp(migration.version)) throw new Error(`Schema migration version ${migration.version} is not a mint timestamp \u2014 mint one with \`date +%Y%m%d%H%M%S\`, like a supabase migration.`);
89788
89815
  if (REGISTERED.has(migration.version)) throw new Error(`A schema migration at version ${migration.version} is already registered.`);
89789
- if (migration.version > 20261102185610) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) \u2014 a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
89816
+ if (migration.version > 20261102193912) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) \u2014 a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
89790
89817
  REGISTERED.set(migration.version, migration);
89791
89818
  }
89792
89819
  }
@@ -89817,7 +89844,7 @@ function pendingFor(version2, target2, options) {
89817
89844
  return [...(options?.migrations ?? REGISTERED).values()].filter((m) => m.version > version2 && m.version <= target2).sort((a, b) => a.version - b.version);
89818
89845
  }
89819
89846
  function upgradeSerializedConfig(json2, options) {
89820
- const target2 = options?.target ?? 20261102185610;
89847
+ const target2 = options?.target ?? 20261102193912;
89821
89848
  const version2 = detectedWireVersion(json2);
89822
89849
  if (version2 > target2) throw new SchemaVersionTooNew(version2, target2);
89823
89850
  const raw = json2;
@@ -96703,7 +96730,7 @@ var Config = class Config2 {
96703
96730
  * links from the provided sources. A declared `linkedKind` with no provided source throws. */
96704
96731
  hydrateFrom(stored, options) {
96705
96732
  const claimed = schemaVersionOf(stored);
96706
- if (claimed > 20261102185610) throw new SchemaVersionTooNew(claimed);
96733
+ if (claimed > 20261102193912) throw new SchemaVersionTooNew(claimed);
96707
96734
  const wire = upgradeSerializedConfig(stored);
96708
96735
  if (!Array.isArray(wire.ownedKinds) || typeof wire.items !== "object" || wire.items === null) throw new ConfigFormatError(`Config "${stored.name ?? "system-config"}" cannot be hydrated: this is not a serialized config-v2 config (no "ownedKinds"/"items"). A pre-cutover build artifact converts through the registered cutover migration \u2014 import the config type's module (e.g. \`configs/system\`) before hydrating.`);
96709
96736
  const leftover = wire.options;
@@ -100271,6 +100298,15 @@ var linkReplaceMigration = {
100271
100298
  up: (json2) => json2
100272
100299
  };
100273
100300
 
100301
+ // ../config/dist/migrations/20261102193912_map_props_from.js
100302
+ var MAP_PROPS_FROM_VERSION = 20261102193912;
100303
+ var mapPropsFromMigration = {
100304
+ version: MAP_PROPS_FROM_VERSION,
100305
+ up(json2) {
100306
+ return json2;
100307
+ }
100308
+ };
100309
+
100274
100310
  // ../../node_modules/css-tree/lib/generator/sourceMap.js
100275
100311
  var import_source_map_generator = __toESM(require_source_map_generator(), 1);
100276
100312
  var trackNodes = /* @__PURE__ */ new Set(["Atrule", "Selector", "Declaration"]);
@@ -103009,6 +103045,7 @@ if (!registeredSchemaMigrations().has(20261030134149)) registerSchemaMigrations(
103009
103045
  if (!registeredSchemaMigrations().has(20261030163028)) registerSchemaMigrations(layerPrefixMigration);
103010
103046
  if (!registeredSchemaMigrations().has(20261102143821)) registerSchemaMigrations(defaultColorsMigration);
103011
103047
  if (!registeredSchemaMigrations().has(20261102185610)) registerSchemaMigrations(linkReplaceMigration);
103048
+ if (!registeredSchemaMigrations().has(20261102193912)) registerSchemaMigrations(mapPropsFromMigration);
103012
103049
 
103013
103050
  // ../config/dist/capture/node-ops.js
103014
103051
  var DEFAULT_WIDTH = 1600;