@animus-ui/next-plugin 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.
@@ -1,378 +0,0 @@
1
- import type { AnimusNextOptions } from './types';
2
- /**
3
- * Module id the Rust emitter injects for the extracted stylesheet — also the
4
- * exact resolve.alias key with-animus registers for it, which the adapter's
5
- * alias harvesting must skip.
6
- */
7
- export declare const ANIMUS_CSS_MODULE_ID = ".animus/styles.css";
8
- /** Watch-cycle change sets, as reported by the bundler's watcher. */
9
- export interface WatchChanges {
10
- modifiedFiles?: ReadonlySet<string>;
11
- removedFiles?: ReadonlySet<string>;
12
- }
13
- /**
14
- * Bundler-agnostic extraction pipeline: system loading, source discovery
15
- * and ingestion, external-package collection, analysis, stylesheet and
16
- * system-props emission, and watch-cycle diffing.
17
- *
18
- * The webpack adapter (plugin.ts) owns only bundler wiring: hook
19
- * registration, alias harvesting from the compiler config, in-memory asset
20
- * replacement, and translating watch events into `handleWatchUpdate`
21
- * change sets. Keeping this class free of webpack types is deliberate — a
22
- * future Turbopack integration must drive the same session from outside
23
- * the bundler (Turbopack has no compiler-hook surface), reusing everything
24
- * here unchanged.
25
- *
26
- * Outputs are published through the package singleton (shared CSS,
27
- * manifest, system props) and written to `.animus/` on disk.
28
- */
29
- export declare class ExtractionSession {
30
- /** Set by the adapter before any pipeline run. */
31
- rootDir: string | null;
32
- /** Serialized path aliases, harvested by the adapter from bundler config. */
33
- pathAliasesJson: string | null;
34
- private assetCopyCache;
35
- /** Physical asset files registered with the host watcher. */
36
- assetDependencyPaths: Set<string>;
37
- private assetDependencyKeys;
38
- /** Emitter identity override for the system-props module id. Webpack mode
39
- * (null) injects the absolute `.animus/system-props.js` path, resolved by
40
- * NormalModuleReplacement; Turbopack rejects absolute-path imports, so
41
- * its driver sets the virtual id that `resolveAlias` maps to disk. */
42
- systemPropsModuleId: string | null;
43
- /** Whether the analysis-inputs hydration corpus is serialized + written.
44
- * False (webpack mode): the loader shares the pipeline process and reads
45
- * the manifest from memory — the corpus is never persisted. True is set
46
- * by the Turbopack orchestration driver, whose isolated loader workers
47
- * replay it (spec: next-turbopack-integration, "Manifest disk artifact" /
48
- * "Webpack mode skips the hydration corpus"). */
49
- persistAnalysisInputs: boolean;
50
- /** Absolute directory prefixes for external DS packages (loader allowlisting). */
51
- externalPackageDirs: string[];
52
- /** Absolute package dir → owning specifier (cross-source correlation). */
53
- private externalDirOwners;
54
- /** rootDir-relative external file → owning specifier (correlation join). */
55
- private externalFileOwners;
56
- /** External package specifier → absolute source entry path. */
57
- externalSourceEntries: Map<string, string>;
58
- /** SourceId derivation authority for the current generation (openspec:
59
- * external-source-watch-ingestion, design D2) — canonical roots
60
- * realpath'd once per full pipeline; alias→SourceId associations
61
- * recorded while files exist so deletion resolves through the cache. */
62
- private sourceIdentity;
63
- /** Canonical admitted external root → declared specifiers (set-valued
64
- * ownership, design D2; duplicate specifiers resolving to one canonical
65
- * root share it). Engine watch wiring and tests read this. */
66
- externalRootOwners: Map<string, Set<string>>;
67
- /** Canonical external root → the extension set its collection walk used
68
- * (widened for dist-only roots); rewalks and classification share it. */
69
- private externalRootExtensions;
70
- /** Canonical admitted external watch roots — the engine-side watch
71
- * surface (webpack contextDependencies / Turbopack watchers). */
72
- externalWatchRoots: string[];
73
- /** Canonical external root → (raw sourceKey → {raw content hash, recorded
74
- * abs spelling}): the previous-generation inventory a dirty-root rewalk
75
- * diffs against (design D3). Raw hashes — MDX preprocessing never skews
76
- * the diff; the recorded abs path is a registered deletion alias, so a
77
- * reconstructed deletion always resolves through cached identity. */
78
- private externalInventory;
79
- /** Sticky diagnostics (design D5/D7): stable key → message, re-surfaced
80
- * on every full pipeline until the underlying condition clears. */
81
- readonly stickyDiagnostics: Map<string, string>;
82
- /** Volume-membership predicate for the cross-volume gate (design D5).
83
- * Injected seam: the shared predicate only discriminates on Windows
84
- * (win32 semantics are unit-tested via path.win32), so runtime tests
85
- * drive the gate through this. */
86
- sharesProjectVolume: (projectRoot: string, externalRoot: string) => boolean;
87
- /** Orchestrator seams (openspec: external-source-watch-ingestion, design
88
- * D4). `onExternalRootResolved` fires per volume-admitted external root
89
- * DURING collection — after resolution, BEFORE that root's sources are
90
- * walked — so a watching host can open its handle with no blind gap
91
- * between scan and watch. `onExternalRootsCommitted` fires once after a
92
- * successful full-pipeline publication with the complete admitted
93
- * canonical root set (the host's promote/replay/close-old phase; a
94
- * failed pipeline never fires it, so the host rolls back). */
95
- onExternalRootResolved: ((canonicalRoot: string) => void) | null;
96
- onExternalRootsCommitted: ((canonicalRoots: string[]) => void) | null;
97
- private readonly options;
98
- private readonly staticCssJson;
99
- private system;
100
- /** Discovery-time keyframes diagnostics awaiting the shared surfacing pass. */
101
- private externalKeyframesDiagnostics;
102
- /** Full package-resolution map from the last full pipeline — replayed by
103
- * incremental passes (sourceEntries alone omits dist-resolved packages). */
104
- private lastPackageMap;
105
- private fileCache;
106
- private systemDependencyKeys;
107
- /** Loader-reported dependency paths for bundler watch registration. */
108
- systemDependencyPaths: string[];
109
- private systemDependencyHashes;
110
- private lastSystemPropsHash;
111
- /** Per-payload write guards: payloadHash gates rewrites (byte-identical
112
- * payloads leave disk untouched); diskHash is the hash of the CURRENT
113
- * disk bytes (envelope included) recorded in the analysis-commit. null =
114
- * not yet seeded (first publication reads the artifact's envelope so a
115
- * same-session restart never rewrites byte-identical artifacts). */
116
- private artifactRecords;
117
- /** Last written analysis-commit; null = seeded from disk on first use. */
118
- private lastCommit;
119
- /** Session identity — claimed once per PROCESS (one Next invocation),
120
- * adopted by every subsequent session instance so all compilers share
121
- * one artifact tree (design D2: `next dev`/`next build` co-writing are
122
- * separate processes and therefore separate sessions). */
123
- readonly sessionId: string;
124
- /** Epoch value of the last published analysis; null = not yet known
125
- * (seeded from the session dir's artifact on first publication so a
126
- * same-session restart with unchanged plans never rewrites bytes). */
127
- private lastEpochValue;
128
- /** Watcher debounce ceiling feeding status deadlines (design D3). */
129
- debounceCeilingMs: number;
130
- /** Test seam: observes every session-artifact write (name, content)
131
- * post-rename — write ORDER is part of the transaction contract. */
132
- onArtifactWrite: ((name: string, content: string) => void) | null;
133
- /** Status attempt bookkeeping (design D3). */
134
- private statusAttemptId;
135
- private statusAttemptOpen;
136
- /** Debounce-window observations pending analysis (sourceKey → hash). */
137
- private debouncePending;
138
- /** Session-start hygiene (pruning + legacy cleanup) runs once. */
139
- private sessionStartHygieneDone;
140
- private lcssTargets;
141
- constructor(options: AnimusNextOptions);
142
- /** This session's artifact directory. Requires `rootDir` to be set. */
143
- get sessionDir(): string;
144
- get verbose(): boolean;
145
- private log;
146
- private warn;
147
- private now;
148
- private elapsed;
149
- /** Lazily-computed scan config (options are constructor-fixed, so the
150
- * derivation is stable for the session's lifetime). */
151
- private scanConfigMemo;
152
- /** Resolve the scan configuration from options — the single source of the
153
- * exclude/extension policy shared by the full and incremental pipelines. */
154
- private resolveScanConfig;
155
- /**
156
- * Watch entry point: one single-flight analysis transaction per event
157
- * batch (openspec: next-webpack-served-transform-coherence, design D3).
158
- * The first entering session runs the transaction; every concurrent
159
- * entry — same session re-entered, or another compiler's session
160
- * (client/server/RSC each hold their own instance) — joins the in-flight
161
- * promise, so no compiler proceeds against a generation older than the
162
- * one the transaction publishes. A rejected transaction rejects every
163
- * joiner; the gate always clears.
164
- */
165
- handleWatchUpdate(changes: WatchChanges): Promise<void>;
166
- /**
167
- * Owner-side entry for a batch observed by a NON-OWNING compiler's
168
- * watcher. Serializes behind any in-flight transaction, then runs the
169
- * forwarded batch as its own transaction — never drops it (a forwarded
170
- * batch has no other delivery; content-hash diffing makes an
171
- * already-covered batch a cheap no-op).
172
- */
173
- ingestForwardedBatch(changes: WatchChanges): Promise<void>;
174
- /**
175
- * Incremental watch pass: geological reset when the system file changed,
176
- * otherwise content-hash diffing restricted to the watcher's change sets
177
- * (falling back to a full discovery walk when no sets are provided).
178
- */
179
- private processWatchUpdate;
180
- /**
181
- * Preprocess one `.mdx` entry into scanner-consumable tsx. Returns the
182
- * rewritten source plus the `relPath + '.tsx'` path on success, or null
183
- * when the file must be skipped.
184
- *
185
- * `warn: false` (incremental watch pass) skips silently — the full
186
- * pipeline already surfaced the warning. `warn: true` (full pipeline)
187
- * warns ONCE for a missing @mdx-js/mdx dependency via the shared
188
- * `missingDepFlag` holder, and every time for a preprocessing error.
189
- */
190
- private preprocessMdxEntry;
191
- runFullPipeline(pending?: Array<[string, string]>): Promise<void>;
192
- /**
193
- * Reset analysis state for HMR geological reset. Payload write guards go
194
- * back to null so the next publication reseeds them from the disk
195
- * envelopes — a byte-identical post-reset artifact is still not
196
- * rewritten.
197
- */
198
- resetForHmr(): void;
199
- /**
200
- * The (sourceKey, observedSourceHash) pairs of a watch batch — cheap
201
- * evidence for the status file's pending set on the geological-reset
202
- * path, where the batch's component edits ride along with the system
203
- * edit (design D3: loaders wait only on observed inputs).
204
- */
205
- private pendingFromBatch;
206
- /**
207
- * Root-dirty inventory reconciliation (design D3): partition the
208
- * watcher's change sets into explicit FILE events and external ROOT hits
209
- * (a reported path that IS an admitted root, or a directory inside one),
210
- * rewalk each dirty root through the shared discovery policy, diff the
211
- * SourceId+raw-hash inventory against the previous generation, and merge
212
- * the reconstructed created/edited/deleted deltas with the explicit
213
- * events (identity-level dedup happens downstream at the cache gate).
214
- * Deletion falls out of the inventory diff — webpack may report only the
215
- * directory (probe-proven).
216
- */
217
- private reconcileExternalRoots;
218
- /**
219
- * Route one watcher-reported path (design D1/D2): a project-root member
220
- * (lexical containment — existing local semantics preserved; consumer
221
- * exclude patterns apply) or an admitted external member (identity
222
- * resolution with symlink-escape rejection; package-relative excludes
223
- * mirror the collection walk's filters — guardrail G1, one policy).
224
- * Returns null for dropped paths.
225
- */
226
- private classifyWatchPath;
227
- /**
228
- * Build file entries from cache: every cached file rides with full source.
229
- * The v2 engine has NO Rust-side cache (arch-extract-v2-spine: uncached
230
- * re-analysis beats a cache-hit path), so it must always receive full sources
231
- * (openspec: retire-extract-v1 removed the v1 empty-source cache contract).
232
- */
233
- private buildFileEntriesFromCache;
234
- /**
235
- * Run incremental pipeline with cache-aware file entries.
236
- * Reuses system config from the last full pipeline run.
237
- */
238
- private runIncrementalPipeline;
239
- /**
240
- * Shared analysis + emit core for both pipelines — the single call site
241
- * that routes every manifest through the shared `runProjectAnalysis`,
242
- * reachable from both runFullPipeline (production) and
243
- * runIncrementalPipeline (HMR).
244
- *
245
- * Owns diagnostic surfacing, CSS assembly + styles.css write guard,
246
- * system-props module emit, and the timing log. The `devMode` flag is the
247
- * ONLY behavioral fork:
248
- *
249
- * - `false` (production): computes bt.analysis + logs the extraction
250
- * report, and writes system-props.js UNCONDITIONALLY (no
251
- * lastSystemPropsHash guard).
252
- * - `true` (HMR): skips the report log, and guards the system-props.js
253
- * write by lastSystemPropsHash.
254
- *
255
- * The disk artifacts land under the session directory in transaction
256
- * order (design D1): manifest → analysis-inputs (Turbopack orchestration
257
- * only) → styles.css → system-props → analysis-commit →
258
- * replacements-epoch (last, only when moved). The analysis-status file walks starting → analyzing →
259
- * committing → idle around the attempt, landing in `failed` (with the
260
- * diagnostic) on any throw (design D3).
261
- */
262
- private analyzeAndEmit;
263
- private analyzeAndEmitAttempt;
264
- /** Open a status attempt (attemptId increments once per burst — a
265
- * debouncing pre-write and the analysis that follows share one id). */
266
- private beginStatusAttempt;
267
- /** Write the session's analysis-status artifact (design D3). Terminal
268
- * states (idle/failed) close the attempt. */
269
- private writeAnalysisStatus;
270
- /**
271
- * Orchestrator seam (Turbopack watcher): record watch events observed
272
- * during the debounce window so a loader running ahead of the analysis
273
- * has positive evidence to wait on (design D3 'debouncing'). Paths are
274
- * filtered by the scan config and hashed at observation time.
275
- */
276
- noteDebouncedWatchEvents(absPaths: Iterable<string>): void;
277
- /** One pending microtask flushes a burst of debounce observations. */
278
- private debounceStatusWriteScheduled;
279
- /**
280
- * Write one payload artifact into the session directory, enveloped with
281
- * `{sessionId, generation, replacementEpoch, payloadHash}` and rewritten
282
- * only when the PAYLOAD bytes changed (byte-identical re-analyses leave
283
- * disk untouched — spec: "Unchanged manifest is not rewritten"). The
284
- * recorded diskHash (hash of the enveloped bytes) feeds the
285
- * analysis-commit.
286
- */
287
- private publishPayloadArtifact;
288
- /** Reconstruct a payload write guard from the on-disk artifact's envelope
289
- * (same-session restart: a byte-identical payload must not rewrite). */
290
- private seedPayloadRecord;
291
- /** Last analysis-commit persisted in this session's directory, or null. */
292
- private seedCommitFromDisk;
293
- /**
294
- * Publish the analysis-commit — the transaction identity (design D1).
295
- * Written AFTER every payload and BEFORE the epoch; skipped entirely when
296
- * the payload set (disk hashes) and epoch are unchanged, so a no-op
297
- * re-analysis neither re-keys loader-worker hydration nor burns a
298
- * generation.
299
- */
300
- private publishAnalysisCommit;
301
- /**
302
- * Publish the canonical replacement epoch: maintain the session-scoped
303
- * disk witness `{schema, sessionId, epoch}`, rewritten ONLY when the
304
- * epoch VALUE changes so style-only analyses and same-session restarts
305
- * leave bytes and mtime untouched, then expose the value through the
306
- * singleton for the plugin's needBuild fan-out and the loader's catch-up
307
- * re-check. Every VALUE move also reconciles sibling sessions' epoch
308
- * artifacts (below) — the webpack cold-cache validity witness.
309
- */
310
- private publishReplacementEpoch;
311
- /**
312
- * Sibling epoch reconciliation — the cross-session half of the webpack
313
- * persistent-cache witness (spec: dev-served-transform-coherence,
314
- * "Offline change invalidates restored modules"). Restored-module
315
- * snapshots reference the epoch artifact of the session that BUILT them;
316
- * with session-scoped trees that file would otherwise sit untouched
317
- * forever, keeping stale snapshots valid. Whenever this session's epoch
318
- * value moves, delete every sibling epoch artifact that disagrees (their
319
- * snapshots must invalidate — restore-on-demand then rebuilds from the
320
- * current generation) and leave agreeing siblings byte-untouched (warm
321
- * restores stay valid). Deleting a stale artifact is pruning, not a
322
- * foreign-session write; races with concurrent sessions are tolerated
323
- * (S14).
324
- */
325
- /** Sibling ids already reconciled away (artifact deleted or absent) —
326
- * nothing left to invalidate for them on later moves. */
327
- private reconciledSiblingIds;
328
- /** sessions-root listing memo, keyed by the root dir's mtime — a new or
329
- * pruned sibling DIRECTORY moves it; agreeing siblings stay listed. */
330
- private siblingListing;
331
- private reconcileSiblingEpochs;
332
- /** Epoch value held by this session's on-disk artifact, or null when
333
- * absent, unreadable, or not the expected schema. */
334
- private diskEpochValue;
335
- /** Session-start hygiene (design D2): delete legacy flat artifacts
336
- * (unreachable by session-scoped loaders) and prune sibling session
337
- * directories older than the retention window — never the own dir,
338
- * tolerating races with concurrently-pruning sessions (S14). */
339
- private runSessionStartHygiene;
340
- /** Ensure the session directory exists and write one artifact into it.
341
- * Write-then-rename so cross-process readers (Turbopack loader workers)
342
- * can never observe a torn half-written file. The tmp name carries the
343
- * pid — Next dev evaluates the config in more than one process, and two
344
- * sessions writing the same artifact must not race on one tmp path. */
345
- private writeSessionArtifact;
346
- /**
347
- * asset() placeholder substitution (global-styles-system): resolve each
348
- * referenced specifier through Node resolution, copy the bytes into the
349
- * session directory's `assets/` under a content-hashed name, and
350
- * substitute a RELATIVE url — relative to the session-scoped styles.css,
351
- * which sits beside `assets/`, so the emitted `./assets/<file>` form is
352
- * unchanged. The stylesheet is processed by Next's own CSS pipeline
353
- * (webpack and Turbopack alike), which applies its native asset handling
354
- * — publicPath and output hashing — to relative url() references.
355
- * Unsubstitutable specifiers warn and emit literally in non-strict mode,
356
- * fail the build under `strict: true`.
357
- */
358
- private substituteAssetReferences;
359
- private trackAssetDependency;
360
- /**
361
- * Resolve an asset specifier to an absolute file via the shared pipeline
362
- * resolver (host aliases → Node resolution → package root), with one
363
- * session-local last resort: an already-discovered source entry's package
364
- * root (dist-less workspace kits the shared resolver cannot see).
365
- */
366
- private resolveAssetSpecifier;
367
- }
368
- /**
369
- * Sync `.animus/assets/` to the current build's content-hashed file set:
370
- * anything else in the directory is a superseded revision (the copies are
371
- * content-addressed and never overwritten) or the leftover of an asset()
372
- * reference that no longer exists. Failures are tolerated per entry — Next
373
- * dev evaluates the config in more than one process, and a concurrent
374
- * session may have removed (or be about to rewrite) the same file; every
375
- * pass rewrites whatever of its own set is missing, so races self-heal.
376
- */
377
- export declare function pruneStaleAssets(assetsDir: string, expected: ReadonlySet<string>): void;
378
- //# sourceMappingURL=extraction-session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extraction-session.d.ts","sourceRoot":"","sources":["../src/extraction-session.ts"],"names":[],"mappings":"AA8FA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AASjD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAgCzD,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAiB;IAC5B,kDAAkD;IAClD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC9B,6EAA6E;IAC7E,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IAItC,OAAO,CAAC,cAAc,CASlB;IACJ,6DAA6D;IAC7D,oBAAoB,cAAqB;IACzC,OAAO,CAAC,mBAAmB,CAAqB;IAChD;;;2EAGuE;IACvE,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC1C;;;;;sDAKkD;IAClD,qBAAqB,UAAS;IAE9B,kFAAkF;IAClF,mBAAmB,EAAE,MAAM,EAAE,CAAM;IACnC,0EAA0E;IAC1E,OAAO,CAAC,iBAAiB,CAA8B;IACvD,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB,CAA8B;IACxD,+DAA+D;IAC/D,qBAAqB,sBAA6B;IAClD;;;6EAGyE;IACzE,OAAO,CAAC,cAAc,CAA+B;IACrD;;mEAE+D;IAC/D,kBAAkB,2BAAkC;IACpD;8EAC0E;IAC1E,OAAO,CAAC,sBAAsB,CAA0C;IACxE;sEACkE;IAClE,kBAAkB,EAAE,MAAM,EAAE,CAAM;IAClC;;;;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C,mBAAmB;IAoB3B;;;;;OAKG;IACH,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CA+BzD;IAED,sEAAsE;IACtE,OAAO,CAAC,4BAA4B,CAAS;IAE7C;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAyB9B;6EACyE;IACzE,OAAO,CAAC,iBAAiB;IAqBzB,2EAA2E;IAC3E,OAAO,CAAC,kBAAkB;IAe1B;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAiC7B;;;;;;;;OAQG;IACH,OAAO,CAAC,uBAAuB;IA4B/B;;;;;;;;;;;;;OAaG;IACH;8DAC0D;IAC1D,OAAO,CAAC,oBAAoB,CAAqB;IACjD;4EACwE;IACxE,OAAO,CAAC,cAAc,CAAuD;IAE7E,OAAO,CAAC,sBAAsB;IA8C9B;0DACsD;IACtD,OAAO,CAAC,cAAc;IAatB;;;qEAGiE;IACjE,OAAO,CAAC,sBAAsB;IA+B9B;;;;4EAIwE;IACxE,OAAO,CAAC,oBAAoB;IAU5B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,yBAAyB;IA2EjC,OAAO,CAAC,oBAAoB;IAK5B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;CA0B9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAC5B,IAAI,CAgBN"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Resolve external DS package specifiers to rootDir-relative entry paths.
3
- * Node-generic (no webpack APIs): Pass 1 walks the consumer's workspaces for
4
- * matching package names; Pass 2 falls back to `require.resolve`. Specifiers
5
- * that resolve nowhere are simply omitted (spec: silent skip).
6
- */
7
- export declare function resolvePackagesByName(rootDir: string, names: string[]): Record<string, string>;
8
- //# sourceMappingURL=resolve-packages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-packages.d.ts","sourceRoot":"","sources":["../src/resolve-packages.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EAAE,GACd,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA0DxB"}
@@ -1,229 +0,0 @@
1
- require("./turbopack-loader.cjs");
2
- let path = require("path");
3
- //#region src/session-paths.ts
4
- /**
5
- * Session-scoped artifact names, path derivations, and the analysis-status
6
- * shape (openspec: next-turbopack-served-transform-coherence, design D1–D3)
7
- * — shared by the session writer (extraction-session), the webpack
8
- * plugin/loader, and the Turbopack loader.
9
- *
10
- * Deliberately free of singleton/session imports: the Turbopack loader
11
- * executes in isolated worker processes and its module graph must stay
12
- * worker-local (guardrail G1) — this module is pure path/shape vocabulary.
13
- */
14
- /** Session-dir-relative name of the replacement-epoch disk witness
15
- * (openspec: next-webpack-served-transform-coherence, design D2;
16
- * session-scoped by next-turbopack-served-transform-coherence D2). */
17
- const REPLACEMENT_EPOCH_ARTIFACT = "replacements-epoch";
18
- /** Session-dir-relative name of the analysis-commit transaction artifact
19
- * (design D1). */
20
- const ANALYSIS_COMMIT_ARTIFACT = "analysis-commit";
21
- /** Session-dir-relative name of the analysis-status artifact (design D3). */
22
- const ANALYSIS_STATUS_ARTIFACT = "analysis-status.json";
23
- /** Session-dir-relative name of the manifest payload artifact. */
24
- const MANIFEST_ARTIFACT = "manifest.json";
25
- /** Session-dir-relative name of the analysis-inputs payload artifact
26
- * (Turbopack loader-worker hydration corpus). */
27
- const ANALYSIS_INPUTS_ARTIFACT = "analysis-inputs.json";
28
- /** Session-dir-relative name of the emitted stylesheet artifact. */
29
- const STYLES_ARTIFACT = "styles.css";
30
- /** Session-dir-relative name of the emitted system-props module. */
31
- const SYSTEM_PROPS_ARTIFACT = "system-props.js";
32
- /** Session-dir-relative directory holding copied asset() files. */
33
- const SESSION_ASSETS_DIR = "assets";
34
- /** Root of every session-scoped artifact tree for a project. */
35
- function sessionsRootDir(rootDir) {
36
- return (0, path.join)(rootDir, ".animus", "sessions");
37
- }
38
- /** One session's artifact directory (design D2: session-scoped trees,
39
- * no global pointer). */
40
- function sessionArtifactDir(rootDir, sessionId) {
41
- return (0, path.join)(sessionsRootDir(rootDir), sessionId);
42
- }
43
- /** Absolute path of a session's replacement-epoch artifact — the single
44
- * derivation shared by the session writer, the webpack plugin's
45
- * watch-ignore entry, and both loaders' file dependencies. Takes the
46
- * SESSION directory (not the project root) since the artifact was
47
- * relocated into the session tree. */
48
- function replacementEpochPath(sessionDir) {
49
- return (0, path.join)(sessionDir, REPLACEMENT_EPOCH_ARTIFACT);
50
- }
51
- /** Absolute path of a session's analysis-commit artifact. */
52
- function analysisCommitPath(sessionDir) {
53
- return (0, path.join)(sessionDir, ANALYSIS_COMMIT_ARTIFACT);
54
- }
55
- /** Absolute path of a session's analysis-status artifact. */
56
- function analysisStatusPath(sessionDir) {
57
- return (0, path.join)(sessionDir, ANALYSIS_STATUS_ARTIFACT);
58
- }
59
- /** Absolute path of a session's manifest artifact. */
60
- function manifestPath(sessionDir) {
61
- return (0, path.join)(sessionDir, MANIFEST_ARTIFACT);
62
- }
63
- /** Absolute path of a session's analysis-inputs artifact. */
64
- function analysisInputsPath(sessionDir) {
65
- return (0, path.join)(sessionDir, ANALYSIS_INPUTS_ARTIFACT);
66
- }
67
- /** Absolute path of a session's stylesheet artifact. */
68
- function stylesPath(sessionDir) {
69
- return (0, path.join)(sessionDir, STYLES_ARTIFACT);
70
- }
71
- /** Absolute path of a session's system-props module artifact. */
72
- function systemPropsPath(sessionDir) {
73
- return (0, path.join)(sessionDir, SYSTEM_PROPS_ARTIFACT);
74
- }
75
- /** Splice the session envelope into a JSON-object payload as a leading
76
- * `__animusSession` field, byte-preserving the payload's own content
77
- * (parse/re-stringify could reformat engine-emitted JSON). */
78
- function envelopeJsonArtifact(payload, envelopeJson) {
79
- const trimmed = payload.trimStart();
80
- if (!trimmed.startsWith("{")) return payload;
81
- if (trimmed.slice(1).trimStart().startsWith("}")) return `{"__animusSession":${envelopeJson}}`;
82
- return `{"__animusSession":${envelopeJson},${trimmed.slice(1)}`;
83
- }
84
- /** Trailing-comment side-band for the CSS artifact (a leading comment
85
- * would displace the @layer declaration consumers pin at offset 0). */
86
- function envelopeCssArtifact(payload, envelopeJson) {
87
- return `${payload}\n/* __animusSession ${envelopeJson} */\n`;
88
- }
89
- /** Matches the CSS artifact's envelope side-band. */
90
- const ENVELOPE_CSS_COMMENT_RE = /\/\* __animusSession (\{.*\}) \*\//;
91
- /** Envelope of a JSON artifact's bytes, or undefined when the artifact
92
- * carries none. THROWS on unparseable bytes — callers decide whether a
93
- * torn artifact fails closed or degrades. */
94
- function readJsonEnvelope(bytes) {
95
- return JSON.parse(bytes).__animusSession;
96
- }
97
- /** Envelope of the CSS artifact's side-band comment, or undefined when the
98
- * side-band is absent. THROWS on an unparseable envelope body. */
99
- function readCssEnvelope(bytes) {
100
- const match = bytes.match(ENVELOPE_CSS_COMMENT_RE);
101
- return match ? JSON.parse(match[1]) : void 0;
102
- }
103
- //#endregion
104
- Object.defineProperty(exports, "ANALYSIS_COMMIT_ARTIFACT", {
105
- enumerable: true,
106
- get: function() {
107
- return ANALYSIS_COMMIT_ARTIFACT;
108
- }
109
- });
110
- Object.defineProperty(exports, "ANALYSIS_INPUTS_ARTIFACT", {
111
- enumerable: true,
112
- get: function() {
113
- return ANALYSIS_INPUTS_ARTIFACT;
114
- }
115
- });
116
- Object.defineProperty(exports, "ANALYSIS_STATUS_ARTIFACT", {
117
- enumerable: true,
118
- get: function() {
119
- return ANALYSIS_STATUS_ARTIFACT;
120
- }
121
- });
122
- Object.defineProperty(exports, "MANIFEST_ARTIFACT", {
123
- enumerable: true,
124
- get: function() {
125
- return MANIFEST_ARTIFACT;
126
- }
127
- });
128
- Object.defineProperty(exports, "REPLACEMENT_EPOCH_ARTIFACT", {
129
- enumerable: true,
130
- get: function() {
131
- return REPLACEMENT_EPOCH_ARTIFACT;
132
- }
133
- });
134
- Object.defineProperty(exports, "SESSION_ASSETS_DIR", {
135
- enumerable: true,
136
- get: function() {
137
- return SESSION_ASSETS_DIR;
138
- }
139
- });
140
- Object.defineProperty(exports, "STYLES_ARTIFACT", {
141
- enumerable: true,
142
- get: function() {
143
- return STYLES_ARTIFACT;
144
- }
145
- });
146
- Object.defineProperty(exports, "SYSTEM_PROPS_ARTIFACT", {
147
- enumerable: true,
148
- get: function() {
149
- return SYSTEM_PROPS_ARTIFACT;
150
- }
151
- });
152
- Object.defineProperty(exports, "analysisCommitPath", {
153
- enumerable: true,
154
- get: function() {
155
- return analysisCommitPath;
156
- }
157
- });
158
- Object.defineProperty(exports, "analysisInputsPath", {
159
- enumerable: true,
160
- get: function() {
161
- return analysisInputsPath;
162
- }
163
- });
164
- Object.defineProperty(exports, "analysisStatusPath", {
165
- enumerable: true,
166
- get: function() {
167
- return analysisStatusPath;
168
- }
169
- });
170
- Object.defineProperty(exports, "envelopeCssArtifact", {
171
- enumerable: true,
172
- get: function() {
173
- return envelopeCssArtifact;
174
- }
175
- });
176
- Object.defineProperty(exports, "envelopeJsonArtifact", {
177
- enumerable: true,
178
- get: function() {
179
- return envelopeJsonArtifact;
180
- }
181
- });
182
- Object.defineProperty(exports, "manifestPath", {
183
- enumerable: true,
184
- get: function() {
185
- return manifestPath;
186
- }
187
- });
188
- Object.defineProperty(exports, "readCssEnvelope", {
189
- enumerable: true,
190
- get: function() {
191
- return readCssEnvelope;
192
- }
193
- });
194
- Object.defineProperty(exports, "readJsonEnvelope", {
195
- enumerable: true,
196
- get: function() {
197
- return readJsonEnvelope;
198
- }
199
- });
200
- Object.defineProperty(exports, "replacementEpochPath", {
201
- enumerable: true,
202
- get: function() {
203
- return replacementEpochPath;
204
- }
205
- });
206
- Object.defineProperty(exports, "sessionArtifactDir", {
207
- enumerable: true,
208
- get: function() {
209
- return sessionArtifactDir;
210
- }
211
- });
212
- Object.defineProperty(exports, "sessionsRootDir", {
213
- enumerable: true,
214
- get: function() {
215
- return sessionsRootDir;
216
- }
217
- });
218
- Object.defineProperty(exports, "stylesPath", {
219
- enumerable: true,
220
- get: function() {
221
- return stylesPath;
222
- }
223
- });
224
- Object.defineProperty(exports, "systemPropsPath", {
225
- enumerable: true,
226
- get: function() {
227
- return systemPropsPath;
228
- }
229
- });