@yahoo/uds-create-cli 5.100.7 → 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.7",
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.7",
36
- "@yahoo/uds-create-loader": "5.100.7",
37
- "@yahoo/uds-create-types": "5.100.7",
38
- "@yahoo/uds-create-utils": "5.100.7",
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.7",
58
- "@yahoo/uds-create-cli-darwin-x64": "5.100.7",
59
- "@yahoo/uds-create-cli-linux-arm64": "5.100.7",
60
- "@yahoo/uds-create-cli-linux-x64": "5.100.7",
61
- "@yahoo/uds-create-cli-linux-arm64-musl": "5.100.7",
62
- "@yahoo/uds-create-cli-linux-x64-musl": "5.100.7"
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 = () => ({
@@ -107330,14 +107355,10 @@ function insert(config2, input2) {
107330
107355
  for (const key2 of order) {
107331
107356
  const element2 = elements[key2];
107332
107357
  if (!element2) continue;
107333
- const type = elementTypeRef({
107358
+ const type = placedTypeRef({
107334
107359
  type: element2.type,
107335
- slug: slug2
107336
- });
107337
- requireComponent({
107360
+ slug: slug2,
107338
107361
  system,
107339
- type,
107340
- spelled: element2.type,
107341
107362
  field: [
107342
107363
  "data",
107343
107364
  "subtree",
@@ -107400,11 +107421,6 @@ function componentOf2({ config: config2, body }) {
107400
107421
  path: entity.path
107401
107422
  } : void 0;
107402
107423
  }
107403
- function requireComponent({ system, type, spelled: spelled4, field }) {
107404
- if (kindOf2(type) !== "component") return;
107405
- if (system.resolve("component", pathOf2(type))) return;
107406
- rejectData(`The system has no component "${spelled4}".`, field);
107407
- }
107408
107424
  function placeOf(config2, path2, field) {
107409
107425
  const root = rootOf(path2);
107410
107426
  if (path2 === root) return rejectData(`"${path2}" is a placed node; this acts on an element inside one.`, field);
@@ -107643,18 +107659,14 @@ function reparent({ config: config2, path: path2, parent, slotProp: slot, index
107643
107659
  }];
107644
107660
  }
107645
107661
  function wrap(config2, input2) {
107646
- const { slug: slug2 } = attachedSystem(config2);
107662
+ const { slug: slug2, system } = attachedSystem(config2);
107647
107663
  const children = childrenOf(bodyOf2(config2, input2.path, ["path"]));
107648
107664
  const wrapped = new Set(input2.data.elements);
107649
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"]);
107650
- const type = elementTypeRef({
107666
+ const type = placedTypeRef({
107651
107667
  type: input2.data.container.type,
107652
- slug: slug2
107653
- });
107654
- requireComponent({
107655
- system: attachedSystem(config2).system,
107656
- type,
107657
- spelled: input2.data.container.type,
107668
+ slug: slug2,
107669
+ system,
107658
107670
  field: [
107659
107671
  "data",
107660
107672
  "container",