@yahoo/uds-create-cli 5.64.0 → 5.64.2

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.64.0",
3
+ "version": "5.64.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,10 +31,10 @@
31
31
  "@modelcontextprotocol/sdk": "^1.32.2",
32
32
  "@orpc/client": "^1.13.9",
33
33
  "@orpc/contract": "^1.13.9",
34
- "@yahoo/uds-create-config": "5.64.0",
35
- "@yahoo/uds-create-loader": "5.64.0",
36
- "@yahoo/uds-create-types": "5.64.0",
37
- "@yahoo/uds-create-utils": "5.64.0",
34
+ "@yahoo/uds-create-config": "5.64.2",
35
+ "@yahoo/uds-create-loader": "5.64.2",
36
+ "@yahoo/uds-create-types": "5.64.2",
37
+ "@yahoo/uds-create-utils": "5.64.2",
38
38
  "esbuild": "^0.27.4",
39
39
  "ts-morph": "^27.0.2",
40
40
  "get-tsconfig": "^4.10.0",
@@ -53,9 +53,9 @@
53
53
  },
54
54
  "udsSchemaVersion": 20261027205147,
55
55
  "optionalDependencies": {
56
- "@yahoo/uds-create-cli-darwin-arm64": "5.64.0",
57
- "@yahoo/uds-create-cli-darwin-x64": "5.64.0",
58
- "@yahoo/uds-create-cli-linux-arm64": "5.64.0",
59
- "@yahoo/uds-create-cli-linux-x64": "5.64.0"
56
+ "@yahoo/uds-create-cli-darwin-arm64": "5.64.2",
57
+ "@yahoo/uds-create-cli-darwin-x64": "5.64.2",
58
+ "@yahoo/uds-create-cli-linux-arm64": "5.64.2",
59
+ "@yahoo/uds-create-cli-linux-x64": "5.64.2"
60
60
  }
61
61
  }
@@ -64459,6 +64459,15 @@ function heldElsewhere(config2, { slug: slug2, kind, path: path2 }) {
64459
64459
  }
