@animus-ui/cli 0.1.22 → 0.1.24

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/dist/build.d.ts CHANGED
@@ -23,5 +23,9 @@ export interface PublishOutcome {
23
23
  export declare function publishSharedPayloads(config: ResolvedCliConfig, session: ExtractionSession): PublishOutcome;
24
24
  export declare function createRunClaimRelease(getSession: () => ExtractionSession | null, releaseLock: () => void): () => void;
25
25
  export declare function reportDiscoveryOutcomes(config: ResolvedCliConfig, session: ExtractionSession): void;
26
- export declare function runBuild(config: ResolvedCliConfig): Promise<BuildResult>;
26
+ export interface BuildFlags {
27
+ /** Also write the kit descriptor at the root. */
28
+ kit?: boolean;
29
+ }
30
+ export declare function runBuild(config: ResolvedCliConfig, flags?: BuildFlags): Promise<BuildResult>;
27
31
  //# sourceMappingURL=build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,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,cAA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qB,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,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
@@ -1,4 +1,4 @@
1
- import type { AnimusCoreOptions, AnimusMode, OptionProvenance, StaticCssConfig } from '@animus-ui/extract/pipeline';
1
+ import type { AnimusCoreOptions, AnimusMode, DiagnosticLevel, OptionProvenance, StaticCssConfig } from '@animus-ui/extract/pipeline';
2
2
  export declare const CONFIG_FILENAMES: readonly ['animus.config.json', 'animus.config.mjs', 'animus.config.js', 'animus.config.ts'];
3
3
  export interface CliNamespaceOptions {
4
4
  /** Artifact output directory, relative to the root. @default '.animus' */
@@ -41,6 +41,7 @@ export declare function projectResolvedConfig(config: ResolvedCliConfig): {
41
41
  mode: AnimusMode;
42
42
  system: string;
43
43
  strict: boolean;
44
+ diagnostics: Readonly<Record<string, DiagnosticLevel>> | null;
44
45
  verbose: "trace" | boolean;
45
46
  targets: string | string[] | null;
46
47
  minify: boolean | null;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAEhB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AAErC,eAAO,MAAM,gBAAgB,YA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AE,iBAAiB,CAAC;IAC3B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC9C;AA+OD,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,QAAQ,EACf,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,iBAAiB,CAAC,CAoI5B;AAED;kEACkE;AAClE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB;IAE3D,MAAM;IACN,IAAI;IACJ,UAAU;IACV,MAAM;IACN,IAAI;IACJ,MAAM;IACN,MAAM;IACN,WAAW;IACX,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,oBAAoB;IACpB,MAAM;IACN,UAAU;IACV,SAAS;IACT,OAAO;IACP,UAAU;EAEb"}
package/dist/index.cjs CHANGED
@@ -348,7 +348,15 @@ function reportDiscoveryOutcomes(config, session) {
348
348
  const stats = session.getExcludeStats();
349
349
  for (const pattern of config.options.exclude ?? []) if ((stats.get(pattern) ?? 0) === 0) err(`exclude pattern '${pattern}' matched nothing`);
350
350
  }
351
- async function runBuild(config) {
351
+ /** Writes the analysed kit's descriptor at the root, from the manifest the
352
+ * build published. */
353
+ function writeKitDescriptor(root) {
354
+ const manifest = JSON.parse((0, _animus_ui_extract_session.getManifestJson)() ?? "");
355
+ const path$2 = (0, path.join)(root, _animus_ui_extract_pipeline.KIT_DESCRIPTOR_FILE);
356
+ (0, fs.writeFileSync)(path$2, `${JSON.stringify((0, _animus_ui_extract_pipeline.buildKitDescriptor)(manifest), null, 2)}\n`);
357
+ return path$2;
358
+ }
359
+ async function runBuild(config, flags = {}) {
352
360
  const { outDir } = config;
353
361
  await runPreflight(config);
354
362
  const release = acquireLock(outDir);
@@ -367,6 +375,11 @@ async function runBuild(config) {
367
375
  throw new ExtractionFailure(String(error));
368
376
  }
369
377
  const { componentCount, fileCount } = publishSharedPayloads(config, session);
378
+ if (flags.kit) {
379
+ const failures = (0, _animus_ui_extract_pipeline.kitPublicationFailures)(config.root, (0, _animus_ui_extract_session.engineApi)(), config.outDir);
380
+ 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)}`);
382
+ }
370
383
  reportDiscoveryOutcomes(config, session);
371
384
  err(`build complete: ${componentCount} components from ${fileCount} files → ${outDir}`);
372
385
  return {
@@ -435,6 +448,11 @@ function configStaticCss(value) {
435
448
  if (isStaticCssConfig(value)) return value;
436
449
  throw new _animus_ui_extract_pipeline.AnimusConfigError(`Invalid value for "staticCss" — expected a static CSS declaration object, got ${JSON.stringify(value)}.`);
437
450
  }
451
+ /** The shared validator has already rejected a non-level value. */
452
+ function configDiagnostics(value) {
453
+ if (!isConfigRecord(value)) return void 0;
454
+ return Object.fromEntries(Object.entries(value).filter((entry) => isConfigString(entry[1]) && _animus_ui_extract_pipeline.DIAGNOSTIC_LEVELS.has(entry[1])));
455
+ }
438
456
  function parseLoadedCliConfig(raw) {
439
457
  (0, _animus_ui_extract_pipeline.assertNoRetiredEngineSelection)(isConfigString(raw.engine) ? raw.engine : void 0);
440
458
  (0, _animus_ui_extract_pipeline.assertKnownOptionKeys)(raw);
@@ -448,6 +466,7 @@ function parseLoadedCliConfig(raw) {
448
466
  exclude: isConfigStringArray(raw.exclude) ? raw.exclude : void 0,
449
467
  extensions: isConfigStringArray(raw.extensions) ? raw.extensions : void 0,
450
468
  strict: isConfigBoolean(raw.strict) ? raw.strict : void 0,
469
+ diagnostics: configDiagnostics(raw.diagnostics),
451
470
  verbose: isConfigBoolean(raw.verbose) || raw.verbose === "trace" ? raw.verbose : void 0,
452
471
  prefix: isConfigString(raw.prefix) ? raw.prefix : void 0,
453
472
  prefixContextualVars: isConfigBoolean(raw.prefixContextualVars) ? raw.prefixContextualVars : void 0,
@@ -539,6 +558,7 @@ async function resolveCliConfig(flags, cwd) {
539
558
  exclude: excludeIsExplicit ? exclude : void 0,
540
559
  extensions: pick("extensions", void 0),
541
560
  strict: pick("strict", flags.strict),
561
+ diagnostics: pick("diagnostics", void 0),
542
562
  verbose: pick("verbose", flags.verbose),
543
563
  prefix: pick("prefix", void 0),
544
564
  prefixContextualVars: pick("prefixContextualVars", void 0),
@@ -576,6 +596,7 @@ function projectResolvedConfig(config) {
576
596
  mode: config.mode,
577
597
  system: config.options.system,
578
598
  strict: config.options.strict ?? false,
599
+ diagnostics: config.options.diagnostics ?? null,
579
600
  verbose: config.options.verbose ?? false,
580
601
  targets: config.options.targets ?? null,
581
602
  minify: config.options.minify ?? null,
@@ -641,6 +662,7 @@ async function runWatch(config, flags) {
641
662
  let startup;
642
663
  try {
643
664
  const created = createCliSession(config);
665
+ created.development = true;
644
666
  constructed = created;
645
667
  const claim = (0, _animus_ui_extract_session.startTurbopackWatcher)(created, root, { holdEvents: true });
646
668
  if (claim.kind === "started") watcher = claim.handle;
@@ -790,6 +812,8 @@ Options:
790
812
  --targets <query> Browserslist query for CSS lowering
791
813
  --strict Fail on inputs that could not be read or resolved,
792
814
  and on classified unsupported Animus declarations
815
+ --kit build only: also write the kit descriptor, animus.json,
816
+ at the root, for the kit to export as ./animus.json
793
817
  --fail-on-degraded watch only: exit 3 instead of running with unwatched
794
818
  roots (degradation is otherwise reported and tolerated)
795
819
  --verbose Verbose logging (stderr): phase checkpoints,
@@ -839,6 +863,7 @@ async function main(argv = process.argv.slice(2)) {
839
863
  strict: { type: "boolean" },
840
864
  verbose: { type: "boolean" },
841
865
  trace: { type: "boolean" },
866
+ kit: { type: "boolean" },
842
867
  "fail-on-degraded": { type: "boolean" },
843
868
  "print-config": { type: "boolean" },
844
869
  help: { type: "boolean" }
@@ -885,7 +910,7 @@ async function main(argv = process.argv.slice(2)) {
885
910
  return;
886
911
  }
887
912
  if (command === "build") {
888
- await runBuild(config);
913
+ await runBuild(config, { kit: values.kit === true });
889
914
  process.exitCode = 0;
890
915
  return;
891
916
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;kDACkD;AAiBlD,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC;qEACqE;AACrE,eAAO,MAAM,YAAY,IAAI,CAAC;AA0D9B;sDACsD;AACtD,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMzD;AAQD,wBAAsB,IAAI,CACxB,IAAI,GAAE,MAAM,EAA0B,GACrC,OAAO,CAAC,IAAI,CAAC,CA2Ff"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;kDACkD;AAiBlD,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC;qEACqE;AACrE,eAAO,MAAM,YAAY,IAAI,CAAC;AA4D9B;sDACsD;AACtD,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMzD;AAQD,wBAAsB,IAAI,CACxB,IAAI,GAAE,MAAM,EAA0B,GACrC,OAAO,CAAC,IAAI,CAAC,CA4Ff"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { AnimusConfigError, REPLACEABLE_DEFAULT_EXCLUDE, STRUCTURAL_EXCLUDE, assertKnownOptionKeys, assertNoRetiredEngineSelection, buildPathAliasesJson, contentHash, createExcludeMatcher, readTsconfigAliasPairs, resolveMode, runStructuralSelfCheck } from "@animus-ui/extract/pipeline";
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";
2
2
  import { parseArgs } from "node:util";
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, getAnalyzedHashes, getManifestJson, getSharedCss, getSharedSystemProps, holdDirectoryClaim, isLockHolderAlive, lockRecordBytes, readCliLockRecord, startTurbopackWatcher, verifyCommitRecord } from "@animus-ui/extract/session";
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";
5
5
  import { dirname, isAbsolute, join, relative, resolve } from "path";
6
6
  import { pathToFileURL } from "url";
@@ -347,7 +347,15 @@ function reportDiscoveryOutcomes(config, session) {
347
347
  const stats = session.getExcludeStats();
348
348
  for (const pattern of config.options.exclude ?? []) if ((stats.get(pattern) ?? 0) === 0) err(`exclude pattern '${pattern}' matched nothing`);
349
349
  }
350
- async function runBuild(config) {
350
+ /** Writes the analysed kit's descriptor at the root, from the manifest the
351
+ * build published. */
352
+ function writeKitDescriptor(root) {
353
+ const manifest = JSON.parse(getManifestJson() ?? "");
354
+ const path = join(root, KIT_DESCRIPTOR_FILE);
355
+ writeFileSync(path, `${JSON.stringify(buildKitDescriptor(manifest), null, 2)}\n`);
356
+ return path;
357
+ }
358
+ async function runBuild(config, flags = {}) {
351
359
  const { outDir } = config;
352
360
  await runPreflight(config);
353
361
  const release = acquireLock(outDir);
@@ -366,6 +374,11 @@ async function runBuild(config) {
366
374
  throw new ExtractionFailure(String(error));
367
375
  }
368
376
  const { componentCount, fileCount } = publishSharedPayloads(config, session);
377
+ if (flags.kit) {
378
+ const failures = kitPublicationFailures(config.root, engineApi(), config.outDir);
379
+ 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)}`);
381
+ }
369
382
  reportDiscoveryOutcomes(config, session);
370
383
  err(`build complete: ${componentCount} components from ${fileCount} files → ${outDir}`);
371
384
  return {
@@ -434,6 +447,11 @@ function configStaticCss(value) {
434
447
  if (isStaticCssConfig(value)) return value;
435
448
  throw new AnimusConfigError(`Invalid value for "staticCss" — expected a static CSS declaration object, got ${JSON.stringify(value)}.`);
436
449
  }
450
+ /** The shared validator has already rejected a non-level value. */
451
+ function configDiagnostics(value) {
452
+ if (!isConfigRecord(value)) return void 0;
453
+ return Object.fromEntries(Object.entries(value).filter((entry) => isConfigString(entry[1]) && DIAGNOSTIC_LEVELS.has(entry[1])));
454
+ }
437
455
  function parseLoadedCliConfig(raw) {
438
456
  assertNoRetiredEngineSelection(isConfigString(raw.engine) ? raw.engine : void 0);
439
457
  assertKnownOptionKeys(raw);
@@ -447,6 +465,7 @@ function parseLoadedCliConfig(raw) {
447
465
  exclude: isConfigStringArray(raw.exclude) ? raw.exclude : void 0,
448
466
  extensions: isConfigStringArray(raw.extensions) ? raw.extensions : void 0,
449
467
  strict: isConfigBoolean(raw.strict) ? raw.strict : void 0,
468
+ diagnostics: configDiagnostics(raw.diagnostics),
450
469
  verbose: isConfigBoolean(raw.verbose) || raw.verbose === "trace" ? raw.verbose : void 0,
451
470
  prefix: isConfigString(raw.prefix) ? raw.prefix : void 0,
452
471
  prefixContextualVars: isConfigBoolean(raw.prefixContextualVars) ? raw.prefixContextualVars : void 0,
@@ -538,6 +557,7 @@ async function resolveCliConfig(flags, cwd) {
538
557
  exclude: excludeIsExplicit ? exclude : void 0,
539
558
  extensions: pick("extensions", void 0),
540
559
  strict: pick("strict", flags.strict),
560
+ diagnostics: pick("diagnostics", void 0),
541
561
  verbose: pick("verbose", flags.verbose),
542
562
  prefix: pick("prefix", void 0),
543
563
  prefixContextualVars: pick("prefixContextualVars", void 0),
@@ -575,6 +595,7 @@ function projectResolvedConfig(config) {
575
595
  mode: config.mode,
576
596
  system: config.options.system,
577
597
  strict: config.options.strict ?? false,
598
+ diagnostics: config.options.diagnostics ?? null,
578
599
  verbose: config.options.verbose ?? false,
579
600
  targets: config.options.targets ?? null,
580
601
  minify: config.options.minify ?? null,
@@ -640,6 +661,7 @@ async function runWatch(config, flags) {
640
661
  let startup;
641
662
  try {
642
663
  const created = createCliSession(config);
664
+ created.development = true;
643
665
  constructed = created;
644
666
  const claim = startTurbopackWatcher(created, root, { holdEvents: true });
645
667
  if (claim.kind === "started") watcher = claim.handle;
@@ -789,6 +811,8 @@ Options:
789
811
  --targets <query> Browserslist query for CSS lowering
790
812
  --strict Fail on inputs that could not be read or resolved,
791
813
  and on classified unsupported Animus declarations
814
+ --kit build only: also write the kit descriptor, animus.json,
815
+ at the root, for the kit to export as ./animus.json
792
816
  --fail-on-degraded watch only: exit 3 instead of running with unwatched
793
817
  roots (degradation is otherwise reported and tolerated)
794
818
  --verbose Verbose logging (stderr): phase checkpoints,
@@ -838,6 +862,7 @@ async function main(argv = process.argv.slice(2)) {
838
862
  strict: { type: "boolean" },
839
863
  verbose: { type: "boolean" },
840
864
  trace: { type: "boolean" },
865
+ kit: { type: "boolean" },
841
866
  "fail-on-degraded": { type: "boolean" },
842
867
  "print-config": { type: "boolean" },
843
868
  help: { type: "boolean" }
@@ -884,7 +909,7 @@ async function main(argv = process.argv.slice(2)) {
884
909
  return;
885
910
  }
886
911
  if (command === "build") {
887
- await runBuild(config);
912
+ await runBuild(config, { kit: values.kit === true });
888
913
  process.exitCode = 0;
889
914
  return;
890
915
  }
@@ -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,YAAY,EAAE,CA0BjB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAElE;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAC9C,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,CAKR;AAgBD;iFACiF;AACjF,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,MAAM,CAAC,CAwMjB"}
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,YAAY,EAAE,CA0BjB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAElE;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAC9C,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,CAKR;AAgBD;iFACiF;AACjF,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,MAAM,CAAC,CA0MjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/cli",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
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.22"
44
+ "@animus-ui/extract": "0.1.24"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=22.12.0"