zazz-ui 0.3.2 → 0.3.4

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.
@@ -1,13 +1,13 @@
1
- import { t as ZazzError } from "./errors-DC2U2USS.js";
2
- import { _ as resolveKit, a as renderIndexJs, c as createUi, f as baseFiles, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, l as apply, m as primitiveFiles, o as sha256, p as baseScriptFiles, r as renderHead, t as appendJsImports, u as describe, v as loadConfig, y as filterCollisions } from "./wiring-CWDMdCmo.js";
3
- import { t as parseVersionArg } from "./init-m26gsqEa.js";
1
+ import { _ as resolveKit, a as renderIndexJs, b as filterCollisions, c as createUi, f as baseFiles, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, l as apply, m as primitiveFiles, o as sha256, p as baseScriptFiles, r as renderHead, t as appendJsImports, u as describe, y as loadConfig } from "./wiring-K8-qOImj.js";
2
+ import { t as ZazzError } from "./errors--aALbpFB.js";
3
+ import { t as parseVersionArg } from "./init-DarNiijO.js";
4
4
  import chalk from "chalk";
5
5
  import { existsSync } from "node:fs";
6
6
  import { readFile } from "node:fs/promises";
7
7
  import path from "node:path";
8
8
  import { mergeDiff3 } from "node-diff3";
9
9
 
10
- //#region src/changelog.ts
10
+ // src/changelog.ts
11
11
  /**
12
12
  * @fileoverview Slices the kit's CHANGELOG.md down to what a project cares
13
13
  * about: versions in `(from, to]`, sections whose scope touches the vendored
@@ -99,8 +99,7 @@ function compareVersions(a, b) {
99
99
  return preA < preB ? -1 : 1;
100
100
  }
101
101
 
102
- //#endregion
103
- //#region src/merge.ts
102
+ // src/merge.ts
104
103
  /**
105
104
  * @fileoverview Per-file update classification and 3-way merging.
106
105
  * @description `classify` turns one file's three states — ours (on disk),
@@ -167,8 +166,7 @@ function bytesEqual(a, b) {
167
166
  return bufA.equals(bufB);
168
167
  }
169
168
 
170
- //#endregion
171
- //#region src/commands/update.ts
169
+ // src/commands/update.ts
172
170
  /**
173
171
  * @fileoverview `zazz-ui update` — move vendored files to a new kit version
174
172
  * with provenance-recorded 3-way merges.
@@ -183,6 +181,14 @@ function bytesEqual(a, b) {
183
181
  * entries (index.css / index.js / head.html) belong to the base unit; their
184
182
  * merge ancestor and target are regenerated, not read from the tarball.
185
183
  * head.html is CLI-owned: it always takes the regenerated version.
184
+ *
185
+ * A base file can come from a version other than the base's own (a shared
186
+ * script a moved primitive needs before the base catches up); `base.sources`
187
+ * records that version so the file keeps its merge ancestor. No update deletes
188
+ * a file the resulting entry script still imports: it stays, tracked by the
189
+ * base unit, until the entry lets go. When the base unit is skipped,
190
+ * `base.entries` records the primitive versions the entries on disk were
191
+ * generated for, so a re-run has work to do and a true ancestor to merge from.
186
192
  */
187
193
  /** Splits positional args: the @-prefixed one is the version, the rest names. */
