@animus-ui/next-plugin 0.1.31 → 0.1.35

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.mjs CHANGED
@@ -1,9 +1,10 @@
1
- import { a as resolveTurbopackMode, i as resolveTurbopackLoaderPath, n as buildTurbopackConfig, o as turbopackSideEffectsLimits, r as isTurbopackDevelopment, s as resolveAnimusLoaderPath, t as ANIMUS_TURBOPACK_RULE_GLOB } from "./turbopack-config-3jtLDAIM.mjs";
2
- import { AnimusConfigError, assembleStylesheet, assertKnownOptionKeys, assertSupportedEngine, buildPathAliasesJson, builtInAssetClassification, isEngineTransformExtension, isPathWithinRoot, keepsKitSourceEffects, nextImageAssetClassification, outputExclusion, resolveMode, sourceKitDependencies, turbopackExtensionPolicy, webpackExtensionPolicy } from "@animus-ui/extract/pipeline";
3
- import { ANIMUS_CSS_MODULE_ID, ANIMUS_CSS_MODULE_ID as ANIMUS_CSS_MODULE_ID$1, ExtractionSession, TURBOPACK_SYSTEM_PROPS_ID, createBuildId, getAnalysisStartedPromise, getReplacementEpoch, getSharedCss, getSharedExternalDirs, getSharedExternalEntries, getSharedExternalSideEffects, replacementEpochPath, requireEngine, resetAnalysisStartedPromise, runSessionPipeline, sessionArtifactDir, setAnalysisStartedPromise, startTurbopackWatcher, stylesPath, systemPropsPath } from "@animus-ui/extract/session";
1
+ import { a as resolveTurbopackMode, i as resolveTurbopackLoaderPath, n as buildTurbopackConfig, o as turbopackSideEffectsLimits, r as isTurbopackDevelopment, s as resolveAnimusLoaderPath, t as ANIMUS_TURBOPACK_RULE_GLOB } from "./turbopack-config-BOUPGkmi.mjs";
2
+ import { AnimusConfigError, assembleStylesheet, assertKnownOptionKeys, assertSupportedEngine, buildPathAliasesJson, builtInAssetClassification, fontPreloadsModule, isEngineTransformExtension, isExcludedPackageRelativePath, isPathWithinRoot, keepsKitSourceEffects, layergateMissing, layergateOptions, nextImageAssetClassification, outputExclusion, resolveMode, sourceKitDependencies, turbopackExtensionPolicy, webpackExtensionPolicy, withVendorLayer } from "@animus-ui/extract/pipeline";
3
+ import { ANIMUS_CSS_MODULE_ID, ANIMUS_CSS_MODULE_ID as ANIMUS_CSS_MODULE_ID$1, ExtractionSession, FONT_PRELOADS_MODULE_ID, TURBOPACK_SYSTEM_PROPS_ID, createBuildId, fontPreloadsPath, getAnalysisStartedPromise, getReplacementEpoch, getSharedCss, getSharedExternalDirs, getSharedExternalEntries, getSharedExternalSideEffects, replacementEpochPath, requireEngine, resetAnalysisStartedPromise, runSessionPipeline, sessionArtifactDir, setAnalysisStartedPromise, startTurbopackWatcher, stylesPath, systemPropsPath } from "@animus-ui/extract/session";
4
4
  import { existsSync, mkdirSync, readFileSync, realpathSync, statSync, writeFileSync } from "fs";
5
- import { dirname, join, resolve } from "path";
5
+ import { dirname, join, resolve, sep } from "path";
6
6
  import { fileURLToPath } from "url";
7
+ import { createRequire } from "module";
7
8
  //#region src/same-directory.ts
8
9
  /** Whether two paths name one directory: by real path, which resolves a
9
10
  * trailing slash, a symlink and the filesystem's own spelling, else by
@@ -26,11 +27,97 @@ function sameDirectory(a, b) {
26
27
  }
27
28
  }
28
29
  //#endregion
29
- //#region src/plugin.ts
30
+ //#region src/watch-ignored.ts
31
+ /**
32
+ * webpack's `watchOptions.ignored`, read as Watchpack reads it, so Animus can
33
+ * wrap it: its own epoch file stays ignored, and the files and directories it
34
+ * registers are watched whatever the host ignores (Next ignores every
35
+ * `node_modules` path, where an installed source kit lives).
36
+ */
30
37
  /** The value arrives from a consumer's `next.config`, so the union above is a
31
38
  * model of what webpack accepts, not a proof about the value in hand. */
32
39
  const isWatchIgnoreString = (ignored) => Object.prototype.toString.call(ignored) === "[object String]";
33
40
  const isWatchIgnoreMatcher = (ignored) => Object.prototype.toString.call(ignored) === "[object Function]";
