@animus-ui/vite-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/README.md CHANGED
@@ -101,6 +101,7 @@ Router examples live in the
101
101
  - Do **not** add React resolve aliases to `vite.config.ts` — they break the extraction transform pipeline
102
102
  - After system config changes, restart the dev server (the subprocess runs at `buildStart`)
103
103
  - Run `bun run clean:light` if styles seem stale (clears `.vite` cache)
104
+ - The virtual module ids are published contract, and Vite gives the first `resolveId`/`load` answer for an id to the whole config, so two plugin instances in one Vite config share one bridge and one stylesheet — the second instance's modules resolve to the first's. The per-instance key only separates independently built bundles that share a document.
104
105
 
105
106
  ## License
106
107
 
@@ -1,11 +1,7 @@
1
1
  import type { PluginContext } from './context';
2
2
  /**
3
- * buildStart: load the system, discover and ingest sources (local +
4
- * external packages), run whole-project analysis, and log the report.
5
- * `resolveSpecifier` is the bundler seam — Vite's `this.resolve` mapped to
6
- * an absolute id. `emitAsset` (build mode only) is Rollup's `this.emitFile`
7
- * for `asset()` placeholder substitution; absent in dev, where resolved
8
- * files are served via base + `/@fs/` instead.
3
+ * `resolveSpecifier` maps a specifier to an absolute id. `emitAsset` is
4
+ * present in build only, where `asset()` files become Rollup assets.
9
5
  */
10
6
  export declare function runBuildStart(ctx: PluginContext, resolveSpecifier: (specifier: string) => Promise<string | null>, emitAsset?: (fileName: string, source: Uint8Array) => string): Promise<void>;
11
7
  //# sourceMappingURL=build-start.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-start.d.ts","sourceRoot":"","sources":["../src/build-start.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,aAAa,EAClB,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAC/D,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,KAAK,MAAM,GAC3D,OAAO,CAAC,IAAI,CAAC,CA2Rf"}
1
+ {"version":3,"file":"build-start.d.ts","sourceRoot":"","sources":["../src/build-start.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;GAGG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,aAAa,EAClB,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAC/D,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,KAAK,MAAM,GAC3D,OAAO,CAAC,IAAI,CAAC,CAkNf"}
package/dist/config.d.ts CHANGED
@@ -1,9 +1,4 @@
1
1
  import type { PluginContext } from './context';
2
2
  import type { ResolvedConfig } from 'vite';
3
- /**
4
- * configResolved: capture build mode, root, and logger; resolve Lightning
5
- * CSS targets; harvest resolve.alias into the Rust `pathAliasesJson`
6
- * contract via the shared encoder.
7
- */
8
3
  export declare function applyResolvedConfig(ctx: PluginContext, config: ResolvedConfig): void;
9
4
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,cAAc,GACrB,IAAI,CAwDN"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE3C,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,cAAc,GACrB,IAAI,CAmCN"}
@@ -1,8 +1,6 @@
1
1
  /**
2
- * The namespace every virtual module this plugin owns lives under. Exported so
3
- * the `transform` guard that keeps those modules out of source-file handling
4
- * matches on the same string the ids are built from — a rename of the
5
- * namespace cannot leave the guard behind.
2
+ * The namespace every virtual module here lives under; the `transform` guard
3
+ * matches on this same string so a rename cannot strand it.
6
4
  */
7
5
  export declare const VIRTUAL_PREFIX = "virtual:animus/";
8
6
  export declare const VIRTUAL_CSS_ID = "virtual:animus/styles.css";
@@ -12,21 +10,11 @@ export declare const RESOLVED_COMPONENTS_ID = "\0virtual:animus/components.js";
12
10
  export declare const VIRTUAL_BRIDGE_ID = "virtual:animus/hmr-bridge.js";
13
11
  export declare const RESOLVED_BRIDGE_ID = "\0virtual:animus/hmr-bridge.js";
14
12
  /**
15
- * Browser-addressable URL for the bridge, used as the `src` of the dev
16
- * `<script type="module">` (see index-html.ts). THE explanation of the `/@id/`
17
- * convention lives here; everything else points at it.
18
- *
19
- * Vite reserves `/@id/` for module ids that are not file paths. Its transform
20
- * middleware normalizes such a URL before serving it (`unwrapId`): strip the
21
- * prefix, then decode the `__x00__` placeholder back to a NUL byte. The
22
- * UNPREFIXED specifier is what travels here — `resolveVirtualId` is the hook
23
- * that answers it, and it answers with the `\0` form. (Vite's own `wrapId`
24
- * encodes an already-`\0`-prefixed id as `__x00__`; that form resolves too, but
25
- * it leans on the placeholder convention rather than on this plugin's own
26
- * `resolveId` contract.)
13
+ * Vite reserves `/@id/` for module ids that are not file paths and strips the
14
+ * prefix before `resolveId`, so the unprefixed specifier travels here.
27
15
  */
