@yahoo/uds-create-cli 5.100.6 → 5.101.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.100.6",
3
+ "version": "5.101.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.100.6",
36
- "@yahoo/uds-create-loader": "5.100.6",
37
- "@yahoo/uds-create-types": "5.100.6",
38
- "@yahoo/uds-create-utils": "5.100.6",
35
+ "@yahoo/uds-create-config": "5.101.0",
36
+ "@yahoo/uds-create-loader": "5.101.0",
37
+ "@yahoo/uds-create-types": "5.101.0",
38
+ "@yahoo/uds-create-utils": "5.101.0",
39
39
  "esbuild": "^0.27.4",
40
40
  "ts-morph": "^27.0.2",
41
41
  "get-tsconfig": "^4.10.0",
@@ -54,11 +54,11 @@
54
54
  },
55
55
  "udsSchemaVersion": 20261113131930,
56
56
  "optionalDependencies": {
57
- "@yahoo/uds-create-cli-darwin-arm64": "5.100.6",
58
- "@yahoo/uds-create-cli-darwin-x64": "5.100.6",
59
- "@yahoo/uds-create-cli-linux-arm64": "5.100.6",
60
- "@yahoo/uds-create-cli-linux-x64": "5.100.6",
61
- "@yahoo/uds-create-cli-linux-arm64-musl": "5.100.6",
62
- "@yahoo/uds-create-cli-linux-x64-musl": "5.100.6"
57
+ "@yahoo/uds-create-cli-darwin-arm64": "5.101.0",
58
+ "@yahoo/uds-create-cli-darwin-x64": "5.101.0",
59
+ "@yahoo/uds-create-cli-linux-arm64": "5.101.0",
60
+ "@yahoo/uds-create-cli-linux-x64": "5.101.0",
61
+ "@yahoo/uds-create-cli-linux-arm64-musl": "5.101.0",
62
+ "@yahoo/uds-create-cli-linux-x64-musl": "5.101.0"
63
63
  }
64
64
  }