41
+ /** A glob as Watchpack compiles it (`glob-to-regexp` with `globstar` and
42
+ * `extended`, then matching the path or anything under it). */
43
+ function globSource(glob) {
44
+ let source = "";
45
+ let inGroup = false;
46
+ for (let index = 0; index < glob.length; index++) {
47
+ const char = glob[index];
48
+ switch (char) {
49
+ case "/":
50
+ case "$":
51
+ case "^":
52
+ case "+":
53
+ case ".":
54
+ case "(":
55
+ case ")":
56
+ case "=":
57
+ case "!":
58
+ case "|":
59
+ source += `\\${char}`;
60
+ break;
61
+ case "?":
62
+ source += ".";
63
+ break;
64
+ case "{":
65
+ inGroup = true;
66
+ source += "(";
67
+ break;
68
+ case "}":
69
+ inGroup = false;
70
+ source += ")";
71
+ break;
72
+ case ",":
73
+ source += inGroup ? "|" : "\\,";
74
+ break;
75
+ case "*": {
76
+ const before = glob[index - 1];
77
+ let stars = 1;
78
+ while (glob[index + 1] === "*") {
79
+ stars += 1;
80
+ index += 1;
81
+ }
82
+ const after = glob[index + 1];
83
+ if (stars > 1 && (before === "/" || before === void 0) && (after === "/" || after === void 0)) {
84
+ source += "((?:[^/]*(?:/|$))*)";
85
+ index += 1;
86
+ } else source += "([^/]*)";
87
+ break;
88
+ }
89
+ default: source += char;
90
+ }
91
+ }
92
+ return `^${source}(?:$|\\/)`;
93
+ }
94
+ /** What `ignored` ignores, as Watchpack decides it; nothing when unset. */
95
+ function ignoredMatcher(ignored) {
96
+ const slashed = (path) => path.replace(/\\/g, "/");
97
+ if (ignored === void 0 || ignored === null) return () => false;
98
+ if (isWatchIgnoreMatcher(ignored)) return (path) => Boolean(ignored(path));
99
+ if (ignored instanceof RegExp) return (path) => ignored.test(slashed(path));
100
+ const sources = (isWatchIgnoreString(ignored) ? [ignored] : ignored).map((entry) => entry instanceof RegExp ? entry.source : entry.length > 0 ? globSource(entry) : null).filter((source) => source !== null);
101
+ if (sources.length === 0) return () => false;
102
+ const pattern = new RegExp(sources.join("|"));
103
+ return (path) => pattern.test(slashed(path));
104
+ }
105
+ /** Windows paths compare without case, as `path.win32.relative` does. */
106
+ const comparable = process.platform === "win32" ? (path) => path.toLowerCase() : (path) => path;
107
+ /** Whether a path is one of `directories` or lies under one where a kit's
108
+ * sources can live: never in the kit's own `node_modules` or another path
109
+ * ingestion excludes, which stay as the host decides. A prefix test:
110
+ * webpack's watcher asks for every path it watches. */
111
+ function withinDirectories(directories) {
112
+ const prefixes = directories.map((dir) => comparable(dir.endsWith(sep) ? dir : dir + sep)).sort((a, b) => b.length - a.length);
113
+ return (path) => {
114
+ const key = comparable(path) + sep;
115
+ const prefix = prefixes.find((candidate) => key.startsWith(candidate));
116
+ return prefix !== void 0 && !isExcludedPackageRelativePath(key.slice(prefix.length));
117
+ };
118
+ }
119
+ //#endregion
120
+ //#region src/plugin.ts
34
121
  const UNSUPPORTED_WEBPACK_MESSAGE = "[animus-extract] Unsupported webpack: NormalModule.getCompilationHooks(compilation).needBuild is required for dev transform coherence and this webpack does not expose it. Use a Next.js version whose webpack exposes this hook.";
35
122
  const PLUGIN_NAME = "AnimusWebpackPlugin";