28
16
  export declare const BRIDGE_SCRIPT_SRC = "/@id/virtual:animus/hmr-bridge.js";
29
17
  export declare const VIRTUAL_SYSTEM_PROPS_ID = "virtual:animus/system-props";
30
18
  export declare const RESOLVED_SYSTEM_PROPS_ID = "\0virtual:animus/system-props";
31
- export declare const DEFAULT_EXCLUDE: string[];
19
+ export { DEFAULT_EXCLUDE } from '@animus-ui/extract/pipeline';
32
20
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,8BAAgC,CAAC;AAC5D,eAAO,MAAM,eAAe,gCAAwB,CAAC;AAErD,eAAO,MAAM,qBAAqB,iCAAmC,CAAC;AACtE,eAAO,MAAM,sBAAsB,mCAA+B,CAAC;AAEnE,eAAO,MAAM,iBAAiB,iCAAmC,CAAC;AAClE,eAAO,MAAM,kBAAkB,mCAA2B,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,sCAA8B,CAAC;AAE7D,eAAO,MAAM,uBAAuB,gCAAkC,CAAC;AACvE,eAAO,MAAM,wBAAwB,kCAAiC,CAAC;AAEvE,eAAO,MAAM,eAAe,UAA+C,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,8BAAgC,CAAC;AAC5D,eAAO,MAAM,eAAe,gCAAwB,CAAC;AAErD,eAAO,MAAM,qBAAqB,iCAAmC,CAAC;AACtE,eAAO,MAAM,sBAAsB,mCAA+B,CAAC;AAEnE,eAAO,MAAM,iBAAiB,iCAAmC,CAAC;AAClE,eAAO,MAAM,kBAAkB,mCAA2B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,sCAA8B,CAAC;AAE7D,eAAO,MAAM,uBAAuB,gCAAkC,CAAC;AACvE,eAAO,MAAM,wBAAwB,kCAAiC,CAAC;AAIvE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC"}
package/dist/context.d.ts CHANGED
@@ -1,123 +1,72 @@
1
1
  import { HotUpdateEvents } from './hot-update-events';
2
2
  import type { LightningTargets } from './css';
3
3
  import type { AnimusExtractOptions } from './index';
4
- import type { ExternalPackageOutcome, ManifestDiagnostic, SystemConfig } from '@animus-ui/extract/pipeline';
4
+ import type { ExcludeMatcher, ExternalPackageOutcome, ManifestDiagnostic, ManifestSheets, ProjectManifest, RawSourceEntry, SourceCorpus, SourceIngestionResult, SystemConfig } from '@animus-ui/extract/pipeline';
5
5
  import type { Logger } from 'vite';
6
- /**
7
- * Structured per-layer CSS sheets from the Rust crate (dev split delivery).
8
- * Mirrors the `CssSheets` struct in packages/extract/src/css_generator.rs —
9
- * keep these fields in sync.
10
- */
11
- export interface CssSheets {
12
- declaration: string;
13
- global: string;
14
- base: string;
15
- variants: string;
16
- compounds: string;
17
- states: string;
18
- system: string;
19
- custom: string;
20
- }
21
- /**
22
- * Reconstruct file entries from cache, including content hashes.
23
- * For unchanged files (hash matches changedPath), sends empty source
24
- * to avoid serializing full source text across the NAPI boundary.
25
- * The engine adapter's `rehydrateFilesJson` refills empty sources from
26
- * this same cache before analyze.
27
- */
28
- export declare function buildFileEntriesFromCache(cache: Map<string, {
29
- hash: string;
30
- source: string;
31
- }>, changedPath?: string): Array<{
32
- path: string;
33
- source: string;
34
- hash: string;
35
- }>;
36
- /**
37
- * The exact source `virtual:animus/system-props` serves for the current state.
38
- * One definition, so the served bytes and the change decision below can never
39
- * be computed from different inputs.
40
- *
41
- * A real context carries the module already generated (`systemPropsModuleMemo`,
42
- * refreshed wherever the four inputs move), so serving it and deciding whether
43
- * it changed are both reads. Contexts that publish those inputs by hand — the
44
- * behavioral test doubles — carry no memo and generate here instead.
45
- */
6
+ /** Runs `task` after every analysis transaction already scheduled for this
7
+ * context. Entry points only — a nested call waits on its own chain. */
8
+ export declare function runExclusiveAnalysis<T>(ctx: PluginContext, task: () => Promise<T>): Promise<T>;
9
+ /** The exact source `virtual:animus/system-props` serves now — one definition,
10
+ * so the served bytes and the HMR change decision cannot diverge. */
46
11
  export declare function systemPropsModuleSource(ctx: PluginContext): string;