@@ -90761,7 +90761,7 @@ var Converter = class {
90761
90761
  convert(el) {
90762
90762
  if (!visible(el)) return [];
90763
90763
  const path2 = el.getAttribute("data-uds-component");
90764
- if (path2 && el.getAttribute("data-uds-layer") === "root") {
90764
+ if (path2 && el.getAttribute("data-uds-layer") === "root" && this.options.config.resolve("component", path2)) {
90765
90765
  const key2 = this.component(el, path2);
90766
90766
  return key2 ? [key2] : [];
90767
90767
  }
@@ -92290,14 +92290,24 @@ function elementTypeRef({ type, slug: slug2 }) {
92290
92290
  if (SPEC_PRIMITIVES.has(type)) return ref("spec", type);
92291
92291
  return ref("component", type, slug2);
92292
92292
  }
92293
- function elementNodeFields({ element: element2, nodeId, slug: slug2 }) {
92293
+ function placedTypeRef({ type, slug: slug2, system, field }) {
92294
+ const placed = elementTypeRef({
92295
+ type,
92296
+ slug: slug2
92297
+ });
92298
+ if (kindOf2(placed) === "component" && !system.resolve("component", pathOf2(placed))) return rejectData(`The system has no component "${pathOf2(placed)}".`, field);
92299
+ return placed;
92300
+ }
92301
+ function elementNodeFields({ element: element2, nodeId, slug: slug2, system, field }) {
92294
92302
  const sub = (key2) => ref("node", `${nodeId}/${key2}`);
92295
92303
  const slots = {};
92296
92304
  for (const [name, fills] of Object.entries(element2.slots ?? {})) slots[name] = fills.map(sub);
92297
92305
  return {
92298
- type: elementTypeRef({
92306
+ type: placedTypeRef({
92299
92307
  type: element2.type,
92300
- slug: slug2
92308
+ slug: slug2,
92309
+ system,
92310
+ field
92301
92311
  }),
92302
92312
  props: element2.props ?? {},
92303
92313
  ...element2.children?.length ? { children: element2.children.map(sub) } : {},
@@ -92322,7 +92332,13 @@ function postOrder(spec2) {
92322
92332
  visit2(spec2.root);
92323
92333
  return out;
92324
92334
  }
92325
- function specToNodePatches({ config: config2, nodeId, spec: spec2, slug: slug2, placement }) {
92335
+ function specToNodePatches({ config: config2, nodeId, spec: spec2, placement, field = (key2) => [
92336
+ "spec",
92337
+ "elements",
92338
+ key2,
92339
+ "type"
92340
+ ] }) {
92341
+ const { slug: slug2, system } = attachedSystem(config2);
92326
92342
  if (config2.resolve("node", nodeId)) throw new Error(`Node "${nodeId}" already exists; pick a path that is free.`);
92327
92343
  const patches = [];
92328
92344
  for (const key2 of postOrder(spec2)) {
@@ -92334,7 +92350,9 @@ function specToNodePatches({ config: config2, nodeId, spec: spec2, slug: slug2,
92334
92350
  data: elementNodeFields({
92335
92351
  element: spec2.elements[key2],
92336
92352
  nodeId,
92337
- slug: slug2
92353
+ slug: slug2,
92354
+ system,
92355
+ field: field(key2)
92338
92356
  })
92339
92357
  });
92340
92358
  }
@@ -92346,7 +92364,9 @@ function specToNodePatches({ config: config2, nodeId, spec: spec2, slug: slug2,
92346
92364
  ...elementNodeFields({
92347
92365
  element: spec2.elements[spec2.root],
92348
92366
  nodeId,
92349
- slug: slug2
92367
+ slug: slug2,
92368
+ system,
92369
+ field: field(spec2.root)
92350
92370
  }),
92351
92371
  meta: spec2.meta,
92352
92372
  page: ref("page", placement.page),
@@ -107136,7 +107156,7 @@ function artboardsOn(config2, page) {
107136
107156
  return out.sort((a, b) => a.order - b.order || a.id.localeCompare(b.id));
107137
107157
  }
107138
107158
  function convert2(config2, input2) {
107139
- const { slug: slug2, system } = attachedSystem(config2);
107159
+ const { system } = attachedSystem(config2);
107140
107160
  const data = input2.data;
107141
107161
  if (config2.resolve("node", input2.path)) return rejectData(`Node "${input2.path}" already exists; pick a path that is free.`, ["path"]);
107142
107162
  if (!data.page) return rejectData(`Pass \`page\` (and \`label\`) to place node "${input2.path}".`, ["data", "page"]);
@@ -107164,12 +107184,17 @@ function convert2(config2, input2) {
107164
107184
  label: data.label ?? input2.path,
107165
107185
  order: front && Number.isFinite(front.order) ? front.order + 1 : 1
107166
107186
  };
107187
+ const framed = data.frame !== void 0;
107167
107188
  return specToNodePatches({
107168
107189
  config: config2,
107169
107190
  nodeId: input2.path,
107170
107191
  spec: converted.spec,
107171
- slug: slug2,
107172
- placement
107192
+ placement,
107193
+ field: (key2) => framed && key2 === converted.spec.root ? [
107194
+ "data",
107195
+ "frame",
107196
+ "type"
107197
+ ] : ["data", "tree"]
107173
107198
  });
107174
107199
  }
107175
107200
  var fromHtmlExample = () => ({
@@ -107312,7 +107337,7 @@ function childrenOf(body) {
107312
107337
  return [...body.children ?? []];
107313
107338
  }
107314
107339
  function insert(config2, input2) {
107315
- const { slug: slug2 } = attachedSystem(config2);
107340
+ const { slug: slug2, system } = attachedSystem(config2);
107316
107341
  const parent = bodyOf2(config2, input2.path, ["path"]);
107317
107342
  const spec2 = input2.data.subtree;
107318
107343
  const elements = spec2.elements;
@@ -107330,6 +107355,18 @@ function insert(config2, input2) {
107330
107355
  for (const key2 of order) {
107331
107356
  const element2 = elements[key2];
107332
107357
  if (!element2) continue;
107358
+ const type = placedTypeRef({
107359
+ type: element2.type,
107360
+ slug: slug2,
107361
+ system,
107362
+ field: [
107363
+ "data",
107364
+ "subtree",
107365
+ "elements",
107366
+ key2,
107367
+ "type"
107368
+ ]
107369
+ });
107333
107370
  const slots = {};
107334
107371
  for (const [name, fills] of Object.entries(element2.slots ?? {})) slots[name] = fills.map(sub);
107335
107372
  patches.push({
@@ -107337,10 +107374,7 @@ function insert(config2, input2) {
107337
107374
  operation: "create",
107338
107375
  path: pathFor.get(key2),
107339
107376
  data: {
107340
- type: elementTypeRef({
107341
- type: element2.type,
107342
- slug: slug2
107343
- }),
107377
+ type,
107344
107378
  props: element2.props ?? {},
107345
107379
  ...element2.children?.length ? { children: element2.children.map(sub) } : {},
107346
107380
  ...Object.keys(slots).length > 0 ? { slots } : {},
@@ -107625,13 +107659,19 @@ function reparent({ config: config2, path: path2, parent, slotProp: slot, index
107625
107659
  }];
107626
107660
  }
107627
107661
  function wrap(config2, input2) {
107628
- const { slug: slug2 } = attachedSystem(config2);
107662
+ const { slug: slug2, system } = attachedSystem(config2);
107629
107663
  const children = childrenOf(bodyOf2(config2, input2.path, ["path"]));
107630
107664
  const wrapped = new Set(input2.data.elements);
107631
107665
  for (const element2 of input2.data.elements) if (!children.some((child) => pathOf2(child) === element2)) return rejectData(`"${element2}" is not a child of "${input2.path}"; wrap acts on a node's direct children.`, ["data", "elements"]);
107632
- const type = elementTypeRef({
107666
+ const type = placedTypeRef({
107633
107667
  type: input2.data.container.type,
107634
- slug: slug2
107668
+ slug: slug2,
107669
+ system,
107670
+ field: [
107671
+ "data",
107672
+ "container",
107673
+ "type"
107674
+ ]
107635
107675
  });
107636
107676
  const slotName = input2.data.container.slotProp ?? "children";
107637
107677
  const component = componentOf2({