188
194
  function splitVersionArgs(args) {
@@ -222,18 +228,6 @@ async function runUpdate(args, flags, global) {
222
228
  const scopeNames = wholeKit ? vendoredNames : names;
223
229
  const survivors = scopeNames.filter((name) => target.manifest.primitives[name]);
224
230
  const freshDeps = target.manifest.resolveClosure(survivors).filter((name) => !config.primitives[name]);
225
- if (!(freshDeps.length > 0 || scopeNames.some((name) => config.primitives[name]?.version !== target.version) || wholeKit && (config.kit.version !== target.version || (config.base.version ?? config.kit.version) !== target.version))) {
226
- ui.outro(`Already at ${target.version} — nothing to update.`);
227
- return;
228
- }
229
- const changelog = await readChangelog(target);
230
- if (changelog && compareVersions(target.version, config.kit.version) > 0) {
231
- const slice = sliceChangelog(changelog, {
232
- from: config.kit.version,
233
- to: target.version
234
- }, /* @__PURE__ */ new Set([...vendoredNames, ...freshDeps]));
235
- if (slice) ui.step(slice);
236
- }
237
231
  const kitCache = /* @__PURE__ */ new Map();
238
232
  kitCache.set(target.version, Promise.resolve(target));
239
233
  const kitAt = (v) => {
@@ -253,6 +247,18 @@ async function runUpdate(args, flags, global) {
253
247
  strategy,
254
248
  interactive: ui.interactive
255
249
  };
250
+ if (!(config.base.entries !== void 0 || freshDeps.length > 0 || scopeNames.some((name) => config.primitives[name]?.version !== target.version) || wholeKit && (config.kit.version !== target.version || (config.base.version ?? config.kit.version) !== target.version || Object.keys(config.base.sources ?? {}).length > 0))) {
251
+ ui.outro(`Already at ${target.version} — nothing to update.`);
252
+ return;
253
+ }
254
+ const changelog = await readChangelog(target);
255
+ if (changelog && compareVersions(target.version, config.kit.version) > 0) {
256
+ const slice = sliceChangelog(changelog, {
257
+ from: config.kit.version,
258
+ to: target.version
259
+ }, /* @__PURE__ */ new Set([...vendoredNames, ...freshDeps]));
260
+ if (slice) ui.step(slice);
261
+ }
256
262
  const units = [];
257
263
  for (const name of scopeNames) units.push(await planPrimitiveUnit(name, context));
258
264
  const primitiveVersionAfter = new Map(vendoredNames.map((name) => [name, config.primitives[name]?.version ?? target.version]));
@@ -277,6 +283,7 @@ async function runUpdate(args, flags, global) {
277
283
  }
278
284
  const baseUnit = await planBaseUnit(context, {
279
285
  wholeKit,
286
+ claimed: new Set(units.filter((unit) => !unit.skipped).flatMap((unit) => Object.keys(unit.hashes))),
280
287
  primitiveVersionAfter,
281
288
  removedPrimitives: units.filter((unit) => unit.removedFromKit && !unit.skipped)
282
289
  });
@@ -285,8 +292,33 @@ async function runUpdate(args, flags, global) {
285
292
  ui,
286
293
  force: flags.force === true
287
294
  });
295
+ const entriesBefore = Object.fromEntries(Object.entries(config.primitives).map(([name, entry]) => [name, entry.version]));
288
296
  const applied = units.filter((unit) => !unit.skipped);
289
297
  const skippedUnits = units.filter((unit) => unit.skipped);
298
+ const baseVersionBefore = config.base.version ?? config.kit.version;
299
+ const baseVersionAfter = wholeKit && !baseUnit.skipped ? target.version : baseVersionBefore;
300
+ const entryScript = config.language === "ts" ? "index.ts" : "index.js";
301
+ const entryDest = path.join(root, config.dir, entryScript);
302
+ const stagedEntry = baseUnit.skipped ? void 0 : baseUnit.writes.findLast((write) => write.dest === entryDest)?.content;
303
+ const imported = importedStems(stagedEntry !== void 0 ? stagedEntry.toString() : existsSync(entryDest) ? await readFile(entryDest, "utf8") : "");
304
+ const kitRoot = path.join(root, config.dir);
305
+ const held = [];
306
+ for (const unit of applied) unit.deletes = unit.deletes.filter((dest) => {
307
+ const file = path.relative(kitRoot, dest).split(path.sep).join("/");
308
+ const stem = file.replace(/\.d\.ts$|\.js$|\.ts$/, "");
309
+ if (stem === file || !imported.has(stem)) return true;
310
+ const rel = path.relative(root, dest);
311
+ unit.notes = unit.notes.filter((note) => !note.startsWith(`${rel}: removed upstream`));
312
+ unit.notes.push(`${rel}: removed upstream — kept, because your ${entryScript} still imports it. Remove the import and run \`zazz-ui update\` again to delete it`);
313
+ const hash = unit.unit === "base" ? config.base.files[file] : config.primitives[unit.unit]?.files[file];
314
+ const source = unit.unit === "base" ? config.base.sources?.[file] ?? baseVersionBefore : unit.fromVersion;
315
+ if (hash !== void 0) held.push({
316
+ file,
317
+ hash,
318
+ source
319
+ });
320
+ return false;
321
+ });
290
322
  for (const unit of applied) {
291
323
  if (unit.unit === "base") continue;
292
324
  if (unit.removedFromKit) delete config.primitives[unit.unit];
@@ -295,23 +327,38 @@ async function runUpdate(args, flags, global) {
295
327
  files: unit.hashes
296
328
  };
297
329
  }
330
+ const required = baseUnit.skipped ? baseUnit.required ?? [] : [];
331
+ const sources = baseUnit.skipped ? { ...config.base.sources } : { ...baseUnit.sources };
298
332
  if (!baseUnit.skipped) config.base.files = baseUnit.hashes;
333
+ if (baseUnit.skipped) for (const unit of applied) for (const file of Object.keys(unit.hashes)) delete config.base.files[file];
334
+ for (const { file, hash, source } of [...required, ...held]) {
335
+ config.base.files[file] = hash;
336
+ sources[file] = source;
337
+ }
338
+ for (const [file, source] of Object.entries(sources)) if (source === baseVersionAfter || !(file in config.base.files)) delete sources[file];
339
+ if (baseUnit.skipped) config.base.entries ??= entriesBefore;
340
+ else delete config.base.entries;
341
+ if (Object.keys(sources).length > 0) config.base.sources = sources;
342
+ else delete config.base.sources;
299
343
  for (const dep of freshDeps) config.primitives[dep] = {
300
344
  version: target.version,
301
345
  files: freshHashes.get(dep) ?? {}
302
346
  };
303
347
  if (wholeKit) {
304
- const oldBaseVersion = config.base.version ?? config.kit.version;
305
348
  config.kit = {
306
349
  version: target.version,
307
350
  integrity: target.integrity
308
351
  };
309
- if (baseUnit.skipped) config.base.version = oldBaseVersion;
352
+ if (baseUnit.skipped) config.base.version = baseVersionBefore;
310
353
  else delete config.base.version;
311
354
  }
312
355
  const tx = {
313
356
  root,
314
- writes: [...applied.flatMap((unit) => unit.writes), ...keptFresh],
357
+ writes: [
358
+ ...applied.flatMap((unit) => unit.writes),
359
+ ...required.map(({ write }) => write),
360
+ ...keptFresh
361
+ ],
315
362
  deletes: applied.flatMap((unit) => unit.deletes),
316
363
  config
317
364
  };
@@ -322,6 +369,7 @@ async function runUpdate(args, flags, global) {
322
369
  }
323
370
  await apply(tx);
324
371
  for (const unit of applied) for (const note of unit.notes) ui.step(note);
372
+ if (required.length > 0) ui.step(`base was skipped, but the shared scripts the updated primitives import were still vendored:\n ${required.map(({ write }) => path.relative(root, write.dest)).join("\n ")}`);
325
373
  if (freshDeps.length > 0) ui.step(`New dependencies vendored at ${target.version}: ${freshDeps.join(", ")}`);
326
374
  const straySkips = applied.reduce((count, unit) => count + unit.straySkips, 0);
327
375
  if (skippedUnits.length > 0 || freshSkipped.length > 0 || straySkips > 0) {
@@ -364,12 +412,17 @@ async function planPrimitiveUnit(name, context) {
364
412
  const wantExamples = newEntry.examples.some((file) => file in record.files);
365
413
  const needed = primitiveFiles(newEntry, config.language, { examples: wantExamples });
366
414
  const files = [.../* @__PURE__ */ new Set([...Object.keys(record.files), ...needed])];
367
- for (const file of files) if (!await resolveFile(unit, context, {
368
- file,
369
- recordedHash: record.files[file] ?? null,
370
- base: () => readKitFile(oldKit, file),
371
- theirs: () => readKitFile(target, file)
372
- })) return unit;
415
+ for (const file of files) {
416
+ const held = file in record.files ? void 0 : config.base.files[file];
417
+ const heldVersion = config.base.sources?.[file] ?? config.base.version ?? config.kit.version;
418
+ if (!await resolveFile(unit, context, {
419
+ file,
420
+ recordedHash: record.files[file] ?? held ?? null,
421
+ base: async () => readKitFile(held === void 0 ? oldKit : await context.kitAt(heldVersion), file),
422
+ ...held === void 0 ? {} : { baseLabel: heldVersion },
423
+ theirs: () => readKitFile(target, file)
424
+ })) return unit;
425
+ }
373
426
  return unit;
374
427
  }
375
428
  /**
@@ -382,6 +435,8 @@ async function planBaseUnit(context, options) {
382
435
  const baseVersion = config.base.version ?? config.kit.version;
383
436
  const oldKit = await context.kitAt(baseVersion);
384
437
  const entriesKit = options.wholeKit ? target : oldKit;
438
+ const required = [];
439
+ const sources = {};
385
440
  const unit = {
386
441
  unit: "base",
387
442
  fromVersion: baseVersion,
@@ -391,7 +446,9 @@ async function planBaseUnit(context, options) {
391
446
  skipped: false,
392
447
  removedFromKit: false,
393
448
  notes: [],
394
- straySkips: 0
449
+ straySkips: 0,
450
+ required,
451
+ sources
395
452
  };
396
453
  const entryScript = config.language === "ts" ? "index.ts" : "index.js";
397
454
  const generated = /* @__PURE__ */ new Set([
@@ -401,30 +458,70 @@ async function planBaseUnit(context, options) {
401
458
  "head.html"
402
459
  ]);
403
460
  const removed = new Set(options.removedPrimitives.map((plan) => plan.unit));
404
- const beforeVersions = new Map(Object.entries(config.primitives).map(([name, entry]) => [name, entry.version]));
461
+ const beforeVersions = new Map(Object.entries(config.base.entries ?? Object.fromEntries(Object.entries(config.primitives).map(([name, entry]) => [name, entry.version]))));
405
462
  const afterVersions = new Map([...options.primitiveVersionAfter].filter(([name]) => !removed.has(name)));
406
463
  const entriesBefore = await entrySources(context, oldKit, beforeVersions);
407
464
  const entriesAfter = await entrySources(context, entriesKit, afterVersions);
408
465
  const afterEntries = [];
466
+ const neededFrom = /* @__PURE__ */ new Map();
409
467
  for (const [name, primitiveVersion] of afterVersions) {
410
- const entry = (await context.kitAt(primitiveVersion)).manifest.primitives[name];
411
- if (entry) afterEntries.push(entry);
468
+ const kit = await context.kitAt(primitiveVersion);
469
+ const entry = kit.manifest.primitives[name];
470
+ if (!entry) continue;
471
+ afterEntries.push(entry);
472
+ for (const file of baseScriptFiles([entry], config.language)) if (!neededFrom.has(file) || kit === target) neededFrom.set(file, kit);
412
473
  }
413
474
  const neededScripts = baseScriptFiles(afterEntries, config.language);
475
+ const ancestorVersion = (file) => config.base.sources?.[file] ?? baseVersion;
476
+ const ancestor = async (file) => readKitFile(await context.kitAt(ancestorVersion(file)), file);
414
477
  const vendorable = options.wholeKit ? [.../* @__PURE__ */ new Set([
415
478
  ...Object.keys(config.base.files).filter((file) => !generated.has(file)),
416
479
  ...baseFiles(target.manifest, config.language),
417
480
  ...neededScripts
418
- ])] : neededScripts.filter((file) => !(file in config.base.files));
481
+ ])].filter((file) => !options.claimed.has(file)) : neededScripts.filter((file) => !(file in config.base.files));
419
482
  if (!options.wholeKit) {
420
- for (const [file, hash] of Object.entries(config.base.files)) if (!generated.has(file)) unit.hashes[file] = hash;
483
+ for (const [file, hash] of Object.entries(config.base.files)) if (!generated.has(file) && !options.claimed.has(file)) unit.hashes[file] = hash;
484
+ Object.assign(sources, config.base.sources);
485
+ }
486
+ const origin = /* @__PURE__ */ new Map();
487
+ const theirs = async (file) => {
488
+ const kits = options.wholeKit ? [target, neededFrom.get(file)] : [oldKit, target];
489
+ for (const kit of kits) {
490
+ const content = kit ? await readKitFile(kit, file) : null;
491
+ if (content !== null) {
492
+ origin.set(file, kit?.version ?? baseVersion);
493
+ return content;
494
+ }
495
+ }
496
+ return null;
497
+ };
498
+ for (const file of neededScripts) {
499
+ const dest = destPath(context, file);
500
+ if (file in config.base.files || existsSync(dest)) continue;
501
+ const content = await theirs(file);
502
+ if (content === null) continue;
503
+ required.push({
504
+ file,
505
+ hash: sha256(content),
506
+ source: origin.get(file) ?? baseVersion,
507
+ write: {
508
+ dest,
509
+ content,
510
+ note: "vendor"
511
+ }
512
+ });
513
+ }
514
+ for (const file of vendorable) {
515
+ if (!await resolveFile(unit, context, {
516
+ file,
517
+ recordedHash: config.base.files[file] ?? null,
518
+ base: () => ancestor(file),
519
+ baseLabel: ancestorVersion(file),
520
+ theirs: () => theirs(file)
521
+ })) return unit;
522
+ const source = origin.get(file);
523
+ if (file in unit.hashes && source !== void 0) sources[file] = source;
421
524
  }
422
- for (const file of vendorable) if (!await resolveFile(unit, context, {
423
- file,
424
- recordedHash: config.base.files[file] ?? null,
425
- base: () => readKitFile(oldKit, file),
426
- theirs: () => readKitFile(options.wholeKit ? target : oldKit, file)
427
- })) return unit;
428
525
  for (const file of ["index.css", entryScript]) if (!await resolveFile(unit, context, {
429
526
  file,
430
527
  recordedHash: config.base.files[file] ?? null,
@@ -484,7 +581,7 @@ async function resolveFile(unit, context, input) {
484
581
  const base = await input.base();
485
582
  const labels = {
486
583
  ours: "yours",
487
- base: unit.fromVersion,
584
+ base: input.baseLabel ?? unit.fromVersion,
488
585
  theirs: context.target.version
489
586
  };
490
587
  const disposition = classify({
@@ -651,6 +748,17 @@ async function resolveConflict(unit, context, file) {
651
748
  default: return true;
652
749
  }
653
750
  }
751
+ /**
752
+ * @description The kit files a script imports, without their extension
753
+ * (`base/engine`). Block comments and commented-out lines do not count; both
754
+ * sides of an unresolved conflict do, so nothing either side needs is deleted.
755
+ */
756
+ function importedStems(source) {
757
+ const code = source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/.*$/gm, "");
758
+ const stems = /* @__PURE__ */ new Set();
759
+ for (const match of code.matchAll(/\b(?:import|from)\s*\(?\s*["']\.\/([^"']+?)(?:\.d\.ts|\.js|\.ts)["']/g)) if (match[1] !== void 0) stems.add(match[1]);
760
+ return stems;
761
+ }
654
762
  function destPath(context, file) {
655
763
  return path.join(context.root, context.config.dir, ...file.split("/"));
656
764
  }
@@ -666,5 +774,4 @@ async function readChangelog(kit) {
666
774
  }
667
775
  }
668
776
 
669
- //#endregion
670
- export { compareVersions as a, isBinary as i, runUpdate as n, sliceChangelog as o, splitVersionArgs as r, readChangelog as t };
777
+ export { isBinary as a, splitVersionArgs as i, readChangelog as n, compareVersions as o, runUpdate as r, sliceChangelog as s, importedStems as t };
@@ -1,4 +1,4 @@
1
- import { i as offlineMiss, n as kitTooNew, r as kitTooOld, t as ZazzError } from "./errors-DC2U2USS.js";
1
+ import { i as offlineMiss, n as kitTooNew, r as kitTooOld, t as ZazzError } from "./errors--aALbpFB.js";
2
2
  import chalk from "chalk";
3
3
  import { existsSync } from "node:fs";
4
4
  import { mkdir, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
@@ -9,7 +9,7 @@ import os from "node:os";
9
9
  import * as clack from "@clack/prompts";
10
10
  import { createHash } from "node:crypto";
11
11
 
12
- //#region src/collisions.ts
12
+ // src/collisions.ts
13
13
  /**
14
14
  * @fileoverview The stray-file collision prompt, shared by every
15
15
  * command that writes files it has no provenance record for.
@@ -39,8 +39,7 @@ async function filterCollisions(writes, context) {
39
39
  };
40
40
  }
41
41
 
42
- //#endregion
43
- //#region src/config.ts
42
+ // src/config.ts
44
43
  /**
45
44
  * @fileoverview `zazz.json` — the project's vendoring provenance record.
46
45
  * @description One file at the project root records what was vendored, from
@@ -95,7 +94,9 @@ function serializeConfig(config) {
95
94
  },
96
95
  base: {
97
96
  ...config.base.version !== void 0 ? { version: config.base.version } : {},
98
- files: sortKeys(config.base.files)
97
+ files: sortKeys(config.base.files),
98
+ ...Object.keys(config.base.sources ?? {}).length > 0 ? { sources: sortKeys(config.base.sources ?? {}) } : {},
99
+ ...config.base.entries !== void 0 ? { entries: sortKeys(config.base.entries) } : {}
99
100
  },
100
101
  primitives: Object.fromEntries(Object.keys(config.primitives).sort().map((name) => {
101
102
  const entry = config.primitives[name];
@@ -128,6 +129,8 @@ function validateConfig(raw, source) {
128
129
  const base = config.base;
129
130
  if (typeof base !== "object" || base === null || !isFileHashes(base.files)) fail("base.files missing");
130
131
  if (base && base.version !== void 0 && typeof base.version !== "string") fail("base.version must be a string");
132
+ if (base && base.sources !== void 0 && !isFileHashes(base.sources)) fail("base.sources must map files to versions");
133
+ if (base && base.entries !== void 0 && !isFileHashes(base.entries)) fail("base.entries must map primitives to versions");
131
134
  const primitives = config.primitives;
132
135
  if (typeof primitives !== "object" || primitives === null) fail("primitives missing");
133
136
  for (const [name, entry] of Object.entries(primitives)) {
@@ -137,11 +140,10 @@ function validateConfig(raw, source) {
137
140
  return raw;
138
141
  }
139
142
  function isFileHashes(value) {
140
- return typeof value === "object" && value !== null && Object.values(value).every((hash) => typeof hash === "string");
143
+ return typeof value === "object" && value !== null && !Array.isArray(value) && Object.values(value).every((hash) => typeof hash === "string");
141
144
  }
142
145
 
143
- //#endregion
144
- //#region src/kit.ts
146
+ // src/kit.ts
145
147
  /**
146
148
  * @fileoverview The kit engine: npm tarball → validated, importable kit.
147
149
  * @description Resolves a `@zazz-ui/core` spec through pacote (npm-identical
@@ -190,7 +192,7 @@ function isFileSpec(spec) {
190
192
  async function resolveKit(spec, fetch) {
191
193
  const fileSpec = isFileSpec(spec);
192
194
  const exact = !fileSpec && EXACT_VERSION.test(spec.slice(14));
193
- const options = {
195
+ let options = {
194
196
  ...fetch,
195
197
  preferOffline: exact || fetch.offline === true
196
198
  };
@@ -199,7 +201,17 @@ async function resolveKit(spec, fetch) {
199
201
  manifest = await pacote.manifest(spec, options);
200
202
  } catch (error) {
201
203
  if (fetch.offline || fetch.preferOffline) throw offlineMiss(spec);
202
- throw new ZazzError(`could not resolve ${spec}: ${error.message}`);
204
+ if (!exact) throw new ZazzError(`could not resolve ${spec}: ${error.message}`);
205
+ options = {
206
+ ...fetch,
207
+ preferOffline: false,
208
+ preferOnline: true
209
+ };
210
+ try {
211
+ manifest = await pacote.manifest(spec, options);
212
+ } catch (retry) {
213
+ throw new ZazzError(`could not resolve ${spec}: ${retry.message}`);
214
+ }
203
215
  }
204
216
  const version = manifest.version;
205
217
  const integrity = manifest.dist?.integrity ?? manifest._integrity ?? "";
@@ -261,6 +273,7 @@ async function loadKitFromDir(extractDir, meta) {
261
273
  if (typeof primitives !== "object" || primitives === null || !Array.isArray(cascade) || typeof resolveClosure !== "function" || typeof buildHead !== "function") throw kitTooNew(meta.version, "its manifest shape is unrecognized");
262
274
  const baseCssPre = manifestModule.BASE_CSS_PRE;
263
275
  const baseCssPost = manifestModule.BASE_CSS_POST;
276
+ const baseData = manifestModule.BASE_DATA;
264
277
  const coreRuntime = manifestModule.CORE_RUNTIME;
265
278
  const corePolyfills = manifestModule.CORE_POLYFILLS;
266
279
  const coreFallbacks = Array.isArray(manifestModule.CORE_FALLBACKS) ? manifestModule.CORE_FALLBACKS.filter(isRuntimeFallback) : [];
@@ -275,6 +288,7 @@ async function loadKitFromDir(extractDir, meta) {
275
288
  resolveClosure,
276
289
  ...Array.isArray(baseCssPre) ? { baseCssPre } : {},
277
290
  ...Array.isArray(baseCssPost) ? { baseCssPost } : {},
291
+ ...Array.isArray(baseData) ? { baseData } : {},
278
292
  ...Array.isArray(coreRuntime) ? { coreRuntime } : {},
279
293
  ...Array.isArray(corePolyfills) && corePolyfills.every(isRuntimePolyfill) ? { corePolyfills } : {},
280
294
  ...coreFallbacks.length > 0 ? { coreFallbacks } : {}
@@ -301,8 +315,7 @@ function resolveWithin(root, relative) {
301
315
  return resolved;
302
316
  }
303
317
 
304
- //#endregion
305
- //#region src/npmrc.ts
318
+ // src/npmrc.ts
306
319
  /**
307
320
  * @fileoverview npm configuration → pacote options.
308
321
  * @description Loads the user's real npm config through `@npmcli/config`
@@ -350,8 +363,7 @@ async function loadFetchOptions(flags) {
350
363
  return options;
351
364
  }
352
365
 
353
- //#endregion
354
- //#region src/plan.ts
366
+ // src/plan.ts
355
367
  /** The v1 base stylesheet inventory (kit `src/index.css` cascade shell). */
356
368
  const V1_BASE_CSS_PRE = [
357
369
  "base/_layers.css",
@@ -396,14 +408,16 @@ function scriptVariants(jsPath, language) {
396
408
  return [jsPath, jsPath.replace(/\.js$/, ".d.ts")];
397
409
  }
398
410
  /**
399
- * Everything `init` vendors: base css + core runtime, its polyfills, and its
400
- * fallbacks, per language. TypeScript also gets the ambient `globals.d.ts`
401
- * the sources type-check against (the emitted `.d.ts` files don't need it).
411
+ * Everything `init` vendors: base css, the definitions' data files, the core
412
+ * runtime, its polyfills, and its fallbacks, per language. TypeScript also gets
413
+ * the ambient `globals.d.ts` the sources type-check against (the emitted
414
+ * `.d.ts` files don't need it).
402
415
  */
403
416
  function baseFiles(manifest, language) {
404
417
  return [
405
418
  ...language === "ts" ? ["globals.d.ts"] : [],
406
419
  ...baseCss(manifest),
420
+ ...manifest.baseData ?? [],
407
421
  ...[
408
422
  ...coreRuntime(manifest),
409
423
  ...corePolyfills(manifest).map((polyfill) => polyfill.file),
@@ -416,6 +430,7 @@ function primitiveFiles(entry, language, options) {
416
430
  return [
417
431
  ...entry.css,
418
432
  ...entry.js.flatMap((jsPath) => scriptVariants(jsPath, language)),
433
+ ...entry.data ? [entry.data] : [],
419
434
  ...options.examples ? entry.examples : []
420
435
  ];
421
436
  }
@@ -431,8 +446,7 @@ function baseScriptFiles(entries, language) {
431
446
  return files;
432
447
  }
433
448
 
434
- //#endregion
435
- //#region src/transaction.ts
449
+ // src/transaction.ts
436
450
  /**
437
451
  * @fileoverview Staged, near-atomic application of a command's write plan.
438
452
  * @description Every prompt is answered and every merge resolved before a
@@ -474,8 +488,7 @@ async function apply(tx) {
474
488
  await saveConfig(tx.root, tx.config);
475
489
  }
476
490
 
477
- //#endregion
478
- //#region src/ui.ts
491
+ // src/ui.ts
479
492
  /**
480
493
  * @fileoverview The CLI's voice: clack prompts and spinners behind one
481
494
  * injectable interface.
@@ -559,8 +572,7 @@ function createUi(options) {
559
572
  };
560
573
  }
561
574
 
562
- //#endregion
563
- //#region src/vendor.ts
575
+ // src/vendor.ts
564
576
  /**
565
577
  * @fileoverview Vendoring: pristine tarball bytes → write entries + hashes.
566
578
  * @description Reads each planned file's exact published bytes from the
@@ -598,8 +610,7 @@ async function vendorFiles(kit, files, destRoot) {
598
610
  };
599
611
  }
600
612
 
601
- //#endregion
602
- //#region src/wiring.ts
613
+ // src/wiring.ts
603
614
  /** The insertion anchor `add` looks for in an untouched index.css. */
604
615
  const PRIMITIVES_MARKER = "/* Zazz primitives — zazz-ui add inserts imports here in cascade order. */";
605
616
  const LEGACY_SLOT_COMMENT = "/* Legacy layer — import your legacy stylesheets into layer(legacy.imports) here: */\n/* @import \"./your-legacy.css\" layer(legacy.imports); */";
@@ -727,5 +738,4 @@ function renderHead(kit, config) {
727
738
  })}\n`;
728
739
  }
729
740
 
730
- //#endregion
731
- export { resolveKit as _, renderIndexJs as a, createUi as c, baseCssSplit as d, baseFiles as f, kitSpec as g, loadFetchOptions as h, renderIndexCss as i, apply as l, primitiveFiles as m, insertCssImports as n, sha256 as o, baseScriptFiles as p, renderHead as r, vendorFiles as s, appendJsImports as t, describe as u, loadConfig as v, filterCollisions as y };
741
+ export { resolveKit as _, renderIndexJs as a, filterCollisions as b, createUi as c, baseCssSplit as d, baseFiles as f, kitSpec as g, loadFetchOptions as h, renderIndexCss as i, apply as l, primitiveFiles as m, insertCssImports as n, sha256 as o, baseScriptFiles as p, renderHead as r, vendorFiles as s, appendJsImports as t, describe as u, CONFIG_NAME as v, loadConfig as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zazz-ui",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "CLI for the Zazz Design Framework — vendors primitives from @zazz-ui/core into your project, with provenance-tracked updates.",
5
5
  "keywords": [
6
6
  "cli",
@@ -45,9 +45,8 @@
45
45
  "@types/pacote": "^11.1.8",
46
46
  "tar": "^7.5.22",
47
47
  "typescript": "^7.0.2",
48
- "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
49
- "vite-plus": "1.3.0",
50
- "vitest": "5.0.5"
48
+ "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
49
+ "vite-plus": "1.7.0"
51
50
  },
52
51
  "engines": {
53
52
  "node": "^22.22.2 || ^24.15.0 || >=26.0.0"
@@ -1,3 +0,0 @@
1
- import { n as runInit, t as parseVersionArg } from "./init-m26gsqEa.js";
2
-
3
- export { runInit };
@@ -1,3 +0,0 @@
1
- import { n as runUpdate, r as splitVersionArgs, t as readChangelog } from "./update-CaIG25mx.js";
2
-
3
- export { runUpdate };