@animus-ui/next-plugin 0.1.9 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/index.cjs +88 -1742
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.mjs +78 -1731
  5. package/dist/loader-core-BthLSJQF.cjs +47 -0
  6. package/dist/loader-core-x6cOzF9v.mjs +42 -0
  7. package/dist/loader-core.d.ts +6 -13
  8. package/dist/loader-core.d.ts.map +1 -1
  9. package/dist/loader-path.d.ts +0 -13
  10. package/dist/loader-path.d.ts.map +1 -1
  11. package/dist/loader.cjs +10 -34
  12. package/dist/loader.d.ts +2 -24
  13. package/dist/loader.d.ts.map +1 -1
  14. package/dist/loader.mjs +3 -26
  15. package/dist/plugin.d.ts +18 -70
  16. package/dist/plugin.d.ts.map +1 -1
  17. package/dist/turbopack-config.d.ts +11 -38
  18. package/dist/turbopack-config.d.ts.map +1 -1
  19. package/dist/turbopack-loader.cjs +44 -64
  20. package/dist/turbopack-loader.d.ts +12 -24
  21. package/dist/turbopack-loader.d.ts.map +1 -1
  22. package/dist/turbopack-loader.mjs +40 -56
  23. package/dist/types.d.ts +25 -79
  24. package/dist/types.d.ts.map +1 -1
  25. package/dist/with-animus.d.ts +39 -24
  26. package/dist/with-animus.d.ts.map +1 -1
  27. package/package.json +8 -2
  28. package/dist/extraction-session.d.ts +0 -378
  29. package/dist/extraction-session.d.ts.map +0 -1
  30. package/dist/loader-core-C40WbC6s.cjs +0 -71
  31. package/dist/loader-core-D6Tm_b8F.mjs +0 -66
  32. package/dist/resolve-packages.d.ts +0 -8
  33. package/dist/resolve-packages.d.ts.map +0 -1
  34. package/dist/session-paths-CZoi19NW.cjs +0 -229
  35. package/dist/session-paths-DfYIPDcM.mjs +0 -107
  36. package/dist/session-paths.d.ts +0 -107
  37. package/dist/session-paths.d.ts.map +0 -1
  38. package/dist/singleton-BjSsGjsg.mjs +0 -217
  39. package/dist/singleton-BjZyw_8b.cjs +0 -366
  40. package/dist/singleton.d.ts +0 -96
  41. package/dist/singleton.d.ts.map +0 -1
  42. package/dist/timing.d.ts +0 -7
  43. package/dist/timing.d.ts.map +0 -1
  44. package/dist/turbopack-orchestrator.d.ts +0 -34
  45. package/dist/turbopack-orchestrator.d.ts.map +0 -1
