@animus-ui/next-plugin 0.1.16 → 0.1.18

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/README.md CHANGED
@@ -32,6 +32,12 @@ resolves, a watcher re-analyzes on source changes in dev, and per-file
32
32
  transforms run in a stateless loader fed by generated `.animus/` artifacts.
33
33
  tsconfig `paths` aliases are honored.
34
34
 
35
+ Because `next.config` resolves only after that first extraction, a source the
36
+ parser cannot finish at startup rejects the config before any watcher exists:
37
+ fix the syntax error and start Next again. Once the watcher runs, a later
38
+ syntax error keeps the last published artifacts and holds further edits until
39
+ the file parses, then publishes them together.
40
+
35
41
  Control it explicitly with the `turbopack` option:
36
42
 
37
43
  ```tsx
package/dist/index.cjs CHANGED
@@ -1,23 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_turbopack_config = require("./turbopack-config-DDjiYVRp.cjs");
2
3
  let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
3
4
  let _animus_ui_extract_session = require("@animus-ui/extract/session");
4
5
  let fs = require("fs");
5
6
  let path = require("path");
6
7
  let url = require("url");
7
- //#region src/loader-path.ts
8
- const __filename$2 = (0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
9
- const __dirname$2 = (0, path.dirname)(__filename$2);
10
- function resolveLoaderPath(pluginDir, distCandidates, sourceFallback) {
11
- for (const candidate of distCandidates) {
12
- const distPath = (0, path.resolve)(pluginDir, candidate);
13
- if ((0, fs.existsSync)(distPath)) return distPath;
14
- }
15
- return (0, path.resolve)(pluginDir, sourceFallback);
16
- }
17
- function resolveAnimusLoaderPath() {
18
- return resolveLoaderPath(__dirname$2, ["loader.mjs"], "loader.ts");
19
- }
20
- //#endregion
21
8
  //#region src/plugin.ts
22
9
  /** The value arrives from a consumer's `next.config`, so the union above is a
23
10
  * model of what webpack accepts, not a proof about the value in hand. */
@@ -33,12 +20,15 @@ var AnimusWebpackPlugin = class {
33
20
  animusLoaderPaths;
34
21
  lastBuiltEpoch = null;
35
22
  epochMovedForNextCompilation = false;
23
+ /** This turn's rejected analysis. A rejection must fail the compilation,
24
+ * never `watchRun`: webpack stops watching after a failed `watchRun`. */
25
+ watchFailure = null;
36
26
  constructor(options) {
37
27
  this.options = options;
38
28
  (0, _animus_ui_extract_pipeline.assertNoRetiredEngineSelection)(options.engine);
39
29
  (0, _animus_ui_extract_session.setSharedEngine)(options.engine ?? "v2");
40
30
  this.session = new _animus_ui_extract_session.ExtractionSession(options);
41
- this.animusLoaderPaths = /* @__PURE__ */ new Set([resolveAnimusLoaderPath()]);
31
+ this.animusLoaderPaths = /* @__PURE__ */ new Set([require_turbopack_config.resolveAnimusLoaderPath()]);
42
32
  if (options.loaderPath) this.animusLoaderPaths.add(options.loaderPath);
43
33
  }
44
34
  moduleUsesAnimusLoader(module) {
@@ -89,6 +79,7 @@ var AnimusWebpackPlugin = class {
89
79
  compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
90
80
  const epochMoved = this.epochMovedForNextCompilation;
91
81
  this.epochMovedForNextCompilation = false;
82
+ if (this.watchFailure) compilation.errors.push(this.watchFailure);
92
83
  const needBuild = NormalModule.getCompilationHooks(compilation).needBuild;
93
84
  if (needBuild === void 0) throw new Error(UNSUPPORTED_WEBPACK_MESSAGE);
94
85
  needBuild.tapAsync(PLUGIN_NAME, (module, _context, callback) => {
@@ -141,27 +132,42 @@ var AnimusWebpackPlugin = class {
141
132
  compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, async (_compiler) => {
142
133
  this.adoptCompilerContext(_compiler);
143
134
  this.extractAliases(_compiler);
144
- if (!this.initialized) {
145
- const existing = (0, _animus_ui_extract_session.getAnalysisStartedPromise)();
146
- if (existing) await existing;
147
- else {
148
- const promise = this.session.runFullPipeline();
149
- (0, _animus_ui_extract_session.setAnalysisStartedPromise)(promise);
150
- await promise;
151
- }
152
- this.initialized = true;
153
- this.lastBuiltEpoch = (0, _animus_ui_extract_session.getReplacementEpoch)();
154
- return;
135
+ try {
136
+ await this.analyzeWatchTurn(_compiler);
137
+ this.watchFailure = null;
138
+ } catch (err) {
139
+ this.watchFailure = err instanceof Error ? err : new Error(String(err));
155
140
  }
156
- await this.session.handleWatchUpdate({
157
- modifiedFiles: _compiler.modifiedFiles,
158
- removedFiles: _compiler.removedFiles
159
- });
160
- const epoch = (0, _animus_ui_extract_session.getReplacementEpoch)();
161
- this.epochMovedForNextCompilation = this.lastBuiltEpoch !== null && epoch !== null && epoch !== this.lastBuiltEpoch;
162
- if (epoch !== null) this.lastBuiltEpoch = epoch;
163
141
  });
164
142
  }
143
+ /** Rejects with the analysis error; the published generation stays the
144
+ * last successful one. */
145
+ async analyzeWatchTurn(compiler) {
146
+ if (!this.initialized) {
147
+ let startup = (0, _animus_ui_extract_session.getAnalysisStartedPromise)();
148
+ if (!startup) {
149
+ startup = this.session.runFullPipeline();
150
+ (0, _animus_ui_extract_session.setAnalysisStartedPromise)(startup);
151
+ }
152
+ try {
153
+ await startup;
154
+ } catch (err) {
155
+ if ((0, _animus_ui_extract_session.getAnalysisStartedPromise)() === startup) (0, _animus_ui_extract_session.resetAnalysisStartedPromise)();
156
+ throw err;
157
+ }
158
+ this.initialized = true;
159
+ this.lastBuiltEpoch = (0, _animus_ui_extract_session.getReplacementEpoch)();
160
+ this.epochMovedForNextCompilation = this.watchFailure !== null;
161
+ return;
162
+ }
163
+ await this.session.handleWatchUpdate({
164
+ modifiedFiles: compiler.modifiedFiles,
165
+ removedFiles: compiler.removedFiles
166
+ });
167
+ const epoch = (0, _animus_ui_extract_session.getReplacementEpoch)();
168
+ this.epochMovedForNextCompilation = this.lastBuiltEpoch !== null && epoch !== null && epoch !== this.lastBuiltEpoch;
169
+ if (epoch !== null) this.lastBuiltEpoch = epoch;
170
+ }
165
171
  resetForHmr() {
166
172
  this.session.resetForHmr();
167
173
  }
@@ -201,47 +207,6 @@ var AnimusWebpackPlugin = class {
201
207
  }
202
208
  };
203
209
  //#endregion
204
- //#region src/turbopack-config.ts
205
- /** The one glob the loader registers under, derived from the shared engine
206
- * extension set so the bundler families cannot drift. `.mjs` belongs in that
207
- * set: an external package with no src/ is ingested through its dist entry
208
- * and must still reach the loader, so do not trim it. */
209
- const ANIMUS_TURBOPACK_RULE_GLOB = `*.{${_animus_ui_extract_pipeline.ENGINE_TRANSFORM_EXTENSIONS.join(",")}}`;
210
- function resolveTurbopackMode(options, env = process.env) {
211
- const mode = options.turbopack?.mode ?? options.unstable_turbopack?.mode ?? "auto";
212
- if (mode === "on") return true;
213
- if (mode === "auto") return env.TURBOPACK !== void 0;
214
- return false;
215
- }
216
- function rootRelativeRequest(rootDir, absPath) {
217
- return `./${(0, path.relative)(rootDir, absPath).replace(/\\/g, "/")}`;
218
- }
219
- function buildTurbopackConfig(args) {
220
- const { rootDir, loaderPath, options, externalSourceEntries, sessionId, sessionDir } = args;
221
- const loaderOptions = {
222
- rootDir,
223
- sessionId,
224
- sessionDir
225
- };
226
- if (options.strict !== void 0) loaderOptions.strict = options.strict;
227
- if (options.cssImportTarget !== void 0) loaderOptions.cssImportTarget = options.cssImportTarget;
228
- const resolveAlias = {
229
- [_animus_ui_extract_session.TURBOPACK_SYSTEM_PROPS_ID]: rootRelativeRequest(rootDir, (0, path.join)(sessionDir, _animus_ui_extract_session.SYSTEM_PROPS_ARTIFACT)),
230
- [_animus_ui_extract_session.ANIMUS_CSS_MODULE_ID]: rootRelativeRequest(rootDir, (0, path.join)(sessionDir, _animus_ui_extract_session.STYLES_ARTIFACT))
231
- };
232
- for (const [specifier, srcEntry] of externalSourceEntries) resolveAlias[specifier] = rootRelativeRequest(rootDir, srcEntry);
233
- return {
234
- rules: { [ANIMUS_TURBOPACK_RULE_GLOB]: { loaders: [{
235
- loader: loaderPath,
236
- options: loaderOptions
237
- }] } },
238
- resolveAlias
239
- };
240
- }
241
- function resolveTurbopackLoaderPath(pluginDir) {
242
- return resolveLoaderPath(pluginDir, ["turbopack-loader.cjs", "turbopack-loader.mjs"], "turbopack-loader.ts");
243
- }
244
- //#endregion
245
210
  //#region src/with-animus.ts
246
211
  const __filename$1 = (0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
247
212
  const __dirname$1 = (0, path.dirname)(__filename$1);
@@ -266,7 +231,7 @@ function withAnimus(options) {
266
231
  console.warn("[animus-extract] `unstable_turbopack` is deprecated — rename it to `turbopack` (same shape)");
267
232
  }
268
233
  return (nextConfig) => {
269
- if (resolveTurbopackMode(options)) return wireTurbopack(nextConfig, options);
234
+ if (require_turbopack_config.resolveTurbopackMode(options)) return wireTurbopack(nextConfig, options);
270
235
  const existingWebpack = nextConfig.webpack;
271
236
  return {
272
237
  ...nextConfig,
@@ -315,7 +280,7 @@ function withAnimus(options) {
315
280
  });
316
281
  });
317
282
  } });
318
- const actualLoaderPath = resolveAnimusLoaderPath();
283
+ const actualLoaderPath = require_turbopack_config.resolveAnimusLoaderPath();
319
284
  config.module = config.module || {};
320
285
  config.module.rules = config.module.rules || [];
321
286
  config.module.rules.push({
@@ -356,17 +321,17 @@ async function wireTurbopack(nextConfig, options) {
356
321
  const builtAliases = (0, _animus_ui_extract_pipeline.buildPathAliasesJson)(aliasPairs, rootDir);
357
322
  if (builtAliases) session.pathAliasesJson = builtAliases.json;
358
323
  await (0, _animus_ui_extract_session.runSessionPipeline)(session);
359
- if (process.env.NODE_ENV === "development") bindTurbopackWatchDeathReport((0, _animus_ui_extract_session.startTurbopackWatcher)(session, rootDir), rootDir);
360
- const fragment = buildTurbopackConfig({
324
+ if (require_turbopack_config.isTurbopackDevelopment()) bindTurbopackWatchDeathReport((0, _animus_ui_extract_session.startTurbopackWatcher)(session, rootDir), rootDir);
325
+ const fragment = require_turbopack_config.buildTurbopackConfig({
361
326
  rootDir,
362
- loaderPath: resolveTurbopackLoaderPath(__dirname$1),
327
+ loaderPath: require_turbopack_config.resolveTurbopackLoaderPath(__dirname$1),
363
328
  options,
364
329
  externalSourceEntries: session.externalSourceEntries,
365
330
  sessionId: session.sessionId,
366
331
  sessionDir: session.sessionDir
367
332
  });
368
333
  const existing = nextConfig.turbopack ?? {};
369
- if (existing.rules && ANIMUS_TURBOPACK_RULE_GLOB in existing.rules) throw new Error(`[animus-extract] turbopack.rules['${ANIMUS_TURBOPACK_RULE_GLOB}'] is already configured — remove the consumer rule or disable unstable_turbopack`);
334
+ if (existing.rules && require_turbopack_config.ANIMUS_TURBOPACK_RULE_GLOB in existing.rules) throw new Error(`[animus-extract] turbopack.rules['${require_turbopack_config.ANIMUS_TURBOPACK_RULE_GLOB}'] is already configured — remove the consumer rule or disable unstable_turbopack`);
370
335
  return {
371
336
  ...nextConfig,
372
337
  turbopack: {
package/dist/index.mjs CHANGED
@@ -1,22 +1,9 @@
1
- import { ENGINE_TRANSFORM_EXTENSIONS, assembleStylesheet, assertKnownOptionKeys, assertNoRetiredEngineSelection, buildPathAliasesJson, isEngineTransformExtension, isPathWithinRoot, readTsconfigAliasPairs, resolveMode } from "@animus-ui/extract/pipeline";
2
- import { ANIMUS_CSS_MODULE_ID, ANIMUS_CSS_MODULE_ID as ANIMUS_CSS_MODULE_ID$1, ExtractionSession, STYLES_ARTIFACT, SYSTEM_PROPS_ARTIFACT, TURBOPACK_SYSTEM_PROPS_ID, getAnalysisStartedPromise, getReplacementEpoch, getSharedCss, getSharedExternalDirs, getSharedExternalEntries, replacementEpochPath, runSessionPipeline, sessionArtifactDir, setAnalysisStartedPromise, setSharedEngine, startTurbopackWatcher, stylesPath, systemPropsPath } from "@animus-ui/extract/session";
1
+ import { a as resolveTurbopackMode, i as resolveTurbopackLoaderPath, n as buildTurbopackConfig, o as resolveAnimusLoaderPath, r as isTurbopackDevelopment, t as ANIMUS_TURBOPACK_RULE_GLOB } from "./turbopack-config-CaAI_L6k.mjs";
2
+ import { assembleStylesheet, assertKnownOptionKeys, assertNoRetiredEngineSelection, buildPathAliasesJson, isEngineTransformExtension, isPathWithinRoot, readTsconfigAliasPairs, resolveMode } from "@animus-ui/extract/pipeline";
3
+ import { ANIMUS_CSS_MODULE_ID, ANIMUS_CSS_MODULE_ID as ANIMUS_CSS_MODULE_ID$1, ExtractionSession, getAnalysisStartedPromise, getReplacementEpoch, getSharedCss, getSharedExternalDirs, getSharedExternalEntries, replacementEpochPath, resetAnalysisStartedPromise, runSessionPipeline, sessionArtifactDir, setAnalysisStartedPromise, setSharedEngine, startTurbopackWatcher, stylesPath, systemPropsPath } from "@animus-ui/extract/session";
3
4
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
4
- import { dirname, join, relative, resolve } from "path";
5
+ import { dirname, join } from "path";
5
6
  import { fileURLToPath } from "url";
6
- //#region src/loader-path.ts
7
- const __filename$1 = fileURLToPath(import.meta.url);
8
- const __dirname$1 = dirname(__filename$1);
9
- function resolveLoaderPath(pluginDir, distCandidates, sourceFallback) {
10
- for (const candidate of distCandidates) {
11
- const distPath = resolve(pluginDir, candidate);
12
- if (existsSync(distPath)) return distPath;
13
- }
14
- return resolve(pluginDir, sourceFallback);
15
- }
16
- function resolveAnimusLoaderPath() {
17
- return resolveLoaderPath(__dirname$1, ["loader.mjs"], "loader.ts");
18
- }
19
- //#endregion
20
7
  //#region src/plugin.ts
21
8
  /** The value arrives from a consumer's `next.config`, so the union above is a
22
9
  * model of what webpack accepts, not a proof about the value in hand. */
@@ -32,6 +19,9 @@ var AnimusWebpackPlugin = class {
32
19
  animusLoaderPaths;
33
20
  lastBuiltEpoch = null;
34
21
  epochMovedForNextCompilation = false;
22
+ /** This turn's rejected analysis. A rejection must fail the compilation,
23
+ * never `watchRun`: webpack stops watching after a failed `watchRun`. */
24
+ watchFailure = null;
35
25
  constructor(options) {
36
26
  this.options = options;
37
27
  assertNoRetiredEngineSelection(options.engine);
@@ -88,6 +78,7 @@ var AnimusWebpackPlugin = class {
88
78
  compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
89
79
  const epochMoved = this.epochMovedForNextCompilation;
90
80
  this.epochMovedForNextCompilation = false;
81
+ if (this.watchFailure) compilation.errors.push(this.watchFailure);
91
82
  const needBuild = NormalModule.getCompilationHooks(compilation).needBuild;
92
83
  if (needBuild === void 0) throw new Error(UNSUPPORTED_WEBPACK_MESSAGE);
93
84
  needBuild.tapAsync(PLUGIN_NAME, (module, _context, callback) => {
@@ -140,27 +131,42 @@ var AnimusWebpackPlugin = class {
140
131
  compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, async (_compiler) => {
141
132
  this.adoptCompilerContext(_compiler);
142
133
  this.extractAliases(_compiler);
143
- if (!this.initialized) {
144
- const existing = getAnalysisStartedPromise();
145
- if (existing) await existing;
146
- else {
147
- const promise = this.session.runFullPipeline();
148
- setAnalysisStartedPromise(promise);
149
- await promise;
150
- }
151
- this.initialized = true;
152
- this.lastBuiltEpoch = getReplacementEpoch();
153
- return;
134
+ try {
135
+ await this.analyzeWatchTurn(_compiler);
136
+ this.watchFailure = null;
137
+ } catch (err) {
138
+ this.watchFailure = err instanceof Error ? err : new Error(String(err));
154
139
  }
155
- await this.session.handleWatchUpdate({
156
- modifiedFiles: _compiler.modifiedFiles,
157
- removedFiles: _compiler.removedFiles
158
- });
159
- const epoch = getReplacementEpoch();
160
- this.epochMovedForNextCompilation = this.lastBuiltEpoch !== null && epoch !== null && epoch !== this.lastBuiltEpoch;
161
- if (epoch !== null) this.lastBuiltEpoch = epoch;
162
140
  });
163
141
  }
142
+ /** Rejects with the analysis error; the published generation stays the
143
+ * last successful one. */
144
+ async analyzeWatchTurn(compiler) {
145
+ if (!this.initialized) {
146
+ let startup = getAnalysisStartedPromise();
147
+ if (!startup) {
148
+ startup = this.session.runFullPipeline();
149
+ setAnalysisStartedPromise(startup);
150
+ }
151
+ try {
152
+ await startup;
153
+ } catch (err) {
154
+ if (getAnalysisStartedPromise() === startup) resetAnalysisStartedPromise();
155
+ throw err;
156
+ }
157
+ this.initialized = true;
158
+ this.lastBuiltEpoch = getReplacementEpoch();
159
+ this.epochMovedForNextCompilation = this.watchFailure !== null;
160
+ return;
161
+ }
162
+ await this.session.handleWatchUpdate({
163
+ modifiedFiles: compiler.modifiedFiles,
164
+ removedFiles: compiler.removedFiles
165
+ });
166
+ const epoch = getReplacementEpoch();
167
+ this.epochMovedForNextCompilation = this.lastBuiltEpoch !== null && epoch !== null && epoch !== this.lastBuiltEpoch;
168
+ if (epoch !== null) this.lastBuiltEpoch = epoch;
169
+ }
164
170
  resetForHmr() {
165
171
  this.session.resetForHmr();
166
172
  }
@@ -200,47 +206,6 @@ var AnimusWebpackPlugin = class {
200
206
  }
201
207
  };
202
208
  //#endregion
203
- //#region src/turbopack-config.ts
204
- /** The one glob the loader registers under, derived from the shared engine
205
- * extension set so the bundler families cannot drift. `.mjs` belongs in that
206
- * set: an external package with no src/ is ingested through its dist entry
207
- * and must still reach the loader, so do not trim it. */
208
- const ANIMUS_TURBOPACK_RULE_GLOB = `*.{${ENGINE_TRANSFORM_EXTENSIONS.join(",")}}`;
209
- function resolveTurbopackMode(options, env = process.env) {
210
- const mode = options.turbopack?.mode ?? options.unstable_turbopack?.mode ?? "auto";
211
- if (mode === "on") return true;
212
- if (mode === "auto") return env.TURBOPACK !== void 0;
213
- return false;
214
- }
215
- function rootRelativeRequest(rootDir, absPath) {
216
- return `./${relative(rootDir, absPath).replace(/\\/g, "/")}`;
217
- }
218
- function buildTurbopackConfig(args) {
219
- const { rootDir, loaderPath, options, externalSourceEntries, sessionId, sessionDir } = args;
220
- const loaderOptions = {
221
- rootDir,
222
- sessionId,
223
- sessionDir
224
- };
225
- if (options.strict !== void 0) loaderOptions.strict = options.strict;
226
- if (options.cssImportTarget !== void 0) loaderOptions.cssImportTarget = options.cssImportTarget;
227
- const resolveAlias = {
228
- [TURBOPACK_SYSTEM_PROPS_ID]: rootRelativeRequest(rootDir, join(sessionDir, SYSTEM_PROPS_ARTIFACT)),
229
- [ANIMUS_CSS_MODULE_ID]: rootRelativeRequest(rootDir, join(sessionDir, STYLES_ARTIFACT))
230
- };
231
- for (const [specifier, srcEntry] of externalSourceEntries) resolveAlias[specifier] = rootRelativeRequest(rootDir, srcEntry);
232
- return {
233
- rules: { [ANIMUS_TURBOPACK_RULE_GLOB]: { loaders: [{
234
- loader: loaderPath,
235
- options: loaderOptions
236
- }] } },
237
- resolveAlias
238
- };
239
- }
240
- function resolveTurbopackLoaderPath(pluginDir) {
241
- return resolveLoaderPath(pluginDir, ["turbopack-loader.cjs", "turbopack-loader.mjs"], "turbopack-loader.ts");
242
- }
243
- //#endregion
244
209
  //#region src/with-animus.ts
245
210
  const __filename = fileURLToPath(import.meta.url);
246
211
  const __dirname = dirname(__filename);
@@ -355,7 +320,7 @@ async function wireTurbopack(nextConfig, options) {
355
320
  const builtAliases = buildPathAliasesJson(aliasPairs, rootDir);
356
321
  if (builtAliases) session.pathAliasesJson = builtAliases.json;
357
322
  await runSessionPipeline(session);
358
- if (process.env.NODE_ENV === "development") bindTurbopackWatchDeathReport(startTurbopackWatcher(session, rootDir), rootDir);
323
+ if (isTurbopackDevelopment()) bindTurbopackWatchDeathReport(startTurbopackWatcher(session, rootDir), rootDir);
359
324
  const fragment = buildTurbopackConfig({
360
325
  rootDir,
361
326
  loaderPath: resolveTurbopackLoaderPath(__dirname),
@@ -1,3 +1,4 @@
1
+ let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
1
2
  let _animus_ui_extract_session = require("@animus-ui/extract/session");
2
3
  //#region src/loader-core.ts
3
4
  /** Matches every already-emitted stylesheet import — arbitrary relative
@@ -15,6 +16,51 @@ function isCssImportTarget(filename, cssImportTarget) {
15
16
  if (cssImportTarget) return normalized === normalizePath(cssImportTarget);
16
17
  return ROOT_ENTRY_RE.test(normalized);
17
18
  }
19
+ /** Each file's transitive cross-file ancestors, built once per published
20
+ * manifest: loaders ask for every module. */
21
+ let ancestry = null;
22
+ function indexAncestry(manifestJson) {
23
+ const { components = {}, files = {} } = JSON.parse(manifestJson);
24
+ const byFile = /* @__PURE__ */ new Map();
25
+ for (const [filename, ids] of Object.entries(files)) {
26
+ const ancestors = /* @__PURE__ */ new Set();
27
+ const queue = [...ids];
28
+ const seen = new Set(queue);
29
+ for (let i = 0; i < queue.length; i++) {
30
+ const parentId = components[queue[i]]?.extends_from;
31
+ if (!parentId || seen.has(parentId)) continue;
32
+ seen.add(parentId);
33
+ queue.push(parentId);
34
+ const parentFile = components[parentId]?.file;
35
+ if (parentFile && parentFile !== filename) ancestors.add(parentFile);
36
+ }
37
+ if (ancestors.size > 0) byFile.set(filename, [...ancestors].sort());
38
+ }
39
+ return byFile;
40
+ }
41
+ /**
42
+ * The other files declaring a component that one of `filename`'s components
43
+ * extends, transitively. An extension captures its parent's callables when
44
+ * its module evaluates, so it must re-evaluate whenever one of these does.
45
+ */
46
+ function extendedFiles(manifestJson, filename) {
47
+ if (ancestry?.json !== manifestJson) ancestry = {
48
+ json: manifestJson,
49
+ byFile: indexAncestry(manifestJson)
50
+ };
51
+ return ancestry.byFile.get(filename) ?? [];
52
+ }
53
+ /**
54
+ * Emitted code that changes whenever an extended file's analyzed source does,
55
+ * so a host re-delivers the extension in the same update as its parent.
56
+ * Hosts keep an unchanged module out of a hot update, and Turbopack ignores
57
+ * comment-only differences, so this must be a statement.
58
+ */
59
+ function extensionLineage(files, analyzedHashes) {
60
+ if (files.length === 0) return "";
61
+ const lineage = files.map((file) => `${file}\0${analyzedHashes?.get(file) ?? ""}`).join("\0");
62
+ return `\nvoid "animus-lineage:${(0, _animus_ui_extract_pipeline.contentHash)(lineage)}";\n`;
63
+ }
18
64
  function transformWithManifest(args) {
19
65
  const { source, filename, manifestJson, engineApi, opts } = args;
20
66
  const isRootEntry = isCssImportTarget(filename, opts.cssImportTarget);
@@ -39,6 +85,18 @@ function transformWithManifest(args) {
39
85
  }
40
86
  }
41
87
  //#endregion
88
+ Object.defineProperty(exports, "extendedFiles", {
89
+ enumerable: true,
90
+ get: function() {
91
+ return extendedFiles;
92
+ }
93
+ });
94
+ Object.defineProperty(exports, "extensionLineage", {
95
+ enumerable: true,
96
+ get: function() {
97
+ return extensionLineage;
98
+ }
99
+ });
42
100
  Object.defineProperty(exports, "transformWithManifest", {
43
101
  enumerable: true,
44
102
  get: function() {
@@ -1,3 +1,4 @@
1
+ import { contentHash } from "@animus-ui/extract/pipeline";
1
2
  import { ANIMUS_CSS_MODULE_ID } from "@animus-ui/extract/session";
2
3
  //#region src/loader-core.ts
3
4
  /** Matches every already-emitted stylesheet import — arbitrary relative
@@ -15,6 +16,51 @@ function isCssImportTarget(filename, cssImportTarget) {
15
16
  if (cssImportTarget) return normalized === normalizePath(cssImportTarget);
16
17
  return ROOT_ENTRY_RE.test(normalized);
17
18
  }
19
+ /** Each file's transitive cross-file ancestors, built once per published
20
+ * manifest: loaders ask for every module. */
21
+ let ancestry = null;
22
+ function indexAncestry(manifestJson) {
23
+ const { components = {}, files = {} } = JSON.parse(manifestJson);
24
+ const byFile = /* @__PURE__ */ new Map();
25
+ for (const [filename, ids] of Object.entries(files)) {
26
+ const ancestors = /* @__PURE__ */ new Set();
27
+ const queue = [...ids];
28
+ const seen = new Set(queue);
29
+ for (let i = 0; i < queue.length; i++) {
30
+ const parentId = components[queue[i]]?.extends_from;
31
+ if (!parentId || seen.has(parentId)) continue;
32
+ seen.add(parentId);
33
+ queue.push(parentId);
34
+ const parentFile = components[parentId]?.file;
35
+ if (parentFile && parentFile !== filename) ancestors.add(parentFile);
36
+ }
37
+ if (ancestors.size > 0) byFile.set(filename, [...ancestors].sort());
38
+ }
39
+ return byFile;
40
+ }
41
+ /**
42
+ * The other files declaring a component that one of `filename`'s components
43
+ * extends, transitively. An extension captures its parent's callables when
44
+ * its module evaluates, so it must re-evaluate whenever one of these does.
45
+ */
46
+ function extendedFiles(manifestJson, filename) {
47
+ if (ancestry?.json !== manifestJson) ancestry = {
48
+ json: manifestJson,
49
+ byFile: indexAncestry(manifestJson)
50
+ };
51
+ return ancestry.byFile.get(filename) ?? [];
52
+ }
53
+ /**
54
+ * Emitted code that changes whenever an extended file's analyzed source does,
55
+ * so a host re-delivers the extension in the same update as its parent.
56
+ * Hosts keep an unchanged module out of a hot update, and Turbopack ignores
57
+ * comment-only differences, so this must be a statement.
58
+ */
59
+ function extensionLineage(files, analyzedHashes) {
60
+ if (files.length === 0) return "";
61
+ const lineage = files.map((file) => `${file}\0${analyzedHashes?.get(file) ?? ""}`).join("\0");
62
+ return `\nvoid "animus-lineage:${contentHash(lineage)}";\n`;
63
+ }
18
64
  function transformWithManifest(args) {
19
65
  const { source, filename, manifestJson, engineApi, opts } = args;
20
66
  const isRootEntry = isCssImportTarget(filename, opts.cssImportTarget);
@@ -39,4 +85,4 @@ function transformWithManifest(args) {
39
85
  }
40
86
  }
41
87
  //#endregion
42
- export { transformWithManifest as t };
88
+ export { extensionLineage as n, transformWithManifest as r, extendedFiles as t };
@@ -8,6 +8,19 @@ export interface LoaderContextBase<O extends LoaderPolicyOptions = LoaderPolicyO
8
8
  getOptions: () => O;
9
9
  addDependency?: (file: string) => void;
10
10
  }
11
+ /**
12
+ * The other files declaring a component that one of `filename`'s components
13
+ * extends, transitively. An extension captures its parent's callables when
14
+ * its module evaluates, so it must re-evaluate whenever one of these does.
15
+ */
16
+ export declare function extendedFiles(manifestJson: string, filename: string): readonly string[];
17
+ /**
18
+ * Emitted code that changes whenever an extended file's analyzed source does,
19
+ * so a host re-delivers the extension in the same update as its parent.
20
+ * Hosts keep an unchanged module out of a hot update, and Turbopack ignores
21
+ * comment-only differences, so this must be a statement.
22
+ */
23
+ export declare function extensionLineage(files: readonly string[], analyzedHashes: ReadonlyMap<string, string> | null | undefined): string;
11
24
  export declare function transformWithManifest(args: {
12
25
  source: string;
13
26
  /** Project-root-relative path of the file being transformed. */
@@ -1 +1 @@
1
- {"version":3,"file":"loader-core.d.ts","sourceRoot":"","sources":["../src/loader-core.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB,CAChC,CAAC,SA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E,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IAErB,SAAS,EAAE,MAAM,GAAG,CAAC;IACrB,IAAI,EAAE,mBAAmB,CAAC;CAC3B,GAAG,MAAM,CAwCT"}
package/dist/loader.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_loader_core = require("./loader-core-BthLSJQF.cjs");
1
+ const require_loader_core = require("./loader-core-Cnipfewg.cjs");
2
2
  let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
3
3
  let _animus_ui_extract_session = require("@animus-ui/extract/session");
4
4
  let fs = require("fs");
@@ -6,7 +6,8 @@ let path = require("path");
6
6
  //#region src/loader.ts
7
7
  const epochSeenForSessionDir = /* @__PURE__ */ new Set();
8
8
  function animusLoader(source) {
9
- if (this.mode !== "production" && this.addDependency !== void 0) {
9
+ const watching = this.mode !== "production";
10
+ if (watching && this.addDependency !== void 0) {
10
11
  const sessionDir = (0, _animus_ui_extract_session.getSessionArtifactDir)();
11
12
  if (sessionDir) {
12
13
  const epochPath = (0, _animus_ui_extract_session.replacementEpochPath)(sessionDir);
@@ -28,13 +29,17 @@ function animusLoader(source) {
28
29
  manifestJson = (0, _animus_ui_extract_session.getManifestJson)() ?? manifestJson;
29
30
  }
30
31
  }
31
- return require_loader_core.transformWithManifest({
32
+ const code = require_loader_core.transformWithManifest({
32
33
  source,
33
34
  filename,
34
35
  manifestJson,
35
36
  engineApi: _animus_ui_extract_session.engineApi,
36
37
  opts: this.getOptions?.() ?? {}
37
38
  });
39
+ if (!watching || this.addDependency === void 0) return code;
40
+ const extended = require_loader_core.extendedFiles(manifestJson, filename);
41
+ for (const file of extended) this.addDependency((0, path.join)(this.rootContext, file));
42
+ return code + require_loader_core.extensionLineage(extended, (0, _animus_ui_extract_session.getAnalyzedHashes)());
38
43
  }
39
44
  //#endregion
40
45
  module.exports = animusLoader;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD,KAAK,aAAa,GAAG,iBAAiB,GAAG;IACvC,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,GAAG,MAAM,CAAC;CAC9C,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,GACb,MAAM,CAsCR"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD,KAAK,aAAa,GAAG,iBAAiB,GAAG;IACvC,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,GAAG,MAAM,CAAC;CAC9C,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,GACb,MAAM,CAgDR"}
package/dist/loader.mjs CHANGED
@@ -1,12 +1,13 @@
1
- import { t as transformWithManifest } from "./loader-core-x6cOzF9v.mjs";
1
+ import { n as extensionLineage, r as transformWithManifest, t as extendedFiles } from "./loader-core-Dg0a-jZv.mjs";
2
2
  import { contentHash } from "@animus-ui/extract/pipeline";
3
3
  import { engineApi, getAnalyzedHashes, getManifestJson, getSessionArtifactDir, replacementEpochPath } from "@animus-ui/extract/session";
4
4
  import { existsSync } from "fs";
5
- import { relative } from "path";
5
+ import { join, relative } from "path";
6
6
  //#region src/loader.ts
7
7
  const epochSeenForSessionDir = /* @__PURE__ */ new Set();
8
8
  function animusLoader(source) {
9
- if (this.mode !== "production" && this.addDependency !== void 0) {
9
+ const watching = this.mode !== "production";
10
+ if (watching && this.addDependency !== void 0) {
10
11
  const sessionDir = getSessionArtifactDir();
11
12
  if (sessionDir) {
12
13
  const epochPath = replacementEpochPath(sessionDir);
@@ -28,13 +29,17 @@ function animusLoader(source) {
28
29
  manifestJson = getManifestJson() ?? manifestJson;
29
30
  }
30
31
  }
31
- return transformWithManifest({
32
+ const code = transformWithManifest({
32
33
  source,
33
34
  filename,
34
35
  manifestJson,
35
36
  engineApi,
36
37
  opts: this.getOptions?.() ?? {}
37
38
  });
39
+ if (!watching || this.addDependency === void 0) return code;
40
+ const extended = extendedFiles(manifestJson, filename);
41
+ for (const file of extended) this.addDependency(join(this.rootContext, file));
42
+ return code + extensionLineage(extended, getAnalyzedHashes());
38
43
  }
39
44
  //#endregion
40
45
  export { animusLoader as default };
package/dist/plugin.d.ts CHANGED
@@ -39,6 +39,11 @@ type CandidateModule = {
39
39
  type NeedBuildCallback = (err?: Error | null, result?: boolean) => void;
40
40
  type NeedBuildContext = Record<never, never>;
41
41
  type CompilationIdentity = Record<never, never>;
42
+ /** The compilation `thisCompilation` hands over: its identity keys the
43
+ * NormalModule hooks, and its errors fail that build. */
44
+ type OwnCompilation = CompilationIdentity & {
45
+ errors: Error[];
46
+ };
42
47
  type NormalModuleCompilationHooks = {
43
48
  needBuild?: {
44
49
  tapAsync: (name: string, fn: (module: CandidateModule, context: NeedBuildContext, callback: NeedBuildCallback) => void) => void;
@@ -56,7 +61,7 @@ type Compiler = {
56
61
  tap: (name: string, fn: (compilation: Compilation) => void) => void;
57
62
  };
58
63
  thisCompilation: {
59
- tap: (name: string, fn: (compilation: CompilationIdentity) => void) => void;
64
+ tap: (name: string, fn: (compilation: OwnCompilation) => void) => void;
60
65
  };
61
66
  };
62
67
  context: string;
@@ -94,11 +99,17 @@ export declare class AnimusWebpackPlugin {
94
99
  private readonly animusLoaderPaths;
95
100
  private lastBuiltEpoch;
96
101
  private epochMovedForNextCompilation;
102
+ /** This turn's rejected analysis. A rejection must fail the compilation,
103
+ * never `watchRun`: webpack stops watching after a failed `watchRun`. */
104
+ private watchFailure;
97
105
  constructor(options: AnimusNextOptions);
98
106
  private moduleUsesAnimusLoader;
99
107
  private appendEpochWatchIgnore;
100
108
  private extractAliases;
101
109
  apply(compiler: Compiler): void;
110
+ /** Rejects with the analysis error; the published generation stays the
111
+ * last successful one. */
112
+ private analyzeWatchTurn;
102
113
  resetForHmr(): void;
103
114
  get sessionId(): string;
104
115
  setRootDir(rootDir: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,KAAK,aAAa,GAAG;IACnB,MAAM,IAAI,MAAM,GAAG,MAAM,CAAC;IAC1B,IAAI,IAAI,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,gBAAgB,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC,KAAK,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAEpD,KAAK,YAAY,GACb,gBAAgB,GAChB,gBAAgB,EAAE,GAClB,kBAAkB,GAClB,IAAI,GACJ,SAAS,CAAC;AAYd,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC;AAEjE,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,gBAAgB,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC9C,mBAAmB,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACjD,mBAAm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-ui/extract/pipeline";
2
+ import { ANIMUS_CSS_MODULE_ID, STYLES_ARTIFACT, SYSTEM_PROPS_ARTIFACT, TURBOPACK_SYSTEM_PROPS_ID } from "@animus-ui/extract/session";
3
+ import { existsSync } from "fs";
4
+ import { dirname, join, relative, resolve } from "path";
5
+ import { fileURLToPath } from "url";
6
+ //#region src/loader-path.ts
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+ function resolveLoaderPath(pluginDir, distCandidates, sourceFallback) {
10
+ for (const candidate of distCandidates) {
11
+ const distPath = resolve(pluginDir, candidate);
12
+ if (existsSync(distPath)) return distPath;
13
+ }
14
+ return resolve(pluginDir, sourceFallback);
15
+ }
16
+ function resolveAnimusLoaderPath() {
17
+ return resolveLoaderPath(__dirname, ["loader.mjs"], "loader.ts");
18
+ }
19
+ //#endregion
20
+ //#region src/turbopack-config.ts
21
+ /** The one glob the loader registers under, derived from the shared engine
22
+ * extension set so the bundler families cannot drift. `.mjs` belongs in that
23
+ * set: an external package with no src/ is ingested through its dist entry
24
+ * and must still reach the loader, so do not trim it. */
25
+ const ANIMUS_TURBOPACK_RULE_GLOB = `*.{${ENGINE_TRANSFORM_EXTENSIONS.join(",")}}`;
26
+ function resolveTurbopackMode(options, env = process.env) {
27
+ const mode = options.turbopack?.mode ?? options.unstable_turbopack?.mode ?? "auto";
28
+ if (mode === "on") return true;
29
+ if (mode === "auto") return env.TURBOPACK !== void 0;
30
+ return false;
31
+ }
32
+ /** Development under Turbopack: the dev watcher runs, and loaders may wait
33
+ * for and re-deliver its generations. */
34
+ function isTurbopackDevelopment(env = process.env) {
35
+ return env.NODE_ENV === "development";
36
+ }
37
+ function rootRelativeRequest(rootDir, absPath) {
38
+ return `./${relative(rootDir, absPath).replace(/\\/g, "/")}`;
39
+ }
40
+ function buildTurbopackConfig(args) {
41
+ const { rootDir, loaderPath, options, externalSourceEntries, sessionId, sessionDir } = args;
42
+ const loaderOptions = {
43
+ rootDir,
44
+ sessionId,
45
+ sessionDir
46
+ };
47
+ if (options.strict !== void 0) loaderOptions.strict = options.strict;
48
+ if (options.cssImportTarget !== void 0) loaderOptions.cssImportTarget = options.cssImportTarget;
49
+ const resolveAlias = {
50
+ [TURBOPACK_SYSTEM_PROPS_ID]: rootRelativeRequest(rootDir, join(sessionDir, SYSTEM_PROPS_ARTIFACT)),
51
+ [ANIMUS_CSS_MODULE_ID]: rootRelativeRequest(rootDir, join(sessionDir, STYLES_ARTIFACT))
52
+ };
53
+ for (const [specifier, srcEntry] of externalSourceEntries) resolveAlias[specifier] = rootRelativeRequest(rootDir, srcEntry);
54
+ return {
55
+ rules: { [ANIMUS_TURBOPACK_RULE_GLOB]: { loaders: [{
56
+ loader: loaderPath,
57
+ options: loaderOptions
58
+ }] } },
59
+ resolveAlias
60
+ };
61
+ }
62
+ function resolveTurbopackLoaderPath(pluginDir) {
63
+ return resolveLoaderPath(pluginDir, ["turbopack-loader.cjs", "turbopack-loader.mjs"], "turbopack-loader.ts");
64
+ }
65
+ //#endregion
66
+ export { resolveTurbopackMode as a, resolveTurbopackLoaderPath as i, buildTurbopackConfig as n, resolveAnimusLoaderPath as o, isTurbopackDevelopment as r, ANIMUS_TURBOPACK_RULE_GLOB as t };
@@ -0,0 +1,100 @@
1
+ let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
2
+ let _animus_ui_extract_session = require("@animus-ui/extract/session");
3
+ let fs = require("fs");
4
+ let path = require("path");
5
+ //#region src/loader-path.ts
6
+ const __filename$1 = (0, require("url").fileURLToPath)(require("url").pathToFileURL(__filename).href);
7
+ const __dirname$1 = (0, path.dirname)(__filename$1);
8
+ function resolveLoaderPath(pluginDir, distCandidates, sourceFallback) {
9
+ for (const candidate of distCandidates) {
10
+ const distPath = (0, path.resolve)(pluginDir, candidate);
11
+ if ((0, fs.existsSync)(distPath)) return distPath;
12
+ }
13
+ return (0, path.resolve)(pluginDir, sourceFallback);
14
+ }
15
+ function resolveAnimusLoaderPath() {
16
+ return resolveLoaderPath(__dirname$1, ["loader.mjs"], "loader.ts");
17
+ }
18
+ //#endregion
19
+ //#region src/turbopack-config.ts
20
+ /** The one glob the loader registers under, derived from the shared engine
21
+ * extension set so the bundler families cannot drift. `.mjs` belongs in that
22
+ * set: an external package with no src/ is ingested through its dist entry
23
+ * and must still reach the loader, so do not trim it. */
24
+ const ANIMUS_TURBOPACK_RULE_GLOB = `*.{${_animus_ui_extract_pipeline.ENGINE_TRANSFORM_EXTENSIONS.join(",")}}`;
25
+ function resolveTurbopackMode(options, env = process.env) {
26
+ const mode = options.turbopack?.mode ?? options.unstable_turbopack?.mode ?? "auto";
27
+ if (mode === "on") return true;
28
+ if (mode === "auto") return env.TURBOPACK !== void 0;
29
+ return false;
30
+ }
31
+ /** Development under Turbopack: the dev watcher runs, and loaders may wait
32
+ * for and re-deliver its generations. */
33
+ function isTurbopackDevelopment(env = process.env) {
34
+ return env.NODE_ENV === "development";
35
+ }
36
+ function rootRelativeRequest(rootDir, absPath) {
37
+ return `./${(0, path.relative)(rootDir, absPath).replace(/\\/g, "/")}`;
38
+ }
39
+ function buildTurbopackConfig(args) {
40
+ const { rootDir, loaderPath, options, externalSourceEntries, sessionId, sessionDir } = args;
41
+ const loaderOptions = {
42
+ rootDir,
43
+ sessionId,
44
+ sessionDir
45
+ };
46
+ if (options.strict !== void 0) loaderOptions.strict = options.strict;
47
+ if (options.cssImportTarget !== void 0) loaderOptions.cssImportTarget = options.cssImportTarget;
48
+ const resolveAlias = {
49
+ [_animus_ui_extract_session.TURBOPACK_SYSTEM_PROPS_ID]: rootRelativeRequest(rootDir, (0, path.join)(sessionDir, _animus_ui_extract_session.SYSTEM_PROPS_ARTIFACT)),
50
+ [_animus_ui_extract_session.ANIMUS_CSS_MODULE_ID]: rootRelativeRequest(rootDir, (0, path.join)(sessionDir, _animus_ui_extract_session.STYLES_ARTIFACT))
51
+ };
52
+ for (const [specifier, srcEntry] of externalSourceEntries) resolveAlias[specifier] = rootRelativeRequest(rootDir, srcEntry);
53
+ return {
54
+ rules: { [ANIMUS_TURBOPACK_RULE_GLOB]: { loaders: [{
55
+ loader: loaderPath,
56
+ options: loaderOptions
57
+ }] } },
58
+ resolveAlias
59
+ };
60
+ }
61
+ function resolveTurbopackLoaderPath(pluginDir) {
62
+ return resolveLoaderPath(pluginDir, ["turbopack-loader.cjs", "turbopack-loader.mjs"], "turbopack-loader.ts");
63
+ }
64
+ //#endregion
65
+ Object.defineProperty(exports, "ANIMUS_TURBOPACK_RULE_GLOB", {
66
+ enumerable: true,
67
+ get: function() {
68
+ return ANIMUS_TURBOPACK_RULE_GLOB;
69
+ }
70
+ });
71
+ Object.defineProperty(exports, "buildTurbopackConfig", {
72
+ enumerable: true,
73
+ get: function() {
74
+ return buildTurbopackConfig;
75
+ }
76
+ });
77
+ Object.defineProperty(exports, "isTurbopackDevelopment", {
78
+ enumerable: true,
79
+ get: function() {
80
+ return isTurbopackDevelopment;
81
+ }
82
+ });
83
+ Object.defineProperty(exports, "resolveAnimusLoaderPath", {
84
+ enumerable: true,
85
+ get: function() {
86
+ return resolveAnimusLoaderPath;
87
+ }
88
+ });
89
+ Object.defineProperty(exports, "resolveTurbopackLoaderPath", {
90
+ enumerable: true,
91
+ get: function() {
92
+ return resolveTurbopackLoaderPath;
93
+ }
94
+ });
95
+ Object.defineProperty(exports, "resolveTurbopackMode", {
96
+ enumerable: true,
97
+ get: function() {
98
+ return resolveTurbopackMode;
99
+ }
100
+ });
@@ -21,6 +21,9 @@ export interface TurbopackConfigFragment {
21
21
  export declare const ANIMUS_TURBOPACK_RULE_GLOB: string;
22
22
  export { TURBOPACK_SYSTEM_PROPS_ID };
23
23
  export declare function resolveTurbopackMode(options: AnimusNextOptions, env?: Record<string, string | undefined>): boolean;
24
+ /** Development under Turbopack: the dev watcher runs, and loaders may wait
25
+ * for and re-deliver its generations. */
26
+ export declare function isTurbopackDevelopment(env?: Record<string, string | undefined>): boolean;
24
27
  export declare function buildTurbopackConfig(args: {
25
28
  rootDir: string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AC;CACpB,GAAG,uBAAuB,CA0C1B;AAED,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMpE"}
@@ -24,7 +24,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
  //#endregion
27
- const require_loader_core = require("./loader-core-BthLSJQF.cjs");
27
+ const require_turbopack_config = require("./turbopack-config-DDjiYVRp.cjs");
28
+ const require_loader_core = require("./loader-core-Cnipfewg.cjs");
28
29
  let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
29
30
  let _animus_ui_extract_session = require("@animus-ui/extract/session");
30
31
  let fs = require("fs");
@@ -163,6 +164,8 @@ const CATCHUP_NO_DEADLINE_CAP_MS = 2e3;
163
164
  function sleep(ms) {
164
165
  return new Promise((resolve) => setTimeout(resolve, ms));
165
166
  }
167
+ /** Whether the attempt has seen `file` at `hash` (its current content). */
168
+ const observedPending = (status, file, hash) => (status.pending ?? []).some(([key, seen]) => key === file && seen === hash);
166
169
  const ACTIVE_STATES = /* @__PURE__ */ new Set([
167
170
  "starting",
168
171
  "debouncing",
@@ -188,13 +191,16 @@ async function runLoader(ctx, source) {
188
191
  ctx.addDependency(epochPath);
189
192
  }
190
193
  const filename = (0, path.relative)(rootDir, ctx.resourcePath);
191
- /** Registers commit and status as dependencies before throwing: the runner
192
- * sends dependency IPC ahead of the error, so a landing commit re-fires.
193
- * Failure paths only — successful paths register neither, so this must not
194
- * be hoisted out of the failure helper. */
195
- const coverageFailure = (message) => {
194
+ /** Makes a landing commit re-fire this module. Only paths still waiting
195
+ * on an analysis register it: one that delivered never re-fires. */
196
+ const awaitNextCommit = () => {
196
197
  ctx.addDependency?.(commitPath);
197
198
  ctx.addDependency?.(statusPath);
199
+ };
200
+ /** Registers before throwing: the runner sends dependency IPC ahead of the
201
+ * error. */
202
+ const coverageFailure = (message) => {
203
+ awaitNextCommit();
198
204
  return new Error(message);
199
205
  };
200
206
  const transform = (manifestJson) => require_loader_core.transformWithManifest({
@@ -204,15 +210,31 @@ async function runLoader(ctx, source) {
204
210
  engineApi: engineApiImpl,
205
211
  opts
206
212
  });
213
+ const deliver = async (covering) => {
214
+ if (!require_turbopack_config.isTurbopackDevelopment()) return transform(covering.manifestJson);
215
+ const extended = require_loader_core.extendedFiles(covering.manifestJson, filename);
216
+ const generation = await coverExtendedFiles({
217
+ covering,
218
+ extended,
219
+ filename,
220
+ rootDir,
221
+ sessionDir,
222
+ sessionId,
223
+ awaitNextCommit
224
+ });
225
+ const lineage = generation === covering ? extended : require_loader_core.extendedFiles(generation.manifestJson, filename);
226
+ for (const file of lineage) ctx.addDependency?.((0, path.join)(rootDir, file));
227
+ return transform(generation.manifestJson) + require_loader_core.extensionLineage(lineage, generation.fileHashes);
228
+ };
207
229
  const outcome = hydrateSession(sessionDir, sessionId);
208
230
  if (outcome.kind === "foreign") throw coverageFailure(`ANIMUS_FOREIGN_SESSION: artifacts under ${sessionDir} belong to session ${outcome.artifactSessionId}, not ${sessionId} — refusing to transform from a foreign generation`);
209
231
  if (outcome.kind === "torn") throw coverageFailure(`ANIMUS_ARTIFACT_READ_TORN: could not obtain a consistent committed artifact set for ${filename} after ${ARTIFACT_READ_RETRIES} attempts`);
210
232
  let sourceHash = null;
211
233
  if (outcome.kind === "ok") {
212
234
  const analyzedHash = outcome.hydration.fileHashes.get(filename);
213
- if (analyzedHash === void 0) return transform(outcome.hydration.manifestJson);
235
+ if (analyzedHash === void 0) return deliver(outcome.hydration);
214
236
  sourceHash = (0, _animus_ui_extract_pipeline.contentHash)(source);
215
- if (analyzedHash === sourceHash) return transform(outcome.hydration.manifestJson);
237
+ if (analyzedHash === sourceHash) return deliver(outcome.hydration);
216
238
  }
217
239
  return awaitCoverage({
218
240
  source,
@@ -221,11 +243,11 @@ async function runLoader(ctx, source) {
221
243
  sessionId,
222
244
  sessionDir,
223
245
  coverageFailure,
224
- transform
246
+ deliver
225
247
  });
226
248
  }
227
249
  async function awaitCoverage(args) {
228
- const { source, sourceHash, filename, sessionId, sessionDir, coverageFailure, transform } = args;
250
+ const { source, sourceHash, filename, sessionId, sessionDir, coverageFailure, deliver } = args;
229
251
  const noDeadlineCap = Date.now() + CATCHUP_NO_DEADLINE_CAP_MS + CATCHUP_WAIT_MARGIN_MS;
230
252
  let poll = CATCHUP_POLL_INITIAL_MS;
231
253
  for (;;) {
@@ -233,7 +255,7 @@ async function awaitCoverage(args) {
233
255
  if (outcome.kind === "foreign") throw coverageFailure(`ANIMUS_FOREIGN_SESSION: artifacts under ${sessionDir} belong to session ${outcome.artifactSessionId}, not ${sessionId}`);
234
256
  if (outcome.kind === "ok") {
235
257
  const analyzedHash = outcome.hydration.fileHashes.get(filename);
236
- if (analyzedHash !== void 0 && analyzedHash === sourceHash) return transform(outcome.hydration.manifestJson);
258
+ if (analyzedHash !== void 0 && analyzedHash === sourceHash) return deliver(outcome.hydration);
237
259
  }
238
260
  const commitPresent = outcome.kind === "ok";
239
261
  const status = readStatus(sessionDir);
@@ -245,7 +267,7 @@ async function awaitCoverage(args) {
245
267
  if (status.state === "failed") throw coverageFailure(`ANIMUS_ANALYSIS_FAILED: the analysis covering ${filename} failed: ${status.diagnostic ?? "unknown analysis error"}`);
246
268
  if (status.state === "idle" || !ACTIVE_STATES.has(status.state)) throw coverageFailure(`ANIMUS_ANALYSIS_NOT_SCHEDULED: ${filename} changed but no analysis attempt is scheduled for it (watcher miss?)`);
247
269
  if (commitPresent) {
248
- if (!(status.pending ?? []).some(([key, hash]) => key === filename && hash === sourceHash)) throw coverageFailure(`ANIMUS_ANALYSIS_NOT_SCHEDULED: the active analysis attempt (${status.attemptId}) has not observed ${filename} at its current content`);
270
+ if (!observedPending(status, filename, sourceHash)) throw coverageFailure(`ANIMUS_ANALYSIS_NOT_SCHEDULED: the active analysis attempt (${status.attemptId}) has not observed ${filename} at its current content`);
249
271
  }
250
272
  const now = Date.now();
251
273
  if (hasReadableDeadline(status)) {
@@ -255,6 +277,39 @@ async function awaitCoverage(args) {
255
277
  poll = CATCHUP_POLL_MAX_MS;
256
278
  }
257
279
  }
280
+ /**
281
+ * A commit covering the extended files' current content, so an extension and
282
+ * the parent it captures come from one generation. Waits only while an active
283
+ * attempt has observed that content; otherwise keeps `covering` and re-fires
284
+ * on the next commit. Never throws: an extended file's failure is reported by
285
+ * its own module.
286
+ */
287
+ async function coverExtendedFiles(args) {
288
+ const { covering, extended, filename, rootDir, sessionDir, sessionId } = args;
289
+ const current = [];
290
+ for (const file of extended) {
291
+ const text = readFileOrNull((0, path.join)(rootDir, file));
292
+ if (text !== null) current.push([file, (0, _animus_ui_extract_pipeline.contentHash)(text)]);
293
+ }
294
+ const ownHash = covering.fileHashes.get(filename);
295
+ const covers = (hydration) => hydration.fileHashes.get(filename) === ownHash && current.every(([file, hash]) => hydration.fileHashes.get(file) === hash);
296
+ if (covers(covering)) return covering;
297
+ const noDeadlineCap = Date.now() + CATCHUP_NO_DEADLINE_CAP_MS + CATCHUP_WAIT_MARGIN_MS;
298
+ let poll = CATCHUP_POLL_INITIAL_MS;
299
+ for (;;) {
300
+ const outcome = hydrateSession(sessionDir, sessionId);
301
+ const latest = outcome.kind === "ok" ? outcome.hydration : covering;
302
+ if (covers(latest)) return latest;
303
+ const status = readStatus(sessionDir);
304
+ const now = Date.now();
305
+ if (!(status !== null && status.sessionId === sessionId && ACTIVE_STATES.has(status.state) && current.every(([file, hash]) => latest.fileHashes.get(file) === hash || observedPending(status, file, hash)) && (hasReadableDeadline(status) ? now <= status.deadlineAt : now <= noDeadlineCap))) {
306
+ args.awaitNextCommit();
307
+ return covering;
308
+ }
309
+ await sleep(poll);
310
+ poll = CATCHUP_POLL_MAX_MS;
311
+ }
312
+ }
258
313
  //#endregion
259
314
  exports.__resetTurbopackLoaderStateForTests = __resetTurbopackLoaderStateForTests;
260
315
  exports.__setTurbopackLoaderEngineApiForTests = __setTurbopackLoaderEngineApiForTests;
@@ -1 +1 @@
1
- {"version":3,"file":"turbopack-loader.d.ts","sourceRoot":"","sources":["../src/turbopack-loader.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,MAAM,MAAM,IAAI,CAAC;AAK7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,KAAK,EAEV,SAAS,EAEV,MAAM,6BAA6B,CAAC;AAUrC;;;yEAGyE;AACzE,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,KAAK,cAAc,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAEpE,KAAK,aAAa,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,GAAG;IAC/D,KAAK,CAAC,EAAE,MAAM,cAAc,CAAC;CAC9B,CAAC;AAgCF,KAAK,eAAe,GAAG,MAAM,IAAI,CAC/B,SAAS,EACT,gBAAgB,GAAG,eAAe,CACnC,CAAC;AAGF,2BAA2B;AAC3B,wBAAgB,qCAAqC,CACnD,GAAG,EAAE,eAAe,GAAG,IAAI,GAC1B,IAAI,CAEN;AAED,KAAK,QAAQ,GAAG,IAAI,CAAC,OAAO,MAAM,EAAE,cAAc,GAAG,YAAY,CAAC,CAAC;AAGnE,2BAA2B;AAC3B,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAExE;AAID,2BAA2B;AAC3B,wBAAgB,mCAAmC,IAAI,IAAI,CAK1D;AA6ID,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,GACb,IAAI,CAYN"}
1
+ {"version":3,"file":"turbopack-loader.d.ts","sourceRoot":"","sources":["../src/turbopack-loader.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,MAAM,MAAM,IAAI,CAAC;AAU7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,KAAK,EAEV,SAAS,EAEV,MAAM,6BAA6B,CAAC;AAUrC;;;yEAGyE;AACzE,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,KAAK,cAAc,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAEpE,KAAK,aAAa,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,GAAG;IAC/D,KAAK,CAAC,EAAE,MAAM,cAAc,CAAC;CAC9B,CAAC;AAgCF,KAAK,eAAe,GAAG,MAAM,IAAI,CAC/B,SAAS,EACT,gBAAgB,GAAG,eAAe,CACnC,CAAC;AAGF,2BAA2B;AAC3B,wBAAgB,qCAAqC,CACnD,GAAG,EAAE,eAAe,GAAG,IAAI,GAC1B,IAAI,CAEN;AAED,KAAK,QAAQ,GAAG,IAAI,CAAC,OAAO,MAAM,EAAE,cAAc,GAAG,YAAY,CAAC,CAAC;AAGnE,2BAA2B;AAC3B,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAExE;AAID,2BAA2B;AAC3B,wBAAgB,mCAAmC,IAAI,IAAI,CAK1D;AAqJD,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,GACb,IAAI,CAYN"}
@@ -1,9 +1,10 @@
1
- import { t as transformWithManifest } from "./loader-core-x6cOzF9v.mjs";
1
+ import { r as isTurbopackDevelopment } from "./turbopack-config-CaAI_L6k.mjs";
2
+ import { n as extensionLineage, r as transformWithManifest, t as extendedFiles } from "./loader-core-Dg0a-jZv.mjs";
2
3
  import { createRequire } from "node:module";
3
4
  import { buildAnalyzeProjectArgs, contentHash, createV2EngineApi, parseFilesJson } from "@animus-ui/extract/pipeline";
4
5
  import { analysisCommitPath, analysisInputsPath, analysisStatusPath, manifestPath, readJsonEnvelope, replacementEpochPath, sessionArtifactDir } from "@animus-ui/extract/session";
5
6
  import * as nodeFs from "fs";
6
- import { relative } from "path";
7
+ import { join, relative } from "path";
7
8
  //#region \0rolldown/runtime.js
8
9
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
9
10
  //#endregion
@@ -140,6 +141,8 @@ const CATCHUP_NO_DEADLINE_CAP_MS = 2e3;
140
141
  function sleep(ms) {
141
142
  return new Promise((resolve) => setTimeout(resolve, ms));
142
143
  }
144
+ /** Whether the attempt has seen `file` at `hash` (its current content). */
145
+ const observedPending = (status, file, hash) => (status.pending ?? []).some(([key, seen]) => key === file && seen === hash);
143
146
  const ACTIVE_STATES = /* @__PURE__ */ new Set([
144
147
  "starting",
145
148
  "debouncing",
@@ -165,13 +168,16 @@ async function runLoader(ctx, source) {
165
168
  ctx.addDependency(epochPath);
166
169
  }
167
170
  const filename = relative(rootDir, ctx.resourcePath);
168
- /** Registers commit and status as dependencies before throwing: the runner
169
- * sends dependency IPC ahead of the error, so a landing commit re-fires.
170
- * Failure paths only — successful paths register neither, so this must not
171
- * be hoisted out of the failure helper. */
172
- const coverageFailure = (message) => {
171
+ /** Makes a landing commit re-fire this module. Only paths still waiting
172
+ * on an analysis register it: one that delivered never re-fires. */
173
+ const awaitNextCommit = () => {
173
174
  ctx.addDependency?.(commitPath);
174
175
  ctx.addDependency?.(statusPath);
176
+ };
177
+ /** Registers before throwing: the runner sends dependency IPC ahead of the
178
+ * error. */
179
+ const coverageFailure = (message) => {
180
+ awaitNextCommit();
175
181
  return new Error(message);
176
182
  };
177
183
  const transform = (manifestJson) => transformWithManifest({
@@ -181,15 +187,31 @@ async function runLoader(ctx, source) {
181
187
  engineApi: engineApiImpl,
182
188
  opts
183
189
  });
190
+ const deliver = async (covering) => {
191
+ if (!isTurbopackDevelopment()) return transform(covering.manifestJson);
192
+ const extended = extendedFiles(covering.manifestJson, filename);
193
+ const generation = await coverExtendedFiles({
194
+ covering,
195
+ extended,
196
+ filename,
197
+ rootDir,
198
+ sessionDir,
199
+ sessionId,
200
+ awaitNextCommit
201
+ });
202
+ const lineage = generation === covering ? extended : extendedFiles(generation.manifestJson, filename);
203
+ for (const file of lineage) ctx.addDependency?.(join(rootDir, file));
204
+ return transform(generation.manifestJson) + extensionLineage(lineage, generation.fileHashes);
205
+ };
184
206
  const outcome = hydrateSession(sessionDir, sessionId);
185
207
  if (outcome.kind === "foreign") throw coverageFailure(`ANIMUS_FOREIGN_SESSION: artifacts under ${sessionDir} belong to session ${outcome.artifactSessionId}, not ${sessionId} — refusing to transform from a foreign generation`);
186
208
  if (outcome.kind === "torn") throw coverageFailure(`ANIMUS_ARTIFACT_READ_TORN: could not obtain a consistent committed artifact set for ${filename} after ${ARTIFACT_READ_RETRIES} attempts`);
187
209
  let sourceHash = null;
188
210
  if (outcome.kind === "ok") {
189
211
  const analyzedHash = outcome.hydration.fileHashes.get(filename);
190
- if (analyzedHash === void 0) return transform(outcome.hydration.manifestJson);
212
+ if (analyzedHash === void 0) return deliver(outcome.hydration);
191
213
  sourceHash = contentHash(source);
192
- if (analyzedHash === sourceHash) return transform(outcome.hydration.manifestJson);
214
+ if (analyzedHash === sourceHash) return deliver(outcome.hydration);
193
215
  }
194
216
  return awaitCoverage({
195
217
  source,
@@ -198,11 +220,11 @@ async function runLoader(ctx, source) {
198
220
  sessionId,
199
221
  sessionDir,
200
222
  coverageFailure,
201
- transform
223
+ deliver
202
224
  });
203
225
  }
204
226
  async function awaitCoverage(args) {
205
- const { source, sourceHash, filename, sessionId, sessionDir, coverageFailure, transform } = args;
227
+ const { source, sourceHash, filename, sessionId, sessionDir, coverageFailure, deliver } = args;
206
228
  const noDeadlineCap = Date.now() + CATCHUP_NO_DEADLINE_CAP_MS + CATCHUP_WAIT_MARGIN_MS;
207
229
  let poll = CATCHUP_POLL_INITIAL_MS;
208
230
  for (;;) {
@@ -210,7 +232,7 @@ async function awaitCoverage(args) {
210
232
  if (outcome.kind === "foreign") throw coverageFailure(`ANIMUS_FOREIGN_SESSION: artifacts under ${sessionDir} belong to session ${outcome.artifactSessionId}, not ${sessionId}`);
211
233
  if (outcome.kind === "ok") {
212
234
  const analyzedHash = outcome.hydration.fileHashes.get(filename);
213
- if (analyzedHash !== void 0 && analyzedHash === sourceHash) return transform(outcome.hydration.manifestJson);
235
+ if (analyzedHash !== void 0 && analyzedHash === sourceHash) return deliver(outcome.hydration);
214
236
  }
215
237
  const commitPresent = outcome.kind === "ok";
216
238
  const status = readStatus(sessionDir);
@@ -222,7 +244,7 @@ async function awaitCoverage(args) {
222
244
  if (status.state === "failed") throw coverageFailure(`ANIMUS_ANALYSIS_FAILED: the analysis covering ${filename} failed: ${status.diagnostic ?? "unknown analysis error"}`);
223
245
  if (status.state === "idle" || !ACTIVE_STATES.has(status.state)) throw coverageFailure(`ANIMUS_ANALYSIS_NOT_SCHEDULED: ${filename} changed but no analysis attempt is scheduled for it (watcher miss?)`);
224
246
  if (commitPresent) {
225
- if (!(status.pending ?? []).some(([key, hash]) => key === filename && hash === sourceHash)) throw coverageFailure(`ANIMUS_ANALYSIS_NOT_SCHEDULED: the active analysis attempt (${status.attemptId}) has not observed ${filename} at its current content`);
247
+ if (!observedPending(status, filename, sourceHash)) throw coverageFailure(`ANIMUS_ANALYSIS_NOT_SCHEDULED: the active analysis attempt (${status.attemptId}) has not observed ${filename} at its current content`);
226
248
  }
227
249
  const now = Date.now();
228
250
  if (hasReadableDeadline(status)) {
@@ -232,5 +254,38 @@ async function awaitCoverage(args) {
232
254
  poll = CATCHUP_POLL_MAX_MS;
233
255
  }
234
256
  }
257
+ /**
258
+ * A commit covering the extended files' current content, so an extension and
259
+ * the parent it captures come from one generation. Waits only while an active
260
+ * attempt has observed that content; otherwise keeps `covering` and re-fires
261
+ * on the next commit. Never throws: an extended file's failure is reported by
262
+ * its own module.
263
+ */
264
+ async function coverExtendedFiles(args) {
265
+ const { covering, extended, filename, rootDir, sessionDir, sessionId } = args;
266
+ const current = [];
267
+ for (const file of extended) {
268
+ const text = readFileOrNull(join(rootDir, file));
269
+ if (text !== null) current.push([file, contentHash(text)]);
270
+ }
271
+ const ownHash = covering.fileHashes.get(filename);
272
+ const covers = (hydration) => hydration.fileHashes.get(filename) === ownHash && current.every(([file, hash]) => hydration.fileHashes.get(file) === hash);
273
+ if (covers(covering)) return covering;
274
+ const noDeadlineCap = Date.now() + CATCHUP_NO_DEADLINE_CAP_MS + CATCHUP_WAIT_MARGIN_MS;
275
+ let poll = CATCHUP_POLL_INITIAL_MS;
276
+ for (;;) {
277
+ const outcome = hydrateSession(sessionDir, sessionId);
278
+ const latest = outcome.kind === "ok" ? outcome.hydration : covering;
279
+ if (covers(latest)) return latest;
280
+ const status = readStatus(sessionDir);
281
+ const now = Date.now();
282
+ if (!(status !== null && status.sessionId === sessionId && ACTIVE_STATES.has(status.state) && current.every(([file, hash]) => latest.fileHashes.get(file) === hash || observedPending(status, file, hash)) && (hasReadableDeadline(status) ? now <= status.deadlineAt : now <= noDeadlineCap))) {
283
+ args.awaitNextCommit();
284
+ return covering;
285
+ }
286
+ await sleep(poll);
287
+ poll = CATCHUP_POLL_MAX_MS;
288
+ }
289
+ }
235
290
  //#endregion
236
291
  export { __resetTurbopackLoaderStateForTests, __setTurbopackLoaderEngineApiForTests, __setTurbopackLoaderFsForTests, animusTurbopackLoader as default };
package/dist/types.d.ts CHANGED
@@ -8,12 +8,14 @@ export interface AnimusNextOptions {
8
8
  /** Extensions scanned for definitions and usages; replaces the default
9
9
  * `['.ts','.tsx','.js','.jsx','.mdx']`. `.mdx` needs `@mdx-js/mdx`. */
10
10
  extensions?: string[];
11
- /** When true, extraction failures throw instead of warning. */
11
+ /** When true, error-severity diagnostics — lost configured inputs and
12
+ * classified unsupported Animus declarations — fail the build instead of
13
+ * warning. Omitted or `false` warns. */
12
14
  strict?: boolean;
13
15
  /** Project-root-relative path of the one file that receives the stylesheet
14
16
  * import; replaces the `app/layout.*` / `pages/_app.*` detection. */
15
17
  cssImportTarget?: string;
16
- verbose?: boolean;
18
+ verbose?: boolean | 'trace';
17
19
  /** Namespace prefix for CSS variables and class names. */
18
20
  prefix?: string;
19
21
  /** Forced-emission declarations for usage the scanner cannot observe
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf;+EAC2E;IAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;4EACwE;IACxE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;0EACsE;IACtE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;yEACqE;IACrE,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;mDAC+C;IAC/C,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B;wDACoD;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;yEACqE;IACrE,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IACpC;gFAC4E;IAC5E,MAAM,CAAC,EAAE,IAAI,CAAC;IACd;qEACiE;IACjE,SAAS,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAAA;KAAE,CAAC;IAC7C;sCACkC;IAClC,k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C;CACH;AAED,KAAK,eAAe,GAAG,CACrB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,kBAAkB,KACxB,aAAa,CAAC;AAEnB,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED,KAAK,kBAAkB,GAAG,CACxB,GAAG,IAAI,EAAE,KAAK,EAAE,KACb,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAIhD,YAAY,EAAE,kBAAkB,IAAI,wBAAwB,EAAE,CAAC;AAE/D,MAAM,MAAM,eAAe,CAAC,MAAM,SAAS,eAAe,IACxD,MAAM,SAAS,kBAAkB,GAAG,KAAK,GAAG,MAAM,GAAG,kBAAkB,CAAC;AAE1E,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,eAAe,IAAI,IAAI,CAClE,MAAM,EACN,SAAS,CACV,GAAG;IACF,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,eAAe,IAAI,IAAI,CACpE,MAAM,EACN,WAAW,CACZ,GAAG;IACF,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAKF,wBAAgB,UAAU,CACxB,OAAO,EAAE,iBAAiB,GACzB,CAAC,MAAM,SAAS,eAAe,EAChC,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,KAChC,iBAAiB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CA4LpE;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,MAAM,GACd,IAAI,CASN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/next-plugin",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Animus static CSS extraction for Next.js (webpack)",
5
5
  "keywords": [
6
6
  "animus",
@@ -40,10 +40,10 @@
40
40
  "compile": "tsc --noEmit"
41
41
  },
42
42
  "dependencies": {
43
- "@animus-ui/extract": "0.1.16"
43
+ "@animus-ui/extract": "0.1.18"
44
44
  },
45
45
  "devDependencies": {
46
- "@animus-ui/assertions": "0.1.16"
46
+ "@animus-ui/assertions": "0.1.18"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@mdx-js/mdx": "^3.0.0",