@animus-ui/next-plugin 0.1.9 → 0.1.12
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/index.cjs +88 -1742
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +78 -1731
- package/dist/loader-core-BthLSJQF.cjs +47 -0
- package/dist/loader-core-x6cOzF9v.mjs +42 -0
- package/dist/loader-core.d.ts +6 -13
- package/dist/loader-core.d.ts.map +1 -1
- package/dist/loader-path.d.ts +0 -13
- package/dist/loader-path.d.ts.map +1 -1
- package/dist/loader.cjs +10 -34
- package/dist/loader.d.ts +2 -24
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.mjs +3 -26
- package/dist/plugin.d.ts +18 -70
- package/dist/plugin.d.ts.map +1 -1
- package/dist/turbopack-config.d.ts +11 -38
- package/dist/turbopack-config.d.ts.map +1 -1
- package/dist/turbopack-loader.cjs +44 -64
- package/dist/turbopack-loader.d.ts +12 -24
- package/dist/turbopack-loader.d.ts.map +1 -1
- package/dist/turbopack-loader.mjs +40 -56
- package/dist/types.d.ts +25 -79
- package/dist/types.d.ts.map +1 -1
- package/dist/with-animus.d.ts +39 -24
- package/dist/with-animus.d.ts.map +1 -1
- package/package.json +8 -2
- package/dist/extraction-session.d.ts +0 -378
- package/dist/extraction-session.d.ts.map +0 -1
- package/dist/loader-core-C40WbC6s.cjs +0 -71
- package/dist/loader-core-D6Tm_b8F.mjs +0 -66
- package/dist/resolve-packages.d.ts +0 -8
- package/dist/resolve-packages.d.ts.map +0 -1
- package/dist/session-paths-CZoi19NW.cjs +0 -229
- package/dist/session-paths-DfYIPDcM.mjs +0 -107
- package/dist/session-paths.d.ts +0 -107
- package/dist/session-paths.d.ts.map +0 -1
- package/dist/singleton-BjSsGjsg.mjs +0 -217
- package/dist/singleton-BjZyw_8b.cjs +0 -366
- package/dist/singleton.d.ts +0 -96
- package/dist/singleton.d.ts.map +0 -1
- package/dist/timing.d.ts +0 -7
- package/dist/timing.d.ts.map +0 -1
- package/dist/turbopack-orchestrator.d.ts +0 -34
- package/dist/turbopack-orchestrator.d.ts.map +0 -1
|
@@ -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
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
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 };
|
package/dist/session-paths.d.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
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
|
-
/** Session-dir-relative name of the analysis-commit transaction artifact
|
|
16
|
-
* (design D1). */
|
|
17
|
-
export declare const ANALYSIS_COMMIT_ARTIFACT = "analysis-commit";
|
|
18
|
-
/** Session-dir-relative name of the analysis-status artifact (design D3). */
|
|
19
|
-
export declare const ANALYSIS_STATUS_ARTIFACT = "analysis-status.json";
|
|
20
|
-
/** Session-dir-relative name of the manifest payload artifact. */
|
|
21
|
-
export declare const MANIFEST_ARTIFACT = "manifest.json";
|
|
22
|
-
/** Session-dir-relative name of the analysis-inputs payload artifact
|
|
23
|
-
* (Turbopack loader-worker hydration corpus). */
|
|
24
|
-
export declare const ANALYSIS_INPUTS_ARTIFACT = "analysis-inputs.json";
|
|
25
|
-
/** Session-dir-relative name of the emitted stylesheet artifact. */
|
|
26
|
-
export declare const STYLES_ARTIFACT = "styles.css";
|
|
27
|
-
/** Session-dir-relative name of the emitted system-props module. */
|
|
28
|
-
export declare const SYSTEM_PROPS_ARTIFACT = "system-props.js";
|
|
29
|
-
/** Session-dir-relative directory holding copied asset() files. */
|
|
30
|
-
export declare const SESSION_ASSETS_DIR = "assets";
|
|
31
|
-
/** Root of every session-scoped artifact tree for a project. */
|
|
32
|
-
export declare function sessionsRootDir(rootDir: string): string;
|
|
33
|
-
/** One session's artifact directory (design D2: session-scoped trees,
|
|
34
|
-
* no global pointer). */
|
|
35
|
-
export declare function sessionArtifactDir(rootDir: string, sessionId: string): string;
|
|
36
|
-
/** Absolute path of a session's replacement-epoch artifact — the single
|
|
37
|
-
* derivation shared by the session writer, the webpack plugin's
|
|
38
|
-
* watch-ignore entry, and both loaders' file dependencies. Takes the
|
|
39
|
-
* SESSION directory (not the project root) since the artifact was
|
|
40
|
-
* relocated into the session tree. */
|
|
41
|
-
export declare function replacementEpochPath(sessionDir: string): string;
|
|
42
|
-
/** Absolute path of a session's analysis-commit artifact. */
|
|
43
|
-
export declare function analysisCommitPath(sessionDir: string): string;
|
|
44
|
-
/** Absolute path of a session's analysis-status artifact. */
|
|
45
|
-
export declare function analysisStatusPath(sessionDir: string): string;
|
|
46
|
-
/** Absolute path of a session's manifest artifact. */
|
|
47
|
-
export declare function manifestPath(sessionDir: string): string;
|
|
48
|
-
/** Absolute path of a session's analysis-inputs artifact. */
|
|
49
|
-
export declare function analysisInputsPath(sessionDir: string): string;
|
|
50
|
-
/** Absolute path of a session's stylesheet artifact. */
|
|
51
|
-
export declare function stylesPath(sessionDir: string): string;
|
|
52
|
-
/** Absolute path of a session's system-props module artifact. */
|
|
53
|
-
export declare function systemPropsPath(sessionDir: string): string;
|
|
54
|
-
/** Session-scoped analysis-status shape (design D3). Successful loader
|
|
55
|
-
* invocations never depend on it; it exists so a loader observing a
|
|
56
|
-
* source/commit mismatch can decide — on evidence — whether to wait. */
|
|
57
|
-
export interface AnalysisStatus {
|
|
58
|
-
schema: 1;
|
|
59
|
-
sessionId: string;
|
|
60
|
-
attemptId: number;
|
|
61
|
-
state: 'starting' | 'debouncing' | 'analyzing' | 'committing' | 'idle' | 'failed';
|
|
62
|
-
/** [(rootDir-relative sourceKey, observed content hash)] of the batch. */
|
|
63
|
-
pending: Array<[string, string]>;
|
|
64
|
-
/** Epoch-ms deadline for the active attempt (debounce ceiling + 2s). */
|
|
65
|
-
deadlineAt: number;
|
|
66
|
-
diagnostic?: string;
|
|
67
|
-
}
|
|
68
|
-
/** analysis-commit artifact shape (design D1: the transaction identity —
|
|
69
|
-
* hashes are of the DISK payload bytes, envelope included). `inputsHash`
|
|
70
|
-
* is present only when the hydration corpus is persisted (Turbopack
|
|
71
|
-
* orchestration); webpack-mode commits omit it (spec:
|
|
72
|
-
* next-turbopack-integration, "Webpack mode skips the hydration corpus"). */
|
|
73
|
-
export interface AnalysisCommit {
|
|
74
|
-
schema: 1;
|
|
75
|
-
sessionId: string;
|
|
76
|
-
generation: number;
|
|
77
|
-
replacementEpoch: string;
|
|
78
|
-
manifestHash: string;
|
|
79
|
-
inputsHash?: string;
|
|
80
|
-
stylesHash: string;
|
|
81
|
-
}
|
|
82
|
-
/** Envelope embedded in every payload artifact (design D2: sessionId in
|
|
83
|
-
* every artifact; payloadHash lets a same-session restart seed its write
|
|
84
|
-
* guards without byte-reconstructing the payload). */
|
|
85
|
-
export interface SessionEnvelope {
|
|
86
|
-
sessionId: string;
|
|
87
|
-
generation: number;
|
|
88
|
-
replacementEpoch: string;
|
|
89
|
-
payloadHash: string;
|
|
90
|
-
}
|
|
91
|
-
/** Splice the session envelope into a JSON-object payload as a leading
|
|
92
|
-
* `__animusSession` field, byte-preserving the payload's own content
|
|
93
|
-
* (parse/re-stringify could reformat engine-emitted JSON). */
|
|
94
|
-
export declare function envelopeJsonArtifact(payload: string, envelopeJson: string): string;
|
|
95
|
-
/** Trailing-comment side-band for the CSS artifact (a leading comment
|
|
96
|
-
* would displace the @layer declaration consumers pin at offset 0). */
|
|
97
|
-
export declare function envelopeCssArtifact(payload: string, envelopeJson: string): string;
|
|
98
|
-
/** Matches the CSS artifact's envelope side-band. */
|
|
99
|
-
export declare const ENVELOPE_CSS_COMMENT_RE: RegExp;
|
|
100
|
-
/** Envelope of a JSON artifact's bytes, or undefined when the artifact
|
|
101
|
-
* carries none. THROWS on unparseable bytes — callers decide whether a
|
|
102
|
-
* torn artifact fails closed or degrades. */
|
|
103
|
-
export declare function readJsonEnvelope(bytes: string): SessionEnvelope | undefined;
|
|
104
|
-
/** Envelope of the CSS artifact's side-band comment, or undefined when the
|
|
105
|
-
* side-band is absent. THROWS on an unparseable envelope body. */
|
|
106
|
-
export declare function readCssEnvelope(bytes: string): SessionEnvelope | undefined;
|
|
107
|
-
//# sourceMappingURL=session-paths.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-paths.d.ts","sourceRoot":"","sources":["../src/session-paths.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { S as __require } from "./session-paths-DfYIPDcM.mjs";
|
|
2
|
-
import { createV2EngineApi } from "@animus-ui/extract/pipeline";
|
|
3
|
-
import { randomUUID } from "crypto";
|
|
4
|
-
//#region src/singleton.ts
|
|
5
|
-
/**
|
|
6
|
-
* Module-scope singleton for sharing analysis state between the webpack plugin and loader.
|
|
7
|
-
*
|
|
8
|
-
* Uses globalThis to survive the ESM/CJS module boundary: the plugin is loaded via ESM
|
|
9
|
-
* (next.config.ts import) while the loader is loaded by webpack via require(). Without
|
|
10
|
-
* globalThis, each module system gets its own singleton instance.
|
|
11
|
-
*/
|
|
12
|
-
const MANIFEST_KEY = "__animus_manifest_json__";
|
|
13
|
-
const PROMISE_KEY = "__animus_analysis_promise__";
|
|
14
|
-
const SHARED_CSS_KEY = "__animus_shared_css__";
|
|
15
|
-
const SHARED_SYSTEM_PROPS_KEY = "__animus_shared_system_props__";
|
|
16
|
-
const SHARED_EXTERNAL_DIRS_KEY = "__animus_external_pkg_dirs__";
|
|
17
|
-
const SHARED_EXTERNAL_ENTRIES_KEY = "__animus_external_source_entries__";
|
|
18
|
-
function getManifestJson() {
|
|
19
|
-
return globalThis[MANIFEST_KEY];
|
|
20
|
-
}
|
|
21
|
-
function setManifestJson(json) {
|
|
22
|
-
globalThis[MANIFEST_KEY] = json;
|
|
23
|
-
}
|
|
24
|
-
function getAnalysisPromise() {
|
|
25
|
-
return globalThis[PROMISE_KEY];
|
|
26
|
-
}
|
|
27
|
-
function setAnalysisPromise(promise) {
|
|
28
|
-
globalThis[PROMISE_KEY] = promise;
|
|
29
|
-
}
|
|
30
|
-
function resetAnalysisPromise() {
|
|
31
|
-
globalThis[PROMISE_KEY] = null;
|
|
32
|
-
}
|
|
33
|
-
function getSharedCss() {
|
|
34
|
-
return globalThis[SHARED_CSS_KEY] || "";
|
|
35
|
-
}
|
|
36
|
-
function setSharedCss(css) {
|
|
37
|
-
globalThis[SHARED_CSS_KEY] = css;
|
|
38
|
-
}
|
|
39
|
-
function setSharedSystemProps(content) {
|
|
40
|
-
globalThis[SHARED_SYSTEM_PROPS_KEY] = content;
|
|
41
|
-
}
|
|
42
|
-
function getSharedExternalDirs() {
|
|
43
|
-
return globalThis[SHARED_EXTERNAL_DIRS_KEY] || [];
|
|
44
|
-
}
|
|
45
|
-
function setSharedExternalDirs(dirs) {
|
|
46
|
-
globalThis[SHARED_EXTERNAL_DIRS_KEY] = dirs;
|
|
47
|
-
}
|
|
48
|
-
function getSharedExternalEntries() {
|
|
49
|
-
return globalThis[SHARED_EXTERNAL_ENTRIES_KEY] || /* @__PURE__ */ new Map();
|
|
50
|
-
}
|
|
51
|
-
function setSharedExternalEntries(entries) {
|
|
52
|
-
globalThis[SHARED_EXTERNAL_ENTRIES_KEY] = entries;
|
|
53
|
-
}
|
|
54
|
-
/** One typed globalThis slot — the single accessor shape every
|
|
55
|
-
* singleton-published value shares (null when unset). */
|
|
56
|
-
function globalSlot(key) {
|
|
57
|
-
const store = globalThis;
|
|
58
|
-
return {
|
|
59
|
-
get: () => store[key] ?? null,
|
|
60
|
-
set: (value) => {
|
|
61
|
-
store[key] = value;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const ANALYZED_HASHES_KEY = "__animus_analyzed_hashes__";
|
|
66
|
-
const REPLACEMENT_EPOCH_KEY = "__animus_replacement_epoch__";
|
|
67
|
-
const WATCH_TRANSACTION_KEY = "__animus_watch_transaction__";
|
|
68
|
-
const PROCESS_SESSION_ID_KEY = "__animus_process_session_id__";
|
|
69
|
-
const SESSION_ARTIFACT_DIR_KEY = "__animus_session_artifact_dir__";
|
|
70
|
-
const OWNING_WATCH_SESSION_KEY = "__animus_owning_watch_session__";
|
|
71
|
-
const analyzedHashesSlot = globalSlot(ANALYZED_HASHES_KEY);
|
|
72
|
-
const replacementEpochSlot = globalSlot(REPLACEMENT_EPOCH_KEY);
|
|
73
|
-
const watchTransactionSlot = globalSlot(WATCH_TRANSACTION_KEY);
|
|
74
|
-
const sessionArtifactDirSlot = globalSlot(SESSION_ARTIFACT_DIR_KEY);
|
|
75
|
-
const owningWatchSessionSlot = globalSlot(OWNING_WATCH_SESSION_KEY);
|
|
76
|
-
/**
|
|
77
|
-
* The session that completed the full pipeline and holds system state — the
|
|
78
|
-
* only instance that can run watch analysis. Each MultiCompiler child holds
|
|
79
|
-
* its own session AND its own watcher with its own modified set; a
|
|
80
|
-
* non-owning session forwards its batch here instead of dropping it (a file
|
|
81
|
-
* only that compiler watches would otherwise never be analyzed).
|
|
82
|
-
*/
|
|
83
|
-
function getOwningWatchSession() {
|
|
84
|
-
return owningWatchSessionSlot.get();
|
|
85
|
-
}
|
|
86
|
-
function setOwningWatchSession(session) {
|
|
87
|
-
owningWatchSessionSlot.set(session);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Per-file analyzed content hashes of the last published analysis (relPath →
|
|
91
|
-
* contentHash of the exact bytes analyzed) — the loader's witness for the
|
|
92
|
-
* unconditional catching-up guard (openspec:
|
|
93
|
-
* next-webpack-served-transform-coherence, design D4). Includes files
|
|
94
|
-
* analyzed with ZERO animus entries: analyzed identity is membership in the
|
|
95
|
-
* analysis input set, not manifest entry count.
|
|
96
|
-
*/
|
|
97
|
-
function getAnalyzedHashes() {
|
|
98
|
-
return analyzedHashesSlot.get();
|
|
99
|
-
}
|
|
100
|
-
function setAnalyzedHashes(hashes) {
|
|
101
|
-
analyzedHashesSlot.set(hashes);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Session identity is per Next INVOCATION — one process, however many
|
|
105
|
-
* compiler instances it holds (openspec:
|
|
106
|
-
* next-turbopack-served-transform-coherence, design D2). The first
|
|
107
|
-
* ExtractionSession constructed in a process claims a fresh randomUUID;
|
|
108
|
-
* every later instance (client/server/RSC compilers each construct one)
|
|
109
|
-
* adopts it, so all compilers alias, watch-ignore, and publish ONE
|
|
110
|
-
* session-scoped artifact tree. Separate invocations (`next dev` +
|
|
111
|
-
* `next build` co-writing) are separate processes and therefore separate
|
|
112
|
-
* sessions by construction.
|
|
113
|
-
*/
|
|
114
|
-
function claimProcessSessionId() {
|
|
115
|
-
const store = globalThis;
|
|
116
|
-
const existing = store[PROCESS_SESSION_ID_KEY];
|
|
117
|
-
if (typeof existing === "string" && existing.length > 0) return existing;
|
|
118
|
-
const fresh = randomUUID();
|
|
119
|
-
store[PROCESS_SESSION_ID_KEY] = fresh;
|
|
120
|
-
return fresh;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Absolute session artifact directory of the OWNING session's last
|
|
124
|
-
* publication — the webpack loader's source for the session-scoped epoch
|
|
125
|
-
* dependency path (the loader shares the process with the pipeline; the
|
|
126
|
-
* Turbopack loader instead receives the directory via its options).
|
|
127
|
-
*/
|
|
128
|
-
function getSessionArtifactDir() {
|
|
129
|
-
return sessionArtifactDirSlot.get();
|
|
130
|
-
}
|
|
131
|
-
function setSessionArtifactDir(dir) {
|
|
132
|
-
sessionArtifactDirSlot.set(dir);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Canonical replacement epoch of the last published analysis
|
|
136
|
-
* (`hashReplacementPlans(snapshotFilePlans(manifest), systemPropsContent)`
|
|
137
|
-
* — openspec: next-webpack-served-transform-coherence, design D5; the
|
|
138
|
-
* served system-props module rides as the served-dependency witness so
|
|
139
|
-
* offline system-props changes move the epoch). Published by the
|
|
140
|
-
* owning session AFTER the manifest so a reader that observes the epoch
|
|
141
|
-
* always observes at least that generation's manifest. (Session
|
|
142
|
-
* attribution lives on the DISK epoch artifact — no in-process mirror.)
|
|
143
|
-
*/
|
|
144
|
-
function getReplacementEpoch() {
|
|
145
|
-
return replacementEpochSlot.get();
|
|
146
|
-
}
|
|
147
|
-
function setReplacementEpoch(epoch) {
|
|
148
|
-
replacementEpochSlot.set(epoch);
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* The one in-flight watch-analysis transaction (design D3): the first
|
|
152
|
-
* compiler entering a watch batch runs analysis + publication; every other
|
|
153
|
-
* compiler (client/server/RSC — each holds its own session instance) joins
|
|
154
|
-
* this promise instead of proceeding against a pre-transaction generation.
|
|
155
|
-
*/
|
|
156
|
-
function getWatchTransaction() {
|
|
157
|
-
return watchTransactionSlot.get();
|
|
158
|
-
}
|
|
159
|
-
function setWatchTransaction(transaction) {
|
|
160
|
-
watchTransactionSlot.set(transaction);
|
|
161
|
-
}
|
|
162
|
-
const ENGINE_KEY = "__animus_engine__";
|
|
163
|
-
/** Engine selection travels through the singleton so non-owning compiler
|
|
164
|
-
* instances and the webpack loader honor the same choice as the owner. */
|
|
165
|
-
function setSharedEngine(engine) {
|
|
166
|
-
globalThis[ENGINE_KEY] = engine;
|
|
167
|
-
}
|
|
168
|
-
function getSharedEngine() {
|
|
169
|
-
return globalThis[ENGINE_KEY] || "v2";
|
|
170
|
-
}
|
|
171
|
-
/** Single engine choke-point for every native extraction call. Return type
|
|
172
|
-
* mirrors the untyped `require` the call sites previously used — the NAPI
|
|
173
|
-
* module's own .d.ts is the authoritative surface. */
|
|
174
|
-
function requireEngine() {
|
|
175
|
-
return __require("@animus-ui/extract");
|
|
176
|
-
}
|
|
177
|
-
const V2_ENGINE_KEY = "__animus_v2_engine__";
|
|
178
|
-
/**
|
|
179
|
-
* Engine-agnostic API over both engines (extract-v2-spine row 13). The
|
|
180
|
-
* v2 leg adapts the v1 function surface onto a stateful ExtractEngine
|
|
181
|
-
* (hoisted to `createV2EngineApi` in @animus-ui/extract/pipeline — the
|
|
182
|
-
* single authoritative copy shared with vite-plugin). The engine INSTANCE,
|
|
183
|
-
* its analyze-time sources, and the one-shot drift flag all live on
|
|
184
|
-
* globalThis for the same reason the manifest does — the ESM plugin and the
|
|
185
|
-
* CJS webpack loader must see one engine (and one drift warning) across the
|
|
186
|
-
* double-load. (The next-plugin is already process-singleton by design:
|
|
187
|
-
* manifest, css, and system props share the same globalThis keys.)
|
|
188
|
-
* loadSystemModule is exported by both bindings from one engine-neutral
|
|
189
|
-
* Rust crate, so the default path no longer loads the v1 binary.
|
|
190
|
-
*/
|
|
191
|
-
const V2_SENT_SOURCES_KEY = "__animus_v2_sent_sources__";
|
|
192
|
-
const V2_DRIFT_WARNED_KEY = "__animus_v2_drift_warned__";
|
|
193
|
-
const v2EngineApi = createV2EngineApi({
|
|
194
|
-
label: "animus-next",
|
|
195
|
-
isV2: () => getSharedEngine() === "v2",
|
|
196
|
-
loadNativeEngine: requireEngine,
|
|
197
|
-
passThroughUnknownPaths: true,
|
|
198
|
-
store: {
|
|
199
|
-
getEngine: () => globalThis[V2_ENGINE_KEY],
|
|
200
|
-
setEngine: (engine) => {
|
|
201
|
-
globalThis[V2_ENGINE_KEY] = engine;
|
|
202
|
-
},
|
|
203
|
-
getSentSources: () => globalThis[V2_SENT_SOURCES_KEY] ?? null,
|
|
204
|
-
setSentSources: (sources) => {
|
|
205
|
-
globalThis[V2_SENT_SOURCES_KEY] = sources;
|
|
206
|
-
},
|
|
207
|
-
getDriftWarned: () => Boolean(globalThis[V2_DRIFT_WARNED_KEY]),
|
|
208
|
-
setDriftWarned: (value) => {
|
|
209
|
-
globalThis[V2_DRIFT_WARNED_KEY] = value;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
function engineApi() {
|
|
214
|
-
return v2EngineApi();
|
|
215
|
-
}
|
|
216
|
-
//#endregion
|
|
217
|
-
export { setSharedExternalEntries as C, setSharedExternalDirs as S, setWatchTransaction as T, setOwningWatchSession as _, getManifestJson as a, setSharedCss as b, getSessionArtifactDir as c, getSharedExternalEntries as d, getWatchTransaction as f, setManifestJson as g, setAnalyzedHashes as h, getAnalyzedHashes as i, getSharedCss as l, setAnalysisPromise as m, engineApi as n, getOwningWatchSession as o, resetAnalysisPromise as p, getAnalysisPromise as r, getReplacementEpoch as s, claimProcessSessionId as t, getSharedExternalDirs as u, setReplacementEpoch as v, setSharedSystemProps as w, setSharedEngine as x, setSessionArtifactDir as y };
|