@animus-ui/next-plugin 0.1.6 → 0.1.8
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/extraction-session.d.ts +216 -26
- package/dist/extraction-session.d.ts.map +1 -1
- package/dist/index.cjs +980 -144
- package/dist/index.mjs +977 -143
- package/dist/loader-path.d.ts +16 -0
- package/dist/loader-path.d.ts.map +1 -0
- package/dist/loader.cjs +40 -4
- package/dist/loader.d.ts +13 -0
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.mjs +38 -3
- package/dist/plugin.d.ts +65 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/session-paths-CZoi19NW.cjs +229 -0
- package/dist/session-paths-DfYIPDcM.mjs +107 -0
- package/dist/session-paths.d.ts +107 -0
- package/dist/session-paths.d.ts.map +1 -0
- package/dist/singleton-372wiSRr.mjs +202 -0
- package/dist/{singleton-DH7yeWZa.cjs → singleton-D4vhawsW.cjs} +149 -0
- package/dist/singleton.d.ts +55 -0
- package/dist/singleton.d.ts.map +1 -1
- package/dist/turbopack-config.d.ts +6 -1
- package/dist/turbopack-config.d.ts.map +1 -1
- package/dist/turbopack-loader.cjs +231 -39
- package/dist/turbopack-loader.d.ts +29 -6
- package/dist/turbopack-loader.d.ts.map +1 -1
- package/dist/turbopack-loader.mjs +203 -42
- package/dist/turbopack-orchestrator.d.ts +6 -3
- package/dist/turbopack-orchestrator.d.ts.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/with-animus.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-y_GBKt04.mjs +0 -5
- package/dist/singleton-BKALu7Mk.mjs +0 -108
- /package/dist/{loader-core-CbaYNhBu.cjs → loader-core-C40WbC6s.cjs} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one loader-path derivation: first existing dist candidate under the
|
|
3
|
+
* plugin dir, else the in-repo source fallback. Both loader resolvers below
|
|
4
|
+
* are thin wrappers, so rule registration and any loader-chain predicate
|
|
5
|
+
* can never drift (openspec: next-webpack-served-transform-coherence,
|
|
6
|
+
* design D1).
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveLoaderPath(pluginDir: string, distCandidates: string[], sourceFallback: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* This package's webpack loader path, shared by the rule registration
|
|
11
|
+
* (with-animus) and the needBuild loader-chain predicate (plugin). Compiled
|
|
12
|
+
* dist ships `loader.mjs` next to this module; running from source falls
|
|
13
|
+
* back to the TypeScript loader.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveAnimusLoaderPath(): string;
|
|
16
|
+
//# sourceMappingURL=loader-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-path.d.ts","sourceRoot":"","sources":["../src/loader-path.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,GACrB,MAAM,CAMR;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD"}
|
package/dist/loader.cjs
CHANGED
|
@@ -1,20 +1,56 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const require_session_paths = require("./session-paths-CZoi19NW.cjs");
|
|
2
|
+
const require_singleton = require("./singleton-D4vhawsW.cjs");
|
|
3
|
+
const require_loader_core = require("./loader-core-C40WbC6s.cjs");
|
|
4
|
+
require("./turbopack-loader.cjs");
|
|
5
|
+
let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
|
|
6
|
+
let fs = require("fs");
|
|
3
7
|
let path = require("path");
|
|
4
8
|
//#region src/loader.ts
|
|
9
|
+
/** Session dirs whose epoch artifact has been SEEN on disk — the artifact
|
|
10
|
+
* is never deleted once written, so a positive existsSync is stable for
|
|
11
|
+
* the life of the process (negatives always re-probe). */
|
|
12
|
+
const epochSeenForSessionDir = /* @__PURE__ */ new Set();
|
|
5
13
|
/**
|
|
6
14
|
* Webpack loader for Animus source transformation.
|
|
7
15
|
* Runs with enforce: 'pre' to see original source before Babel/SWC.
|
|
8
16
|
* The manifest arrives via the process singleton (the webpack pipeline and
|
|
9
17
|
* this loader share one process); the transform + CSS-import policy lives
|
|
10
18
|
* in the shared loader-core.
|
|
19
|
+
*
|
|
20
|
+
* Coherence duties (openspec: next-webpack-served-transform-coherence):
|
|
21
|
+
* every dev invocation registers the replacement-epoch artifact as a file
|
|
22
|
+
* dependency (design D2 — restored persistent-cache modules snapshot it, so
|
|
23
|
+
* offline epoch moves invalidate them), and an analyzed file whose current
|
|
24
|
+
* source hash mismatches its analyzed hash fails with the stable diagnostic
|
|
25
|
+
* `ANIMUS_ANALYSIS_CATCHING_UP` after one refreshed re-check (design D4 —
|
|
26
|
+
* unconditional: a zero-entry stale manifest must never publish raw bytes).
|
|
11
27
|
*/
|
|
12
28
|
function animusLoader(source) {
|
|
13
|
-
|
|
29
|
+
if (this.mode !== "production" && typeof this.addDependency === "function") {
|
|
30
|
+
const sessionDir = require_singleton.getSessionArtifactDir();
|
|
31
|
+
if (sessionDir) {
|
|
32
|
+
const epochPath = require_session_paths.replacementEpochPath(sessionDir);
|
|
33
|
+
if (epochSeenForSessionDir.has(sessionDir) || (0, fs.existsSync)(epochPath)) {
|
|
34
|
+
epochSeenForSessionDir.add(sessionDir);
|
|
35
|
+
this.addDependency(epochPath);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let manifestJson = require_singleton.getManifestJson();
|
|
14
40
|
if (!manifestJson) return source;
|
|
41
|
+
const filename = (0, path.relative)(this.rootContext, this.resourcePath);
|
|
42
|
+
const analyzedHash = require_singleton.getAnalyzedHashes()?.get(filename);
|
|
43
|
+
if (analyzedHash !== void 0) {
|
|
44
|
+
const sourceHash = (0, _animus_ui_extract_pipeline.contentHash)(source);
|
|
45
|
+
if (sourceHash !== analyzedHash) {
|
|
46
|
+
const refreshedHash = require_singleton.getAnalyzedHashes()?.get(filename);
|
|
47
|
+
if (refreshedHash === void 0 || sourceHash !== refreshedHash) throw new Error(`ANIMUS_ANALYSIS_CATCHING_UP: ${filename} changed after the current analysis; retrying on the next watch turn`);
|
|
48
|
+
manifestJson = require_singleton.getManifestJson() ?? manifestJson;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
15
51
|
return require_loader_core.transformWithManifest({
|
|
16
52
|
source,
|
|
17
|
-
filename
|
|
53
|
+
filename,
|
|
18
54
|
manifestJson,
|
|
19
55
|
engineApi: require_singleton.engineApi,
|
|
20
56
|
opts: this.getOptions?.() ?? {}
|
package/dist/loader.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ type LoaderContext = {
|
|
|
3
3
|
resourcePath: string;
|
|
4
4
|
rootContext: string;
|
|
5
5
|
getOptions: () => LoaderPolicyOptions;
|
|
6
|
+
/** webpack file-dependency registration — optional so bare policy tests
|
|
7
|
+
* can drive the loader without a full context. */
|
|
8
|
+
addDependency?: (file: string) => void;
|
|
9
|
+
/** webpack build mode; production invocations stay engine-verbatim. */
|
|
10
|
+
mode?: 'development' | 'production' | 'none';
|
|
6
11
|
};
|
|
7
12
|
/**
|
|
8
13
|
* Webpack loader for Animus source transformation.
|
|
@@ -10,6 +15,14 @@ type LoaderContext = {
|
|
|
10
15
|
* The manifest arrives via the process singleton (the webpack pipeline and
|
|
11
16
|
* this loader share one process); the transform + CSS-import policy lives
|
|
12
17
|
* in the shared loader-core.
|
|
18
|
+
*
|
|
19
|
+
* Coherence duties (openspec: next-webpack-served-transform-coherence):
|
|
20
|
+
* every dev invocation registers the replacement-epoch artifact as a file
|
|
21
|
+
* dependency (design D2 — restored persistent-cache modules snapshot it, so
|
|
22
|
+
* offline epoch moves invalidate them), and an analyzed file whose current
|
|
23
|
+
* source hash mismatches its analyzed hash fails with the stable diagnostic
|
|
24
|
+
* `ANIMUS_ANALYSIS_CATCHING_UP` after one refreshed re-check (design D4 —
|
|
25
|
+
* unconditional: a zero-entry stale manifest must never publish raw bytes).
|
|
13
26
|
*/
|
|
14
27
|
export default function animusLoader(this: LoaderContext, source: string): string;
|
|
15
28
|
export {};
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAOzD,KAAK,aAAa,GAAG;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,mBAAmB,CAAC;IACtC;uDACmD;IACnD,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,uEAAuE;IACvE,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,GAAG,MAAM,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,GACb,MAAM,CAmDR"}
|
package/dist/loader.mjs
CHANGED
|
@@ -1,20 +1,55 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as replacementEpochPath } from "./session-paths-DfYIPDcM.mjs";
|
|
2
|
+
import { a as getManifestJson, i as getAnalyzedHashes, n as engineApi, s as getSessionArtifactDir } from "./singleton-372wiSRr.mjs";
|
|
2
3
|
import { t as transformWithManifest } from "./loader-core-D6Tm_b8F.mjs";
|
|
4
|
+
import { contentHash } from "@animus-ui/extract/pipeline";
|
|
5
|
+
import { existsSync } from "fs";
|
|
3
6
|
import { relative } from "path";
|
|
4
7
|
//#region src/loader.ts
|
|
8
|
+
/** Session dirs whose epoch artifact has been SEEN on disk — the artifact
|
|
9
|
+
* is never deleted once written, so a positive existsSync is stable for
|
|
10
|
+
* the life of the process (negatives always re-probe). */
|
|
11
|
+
const epochSeenForSessionDir = /* @__PURE__ */ new Set();
|
|
5
12
|
/**
|
|
6
13
|
* Webpack loader for Animus source transformation.
|
|
7
14
|
* Runs with enforce: 'pre' to see original source before Babel/SWC.
|
|
8
15
|
* The manifest arrives via the process singleton (the webpack pipeline and
|
|
9
16
|
* this loader share one process); the transform + CSS-import policy lives
|
|
10
17
|
* in the shared loader-core.
|
|
18
|
+
*
|
|
19
|
+
* Coherence duties (openspec: next-webpack-served-transform-coherence):
|
|
20
|
+
* every dev invocation registers the replacement-epoch artifact as a file
|
|
21
|
+
* dependency (design D2 — restored persistent-cache modules snapshot it, so
|
|
22
|
+
* offline epoch moves invalidate them), and an analyzed file whose current
|
|
23
|
+
* source hash mismatches its analyzed hash fails with the stable diagnostic
|
|
24
|
+
* `ANIMUS_ANALYSIS_CATCHING_UP` after one refreshed re-check (design D4 —
|
|
25
|
+
* unconditional: a zero-entry stale manifest must never publish raw bytes).
|
|
11
26
|
*/
|
|
12
27
|
function animusLoader(source) {
|
|
13
|
-
|
|
28
|
+
if (this.mode !== "production" && typeof this.addDependency === "function") {
|
|
29
|
+
const sessionDir = getSessionArtifactDir();
|
|
30
|
+
if (sessionDir) {
|
|
31
|
+
const epochPath = replacementEpochPath(sessionDir);
|
|
32
|
+
if (epochSeenForSessionDir.has(sessionDir) || existsSync(epochPath)) {
|
|
33
|
+
epochSeenForSessionDir.add(sessionDir);
|
|
34
|
+
this.addDependency(epochPath);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let manifestJson = getManifestJson();
|
|
14
39
|
if (!manifestJson) return source;
|
|
40
|
+
const filename = relative(this.rootContext, this.resourcePath);
|
|
41
|
+
const analyzedHash = getAnalyzedHashes()?.get(filename);
|
|
42
|
+
if (analyzedHash !== void 0) {
|
|
43
|
+
const sourceHash = contentHash(source);
|
|
44
|
+
if (sourceHash !== analyzedHash) {
|
|
45
|
+
const refreshedHash = getAnalyzedHashes()?.get(filename);
|
|
46
|
+
if (refreshedHash === void 0 || sourceHash !== refreshedHash) throw new Error(`ANIMUS_ANALYSIS_CATCHING_UP: ${filename} changed after the current analysis; retrying on the next watch turn`);
|
|
47
|
+
manifestJson = getManifestJson() ?? manifestJson;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
15
50
|
return transformWithManifest({
|
|
16
51
|
source,
|
|
17
|
-
filename
|
|
52
|
+
filename,
|
|
18
53
|
manifestJson,
|
|
19
54
|
engineApi,
|
|
20
55
|
opts: this.getOptions?.() ?? {}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -21,11 +21,32 @@ type Compilation = {
|
|
|
21
21
|
missingDependencies: {
|
|
22
22
|
add(path: string): void;
|
|
23
23
|
};
|
|
24
|
+
/** Directory watch inputs (webpack 5 LazySet). External kit roots are
|
|
25
|
+
* registered here every compilation so UNIMPORTED creations still
|
|
26
|
+
* produce watch turns — webpack reports the DIRECTORY, and the
|
|
27
|
+
* session's root-dirty rewalk reconstructs the delta (openspec:
|
|
28
|
+
* external-source-watch-ingestion, design D3; probe E). */
|
|
29
|
+
contextDependencies: {
|
|
30
|
+
add(path: string): void;
|
|
31
|
+
};
|
|
24
32
|
getAsset(name: string): {
|
|
25
33
|
source: WebpackSource;
|
|
26
34
|
} | undefined;
|
|
27
35
|
updateAsset(name: string, newSource: WebpackSource): void;
|
|
28
36
|
};
|
|
37
|
+
/** The slice of a webpack Module the needBuild predicate inspects. */
|
|
38
|
+
type CandidateModule = {
|
|
39
|
+
loaders?: Array<{
|
|
40
|
+
loader?: string;
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
type NeedBuildCallback = (err?: Error | null, result?: boolean) => void;
|
|
44
|
+
/** NormalModule.getCompilationHooks(...) slice (webpack 5). */
|
|
45
|
+
type NormalModuleCompilationHooks = {
|
|
46
|
+
needBuild?: {
|
|
47
|
+
tapAsync: (name: string, fn: (module: CandidateModule, context: unknown, callback: NeedBuildCallback) => void) => void;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
29
50
|
type Compiler = {
|
|
30
51
|
hooks: {
|
|
31
52
|
run: {
|
|
@@ -37,6 +58,9 @@ type Compiler = {
|
|
|
37
58
|
compilation: {
|
|
38
59
|
tap: (name: string, fn: (compilation: Compilation) => void) => void;
|
|
39
60
|
};
|
|
61
|
+
thisCompilation: {
|
|
62
|
+
tap: (name: string, fn: (compilation: unknown) => void) => void;
|
|
63
|
+
};
|
|
40
64
|
};
|
|
41
65
|
context: string;
|
|
42
66
|
/** Present on watchRun compilers after the first compilation (webpack 5). */
|
|
@@ -47,6 +71,9 @@ type Compiler = {
|
|
|
47
71
|
resolve?: {
|
|
48
72
|
alias?: Record<string, string | string[] | false>;
|
|
49
73
|
};
|
|
74
|
+
watchOptions?: {
|
|
75
|
+
ignored?: unknown;
|
|
76
|
+
};
|
|
50
77
|
};
|
|
51
78
|
webpack?: {
|
|
52
79
|
Compilation: {
|
|
@@ -55,6 +82,11 @@ type Compiler = {
|
|
|
55
82
|
sources: {
|
|
56
83
|
RawSource: new (source: string) => WebpackSource;
|
|
57
84
|
};
|
|
85
|
+
/** Obtained from the compiler instance at hook time — NEVER a top-level
|
|
86
|
+
* webpack import (Next ships its own compiled webpack). */
|
|
87
|
+
NormalModule?: {
|
|
88
|
+
getCompilationHooks?: (compilation: unknown) => NormalModuleCompilationHooks;
|
|
89
|
+
};
|
|
58
90
|
};
|
|
59
91
|
};
|
|
60
92
|
/**
|
|
@@ -69,7 +101,31 @@ export declare class AnimusWebpackPlugin {
|
|
|
69
101
|
private session;
|
|
70
102
|
private initialized;
|
|
71
103
|
private aliasesExtracted;
|
|
104
|
+
/** Loader paths counting as "the animus loader" in a module's chain —
|
|
105
|
+
* this package's own loader plus an optional harness override. */
|
|
106
|
+
private readonly animusLoaderPaths;
|
|
107
|
+
/** Epoch THIS compiler last proceeded with (set after every awaited
|
|
108
|
+
* watchRun transaction — including joined ones). Null until the
|
|
109
|
+
* initialization pipeline publishes. */
|
|
110
|
+
private lastBuiltEpoch;
|
|
111
|
+
/** Armed by watchRun when the transaction moved the epoch; captured and
|
|
112
|
+
* disarmed by the next compilation's needBuild wiring (design D1). */
|
|
113
|
+
private epochMovedForNextCompilation;
|
|
72
114
|
constructor(options: AnimusNextOptions);
|
|
115
|
+
/** True when the module's loader chain contains the animus loader — the
|
|
116
|
+
* needBuild fan-out predicate (design D1: no historical records; covers
|
|
117
|
+
* restored persistent-cache modules and raw passthroughs alike). */
|
|
118
|
+
private moduleUsesAnimusLoader;
|
|
119
|
+
/** Append the exact epoch artifact path to `watchOptions.ignored`,
|
|
120
|
+
* preserving the user's shape (design D2: the artifact participates in
|
|
121
|
+
* module snapshots via addDependency but never triggers live watch
|
|
122
|
+
* turns — no echo compilations). Session identity is process-claimed,
|
|
123
|
+
* so every compiler's plugin instance derives the SAME session-scoped
|
|
124
|
+
* path here regardless of which instance ends up owning the pipeline.
|
|
125
|
+
* Derived from the ONE root (session.rootDir, set at config time by
|
|
126
|
+
* with-animus); compiler.context is the fallback for bare-apply
|
|
127
|
+
* harnesses — identical when compiler.context === cwd. */
|
|
128
|
+
private appendEpochWatchIgnore;
|
|
73
129
|
/** Extract path aliases from webpack's resolve.alias config. Runs once per
|
|
74
130
|
* plugin instance — the resolve config is immutable after apply. */
|
|
75
131
|
private extractAliases;
|
|
@@ -78,6 +134,15 @@ export declare class AnimusWebpackPlugin {
|
|
|
78
134
|
* Reset analysis state for HMR geological reset.
|
|
79
135
|
*/
|
|
80
136
|
resetForHmr(): void;
|
|
137
|
+
/** Session identity (process-claimed) — with-animus derives the
|
|
138
|
+
* session-scoped alias/stub paths from it (design D2). */
|
|
139
|
+
get sessionId(): string;
|
|
140
|
+
/** Set the project root at CONFIG time (with-animus) — the ONE root all
|
|
141
|
+
* session-path derivations use. The compiler hooks re-assert it from
|
|
142
|
+
* compiler.context (identical when compiler.context === cwd). */
|
|
143
|
+
setRootDir(rootDir: string): void;
|
|
144
|
+
/** This session's artifact directory, derived from the one root. */
|
|
145
|
+
get sessionDir(): string;
|
|
81
146
|
/** Expose options for the loader */
|
|
82
147
|
getOptions(): AnimusNextOptions;
|
|
83
148
|
/** Expose external package directories for webpack loader allowlisting.
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,KAAK,aAAa,GAAG;IACnB,MAAM,IAAI,MAAM,GAAG,MAAM,CAAC;IAC1B,IAAI,IAAI,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE;QACL,aAAa,EAAE;YACb,GAAG,EAAE,CACH,OAAO,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,EACxC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,IAAI,KAChD,IAAI,CAAC;SACX,CAAC;KACH,CAAC;IACF,yEAAyE;IACzE,gBAAgB,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC9C,oEAAoE;IACpE,mBAAmB,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACjD;;;;gEAI4D;IAC5D,mBAAmB,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,MAAM,EAAE,aAAa,CAAA;KAAE,GAAG,SAAS,CAAC;IAC9D,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;CAC3D,CAAC;AAEF,sEAAsE;AACtE,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtC,CAAC;AAEF,KAAK,iBAAiB,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AAExE,+DAA+D;AAC/D,KAAK,4BAA4B,GAAG;IAClC,SAAS,CAAC,EAAE;QACV,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CACF,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,iBAAiB,KACxB,IAAI,KACN,IAAI,CAAC;KACX,CAAC;CACH,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE;QACL,GAAG,EAAE;YACH,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;SACxE,CAAC;QACF,QAAQ,EAAE;YACR,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;SACxE,CAAC;QACF,WAAW,EAAE;YACX,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,KAAK,IAAI,CAAC;SACrE,CAAC;QACF,eAAe,EAAE;YACf,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;SACjE,CAAC;KACH,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE;YACR,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC;SACnD,CAAC;QACF,YAAY,CAAC,EAAE;YACb,OAAO,CAAC,EAAE,OAAO,CAAC;SACnB,CAAC;KACH,CAAC;IACF,OAAO,CAAC,EAAE;QACR,WAAW,EAAE;YACX,+BAA+B,EAAE,MAAM,CAAC;SACzC,CAAC;QACF,OAAO,EAAE;YACP,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,KAAK,aAAa,CAAC;SAClD,CAAC;QACF;oEAC4D;QAC5D,YAAY,CAAC,EAAE;YACb,mBAAmB,CAAC,EAAE,CACpB,WAAW,EAAE,OAAO,KACjB,4BAA4B,CAAC;SACnC,CAAC;KACH,CAAC;CACH,CAAC;AAYF;;;;;;GAMG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,gBAAgB,CAAS;IACjC;uEACmE;IACnE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAc;IAChD;;6CAEyC;IACzC,OAAO,CAAC,cAAc,CAAuB;IAC7C;2EACuE;IACvE,OAAO,CAAC,4BAA4B,CAAS;IAE7C,YAAY,OAAO,EAAE,iBAAiB,EAarC;IAED;;yEAEqE;IACrE,OAAO,CAAC,sBAAsB;IAU9B;;;;;;;;+DAQ2D;IAC3D,OAAO,CAAC,sBAAsB;IA8B9B;yEACqE;IACrE,OAAO,CAAC,cAAc;IAwBtB,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CA0J9B;IAED;;OAEG;IACH,WAAW,IAAI,IAAI,CAElB;IAED;+DAC2D;IAC3D,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;sEAEkE;IAClE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhC;IAED,oEAAoE;IACpE,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,oCAAoC;IACpC,UAAU,IAAI,iBAAiB,CAE9B;IAED;mFAC+E;IAC/E,sBAAsB,IAAI,MAAM,EAAE,CAIjC;IAED;mFAC+E;IAC/E,wBAAwB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAI9C;CACF"}
|
|
@@ -0,0 +1,229 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/session-paths.ts
|
|
7
|
+
/**
|
|
8
|
+
* Session-scoped artifact names, path derivations, and the analysis-status
|
|
9
|
+
* shape (openspec: next-turbopack-served-transform-coherence, design D1–D3)
|
|
10
|
+
* — shared by the session writer (extraction-session), the webpack
|
|
11
|
+
* plugin/loader, and the Turbopack loader.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately free of singleton/session imports: the Turbopack loader
|
|
14
|
+
* executes in isolated worker processes and its module graph must stay
|
|
15
|
+
* worker-local (guardrail G1) — this module is pure path/shape vocabulary.
|
|
16
|
+
*/
|
|
17
|
+
/** Session-dir-relative name of the replacement-epoch disk witness
|
|
18
|
+
* (openspec: next-webpack-served-transform-coherence, design D2;
|
|
19
|
+
* session-scoped by next-turbopack-served-transform-coherence D2). */
|
|
20
|
+
const REPLACEMENT_EPOCH_ARTIFACT = "replacements-epoch";
|
|
21
|
+
/** Session-dir-relative name of the analysis-commit transaction artifact
|
|
22
|
+
* (design D1). */
|
|
23
|
+
const ANALYSIS_COMMIT_ARTIFACT = "analysis-commit";
|
|
24
|
+
/** Session-dir-relative name of the analysis-status artifact (design D3). */
|
|
25
|
+
const ANALYSIS_STATUS_ARTIFACT = "analysis-status.json";
|
|
26
|
+
/** Session-dir-relative name of the manifest payload artifact. */
|
|
27
|
+
const MANIFEST_ARTIFACT = "manifest.json";
|
|
28
|
+
/** Session-dir-relative name of the analysis-inputs payload artifact
|
|
29
|
+
* (Turbopack loader-worker hydration corpus). */
|
|
30
|
+
const ANALYSIS_INPUTS_ARTIFACT = "analysis-inputs.json";
|
|
31
|
+
/** Session-dir-relative name of the emitted stylesheet artifact. */
|
|
32
|
+
const STYLES_ARTIFACT = "styles.css";
|
|
33
|
+
/** Session-dir-relative name of the emitted system-props module. */
|
|
34
|
+
const SYSTEM_PROPS_ARTIFACT = "system-props.js";
|
|
35
|
+
/** Session-dir-relative directory holding copied asset() files. */
|
|
36
|
+
const SESSION_ASSETS_DIR = "assets";
|
|
37
|
+
/** Root of every session-scoped artifact tree for a project. */
|
|
38
|
+
function sessionsRootDir(rootDir) {
|
|
39
|
+
return join(rootDir, ".animus", "sessions");
|
|
40
|
+
}
|
|
41
|
+
/** One session's artifact directory (design D2: session-scoped trees,
|
|
42
|
+
* no global pointer). */
|
|
43
|
+
function sessionArtifactDir(rootDir, sessionId) {
|
|
44
|
+
return join(sessionsRootDir(rootDir), sessionId);
|
|
45
|
+
}
|
|
46
|
+
/** Absolute path of a session's replacement-epoch artifact — the single
|
|
47
|
+
* derivation shared by the session writer, the webpack plugin's
|
|
48
|
+
* watch-ignore entry, and both loaders' file dependencies. Takes the
|
|
49
|
+
* SESSION directory (not the project root) since the artifact was
|
|
50
|
+
* relocated into the session tree. */
|
|
51
|
+
function replacementEpochPath(sessionDir) {
|
|
52
|
+
return join(sessionDir, REPLACEMENT_EPOCH_ARTIFACT);
|
|
53
|
+
}
|
|
54
|
+
/** Absolute path of a session's analysis-commit artifact. */
|
|
55
|
+
function analysisCommitPath(sessionDir) {
|
|
56
|
+
return join(sessionDir, ANALYSIS_COMMIT_ARTIFACT);
|
|
57
|
+
}
|
|
58
|
+
/** Absolute path of a session's analysis-status artifact. */
|
|
59
|
+
function analysisStatusPath(sessionDir) {
|
|
60
|
+
return join(sessionDir, ANALYSIS_STATUS_ARTIFACT);
|
|
61
|
+
}
|
|
62
|
+
/** Absolute path of a session's manifest artifact. */
|
|
63
|
+
function manifestPath(sessionDir) {
|
|
64
|
+
return join(sessionDir, MANIFEST_ARTIFACT);
|
|
65
|
+
}
|
|
66
|
+
/** Absolute path of a session's analysis-inputs artifact. */
|
|
67
|
+
function analysisInputsPath(sessionDir) {
|
|
68
|
+
return join(sessionDir, ANALYSIS_INPUTS_ARTIFACT);
|
|
69
|
+
}
|
|
70
|
+
/** Absolute path of a session's stylesheet artifact. */
|
|
71
|
+
function stylesPath(sessionDir) {
|
|
72
|
+
return join(sessionDir, STYLES_ARTIFACT);
|
|
73
|
+
}
|
|
74
|
+
/** Absolute path of a session's system-props module artifact. */
|
|
75
|
+
function systemPropsPath(sessionDir) {
|
|
76
|
+
return join(sessionDir, SYSTEM_PROPS_ARTIFACT);
|
|
77
|
+
}
|
|
78
|
+
/** Splice the session envelope into a JSON-object payload as a leading
|
|
79
|
+
* `__animusSession` field, byte-preserving the payload's own content
|
|
80
|
+
* (parse/re-stringify could reformat engine-emitted JSON). */
|
|
81
|
+
function envelopeJsonArtifact(payload, envelopeJson) {
|
|
82
|
+
const trimmed = payload.trimStart();
|
|
83
|
+
if (!trimmed.startsWith("{")) return payload;
|
|
84
|
+
if (trimmed.slice(1).trimStart().startsWith("}")) return `{"__animusSession":${envelopeJson}}`;
|
|
85
|
+
return `{"__animusSession":${envelopeJson},${trimmed.slice(1)}`;
|
|
86
|
+
}
|
|
87
|
+
/** Trailing-comment side-band for the CSS artifact (a leading comment
|
|
88
|
+
* would displace the @layer declaration consumers pin at offset 0). */
|
|
89
|
+
function envelopeCssArtifact(payload, envelopeJson) {
|
|
90
|
+
return `${payload}\n/* __animusSession ${envelopeJson} */\n`;
|
|
91
|
+
}
|
|
92
|
+
/** Matches the CSS artifact's envelope side-band. */
|
|
93
|
+
const ENVELOPE_CSS_COMMENT_RE = /\/\* __animusSession (\{.*\}) \*\//;
|
|
94
|
+
/** Envelope of a JSON artifact's bytes, or undefined when the artifact
|
|
95
|
+
* carries none. THROWS on unparseable bytes — callers decide whether a
|
|
96
|
+
* torn artifact fails closed or degrades. */
|
|
97
|
+
function readJsonEnvelope(bytes) {
|
|
98
|
+
return JSON.parse(bytes).__animusSession;
|
|
99
|
+
}
|
|
100
|
+
/** Envelope of the CSS artifact's side-band comment, or undefined when the
|
|
101
|
+
* side-band is absent. THROWS on an unparseable envelope body. */
|
|
102
|
+
function readCssEnvelope(bytes) {
|
|
103
|
+
const match = bytes.match(ENVELOPE_CSS_COMMENT_RE);
|
|
104
|
+
return match ? JSON.parse(match[1]) : void 0;
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
export { __require as S, replacementEpochPath as _, REPLACEMENT_EPOCH_ARTIFACT as a, stylesPath as b, SYSTEM_PROPS_ARTIFACT as c, analysisStatusPath as d, envelopeCssArtifact as f, readJsonEnvelope as g, readCssEnvelope as h, MANIFEST_ARTIFACT as i, analysisCommitPath as l, manifestPath as m, ANALYSIS_INPUTS_ARTIFACT as n, SESSION_ASSETS_DIR as o, envelopeJsonArtifact as p, ANALYSIS_STATUS_ARTIFACT as r, STYLES_ARTIFACT as s, ANALYSIS_COMMIT_ARTIFACT as t, analysisInputsPath as u, sessionArtifactDir as v, systemPropsPath as x, sessionsRootDir as y };
|