64460
64460
  function danglingDirectives(config2) {
64461
64461
  const found = [];
64462
+ const reached = /* @__PURE__ */ new Map();
64463
+ const reachedComponents = (slug2) => {
64464
+ let paths = reached.get(slug2);
64465
+ if (!paths) {
64466
+ paths = new Set(config2.sourceClosure(slug2, "component").map(pathOf2));
64467
+ reached.set(slug2, paths);
64468
+ }
64469
+ return paths;
64470
+ };
64462
64471
  for (const slug2 of config2.sourceSlugs()) {
64463
64472
  const source = config2.liveSourceFor(slug2);
64464
64473
  if (!source) continue;
@@ -64480,6 +64489,25 @@ function danglingDirectives(config2) {
64480
64489
  path: path2
64481
64490
  });
64482
64491
  if (heldBy === void 0) continue;
64492
+ if (kind === "component" && reachedComponents(slug2).has(path2)) {
64493
+ const copy = config2.pinCopyOf({
64494
+ slug: slug2,
64495
+ kind,
64496
+ path: path2
64497
+ });
64498
+ if (copy && "unreadable" in copy) {
64499
+ found.push({
64500
+ slug: slug2,
64501
+ accessor,
64502
+ path: path2,
64503
+ missing: "row",
64504
+ ...heldBy === null ? {} : { heldBy },
64505
+ unreadable: copy.unreadable
64506
+ });
64507
+ continue;
64508
+ }
64509
+ if (copy) continue;
64510
+ }
64483
64511
  found.push({
64484
64512
  slug: slug2,
64485
64513
  accessor,
@@ -78618,7 +78646,7 @@ var sourceVarPrefix = (config2, slug2) => prefixed({
78618
78646
  });
78619
78647
  function linkedVarNaming(config2, slug2) {
78620
78648
  const pinned = sourceVarPrefix(config2, slug2);
78621
- const source = config2.sourceFor(slug2);
78649
+ const source = config2.drawnSourceFor(slug2);
78622
78650
  const named = /* @__PURE__ */ new Map();
78623
78651
  return (tokenPath) => {
78624
78652
  const hit = named.get(tokenPath);
@@ -90718,6 +90746,8 @@ function objectSchemaOf(schema) {
90718
90746
  }
90719
90747
  }
90720
90748
  var implementedByCache = /* @__PURE__ */ new WeakMap();
90749
+ var CONSUMER_TOKENS = "__consumer";
90750
+ var drawnSources = /* @__PURE__ */ new WeakMap();
90721
90751
  function implementedBy(config2) {
90722
90752
  const cached2 = implementedByCache.get(config2);
90723
90753
  if (cached2) return cached2;
@@ -95027,6 +95057,104 @@ var Config = class Config2 {
95027
95057
  });
95028
95058
  }
95029
95059
  /**
95060
+ * The source at `slug` as this build draws the copies it still builds of its components that another
95061
+ * row stands in for here, each drawn the way the pin's own row was: with the entry the pin's
95062
+ * `options` lay at its path ({@link pinCopyOf}).
95063
+ *
95064
+ * A product that takes Yahoo OS's Button still builds the Bridge's, which the Bridge's Banner
95065
+ * renders, and the Bridge pin's entry for its Button is what that copy is drawn with. Everything else
95066
+ * is the source's own, so the source itself comes back when no copy carries an entry.
95067
+ */
95068
+ drawnSourceFor(slug2) {
95069
+ const source = this.sourceFor(slug2);
95070
+ if (!source) return void 0;
95071
+ let bySlug = drawnSources.get(this);
95072
+ if (!bySlug) {
95073
+ bySlug = /* @__PURE__ */ new Map();
95074
+ drawnSources.set(this, bySlug);
95075
+ }
95076
+ const cached2 = bySlug.get(slug2);
95077
+ if (cached2) return cached2;
95078
+ const changes = [];
95079
+ for (const { kind, path: path2 } of this.sourceDirectives(slug2)) {
95080
+ const entry = kind === void 0 ? void 0 : this.entityOf(kind);
95081
+ if (kind !== "component" || !entry) continue;
95082
+ const copy = this.pinCopyOf({
95083
+ slug: slug2,
95084
+ kind,
95085
+ path: path2
95086
+ });
95087
+ if (!copy || !("body" in copy)) continue;
95088
+ changes.push({
95089
+ kind,
95090
+ target: "item",
95091
+ path: path2,
95092
+ value: new Entity(path2, copy.body, entry.fieldKeys)
95093
+ });
95094
+ const tokenEntry = this.entityOf("token");
95095
+ for (const [at, cssVariable] of copy.tokens) {
95096
+ if (!tokenEntry) break;
95097
+ changes.push({
95098
+ kind: "token",
95099
+ target: "item",
95100
+ path: at,
95101
+ value: new Entity(at, { cssVariable }, tokenEntry.fieldKeys)
95102
+ });
95103
+ }
95104
+ }
95105
+ const drawn = changes.length === 0 ? source : source.derive({ snapshot: source.state.snapshot.withChanges(changes) });
95106
+ bySlug.set(slug2, drawn);
95107
+ return drawn;
95108
+ }
95109
+ /**
95110
+ * The body `slug`'s copy of `kind:path` is drawn with, spelled as the source spells it: the source's
95111
+ * entity with the entry the pin's `options` lay at the path, read as the pin's row would read it
95112
+ * here. `undefined` when this config holds the pin's row at the path (the row is what's drawn), holds
95113
+ * nothing there, or the pin lays nothing over it.
95114
+ *
95115
+ * A token it names that the source has no name for (one of this config's own, or one it takes
95116
+ * through another pin) is named under {@link CONSUMER_TOKENS} instead, and `tokens` gives each such
95117
+ * path the variable this config's stylesheet declares for it. `unreadable` names any other ref the
95118
+ * source has no name for: the copy can't be drawn with it, so the entry is reported instead.
95119
+ */
95120
+ pinCopyOf({ slug: slug2, kind, path: path2 }) {
95121
+ const stored = this.storedBody(kind, path2);
95122
+ if (stored === void 0 || isRef2(stored) && sourceOf2(stored) === slug2) return;
95123
+ const overlay = this.sourceDirective(slug2, kind, path2).overlay;
95124
+ const source = this.sourceFor(slug2);
95125
+ const theirs = this.theirBody({
95126
+ slug: slug2,
95127
+ kind,
95128
+ path: path2
95129
+ });
95130
+ if (!overlay || !source || !theirs) return void 0;
95131
+ const read = this.derive({ snapshot: this.state.snapshot.withChanges([derivedItemChange(kind, path2, ref(kind, path2, slug2).__ref, overlayBody({
95132
+ overlay,
95133
+ theirs
95134
+ }))]) }).resolve(kind, path2)?.toJSON();
95135
+ if (!read) return void 0;
95136
+ const owned = new Set(source.ownedKinds());
95137
+ const unreadable = [...new Set(collectRefs(read).filter((target2) => sourceOf2(target2) === void 0 && owned.has(kindOf2(target2)) && pathOf2(target2) !== "" && !this.borrowsExactly({ __ref: target2 }, slug2)))];
95138
+ let body = read;
95139
+ const tokens = /* @__PURE__ */ new Map();
95140
+ const others = [];
95141
+ for (const target2 of unreadable) {
95142
+ const path3 = pathOf2(target2);
95143
+ if (kindOf2(target2) !== "token" || !declaresCssVariable(this, path3)) {
95144
+ others.push(target2);
95145
+ continue;
95146
+ }
95147
+ const at = `${CONSUMER_TOKENS}/${path3}`;
95148
+ body = rewriteRefs(body, target2, ref("token", at).__ref);
95149
+ tokens.set(at, cssVar(this, "token", path3));
95150
+ }
95151
+ if (others.length > 0) return { unreadable: others };
95152
+ return {
95153
+ body: rewriteRefSource(body, slug2, void 0),
95154
+ tokens
95155
+ };
95156
+ }
95157
+ /**
95030
95158
  * The group counterpart of {@link heldThroughAnotherPin}: this config holds the group at `path`
95031
95159
  * through another pin, and every member `slug` offers under it is held that way too. A group is a
95032
95160
  * folder over its members, so it is the same folder exactly when they are the same entities.
@@ -97713,12 +97841,13 @@ function planLinkApplied({ config: config2, input: input2 }) {
97713
97841
  ];
97714
97842
  let result = planned.length > 0 ? applied(config2, planned) : void 0;
97715
97843
  if (takes2.length > 0 && result && "failed" in result) throw result.failed;
97716
- const { dropped, patches: drops } = takes2.length > 0 && result && "config" in result ? directivesTakenFrom({
97844
+ const { dropped, stranded, patches: drops } = takes2.length > 0 && result && "config" in result ? directivesTakenFrom({
97717
97845
  config: config2,
97718
97846
  slug: slug2,
97719
97847
  after: result.config
97720
97848
  }) : {
97721
97849
  dropped: [],
97850
+ stranded: [],
97722
97851
  patches: []
97723
97852
  };
97724
97853
  if (drops.length > 0 && result && "config" in result) result = applied(result.config, drops);
@@ -97738,23 +97867,33 @@ function planLinkApplied({ config: config2, input: input2 }) {
97738
97867
  extended,
97739
97868
  dropped,
97740
97869
  shared,
97741
- patches
97870
+ patches,
97871
+ ...stranded.length > 0 ? {
97872
+ stranded,
97873
+ blocked: strandedMessage(slug2, stranded)
97874
+ } : {}
97742
97875
  },
97743
- after: result && "config" in result ? result.config : void 0
97876
+ after: stranded.length === 0 && result && "config" in result ? result.config : void 0
97744
97877
  };
97745
97878
  }
97746
97879
  function directivesTakenFrom({ config: config2, slug: slug2, after: after5 }) {
97747
97880
  const key2 = (at) => `${at.slug}\0${at.accessor}\0${at.path}`;
97748
97881
  const already = new Set(danglingDirectives(config2).map(key2));
97749
97882
  const dropped = [];
97883
+ const stranded = [];
97750
97884
  for (const at of danglingDirectives(after5)) {
97751
97885
  if (at.missing !== "row" || at.heldBy !== slug2 || already.has(key2(at))) continue;
97752
- dropped.push({
97886
+ const entry = {
97753
97887
  kind: config2.accessors()[at.accessor]?.kind ?? at.accessor,
97754
97888
  path: at.path,
97755
97889
  from: at.slug,
97756
97890
  accessor: at.accessor
97891
+ };
97892
+ if (at.unreadable) stranded.push({
97893
+ ...entry,
97894
+ unreadable: at.unreadable
97757
97895
  });
97896
+ else dropped.push(entry);
97758
97897
  }
97759
97898
  const edits = [];
97760
97899
  for (const pin of new Set(dropped.map((at) => at.from))) {
@@ -97780,9 +97919,15 @@ function directivesTakenFrom({ config: config2, slug: slug2, after: after5 }) {
97780
97919
  }
97781
97920
  return {
97782
97921
  dropped,
97922
+ stranded,
97783
97923
  patches: edits
97784
97924
  };
97785
97925
  }
97926
+ function strandedMessage(slug2, stranded) {
97927
+ const named = stranded.map((at) => `${at.from}'s ${at.accessor} entry at "${at.path}" names ${at.unreadable.join(", ")}`).join("; ");
97928
+ const [one] = stranded;
97929
+ return `Can't take through "${slug2}": ${named}. ${stranded.length === 1 && one ? `${one.from} still builds its own ${one.path}, which its components render, and that entry applies to it` : "each pin still builds its own copy, which its components render, and the entry applies to it"}, but Create can draw that copy only with this system's own tokens, not yet with this system's own components, composites or motion presets. Point those values at something the pin links, or remove them from the entry, then take again.`;
97930
+ }
97786
97931
  function refusal(error61) {
97787
97932
  const collisions2 = error61.issues.flatMap((issue2) => issue2.collisions ?? []);
97788
97933
  return {
@@ -98662,10 +98807,11 @@ var LinkedSystemDefinition = defineEntity({
98662
98807
  title: (entity) => `Link something from ${entity}`,
98663
98808
  example: linkExample,
98664
98809
  handler: (input2, config2) => {
98665
- const { plan: { linked, patches }, after: after5 } = planLinkApplied({
98810
+ const { plan: { linked, patches, stranded, blocked }, after: after5 } = planLinkApplied({
98666
98811
  config: config2,
98667
98812
  input: linkPlanInputOf(input2)
98668
98813
  });
98814
+ if (stranded && stranded.length > 0 && blocked) rejectData(blocked, ["onLinked"]);
98669
98815
  if (linked.length > 0 && input2.onLinked === void 0) {
98670
98816
  const named = linked.map((at) => `${at.path} (from ${at.from})`);
98671
98817
  rejectData(`Linking through "${String(input2.path)}" reaches what another linked system provides: ${named.join(", ")}. Say whether to take them (\`onLinked: 'take'\`) or keep them where they come from (\`onLinked: 'keep'\`).`, ["onLinked"]);