@animus-ui/next-plugin 0.1.9 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +88 -1742
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +78 -1731
- package/dist/loader-core-BthLSJQF.cjs +47 -0
- package/dist/loader-core-x6cOzF9v.mjs +42 -0
- package/dist/loader-core.d.ts +6 -13
- package/dist/loader-core.d.ts.map +1 -1
- package/dist/loader-path.d.ts +0 -13
- package/dist/loader-path.d.ts.map +1 -1
- package/dist/loader.cjs +10 -34
- package/dist/loader.d.ts +2 -24
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.mjs +3 -26
- package/dist/plugin.d.ts +18 -70
- package/dist/plugin.d.ts.map +1 -1
- package/dist/turbopack-config.d.ts +11 -38
- package/dist/turbopack-config.d.ts.map +1 -1
- package/dist/turbopack-loader.cjs +44 -64
- package/dist/turbopack-loader.d.ts +12 -24
- package/dist/turbopack-loader.d.ts.map +1 -1
- package/dist/turbopack-loader.mjs +40 -56
- package/dist/types.d.ts +25 -79
- package/dist/types.d.ts.map +1 -1
- package/dist/with-animus.d.ts +39 -24
- package/dist/with-animus.d.ts.map +1 -1
- package/package.json +8 -2
- package/dist/extraction-session.d.ts +0 -378
- package/dist/extraction-session.d.ts.map +0 -1
- package/dist/loader-core-C40WbC6s.cjs +0 -71
- package/dist/loader-core-D6Tm_b8F.mjs +0 -66
- package/dist/resolve-packages.d.ts +0 -8
- package/dist/resolve-packages.d.ts.map +0 -1
- package/dist/session-paths-CZoi19NW.cjs +0 -229
- package/dist/session-paths-DfYIPDcM.mjs +0 -107
- package/dist/session-paths.d.ts +0 -107
- package/dist/session-paths.d.ts.map +0 -1
- package/dist/singleton-BjSsGjsg.mjs +0 -217
- package/dist/singleton-BjZyw_8b.cjs +0 -366
- package/dist/singleton.d.ts +0 -96
- package/dist/singleton.d.ts.map +0 -1
- package/dist/timing.d.ts +0 -7
- package/dist/timing.d.ts.map +0 -1
- package/dist/turbopack-orchestrator.d.ts +0 -34
- package/dist/turbopack-orchestrator.d.ts.map +0 -1
package/dist/types.d.ts.map
CHANGED
|
@@ -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
|
|
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,kBAAkB,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACtD;qEACiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;+EAC2E;IAC3E,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
package/dist/with-animus.d.ts
CHANGED
|
@@ -1,33 +1,48 @@
|
|
|
1
1
|
import type { AnimusNextOptions } from './types';
|
|
2
|
-
type
|
|
3
|
-
|
|
2
|
+
import type { TurbopackWatchOutcome } from '@animus-ui/extract/session';
|
|
3
|
+
import type { NextConfig as NextOwnedConfig, TurbopackOptions } from 'next/dist/server/config-shared';
|
|
4
|
+
type WebpackPluginEntry = object | false | null | undefined;
|
|
5
|
+
interface WebpackLoaderUse {
|
|
6
|
+
loader: string;
|
|
7
|
+
options?: object | string;
|
|
8
|
+
}
|
|
9
|
+
interface WebpackRule {
|
|
10
|
+
test?: RegExp | ((path: string) => boolean);
|
|
11
|
+
exclude?: RegExp | ((path: string) => boolean);
|
|
12
|
+
enforce?: string;
|
|
13
|
+
use?: WebpackLoaderUse[];
|
|
14
|
+
}
|
|
15
|
+
interface WebpackConfig {
|
|
16
|
+
plugins?: WebpackPluginEntry[];
|
|
4
17
|
resolve?: {
|
|
5
18
|
alias?: Record<string, string>;
|
|
6
19
|
};
|
|
7
20
|
module?: {
|
|
8
|
-
rules?:
|
|
9
|
-
test?: RegExp | ((path: string) => boolean);
|
|
10
|
-
exclude?: RegExp | ((path: string) => boolean);
|
|
11
|
-
enforce?: string;
|
|
12
|
-
use?: Array<{
|
|
13
|
-
loader: string;
|
|
14
|
-
options?: Record<string, unknown>;
|
|
15
|
-
}>;
|
|
16
|
-
}>;
|
|
21
|
+
rules?: WebpackRule[];
|
|
17
22
|
};
|
|
23
|
+
}
|
|
24
|
+
type DefinePluginConstructor = new (definitions: Record<string, string>) => object;
|
|
25
|
+
interface NextWebpackContext {
|
|
26
|
+
dir?: string;
|
|
27
|
+
dev?: boolean;
|
|
28
|
+
webpack?: {
|
|
29
|
+
DefinePlugin?: DefinePluginConstructor;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
type NextWebpackHook = (config: WebpackConfig, context: NextWebpackContext) => WebpackConfig;
|
|
33
|
+
interface NextConfigBoundary {
|
|
34
|
+
webpack?: NextWebpackHook | null;
|
|
35
|
+
turbopack?: TurbopackOptions;
|
|
36
|
+
}
|
|
37
|
+
type CallableNextConfig = (...args: never[]) => NextOwnedConfig | Promise<NextOwnedConfig>;
|
|
38
|
+
export type { NextConfigBoundary as AnimusNextConfigBoundary };
|
|
39
|
+
export type NextConfigInput<Config extends NextOwnedConfig> = Config extends CallableNextConfig ? never : Config & NextConfigBoundary;
|
|
40
|
+
export type WebpackNextConfig<Config extends NextOwnedConfig> = Omit<Config, 'webpack'> & {
|
|
41
|
+
webpack: NextWebpackHook;
|
|
18
42
|
};
|
|
19
|
-
type
|
|
20
|
-
|
|
43
|
+
export type TurbopackNextConfig<Config extends NextOwnedConfig> = Omit<Config, 'turbopack'> & {
|
|
44
|
+
turbopack: TurbopackOptions;
|
|
21
45
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
* ```ts
|
|
26
|
-
* // next.config.ts
|
|
27
|
-
* import { withAnimus } from '@animus-ui/next-plugin';
|
|
28
|
-
* export default withAnimus({ system: './src/ds.ts' })({});
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare function withAnimus(options: AnimusNextOptions): (nextConfig: NextConfig) => NextConfig | Promise<NextConfig>;
|
|
32
|
-
export {};
|
|
46
|
+
export declare function withAnimus(options: AnimusNextOptions): <Config extends NextOwnedConfig>(nextConfig: NextConfigInput<Config>) => WebpackNextConfig<Config> | Promise<TurbopackNextConfig<Config>>;
|
|
47
|
+
export declare function bindTurbopackWatchDeathReport(outcome: TurbopackWatchOutcome, rootDir: string): void;
|
|
33
48
|
//# sourceMappingURL=with-animus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-animus.d.ts","sourceRoot":"","sources":["../src/with-animus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-animus.d.ts","sourceRoot":"","sources":["../src/with-animus.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EACV,UAAU,IAAI,eAAe,EAC7B,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AAKxC,KAAK,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;AAE5D,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B;AAED,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC1B;AAED,UAAU,aAAa;IACrB,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC;IACF,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;KACvB,CAAC;CACH;AAED,KAAK,uBAAuB,GAAG,KAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACh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AAE,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.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Animus static CSS extraction for Next.js (webpack)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"animus",
|
|
@@ -40,7 +40,10 @@
|
|
|
40
40
|
"compile": "tsc --noEmit"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@animus-ui/extract": "0.1.
|
|
43
|
+
"@animus-ui/extract": "0.1.12"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@animus-ui/assertions": "0.1.12"
|
|
44
47
|
},
|
|
45
48
|
"peerDependencies": {
|
|
46
49
|
"@mdx-js/mdx": "^3.0.0",
|
|
@@ -51,5 +54,8 @@
|
|
|
51
54
|
"@mdx-js/mdx": {
|
|
52
55
|
"optional": true
|
|
53
56
|
}
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=22.12.0"
|
|
54
60
|
}
|
|
55
61
|
}
|
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
import type { AnimusNextOptions } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Module id the Rust emitter injects for the extracted stylesheet — also the
|
|
4
|
-
* exact resolve.alias key with-animus registers for it, which the adapter's
|
|
5
|
-
* alias harvesting must skip.
|
|
6
|
-
*/
|
|
7
|
-
export declare const ANIMUS_CSS_MODULE_ID = ".animus/styles.css";
|
|
8
|
-
/** Watch-cycle change sets, as reported by the bundler's watcher. */
|
|
9
|
-
export interface WatchChanges {
|
|
10
|
-
modifiedFiles?: ReadonlySet<string>;
|
|
11
|
-
removedFiles?: ReadonlySet<string>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Bundler-agnostic extraction pipeline: system loading, source discovery
|
|
15
|
-
* and ingestion, external-package collection, analysis, stylesheet and
|
|
16
|
-
* system-props emission, and watch-cycle diffing.
|
|
17
|
-
*
|
|
18
|
-
* The webpack adapter (plugin.ts) owns only bundler wiring: hook
|
|
19
|
-
* registration, alias harvesting from the compiler config, in-memory asset
|
|
20
|
-
* replacement, and translating watch events into `handleWatchUpdate`
|
|
21
|
-
* change sets. Keeping this class free of webpack types is deliberate — a
|
|
22
|
-
* future Turbopack integration must drive the same session from outside
|
|
23
|
-
* the bundler (Turbopack has no compiler-hook surface), reusing everything
|
|
24
|
-
* here unchanged.
|
|
25
|
-
*
|
|
26
|
-
* Outputs are published through the package singleton (shared CSS,
|
|
27
|
-
* manifest, system props) and written to `.animus/` on disk.
|
|
28
|
-
*/
|
|
29
|
-
export declare class ExtractionSession {
|
|
30
|
-
/** Set by the adapter before any pipeline run. */
|
|
31
|
-
rootDir: string | null;
|
|
32
|
-
/** Serialized path aliases, harvested by the adapter from bundler config. */
|
|
33
|
-
pathAliasesJson: string | null;
|
|
34
|
-
private assetCopyCache;
|
|
35
|
-
/** Physical asset files registered with the host watcher. */
|
|
36
|
-
assetDependencyPaths: Set<string>;
|
|
37
|
-
private assetDependencyKeys;
|
|
38
|
-
/** Emitter identity override for the system-props module id. Webpack mode
|
|
39
|
-
* (null) injects the absolute `.animus/system-props.js` path, resolved by
|
|
40
|
-
* NormalModuleReplacement; Turbopack rejects absolute-path imports, so
|
|
41
|
-
* its driver sets the virtual id that `resolveAlias` maps to disk. */
|
|
42
|
-
systemPropsModuleId: string | null;
|
|
43
|
-
/** Whether the analysis-inputs hydration corpus is serialized + written.
|
|
44
|
-
* False (webpack mode): the loader shares the pipeline process and reads
|
|
45
|
-
* the manifest from memory — the corpus is never persisted. True is set
|
|
46
|
-
* by the Turbopack orchestration driver, whose isolated loader workers
|
|
47
|
-
* replay it (spec: next-turbopack-integration, "Manifest disk artifact" /
|
|
48
|
-
* "Webpack mode skips the hydration corpus"). */
|
|
49
|
-
persistAnalysisInputs: boolean;
|
|
50
|
-
/** Absolute directory prefixes for external DS packages (loader allowlisting). */
|
|
51
|
-
externalPackageDirs: string[];
|
|
52
|
-
/** Absolute package dir → owning specifier (cross-source correlation). */
|
|
53
|
-
private externalDirOwners;
|
|
54
|
-
/** rootDir-relative external file → owning specifier (correlation join). */
|
|
55
|
-
private externalFileOwners;
|
|
56
|
-
/** External package specifier → absolute source entry path. */
|
|
57
|
-
externalSourceEntries: Map<string, string>;
|
|
58
|
-
/** SourceId derivation authority for the current generation (openspec:
|
|
59
|
-
* external-source-watch-ingestion, design D2) — canonical roots
|
|
60
|
-
* realpath'd once per full pipeline; alias→SourceId associations
|
|
61
|
-
* recorded while files exist so deletion resolves through the cache. */
|
|
62
|
-
private sourceIdentity;
|
|
63
|
-
/** Canonical admitted external root → declared specifiers (set-valued
|
|
64
|
-
* ownership, design D2; duplicate specifiers resolving to one canonical
|
|
65
|
-
* root share it). Engine watch wiring and tests read this. */
|
|
66
|
-
externalRootOwners: Map<string, Set<string>>;
|
|
67
|
-
/** Canonical external root → the extension set its collection walk used
|
|
68
|
-
* (widened for dist-only roots); rewalks and classification share it. */
|
|
69
|
-
private externalRootExtensions;
|
|
70
|
-
/** Canonical admitted external watch roots — the engine-side watch
|
|
71
|
-
* surface (webpack contextDependencies / Turbopack watchers). */
|
|
72
|
-
externalWatchRoots: string[];
|
|
73
|
-
/** Canonical external root → (raw sourceKey → {raw content hash, recorded
|
|
74
|
-
* abs spelling}): the previous-generation inventory a dirty-root rewalk
|
|
75
|
-
* diffs against (design D3). Raw hashes — MDX preprocessing never skews
|
|
76
|
-
* the diff; the recorded abs path is a registered deletion alias, so a
|
|
77
|
-
* reconstructed deletion always resolves through cached identity. */
|
|
78
|
-
private externalInventory;
|
|
79
|
-
/** Sticky diagnostics (design D5/D7): stable key → message, re-surfaced
|
|
80
|
-
* on every full pipeline until the underlying condition clears. */
|
|
81
|
-
readonly stickyDiagnostics: Map<string, string>;
|
|
82
|
-
/** Volume-membership predicate for the cross-volume gate (design D5).
|
|
83
|
-
* Injected seam: the shared predicate only discriminates on Windows
|
|
84
|
-
* (win32 semantics are unit-tested via path.win32), so runtime tests
|
|
85
|
-
* drive the gate through this. */
|
|
86
|
-
sharesProjectVolume: (projectRoot: string, externalRoot: string) => boolean;
|
|
87
|
-
/** Orchestrator seams (openspec: external-source-watch-ingestion, design
|
|
88
|
-
* D4). `onExternalRootResolved` fires per volume-admitted external root
|
|
89
|
-
* DURING collection — after resolution, BEFORE that root's sources are
|
|
90
|
-
* walked — so a watching host can open its handle with no blind gap
|
|
91
|
-
* between scan and watch. `onExternalRootsCommitted` fires once after a
|
|
92
|
-
* successful full-pipeline publication with the complete admitted
|
|
93
|
-
* canonical root set (the host's promote/replay/close-old phase; a
|
|
94
|
-
* failed pipeline never fires it, so the host rolls back). */
|
|
95
|
-
onExternalRootResolved: ((canonicalRoot: string) => void) | null;
|
|
96
|
-
onExternalRootsCommitted: ((canonicalRoots: string[]) => void) | null;
|
|
97
|
-
private readonly options;
|
|
98
|
-
private readonly staticCssJson;
|
|
99
|
-
private system;
|
|
100
|
-
/** Discovery-time keyframes diagnostics awaiting the shared surfacing pass. */
|
|
101
|
-
private externalKeyframesDiagnostics;
|
|
102
|
-
/** Full package-resolution map from the last full pipeline — replayed by
|
|
103
|
-
* incremental passes (sourceEntries alone omits dist-resolved packages). */
|
|
104
|
-
private lastPackageMap;
|
|
105
|
-
private fileCache;
|
|
106
|
-
private systemDependencyKeys;
|
|
107
|
-
/** Loader-reported dependency paths for bundler watch registration. */
|
|
108
|
-
systemDependencyPaths: string[];
|
|
109
|
-
private systemDependencyHashes;
|
|
110
|
-
private lastSystemPropsHash;
|
|
111
|
-
/** Per-payload write guards: payloadHash gates rewrites (byte-identical
|
|
112
|
-
* payloads leave disk untouched); diskHash is the hash of the CURRENT
|
|
113
|
-
* disk bytes (envelope included) recorded in the analysis-commit. null =
|
|
114
|
-
* not yet seeded (first publication reads the artifact's envelope so a
|
|
115
|
-
* same-session restart never rewrites byte-identical artifacts). */
|
|
116
|
-
private artifactRecords;
|
|
117
|
-
/** Last written analysis-commit; null = seeded from disk on first use. */
|
|
118
|
-
private lastCommit;
|
|
119
|
-
/** Session identity — claimed once per PROCESS (one Next invocation),
|
|
120
|
-
* adopted by every subsequent session instance so all compilers share
|
|
121
|
-
* one artifact tree (design D2: `next dev`/`next build` co-writing are
|
|
122
|
-
* separate processes and therefore separate sessions). */
|
|
123
|
-
readonly sessionId: string;
|
|
124
|
-
/** Epoch value of the last published analysis; null = not yet known
|
|
125
|
-
* (seeded from the session dir's artifact on first publication so a
|
|
126
|
-
* same-session restart with unchanged plans never rewrites bytes). */
|
|
127
|
-
private lastEpochValue;
|
|
128
|
-
/** Watcher debounce ceiling feeding status deadlines (design D3). */
|
|
129
|
-
debounceCeilingMs: number;
|
|
130
|
-
/** Test seam: observes every session-artifact write (name, content)
|
|
131
|
-
* post-rename — write ORDER is part of the transaction contract. */
|
|
132
|
-
onArtifactWrite: ((name: string, content: string) => void) | null;
|
|
133
|
-
/** Status attempt bookkeeping (design D3). */
|
|
134
|
-
private statusAttemptId;
|
|
135
|
-
private statusAttemptOpen;
|
|
136
|
-
/** Debounce-window observations pending analysis (sourceKey → hash). */
|
|
137
|
-
private debouncePending;
|
|
138
|
-
/** Session-start hygiene (pruning + legacy cleanup) runs once. */
|
|
139
|
-
private sessionStartHygieneDone;
|
|
140
|
-
private lcssTargets;
|
|
141
|
-
constructor(options: AnimusNextOptions);
|
|
142
|
-
/** This session's artifact directory. Requires `rootDir` to be set. */
|
|
143
|
-
get sessionDir(): string;
|
|
144
|
-
get verbose(): boolean;
|
|
145
|
-
private log;
|
|
146
|
-
private warn;
|
|
147
|
-
private now;
|
|
148
|
-
private elapsed;
|
|
149
|
-
/** Lazily-computed scan config (options are constructor-fixed, so the
|
|
150
|
-
* derivation is stable for the session's lifetime). */
|
|
151
|
-
private scanConfigMemo;
|
|
152
|
-
/** Resolve the scan configuration from options — the single source of the
|
|
153
|
-
* exclude/extension policy shared by the full and incremental pipelines. */
|
|
154
|
-
private resolveScanConfig;
|
|
155
|
-
/**
|
|
156
|
-
* Watch entry point: one single-flight analysis transaction per event
|
|
157
|
-
* batch (openspec: next-webpack-served-transform-coherence, design D3).
|
|
158
|
-
* The first entering session runs the transaction; every concurrent
|
|
159
|
-
* entry — same session re-entered, or another compiler's session
|
|
160
|
-
* (client/server/RSC each hold their own instance) — joins the in-flight
|
|
161
|
-
* promise, so no compiler proceeds against a generation older than the
|
|
162
|
-
* one the transaction publishes. A rejected transaction rejects every
|
|
163
|
-
* joiner; the gate always clears.
|
|
164
|
-
*/
|
|
165
|
-
handleWatchUpdate(changes: WatchChanges): Promise<void>;
|
|
166
|
-
/**
|
|
167
|
-
* Owner-side entry for a batch observed by a NON-OWNING compiler's
|
|
168
|
-
* watcher. Serializes behind any in-flight transaction, then runs the
|
|
169
|
-
* forwarded batch as its own transaction — never drops it (a forwarded
|
|
170
|
-
* batch has no other delivery; content-hash diffing makes an
|
|
171
|
-
* already-covered batch a cheap no-op).
|
|
172
|
-
*/
|
|
173
|
-
ingestForwardedBatch(changes: WatchChanges): Promise<void>;
|
|
174
|
-
/**
|
|
175
|
-
* Incremental watch pass: geological reset when the system file changed,
|
|
176
|
-
* otherwise content-hash diffing restricted to the watcher's change sets
|
|
177
|
-
* (falling back to a full discovery walk when no sets are provided).
|
|
178
|
-
*/
|
|
179
|
-
private processWatchUpdate;
|
|
180
|
-
/**
|
|
181
|
-
* Preprocess one `.mdx` entry into scanner-consumable tsx. Returns the
|
|
182
|
-
* rewritten source plus the `relPath + '.tsx'` path on success, or null
|
|
183
|
-
* when the file must be skipped.
|
|
184
|
-
*
|
|
185
|
-
* `warn: false` (incremental watch pass) skips silently — the full
|
|
186
|
-
* pipeline already surfaced the warning. `warn: true` (full pipeline)
|
|
187
|
-
* warns ONCE for a missing @mdx-js/mdx dependency via the shared
|
|
188
|
-
* `missingDepFlag` holder, and every time for a preprocessing error.
|
|
189
|
-
*/
|
|
190
|
-
private preprocessMdxEntry;
|
|
191
|
-
runFullPipeline(pending?: Array<[string, string]>): Promise<void>;
|
|
192
|
-
/**
|
|
193
|
-
* Reset analysis state for HMR geological reset. Payload write guards go
|
|
194
|
-
* back to null so the next publication reseeds them from the disk
|
|
195
|
-
* envelopes — a byte-identical post-reset artifact is still not
|
|
196
|
-
* rewritten.
|
|
197
|
-
*/
|
|
198
|
-
resetForHmr(): void;
|
|
199
|
-
/**
|
|
200
|
-
* The (sourceKey, observedSourceHash) pairs of a watch batch — cheap
|
|
201
|
-
* evidence for the status file's pending set on the geological-reset
|
|
202
|
-
* path, where the batch's component edits ride along with the system
|
|
203
|
-
* edit (design D3: loaders wait only on observed inputs).
|
|
204
|
-
*/
|
|
205
|
-
private pendingFromBatch;
|
|
206
|
-
/**
|
|
207
|
-
* Root-dirty inventory reconciliation (design D3): partition the
|
|
208
|
-
* watcher's change sets into explicit FILE events and external ROOT hits
|
|
209
|
-
* (a reported path that IS an admitted root, or a directory inside one),
|
|
210
|
-
* rewalk each dirty root through the shared discovery policy, diff the
|
|
211
|
-
* SourceId+raw-hash inventory against the previous generation, and merge
|
|
212
|
-
* the reconstructed created/edited/deleted deltas with the explicit
|
|
213
|
-
* events (identity-level dedup happens downstream at the cache gate).
|
|
214
|
-
* Deletion falls out of the inventory diff — webpack may report only the
|
|
215
|
-
* directory (probe-proven).
|
|
216
|
-
*/
|
|
217
|
-
private reconcileExternalRoots;
|
|
218
|
-
/**
|
|
219
|
-
* Route one watcher-reported path (design D1/D2): a project-root member
|
|
220
|
-
* (lexical containment — existing local semantics preserved; consumer
|
|
221
|
-
* exclude patterns apply) or an admitted external member (identity
|
|
222
|
-
* resolution with symlink-escape rejection; package-relative excludes
|
|
223
|
-
* mirror the collection walk's filters — guardrail G1, one policy).
|
|
224
|
-
* Returns null for dropped paths.
|
|
225
|
-
*/
|
|
226
|
-
private classifyWatchPath;
|
|
227
|
-
/**
|
|
228
|
-
* Build file entries from cache: every cached file rides with full source.
|
|
229
|
-
* The v2 engine has NO Rust-side cache (arch-extract-v2-spine: uncached
|
|
230
|
-
* re-analysis beats a cache-hit path), so it must always receive full sources
|
|
231
|
-
* (openspec: retire-extract-v1 removed the v1 empty-source cache contract).
|
|
232
|
-
*/
|
|
233
|
-
private buildFileEntriesFromCache;
|
|
234
|
-
/**
|
|
235
|
-
* Run incremental pipeline with cache-aware file entries.
|
|
236
|
-
* Reuses system config from the last full pipeline run.
|
|
237
|
-
*/
|
|
238
|
-
private runIncrementalPipeline;
|
|
239
|
-
/**
|
|
240
|
-
* Shared analysis + emit core for both pipelines — the single call site
|
|
241
|
-
* that routes every manifest through the shared `runProjectAnalysis`,
|
|
242
|
-
* reachable from both runFullPipeline (production) and
|
|
243
|
-
* runIncrementalPipeline (HMR).
|
|
244
|
-
*
|
|
245
|
-
* Owns diagnostic surfacing, CSS assembly + styles.css write guard,
|
|
246
|
-
* system-props module emit, and the timing log. The `devMode` flag is the
|
|
247
|
-
* ONLY behavioral fork:
|
|
248
|
-
*
|
|
249
|
-
* - `false` (production): computes bt.analysis + logs the extraction
|
|
250
|
-
* report, and writes system-props.js UNCONDITIONALLY (no
|
|
251
|
-
* lastSystemPropsHash guard).
|
|
252
|
-
* - `true` (HMR): skips the report log, and guards the system-props.js
|
|
253
|
-
* write by lastSystemPropsHash.
|
|
254
|
-
*
|
|
255
|
-
* The disk artifacts land under the session directory in transaction
|
|
256
|
-
* order (design D1): manifest → analysis-inputs (Turbopack orchestration
|
|
257
|
-
* only) → styles.css → system-props → analysis-commit →
|
|
258
|
-
* replacements-epoch (last, only when moved). The analysis-status file walks starting → analyzing →
|
|
259
|
-
* committing → idle around the attempt, landing in `failed` (with the
|
|
260
|
-
* diagnostic) on any throw (design D3).
|
|
261
|
-
*/
|
|
262
|
-
private analyzeAndEmit;
|
|
263
|
-
private analyzeAndEmitAttempt;
|
|
264
|
-
/** Open a status attempt (attemptId increments once per burst — a
|
|
265
|
-
* debouncing pre-write and the analysis that follows share one id). */
|
|
266
|
-
private beginStatusAttempt;
|
|
267
|
-
/** Write the session's analysis-status artifact (design D3). Terminal
|
|
268
|
-
* states (idle/failed) close the attempt. */
|
|
269
|
-
private writeAnalysisStatus;
|
|
270
|
-
/**
|
|
271
|
-
* Orchestrator seam (Turbopack watcher): record watch events observed
|
|
272
|
-
* during the debounce window so a loader running ahead of the analysis
|
|
273
|
-
* has positive evidence to wait on (design D3 'debouncing'). Paths are
|
|
274
|
-
* filtered by the scan config and hashed at observation time.
|
|
275
|
-
*/
|
|
276
|
-
noteDebouncedWatchEvents(absPaths: Iterable<string>): void;
|
|
277
|
-
/** One pending microtask flushes a burst of debounce observations. */
|
|
278
|
-
private debounceStatusWriteScheduled;
|
|
279
|
-
/**
|
|
280
|
-
* Write one payload artifact into the session directory, enveloped with
|
|
281
|
-
* `{sessionId, generation, replacementEpoch, payloadHash}` and rewritten
|
|
282
|
-
* only when the PAYLOAD bytes changed (byte-identical re-analyses leave
|
|
283
|
-
* disk untouched — spec: "Unchanged manifest is not rewritten"). The
|
|
284
|
-
* recorded diskHash (hash of the enveloped bytes) feeds the
|
|
285
|
-
* analysis-commit.
|
|
286
|
-
*/
|
|
287
|
-
private publishPayloadArtifact;
|
|
288
|
-
/** Reconstruct a payload write guard from the on-disk artifact's envelope
|
|
289
|
-
* (same-session restart: a byte-identical payload must not rewrite). */
|
|
290
|
-
private seedPayloadRecord;
|
|
291
|
-
/** Last analysis-commit persisted in this session's directory, or null. */
|
|
292
|
-
private seedCommitFromDisk;
|
|
293
|
-
/**
|
|
294
|
-
* Publish the analysis-commit — the transaction identity (design D1).
|
|
295
|
-
* Written AFTER every payload and BEFORE the epoch; skipped entirely when
|
|
296
|
-
* the payload set (disk hashes) and epoch are unchanged, so a no-op
|
|
297
|
-
* re-analysis neither re-keys loader-worker hydration nor burns a
|
|
298
|
-
* generation.
|
|
299
|
-
*/
|
|
300
|
-
private publishAnalysisCommit;
|
|
301
|
-
/**
|
|
302
|
-
* Publish the canonical replacement epoch: maintain the session-scoped
|
|
303
|
-
* disk witness `{schema, sessionId, epoch}`, rewritten ONLY when the
|
|
304
|
-
* epoch VALUE changes so style-only analyses and same-session restarts
|
|
305
|
-
* leave bytes and mtime untouched, then expose the value through the
|
|
306
|
-
* singleton for the plugin's needBuild fan-out and the loader's catch-up
|
|
307
|
-
* re-check. Every VALUE move also reconciles sibling sessions' epoch
|
|
308
|
-
* artifacts (below) — the webpack cold-cache validity witness.
|
|
309
|
-
*/
|
|
310
|
-
private publishReplacementEpoch;
|
|
311
|
-
/**
|
|
312
|
-
* Sibling epoch reconciliation — the cross-session half of the webpack
|
|
313
|
-
* persistent-cache witness (spec: dev-served-transform-coherence,
|
|
314
|
-
* "Offline change invalidates restored modules"). Restored-module
|
|
315
|
-
* snapshots reference the epoch artifact of the session that BUILT them;
|
|
316
|
-
* with session-scoped trees that file would otherwise sit untouched
|
|
317
|
-
* forever, keeping stale snapshots valid. Whenever this session's epoch
|
|
318
|
-
* value moves, delete every sibling epoch artifact that disagrees (their
|
|
319
|
-
* snapshots must invalidate — restore-on-demand then rebuilds from the
|
|
320
|
-
* current generation) and leave agreeing siblings byte-untouched (warm
|
|
321
|
-
* restores stay valid). Deleting a stale artifact is pruning, not a
|
|
322
|
-
* foreign-session write; races with concurrent sessions are tolerated
|
|
323
|
-
* (S14).
|
|
324
|
-
*/
|
|
325
|
-
/** Sibling ids already reconciled away (artifact deleted or absent) —
|
|
326
|
-
* nothing left to invalidate for them on later moves. */
|
|
327
|
-
private reconciledSiblingIds;
|
|
328
|
-
/** sessions-root listing memo, keyed by the root dir's mtime — a new or
|
|
329
|
-
* pruned sibling DIRECTORY moves it; agreeing siblings stay listed. */
|
|
330
|
-
private siblingListing;
|
|
331
|
-
private reconcileSiblingEpochs;
|
|
332
|
-
/** Epoch value held by this session's on-disk artifact, or null when
|
|
333
|
-
* absent, unreadable, or not the expected schema. */
|
|
334
|
-
private diskEpochValue;
|
|
335
|
-
/** Session-start hygiene (design D2): delete legacy flat artifacts
|
|
336
|
-
* (unreachable by session-scoped loaders) and prune sibling session
|
|
337
|
-
* directories older than the retention window — never the own dir,
|
|
338
|
-
* tolerating races with concurrently-pruning sessions (S14). */
|
|
339
|
-
private runSessionStartHygiene;
|
|
340
|
-
/** Ensure the session directory exists and write one artifact into it.
|
|
341
|
-
* Write-then-rename so cross-process readers (Turbopack loader workers)
|
|
342
|
-
* can never observe a torn half-written file. The tmp name carries the
|
|
343
|
-
* pid — Next dev evaluates the config in more than one process, and two
|
|
344
|
-
* sessions writing the same artifact must not race on one tmp path. */
|
|
345
|
-
private writeSessionArtifact;
|
|
346
|
-
/**
|
|
347
|
-
* asset() placeholder substitution (global-styles-system): resolve each
|
|
348
|
-
* referenced specifier through Node resolution, copy the bytes into the
|
|
349
|
-
* session directory's `assets/` under a content-hashed name, and
|
|
350
|
-
* substitute a RELATIVE url — relative to the session-scoped styles.css,
|
|
351
|
-
* which sits beside `assets/`, so the emitted `./assets/<file>` form is
|
|
352
|
-
* unchanged. The stylesheet is processed by Next's own CSS pipeline
|
|
353
|
-
* (webpack and Turbopack alike), which applies its native asset handling
|
|
354
|
-
* — publicPath and output hashing — to relative url() references.
|
|
355
|
-
* Unsubstitutable specifiers warn and emit literally in non-strict mode,
|
|
356
|
-
* fail the build under `strict: true`.
|
|
357
|
-
*/
|
|
358
|
-
private substituteAssetReferences;
|
|
359
|
-
private trackAssetDependency;
|
|
360
|
-
/**
|
|
361
|
-
* Resolve an asset specifier to an absolute file via the shared pipeline
|
|
362
|
-
* resolver (host aliases → Node resolution → package root), with one
|
|
363
|
-
* session-local last resort: an already-discovered source entry's package
|
|
364
|
-
* root (dist-less workspace kits the shared resolver cannot see).
|
|
365
|
-
*/
|
|
366
|
-
private resolveAssetSpecifier;
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Sync `.animus/assets/` to the current build's content-hashed file set:
|
|
370
|
-
* anything else in the directory is a superseded revision (the copies are
|
|
371
|
-
* content-addressed and never overwritten) or the leftover of an asset()
|
|
372
|
-
* reference that no longer exists. Failures are tolerated per entry — Next
|
|
373
|
-
* dev evaluates the config in more than one process, and a concurrent
|
|
374
|
-
* session may have removed (or be about to rewrite) the same file; every
|
|
375
|
-
* pass rewrites whatever of its own set is missing, so races self-heal.
|
|
376
|
-
*/
|
|
377
|
-
export declare function pruneStaleAssets(assetsDir: string, expected: ReadonlySet<string>): void;
|
|
378
|
-
//# sourceMappingURL=extraction-session.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extraction-session.d.ts","sourceRoot":"","sources":["../src/extraction-session.ts"],"names":[],"mappings":"AA8FA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AASjD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAgCzD,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAiB;IAC5B,kDAAkD;IAClD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC9B,6EAA6E;IAC7E,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IAItC,OAAO,CAAC,cAAc,CASlB;IACJ,6DAA6D;IAC7D,oBAAoB,cAAqB;IACzC,OAAO,CAAC,mBAAmB,CAAqB;IAChD;;;2EAGuE;IACvE,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC1C;;;;;sDAKkD;IAClD,qBAAqB,UAAS;IAE9B,kFAAkF;IAClF,mBAAmB,EAAE,MAAM,EAAE,CAAM;IACnC,0EAA0E;IAC1E,OAAO,CAAC,iBAAiB,CAA8B;IACvD,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB,CAA8B;IACxD,+DAA+D;IAC/D,qBAAqB,sBAA6B;IAClD;;;6EAGyE;IACzE,OAAO,CAAC,cAAc,C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YACW,sBAAsB;IAqBpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;YACW,cAAc;YA8Bd,qBAAqB;IA4NnC;4EACwE;IACxE,OAAO,CAAC,kBAAkB;IAO1B;kDAC8C;IAC9C,OAAO,CAAC,mBAAmB;IAoB3B;;;;;OAKG;IACH,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CA+BzD;IAED,sEAAsE;IACtE,OAAO,CAAC,4BAA4B,CAAS;IAE7C;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAyB9B;6EACyE;IACzE,OAAO,CAAC,iBAAiB;IAqBzB,2EAA2E;IAC3E,OAAO,CAAC,kBAAkB;IAe1B;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAiC7B;;;;;;;;OAQG;IACH,OAAO,CAAC,uBAAuB;IA4B/B;;;;;;;;;;;;;OAaG;IACH;8DAC0D;IAC1D,OAAO,CAAC,oBAAoB,CAAqB;IACjD;4EACwE;IACxE,OAAO,CAAC,cAAc,CAAuD;IAE7E,OAAO,CAAC,sBAAsB;IA8C9B;0DACsD;IACtD,OAAO,CAAC,cAAc;IAatB;;;qEAGiE;IACjE,OAAO,CAAC,sBAAsB;IA+B9B;;;;4EAIwE;IACxE,OAAO,CAAC,oBAAoB;IAU5B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,yBAAyB;IA2EjC,OAAO,CAAC,oBAAoB;IAK5B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;CA0B9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAC5B,IAAI,CAgBN"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
//#region src/loader-core.ts
|
|
2
|
-
/**
|
|
3
|
-
* Regex matching CSS import lines injected by the Rust emitter.
|
|
4
|
-
* Catches both the alias form (`import '.animus/styles.css'`),
|
|
5
|
-
* relative forms (`import '../.animus/styles.css'`), and the Vite
|
|
6
|
-
* virtual module form (`import 'virtual:animus/styles.css'`) which
|
|
7
|
-
* appears in pre-built external packages compiled with the Vite plugin.
|
|
8
|
-
*/
|
|
9
|
-
const CSS_IMPORT_RE = /import\s+['"](?:[^'"]*\.animus\/styles\.css|virtual:animus\/styles\.css)['"];\n?/g;
|
|
10
|
-
/**
|
|
11
|
-
* Default root entry file patterns. CSS is imported ONLY in the root entry
|
|
12
|
-
* to prevent per-chunk duplication in Next.js builds.
|
|
13
|
-
*
|
|
14
|
-
* - App Router: `app/layout.tsx` (root layout wraps all routes)
|
|
15
|
-
* - Pages Router: `pages/_app.tsx` (custom App wraps all pages)
|
|
16
|
-
*
|
|
17
|
-
* The `(src\/)?` prefix handles projects that use a `src/` directory.
|
|
18
|
-
* Projects whose root entry doesn't match (nested layouts, monorepo roots)
|
|
19
|
-
* set the `cssImportTarget` plugin option, which replaces this detection.
|
|
20
|
-
*/
|
|
21
|
-
const ROOT_ENTRY_RE = /^(src\/)?(?:app\/layout|pages\/_app)\.[tj]sx?$/;
|
|
22
|
-
/** Normalize separators and strip a leading './' for path comparison. */
|
|
23
|
-
function normalizePath(p) {
|
|
24
|
-
return p.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Decide whether `filename` (project-root-relative) is the file that
|
|
28
|
-
* receives the single CSS import. An explicit `cssImportTarget` replaces
|
|
29
|
-
* the default filename-convention detection. Separators are normalized
|
|
30
|
-
* first — Windows `relative()` yields backslashes the patterns would miss.
|
|
31
|
-
*/
|
|
32
|
-
function isCssImportTarget(filename, cssImportTarget) {
|
|
33
|
-
const normalized = normalizePath(filename);
|
|
34
|
-
if (cssImportTarget) return normalized === normalizePath(cssImportTarget);
|
|
35
|
-
return ROOT_ENTRY_RE.test(normalized);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Transform one source file against a manifest: replace builder chains via
|
|
39
|
-
* the engine, strip emitter-injected stylesheet imports everywhere, and
|
|
40
|
-
* re-inject a single import at the root entry (after any leading
|
|
41
|
-
* `'use client'` directive). On failure: throw in strict mode, otherwise
|
|
42
|
-
* warn and return the source unchanged.
|
|
43
|
-
*/
|
|
44
|
-
function transformWithManifest(args) {
|
|
45
|
-
const { source, filename, manifestJson, engineApi, opts } = args;
|
|
46
|
-
const isRootEntry = isCssImportTarget(filename, opts.cssImportTarget);
|
|
47
|
-
try {
|
|
48
|
-
const { transformFile } = engineApi();
|
|
49
|
-
const result = transformFile(source, filename, manifestJson);
|
|
50
|
-
let code = result.hasComponents ? result.code : source;
|
|
51
|
-
code = code.replace(CSS_IMPORT_RE, "");
|
|
52
|
-
if (isRootEntry && !code.includes(".animus/styles.css")) if (code.startsWith("'use client'") || code.startsWith("\"use client\"")) {
|
|
53
|
-
const nl = code.indexOf("\n");
|
|
54
|
-
if (nl === -1) code = `${code}\nimport '.animus/styles.css';\n`;
|
|
55
|
-
else code = `${code.slice(0, nl + 1)}import '.animus/styles.css';\n${code.slice(nl + 1)}`;
|
|
56
|
-
} else code = `import '.animus/styles.css';\n${code}`;
|
|
57
|
-
return code;
|
|
58
|
-
} catch (e) {
|
|
59
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
60
|
-
if (opts.strict) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}`, { cause: e });
|
|
61
|
-
console.warn(`[animus-extract] Transform failed for ${filename}:`, msg);
|
|
62
|
-
return source;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
Object.defineProperty(exports, "transformWithManifest", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function() {
|
|
69
|
-
return transformWithManifest;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
//#region src/loader-core.ts
|
|
2
|
-
/**
|
|
3
|
-
* Regex matching CSS import lines injected by the Rust emitter.
|
|
4
|
-
* Catches both the alias form (`import '.animus/styles.css'`),
|
|
5
|
-
* relative forms (`import '../.animus/styles.css'`), and the Vite
|
|
6
|
-
* virtual module form (`import 'virtual:animus/styles.css'`) which
|
|
7
|
-
* appears in pre-built external packages compiled with the Vite plugin.
|
|
8
|
-
*/
|
|
9
|
-
const CSS_IMPORT_RE = /import\s+['"](?:[^'"]*\.animus\/styles\.css|virtual:animus\/styles\.css)['"];\n?/g;
|
|
10
|
-
/**
|
|
11
|
-
* Default root entry file patterns. CSS is imported ONLY in the root entry
|
|
12
|
-
* to prevent per-chunk duplication in Next.js builds.
|
|
13
|
-
*
|
|
14
|
-
* - App Router: `app/layout.tsx` (root layout wraps all routes)
|
|
15
|
-
* - Pages Router: `pages/_app.tsx` (custom App wraps all pages)
|
|
16
|
-
*
|
|
17
|
-
* The `(src\/)?` prefix handles projects that use a `src/` directory.
|
|
18
|
-
* Projects whose root entry doesn't match (nested layouts, monorepo roots)
|
|
19
|
-
* set the `cssImportTarget` plugin option, which replaces this detection.
|
|
20
|
-
*/
|
|
21
|
-
const ROOT_ENTRY_RE = /^(src\/)?(?:app\/layout|pages\/_app)\.[tj]sx?$/;
|
|
22
|
-
/** Normalize separators and strip a leading './' for path comparison. */
|
|
23
|
-
function normalizePath(p) {
|
|
24
|
-
return p.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Decide whether `filename` (project-root-relative) is the file that
|
|
28
|
-
* receives the single CSS import. An explicit `cssImportTarget` replaces
|
|
29
|
-
* the default filename-convention detection. Separators are normalized
|
|
30
|
-
* first — Windows `relative()` yields backslashes the patterns would miss.
|
|
31
|
-
*/
|
|
32
|
-
function isCssImportTarget(filename, cssImportTarget) {
|
|
33
|
-
const normalized = normalizePath(filename);
|
|
34
|
-
if (cssImportTarget) return normalized === normalizePath(cssImportTarget);
|
|
35
|
-
return ROOT_ENTRY_RE.test(normalized);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Transform one source file against a manifest: replace builder chains via
|
|
39
|
-
* the engine, strip emitter-injected stylesheet imports everywhere, and
|
|
40
|
-
* re-inject a single import at the root entry (after any leading
|
|
41
|
-
* `'use client'` directive). On failure: throw in strict mode, otherwise
|
|
42
|
-
* warn and return the source unchanged.
|
|
43
|
-
*/
|
|
44
|
-
function transformWithManifest(args) {
|
|
45
|
-
const { source, filename, manifestJson, engineApi, opts } = args;
|
|
46
|
-
const isRootEntry = isCssImportTarget(filename, opts.cssImportTarget);
|
|
47
|
-
try {
|
|
48
|
-
const { transformFile } = engineApi();
|
|
49
|
-
const result = transformFile(source, filename, manifestJson);
|
|
50
|
-
let code = result.hasComponents ? result.code : source;
|
|
51
|
-
code = code.replace(CSS_IMPORT_RE, "");
|
|
52
|
-
if (isRootEntry && !code.includes(".animus/styles.css")) if (code.startsWith("'use client'") || code.startsWith("\"use client\"")) {
|
|
53
|
-
const nl = code.indexOf("\n");
|
|
54
|
-
if (nl === -1) code = `${code}\nimport '.animus/styles.css';\n`;
|
|
55
|
-
else code = `${code.slice(0, nl + 1)}import '.animus/styles.css';\n${code.slice(nl + 1)}`;
|
|
56
|
-
} else code = `import '.animus/styles.css';\n${code}`;
|
|
57
|
-
return code;
|
|
58
|
-
} catch (e) {
|
|
59
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
60
|
-
if (opts.strict) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}`, { cause: e });
|
|
61
|
-
console.warn(`[animus-extract] Transform failed for ${filename}:`, msg);
|
|
62
|
-
return source;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
export { transformWithManifest as t };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve external DS package specifiers to rootDir-relative entry paths.
|
|
3
|
-
* Node-generic (no webpack APIs): Pass 1 walks the consumer's workspaces for
|
|
4
|
-
* matching package names; Pass 2 falls back to `require.resolve`. Specifiers
|
|
5
|
-
* that resolve nowhere are simply omitted (spec: silent skip).
|
|
6
|
-
*/
|
|
7
|
-
export declare function resolvePackagesByName(rootDir: string, names: string[]): Record<string, string>;
|
|
8
|
-
//# sourceMappingURL=resolve-packages.d.ts.map
|