36
123
  var AnimusWebpackPlugin = class {
@@ -47,6 +134,16 @@ var AnimusWebpackPlugin = class {
47
134
  /** This turn's rejected analysis. A rejection must fail the compilation,
48
135
  * never `watchRun`: webpack stops watching after a failed `watchRun`. */
49
136
  watchFailure = null;
137
+ /** What the Session's watch plan last registered: `watchIgnored` never
138
+ * ignores it. */
139
+ registered = {
140
+ files: /* @__PURE__ */ new Set(),
141
+ directories: () => false
142
+ };
143
+ /** Other files the watcher must see, by the plugins that read them. */
144
+ alsoWatched = [];
145
+ /** The webpack config Next hands its watcher, when withAnimus made it. */
146
+ watchedConfig;
50
147
  /** `development` is `next dev`: an error-level diagnostic reports and the
51
148
  * compilation keeps publishing, whatever the emission mode. */
52
149
  constructor(options, { development = false, build } = {}) {
@@ -54,6 +151,7 @@ var AnimusWebpackPlugin = class {
54
151
  assertSupportedEngine(options.engine);
55
152
  this.session = new ExtractionSession(options, { build });
56
153
  this.session.development = development;
154
+ this.session.writesFontPreloadsModule = true;
57
155
  this.session.delivery = {
58
156
  ...this.session.delivery,
59
157
  systemPropsModuleId: TURBOPACK_SYSTEM_PROPS_ID
@@ -66,19 +164,39 @@ var AnimusWebpackPlugin = class {
66
164
  if (!Array.isArray(loaders)) return false;
67
165
  return loaders.some((entry) => entry?.loader !== void 0 && this.animusLoaderPaths.has(entry.loader));
68
166
  }
69
- appendEpochWatchIgnore(compiler) {
70
- const options = compiler.options;
71
- if (!options) return;
72
- const epochPath = replacementEpochPath(sessionArtifactDir(this.session.rootDir ?? compiler.context, this.session.sessionId));
73
- options.watchOptions ??= {};
74
- const watchOptions = options.watchOptions;
75
- const ignored = watchOptions.ignored;
76
- if (ignored === void 0 || ignored === null) watchOptions.ignored = [epochPath];
77
- else if (Array.isArray(ignored)) {
78
- if (!ignored.includes(epochPath)) ignored.push(epochPath);
79
- } else if (isWatchIgnoreString(ignored)) watchOptions.ignored = [ignored, epochPath];
80
- else if (ignored instanceof RegExp) watchOptions.ignored = (path) => path === epochPath || ignored.test(path);
81
- else if (isWatchIgnoreMatcher(ignored)) watchOptions.ignored = (path) => path === epochPath || Boolean(ignored(path));
167
+ /** The webpack config whose watch options the host's watcher reads,
168
+ * rewritten when the plugin is applied. */
169
+ watchConfig(config) {
170
+ this.watchedConfig = config;
171
+ }
172
+ /** Makes `watchIgnored` watch the paths `watches` names too: one matcher
173
+ * owns the host's watch options. */
174
+ watchAlso(watches) {
175
+ this.alsoWatched.push(watches);
176
+ }
177
+ /**
178
+ * `watchOptions.ignored` for the host's own `ignored`: this session's epoch
179
+ * file stays ignored, and every file and directory the Session's watch plan
180
+ * registers is watched, whatever the host ignores. Next ignores every
181
+ * `node_modules` path, where an installed source kit and its system live.
182
+ */
183
+ watchIgnored(ignored, context) {
184
+ const hostIgnores = ignoredMatcher(ignored);
185
+ let epochRoot;
186
+ let epochPath;
187
+ const epoch = () => {
188
+ const root = this.session.rootDir ?? context;
189
+ if (root !== epochRoot) {
190
+ epochRoot = root;
191
+ epochPath = root === void 0 ? void 0 : replacementEpochPath(sessionArtifactDir(root, this.session.sessionId));
192
+ }
193
+ return epochPath;
194
+ };
195
+ return (path) => {
196
+ if (path === epoch()) return true;
197
+ if (this.registered.files.has(path) || this.registered.directories(path)) return false;
198
+ return hostIgnores(path) && !this.alsoWatched.some((watches) => watches(path));
199
+ };
82
200
  }
83
201
  /** Webpack's export conditions select the system's kit files as they
84
202
  * select the bundle's; `...`, webpack's own defaults, names none. Its
@@ -126,7 +244,15 @@ var AnimusWebpackPlugin = class {
126
244
  if (compiler.options?.name === "edge-server") return;
127
245
  const NormalModule = compiler.webpack?.NormalModule;
128
246
  if (NormalModule?.getCompilationHooks === void 0) throw new Error(UNSUPPORTED_WEBPACK_MESSAGE);
129
- this.appendEpochWatchIgnore(compiler);
247
+ const options = compiler.options;
248
+ if (options) {
249
+ options.watchOptions ??= {};
250
+ options.watchOptions.ignored = this.watchIgnored(options.watchOptions.ignored, compiler.context);
251
+ }
252
+ if (this.watchedConfig) this.watchedConfig.watchOptions = {
253
+ ...this.watchedConfig.watchOptions,
254
+ ignored: this.watchIgnored(this.watchedConfig.watchOptions?.ignored, compiler.context)
255
+ };
130
256
  compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
131
257
  const epochMoved = this.epochMovedForNextCompilation;
132
258
  this.epochMovedForNextCompilation = false;
@@ -144,6 +270,10 @@ var AnimusWebpackPlugin = class {
144
270
  compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
145
271
  const registerSystemDependencies = () => {
146
272
  const plan = this.session.watchPlan();
273
+ this.registered = {
274
+ files: /* @__PURE__ */ new Set([...plan.files, ...plan.missing]),
275
+ directories: withinDirectories(plan.directories)
276
+ };
147
277
  for (const path of plan.files) if (existsSync(path)) compilation.fileDependencies.add(path);
148
278
  else compilation.missingDependencies.add(path);
149
279
  for (const path of plan.missing) compilation.missingDependencies.add(path);
@@ -173,13 +303,13 @@ var AnimusWebpackPlugin = class {
173
303
  this.extractAliases(_compiler);
174
304
  this.extractConditions(_compiler);
175
305
  if (await this.rejoin()) {
176
- this.session.agreeWithSystemAuthority();
306
+ await this.session.agreeWithSystemAuthority();
177
307
  return;
178
308
  }
179
309
  const existing = getAnalysisStartedPromise(this.session.key);
180
310
  if (existing) {
181
311
  await existing;
182
- this.session.agreeWithSystemAuthority();
312
+ await this.session.agreeWithSystemAuthority();
183
313
  return;
184
314
  }
185
315
  const promise = this.session.runFullPipeline();
@@ -211,7 +341,7 @@ var AnimusWebpackPlugin = class {
211
341
  }
212
342
  async analyzeWatchTurn(compiler) {
213
343
  if (!this.initialized && await this.rejoin()) {
214
- this.session.agreeWithSystemAuthority();
344
+ await this.session.agreeWithSystemAuthority();
215
345
  this.initialized = true;
216
346
  this.lastBuiltEpoch = getReplacementEpoch(this.session.key);
217
347
  this.epochMovedForNextCompilation = true;
@@ -229,7 +359,7 @@ var AnimusWebpackPlugin = class {
229
359
  if (getAnalysisStartedPromise(this.session.key) === startup) resetAnalysisStartedPromise(this.session.key);
230
360
  throw err;
231
361
  }
232
- this.session.agreeWithSystemAuthority();
362
+ await this.session.agreeWithSystemAuthority();
233
363
  this.initialized = true;
234
364
  this.lastBuiltEpoch = getReplacementEpoch(this.session.key);
235
365
  this.epochMovedForNextCompilation = this.watchFailure !== null;
@@ -239,7 +369,7 @@ var AnimusWebpackPlugin = class {
239
369
  modifiedFiles: compiler.modifiedFiles,
240
370
  removedFiles: compiler.removedFiles
241
371
  });
242
- this.session.agreeWithSystemAuthority();
372
+ await this.session.agreeWithSystemAuthority();
243
373
  const epoch = getReplacementEpoch(this.session.key);
244
374
  this.epochMovedForNextCompilation = this.lastBuiltEpoch !== null && epoch !== null && epoch !== this.lastBuiltEpoch;
245
375
  if (epoch !== null) this.lastBuiltEpoch = epoch;
@@ -295,6 +425,29 @@ var AnimusWebpackPlugin = class {
295
425
  }
296
426
  };
297
427
  //#endregion
428
+ //#region src/quarantine.ts
429
+ /**
430
+ * layergate's webpack plugin for the `quarantine` option, loaded on first
431
+ * use: layergate is an optional peer. Only the client compiler builds
432
+ * stylesheets, so only it gets one.
433
+ */
434
+ /** The error Turbopack meets: it runs no loader on a stylesheet's
435
+ * imports, so layergate cannot load a graph there. */
436
+ const QUARANTINE_TURBOPACK_MESSAGE = "[animus-extract] the `quarantine` option needs webpack: Turbopack runs no loader on the stylesheets a stylesheet imports, so it cannot keep them in `anm-vendor`. Run `next build --webpack` and `next dev --webpack`, or remove `quarantine` [layergate.turbopack]";
437
+ function quarantinePlugin(options, order, declaredBy) {
438
+ let layergate;
439
+ try {
440
+ layergate = createRequire(import.meta.url)("@animus-ui/layergate/webpack");
441
+ } catch (cause) {
442
+ throw layergateMissing("@animus-ui/next-plugin", cause);
443
+ }
444
+ return new layergate.LayergatePlugin({
445
+ ...layergateOptions(options, order),
446
+ declaredBy,
447
+ watchIgnored: false
448
+ });
449
+ }
450
+ //#endregion
298
451
  //#region src/with-animus.ts
299
452
  const __filename = fileURLToPath(import.meta.url);
300
453
  const __dirname = dirname(__filename);
@@ -312,7 +465,8 @@ function withAnimus(options) {
312
465
  "turbopack",
313
466
  "unstable_turbopack",
314
467
  "loaderPath",
315
- "phase"
468
+ "phase",
469
+ "quarantine"
316
470
  ], [], {
317
471
  onUnknownKey: "warn",
318
472
  warn: (message) => console.warn(`[animus-extract] ${message}`)
@@ -324,8 +478,10 @@ function withAnimus(options) {
324
478
  const build = createBuildId();
325
479
  const appRoot = options.root === void 0 ? process.cwd() : resolve(options.root);
326
480
  return (authoredConfig) => {
327
- const nextConfig = withSourceKits(authoredConfig, appRoot);
328
- if (resolveTurbopackMode(options)) {
481
+ const nextConfig = withTranspiled(authoredConfig, transpiledPackages(appRoot));
482
+ const turbopack = resolveTurbopackMode(options);
483
+ if (options.quarantine && (turbopack || "TURBOPACK" in process.env)) throw new AnimusConfigError(QUARANTINE_TURBOPACK_MESSAGE);
484
+ if (turbopack) {
329
485
  warnTurbopackCwdRoot(options, appRoot);
330
486
  return turbopackConfig(nextConfig, options, build, appRoot);
331
487
  }
@@ -337,8 +493,11 @@ function withAnimus(options) {
337
493
  if (context.dir?.length && !sameDirectory(context.dir, appRoot)) throw new AnimusConfigError(`[animus-extract] Next builds ${context.dir}, but Animus read the app's source kits from ${appRoot}. Run next from the app directory, or pass withAnimus({ root }) naming it.`);
338
494
  const rootDir = appRoot;
339
495
  const { mode } = resolveMode(options.mode, () => context.dev === true ? "development" : "production");
496
+ const vendorOrder = options.quarantine ? withVendorLayer(options.layers) : void 0;
497
+ const layers = vendorOrder ?? options.layers;
340
498
  const plugin = new AnimusWebpackPlugin({
341
499
  ...options,
500
+ layers,
342
501
  mode
343
502
  }, {
344
503
  development: context.dev === true,
@@ -351,13 +510,15 @@ function withAnimus(options) {
351
510
  const stubCssPath = stylesPath(sessionDir);
352
511
  if (!existsSync(stubCssPath)) {
353
512
  const { declaration } = assembleStylesheet({
354
- layers: options.layers,
513
+ layers,
355
514
  variableCss: "",
356
515
  globalCss: "",
357
516
  split: true
358
517
  });
359
518
  writeFileSync(stubCssPath, declaration);
360
519
  }
520
+ const sessionFontPreloadsPath = fontPreloadsPath(sessionDir);
521
+ if (!existsSync(sessionFontPreloadsPath)) writeFileSync(sessionFontPreloadsPath, fontPreloadsModule([]));
361
522
  if (!warnedGitignore) {
362
523
  warnedGitignore = true;
363
524
  try {
@@ -370,6 +531,12 @@ function withAnimus(options) {
370
531
  const isExternalPackageFile = (filePath) => plugin.getExternalPackageDirs().some((dir) => isPathWithinRoot(dir, filePath));
371
532
  config.plugins = config.plugins || [];
372
533
  config.plugins.push(plugin);
534
+ plugin.watchConfig(config);
535
+ if (options.quarantine && vendorOrder && context.isServer !== true) {
536
+ const gate = quarantinePlugin(options.quarantine, vendorOrder, stubCssPath);
537
+ config.plugins.push(gate);
538
+ plugin.watchAlso((path) => gate.watches(path));
539
+ }
373
540
  const DefinePlugin = context.webpack?.DefinePlugin;
374
541
  if (DefinePlugin) config.plugins.push(new DefinePlugin({ __ANIMUS_DEV__: JSON.stringify(mode === "development") }));
375
542
  config.resolve = config.resolve || {};
@@ -381,6 +548,7 @@ function withAnimus(options) {
381
548
  compiler.hooks.normalModuleFactory.tap("AnimusVirtualResolve", (nmf) => {
382
549
  nmf.hooks.beforeResolve.tap("AnimusVirtualResolve", (resolveData) => {
383
550
  if (resolveData.request === "virtual:animus/system-props") resolveData.request = sessionSystemPropsPath;
551
+ if (resolveData.request === FONT_PRELOADS_MODULE_ID) resolveData.request = sessionFontPreloadsPath;
384
552
  if (resolveData.request === "virtual:animus/styles.css" || resolveData.request === ANIMUS_CSS_MODULE_ID$1) resolveData.request = stylesPath(sessionDir);
385
553
  const srcEntry = plugin.getExternalSourceEntries().get(resolveData.request);
386
554
  if (srcEntry) {
@@ -437,11 +605,7 @@ function bindTurbopackWatchDeathReport(outcome, rootDir) {
437
605
  console.error(`[animus-extract] dev watcher for ${rootDir} died — source edits are no longer extracted; restart the dev server`);
438
606
  };
439
607
  }
440
- /** The config with the source kits the app depends on added to
441
- * `transpilePackages`. The kit redirect points both bundles at a kit's
442
- * source, but Next's server keeps an installed package external, and so
443
- * loads its runtime entry, unless the package is transpiled; transpiling
444
- * also compiles its TypeScript source. */
608
+ const NEXT_PLUGIN_PACKAGE = "@animus-ui/next-plugin";
445
609
  let warnedTurbopackCwd = false;
446
610
  /** Turbopack's loaders get no app dir either, so a cwd that is not the app
447
611
  * cannot be detected later: warn at startup when the cwd holds no Next
@@ -458,15 +622,25 @@ function warnTurbopackCwdRoot(options, appRoot) {
458
622
  warnedTurbopackCwd = true;
459
623
  console.warn(`[animus-extract] the current directory (${appRoot}) holds no next.config: under Turbopack, Animus reads the app from the current directory. Run next from the app directory, or pass withAnimus({ root }) naming it.`);
460
624
  }
461
- function withSourceKits(nextConfig, rootDir) {
625
+ /** The config with `packages` added to `transpilePackages`. Next's server
626
+ * keeps an installed package external, and so loads its runtime entry,
627
+ * unless the package is transpiled. */
628
+ function withTranspiled(nextConfig, packages) {
462
629
  const declared = nextConfig.transpilePackages ?? [];
463
- const kits = sourceKitDependencies(rootDir, requireEngine()).map((kit) => kit.name).filter((name) => !declared.includes(name));
464
- if (kits.length === 0) return nextConfig;
630
+ const added = packages.filter((name) => !declared.includes(name));
631
+ if (added.length === 0) return nextConfig;
465
632
  return {
466
633
  ...nextConfig,
467
- transpilePackages: [...declared, ...kits]
634
+ transpilePackages: [...declared, ...added]
468
635
  };
469
636
  }
637
+ /** The packages Next must transpile: the source kits the app depends on,
638
+ * since the kit redirect points both bundles at a kit's TypeScript source,
639
+ * and this package, whose font-preloads entry imports the session module
640
+ * only the bundle's alias resolves. */
641
+ function transpiledPackages(rootDir) {
642
+ return [...sourceKitDependencies(rootDir, requireEngine()).map((kit) => kit.name), NEXT_PLUGIN_PACKAGE];
643
+ }
470
644
  function turbopackConfig(nextConfig, options, build, appRoot) {
471
645
  const resolveExtensions = nextConfig.turbopack?.resolveExtensions ?? nextConfig.experimental?.turbo?.resolveExtensions;
472
646
  const outputExclude = nextConfig.distDir ? outputExclusion(appRoot, resolve(appRoot, nextConfig.distDir)) : null;
@@ -524,6 +698,7 @@ async function analyzeForTurbopack(options, phase, rootDir, resolveExtensions, o
524
698
  unbundledComputedImports: true,
525
699
  build: `${build}-${phase}`
526
700
  });
701
+ session.writesFontPreloadsModule = true;
527
702
  const owner = turbopackOwner(build);
528
703
  owner.session?.close();
529
704
  owner.watcher?.close();
package/dist/plugin.d.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import type { AnimusNextOptions } from './types';
2
+ import type { WatchIgnored, WatchIgnoreMatcher, WatchOptions } from './watch-ignored';
2
3
  export { ANIMUS_CSS_MODULE_ID } from '@animus-ui/extract/session';
3
4
  type WebpackSource = {
4
5
  source(): string | Buffer;
5
6
  size(): number;
6
7
  };
7
- type WatchIgnoreEntry = string | RegExp;
8
- type WatchIgnoreMatcher = (path: string) => boolean;
9
- type WatchIgnored = WatchIgnoreEntry | WatchIgnoreEntry[] | WatchIgnoreMatcher | null | undefined;
10
8
  type WebpackAliasMap = Record<string, string | string[] | false>;
11
9
  type Compilation = {
12
10
  hooks: {
@@ -95,9 +93,7 @@ type Compiler = {
95
93
  extensionAlias?: Record<string, string | string[]>;
96
94
  } | undefined>;
97
95
  };
98
- watchOptions?: {
99
- ignored?: WatchIgnored;
100
- };
96
+ watchOptions?: WatchOptions;
101
97
  };
102
98
  webpack?: {
103
99
  version?: string;
@@ -128,6 +124,13 @@ export declare class AnimusWebpackPlugin {
128
124
  /** This turn's rejected analysis. A rejection must fail the compilation,
129
125
  * never `watchRun`: webpack stops watching after a failed `watchRun`. */
130
126
  private watchFailure;
127
+ /** What the Session's watch plan last registered: `watchIgnored` never
128
+ * ignores it. */
129
+ private registered;
130
+ /** Other files the watcher must see, by the plugins that read them. */
131
+ private readonly alsoWatched;
132
+ /** The webpack config Next hands its watcher, when withAnimus made it. */
133
+ private watchedConfig;
131
134
  /** `development` is `next dev`: an error-level diagnostic reports and the
132
135
  * compilation keeps publishing, whatever the emission mode. */
133
136
  constructor(options: AnimusNextOptions, { development, build, }?: {
@@ -135,7 +138,21 @@ export declare class AnimusWebpackPlugin {
135
138
  build?: string;
136
139
  });
137
140
  private moduleUsesAnimusLoader;
138
- private appendEpochWatchIgnore;
141
+ /** The webpack config whose watch options the host's watcher reads,
142
+ * rewritten when the plugin is applied. */
143
+ watchConfig(config: {
144
+ watchOptions?: WatchOptions;
145
+ }): void;
146
+ /** Makes `watchIgnored` watch the paths `watches` names too: one matcher
147
+ * owns the host's watch options. */
148
+ watchAlso(watches: (path: string) => boolean): void;
149
+ /**
150
+ * `watchOptions.ignored` for the host's own `ignored`: this session's epoch
151
+ * file stays ignored, and every file and directory the Session's watch plan
152
+ * registers is watched, whatever the host ignores. Next ignores every
153
+ * `node_modules` path, where an installed source kit and its system live.
154
+ */
155
+ watchIgnored(ignored: WatchIgnored, context?: string): WatchIgnoreMatcher;
139
156
  /** Webpack's export conditions select the system's kit files as they
140
157
  * select the bundle's; `...`, webpack's own defaults, names none. Its
141
158
  * extension order and aliases are captured alongside. */
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AA8BA,OAAO,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AAI,CAElD;IAED;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,kBAAkB,CA8BxE;IAED;;8DAE0D;IAC1D,OAAO,CAAC,iBAAiB;IAmCzB,OAAO,CAAC,cAAc;IAyBtB,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAgJ9B;IAED;+BAC2B;IAC3B;gEAC4D;YAC9C,MAAM;YAQN,gBAAgB;IAoD9B,WAAW,IAAI,IAAI,CAElB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhC;IAED;sDACkD;IAClD,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAGrC;IAED;;;yEAGqE;IACrE,OAAO,CAAC,oBAAoB;IAkB5B,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,UAAU,IAAI,iBAAiB,CAE9B;IAED,sBAAsB,IAAI,MAAM,EAAE,CAIjC;IAED;yDACqD;IACrD,oBAAoB,CAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,IAAI,CAEN;IAED,wBAAwB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAI9C;IAED;gCAC4B;IAC5B,4BAA4B,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAInD;CACF"}
@@ -0,0 +1,7 @@
1
+ import type { AnimusQuarantineOptions } from '@animus-ui/extract/pipeline';
2
+ import type { LayergatePlugin } from '@animus-ui/layergate/webpack';
3
+ /** The error Turbopack meets: it runs no loader on a stylesheet's
4
+ * imports, so layergate cannot load a graph there. */
5
+ export declare const QUARANTINE_TURBOPACK_MESSAGE: string;
6
+ export declare function quarantinePlugin(options: AnimusQuarantineOptions, order: readonly string[], declaredBy: string): LayergatePlugin;
7
+ //# sourceMappingURL=quarantine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quarantine.d.ts","sourceRoot":"","sources":["../src/quarantine.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;uDACuD;AACvD,eAAO,MAAM,4BAA4B,QAIO,CAAC;AAEjD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,UAAU,EAAE,MAAM,GACjB,eAAe,CAcjB"}
@@ -0,0 +1,28 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ Object.defineProperty(exports, "__toESM", {
24
+ enumerable: true,
25
+ get: function() {
26
+ return __toESM;
27
+ }
28
+ });
@@ -1,5 +1,5 @@
1
1
  import { ENGINE_TRANSFORM_EXTENSIONS, fileSideEffects, findPackageRoot, kitSourceModuleSideEffects } from "@animus-ui/extract/pipeline";
2
- import { ANIMUS_CSS_MODULE_ID, STYLES_ARTIFACT, SYSTEM_PROPS_ARTIFACT, TURBOPACK_SYSTEM_PROPS_ID as TURBOPACK_SYSTEM_PROPS_ID$1 } from "@animus-ui/extract/session";
2
+ import { ANIMUS_CSS_MODULE_ID, FONT_PRELOADS_ARTIFACT, FONT_PRELOADS_MODULE_ID, STYLES_ARTIFACT, SYSTEM_PROPS_ARTIFACT, TURBOPACK_SYSTEM_PROPS_ID as TURBOPACK_SYSTEM_PROPS_ID$1 } from "@animus-ui/extract/session";
3
3
  import { existsSync } from "fs";
4
4
  import { dirname, join, relative, resolve } from "path";
5
5
  import { fileURLToPath } from "url";
@@ -48,7 +48,8 @@ function buildTurbopackConfig(args) {
48
48
  if (options.cssImportTarget !== void 0) loaderOptions.cssImportTarget = options.cssImportTarget;
49
49
  const resolveAlias = {
50
50
  [TURBOPACK_SYSTEM_PROPS_ID$1]: rootRelativeRequest(rootDir, join(sessionDir, SYSTEM_PROPS_ARTIFACT)),
51
- [ANIMUS_CSS_MODULE_ID]: rootRelativeRequest(rootDir, join(sessionDir, STYLES_ARTIFACT))
51
+ [ANIMUS_CSS_MODULE_ID]: rootRelativeRequest(rootDir, join(sessionDir, STYLES_ARTIFACT)),
52
+ [FONT_PRELOADS_MODULE_ID]: rootRelativeRequest(rootDir, join(sessionDir, FONT_PRELOADS_ARTIFACT))
52
53
  };
53
54
  for (const [specifier, srcEntry] of externalSourceEntries) resolveAlias[specifier] = rootRelativeRequest(rootDir, srcEntry);
54
55
  return {
@@ -47,7 +47,8 @@ function buildTurbopackConfig(args) {
47
47
  if (options.cssImportTarget !== void 0) loaderOptions.cssImportTarget = options.cssImportTarget;
48
48
  const resolveAlias = {
49
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))
50
+ [_animus_ui_extract_session.ANIMUS_CSS_MODULE_ID]: rootRelativeRequest(rootDir, (0, path.join)(sessionDir, _animus_ui_extract_session.STYLES_ARTIFACT)),
51
+ [_animus_ui_extract_session.FONT_PRELOADS_MODULE_ID]: rootRelativeRequest(rootDir, (0, path.join)(sessionDir, _animus_ui_extract_session.FONT_PRELOADS_ARTIFACT))
51
52
  };
52
53
  for (const [specifier, srcEntry] of externalSourceEntries) resolveAlias[specifier] = rootRelativeRequest(rootDir, srcEntry);
53
54
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"turbopack-config.d.ts","sourceRoot":"","sources":["../src/turbopack-config.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AAKpC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;wEACwE;AAExE,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;AAElD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,sBAAsB,CAAA;KAAE,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED;;;0DAG0D;AAC1D,eAAO,MAAM,0BAA0B,QAAiD,CAAC;AAEzF,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,iBAAiB,EAC1B,GAAG,GAAE,MAA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ACrE;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED;;;0DAG0D;AAC1D,eAAO,MAAM,0BAA0B,QAAiD,CAAC;AAEzF,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,iBAAiB,EAC1B,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,OAAO,CAMT;AAED;0CAC0C;AAC1C,wBAAgB,sBAAsB,CACpC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,OAAO,CAET;AAMD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,qBAAqB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB,GAAG,uBAAuB,CA+C1B;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,qBAAqB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAClD,yBAAyB,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GACtD,MAAM,EAAE,CA0BV;AAED,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMpE"}
@@ -2,34 +2,13 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- //#region \0rolldown/runtime.js
6
- var __create = Object.create;
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
- var __getOwnPropNames = Object.getOwnPropertyNames;
10
- var __getProtoOf = Object.getPrototypeOf;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
- key = keys[i];
15
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: ((k) => from[k]).bind(null, key),
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
- //#endregion
27
- const require_turbopack_config = require("./turbopack-config-BoNfzhNu.cjs");
5
+ const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
6
+ const require_turbopack_config = require("./turbopack-config-W5eoa_xN.cjs");
28
7
  const require_loader_core = require("./loader-core-Bz52QNm3.cjs");
29
8
  let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
30
9
  let _animus_ui_extract_session = require("@animus-ui/extract/session");
31
10
  let fs = require("fs");
32
- fs = __toESM(fs);
11
+ fs = require_rolldown_runtime.__toESM(fs);
33
12
  let path = require("path");
34
13
  //#region src/turbopack-loader.ts
35
14
  /** Each build's last hydration in this worker, so a worker serving two
@@ -1,4 +1,4 @@
1
- import { r as isTurbopackDevelopment } from "./turbopack-config-3jtLDAIM.mjs";
1
+ import { r as isTurbopackDevelopment } from "./turbopack-config-BOUPGkmi.mjs";
2
2
  import { n as extensionLineage, r as transformWithManifest, t as extendedFiles } from "./loader-core-DU2uZEMQ.mjs";
3
3
  import { AnimusConfigError, assertSupportedEngine, buildAnalyzeProjectArgs, contentHash, parseFilesJson } from "@animus-ui/extract/pipeline";
4
4
  import { analysisCommitPath, analysisInputsPath, analysisStatusPath, engineHandle, manifestPath, readJsonEnvelope, replacementEpochPath, sessionArtifactDir, sessionKey } from "@animus-ui/extract/session";