@animus-ui/cli 0.1.23 → 0.1.25

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/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);
@@ -361,13 +369,17 @@ async function runBuild(config) {
361
369
  } });
362
370
  try {
363
371
  session = createCliSession(config);
364
- session.selfCheckReportsEmptyKits = true;
365
372
  try {
366
373
  await session.runFullPipeline();
367
374
  } catch (error) {
368
375
  throw new ExtractionFailure(String(error));
369
376
  }
370
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
+ }
371
383
  reportDiscoveryOutcomes(config, session);
372
384
  err(`build complete: ${componentCount} components from ${fileCount} files → ${outDir}`);
373
385
  return {
@@ -650,6 +662,7 @@ async function runWatch(config, flags) {
650
662
  let startup;
651
663
  try {
652
664
  const created = createCliSession(config);
665
+ created.development = true;
653
666
  constructed = created;
654
667
  const claim = (0, _animus_ui_extract_session.startTurbopackWatcher)(created, root, { holdEvents: true });
655
668
  if (claim.kind === "started") watcher = claim.handle;
@@ -799,6 +812,8 @@ Options:
799
812
  --targets <query> Browserslist query for CSS lowering
800
813
  --strict Fail on inputs that could not be read or resolved,
801
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
802
817
  --fail-on-degraded watch only: exit 3 instead of running with unwatched
803
818
  roots (degradation is otherwise reported and tolerated)
804
819
  --verbose Verbose logging (stderr): phase checkpoints,
@@ -848,6 +863,7 @@ async function main(argv = process.argv.slice(2)) {
848
863
  strict: { type: "boolean" },
849
864
  verbose: { type: "boolean" },
850
865
  trace: { type: "boolean" },
866
+ kit: { type: "boolean" },
851
867
  "fail-on-degraded": { type: "boolean" },
852
868
  "print-config": { type: "boolean" },
853
869
  help: { type: "boolean" }
@@ -894,7 +910,7 @@ async function main(argv = process.argv.slice(2)) {
894
910
  return;
895
911
  }
896
912
  if (command === "build") {
897
- await runBuild(config);
913
+ await runBuild(config, { kit: values.kit === true });
898
914
  process.exitCode = 0;
899
915
  return;
900
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, DIAGNOSTIC_LEVELS, 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);
@@ -360,13 +368,17 @@ async function runBuild(config) {
360
368
  } });
361
369
  try {
362
370
  session = createCliSession(config);
363
- session.selfCheckReportsEmptyKits = true;
364
371
  try {
365
372
  await session.runFullPipeline();
366
373
  } catch (error) {
367
374
  throw new ExtractionFailure(String(error));
368
375
  }
369
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
+ }
370
382
  reportDiscoveryOutcomes(config, session);
371
383
  err(`build complete: ${componentCount} components from ${fileCount} files → ${outDir}`);
372
384
  return {
@@ -649,6 +661,7 @@ async function runWatch(config, flags) {
649
661
  let startup;
650
662
  try {
651
663
  const created = createCliSession(config);
664
+ created.development = true;
652
665
  constructed = created;
653
666
  const claim = startTurbopackWatcher(created, root, { holdEvents: true });
654
667
  if (claim.kind === "started") watcher = claim.handle;
@@ -798,6 +811,8 @@ Options:
798
811
  --targets <query> Browserslist query for CSS lowering
799
812
  --strict Fail on inputs that could not be read or resolved,
800
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
801
816
  --fail-on-degraded watch only: exit 3 instead of running with unwatched
802
817
  roots (degradation is otherwise reported and tolerated)
803
818
  --verbose Verbose logging (stderr): phase checkpoints,
@@ -847,6 +862,7 @@ async function main(argv = process.argv.slice(2)) {
847
862
  strict: { type: "boolean" },
848
863
  verbose: { type: "boolean" },
849
864
  trace: { type: "boolean" },
865
+ kit: { type: "boolean" },
850
866
  "fail-on-degraded": { type: "boolean" },
851
867
  "print-config": { type: "boolean" },
852
868
  help: { type: "boolean" }
@@ -893,7 +909,7 @@ async function main(argv = process.argv.slice(2)) {
893
909
  return;
894
910
  }
895
911
  if (command === "build") {
896
- await runBuild(config);
912
+ await runBuild(config, { kit: values.kit === true });
897
913
  process.exitCode = 0;
898
914
  return;
899
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.23",
3
+ "version": "0.1.25",
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.23"
44
+ "@animus-ui/extract": "0.1.25"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=22.12.0"