@@ -0,0 +1,47 @@
1
+ let _animus_ui_extract_session = require("@animus-ui/extract/session");
2
+ //#region src/loader-core.ts
3
+ /** Matches every already-emitted stylesheet import — arbitrary relative
4
+ * prefixes and the Vite emitter's virtual id — not this bundler's id.
5
+ * Never derive it from the shared module-id constant: this reads foreign
6
+ * output, and deriving it silently stops matching the other forms. */
7
+ const CSS_IMPORT_RE = /import\s+['"](?:[^'"]*\.animus\/styles\.css|virtual:animus\/styles\.css)['"];\n?/g;
8
+ const CSS_IMPORT_STATEMENT = `import '${_animus_ui_extract_session.ANIMUS_CSS_MODULE_ID}';\n`;
9
+ const ROOT_ENTRY_RE = /^(src\/)?(?:app\/layout|pages\/_app)\.[tj]sx?$/;
10
+ function normalizePath(p) {
11
+ return p.replace(/\\/g, "/").replace(/^\.\//, "");
12
+ }
13
+ function isCssImportTarget(filename, cssImportTarget) {
14
+ const normalized = normalizePath(filename);
15
+ if (cssImportTarget) return normalized === normalizePath(cssImportTarget);
16
+ return ROOT_ENTRY_RE.test(normalized);
17
+ }
18
+ function transformWithManifest(args) {
19
+ const { source, filename, manifestJson, engineApi, opts } = args;
20
+ const isRootEntry = isCssImportTarget(filename, opts.cssImportTarget);
21
+ try {
22
+ const { transformFile } = engineApi();
23
+ const result = transformFile(source, filename, manifestJson);
24
+ let code = result.hasComponents ? result.code : source;
25
+ code = code.replace(CSS_IMPORT_RE, "");
26
+ if (isRootEntry && !code.includes(_animus_ui_extract_session.ANIMUS_CSS_MODULE_ID)) {
27
+ if (code.startsWith("'use client'") || code.startsWith("\"use client\"")) {
28
+ const nl = code.indexOf("\n");
29
+ if (nl === -1) code = `${code}\n${CSS_IMPORT_STATEMENT}`;
30
+ else code = `${code.slice(0, nl + 1)}${CSS_IMPORT_STATEMENT}${code.slice(nl + 1)}`;
31
+ } else code = `${CSS_IMPORT_STATEMENT}${code}`;
32
+ }
33
+ return code;
34
+ } catch (e) {
35
+ const msg = e instanceof Error ? e.message : String(e);
36
+ if (opts.strict) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}`, { cause: e });
37
+ console.warn(`[animus-extract] Transform failed for ${filename}:`, msg);
38
+ return source;
39
+ }
40
+ }
41
+ //#endregion
42
+ Object.defineProperty(exports, "transformWithManifest", {
43
+ enumerable: true,
44
+ get: function() {
45
+ return transformWithManifest;
46
+ }
47
+ });
@@ -0,0 +1,42 @@
1
+ import { ANIMUS_CSS_MODULE_ID } from "@animus-ui/extract/session";
2
+ //#region src/loader-core.ts
3
+ /** Matches every already-emitted stylesheet import — arbitrary relative
4
+ * prefixes and the Vite emitter's virtual id — not this bundler's id.
5
+ * Never derive it from the shared module-id constant: this reads foreign
6
+ * output, and deriving it silently stops matching the other forms. */
7
+ const CSS_IMPORT_RE = /import\s+['"](?:[^'"]*\.animus\/styles\.css|virtual:animus\/styles\.css)['"];\n?/g;
8
+ const CSS_IMPORT_STATEMENT = `import '${ANIMUS_CSS_MODULE_ID}';\n`;
9
+ const ROOT_ENTRY_RE = /^(src\/)?(?:app\/layout|pages\/_app)\.[tj]sx?$/;
10
+ function normalizePath(p) {
11
+ return p.replace(/\\/g, "/").replace(/^\.\//, "");
12
+ }
13
+ function isCssImportTarget(filename, cssImportTarget) {
14
+ const normalized = normalizePath(filename);
15
+ if (cssImportTarget) return normalized === normalizePath(cssImportTarget);
16
+ return ROOT_ENTRY_RE.test(normalized);
17
+ }
18
+ function transformWithManifest(args) {
19
+ const { source, filename, manifestJson, engineApi, opts } = args;
20
+ const isRootEntry = isCssImportTarget(filename, opts.cssImportTarget);
21
+ try {
22
+ const { transformFile } = engineApi();
23
+ const result = transformFile(source, filename, manifestJson);
24
+ let code = result.hasComponents ? result.code : source;
25
+ code = code.replace(CSS_IMPORT_RE, "");
26
+ if (isRootEntry && !code.includes(ANIMUS_CSS_MODULE_ID)) {
27
+ if (code.startsWith("'use client'") || code.startsWith("\"use client\"")) {
28
+ const nl = code.indexOf("\n");
29
+ if (nl === -1) code = `${code}\n${CSS_IMPORT_STATEMENT}`;
30
+ else code = `${code.slice(0, nl + 1)}${CSS_IMPORT_STATEMENT}${code.slice(nl + 1)}`;
31
+ } else code = `${CSS_IMPORT_STATEMENT}${code}`;
32
+ }
33
+ return code;
34
+ } catch (e) {
35
+ const msg = e instanceof Error ? e.message : String(e);
36
+ if (opts.strict) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}`, { cause: e });
37
+ console.warn(`[animus-extract] Transform failed for ${filename}:`, msg);
38
+ return source;
39
+ }
40
+ }
41
+ //#endregion
42
+ export { transformWithManifest as t };
@@ -1,20 +1,13 @@
1
- /**
2
- * Bundler-neutral loader policy shared by the webpack loader (manifest from
3
- * the process singleton) and the Turbopack loader (manifest hydrated from
4
- * disk artifacts). Owns the transform invocation, strict-mode error
5
- * handling, and the single-stylesheet-import policy.
6
- */
7
1
  export interface LoaderPolicyOptions {
8
2
  strict?: boolean;
9
3
  cssImportTarget?: string;
10
4
  }
