@animus-ui/vite-plugin 0.1.11 → 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 +1 -0
- package/dist/build-start.d.ts +2 -6
- package/dist/build-start.d.ts.map +1 -1
- package/dist/config.d.ts +0 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +4 -16
- package/dist/constants.d.ts.map +1 -1
- package/dist/context.d.ts +54 -233
- package/dist/context.d.ts.map +1 -1
- package/dist/css.d.ts +0 -6
- package/dist/css.d.ts.map +1 -1
- package/dist/hmr.d.ts +2 -19
- package/dist/hmr.d.ts.map +1 -1
- package/dist/hot-update-events.d.ts +14 -44
- package/dist/hot-update-events.d.ts.map +1 -1
- package/dist/index-html.d.ts +2 -23
- package/dist/index-html.d.ts.map +1 -1
- package/dist/index.cjs +315 -622
- package/dist/index.d.ts +25 -92
- package/dist/index.d.ts.map +1 -1
- package/dist/module-invalidation.d.ts +2 -10
- package/dist/module-invalidation.d.ts.map +1 -1
- package/dist/rediscovery.d.ts +6 -24
- package/dist/rediscovery.d.ts.map +1 -1
- package/dist/reset-coalescer.d.ts +6 -8
- package/dist/reset-coalescer.d.ts.map +1 -1
- package/dist/transform.d.ts +2 -16
- package/dist/transform.d.ts.map +1 -1
- package/dist/virtual-modules.d.ts +0 -3
- package/dist/virtual-modules.d.ts.map +1 -1
- package/package.json +7 -4
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
|
|
package/dist/build-start.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { PluginContext } from './context';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
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":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C
|
|
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
|
package/dist/config.d.ts.map
CHANGED
|
@@ -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
|
|
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"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The namespace every virtual module
|
|
3
|
-
*
|
|
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,18 +10,8 @@ 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
|
-
*
|
|
16
|
-
*
|
|
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";
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA
|
|
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,130 +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 { ExcludeMatcher, ExternalPackageOutcome, ManifestDiagnostic,
|
|
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
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
/** Full raw originals for one adaptation attempt. */
|
|
22
|
-
export declare function buildRawEntriesFromCache(cache: Map<string, {
|
|
23
|
-
hash: string;
|
|
24
|
-
source: string;
|
|
25
|
-
}>): Array<{
|
|
26
|
-
path: string;
|
|
27
|
-
source: string;
|
|
28
|
-
hash: string;
|
|
29
|
-
}>;
|
|
30
|
-
/** Run `task` after every previously scheduled analysis transaction for
|
|
31
|
-
* this context. Entry points only (transform detection, hot update,
|
|
32
|
-
* geological reset); helpers they call internally must stay unlocked. */
|
|
33
|
-
export declare function runExclusiveAnalysis<T>(ctx: object, task: () => Promise<T>): Promise<T>;
|
|
34
|
-
/**
|
|
35
|
-
* The exact source `virtual:animus/system-props` serves for the current state.
|
|
36
|
-
* One definition, so the served bytes and the change decision below can never
|
|
37
|
-
* be computed from different inputs.
|
|
38
|
-
*
|
|
39
|
-
* A real context carries the module already generated (`systemPropsModuleMemo`,
|
|
40
|
-
* refreshed wherever the four inputs move), so serving it and deciding whether
|
|
41
|
-
* it changed are both reads. Contexts that publish those inputs by hand — the
|
|
42
|
-
* behavioral test doubles — carry no memo and generate here instead.
|
|
43
|
-
*/
|
|
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. */
|
|
44
11
|
export declare function systemPropsModuleSource(ctx: PluginContext): string;
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* Generated MDX/Svelte children live in `analysisEntryCache` and disappear
|
|
48
|
-
* atomically when the next source-ingestion result publishes. External
|
|
49
|
-
* package entries are rootDir-relative too (with leading `..` segments).
|
|
50
|
-
*/
|
|
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. */
|
|
51
14
|
export declare function pruneFileCache(cache: Map<string, {
|
|
52
15
|
hash: string;
|
|
53
16
|
source: string;
|
|
54
17
|
}>, rootDir: string, absPath: string): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Per-plugin-instance state and the pipeline operations over it. Hook
|
|
57
|
-
* bodies live in their own modules (build-start, virtual-modules,
|
|
58
|
-
* transform, hmr) and receive this context — the plugin factory in
|
|
59
|
-
* index.ts only wires Vite hooks to those functions.
|
|
60
|
-
*
|
|
61
|
-
* A class rather than closure variables so each hook module names exactly
|
|
62
|
-
* the state it touches, and the engine store (per-instance, never
|
|
63
|
-
* module-level) is explicit.
|
|
64
|
-
*/
|
|
65
18
|
export declare class PluginContext {
|
|
66
19
|
readonly options: AnimusExtractOptions;
|
|
67
20
|
readonly verbose: boolean;
|
|
68
|
-
/** Serialized staticCss forced-emission declarations (stable key order). */
|
|
69
21
|
readonly staticCssJson: string | null;
|
|
70
22
|
isProd: boolean;
|
|
71
|
-
/** Emission
|
|
72
|
-
*
|
|
73
|
-
* `isProd`. */
|
|
23
|
+
/** Emission mode (the explicit `mode` option wins over the command); feeds
|
|
24
|
+
* engine devMode and the minify default. Lifecycle stays on `isProd`. */
|
|
74
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
32
|
excludeMatcher: ExcludeMatcher;
|
|
83
|
-
storedManifest:
|
|
33
|
+
storedManifest: ProjectManifest | null;
|
|
84
34
|
storedManifestJson: string;
|
|
85
35
|
globalCss: string;
|
|
86
36
|
resolvedComponentCss: string;
|
|
87
|
-
storedSheets:
|
|
37
|
+
storedSheets: ManifestSheets | null;
|
|
88
38
|
layerDeclaration: string;
|
|
89
39
|
transformOutputHashes: Map<string, string>;
|
|
90
40
|
recordTransformOutput(relativePath: string, code: string): void;
|
|
91
|
-
/**
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
* `applyExternalKeyframes` merge starts from this baseline, so repeated
|
|
95
|
-
* merges (a --watch rebuild's loadSystem + rediscovery, a geological
|
|
96
|
-
* reset) never compound prior external state — a removed include's
|
|
97
|
-
* keyframes disappear with it.
|
|
98
|
-
*/
|
|
99
|
-
private consumerKeyframesJson;
|
|
100
|
-
/**
|
|
101
|
-
* Merge `Keyframes` collections from discovered external package entries
|
|
102
|
-
* into the system's collections (keyframes-only carve-out — the consumer
|
|
103
|
-
* system stays the singular config authority). Runs after buildStart
|
|
104
|
-
* discovery AND after every geological-reset system reload, since a reload
|
|
105
|
-
* rebuilds `this.system` from the consumer entry alone. Merges from the
|
|
106
|
-
* consumer-only baseline, never from the previously merged value.
|
|
107
|
-
*/
|
|
108
|
-
applyExternalKeyframes(): void;
|
|
109
|
-
/** Discovery-time keyframes diagnostics awaiting the next analysis's
|
|
110
|
-
* shared surfacing pass. */
|
|
111
|
-
externalKeyframesDiagnostics: ManifestDiagnostic[];
|
|
41
|
+
/** Vocabulary witnesses from the sealed system, awaiting the next analysis.
|
|
42
|
+
* Surfacing happens only inside `runProjectAnalysis`. */
|
|
43
|
+
systemVocabularyDiagnostics: ManifestDiagnostic[];
|
|
112
44
|
reverseProvenance: Record<string, string[]>;
|
|
113
45
|
storedSystemPropMapJson: string;
|
|
114
46
|
storedDynamicPropsJson: string;
|
|
115
47
|
storedTransformsSource: string;
|
|
116
|
-
|
|
117
|
-
fileCache: Map<string, {
|
|
48
|
+
readonly fileCache: ReadonlyMap<string, {
|
|
118
49
|
hash: string;
|
|
119
50
|
source: string;
|
|
120
51
|
}>;
|
|
121
|
-
|
|
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, {
|
|
122
58
|
hash: string;
|
|
123
59
|
source: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
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;
|
|
127
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;
|
|
128
70
|
readonly hotUpdateEvents: HotUpdateEvents;
|
|
129
71
|
private pendingReloadTimer;
|
|
130
72
|
packageMap: Record<string, string>;
|
|
@@ -136,7 +78,6 @@ export declare class PluginContext {
|
|
|
136
78
|
externalDirOwners: Record<string, string>;
|
|
137
79
|
externalFileOwners: Record<string, string>;
|
|
138
80
|
externalSourceEntries: Map<string, string>;
|
|
139
|
-
externalKeyframesScanEntries: Map<string, string>;
|
|
140
81
|
externalPackageOutcomes: ExternalPackageOutcome[];
|
|
141
82
|
devServer: any;
|
|
142
83
|
resolvedSystemPath: string | null;
|
|
@@ -145,70 +86,28 @@ export declare class PluginContext {
|
|
|
145
86
|
private v2Engine;
|
|
146
87
|
private v2SentSources;
|
|
147
88
|
private v2DriftWarned;
|
|
148
|
-
/**
|
|
89
|
+
/** Every native extraction call goes through this one accessor. */
|
|
149
90
|
readonly engineApi: () => any;
|
|
150
91
|
constructor(options: AnimusExtractOptions, engineApiOverride?: () => any);
|
|
151
92
|
log(msg: string): void;
|
|
152
|
-
/**
|
|
153
|
-
*
|
|
154
|
-
* Reserved for events a developer must see without opting in, e.g. a file
|
|
155
|
-
* created after buildStart being folded into the analysis (openspec:
|
|
156
|
-
* hmr-new-file-detection, "New file detection logging").
|
|
157
|
-
*/
|
|
93
|
+
/** Logs whether or not `verbose` is on — for events a developer must see
|
|
94
|
+
* without opting in. */
|
|
158
95
|
info(msg: string): void;
|
|
159
96
|
warn(msg: string): void;
|
|
160
97
|
logTimingWaterfall(timing: Record<string, number>): void;
|
|
161
|
-
/**
|
|
162
|
-
*
|
|
163
|
-
* `this.system`. On failure the previous config is kept (strict mode
|
|
164
|
-
* throws instead).
|
|
165
|
-
*/
|
|
98
|
+
/** Load the system into `this.system`. On failure the previous config is
|
|
99
|
+
* kept; strict mode throws instead. */
|
|
166
100
|
loadSystem(): void;
|
|
167
|
-
/**
|
|
168
|
-
*
|
|
169
|
-
* all manifest-derived state. Returns whether the analysis PUBLISHED —
|
|
170
|
-
* `false` means the previous manifest is still current, and callers that
|
|
171
|
-
* advanced the file cache for this attempt must roll that entry back or
|
|
172
|
-
* the content-hash gate will suppress the same-content retry forever
|
|
173
|
-
* (openspec: dev-transform-coherence, "Failed analyses do not suppress
|
|
174
|
-
* equal-content retries"). Strict mode still throws.
|
|
175
|
-
*/
|
|
101
|
+
/** Runs project analysis and updates every manifest-derived state. Returns
|
|
102
|
+
* false when nothing published, and the caller must roll its cache back. */
|
|
176
103
|
runAnalysis(fileEntries: Array<{
|
|
177
104
|
path: string;
|
|
178
105
|
source: string;
|
|
179
106
|
hash?: string;
|
|
180
107
|
}>): boolean;
|
|
181
|
-
/**
|
|
182
|
-
* `runtimeImport` swaps ONE module specifier under every generated
|
|
183
|
-
* factory import, and the engine performs no export validation — an
|
|
184
|
-
* override that supplies only `createClassResolver` (the documented
|
|
185
|
-
* class-resolver entry contract) breaks the bundle at LOAD the moment any
|
|
186
|
-
* non-`.asClass()` terminal exists, with the error pointing at generated
|
|
187
|
-
* code. Guaranteed-broken output escalates in every mode, exactly like
|
|
188
|
-
* error diagnostics (extraction-diagnostics §Error diagnostics fail the
|
|
189
|
-
* build), naming the offending components instead of the import site.
|
|
190
|
-
*/
|
|
191
108
|
private assertRuntimeImportSuppliesTerminals;
|
|
192
|
-
/** The
|
|
193
|
-
*
|
|
194
|
-
private sourceIngestor;
|
|
195
|
-
/** Prepare one raw-source corpus through the shared adaptation boundary. */
|
|
196
|
-
ingestRawSources(fileEntries: readonly RawSourceEntry[]): Promise<SourceIngestionResult>;
|
|
197
|
-
/** Surface adapter diagnostics under the shared strict/warn policy. */
|
|
198
|
-
surfaceSourceDiagnostics(diagnostics: readonly SourceIngestionDiagnostic[]): Set<string>;
|
|
199
|
-
/**
|
|
200
|
-
* The one ingest → quarantine → analyze → publish transaction, shared by
|
|
201
|
-
* buildStart and every incremental path. Per-file quarantine: one invalid
|
|
202
|
-
* original warns and drops without aborting the rest of the corpus
|
|
203
|
-
* (strict mode throws from the shared policy). `runAnalysis(...) !==
|
|
204
|
-
* false` is the documented success contract (a `void` behavioral test
|
|
205
|
-
* double reads as success), and the accepted corpus publishes only on
|
|
206
|
-
* success. `beforeAnalysis` runs between quarantine and analysis for the
|
|
207
|
-
* two sites with a documented ordering constraint: buildStart's dev-cache
|
|
208
|
-
* seed must survive a strict analysis throw, and the geological reset
|
|
209
|
-
* clears the engine cache only after strict ingestion diagnostics had
|
|
210
|
-
* their chance to throw.
|
|
211
|
-
*/
|
|
109
|
+
/** The one ingest → quarantine → analyze → publish transaction. The corpus
|
|
110
|
+
* publishes only on success; `beforeAnalysis` runs after quarantine. */
|
|
212
111
|
analyzeIngested(options?: {
|
|
213
112
|
rawEntries?: readonly RawSourceEntry[];
|
|
214
113
|
beforeAnalysis?: (accepted: SourceIngestionResult) => void;
|
|
@@ -216,107 +115,29 @@ export declare class PluginContext {
|
|
|
216
115
|
ok: boolean;
|
|
217
116
|
accepted: SourceIngestionResult;
|
|
218
117
|
}>;
|
|
219
|
-
/** Publish every parser child and ownership edge atomically after analysis. */
|
|
220
118
|
publishSourceIngestion(result: SourceIngestionResult): void;
|
|
221
|
-
/** Base-prefixed dev URL for an absolute file (Vite mounts /@fs under base). */
|
|
222
119
|
devFsUrl(absPath: string): string;
|
|
223
|
-
/**
|
|
224
|
-
* The shared unresolvable-asset policy: fail the build under `strict`,
|
|
225
|
-
* else warn and record the identity mapping so the specifier emits
|
|
226
|
-
* literally.
|
|
227
|
-
*/
|
|
228
120
|
assetFallback(specifier: string, message: string, cause?: unknown): void;
|
|
229
|
-
/**
|
|
230
|
-
*
|
|
231
|
-
* already mapped by buildStart's bundler-resolved pass (a geological
|
|
232
|
-
* reset regenerates globalCss from an edited system, which may reference
|
|
233
|
-
* NEW assets) is resolved Node-side first — host aliases, then Node,
|
|
234
|
-
* then package root; bundler-only resolutions can differ, since the
|
|
235
|
-
* plugin hook context is unavailable on this path. Strict semantics
|
|
236
|
-
* match buildStart.
|
|
237
|
-
*/
|
|
121
|
+
/** Resolves asset specifiers a system reload introduced. Node-side only —
|
|
122
|
+
* the plugin hook context is unavailable here, so results can differ. */
|
|
238
123
|
private applyAssetSubstitutions;
|
|
239
124
|
private resetCoalescer;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
*/
|
|
245
|
-
requestGeologicalReset(trigger: string): void;
|
|
246
|
-
/**
|
|
247
|
-
* A failed reset must surface without killing the server: the coalescer
|
|
248
|
-
* fires from a bare timer, OUTSIDE Vite's handleHMRUpdate catch, so a
|
|
249
|
-
* strict-mode throw (asset resolution, token contracts, system load)
|
|
250
|
-
* would otherwise be an unhandled exception that exits the process.
|
|
251
|
-
* Strict-in-dev means the error overlay, matching the transform/HMR
|
|
252
|
-
* strict paths that Vite itself catches.
|
|
253
|
-
*/
|
|
254
|
-
private geologicalResetFailed;
|
|
255
|
-
/**
|
|
256
|
-
* The geological reset: reload the system (refreshing the dependency
|
|
257
|
-
* set), clear the Rust per-file cache, re-analyze everything with full
|
|
258
|
-
* sources, then invalidate the static/component/system-prop virtual
|
|
259
|
-
* modules and reload the client.
|
|
260
|
-
*/
|
|
261
|
-
performGeologicalReset(): Promise<void>;
|
|
262
|
-
private performGeologicalResetExclusive;
|
|
263
|
-
private invalidateGeologicalResetModules;
|
|
264
|
-
/**
|
|
265
|
-
* True when the file is a member of the system's evaluated module-file
|
|
266
|
-
* set. Tested BEFORE component-scan exclude filters: a system dependency
|
|
267
|
-
* edit invalidates the compiler registry regardless of what the user
|
|
268
|
-
* excluded from component scanning.
|
|
269
|
-
*/
|
|
125
|
+
requestSystemReload(trigger: string): void;
|
|
126
|
+
performSystemReload(): Promise<void>;
|
|
127
|
+
private performSystemReloadExclusive;
|
|
128
|
+
private invalidateSystemReloadModules;
|
|
270
129
|
isSystemDependency(absFile: string): boolean;
|
|
271
|
-
/**
|
|
272
|
-
*
|
|
273
|
-
* Covers system modules unreachable from app imports (workspace package
|
|
274
|
-
* config files). Vite's watcher hard-ignores `node_modules`, so
|
|
275
|
-
* node_modules-installed system dependencies produce no events — a
|
|
276
|
-
* documented limitation; workspace deps resolve to real paths outside
|
|
277
|
-
* node_modules and are watchable. No-ops without a dev server.
|
|
278
|
-
*/
|
|
130
|
+
/** Watch every loader-reported dependency path. Vite hard-ignores
|
|
131
|
+
* node_modules, so dependencies installed there produce no events. */
|
|
279
132
|
registerSystemWatchPaths(): void;
|
|
280
|
-
/**
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
* (the `hotUpdate` delete event) — which both mutate the cache, re-run
|
|
285
|
-
* analysis, and then need the client to pick up the regenerated CSS.
|
|
286
|
-
* No-ops outside dev.
|
|
287
|
-
*
|
|
288
|
-
* `devServer.moduleGraph` is Vite's back-compat mixed graph: its
|
|
289
|
-
* `getModuleById` searches the client AND ssr environment graphs and its
|
|
290
|
-
* `invalidateModule` invalidates both instances behind the returned node,
|
|
291
|
-
* which is exactly the reach this path wants. It stays the seam here.
|
|
292
|
-
*
|
|
293
|
-
* Both modules are invalidated unconditionally, and deliberately so: the
|
|
294
|
-
* appearance or disappearance of a whole component file is not the
|
|
295
|
-
* steady-state edit the change-gated path governs, and a client reload does
|
|
296
|
-
* NOT rescue a module that was never invalidated — Vite keeps serving its
|
|
297
|
-
* cached transform result across reloads (openspec: hmr-new-file-detection,
|
|
298
|
-
* "CSS invalidation after new file analysis").
|
|
299
|
-
*/
|
|
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. */
|
|
300
137
|
invalidateExtractedModules(): void;
|
|
301
|
-
/**
|
|
302
|
-
*
|
|
303
|
-
* (external-package-file-discovery: silence is never an outcome). An
|
|
304
|
-
* unresolvable `.includes()` specifier warns in non-strict mode and FAILS
|
|
305
|
-
* the build under `strict: true`, naming every offending specifier —
|
|
306
|
-
* a typo'd include must not ship a build missing its component CSS. A
|
|
307
|
-
* stale dist entry under an extended package (first-class-extension D13)
|
|
308
|
-
* rides the same seam: a merge against it would silently skew registry
|
|
309
|
-
* content the discovered sources no longer match.
|
|
310
|
-
*/
|
|
138
|
+
/** An unresolvable `.includes()` specifier or a stale dist entry under an
|
|
139
|
+
* extended package warns, and fails the build under `strict`. */
|
|
311
140
|
enforceIncludeResolution(): void;
|
|
312
|
-
/**
|
|
313
|
-
* The post-analysis gate over cross-source token contracts
|
|
314
|
-
* (extraction-diagnostics): a discovered component referencing a token its
|
|
315
|
-
* OWN package defines but the consumer theme does not gets the teaching
|
|
316
|
-
* error naming the token, component, source package, and the missing
|
|
317
|
-
* `createTheme().extend(...)`. Wiring and severity routing live in the
|
|
318
|
-
* shared pipeline gate (next-plugin parity by construction).
|
|
319
|
-
*/
|
|
320
141
|
enforceExternalTokenContracts(): void;
|
|
321
142
|
runSelfVerify(): void;
|
|
322
143
|
}
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAItD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB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QAAC,QAAQ,EAAE,qBAAqB,CAAA;KAAE,CAAC,CAW5D;IAED,sBAAsB,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAQ1D;IAED,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGhC;IAED,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAOvE;IAED;8EAC0E;IAC1E,OAAO,CAAC,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
|
|
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
|
-
*
|
|
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
|
-
*/
|
|
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. */
|
|
22
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":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,MAAM,CAAC;AAEd
|
|
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
|
|
3
|
-
*
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
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
|
|
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"}
|