47
- /**
48
- * Drop a deleted (or renamed-away) file from the dev file cache so its
49
- * last-known source stops riding along as a ghost entry on every later
50
- * re-analysis. Both key forms are tried: the plain rootDir-relative path, and
51
- * the `.tsx` suffix MDX sources carry after preprocessing. External package
52
- * entries are rootDir-relative too (with leading `..` segments) and prune the
53
- * same way. Returns whether an entry was actually removed.
54
- */
12
+ /** Drop a deleted or renamed-away raw original from the dev file cache.
13
+ * Generated MDX/Svelte children live only in the published corpus. */
55
14
  export declare function pruneFileCache(cache: Map<string, {
56
15
  hash: string;
57
16
  source: string;
58
17
  }>, rootDir: string, absPath: string): boolean;
59
- /**
60
- * Per-plugin-instance state and the pipeline operations over it. Hook
61
- * bodies live in their own modules (build-start, virtual-modules,
62
- * transform, hmr) and receive this context — the plugin factory in
63
- * index.ts only wires Vite hooks to those functions.
64
- *
65
- * A class rather than closure variables so each hook module names exactly
66
- * the state it touches, and the engine store (per-instance, never
67
- * module-level) is explicit.
68
- */
69
18
  export declare class PluginContext {
70
19
  readonly options: AnimusExtractOptions;
71
20
  readonly verbose: boolean;
72
- /** Serialized staticCss forced-emission declarations (stable key order). */
73
21
  readonly staticCssJson: string | null;
74
22
  isProd: boolean;
23
+ /** Emission mode (the explicit `mode` option wins over the command); feeds
24
+ * engine devMode and the minify default. Lifecycle stays on `isProd`. */
25
+ emissionProd: boolean;
75
26
  rootDir: string;
76
27
  logger: Logger | null;
77
- /** System-derived config (shared SystemConfig shape). */
78
28
  system: SystemConfig;
79
29
  lcssTargets: LightningTargets;
80
30
  pathAliasesJson: string | null;
81
31
  extensionsSet: ReadonlySet<string>;
82
- storedManifest: any;
32
+ excludeMatcher: ExcludeMatcher;
33
+ storedManifest: ProjectManifest | null;
83
34
  storedManifestJson: string;
84
35
  globalCss: string;
85
36
  resolvedComponentCss: string;
86
- storedSheets: CssSheets | null;
37
+ storedSheets: ManifestSheets | null;
87
38
  layerDeclaration: string;
88
39
  transformOutputHashes: Map<string, string>;
89
40
  recordTransformOutput(relativePath: string, code: string): void;
90
- /**
91
- * The consumer system's OWN keyframes collections, captured at load time
92
- * before any external merge touches `system.keyframesJson`. Every
93
- * `applyExternalKeyframes` merge starts from this baseline, so repeated
94
- * merges (a --watch rebuild's loadSystem + rediscovery, a geological
95
- * reset) never compound prior external state — a removed include's
96
- * keyframes disappear with it.
97
- */
98
- private consumerKeyframesJson;
99
- /**
100
- * Merge `Keyframes` collections from discovered external package entries
101
- * into the system's collections (keyframes-only carve-out — the consumer
102
- * system stays the singular config authority). Runs after buildStart
103
- * discovery AND after every geological-reset system reload, since a reload
104
- * rebuilds `this.system` from the consumer entry alone. Merges from the
105
- * consumer-only baseline, never from the previously merged value.
106
- */
107
- applyExternalKeyframes(): void;
108
- /** Discovery-time keyframes diagnostics awaiting the next analysis's
109
- * shared surfacing pass. */
110
- externalKeyframesDiagnostics: ManifestDiagnostic[];
41
+ /** Vocabulary witnesses from the sealed system, awaiting the next analysis.
42
+ * Surfacing happens only inside `runProjectAnalysis`. */
43
+ systemVocabularyDiagnostics: ManifestDiagnostic[];
111
44
  reverseProvenance: Record<string, string[]>;
112
45
  storedSystemPropMapJson: string;
113
46
  storedDynamicPropsJson: string;
114
47
  storedTransformsSource: string;
115
- systemPropsModuleMemo: string | null;
116
- fileCache: Map<string, {
48
+ readonly fileCache: ReadonlyMap<string, {
117
49
  hash: string;
118
50
  source: string;
119
51
  }>;
52
+ /** Mutation attempts against `fileCache`, for memos that must not key on
53
+ * `size` — a delete plus an unrelated create leaves it unchanged. */
54
+ fileCacheGeneration: number;
55
+ /** The one mutator of the raw-source cache: every add, replacement and
56
+ * deletion goes through here so no write escapes the counter above. */
57
+ mutateFileCache<T>(mutate: (cache: Map<string, {
58
+ hash: string;
59
+ source: string;
60
+ }>) => T): T;
61
+ /** Generated MDX/Svelte paths never enter `fileCache` — they live only in
62
+ * this corpus's published projection. */
63
+ readonly corpus: SourceCorpus;
120
64
  rawExtensionFallbacks: Set<string>;
65
+ /** The one mutator of a file's fallback state — every raw-serve exit of the
66
+ * transform hook reports here. Production keeps the set empty. The
67
+ * barrier's one-shot withhold release must not route through here: it
68
+ * retires other files' records, no claim about their current serve. */
69
+ recordFallbackState(relativePath: string, isFallback: boolean): void;
121
70
  readonly hotUpdateEvents: HotUpdateEvents;
122
71
  private pendingReloadTimer;
123
72
  packageMap: Record<string, string>;
@@ -129,7 +78,6 @@ export declare class PluginContext {
129
78
  externalDirOwners: Record<string, string>;
130
79
  externalFileOwners: Record<string, string>;
131
80
  externalSourceEntries: Map<string, string>;
132
- externalKeyframesScanEntries: Map<string, string>;
133
81
  externalPackageOutcomes: ExternalPackageOutcome[];
134
82
  devServer: any;
135
83
  resolvedSystemPath: string | null;
@@ -138,136 +86,58 @@ export declare class PluginContext {
138
86
  private v2Engine;
139
87
  private v2SentSources;
140
88
  private v2DriftWarned;
141
- /** Single engine choke-point for every native extraction call. */
89
+ /** Every native extraction call goes through this one accessor. */
142
90
  readonly engineApi: () => any;
143
91
  constructor(options: AnimusExtractOptions, engineApiOverride?: () => any);
144
92
  log(msg: string): void;
145
- /**
146
- * Standard-level information — emitted whether or not `verbose` is on.
147
- * Reserved for events a developer must see without opting in, e.g. a file
148
- * created after buildStart being folded into the analysis (openspec:
149
- * hmr-new-file-detection, "New file detection logging").
150
- */
93
+ /** Logs whether or not `verbose` is on — for events a developer must see
94
+ * without opting in. */
151
95
  info(msg: string): void;
152
96
  warn(msg: string): void;
153
97
  logTimingWaterfall(timing: Record<string, number>): void;
154
- /**
155
- * Load a SystemInstance via Rust NAPI (rquickjs bundled eval) into
156
- * `this.system`. On failure the previous config is kept (strict mode
157
- * throws instead).
158
- */
98
+ /** Load the system into `this.system`. On failure the previous config is
99
+ * kept; strict mode throws instead. */
159
100
  loadSystem(): void;
160
- /**
161
- * Run project analysis via the shared `runProjectAnalysis` and update
162
- * all manifest-derived state. Returns whether the analysis PUBLISHED —
163
- * `false` means the previous manifest is still current, and callers that
164
- * advanced the file cache for this attempt must roll that entry back or
165
- * the content-hash gate will suppress the same-content retry forever
166
- * (openspec: dev-transform-coherence, "Failed analyses do not suppress
167
- * equal-content retries"). Strict mode still throws.
168
- */
101
+ /** Runs project analysis and updates every manifest-derived state. Returns
102
+ * false when nothing published, and the caller must roll its cache back. */
169
103
  runAnalysis(fileEntries: Array<{
170
104
  path: string;
171
105
  source: string;
172
106
  hash?: string;
173
107
  }>): boolean;
174
- /** Base-prefixed dev URL for an absolute file (Vite mounts /@fs under base). */
108
+ private assertRuntimeImportSuppliesTerminals;
109
+ /** The one ingest → quarantine → analyze → publish transaction. The corpus
110
+ * publishes only on success; `beforeAnalysis` runs after quarantine. */
111
+ analyzeIngested(options?: {
112
+ rawEntries?: readonly RawSourceEntry[];
113
+ beforeAnalysis?: (accepted: SourceIngestionResult) => void;
114
+ }): Promise<{
115
+ ok: boolean;
116
+ accepted: SourceIngestionResult;
117
+ }>;
118
+ publishSourceIngestion(result: SourceIngestionResult): void;
175
119
  devFsUrl(absPath: string): string;
176
- /**
177
- * The shared unresolvable-asset policy: fail the build under `strict`,
178
- * else warn and record the identity mapping so the specifier emits
179
- * literally.
180
- */
181
120
  assetFallback(specifier: string, message: string, cause?: unknown): void;
182
- /**
183
- * The one asset-substitution pass per analysis. In dev, a specifier not
184
- * already mapped by buildStart's bundler-resolved pass (a geological
185
- * reset regenerates globalCss from an edited system, which may reference
186
- * NEW assets) is resolved Node-side first — host aliases, then Node,
187
- * then package root; bundler-only resolutions can differ, since the
188
- * plugin hook context is unavailable on this path. Strict semantics
189
- * match buildStart.
190
- */
121
+ /** Resolves asset specifiers a system reload introduced. Node-side only —
122
+ * the plugin hook context is unavailable here, so results can differ. */
191
123
  private applyAssetSubstitutions;
192
124
  private resetCoalescer;
193
- /**
194
- * Schedule a geological reset through the burst coalescer. N dependency
195
- * events within the quiescence window produce one reset; events during a
196
- * running reset produce exactly one follow-up.
197
- */
198
- requestGeologicalReset(trigger: string): void;
199
- /**
200
- * A failed reset must surface without killing the server: the coalescer
201
- * fires from a bare timer, OUTSIDE Vite's handleHMRUpdate catch, so a
202
- * strict-mode throw (asset resolution, token contracts, system load)
203
- * would otherwise be an unhandled exception that exits the process.
204
- * Strict-in-dev means the error overlay, matching the transform/HMR
205
- * strict paths that Vite itself catches.
206
- */
207
- private geologicalResetFailed;
208
- /**
209
- * The geological reset: reload the system (refreshing the dependency
210
- * set), clear the Rust per-file cache, re-analyze everything with full
211
- * sources, then invalidate the static/component/system-prop virtual
212
- * modules and reload the client.
213
- */
214
- performGeologicalReset(): void;
215
- /**
216
- * True when the file is a member of the system's evaluated module-file
217
- * set. Tested BEFORE component-scan exclude filters: a system dependency
218
- * edit invalidates the compiler registry regardless of what the user
219
- * excluded from component scanning.
220
- */
125
+ requestSystemReload(trigger: string): void;
126
+ performSystemReload(): Promise<void>;
127
+ private performSystemReloadExclusive;
128
+ private invalidateSystemReloadModules;
221
129
  isSystemDependency(absFile: string): boolean;
222
- /**
223
- * Ask the dev watcher to watch every loader-reported dependency path.
224
- * Covers system modules unreachable from app imports (workspace package
225
- * config files). Vite's watcher hard-ignores `node_modules`, so
226
- * node_modules-installed system dependencies produce no events — a
227
- * documented limitation; workspace deps resolve to real paths outside
228
- * node_modules and are watchable. No-ops without a dev server.
229
- */
130
+ /** Watch every loader-reported dependency path. Vite hard-ignores
131
+ * node_modules, so dependencies installed there produce no events. */
230
132
  registerSystemWatchPaths(): void;
231
- /**
232
- * Invalidate the component CSS and system-props virtual modules, then
233
- * reload the client. Shared by the two out-of-band re-analysis paths — a
234
- * file created after buildStart (transform) and a file deleted during dev
235
- * (the `hotUpdate` delete event) — which both mutate the cache, re-run
236
- * analysis, and then need the client to pick up the regenerated CSS.
237
- * No-ops outside dev.
238
- *
239
- * `devServer.moduleGraph` is Vite's back-compat mixed graph: its
240
- * `getModuleById` searches the client AND ssr environment graphs and its
241
- * `invalidateModule` invalidates both instances behind the returned node,
242
- * which is exactly the reach this path wants. It stays the seam here.
243
- *
244
- * Both modules are invalidated unconditionally, and deliberately so: the
245
- * appearance or disappearance of a whole component file is not the
246
- * steady-state edit the change-gated path governs, and a client reload does
247
- * NOT rescue a module that was never invalidated — Vite keeps serving its
248
- * cached transform result across reloads (openspec: hmr-new-file-detection,
249
- * "CSS invalidation after new file analysis").
250
- */
133
+ /** Invalidate the component CSS and system-props modules, then reload. The
134
+ * reload alone rescues nothing: Vite keeps serving its cached transform.
135
+ * `devServer.moduleGraph` is the mixed back-compat graph on purpose — it
136
+ * reaches client and ssr at once; per-environment graphs do not. */
251
137
  invalidateExtractedModules(): void;
252
- /**
253
- * The buildStart gate over include resolution
254
- * (external-package-file-discovery: silence is never an outcome). An
255
- * unresolvable `.includes()` specifier warns in non-strict mode and FAILS
256
- * the build under `strict: true`, naming every offending specifier —
257
- * a typo'd include must not ship a build missing its component CSS. A
258
- * stale dist entry under an extended package (first-class-extension D13)
259
- * rides the same seam: a merge against it would silently skew registry
260
- * content the discovered sources no longer match.
261
- */
138
+ /** An unresolvable `.includes()` specifier or a stale dist entry under an
139
+ * extended package warns, and fails the build under `strict`. */
262
140
  enforceIncludeResolution(): void;
263
- /**
264
- * The post-analysis gate over cross-source token contracts
265
- * (extraction-diagnostics): a discovered component referencing a token its
266
- * OWN package defines but the consumer theme does not gets the teaching
267
- * error naming the token, component, source package, and the missing
268
- * `createTheme().extend(...)`. Wiring and severity routing live in the
269
- * shared pipeline gate (next-plugin parity by construction).
270
- */
271
141
  enforceExternalTokenContracts(): void;
272
142
  runSelfVerify(): void;
273
143
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,oB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AC,uBAAuB;IA4B/B,OAAO,CAAC,cAAc,CAA+B;IAErD,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAkBzC;IAEK,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAIzC;YAEa,4BAA4B;IA0B1C,OAAO,CAAC,6BAA6B;IAcrC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI3C;IAED;2EACuE;IACvE,wBAAwB,IAAI,IAAI,CAS/B;IAED;;;yEAGqE;IACrE,0BAA0B,IAAI,IAAI,CAkBjC;IAED;sEACkE;IAClE,wBAAwB,IAAI,IAAI,CAW/B;IAED,6BAA6B,IAAI,IAAI,CAUpC;IAED,aAAa,IAAI,IAAI,CAyBpB;CACF"}
package/dist/css.d.ts CHANGED
@@ -1,9 +1,3 @@
1
- /**
2
- * CSS post-processing — the implementation lives in
3
- * `@animus-ui/extract/pipeline` (spec: css-post-processing, single
4
- * implementation across plugins). This module re-exports it for the
5
- * plugin's hook modules.
6
- */
7
1
  export type { LightningTargets } from '@animus-ui/extract/pipeline';
8
2
  export { postProcessCss, resolveLightningTargets, } from '@animus-ui/extract/pipeline';
9
3
  //# sourceMappingURL=css.d.ts.map
package/dist/css.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EACL,cAAc,EACd,uBAAuB,GACxB,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EACL,cAAc,EACd,uBAAuB,GACxB,MAAM,6BAA6B,CAAC"}
package/dist/hmr.d.ts CHANGED
@@ -1,23 +1,6 @@
1
1
  import type { PluginContext } from './context';
2
2
  import type { DevEnvironment, EnvironmentModuleNode, HotUpdateOptions } from 'vite';
3
- /**
4
- * hotUpdate: the single dev file-event hook. Handles system-dependency
5
- * membership (geological reset), content-hash diffing with incremental
6
- * re-analysis, deleted-file cache pruning, and targeted module invalidation
7
- * (component CSS, system props, and definition files whose replacement
8
- * changed).
9
- *
10
- * Vite 8 dispatches this hook once per environment for ONE file event — the
11
- * client environment first, then every non-client environment (see
12
- * `handleHMRUpdate` in vite/dist/node/chunks/node.js). The analysis half is
13
- * therefore claimed by exactly one dispatch (`ctx.hotUpdateEvents`), while the
14
- * invalidation half runs in every environment against its own module graph —
15
- * what the mixed-graph `handleHotUpdate` used to achieve implicitly by
16
- * invalidating the client and SSR instance behind one module node.
17
- *
18
- * The hook fires for every watched file whether or not it has modules in any
19
- * graph, so system dependencies registered through `watcher.add` outside the
20
- * root still reach the reset branch, with an empty `modules` list.
21
- */
22
- export declare function handleHotUpdate(ctx: PluginContext, environment: DevEnvironment, { type, file, timestamp, modules, read }: HotUpdateOptions): Promise<EnvironmentModuleNode[] | void>;
3
+ /** Vite dispatches this hook once per environment for one file event: the
4
+ * analysis half is claimed by one dispatch, invalidation runs in each. */
5
+ export declare function handleHotUpdate(ctx: PluginContext, environment: DevEnvironment, options: HotUpdateOptions): Promise<EnvironmentModuleNode[] | void>;
23
6
  //# sourceMappingURL=hmr.d.ts.map
package/dist/hmr.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,MAAM,CAAC;AAEd;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,aAAa,EAClB,WAAW,EAAE,cAAc,EAC3B,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,gBAAgB,GACzD,OAAO,CAAC,qBAAqB,EAAE,GAAG,IAAI,CAAC,CA8EzC"}
1
+ {"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,MAAM,CAAC;AAEd;2EAC2E;AAC3E,wBAAsB,eAAe,CACnC,GAAG,EAAE,aAAa,EAClB,WAAW,EAAE,cAAc,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,qBAAqB,EAAE,GAAG,IAAI,CAAC,CAKzC"}
@@ -1,31 +1,11 @@
1
1
  /**
2
- * What the owning dispatch decided for one file event, so the remaining
3
- * environments act on the same decision instead of re-deriving it from state
4
- * the owner already mutated.
5
- *
6
- * - `ignored` — out of extraction scope (extension gate, exclude pattern,
7
- * unreadable, MDX skipped): normal Vite HMR applies.
8
- * - `unchanged` — content hash identical: the update is suppressed everywhere.
9
- * - `analyzed` — re-analysis ran; every environment invalidates the affected
10
- * modules in its own graph. `staleDefinitionFiles` are rootDir-relative
11
- * definition files whose component replacement changed (the changed file
12
- * itself is never listed). `systemPropsChanged` reports whether the served
13
- * system-props module moved (see the transaction-spanning compare in
14
- * hmr.ts `analyzeChangedFile`) — only the owning dispatch holds the
15
- * before/after values, so it travels with the decision rather than being
16
- * re-derived per environment.
17
- * `presentationOnly` reports that the changed file's transform output is
18
- * byte-identical before and after the edit (style values are not part of
19
- * the emitted replacement — class names hash `filename::binding`): every
20
- * environment then excludes the file's own modules from the update it
21
- * returns, so the module never re-executes and React component identity,
22
- * generated IDs, focus, and DOM-owned state survive the edit. Computed once
23
- * by the owning dispatch (it needs the pre-edit source and manifest, which
24
- * the owner consumed while re-analyzing) — the same travel rule as
25
- * `systemPropsChanged`.
2
+ * What the owning dispatch decided for one file event. `evicted` is a lost
3
+ * decision for an in-scope file, so each environment invalidates broadly.
26
4
  */
27
5
  export type HotUpdateResult = {
28
6
  kind: 'ignored';
7
+ } | {
8
+ kind: 'evicted';
29
9
  } | {
30
10
  kind: 'unchanged';
31
11
  } | {
@@ -35,35 +15,25 @@ export type HotUpdateResult = {
35
15
  presentationOnly: boolean;
36
16
  };
37
17
  /**
38
- * Once-per-file-event coordination across the `hotUpdate` dispatches.
39
- *
40
- * Vite 8 calls `hotUpdate` once per environment for a single file event — the
41
- * client environment first, then every non-client environment (see
42
- * `handleHMRUpdate` in vite/dist/node/chunks/node.js). Analysis work (cache
43
- * mutation, engine re-analysis, geological reset scheduling) must happen
44
- * exactly once per event; module invalidation must happen per environment
45
- * against that environment's own graph.
46
- *
47
- * The client dispatch always claims — it is dispatched first, so nothing can
48
- * have claimed the event before it, and claiming unconditionally keeps a
49
- * same-millisecond `(file, timestamp)` collision from ever costing a client
50
- * analysis. A non-client dispatch claims only when the event carries no
51
- * recorded claim at all, which happens when the plugin is filtered out of the
52
- * client environment.
53
- *
54
- * Keys are retained for a bounded number of recent events so that interleaved
55
- * file events (Vite does not serialize watcher handlers) still find their own
56
- * result.
18
+ * Vite dispatches `hotUpdate` once per environment, client first: analysis
19
+ * runs for one dispatch, invalidation for all, coordinated through these keys.
57
20
  */
58
21
  export declare class HotUpdateEvents {
59
22
  private readonly historyLimit;
60
23
  private readonly results;
24
+ /** Keys whose decision aged out of `results`, in eviction order. */
25
+ private readonly evicted;
61
26
  constructor(historyLimit?: number);
62
27
  /** True when this environment dispatch owns the event's analysis work. */
63
28
  claim(environmentName: string, file: string, timestamp: number): boolean;
64
29
  /** Publish the owning dispatch's decision to the other environments. */
65
30
  record(file: string, timestamp: number, result: HotUpdateResult): void;
66
- /** The decision for this event — `ignored` when the event was evicted. */
31
+ /**
32
+ * The decision for this event — `evicted` once it aged out of the decision
33
+ * window, `ignored` only when no dispatch ever claimed it.
34
+ */
67
35
  resultOf(file: string, timestamp: number): HotUpdateResult;
36
+ /** Hold both windows at `historyLimit`, oldest insertion first. */
37
+ private retireOldest;
68
38
  }
69
39
  //# sourceMappingURL=hot-update-events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hot-update-events.d.ts","sourceRoot":"","sources":["../src/hot-update-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,eAAe;IAGd,OAAO,CAAC,QAAQ,CAAC,YAAY;IAFzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;IAE9D,YAA6B,YAAY,SAAK,EAAI;IAElD,0EAA0E;IAC1E,KAAK,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAUvE;IAED,wEAAwE;IACxE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAErE;IAED,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,CAEzD;CACF"}
1
+ {"version":3,"file":"hot-update-events.d.ts","sourceRoot":"","sources":["../src/hot-update-events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEN;;;GAGG;AACH,qBAAa,eAAe;IAKd,OAAO,CAAC,QAAQ,CAAC,YAAY;IAJzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;IAC9D,oEAAoE;IACpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAE7C,YAA6B,YAAY,SAAK,EAAI;IAElD,0EAA0E;IAC1E,KAAK,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAgBvE;IAED,wEAAwE;IACxE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAOrE;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,CAKzD;IAED,mEAAmE;IACnE,OAAO,CAAC,YAAY;CAarB"}
@@ -1,29 +1,8 @@
1
1
  import type { PluginContext } from './context';
2
2
  import type { HtmlTagDescriptor } from 'vite';
3
3
  /**
4
- * transformIndexHtml: build the head-prepend tag set.
5
- *
6
- * Three independent tags, all delivery-only:
7
- * - the appearance bootstrap script, when the host build passed a
8
- * pre-generated artifact via `appearanceBootstrap` (absent otherwise);
9
- * - the `@layer` declaration style, when `buildStart` computed one;
10
- * - the HMR bridge module script, in dev only.
11
- *
12
- * The two build-time branches are guarded on non-empty CONTENT, not on mere
13
- * presence: an artifact whose `code` is empty is a caller defect, and emitting
14
- * `<script data-animus-bootstrap></script>` for it would break the
15
- * unconfigured-parity contract in spirit (a tag that does nothing) while
16
- * hiding the defect. Symmetric with `layerDeclaration`. The bridge has no
17
- * content of its own — it is a `src` reference — so its only guard is the mode.
18
- *
19
- * Ordering: every descriptor rides the same `head-prepend` bucket, which Vite
20
- * serializes in array order (`serializeTags`) and splices in immediately after
21
- * `<head>`. The bootstrap script is therefore FIRST in the array so it runs
22
- * before the layer declaration and — since built stylesheet links are appended
23
- * at `</head>` — before any stylesheet reference.
24
- *
25
- * With neither build-time input set, a production build emits no tag,
26
- * attribute, or whitespace of its own.
4
+ * Vite serializes one `head-prepend` bucket in array order, so the bootstrap
5
+ * script precedes the layer declaration and every stylesheet reference.
27
6
  */
28
7
  export declare function buildIndexHtmlTags(ctx: PluginContext): HtmlTagDescriptor[];
29
8
  //# sourceMappingURL=index-html.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-html.d.ts","sourceRoot":"","sources":["../src/index-html.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,iBAAiB,EAAE,CAyD1E"}
1
+ {"version":3,"file":"index-html.d.ts","sourceRoot":"","sources":["../src/index-html.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,iBAAiB,EAAE,CAqC1E"}