11
- /**
12
- * Transform one source file against a manifest: replace builder chains via
13
- * the engine, strip emitter-injected stylesheet imports everywhere, and
14
- * re-inject a single import at the root entry (after any leading
15
- * `'use client'` directive). On failure: throw in strict mode, otherwise
16
- * warn and return the source unchanged.
17
- */
5
+ export interface LoaderContextBase<O extends LoaderPolicyOptions = LoaderPolicyOptions> {
6
+ resourcePath: string;
7
+ rootContext: string;
8
+ getOptions: () => O;
9
+ addDependency?: (file: string) => void;
10
+ }
18
11
  export declare function transformWithManifest(args: {
19
12
  source: string;
20
13
  /** 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":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AA+CD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IAErB,SAAS,EAAE,MAAM,GAAG,CAAC;IACrB,IAAI,EAAE,mBAAmB,CAAC;CAC3B,GAAG,MAAM,CA4CT"}
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,SAAS,mBAAmB,GAAG,mBAAmB;IAEnD,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AA4BD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IAErB,SAAS,EAAE,MAAM,GAAG,CAAC;IACrB,IAAI,EAAE,mBAAmB,CAAC;CAC3B,GAAG,MAAM,CAwCT"}
@@ -1,16 +1,3 @@
1
- /**
2
- * The one loader-path derivation: first existing dist candidate under the
3
- * plugin dir, else the in-repo source fallback. Both loader resolvers below
4
- * are thin wrappers, so rule registration and any loader-chain predicate
5
- * can never drift (openspec: next-webpack-served-transform-coherence,
6
- * design D1).
7
- */
8
1
  export declare function resolveLoaderPath(pluginDir: string, distCandidates: string[], sourceFallback: string): string;
9
- /**
10
- * This package's webpack loader path, shared by the rule registration
11
- * (with-animus) and the needBuild loader-chain predicate (plugin). Compiled
12
- * dist ships `loader.mjs` next to this module; running from source falls
13
- * back to the TypeScript loader.
14
- */
15
2
  export declare function resolveAnimusLoaderPath(): string;
16
3
  //# sourceMappingURL=loader-path.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader-path.d.ts","sourceRoot":"","sources":["../src/loader-path.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,GACrB,MAAM,CAMR;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD"}
1
+ {"version":3,"file":"loader-path.d.ts","sourceRoot":"","sources":["../src/loader-path.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,GACrB,MAAM,CAMR;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD"}
package/dist/loader.cjs CHANGED
@@ -1,62 +1,38 @@
1
- const require_session_paths = require("./session-paths-CZoi19NW.cjs");
2
- const require_singleton = require("./singleton-BjZyw_8b.cjs");
3
- const require_loader_core = require("./loader-core-C40WbC6s.cjs");
4
- require("./turbopack-loader.cjs");
1
+ const require_loader_core = require("./loader-core-BthLSJQF.cjs");
5
2
  let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
3
+ let _animus_ui_extract_session = require("@animus-ui/extract/session");
6
4
  let fs = require("fs");
7
5
  let path = require("path");
8
6
  //#region src/loader.ts
9
- /** Session dirs whose epoch artifact has been SEEN on disk. A sibling
10
- * session's reconciliation may delete the artifact, but the owning
11
- * session self-heals it on its next publish, so a positive existsSync
12
- * stays a sound basis for registering the dependency: a module built
13
- * during the missing window records a missing-file witness that the
14
- * recreation then invalidates (over-invalidation, never under).
15
- * Negatives always re-probe. */
16
7
  const epochSeenForSessionDir = /* @__PURE__ */ new Set();
17
- /**
18
- * Webpack loader for Animus source transformation.
19
- * Runs with enforce: 'pre' to see original source before Babel/SWC.
20
- * The manifest arrives via the process singleton (the webpack pipeline and
21
- * this loader share one process); the transform + CSS-import policy lives
22
- * in the shared loader-core.
23
- *
24
- * Coherence duties (openspec: next-webpack-served-transform-coherence):
25
- * every dev invocation registers the replacement-epoch artifact as a file
26
- * dependency (design D2 — restored persistent-cache modules snapshot it, so
27
- * offline epoch moves invalidate them), and an analyzed file whose current
28
- * source hash mismatches its analyzed hash fails with the stable diagnostic
29
- * `ANIMUS_ANALYSIS_CATCHING_UP` after one refreshed re-check (design D4 —
30
- * unconditional: a zero-entry stale manifest must never publish raw bytes).
31
- */
32
8
  function animusLoader(source) {
33
- if (this.mode !== "production" && typeof this.addDependency === "function") {
34
- const sessionDir = require_singleton.getSessionArtifactDir();
9
+ if (this.mode !== "production" && this.addDependency !== void 0) {
10
+ const sessionDir = (0, _animus_ui_extract_session.getSessionArtifactDir)();
35
11
  if (sessionDir) {
36
- const epochPath = require_session_paths.replacementEpochPath(sessionDir);
12
+ const epochPath = (0, _animus_ui_extract_session.replacementEpochPath)(sessionDir);
37
13
  if (epochSeenForSessionDir.has(sessionDir) || (0, fs.existsSync)(epochPath)) {
38
14
  epochSeenForSessionDir.add(sessionDir);
39
15
  this.addDependency(epochPath);
40
16
  }
41
17
  }
42
18
  }
43
- let manifestJson = require_singleton.getManifestJson();
19
+ let manifestJson = (0, _animus_ui_extract_session.getManifestJson)();
44
20
  if (!manifestJson) return source;
45
21
  const filename = (0, path.relative)(this.rootContext, this.resourcePath);
46
- const analyzedHash = require_singleton.getAnalyzedHashes()?.get(filename);
22
+ const analyzedHash = (0, _animus_ui_extract_session.getAnalyzedHashes)()?.get(filename);
47
23
  if (analyzedHash !== void 0) {
48
24
  const sourceHash = (0, _animus_ui_extract_pipeline.contentHash)(source);
49
25
  if (sourceHash !== analyzedHash) {
50
- const refreshedHash = require_singleton.getAnalyzedHashes()?.get(filename);
26
+ const refreshedHash = (0, _animus_ui_extract_session.getAnalyzedHashes)()?.get(filename);
51
27
  if (refreshedHash === void 0 || sourceHash !== refreshedHash) throw new Error(`ANIMUS_ANALYSIS_CATCHING_UP: ${filename} changed after the current analysis; retrying on the next watch turn`);
52
- manifestJson = require_singleton.getManifestJson() ?? manifestJson;
28
+ manifestJson = (0, _animus_ui_extract_session.getManifestJson)() ?? manifestJson;
53
29
  }
54
30
  }
55
31
  return require_loader_core.transformWithManifest({
56
32
  source,
57
33
  filename,
58
34
  manifestJson,
59
- engineApi: require_singleton.engineApi,
35
+ engineApi: _animus_ui_extract_session.engineApi,
60
36
  opts: this.getOptions?.() ?? {}
61
37
  });
62
38
  }
package/dist/loader.d.ts CHANGED
@@ -1,29 +1,7 @@
1
- import type { LoaderPolicyOptions } from './loader-core';
2
- type LoaderContext = {
3
- resourcePath: string;
4
- rootContext: string;
5
- getOptions: () => LoaderPolicyOptions;
6
- /** webpack file-dependency registration — optional so bare policy tests
7
- * can drive the loader without a full context. */
8
- addDependency?: (file: string) => void;
9
- /** webpack build mode; production invocations stay engine-verbatim. */
1
+ import type { LoaderContextBase } from './loader-core';
2
+ type LoaderContext = LoaderContextBase & {
10
3
  mode?: 'development' | 'production' | 'none';
11
4
  };
12
- /**
13
- * Webpack loader for Animus source transformation.
14
- * Runs with enforce: 'pre' to see original source before Babel/SWC.
15
- * The manifest arrives via the process singleton (the webpack pipeline and
16
- * this loader share one process); the transform + CSS-import policy lives
17
- * in the shared loader-core.
18
- *
19
- * Coherence duties (openspec: next-webpack-served-transform-coherence):
20
- * every dev invocation registers the replacement-epoch artifact as a file
21
- * dependency (design D2 — restored persistent-cache modules snapshot it, so
22
- * offline epoch moves invalidate them), and an analyzed file whose current
23
- * source hash mismatches its analyzed hash fails with the stable diagnostic
24
- * `ANIMUS_ANALYSIS_CATCHING_UP` after one refreshed re-check (design D4 —
25
- * unconditional: a zero-entry stale manifest must never publish raw bytes).
26
- */
27
5
  export default function animusLoader(this: LoaderContext, source: string): string;
28
6
  export {};
29
7
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAWzD,KAAK,aAAa,GAAG;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,mBAAmB,CAAC;IACtC;uDACmD;IACnD,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,uEAAuE;IACvE,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,GAAG,MAAM,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,GACb,MAAM,CAmDR"}
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"}
package/dist/loader.mjs CHANGED
@@ -1,35 +1,12 @@
1
- import { _ as replacementEpochPath } from "./session-paths-DfYIPDcM.mjs";
2
- import { a as getManifestJson, c as getSessionArtifactDir, i as getAnalyzedHashes, n as engineApi } from "./singleton-BjSsGjsg.mjs";
3
- import { t as transformWithManifest } from "./loader-core-D6Tm_b8F.mjs";
1
+ import { t as transformWithManifest } from "./loader-core-x6cOzF9v.mjs";
4
2
  import { contentHash } from "@animus-ui/extract/pipeline";
3
+ import { engineApi, getAnalyzedHashes, getManifestJson, getSessionArtifactDir, replacementEpochPath } from "@animus-ui/extract/session";
5
4
  import { existsSync } from "fs";
6
5
  import { relative } from "path";
7
6
  //#region src/loader.ts
8
- /** Session dirs whose epoch artifact has been SEEN on disk. A sibling
9
- * session's reconciliation may delete the artifact, but the owning
10
- * session self-heals it on its next publish, so a positive existsSync
11
- * stays a sound basis for registering the dependency: a module built
12
- * during the missing window records a missing-file witness that the
13
- * recreation then invalidates (over-invalidation, never under).
14
- * Negatives always re-probe. */
15
7
  const epochSeenForSessionDir = /* @__PURE__ */ new Set();
16
- /**
17
- * Webpack loader for Animus source transformation.
18
- * Runs with enforce: 'pre' to see original source before Babel/SWC.
19
- * The manifest arrives via the process singleton (the webpack pipeline and
20
- * this loader share one process); the transform + CSS-import policy lives
21
- * in the shared loader-core.
22
- *
23
- * Coherence duties (openspec: next-webpack-served-transform-coherence):
24
- * every dev invocation registers the replacement-epoch artifact as a file
25
- * dependency (design D2 — restored persistent-cache modules snapshot it, so
26
- * offline epoch moves invalidate them), and an analyzed file whose current
27
- * source hash mismatches its analyzed hash fails with the stable diagnostic
28
- * `ANIMUS_ANALYSIS_CATCHING_UP` after one refreshed re-check (design D4 —
29
- * unconditional: a zero-entry stale manifest must never publish raw bytes).
30
- */
31
8
  function animusLoader(source) {
32
- if (this.mode !== "production" && typeof this.addDependency === "function") {
9
+ if (this.mode !== "production" && this.addDependency !== void 0) {
33
10
  const sessionDir = getSessionArtifactDir();
34
11
  if (sessionDir) {
35
12
  const epochPath = replacementEpochPath(sessionDir);
package/dist/plugin.d.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  import type { AnimusNextOptions } from './types';
2
- export { ANIMUS_CSS_MODULE_ID } from './extraction-session';
2
+ export { ANIMUS_CSS_MODULE_ID } from '@animus-ui/extract/session';
3
3
  type WebpackSource = {
4
4
  source(): string | Buffer;
5
5
  size(): number;
6
6
  };
7
+ type WatchIgnoreEntry = string | RegExp;
8
+ type WatchIgnoreMatcher = (path: string) => boolean;
9
+ type WatchIgnored = WatchIgnoreEntry | WatchIgnoreEntry[] | WatchIgnoreMatcher | null | undefined;
10
+ type WebpackAliasMap = Record<string, string | string[] | false>;
7
11
  type Compilation = {
8
12
  hooks: {
9
13
  processAssets: {
@@ -13,19 +17,12 @@ type Compilation = {
13
17
  }, fn: (assets: Record<string, WebpackSource>) => void) => void;
14
18
  };
15
19
  };
16
- /** Watch inputs webpack rebuilds per compilation (webpack 5 LazySet). */
17
20
  fileDependencies: {
18
21
  add(path: string): void;
19
22
  };
20
- /** Currently-absent paths whose creation must trigger a rebuild. */
21
23
  missingDependencies: {
22
24
  add(path: string): void;
23
25
  };
24
- /** Directory watch inputs (webpack 5 LazySet). External kit roots are
25
- * registered here every compilation so UNIMPORTED creations still
26
- * produce watch turns — webpack reports the DIRECTORY, and the
27
- * session's root-dirty rewalk reconstructs the delta (openspec:
28
- * external-source-watch-ingestion, design D3; probe E). */
29
26
  contextDependencies: {
30
27
  add(path: string): void;
31
28
  };
@@ -34,17 +31,17 @@ type Compilation = {
34
31
  } | undefined;
35
32
  updateAsset(name: string, newSource: WebpackSource): void;
36
33
  };
37
- /** The slice of a webpack Module the needBuild predicate inspects. */
38
34
  type CandidateModule = {
39
35
  loaders?: Array<{
40
36
  loader?: string;
41
37
  }>;
42
38
  };
43
39
  type NeedBuildCallback = (err?: Error | null, result?: boolean) => void;
44
- /** NormalModule.getCompilationHooks(...) slice (webpack 5). */
40
+ type NeedBuildContext = Record<never, never>;
41
+ type CompilationIdentity = Record<never, never>;
45
42
  type NormalModuleCompilationHooks = {
46
43
  needBuild?: {
47
- tapAsync: (name: string, fn: (module: CandidateModule, context: unknown, callback: NeedBuildCallback) => void) => void;
44
+ tapAsync: (name: string, fn: (module: CandidateModule, context: NeedBuildContext, callback: NeedBuildCallback) => void) => void;
48
45
  };
49
46
  };
50
47
  type Compiler = {
@@ -59,7 +56,7 @@ type Compiler = {
59
56
  tap: (name: string, fn: (compilation: Compilation) => void) => void;
60
57
  };
61
58
  thisCompilation: {
62
- tap: (name: string, fn: (compilation: unknown) => void) => void;
59
+ tap: (name: string, fn: (compilation: CompilationIdentity) => void) => void;
63
60
  };
64
61
  };
65
62
  context: string;
@@ -69,10 +66,10 @@ type Compiler = {
69
66
  options?: {
70
67
  name?: string;
71
68
  resolve?: {
72
- alias?: Record<string, string | string[] | false>;
69
+ alias?: WebpackAliasMap;
73
70
  };
74
71
  watchOptions?: {
75
- ignored?: unknown;
72
+ ignored?: WatchIgnored;
76
73
  };
77
74
  };
78
75
  webpack?: {
@@ -82,87 +79,38 @@ type Compiler = {
82
79
  sources: {
83
80
  RawSource: new (source: string) => WebpackSource;
84
81
  };
85
- /** Obtained from the compiler instance at hook time — NEVER a top-level
86
- * webpack import (Next ships its own compiled webpack). */
82
+ /** Read from the compiler instance, never a top-level webpack import —
83
+ * Next ships its own compiled webpack. */
87
84
  NormalModule?: {
88
- getCompilationHooks?: (compilation: unknown) => NormalModuleCompilationHooks;
85
+ getCompilationHooks?: (compilation: CompilationIdentity) => NormalModuleCompilationHooks;
89
86
  };
90
87
  };
91
88
  };
92
- /**
93
- * Webpack adapter for the extraction pipeline. All pipeline logic lives in
94
- * the bundler-agnostic ExtractionSession — this class owns only the webpack
95
- * wiring: hook registration, cross-compiler analysis dedup, alias
96
- * harvesting from the compiler config, watch-event translation, and
97
- * in-memory CSS asset replacement.
98
- */
99
89
  export declare class AnimusWebpackPlugin {
100
90
  private options;
101
91
  private session;
102
92
  private initialized;
103
93
  private aliasesExtracted;
104
- /** Loader paths counting as "the animus loader" in a module's chain —
105
- * this package's own loader plus an optional harness override. */
106
94
  private readonly animusLoaderPaths;
107
- /** Epoch THIS compiler last proceeded with (set after every awaited
108
- * watchRun transaction — including joined ones). Null until the
109
- * initialization pipeline publishes. */
110
95
  private lastBuiltEpoch;
111
- /** Armed by watchRun when the transaction moved the epoch; captured and
112
- * disarmed by the next compilation's needBuild wiring (design D1). */
113
96
  private epochMovedForNextCompilation;
114
97
  constructor(options: AnimusNextOptions);
115
- /** True when the module's loader chain contains the animus loader — the
116
- * needBuild fan-out predicate (design D1: no historical records; covers
117
- * restored persistent-cache modules and raw passthroughs alike). */
118
98
  private moduleUsesAnimusLoader;
119
- /** Append the exact epoch artifact path to `watchOptions.ignored`,
120
- * preserving the user's shape (design D2: the artifact participates in
121
- * module snapshots via addDependency but never triggers live watch
122
- * turns — no echo compilations). Session identity is process-claimed,
123
- * so every compiler's plugin instance derives the SAME session-scoped
124
- * path here regardless of which instance ends up owning the pipeline.
125
- * Derived from the ONE root (session.rootDir, set at config time by
126
- * with-animus); compiler.context is the fallback for bare-apply
127
- * harnesses — identical when compiler.context === cwd. */
128
99
  private appendEpochWatchIgnore;
129
- /** Extract path aliases from webpack's resolve.alias config. Runs once per
130
- * plugin instance — the resolve config is immutable after apply. */
131
100
  private extractAliases;
132
101
  apply(compiler: Compiler): void;
133
- /**
134
- * Reset analysis state for HMR geological reset.
135
- */
136
102
  resetForHmr(): void;
137
- /** Session identity (process-claimed) — with-animus derives the
138
- * session-scoped alias/stub paths from it (design D2). */
139
103
  get sessionId(): string;
140
- /** Set the project root at CONFIG time (with-animus) — the ONE root all
141
- * session-path derivations use. The compiler hooks ADOPT
142
- * compiler.context only when no root was published (bare-apply
143
- * harnesses); they never overwrite this. */
144
104
  setRootDir(rootDir: string): void;
145
- /** One warning per plugin instance for a context/root mismatch. */
146
105
  private warnedRootDivergence;
147
- /** The run/watchRun taps' root handling: adopt compiler.context when no
148
- * config-time root exists; otherwise KEEP the configured root — every
149
- * frozen config-time derivation (stub path, css alias target,
150
- * virtual:animus/system-props target, watch-ignore) came from it, and a
151
- * silent overwrite re-keys sessionDir so the pipeline publishes
152
- * artifacts where none of those consumers look. A disagreement is
153
- * surfaced loudly instead (with-animus derives the root from Next's own
154
- * `dir`, which equals compiler.context in real Next runs — a mismatch
155
- * means a custom-webpack setup wired the plugin differently). */
106
+ /** Adopts `compiler.context` only when no config-time root exists: every
107
+ * frozen derivation came from that root, so an overwrite re-keys it.
108
+ * Stub path, css alias, virtual system-props target and watch-ignore are
109
+ * all frozen from it, so a disagreement is warned, never reconciled. */
156
110
  private adoptCompilerContext;
157
- /** This session's artifact directory, derived from the one root. */
158
111
  get sessionDir(): string;
159
- /** Expose options for the loader */
160
112
  getOptions(): AnimusNextOptions;
161
- /** Expose external package directories for webpack loader allowlisting.
162
- * Falls back to shared globalThis state for non-owning compiler instances. */
163
113
  getExternalPackageDirs(): string[];
164
- /** Expose external package source entries for webpack resolve alias.
165
- * Falls back to shared globalThis state for non-owning compiler instances. */
166
114
  getExternalSourceEntries(): Map<string, string>;
167
115
  }
168
116
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,KAAK,aAAa,GAAG;IACnB,MAAM,IAAI,MAAM,GAAG,MAAM,CAAC;IAC1B,IAAI,IAAI,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE;QACL,aAAa,EAAE;YACb,GAAG,EAAE,CACH,OAAO,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,EACxC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,IAAI,KAChD,IAAI,CAAC;SACX,CAAC;KACH,CAAC;IACF,yEAAyE;IACzE,gBAAgB,EAAE;QAAE,GAAG,CAAC,IAAI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AiB,CAE9B;IAED,sBAAsB,IAAI,MAAM,EAAE,CAIjC;IAED,wBAAwB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAI9C;CACF"}
@@ -1,46 +1,26 @@
1
+ import { TURBOPACK_SYSTEM_PROPS_ID } from '@animus-ui/extract/session';
2
+ import type { TurbopackLoaderOptions } from './turbopack-loader';
1
3
  import type { AnimusNextOptions } from './types';
2
- /**
3
- * Turbopack config fragment generation (spec: next-turbopack-integration).
4
- * Everything emitted here MUST be JSON-serializable — Turbopack forwards
5
- * loader options across process boundaries and rejects live values.
6
- */
4
+ /** Everything emitted here must be JSON-serializable: Turbopack forwards
5
+ * loader options across process boundaries and rejects live values. */
7
6
  export type TurbopackMode = 'off' | 'auto' | 'on';
8
7
  export interface TurbopackRule {
9
8
  loaders: Array<{
10
9
  loader: string;
11
- options: Record<string, unknown>;
10
+ options: TurbopackLoaderOptions;
12
11
  }>;
13
12
  }
14
13
  export interface TurbopackConfigFragment {
15
14
  rules: Record<string, TurbopackRule>;
16
15
  resolveAlias: Record<string, string>;
17
16
  }
18
- /** The single glob the Animus loader registers under. `.mjs` is included
19
- * for webpack parity: an external package without `src/` is ingested via
20
- * its resolved dist entry (often `dist/index.mjs`) and must still reach
21
- * the loader — manifest lookup remains the file-level gate. */
22
- export declare const ANIMUS_TURBOPACK_RULE_GLOB = "*.{ts,tsx,js,jsx,mjs}";
23
- /** Virtual system-props id emitted into transformed sources under Turbopack
24
- * (absolute-path imports are rejected there); resolveAlias maps it to the
25
- * on-disk artifact. */
26
- export declare const TURBOPACK_SYSTEM_PROPS_ID = "virtual:animus/system-props";
27
- /**
28
- * Resolve whether Turbopack wiring is active for this process. Default is
29
- * `'auto'`: active exactly when the TURBOPACK environment variable is set
30
- * (Next sets it for every Turbopack dev/build). The stable `turbopack`
31
- * option wins over the deprecated `unstable_turbopack` alias.
32
- */
17
+ /** The one glob the loader registers under, derived from the shared engine
18
+ * extension set so the bundler families cannot drift. `.mjs` belongs in that
19
+ * set: an external package with no src/ is ingested through its dist entry
20
+ * and must still reach the loader, so do not trim it. */
21
+ export declare const ANIMUS_TURBOPACK_RULE_GLOB: string;
22
+ export { TURBOPACK_SYSTEM_PROPS_ID };
33
23
  export declare function resolveTurbopackMode(options: AnimusNextOptions, env?: Record<string, string | undefined>): boolean;
34
- /**
35
- * Build the `turbopack` config fragment: one glob-keyed loader rule
36
- * (file-level allowlisting lives in the loader via manifest lookup — Next 15
37
- * rules have no condition algebra) plus resolve aliases for the virtual
38
- * system-props id, the emitter's stylesheet id, and each collected external
39
- * package specifier redirected to its source entry. Loader options carry
40
- * the session identity (design D2: an options-borne, JSON-serializable
41
- * Turbopack task input — restart-cold by construction), and the artifact
42
- * aliases point into the session-scoped tree.
43
- */
44
24
  export declare function buildTurbopackConfig(args: {
45
25
  rootDir: string;
46
26
  loaderPath: string;
@@ -49,12 +29,5 @@ export declare function buildTurbopackConfig(args: {
49
29
  sessionId: string;
50
30
  sessionDir: string;
51
31
  }): TurbopackConfigFragment;
52
- /**
53
- * Locate the Turbopack loader module: built dist first, source fallback for
54
- * in-repo development. CJS preferred — Turbopack's loader-runner follows
55
- * the webpack loader contract (`module.exports = fn`), and the .cjs build
56
- * is loadable by every runner version; ESM default-export acceptance is
57
- * not guaranteed.
58
- */
59
32
  export declare function resolveTurbopackLoaderPath(pluginDir: string): string;
60
33
  //# sourceMappingURL=turbopack-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"turbopack-config.d.ts","sourceRoot":"","sources":["../src/turbopack-config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;GAIG;AAEH,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,MAAM,CAAC,MAAM,EA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