@animus-ui/cli 0.1.25 → 0.1.27

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 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAQA,OAAO,EAIL,iBAAiB,EAKlB,MAAM,4BAA4B,CAAC;AAcpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAC/C,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAC1C,qBAAa,kBAAmB,SAAQ,KAAK;CAAG;AAEhD,eAAO,MAAM,GAAG,aAAc,OAAO,EAAE,KAAG,IACL,CAAC;AAEtC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;qCACqC;AACrC,wBAAsB,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB3E;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAsC7E;AAED,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,iBAAiB,GACzB,cAAc,CA+DhB;AAqBD,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,iBAAiB,GAAG,IAAI,EAC1C,WAAW,EAAE,MAAM,IAAI,GACtB,MAAM,IAAI,CAOZ;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,iBAAiB,GACzB,IAAI,CAgBN;AAED,MAAM,WAAW,UAAU;IACzB,iDAAiD;IACjD,GAAG,CA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;IACjD,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAgBD,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,KAAK,GAAE,UAAe,GACrB,OAAO,CAAC,WAAW,CAAC,CAwDtB"}
package/dist/config.d.ts CHANGED
@@ -50,6 +50,7 @@ export declare function projectResolvedConfig(config: ResolvedCliConfig): {
50
50
  layers: string[] | null;
51
51
  extensions: string[] | null;
52
52
  staticCss: StaticCssConfig | null;
53
+ runtimeImport: string | null;
53
54
  exclude: readonly string[];
54
55
  provenance: Record<string, OptionProvenance>;
55
56
  };
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,eAAe,EAEf,gBAAgB,EAEhB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AAErC,eAAO,MAAM,gBAAgB,YAC3B,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CACV,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,aAAa,GAAG,YAAY,GAAG,KAAK,CAAC;AAE1E,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE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MAAM;IACN,UAAU;IACV,SAAS;IACT,aAAa;IACb,OAAO;IACP,UAAU;EAEb"}
package/dist/index.cjs CHANGED
@@ -263,29 +263,27 @@ async function runPreflight(config) {
263
263
  }
