@animus-ui/extract 0.1.9 → 0.1.11

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.
Files changed (126) hide show
  1. package/README.md +1 -1
  2. package/crates/extract-v2/animus-extract-v2.darwin-arm64.node +0 -0
  3. package/crates/extract-v2/animus-extract-v2.linux-arm64-gnu.node +0 -0
  4. package/crates/extract-v2/animus-extract-v2.linux-x64-gnu.node +0 -0
  5. package/dist/index.cjs +73 -2101
  6. package/dist/index.mjs +2 -2026
  7. package/dist/pipeline/analyze-project-args.d.ts.map +1 -0
  8. package/dist/pipeline/assemble-stylesheet.d.ts.map +1 -0
  9. package/dist/pipeline/asset-placeholders.d.ts.map +1 -0
  10. package/dist/pipeline/content-hash.d.ts.map +1 -0
  11. package/dist/pipeline/core-options.d.ts +162 -0
  12. package/dist/pipeline/core-options.d.ts.map +1 -0
  13. package/dist/pipeline/correlate-external-tokens.d.ts.map +1 -0
  14. package/dist/pipeline/discover-files.d.ts +12 -0
  15. package/dist/pipeline/discover-files.d.ts.map +1 -0
  16. package/dist/{discover-packages.d.ts → pipeline/discover-packages.d.ts} +7 -8
  17. package/dist/pipeline/discover-packages.d.ts.map +1 -0
  18. package/dist/pipeline/dynamic-prop-config.d.ts.map +1 -0
  19. package/dist/{engine-adapter.d.ts → pipeline/engine-adapter.d.ts} +2 -0
  20. package/dist/pipeline/engine-adapter.d.ts.map +1 -0
  21. package/dist/pipeline/engine-retirement.d.ts.map +1 -0
  22. package/dist/pipeline/error-diagnostics.d.ts.map +1 -0
  23. package/dist/pipeline/external-keyframes.d.ts.map +1 -0
  24. package/dist/{index.d.ts → pipeline/index.d.ts} +10 -1
  25. package/dist/pipeline/index.d.ts.map +1 -0
  26. package/dist/pipeline/manifest-diagnostics.d.ts.map +1 -0
  27. package/dist/{mdx-preprocessor.d.ts → pipeline/mdx-preprocessor.d.ts} +10 -0
  28. package/dist/pipeline/mdx-preprocessor.d.ts.map +1 -0
  29. package/dist/pipeline/path-aliases.d.ts.map +1 -0
  30. package/dist/pipeline/post-process-css.d.ts.map +1 -0
  31. package/dist/pipeline/prefix.d.ts.map +1 -0
  32. package/dist/pipeline/replacement-plans.d.ts.map +1 -0
  33. package/dist/pipeline/resolve-asset.d.ts.map +1 -0
  34. package/dist/pipeline/run-analysis.d.ts.map +1 -0
  35. package/dist/pipeline/source-identity.d.ts.map +1 -0
  36. package/dist/pipeline/source-ingestion.d.ts +173 -0
  37. package/dist/pipeline/source-ingestion.d.ts.map +1 -0
  38. package/dist/pipeline/static-css.d.ts.map +1 -0
  39. package/dist/pipeline/structural-self-check.d.ts +32 -0
  40. package/dist/pipeline/structural-self-check.d.ts.map +1 -0
  41. package/dist/pipeline/svelte-source-adapter.d.ts +88 -0
  42. package/dist/pipeline/svelte-source-adapter.d.ts.map +1 -0
  43. package/dist/pipeline/system-config.d.ts.map +1 -0
  44. package/dist/{system-props-module.d.ts → pipeline/system-props-module.d.ts} +4 -3
  45. package/dist/pipeline/system-props-module.d.ts.map +1 -0
  46. package/dist/pipeline/timing-waterfall.d.ts.map +1 -0
  47. package/dist/pipeline/tsconfig-paths.d.ts.map +1 -0
  48. package/dist/pipeline/unit-fallback.d.ts.map +1 -0
  49. package/dist/pipeline/utils.d.ts.map +1 -0
  50. package/dist/pipeline/watch-keys.d.ts.map +1 -0
  51. package/dist/pipeline-lkbOoyAr.mjs +3228 -0
  52. package/dist/pipeline-ojNeABi0.cjs +3685 -0
  53. package/dist/session/extraction-session.d.ts +446 -0
  54. package/dist/session/extraction-session.d.ts.map +1 -0
  55. package/dist/session/index.d.ts +24 -0
  56. package/dist/session/index.d.ts.map +1 -0
  57. package/dist/session/published-set.d.ts +32 -0
  58. package/dist/session/published-set.d.ts.map +1 -0
  59. package/dist/session/resolve-packages.d.ts +8 -0
  60. package/dist/session/resolve-packages.d.ts.map +1 -0
  61. package/dist/session/session-paths.d.ts +131 -0
  62. package/dist/session/session-paths.d.ts.map +1 -0
  63. package/dist/session/singleton.d.ts +124 -0
  64. package/dist/session/singleton.d.ts.map +1 -0
  65. package/dist/session/timing.d.ts +7 -0
  66. package/dist/session/timing.d.ts.map +1 -0
  67. package/dist/session/turbopack-orchestrator.d.ts +43 -0
  68. package/dist/session/turbopack-orchestrator.d.ts.map +1 -0
  69. package/dist/session.cjs +2146 -0
  70. package/dist/session.mjs +2110 -0
  71. package/package.json +18 -6
  72. package/dist/analyze-project-args.d.ts.map +0 -1
  73. package/dist/assemble-stylesheet.d.ts.map +0 -1
  74. package/dist/asset-placeholders.d.ts.map +0 -1
  75. package/dist/content-hash.d.ts.map +0 -1
  76. package/dist/correlate-external-tokens.d.ts.map +0 -1
  77. package/dist/discover-files.d.ts +0 -10
  78. package/dist/discover-files.d.ts.map +0 -1
  79. package/dist/discover-packages.d.ts.map +0 -1
  80. package/dist/dynamic-prop-config.d.ts.map +0 -1
  81. package/dist/engine-adapter.d.ts.map +0 -1
  82. package/dist/engine-retirement.d.ts.map +0 -1
  83. package/dist/error-diagnostics.d.ts.map +0 -1
  84. package/dist/external-keyframes.d.ts.map +0 -1
  85. package/dist/index.d.ts.map +0 -1
  86. package/dist/manifest-diagnostics.d.ts.map +0 -1
  87. package/dist/mdx-preprocessor.d.ts.map +0 -1
  88. package/dist/path-aliases.d.ts.map +0 -1
  89. package/dist/post-process-css.d.ts.map +0 -1
  90. package/dist/prefix.d.ts.map +0 -1
  91. package/dist/replacement-plans.d.ts.map +0 -1
  92. package/dist/resolve-asset.d.ts.map +0 -1
  93. package/dist/run-analysis.d.ts.map +0 -1
  94. package/dist/source-identity.d.ts.map +0 -1
  95. package/dist/static-css.d.ts.map +0 -1
  96. package/dist/system-config.d.ts.map +0 -1
  97. package/dist/system-props-module.d.ts.map +0 -1
  98. package/dist/timing-waterfall.d.ts.map +0 -1
  99. package/dist/tsconfig-paths.d.ts.map +0 -1
  100. package/dist/unit-fallback.d.ts.map +0 -1
  101. package/dist/utils.d.ts.map +0 -1
  102. package/dist/watch-keys.d.ts.map +0 -1
  103. /package/dist/{analyze-project-args.d.ts → pipeline/analyze-project-args.d.ts} +0 -0
  104. /package/dist/{assemble-stylesheet.d.ts → pipeline/assemble-stylesheet.d.ts} +0 -0
  105. /package/dist/{asset-placeholders.d.ts → pipeline/asset-placeholders.d.ts} +0 -0
  106. /package/dist/{content-hash.d.ts → pipeline/content-hash.d.ts} +0 -0
  107. /package/dist/{correlate-external-tokens.d.ts → pipeline/correlate-external-tokens.d.ts} +0 -0
  108. /package/dist/{dynamic-prop-config.d.ts → pipeline/dynamic-prop-config.d.ts} +0 -0
  109. /package/dist/{engine-retirement.d.ts → pipeline/engine-retirement.d.ts} +0 -0
  110. /package/dist/{error-diagnostics.d.ts → pipeline/error-diagnostics.d.ts} +0 -0
  111. /package/dist/{external-keyframes.d.ts → pipeline/external-keyframes.d.ts} +0 -0
  112. /package/dist/{manifest-diagnostics.d.ts → pipeline/manifest-diagnostics.d.ts} +0 -0
  113. /package/dist/{path-aliases.d.ts → pipeline/path-aliases.d.ts} +0 -0
  114. /package/dist/{post-process-css.d.ts → pipeline/post-process-css.d.ts} +0 -0
  115. /package/dist/{prefix.d.ts → pipeline/prefix.d.ts} +0 -0
  116. /package/dist/{replacement-plans.d.ts → pipeline/replacement-plans.d.ts} +0 -0
  117. /package/dist/{resolve-asset.d.ts → pipeline/resolve-asset.d.ts} +0 -0
  118. /package/dist/{run-analysis.d.ts → pipeline/run-analysis.d.ts} +0 -0
  119. /package/dist/{source-identity.d.ts → pipeline/source-identity.d.ts} +0 -0
  120. /package/dist/{static-css.d.ts → pipeline/static-css.d.ts} +0 -0
  121. /package/dist/{system-config.d.ts → pipeline/system-config.d.ts} +0 -0
  122. /package/dist/{timing-waterfall.d.ts → pipeline/timing-waterfall.d.ts} +0 -0
  123. /package/dist/{tsconfig-paths.d.ts → pipeline/tsconfig-paths.d.ts} +0 -0
  124. /package/dist/{unit-fallback.d.ts → pipeline/unit-fallback.d.ts} +0 -0
  125. /package/dist/{utils.d.ts → pipeline/utils.d.ts} +0 -0
  126. /package/dist/{watch-keys.d.ts → pipeline/watch-keys.d.ts} +0 -0
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Session-scoped artifact names, path derivations, and the analysis-status
3
+ * shape (openspec: next-turbopack-served-transform-coherence, design D1–D3)
4
+ * — shared by the session writer (extraction-session), the webpack
5
+ * plugin/loader, and the Turbopack loader.
6
+ *
7
+ * Deliberately free of singleton/session imports: the Turbopack loader
8
+ * executes in isolated worker processes and its module graph must stay
9
+ * worker-local (guardrail G1) — this module is pure path/shape vocabulary.
10
+ */
11
+ /** Session-dir-relative name of the replacement-epoch disk witness
12
+ * (openspec: next-webpack-served-transform-coherence, design D2;
13
+ * session-scoped by next-turbopack-served-transform-coherence D2). */
14
+ export declare const REPLACEMENT_EPOCH_ARTIFACT = "replacements-epoch";
15
+ /** Virtual module id of the emitted system-props module — session
16
+ * vocabulary shared by the orchestrator and the Turbopack config
17
+ * assembly (hoisted here so the session home stays framework-free). */
18
+ export declare const TURBOPACK_SYSTEM_PROPS_ID = "virtual:animus/system-props";
19
+ /** Session-dir-relative name of the analysis-commit transaction artifact
20
+ * (design D1). */
21
+ export declare const ANALYSIS_COMMIT_ARTIFACT = "analysis-commit";
22
+ /** Session-dir-relative name of the analysis-status artifact (design D3). */
23
+ export declare const ANALYSIS_STATUS_ARTIFACT = "analysis-status.json";
24
+ /** Session-dir-relative name of the manifest payload artifact. */
25
+ export declare const MANIFEST_ARTIFACT = "manifest.json";
26
+ /** Session-dir-relative name of the analysis-inputs payload artifact
27
+ * (Turbopack loader-worker hydration corpus). */
28
+ export declare const ANALYSIS_INPUTS_ARTIFACT = "analysis-inputs.json";
29
+ /** Session-dir-relative name of the emitted stylesheet artifact. */
30
+ export declare const STYLES_ARTIFACT = "styles.css";
31
+ /** Session-dir-relative name of the emitted system-props module. */
32
+ export declare const SYSTEM_PROPS_ARTIFACT = "system-props.js";
33
+ /** Session-dir-relative directory holding copied asset() files. */
34
+ export declare const SESSION_ASSETS_DIR = "assets";
35
+ /** The standalone CLI's published-set commit record, written into the flat
36
+ * `.animus/` tree (openspec: standalone-extraction-cli D3). Shared here so
37
+ * the CLI writer and the session's start hygiene agree on ONE name — the
38
+ * hygiene confinement gate keys on this record, and a renamed literal on
39
+ * either side would silently re-arm deletion of the CLI's published output. */
40
+ export declare const CLI_COMMIT_ARTIFACT = "commit.json";
41
+ /** The standalone CLI's single-writer advisory lock in the flat `.animus/`
42
+ * tree. A live holder means a CLI invocation owns that tree right now. */
43
+ export declare const CLI_LOCK_ARTIFACT = "lock.json";
44
+ /** Root of every session-scoped artifact tree for a project. */
45
+ export declare function sessionsRootDir(rootDir: string): string;
46
+ /** One session's artifact directory (design D2: session-scoped trees,
47
+ * no global pointer). */
48
+ export declare function sessionArtifactDir(rootDir: string, sessionId: string): string;
49
+ /** Absolute path of a session's replacement-epoch artifact — the single
50
+ * derivation shared by the session writer, the webpack plugin's
51
+ * watch-ignore entry, and both loaders' file dependencies. Takes the
52
+ * SESSION directory (not the project root) since the artifact was
53
+ * relocated into the session tree. */
54
+ export declare function replacementEpochPath(sessionDir: string): string;
55
+ /** Absolute path of a session's analysis-commit artifact. */
56
+ export declare function analysisCommitPath(sessionDir: string): string;
57
+ /** Absolute path of a session's analysis-status artifact. */
58
+ export declare function analysisStatusPath(sessionDir: string): string;
59
+ /** Absolute path of a session's manifest artifact. */
60
+ export declare function manifestPath(sessionDir: string): string;
61
+ /** Absolute path of a session's analysis-inputs artifact. */
62
+ export declare function analysisInputsPath(sessionDir: string): string;
63
+ /** Absolute path of a session's stylesheet artifact. */
64
+ export declare function stylesPath(sessionDir: string): string;
65
+ /** Absolute path of a session's system-props module artifact. */
66
+ export declare function systemPropsPath(sessionDir: string): string;
67
+ /** Session-scoped analysis-status shape (design D3). Successful loader
68
+ * invocations never depend on it; it exists so a loader observing a
69
+ * source/commit mismatch can decide — on evidence — whether to wait.
70
+ *
71
+ * Schema 2 (openspec: standalone-extraction-cli, watch readiness) adds the
72
+ * additive `ready` field; every other field is unchanged, so schema-1
73
+ * readers keep working (no reader branches on the schema value — the bump
74
+ * records the shape revision for artifact archaeology). */
75
+ export interface AnalysisStatus {
76
+ schema: 1 | 2;
77
+ sessionId: string;
78
+ attemptId: number;
79
+ state: 'starting' | 'debouncing' | 'analyzing' | 'committing' | 'idle' | 'failed';
80
+ /** [(rootDir-relative sourceKey, observed content hash)] of the batch. */
81
+ pending: Array<[string, string]>;
82
+ /** Epoch-ms deadline for the active attempt (debounce ceiling + 2s). */
83
+ deadlineAt: number;
84
+ diagnostic?: string;
85
+ /** Monotonic first-emission witness (additive, schema 2): absent or false
86
+ * until the session's FIRST successful complete publication, true on
87
+ * every status write after it — including 'failed' writes, which is what
88
+ * makes readiness distinct from `state: 'idle'` (idle recurs per attempt;
89
+ * ready never regresses within a session). */
90
+ ready?: boolean;
91
+ }
92
+ /** analysis-commit artifact shape (design D1: the transaction identity —
93
+ * hashes are of the DISK payload bytes, envelope included). `inputsHash`
94
+ * is present only when the hydration corpus is persisted (Turbopack
95
+ * orchestration); webpack-mode commits omit it (spec:
96
+ * next-turbopack-integration, "Webpack mode skips the hydration corpus"). */
97
+ export interface AnalysisCommit {
98
+ schema: 1;
99
+ sessionId: string;
100
+ generation: number;
101
+ replacementEpoch: string;
102
+ manifestHash: string;
103
+ inputsHash?: string;
104
+ stylesHash: string;
105
+ }
106
+ /** Envelope embedded in every payload artifact (design D2: sessionId in
107
+ * every artifact; payloadHash lets a same-session restart seed its write
108
+ * guards without byte-reconstructing the payload). */
109
+ export interface SessionEnvelope {
110
+ sessionId: string;
111
+ generation: number;
112
+ replacementEpoch: string;
113
+ payloadHash: string;
114
+ }
115
+ /** Splice the session envelope into a JSON-object payload as a leading
116
+ * `__animusSession` field, byte-preserving the payload's own content
117
+ * (parse/re-stringify could reformat engine-emitted JSON). */
118
+ export declare function envelopeJsonArtifact(payload: string, envelopeJson: string): string;
119
+ /** Trailing-comment side-band for the CSS artifact (a leading comment
120
+ * would displace the @layer declaration consumers pin at offset 0). */
121
+ export declare function envelopeCssArtifact(payload: string, envelopeJson: string): string;
122
+ /** Matches the CSS artifact's envelope side-band. */
123
+ export declare const ENVELOPE_CSS_COMMENT_RE: RegExp;
124
+ /** Envelope of a JSON artifact's bytes, or undefined when the artifact
125
+ * carries none. THROWS on unparseable bytes — callers decide whether a
126
+ * torn artifact fails closed or degrades. */
127
+ export declare function readJsonEnvelope(bytes: string): SessionEnvelope | undefined;
128
+ /** Envelope of the CSS artifact's side-band comment, or undefined when the
129
+ * side-band is absent. THROWS on an unparseable envelope body. */
130
+ export declare function readCssEnvelope(bytes: string): SessionEnvelope | undefined;
131
+ //# sourceMappingURL=session-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-paths.d.ts","sourceRoot":"","sources":["../../session/session-paths.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH;;uEAEuE;AACvE,eAAO,MAAM,0BAA0B,uBAAuB,CAAC;AAE/D;;wEAEwE;AACxE,eAAO,MAAM,yBAAyB,gCAAgC,CAAC;AAEvE;mBACmB;AACnB,eAAO,MAAM,wBAAwB,oBAAoB,CAAC;AAE1D,6EAA6E;AAC7E,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD;kDACkD;AAClD,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D,oEAAoE;AACpE,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAE3C;;;;gFAIgF;AAChF,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD;2EAC2E;AAC3E,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAE7C,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;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EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;uDAEuD;AACvD,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAKD;;+DAE+D;AAC/D,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,CAQR;AAED;wEACwE;AACxE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAED,qDAAqD;AACrD,eAAO,MAAM,uBAAuB,QAAuC,CAAC;AAE5E;;8CAE8C;AAC9C,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAG3E;AAED;mEACmE;AACnE,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAG1E"}
@@ -0,0 +1,124 @@
1
+ export declare function getManifestJson(): string | null;
2
+ export declare function setManifestJson(json: string): void;
3
+ export declare function getAnalysisPromise(): Promise<void> | null;
4
+ export declare function setAnalysisPromise(promise: Promise<void>): void;
5
+ export declare function resetAnalysisPromise(): void;
6
+ export declare function getSharedCss(): string;
7
+ export declare function setSharedCss(css: string): void;
8
+ export declare function getSharedSystemProps(): string;
9
+ export declare function setSharedSystemProps(content: string): void;
10
+ export declare function getSharedExternalDirs(): string[];
11
+ export declare function setSharedExternalDirs(dirs: string[]): void;
12
+ export declare function getSharedExternalEntries(): Map<string, string>;
13
+ export declare function setSharedExternalEntries(entries: Map<string, string>): void;
14
+ /** Structural view of the owning session a forwarded watch batch targets —
15
+ * kept minimal (and defined here, not imported) so the singleton never
16
+ * depends on the session module it serves. */
17
+ export interface WatchBatchTarget {
18
+ ingestForwardedBatch(changes: {
19
+ modifiedFiles?: ReadonlySet<string>;
20
+ removedFiles?: ReadonlySet<string>;
21
+ }): Promise<void>;
22
+ }
23
+ /**
24
+ * The session that completed the full pipeline and holds system state — the
25
+ * only instance that can run watch analysis. Each MultiCompiler child holds
26
+ * its own session AND its own watcher with its own modified set; a
27
+ * non-owning session forwards its batch here instead of dropping it (a file
28
+ * only that compiler watches would otherwise never be analyzed).
29
+ */
30
+ export declare function getOwningWatchSession(): WatchBatchTarget | null;
31
+ export declare function setOwningWatchSession(session: WatchBatchTarget | null): void;
32
+ /**
33
+ * Per-file analyzed content hashes of the last published analysis (relPath →
34
+ * contentHash of the exact bytes analyzed) — the loader's witness for the
35
+ * unconditional catching-up guard (openspec:
36
+ * next-webpack-served-transform-coherence, design D4). Includes files
37
+ * analyzed with ZERO animus entries: analyzed identity is membership in the
38
+ * analysis input set, not manifest entry count.
39
+ */
40
+ export declare function getAnalyzedHashes(): ReadonlyMap<string, string> | null;
41
+ export declare function setAnalyzedHashes(hashes: Map<string, string>): void;
42
+ /**
43
+ * Session identity is per Next INVOCATION — one process, however many
44
+ * compiler instances it holds (openspec:
45
+ * next-turbopack-served-transform-coherence, design D2). The first
46
+ * ExtractionSession constructed in a process claims a fresh randomUUID;
47
+ * every later instance (client/server/RSC compilers each construct one)
48
+ * adopts it, so all compilers alias, watch-ignore, and publish ONE
49
+ * session-scoped artifact tree. Separate invocations (`next dev` +
50
+ * `next build` co-writing) are separate processes and therefore separate
51
+ * sessions by construction.
52
+ */
53
+ export declare function claimProcessSessionId(): string;
54
+ /**
55
+ * Exclusive-ownership claim over the process-global session state — the
56
+ * hard form of the invariant `claimProcessSessionId` documents softly. The
57
+ * shared slots above (manifest, css, artifact dir) plus the one session id
58
+ * mean two CONCURRENT drive loops in one process (a webpack MultiCompiler
59
+ * array config, parallel rollup array builds, two programmatic CLI runs)
60
+ * would share one session directory, overwrite each other's manifests, and
61
+ * delete each other's live trees on dispose. Drivers that run the loop
62
+ * exclusively (the unplugin host) claim for the build's lifetime and
63
+ * release on dispose; SEQUENTIAL claim/release cycles are legal. The Next
64
+ * multi-compiler adoption path stays the non-exclusive default. Throws
65
+ * naming both hosts and the remediation on overlap. The key lives in
66
+ * `SINGLETON_GLOBAL_KEYS`, so per-test global resets clear a leaked claim.
67
+ */
68
+ export declare function claimExclusiveSessionOwner(label: string): () => void;
69
+ /**
70
+ * Absolute session artifact directory of the OWNING session's last
71
+ * publication — the webpack loader's source for the session-scoped epoch
72
+ * dependency path (the loader shares the process with the pipeline; the
73
+ * Turbopack loader instead receives the directory via its options).
74
+ */
75
+ export declare function getSessionArtifactDir(): string | null;
76
+ export declare function setSessionArtifactDir(dir: string): void;
77
+ /**
78
+ * Canonical replacement epoch of the last published analysis
79
+ * (`hashReplacementPlans(snapshotFilePlans(manifest), systemPropsContent)`
80
+ * — openspec: next-webpack-served-transform-coherence, design D5; the
81
+ * served system-props module rides as the served-dependency witness so
82
+ * offline system-props changes move the epoch). Published by the
83
+ * owning session AFTER the manifest so a reader that observes the epoch
84
+ * always observes at least that generation's manifest. (Session
85
+ * attribution lives on the DISK epoch artifact — no in-process mirror.)
86
+ */
87
+ export declare function getReplacementEpoch(): string | null;
88
+ export declare function setReplacementEpoch(epoch: string): void;
89
+ /**
90
+ * The one in-flight watch-analysis transaction (design D3): the first
91
+ * compiler entering a watch batch runs analysis + publication; every other
92
+ * compiler (client/server/RSC — each holds its own session instance) joins
93
+ * this promise instead of proceeding against a pre-transaction generation.
94
+ */
95
+ export declare function getWatchTransaction(): Promise<void> | null;
96
+ export declare function setWatchTransaction(transaction: Promise<void> | null): void;
97
+ export type AnimusEngine = 'v2';
98
+ /** Engine selection travels through the singleton so non-owning compiler
99
+ * instances and the webpack loader honor the same choice as the owner. */
100
+ export declare function setSharedEngine(engine: AnimusEngine): void;
101
+ export declare function getSharedEngine(): AnimusEngine;
102
+ /** Single engine choke-point for every native extraction call. Return type
103
+ * mirrors the untyped `require` the call sites previously used — the NAPI
104
+ * module's own .d.ts is the authoritative surface. */
105
+ export declare function requireEngine(): any;
106
+ /**
107
+ * Test seam (injected-fn pattern — module mocks cannot reach a bundled
108
+ * dist copy of this module): inject a replacement engine API. GlobalThis-
109
+ * keyed so every copy of this module — source-imported, dist-imported,
110
+ * ESM/CJS dual-load — honors the one override. Deliberately NOT in
111
+ * SINGLETON_GLOBAL_KEYS: the override's lifecycle belongs to the test
112
+ * file, and per-test global resets must not strip it mid-suite. Pass null
113
+ * to restore the native-backed API.
114
+ */
115
+ export declare function setEngineApiOverride(api: (() => any) | null): void;
116
+ export declare function engineApi(): any;
117
+ /**
118
+ * Every globalThis key this module owns EXCEPT the engine-api override
119
+ * (whose lifecycle belongs to the test file that set it — see
120
+ * setEngineApiOverride) — the single authority test harnesses
121
+ * snapshot/clear per test (never re-declare this list).
122
+ */
123
+ export declare const SINGLETON_GLOBAL_KEYS: readonly ["__animus_manifest_json__", "__animus_analysis_promise__", "__animus_shared_css__", "__animus_shared_system_props__", "__animus_external_pkg_dirs__", "__animus_external_source_entries__", "__animus_analyzed_hashes__", "__animus_replacement_epoch__", "__animus_watch_transaction__", "__animus_process_session_id__", "__animus_session_artifact_dir__", "__animus_owning_watch_session__", "__animus_exclusive_session_owner__", "__animus_engine__", "__animus_v2_engine__", "__animus_v2_sent_sources__", "__animus_v2_drift_warned__"];
124
+ //# sourceMappingURL=singleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../session/singleton.ts"],"names":[],"mappings":"AAoBA,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAIzD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAA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;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,IAAI,CAkBpE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAErD;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAEnD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAE1D;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAE3E;AAID,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC;AAEhC;2EAC2E;AAC3E,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE1D;AAED,wBAAgB,eAAe,IAAI,YAAY,CAQ9C;AAED;;uDAEuD;AAEvD,wBAAgB,aAAa,IAAI,GAAG,CAInC;AAyDD;;;;;;;;GAQG;AAEH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAGlE;AAGD,wBAAgB,SAAS,IAAI,GAAG,CAM/B;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,2hBAkBxB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Verbose build-timing waterfall: JS phases, analysis sub-phases, and the
3
+ * shared Rust phase table. `ANIMUS_TIMING_JSON=1` additionally dumps a
4
+ * machine-readable merged record.
5
+ */
6
+ export declare function logBuildTimings(bt: Record<string, number>, rustTiming: Record<string, number> | undefined, log: (msg: string) => void, verbose: boolean): void;
7
+ //# sourceMappingURL=timing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../session/timing.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC9C,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EAC1B,OAAO,EAAE,OAAO,GACf,IAAI,CAqDN"}
@@ -0,0 +1,43 @@
1
+ import { watch } from 'fs';
2
+ import type { ExtractionSession } from './extraction-session';
3
+ /**
4
+ * Out-of-band pipeline orchestration for Turbopack (spec:
5
+ * next-turbopack-integration). Turbopack exposes no compiler hooks, so the
6
+ * pipeline runs during next.config resolution and, in dev, from a
7
+ * filesystem watcher — the bundler only ever sees the `.animus/` disk
8
+ * artifacts.
9
+ */
10
+ /** Run the full pipeline with the Turbopack emitter identity: the virtual
11
+ * system-props id (Turbopack rejects the webpack path's absolute-path
12
+ * imports). Turbopack orchestration persists the analysis-inputs
13
+ * hydration corpus — its isolated loader workers replay it (spec:
14
+ * next-turbopack-integration, "Manifest disk artifact"; webpack mode
15
+ * skips the corpus). */
16
+ export declare function runSessionPipeline(session: ExtractionSession): Promise<void>;
17
+ /**
18
+ * Start the dev watcher: fs.watch per eligible top-level directory (plus a
19
+ * non-recursive watch on the root itself), debounced into
20
+ * existence-partitioned modified/removed sets feeding
21
+ * `session.handleWatchUpdate` (serialized — updates never overlap).
22
+ * Generated and vendored trees (`.animus`, `.next`, node_modules) are never
23
+ * registered with the OS — recursive registration of those trees exhausts
24
+ * inotify/kqueue descriptors (EMFILE/ENOSPC) on large projects.
25
+ * Idempotent per project root; unref'd so it never holds the process open.
26
+ * Asynchronous FSWatcher errors degrade to no-watch with a warning instead
27
+ * of crashing the dev server. Returns a close handle, or null when this
28
+ * root is already watched or the platform lacks recursive fs.watch (Linux
29
+ * before Node 20 — degrades to no-watch with a warning).
30
+ */
31
+ export declare function startTurbopackWatcher(session: ExtractionSession, rootDir: string, debounceMs?: number, watchFn?: typeof watch): TurbopackWatcherHandle | null;
32
+ /** The project-watch handle `startTurbopackWatcher` returns. `close()` is
33
+ * caller-initiated teardown; `died` flips only on an ASYNC watcher error
34
+ * (EMFILE/ENOSPC after registration) with `onDied` invoked once so the
35
+ * process owner can surface the degradation; `settle()` resolves when the
36
+ * in-flight update chain has drained. */
37
+ export interface TurbopackWatcherHandle {
38
+ close(): void;
39
+ readonly died: boolean;
40
+ onDied: (() => void) | null;
41
+ settle(): Promise<void>;
42
+ }
43
+ //# sourceMappingURL=turbopack-orchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turbopack-orchestrator.d.ts","sourceRoot":"","sources":["../../session/turbopack-orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,EAAE,MAAM,IAAI,CAAC;AAK9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;;;;;GAMG;AAEH;;;;;yBAKyB;AACzB,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAIf;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,MAAM,EACf,UAAU,SAAK,EAGf,OAAO,GAAE,OAAO,KAAa,GAC5B,sBAAsB,GAAG,IAAI,CAoT/B;AAED;;;;0CAI0C;AAC1C,MAAM,WAAW,sBAAsB;IACrC,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB"}