264
264
  function createCliSession(config) {
265
265
  const { root, outDir, options } = config;
266
- const session = new _animus_ui_extract_session.ExtractionSession(options);
266
+ const session = new _animus_ui_extract_session.ExtractionSession(options, { noBundler: true });
267
267
  const relOut = (0, path.relative)(root, outDir);
268
268
  if (relOut === "") throw new UsageFailure(`The artifact directory is the root itself (${outDir}) — the published ${STYLES_FILE}/${SYSTEM_PROPS_FILE}/${MANIFEST_FILE} would be re-ingested as source on the next run. Pass --out-dir with a subdirectory (the default is ${_animus_ui_extract_session.ANIMUS_ARTIFACT_DIR}) or point --root at the source tree.`);
269
- if (!relOut.startsWith("..") && !config.excludePatterns.some((p) => relOut.includes(p) || p === relOut)) {
270
- const anchored = `${relOut.split("\\").join("/")}/**`;
271
- session.structuralExclude = [anchored];
272
- err(`outDir ${relOut} is inside the root — auto-excluded from discovery (pattern '${anchored}')`);
269
+ const outputDir = (0, _animus_ui_extract_pipeline.outputExclusion)(root, outDir);
270
+ if (outputDir !== null) {
271
+ session.structuralExclude = [outputDir];
272
+ err(`outDir ${relOut} is inside the root — auto-excluded from discovery (directory '${outputDir}')`);
273
273
  }
274
274
  session.driverLabel = "animus";
275
275
  session.rootDir = root;
276
276
  session.staleAssetPruning = "every-cycle";
277
- const aliasPairs = (0, _animus_ui_extract_pipeline.readTsconfigAliasPairs)(root);
278
- const builtAliases = (0, _animus_ui_extract_pipeline.buildPathAliasesJson)(aliasPairs, root);
279
- if (builtAliases) session.pathAliasesJson = builtAliases.json;
277
+ session.aliasesFromTsconfig = true;
280
278
  return session;
281
279
  }
282
280
  function publishSharedPayloads(config, session) {
283
281
  const { root, outDir, options } = config;
284
- const fileCount = (0, _animus_ui_extract_session.getAnalyzedHashes)()?.size ?? 0;
282
+ const fileCount = (0, _animus_ui_extract_session.getAnalyzedHashes)(session.key)?.size ?? 0;
285
283
  if (fileCount === 0) throw new ExtractionFailure(`Discovery found zero source files under ${root} (exclusions: ${config.excludePatterns.join(", ")})`);
286
- const manifestJson = (0, _animus_ui_extract_session.getManifestJson)() ?? "";
287
- const stylesCss = (0, _animus_ui_extract_session.getSharedCss)();
288
- const systemPropsJs = (0, _animus_ui_extract_session.getSharedSystemProps)();
284
+ const manifestJson = (0, _animus_ui_extract_session.getManifestJson)(session.key) ?? "";
285
+ const stylesCss = (0, _animus_ui_extract_session.getSharedCss)(session.key);
286
+ const systemPropsJs = (0, _animus_ui_extract_session.getSharedSystemProps)(session.key);
289
287
  let componentCount = session.lastComponentCount ?? -1;
290
288
  if (componentCount < 0) try {
291
289
  const manifest = JSON.parse(manifestJson);
@@ -345,13 +343,11 @@ function createRunClaimRelease(getSession, releaseLock) {
345
343
  }
346
344
  function reportDiscoveryOutcomes(config, session) {
347
345
  for (const { specifier, outcome, fileCount: files } of session.lastExternalOutcomes) err(`include '${specifier}': ${outcome}${outcome === "resolved" ? ` (${files} files)` : ""}`);
348
- const stats = session.getExcludeStats();
349
- for (const pattern of config.options.exclude ?? []) if ((stats.get(pattern) ?? 0) === 0) err(`exclude pattern '${pattern}' matched nothing`);
350
346
  }
351
347
  /** Writes the analysed kit's descriptor at the root, from the manifest the
352
348
  * build published. */
353
- function writeKitDescriptor(root) {
354
- const manifest = JSON.parse((0, _animus_ui_extract_session.getManifestJson)() ?? "");
349
+ function writeKitDescriptor(root, key) {
350
+ const manifest = JSON.parse((0, _animus_ui_extract_session.getManifestJson)(key) ?? "");
355
351
  const path$2 = (0, path.join)(root, _animus_ui_extract_pipeline.KIT_DESCRIPTOR_FILE);
356
352
  (0, fs.writeFileSync)(path$2, `${JSON.stringify((0, _animus_ui_extract_pipeline.buildKitDescriptor)(manifest), null, 2)}\n`);
357
353
  return path$2;
@@ -376,9 +372,9 @@ async function runBuild(config, flags = {}) {
376
372
  }
377
373
  const { componentCount, fileCount } = publishSharedPayloads(config, session);
378
374
  if (flags.kit) {
379
- const failures = (0, _animus_ui_extract_pipeline.kitPublicationFailures)(config.root, (0, _animus_ui_extract_session.engineApi)(), config.outDir);
375
+ const failures = (0, _animus_ui_extract_pipeline.kitPublicationFailures)(config.root, (0, _animus_ui_extract_session.engineApi)(session.key), config.outDir);
380
376
  if (failures.length > 0) throw new ExtractionFailure(`the kit is not ready to publish: an installed consumer would fail on missing source, or receive this build's artifacts:\n${failures.map((line) => ` - ${line}`).join("\n")}`);
381
- err(`kit descriptor → ${writeKitDescriptor(config.root)}`);
377
+ err(`kit descriptor → ${writeKitDescriptor(config.root, session.key)}`);
382
378
  }
383
379
  reportDiscoveryOutcomes(config, session);
384
380
  err(`build complete: ${componentCount} components from ${fileCount} files → ${outDir}`);
@@ -454,7 +450,7 @@ function configDiagnostics(value) {
454
450
  return Object.fromEntries(Object.entries(value).filter((entry) => isConfigString(entry[1]) && _animus_ui_extract_pipeline.DIAGNOSTIC_LEVELS.has(entry[1])));
455
451
  }
456
452
  function parseLoadedCliConfig(raw) {
457
- (0, _animus_ui_extract_pipeline.assertNoRetiredEngineSelection)(isConfigString(raw.engine) ? raw.engine : void 0);
453
+ (0, _animus_ui_extract_pipeline.assertSupportedEngine)(isConfigString(raw.engine) ? raw.engine : void 0);
458
454
  (0, _animus_ui_extract_pipeline.assertKnownOptionKeys)(raw);
459
455
  const cliValue = raw.cli;
460
456
  const cli = isConfigRecord(cliValue) ? cliValue : {};
@@ -474,6 +470,7 @@ function parseLoadedCliConfig(raw) {
474
470
  minify: isConfigBoolean(raw.minify) ? raw.minify : void 0,
475
471
  staticCss: configStaticCss(raw.staticCss),
476
472
  layers: isConfigStringArray(raw.layers) ? raw.layers : void 0,
473
+ runtimeImport: isConfigString(raw.runtimeImport) ? raw.runtimeImport : void 0,
477
474
  mode: raw.mode === "development" || raw.mode === "production" ? raw.mode : void 0
478
475
  },
479
476
  cli: { outDir: cli.outDir }
@@ -566,6 +563,7 @@ async function resolveCliConfig(flags, cwd) {
566
563
  minify: pick("minify", void 0),
567
564
  staticCss: pick("staticCss", void 0),
568
565
  layers: pick("layers", void 0),
566
+ runtimeImport: pick("runtimeImport", void 0),
569
567
  mode: resolvedMode.mode
570
568
  };
571
569
  const excludePatterns = (0, _animus_ui_extract_pipeline.createExcludeMatcher)(options.exclude).patterns;
@@ -605,6 +603,7 @@ function projectResolvedConfig(config) {
605
603
  layers: config.options.layers ?? null,
606
604
  extensions: config.options.extensions ?? null,
607
605
  staticCss: config.options.staticCss ?? null,
606
+ runtimeImport: config.options.runtimeImport ?? null,
608
607
  exclude: config.excludePatterns,
609
608
  provenance: config.provenance
610
609
  };
@@ -643,11 +642,11 @@ function formatCyclePublishFailure(outDir, error) {
643
642
  if (error instanceof PublishSwapIncompleteError) return `watch cycle publication failed mid-swap — ${outDir} is NOT last-good: ${String(error)}`;
644
643
  return `watch cycle publication rejected — keeping last-good artifacts in ${outDir}: ${String(error)}`;
645
644
  }
646
- function currentPayloadKey() {
645
+ function currentPayloadKey(key) {
647
646
  return [
648
- (0, _animus_ui_extract_pipeline.contentHash)((0, _animus_ui_extract_session.getManifestJson)() ?? ""),
649
- (0, _animus_ui_extract_pipeline.contentHash)((0, _animus_ui_extract_session.getSharedCss)()),
650
- (0, _animus_ui_extract_pipeline.contentHash)((0, _animus_ui_extract_session.getSharedSystemProps)())
647
+ (0, _animus_ui_extract_pipeline.contentHash)((0, _animus_ui_extract_session.getManifestJson)(key) ?? ""),
648
+ (0, _animus_ui_extract_pipeline.contentHash)((0, _animus_ui_extract_session.getSharedCss)(key)),
649
+ (0, _animus_ui_extract_pipeline.contentHash)((0, _animus_ui_extract_session.getSharedSystemProps)(key))
651
650
  ].join(":");
652
651
  }
653
652
  /** Resolves with the process exit code at shutdown. Startup failures throw,
@@ -686,7 +685,7 @@ async function runWatch(config, flags) {
686
685
  const { session, claim } = startup;
687
686
  let lastPublication = startup.publication;
688
687
  let publications = 1;
689
- let lastPublishedKey = currentPayloadKey();
688
+ let lastPublishedKey = currentPayloadKey(session.key);
690
689
  return new Promise((resolvePromise) => {
691
690
  const keepalive = setInterval(() => {}, 2 ** 30);
692
691
  let shuttingDown = null;
@@ -752,7 +751,7 @@ async function runWatch(config, flags) {
752
751
  err(`watch cycle failed — keeping last-good artifacts in ${outDir}: ${String(cause)}`);
753
752
  return;
754
753
  }
755
- const key = currentPayloadKey();
754
+ const key = currentPayloadKey(session.key);
756
755
  if (key === lastPublishedKey) return;
757
756
  let outcome;
758
757
  try {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { AnimusConfigError, DIAGNOSTIC_LEVELS, KIT_DESCRIPTOR_FILE, REPLACEABLE_DEFAULT_EXCLUDE, STRUCTURAL_EXCLUDE, assertKnownOptionKeys, assertNoRetiredEngineSelection, buildKitDescriptor, buildPathAliasesJson, contentHash, createExcludeMatcher, kitPublicationFailures, readTsconfigAliasPairs, resolveMode, runStructuralSelfCheck } from "@animus-ui/extract/pipeline";
1
+ import { AnimusConfigError, DIAGNOSTIC_LEVELS, KIT_DESCRIPTOR_FILE, REPLACEABLE_DEFAULT_EXCLUDE, STRUCTURAL_EXCLUDE, assertKnownOptionKeys, assertSupportedEngine, buildKitDescriptor, contentHash, createExcludeMatcher, kitPublicationFailures, outputExclusion, resolveMode, runStructuralSelfCheck } from "@animus-ui/extract/pipeline";
2
2
  import { parseArgs } from "node:util";
3
3
  import { ANIMUS_ARTIFACT_DIR, CLI_COMMIT_ARTIFACT, CLI_LOCK_ARTIFACT, ExtractionSession, MANIFEST_ARTIFACT, SESSION_ASSETS_DIR, STYLES_ARTIFACT, SYSTEM_PROPS_ARTIFACT, checkLockLiveness, collectSessionAssets, decodeCommitRecord, engineApi, getAnalyzedHashes, getManifestJson, getSharedCss, getSharedSystemProps, holdDirectoryClaim, isLockHolderAlive, lockRecordBytes, readCliLockRecord, startTurbopackWatcher, verifyCommitRecord } from "@animus-ui/extract/session";
4
4
  import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from "fs";
@@ -262,29 +262,27 @@ async function runPreflight(config) {
262
262
  }
263
263
  function createCliSession(config) {
264
264
  const { root, outDir, options } = config;
265
- const session = new ExtractionSession(options);
265
+ const session = new ExtractionSession(options, { noBundler: true });
266
266
  const relOut = relative(root, outDir);
267
267
  if (relOut === "") throw new UsageFailure(`The artifact directory is the root itself (${outDir}) — the published ${STYLES_FILE}/${SYSTEM_PROPS_FILE}/${MANIFEST_FILE} would be re-ingested as source on the next run. Pass --out-dir with a subdirectory (the default is ${ANIMUS_ARTIFACT_DIR}) or point --root at the source tree.`);
268
- if (!relOut.startsWith("..") && !config.excludePatterns.some((p) => relOut.includes(p) || p === relOut)) {
269
- const anchored = `${relOut.split("\\").join("/")}/**`;
270
- session.structuralExclude = [anchored];
271
- err(`outDir ${relOut} is inside the root — auto-excluded from discovery (pattern '${anchored}')`);
268
+ const outputDir = outputExclusion(root, outDir);
269
+ if (outputDir !== null) {
270
+ session.structuralExclude = [outputDir];
271
+ err(`outDir ${relOut} is inside the root — auto-excluded from discovery (directory '${outputDir}')`);
272
272
  }
273
273
  session.driverLabel = "animus";
274
274
  session.rootDir = root;
275
275
  session.staleAssetPruning = "every-cycle";
276
- const aliasPairs = readTsconfigAliasPairs(root);
277
- const builtAliases = buildPathAliasesJson(aliasPairs, root);
278
- if (builtAliases) session.pathAliasesJson = builtAliases.json;
276
+ session.aliasesFromTsconfig = true;
279
277
  return session;
280
278
  }
281
279
  function publishSharedPayloads(config, session) {
282
280
  const { root, outDir, options } = config;
283
- const fileCount = getAnalyzedHashes()?.size ?? 0;
281
+ const fileCount = getAnalyzedHashes(session.key)?.size ?? 0;
284
282
  if (fileCount === 0) throw new ExtractionFailure(`Discovery found zero source files under ${root} (exclusions: ${config.excludePatterns.join(", ")})`);
285
- const manifestJson = getManifestJson() ?? "";
286
- const stylesCss = getSharedCss();
287
- const systemPropsJs = getSharedSystemProps();
283
+ const manifestJson = getManifestJson(session.key) ?? "";
284
+ const stylesCss = getSharedCss(session.key);
285
+ const systemPropsJs = getSharedSystemProps(session.key);
288
286
  let componentCount = session.lastComponentCount ?? -1;
289
287
  if (componentCount < 0) try {
290
288
  const manifest = JSON.parse(manifestJson);
@@ -344,13 +342,11 @@ function createRunClaimRelease(getSession, releaseLock) {
344
342
  }
345
343
  function reportDiscoveryOutcomes(config, session) {
346
344
  for (const { specifier, outcome, fileCount: files } of session.lastExternalOutcomes) err(`include '${specifier}': ${outcome}${outcome === "resolved" ? ` (${files} files)` : ""}`);
347
- const stats = session.getExcludeStats();
348
- for (const pattern of config.options.exclude ?? []) if ((stats.get(pattern) ?? 0) === 0) err(`exclude pattern '${pattern}' matched nothing`);
349
345
  }
350
346
  /** Writes the analysed kit's descriptor at the root, from the manifest the
351
347
  * build published. */
352
- function writeKitDescriptor(root) {
353
- const manifest = JSON.parse(getManifestJson() ?? "");
348
+ function writeKitDescriptor(root, key) {
349
+ const manifest = JSON.parse(getManifestJson(key) ?? "");
354
350
  const path = join(root, KIT_DESCRIPTOR_FILE);
355
351
  writeFileSync(path, `${JSON.stringify(buildKitDescriptor(manifest), null, 2)}\n`);
356
352
  return path;
@@ -375,9 +371,9 @@ async function runBuild(config, flags = {}) {
375
371
  }
376
372
  const { componentCount, fileCount } = publishSharedPayloads(config, session);
377
373
  if (flags.kit) {
378
- const failures = kitPublicationFailures(config.root, engineApi(), config.outDir);
374
+ const failures = kitPublicationFailures(config.root, engineApi(session.key), config.outDir);
379
375
  if (failures.length > 0) throw new ExtractionFailure(`the kit is not ready to publish: an installed consumer would fail on missing source, or receive this build's artifacts:\n${failures.map((line) => ` - ${line}`).join("\n")}`);
380
- err(`kit descriptor → ${writeKitDescriptor(config.root)}`);
376
+ err(`kit descriptor → ${writeKitDescriptor(config.root, session.key)}`);
381
377
  }
382
378
  reportDiscoveryOutcomes(config, session);
383
379
  err(`build complete: ${componentCount} components from ${fileCount} files → ${outDir}`);
@@ -453,7 +449,7 @@ function configDiagnostics(value) {
453
449
  return Object.fromEntries(Object.entries(value).filter((entry) => isConfigString(entry[1]) && DIAGNOSTIC_LEVELS.has(entry[1])));
454
450
  }
455
451
  function parseLoadedCliConfig(raw) {
456
- assertNoRetiredEngineSelection(isConfigString(raw.engine) ? raw.engine : void 0);
452
+ assertSupportedEngine(isConfigString(raw.engine) ? raw.engine : void 0);
457
453
  assertKnownOptionKeys(raw);
458
454
  const cliValue = raw.cli;
459
455
  const cli = isConfigRecord(cliValue) ? cliValue : {};
@@ -473,6 +469,7 @@ function parseLoadedCliConfig(raw) {
473
469
  minify: isConfigBoolean(raw.minify) ? raw.minify : void 0,
474
470
  staticCss: configStaticCss(raw.staticCss),
475
471
  layers: isConfigStringArray(raw.layers) ? raw.layers : void 0,
472
+ runtimeImport: isConfigString(raw.runtimeImport) ? raw.runtimeImport : void 0,
476
473
  mode: raw.mode === "development" || raw.mode === "production" ? raw.mode : void 0
477
474
  },
478
475
  cli: { outDir: cli.outDir }
@@ -565,6 +562,7 @@ async function resolveCliConfig(flags, cwd) {
565
562
  minify: pick("minify", void 0),
566
563
  staticCss: pick("staticCss", void 0),
567
564
  layers: pick("layers", void 0),
565
+ runtimeImport: pick("runtimeImport", void 0),
568
566
  mode: resolvedMode.mode
569
567
  };
570
568
  const excludePatterns = createExcludeMatcher(options.exclude).patterns;
@@ -604,6 +602,7 @@ function projectResolvedConfig(config) {
604
602
  layers: config.options.layers ?? null,
605
603
  extensions: config.options.extensions ?? null,
606
604
  staticCss: config.options.staticCss ?? null,
605
+ runtimeImport: config.options.runtimeImport ?? null,
607
606
  exclude: config.excludePatterns,
608
607
  provenance: config.provenance
609
608
  };
@@ -642,11 +641,11 @@ function formatCyclePublishFailure(outDir, error) {
642
641
  if (error instanceof PublishSwapIncompleteError) return `watch cycle publication failed mid-swap — ${outDir} is NOT last-good: ${String(error)}`;
643
642
  return `watch cycle publication rejected — keeping last-good artifacts in ${outDir}: ${String(error)}`;
644
643
  }
645
- function currentPayloadKey() {
644
+ function currentPayloadKey(key) {
646
645
  return [
647
- contentHash(getManifestJson() ?? ""),
648
- contentHash(getSharedCss()),
649
- contentHash(getSharedSystemProps())
646
+ contentHash(getManifestJson(key) ?? ""),
647
+ contentHash(getSharedCss(key)),
648
+ contentHash(getSharedSystemProps(key))
650
649
  ].join(":");
651
650
  }
652
651
  /** Resolves with the process exit code at shutdown. Startup failures throw,
@@ -685,7 +684,7 @@ async function runWatch(config, flags) {
685
684
  const { session, claim } = startup;
686
685
  let lastPublication = startup.publication;
687
686
  let publications = 1;
688
- let lastPublishedKey = currentPayloadKey();
687
+ let lastPublishedKey = currentPayloadKey(session.key);
689
688
  return new Promise((resolvePromise) => {
690
689
  const keepalive = setInterval(() => {}, 2 ** 30);
691
690
  let shuttingDown = null;
@@ -751,7 +750,7 @@ async function runWatch(config, flags) {
751
750
  err(`watch cycle failed — keeping last-good artifacts in ${outDir}: ${String(cause)}`);
752
751
  return;
753
752
  }
754
- const key = currentPayloadKey();
753
+ const key = currentPayloadKey(session.key);
755
754
  if (key === lastPublishedKey) return;
756
755
  let outcome;
757
756
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AASlD,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAS7E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,iBAAiB,CAAC;IAChC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD,GAAG,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1
  {
2
2
  "name": "@animus-ui/cli",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "Standalone Animus extraction CLI — one-shot builds and artifact emission for any build system",
5
5
  "keywords": [
6
6
  "animus",
@@ -41,7 +41,7 @@
41
41
  "compile": "tsc --noEmit"
42
42
  },
43
43
  "dependencies": {
44
- "@animus-ui/extract": "0.1.25"
44
+ "@animus-ui/extract": "0.1.27"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=22.12.0"