@animus-ui/vite-plugin 0.1.26 → 0.1.28

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.
@@ -1 +1 @@
1
- {"version":3,"file":"build-start.d.ts","sourceRoot":"","sources":["../src/build-start.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;;GAGG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,aAAa,EAClB,gBAAgB,EAAE,WAAW,EAC7B,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,KAAK,MAAM,GAC3D,OAAO,CAAC,IAAI,CAAC,CAgJf"}
1
+ {"version":3,"file":"build-start.d.ts","sourceRoot":"","sources":["../src/build-start.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;;GAGG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,aAAa,EAClB,gBAAgB,EAAE,WAAW,EAC7B,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,KAAK,MAAM,GAC3D,OAAO,CAAC,IAAI,CAAC,CA2If"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAeA,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,CAsEN"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAeA,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,CAuEN"}
package/dist/context.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { ExtractionSession } from '@animus-ui/extract/session';
1
+ import { EnvironmentBuilds, ExtractionSession } from '@animus-ui/extract/session';
2
2
  import { HotUpdateEvents } from './hot-update-events';
3
3
  import type { LightningTargets } from './css';
4
4
  import type { AnimusExtractOptions } from './index';
5
5
  import type { ExcludeMatcher, ExternalPackageOutcome, HostAssetClassification, HostExtensionPolicy, HostLoadExpander, ProjectManifest, SystemConfig } from '@animus-ui/extract/pipeline';
6
- import type { SessionOutcome, WatchChanges } from '@animus-ui/extract/session';
6
+ import type { SessionOutcome, SessionPublication, WatchChanges } from '@animus-ui/extract/session';
7
7
  import type { Logger } from 'vite';
8
8
  /** A Session outcome, and whether its publication changed the served
9
9
  * system-props module. */
@@ -11,11 +11,6 @@ export interface ObservedOutcome {
11
11
  outcome: SessionOutcome;
12
12
  systemPropsChanged: boolean;
13
13
  }
14
- /** One environment's build, as Vite hands it to a hook: the object is its
15
- * identity, the name its key. */
16
- export interface BuildingEnvironment {
17
- readonly name: string;
18
- }
19
14
  export declare class PluginContext {
20
15
  readonly options: AnimusExtractOptions;
21
16
  readonly verbose: boolean;
@@ -30,7 +25,6 @@ export declare class PluginContext {
30
25
  emissionProd: boolean;
31
26
  rootDir: string;
32
27
  logger: Logger | null;
33
- system: SystemConfig;
34
28
  lcssTargets: LightningTargets;
35
29
  pathAliasesJson: string | null;
36
30
  /** Vite's export conditions, so the loader reads the files Vite serves. */
@@ -51,27 +45,37 @@ export declare class PluginContext {
51
45
  * as structural exclusions; none outside the root. Set in
52
46
  * `configResolved`. */
53
47
  outputExcludes: string[];
54
- storedManifest: ProjectManifest | null;
55
- storedManifestJson: string;
56
- /** The analysis sheets with their asset() placeholders. They are read
57
- * through `globalCss` and `resolvedComponentCss`, which substitute the
58
- * current asset URLs, so an edited asset changes its URL without
59
- * re-analysis. */
60
- private analysisGlobalCss;
61
- private analysisComponentCss;
48
+ /** The Vite config file the build loaded, where it loaded one. */
49
+ configFiles: string[];
50
+ /** The Session publication this context serves, adopted whole as the
51
+ * Session commits it; null until one commits, and a failed analysis
52
+ * leaves the previous one served. Every view below reads it. */
53
+ served: SessionPublication | null;
54
+ /** What a context serves before a first publication. */
55
+ private readonly unpublishedSystem;
56
+ get storedManifest(): ProjectManifest | null;
57
+ get storedManifestJson(): string;
58
+ get system(): SystemConfig;
59
+ get reverseProvenance(): Record<string, string[]>;
60
+ /** The exact source `virtual:animus/system-props` serves: the served
61
+ * publication's, so the served bytes and the HMR change decision cannot
62
+ * diverge. */
63
+ get systemPropsModule(): string;
64
+ get externalPackageDirs(): string[];
65
+ /** specifier → whether its redirected source entry has side effects, from
66
+ * the owning package's `sideEffects`; absent leaves Vite's default. */
67
+ get externalSourceSideEffects(): ReadonlyMap<string, boolean>;
68
+ get externalSourceEntries(): ReadonlyMap<string, string>;
69
+ /** The analysis sheets keep their asset() placeholders; these views
70
+ * substitute the current asset URLs, so an edited asset changes its URL
71
+ * without re-analysis. */
62
72
  get globalCss(): string;
63
- set globalCss(css: string);
64
73
  get resolvedComponentCss(): string;
65
- set resolvedComponentCss(css: string);
74
+ private analysisSheets;
66
75
  private substitutedSheets;
67
76
  layerDeclaration: string;
68
77
  transformOutputHashes: Map<string, string>;
69
78
  recordTransformOutput(relativePath: string, code: string): void;
70
- reverseProvenance: Record<string, string[]>;
71
- /** The exact source `virtual:animus/system-props` serves: the last
72
- * publication's, so the served bytes and the HMR change decision cannot
73
- * diverge. */
74
- systemPropsModule: string;
75
79
  /** Original path → hash of bytes whose parse aborted in a rejected attempt;
76
80
  * non-empty while that rejection holds publication. Those bytes are served
77
81
  * raw so the host reports its own syntax error instead of receiving the
@@ -97,16 +101,12 @@ export declare class PluginContext {
97
101
  servesFile: (path: string) => boolean;
98
102
  assetResolutionFailures: Set<string>;
99
103
  assetPassComplete: boolean;
100
- externalPackageDirs: string[];
101
- /** specifier → whether its redirected source entry has side effects, from
102
- * the owning package's `sideEffects`; absent leaves Vite's default. */
103
- externalSourceSideEffects: Map<string, boolean>;
104
- externalSourceEntries: ReadonlyMap<string, string>;
104
+ /** The Session's last external package outcomes, for the self-verify. */
105
105
  externalPackageOutcomes: ExternalPackageOutcome[];
106
106
  devServer: any;
107
- /** The Session's path lists already registered with Vite's watcher; the
108
- * Session replaces a list when it changes. */
109
- private readonly watchedPathLists;
107
+ /** The paths already registered, per watcher: a reused plugin instance
108
+ * whose dev server is replaced registers everything with the new one. */
109
+ private readonly watchedPaths;
110
110
  /** Every native extraction call goes through this one accessor. */
111
111
  readonly engineApi: () => any;
112
112
  /** The native module's stateless lookups, before the root resolves: the
@@ -134,26 +134,13 @@ export declare class PluginContext {
134
134
  * error itself); any other failure rejects. Either way the watcher
135
135
  * learns the paths the attempt's system load named. */
136
136
  runAttempt(attempt: (session: ExtractionSession) => Promise<void>): Promise<ObservedOutcome[]>;
137
- /** Serves the Session's last publication: the manifest, the analysis
138
- * sheets (asset placeholders kept; Vite substitutes them), the system,
139
- * the package map and the external-package state. */
137
+ /** Serves the Session's last publication whole (asset placeholders
138
+ * kept; Vite substitutes them). */
140
139
  adoptPublication(session: ExtractionSession): void;
141
- /** The environment a host without environments builds as. */
142
- readonly singleEnvironment: BuildingEnvironment;
143
- /** Each environment build that started and has not ended, by name. A
144
- * custom `buildApp` builds a shared plugin's environments in parallel, so
145
- * the context's build retires with the last of them, not the first. */
146
- private readonly openBuilds;
147
- /** Opens `environment`'s build, after any open build under its name has
148
- * ended: a builder reused while an earlier build still runs, or a second
149
- * environment under one name, builds after it rather than beside it.
150
- * Each build then ends its own generation once, in `buildEnd`. */
151
- openBuild(environment: BuildingEnvironment): Promise<void>;
152
- /** Ends `environment`'s open build; whether that left none open. Vite
153
- * ends each build once, in `buildEnd`, and a dev server ends only the
154
- * environments that started, so only the build that opened an entry
155
- * ends it. */
156
- endBuild(environment: BuildingEnvironment): boolean;
140
+ /** The context's environment builds: a custom `buildApp` builds a shared
141
+ * plugin's environments in parallel, so the context's build retires with
142
+ * the last of them, not the first. */
143
+ readonly builds: EnvironmentBuilds;
157
144
  /** Retires this context's build when Vite closes it: the Session leaves
158
145
  * the registry (with its manifest and watch state) and the engine handle
159
146
  * is released, injected engine or not. The next build start rejoins. */
@@ -201,17 +188,14 @@ export declare class PluginContext {
201
188
  private applyAssetSubstitutions;
202
189
  invalidateSystemReloadModules(reloadClient: boolean): void;
203
190
  isSystemDependency(absFile: string): boolean;
204
- /** Watch every loader-reported dependency path, the external package
205
- * roots, and the paths the load found absent that no watched directory
206
- * covers (creating one reloads the system). Vite hard-ignores
207
- * node_modules, so dependencies installed there produce no events. A list
208
- * already registered is not added again. */
191
+ /** Registers the Session's watch plan with Vite's watcher, each path
192
+ * once per watcher. Vite also watches its packages' own directories beside the
193
+ * plan's canonical roots, and an absent path either covers (or the root
194
+ * does) is left to their watch: a watch on an absent file inside a
195
+ * watched directory stops that directory's events under inotify
196
+ * (chokidar's non-fsevents handler). Vite hard-ignores node_modules, so
197
+ * dependencies installed there produce no events. */
209
198
  registerSystemWatchPaths(): void;
210
- /** The absent paths no watched directory reports a creation for. Vite's
211
- * root watch and a package root's watch already do, and a watch on an
212
- * absent file inside a watched directory stops that directory's events
213
- * under inotify (chokidar's non-fsevents handler). */
214
- private uncoveredMissingPaths;
215
199
  /** Invalidate the component CSS and system-props modules, then reload. The
216
200
  * reload alone rescues nothing: Vite keeps serving its cached transform.
217
201
  * `devServer.moduleGraph` is the mixed back-compat graph on purpose — it
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAiBA,OAAO,EAKL,iBAAiB,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D,OAAO,CAAC,eAAe;IAevB,2DAA2D;IAC3D,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAKtC;IAED;oCACgC;IAChC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAgBxC;IAED,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAKvE;IAED,8DAA8D;IAC9D,oBAAoB,IAAI,MAAM,EAAE,CAM/B;IAED;;;gDAG4C;IAC5C,IAAI,WAAW,IAAI,MAAM,CAKxB;IAED;8EAC0E;IAC1E,OAAO,CAAC,uBAAuB;IA2B/B,6BAA6B,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAYzD;IAED,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE3C;IAED;;;;;;0DAMsD;IACtD,wBAAwB,IAAI,IAAI,CAsB/B;IAED;;;yEAGqE;IACrE,0BAA0B,IAAI,IAAI,CAcjC;IAED,aAAa,IAAI,IAAI,CA2BpB;CACF"}
package/dist/index.cjs CHANGED
@@ -98,7 +98,6 @@ async function runBuildStart(ctx, resolveSpecifier, emitAsset) {
98
98
  ctx.assetPassComplete = false;
99
99
  ctx.assetUrlBySpecifier.clear();
100
100
  ctx.assetResolutionFailures.clear();
101
- const t0 = performance.now();
102
101
  if (ctx.options.layers) {
103
102
  (0, _animus_ui_extract_pipeline.validateLayerOrder)(ctx.options.layers);
104
103
  ctx.log(`Custom layers: [${ctx.options.layers.join(", ")}]`);
@@ -113,7 +112,7 @@ async function runBuildStart(ctx, resolveSpecifier, emitAsset) {
113
112
  if (ctx.verbose) {
114
113
  const propCount = Object.keys(JSON.parse(ctx.system.propConfigJson)).length;
115
114
  const groupCount = Object.keys(JSON.parse(ctx.system.groupRegistryJson)).length;
116
- ctx.log(`System loaded: ${propCount} props, ${groupCount} groups (${Math.round(performance.now() - t0)}ms)`);
115
+ ctx.log(`System loaded: ${propCount} props, ${groupCount} groups (${Math.round(session.systemLoadMs)}ms)`);
117
116
  }
118
117
  const assetSpecifiers = ctx.sheetAssetSpecifiers();
119
118
  ctx.assetSourceBySpecifier.clear();
@@ -139,7 +138,6 @@ async function runBuildStart(ctx, resolveSpecifier, emitAsset) {
139
138
  ctx.assetPassComplete = true;
140
139
  if (ctx.storedManifest) {
141
140
  const report = ctx.storedManifest.report;
142
- ctx.log(`Extracted ${report.components_extracted}/${report.components_total} components (${Math.round(performance.now() - t0)}ms)`);
143
141
  ctx.log(`Reconciliation: ${report.components_extracted} kept, ${report.variants_eliminated} variants pruned, ${report.states_eliminated} states pruned`);
144
142
  for (const d of report.eliminated_details) if (d.kind === "component") ctx.warn(`⚠ ${d.component} eliminated: ${d.reason}`);
145
143
  else if (d.kind === "prospective_component" && !ctx.emissionProd) ctx.warn(`⚠ ${d.component} would be eliminated in production: ${d.reason}`);
@@ -176,10 +174,11 @@ function applyResolvedConfig(ctx, config) {
176
174
  const copyDir = (0, path.resolve)(config.cacheDir, "animus-assets", processCopyDir());
177
175
  const served = (0, vite.isFileLoadingAllowed)(config, (0, path.join)(copyDir, "asset"));
178
176
  ctx.assetCopyDir = served ? copyDir : null;
179
- ctx.servesFile = (path$8) => (0, vite.isFileLoadingAllowed)(config, path$8);
177
+ ctx.servesFile = (path$9) => (0, vite.isFileLoadingAllowed)(config, path$9);
180
178
  if (!served) ctx.warn(`[animus-extract] asset() copies in ${copyDir} are not served under server.fs; serving the live files instead, so an edited asset keeps its URL`);
181
179
  }
182
180
  ctx.outputExcludes = (0, _animus_ui_extract_pipeline.outputExclusions)(config.root, (0, _animus_ui_extract_pipeline.viteOutputTargets)(config));
181
+ ctx.configFiles = config.configFile ? [config.configFile] : [];
183
182
  ctx.resolveConditions = config.resolve.conditions.map((condition) => condition === "development|production" ? config.isProduction ? "production" : "development" : condition);
184
183
  ctx.extensionPolicy = (0, _animus_ui_extract_pipeline.viteExtensionPolicy)(config.resolve.extensions);
185
184
  ctx.assetClassification = (0, _animus_ui_extract_pipeline.viteAssetClassification)(config.assetsInclude);
@@ -326,7 +325,6 @@ var PluginContext = class {
326
325
  emissionProd = false;
327
326
  rootDir = "";
328
327
  logger = null;
329
- system = emptySystemConfig();
330
328
  lcssTargets = {};
331
329
  pathAliasesJson = null;
332
330
  /** Vite's export conditions, so the loader reads the files Vite serves. */
@@ -347,43 +345,67 @@ var PluginContext = class {
347
345
  * as structural exclusions; none outside the root. Set in
348
346
  * `configResolved`. */
349
347
  outputExcludes = [];
350
- storedManifest = null;
351
- storedManifestJson = "";
352
- /** The analysis sheets with their asset() placeholders. They are read
353
- * through `globalCss` and `resolvedComponentCss`, which substitute the
354
- * current asset URLs, so an edited asset changes its URL without
355
- * re-analysis. */
356
- analysisGlobalCss = "";
357
- analysisComponentCss = "";
348
+ /** The Vite config file the build loaded, where it loaded one. */
349
+ configFiles = [];
350
+ /** The Session publication this context serves, adopted whole as the
351
+ * Session commits it; null until one commits, and a failed analysis
352
+ * leaves the previous one served. Every view below reads it. */
353
+ served = null;
354
+ /** What a context serves before a first publication. */
355
+ unpublishedSystem = emptySystemConfig();
356
+ get storedManifest() {
357
+ return this.served?.manifest ?? null;
358
+ }
359
+ get storedManifestJson() {
360
+ return this.served?.manifestJson ?? "";
361
+ }
362
+ get system() {
363
+ return this.served?.system ?? this.unpublishedSystem;
364
+ }
365
+ get reverseProvenance() {
366
+ return this.served?.manifest.reverse_provenance ?? {};
367
+ }
368
+ /** The exact source `virtual:animus/system-props` serves: the served
369
+ * publication's, so the served bytes and the HMR change decision cannot
370
+ * diverge. */
371
+ get systemPropsModule() {
372
+ return this.served?.systemPropsModule ?? EMPTY_SYSTEM_PROPS_MODULE;
373
+ }
374
+ get externalPackageDirs() {
375
+ return this.served?.externalPackageDirs ?? [];
376
+ }
377
+ /** specifier → whether its redirected source entry has side effects, from
378
+ * the owning package's `sideEffects`; absent leaves Vite's default. */
379
+ get externalSourceSideEffects() {
380
+ return this.served?.externalSourceSideEffects ?? /* @__PURE__ */ new Map();
381
+ }
382
+ get externalSourceEntries() {
383
+ return this.served?.externalSourceEntries ?? /* @__PURE__ */ new Map();
384
+ }
385
+ /** The analysis sheets keep their asset() placeholders; these views
386
+ * substitute the current asset URLs, so an edited asset changes its URL
387
+ * without re-analysis. */
358
388
  get globalCss() {
359
389
  return this.substitutedSheets().globalCss;
360
390
  }
361
- set globalCss(css) {
362
- this.analysisGlobalCss = css;
363
- }
364
391
  get resolvedComponentCss() {
365
392
  return this.substitutedSheets().componentCss;
366
393
  }
367
- set resolvedComponentCss(css) {
368
- this.analysisComponentCss = css;
394
+ analysisSheets() {
395
+ return {
396
+ ...NO_SHEETS,
397
+ globalCss: this.served?.analysisGlobalCss ?? "",
398
+ componentCss: this.served?.analysisComponentCss ?? ""
399
+ };
369
400
  }
370
401
  substitutedSheets() {
371
- return (0, _animus_ui_extract_pipeline.substituteSheetAssets)({
372
- ...NO_SHEETS,
373
- globalCss: this.analysisGlobalCss,
374
- componentCss: this.analysisComponentCss
375
- }, this.assetUrlBySpecifier);
402
+ return (0, _animus_ui_extract_pipeline.substituteSheetAssets)(this.analysisSheets(), this.assetUrlBySpecifier);
376
403
  }
377
404
  layerDeclaration = "";
378
405
  transformOutputHashes = /* @__PURE__ */ new Map();
379
406
  recordTransformOutput(relativePath, code) {
380
407
  this.transformOutputHashes.set(relativePath, (0, _animus_ui_extract_pipeline.contentHash)(code));
381
408
  }
382
- reverseProvenance = {};
383
- /** The exact source `virtual:animus/system-props` serves: the last
384
- * publication's, so the served bytes and the HMR change decision cannot
385
- * diverge. */
386
- systemPropsModule = EMPTY_SYSTEM_PROPS_MODULE;
387
409
  /** Original path → hash of bytes whose parse aborted in a rejected attempt;
388
410
  * non-empty while that rejection holds publication. Those bytes are served
389
411
  * raw so the host reports its own syntax error instead of receiving the
@@ -411,16 +433,12 @@ var PluginContext = class {
411
433
  servesFile = () => true;
412
434
  assetResolutionFailures = /* @__PURE__ */ new Set();
413
435
  assetPassComplete = false;
414
- externalPackageDirs = [];
415
- /** specifier → whether its redirected source entry has side effects, from
416
- * the owning package's `sideEffects`; absent leaves Vite's default. */
417
- externalSourceSideEffects = /* @__PURE__ */ new Map();
418
- externalSourceEntries = /* @__PURE__ */ new Map();
436
+ /** The Session's last external package outcomes, for the self-verify. */
419
437
  externalPackageOutcomes = [];
420
438
  devServer;
421
- /** The Session's path lists already registered with Vite's watcher; the
422
- * Session replaces a list when it changes. */
423
- watchedPathLists = /* @__PURE__ */ new WeakSet();
439
+ /** The paths already registered, per watcher: a reused plugin instance
440
+ * whose dev server is replaced registers everything with the new one. */
441
+ watchedPaths = /* @__PURE__ */ new WeakMap();
424
442
  /** Every native extraction call goes through this one accessor. */
425
443
  engineApi;
426
444
  /** The native module's stateless lookups, before the root resolves: the
@@ -480,6 +498,8 @@ var PluginContext = class {
480
498
  staticCss: options.staticCss,
481
499
  layers: options.layers,
482
500
  engine: options.engine,
501
+ runtimeImport: options.runtimeImport,
502
+ closedDynamicImports: options.closedDynamicImports,
483
503
  mode: this.emissionProd ? "production" : "development"
484
504
  }, {
485
505
  build: this.build,
@@ -502,10 +522,12 @@ var PluginContext = class {
502
522
  session.assetClassification = this.assetClassification;
503
523
  session.loadExpander = this.loadExpander;
504
524
  session.pathAliasesJson = this.pathAliasesJson;
505
- session.runtimeImport = options.runtimeImport ?? _animus_ui_extract_pipeline.DEFAULT_RUNTIME_IMPORT;
506
- session.cssModuleId = VIRTUAL_CSS_ID;
507
- session.systemPropsModuleId = VIRTUAL_SYSTEM_PROPS_ID;
525
+ session.delivery = {
526
+ cssModuleId: VIRTUAL_CSS_ID,
527
+ systemPropsModuleId: VIRTUAL_SYSTEM_PROPS_ID
528
+ };
508
529
  session.structuralExclude = this.outputExcludes;
530
+ session.buildConfigFiles = this.configFiles;
509
531
  this.session = session;
510
532
  return session;
511
533
  }
@@ -549,63 +571,18 @@ var PluginContext = class {
549
571
  }
550
572
  return collected;
551
573
  }
552
- /** Serves the Session's last publication: the manifest, the analysis
553
- * sheets (asset placeholders kept; Vite substitutes them), the system,
554
- * the package map and the external-package state. */
574
+ /** Serves the Session's last publication whole (asset placeholders
575
+ * kept; Vite substitutes them). */
555
576
  adoptPublication(session) {
556
- const publication = session.publication;
557
- if (publication === null) return;
558
- const manifest = publication.manifest;
559
- this.system = publication.system;
560
- this.storedManifest = manifest;
561
- this.storedManifestJson = publication.manifestJson;
562
- this.globalCss = publication.analysisGlobalCss;
563
- this.resolvedComponentCss = publication.analysisComponentCss;
564
- this.reverseProvenance = manifest.reverse_provenance;
565
- this.systemPropsModule = publication.systemPropsModule;
566
- this.externalPackageDirs = session.externalPackageDirs;
567
- this.externalSourceEntries = session.externalSourceEntries;
568
- this.externalSourceSideEffects = session.externalSourceSideEffects;
577
+ if (session.publication === null) return;
578
+ this.served = session.publication;
569
579
  this.externalPackageOutcomes = session.lastExternalOutcomes;
570
580
  this.applyAssetSubstitutions();
571
581
  }
572
- /** The environment a host without environments builds as. */
573
- singleEnvironment = { name: "build" };
574
- /** Each environment build that started and has not ended, by name. A
575
- * custom `buildApp` builds a shared plugin's environments in parallel, so
576
- * the context's build retires with the last of them, not the first. */
577
- openBuilds = /* @__PURE__ */ new Map();
578
- /** Opens `environment`'s build, after any open build under its name has
579
- * ended: a builder reused while an earlier build still runs, or a second
580
- * environment under one name, builds after it rather than beside it.
581
- * Each build then ends its own generation once, in `buildEnd`. */
582
- async openBuild(environment) {
583
- for (;;) {
584
- const open = this.openBuilds.get(environment.name);
585
- if (open === void 0) break;
586
- await open.ended;
587
- }
588
- let end = () => {};
589
- const ended = new Promise((settle) => {
590
- end = settle;
591
- });
592
- this.openBuilds.set(environment.name, {
593
- environment,
594
- ended,
595
- end
596
- });
597
- }
598
- /** Ends `environment`'s open build; whether that left none open. Vite
599
- * ends each build once, in `buildEnd`, and a dev server ends only the
600
- * environments that started, so only the build that opened an entry
601
- * ends it. */
602
- endBuild(environment) {
603
- const open = this.openBuilds.get(environment.name);
604
- if (open === void 0 || open.environment !== environment) return false;
605
- this.openBuilds.delete(environment.name);
606
- open.end();
607
- return this.openBuilds.size === 0;
608
- }
582
+ /** The context's environment builds: a custom `buildApp` builds a shared
583
+ * plugin's environments in parallel, so the context's build retires with
584
+ * the last of them, not the first. */
585
+ builds = new _animus_ui_extract_session.EnvironmentBuilds();
609
586
  /** Retires this context's build when Vite closes it: the Session leaves
610
587
  * the registry (with its manifest and watch state) and the engine handle
611
588
  * is released, injected engine or not. The next build start rejoins. */
@@ -711,8 +688,8 @@ var PluginContext = class {
711
688
  sheetAssetSpecifiers() {
712
689
  return (0, _animus_ui_extract_pipeline.findSheetAssetSpecifiers)({
713
690
  variableCss: this.system.variableCss,
714
- globalCss: this.analysisGlobalCss,
715
- componentCss: this.analysisComponentCss
691
+ globalCss: this.analysisSheets().globalCss,
692
+ componentCss: this.analysisSheets().componentCss
716
693
  });
717
694
  }
718
695
  /** `system.variableCss` with its asset() placeholders substituted from
@@ -752,34 +729,35 @@ var PluginContext = class {
752
729
  isSystemDependency(absFile) {
753
730
  return this.session?.isSystemDependency(absFile) ?? false;
754
731
  }
755
- /** Watch every loader-reported dependency path, the external package
756
- * roots, and the paths the load found absent that no watched directory
757
- * covers (creating one reloads the system). Vite hard-ignores
758
- * node_modules, so dependencies installed there produce no events. A list
759
- * already registered is not added again. */
732
+ /** Registers the Session's watch plan with Vite's watcher, each path
733
+ * once per watcher. Vite also watches its packages' own directories beside the
734
+ * plan's canonical roots, and an absent path either covers (or the root
735
+ * does) is left to their watch: a watch on an absent file inside a
736
+ * watched directory stops that directory's events under inotify
737
+ * (chokidar's non-fsevents handler). Vite hard-ignores node_modules, so
738
+ * dependencies installed there produce no events. */
760
739
  registerSystemWatchPaths() {
761
740
  const watcher = this.devServer?.watcher;
762
741
  const session = this.session;
763
742
  if (!watcher || !session) return;
743
+ const directories = [.../* @__PURE__ */ new Set([...session.watchPlan().directories, ...session.externalPackageDirs])];
744
+ const covered = this.rootDir ? [this.rootDir, ...directories] : directories;
745
+ const plan = session.watchPlan(covered);
746
+ let registered = this.watchedPaths.get(watcher);
747
+ if (registered === void 0) {
748
+ registered = /* @__PURE__ */ new Set();
749
+ this.watchedPaths.set(watcher, registered);
750
+ }
764
751
  for (const paths of [
765
- session.systemDependencyPaths,
766
- session.systemMissingPaths,
767
- session.externalPackageDirs
752
+ plan.files,
753
+ plan.missing,
754
+ directories
768
755
  ]) {
769
- if (paths.length === 0 || this.watchedPathLists.has(paths)) continue;
770
- this.watchedPathLists.add(paths);
771
- const added = paths === session.systemMissingPaths ? this.uncoveredMissingPaths(paths, session.externalPackageDirs) : paths;
756
+ const added = paths.filter((path$7) => !registered.has(path$7));
757
+ for (const path$8 of added) registered.add(path$8);
772
758
  if (added.length > 0) watcher.add(added);
773
759
  }
774
760
  }
775
- /** The absent paths no watched directory reports a creation for. Vite's
776
- * root watch and a package root's watch already do, and a watch on an
777
- * absent file inside a watched directory stops that directory's events
778
- * under inotify (chokidar's non-fsevents handler). */
779
- uncoveredMissingPaths(paths, packageDirs) {
780
- const watchedDirs = this.rootDir ? [this.rootDir, ...packageDirs] : packageDirs;
781
- return paths.filter((path$7) => !watchedDirs.some((dir) => (0, _animus_ui_extract_pipeline.isPathWithinRoot)(dir, path$7)));
782
- }
783
761
  /** Invalidate the component CSS and system-props modules, then reload. The
784
762
  * reload alone rescues nothing: Vite keeps serving its cached transform.
785
763
  * `devServer.moduleGraph` is the mixed back-compat graph on purpose — it
@@ -1474,12 +1452,12 @@ function animusExtract(options) {
1474
1452
  applyResolvedConfig(ctx, config);
1475
1453
  },
1476
1454
  buildEnd() {
1477
- if (!ctx.endBuild(this.environment ?? ctx.singleEnvironment)) return;
1455
+ if (!ctx.builds.end(this.environment ?? ctx.builds.single)) return;
1478
1456
  cancelSystemReload(ctx);
1479
1457
  ctx.close();
1480
1458
  },
1481
1459
  async buildStart() {
1482
- await ctx.openBuild(this.environment ?? ctx.singleEnvironment);
1460
+ await ctx.builds.open(this.environment ?? ctx.builds.single);
1483
1461
  await runBuildStart(ctx, async (specifier, importer) => {
1484
1462
  return (await this.resolve(specifier, importer))?.id ?? null;
1485
1463
  }, ctx.isProd ? (fileName, source) => this.emitFile({
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DiagnosticLevels, StaticCssConfig } from '@animus-ui/extract/pipeline';
1
+ import type { ClosedDynamicImport, DiagnosticLevels, StaticCssConfig } from '@animus-ui/extract/pipeline';
2
2
  import type { Plugin } from 'vite';
3
3
  export { discoverFiles } from '@animus-ui/extract/pipeline';
4
4
  export interface AnimusExtractOptions {
@@ -11,6 +11,15 @@ export interface AnimusExtractOptions {
11
11
  * terminal used.
12
12
  */
13
13
  runtimeImport?: string;
14
+ /**
15
+ * Computed `import()`s declared closed, by site: each entry names the file
16
+ * (`importer`, relative to the root) and the function the `import()` is
17
+ * written in. `targets: 'build-chunks'` says it loads only what the
18
+ * build's own literal `import()`s load. The analysis records this as an
19
+ * assumption and does not check it; every other computed `import()` may
20
+ * still load any module.
21
+ */
22
+ closedDynamicImports?: ClosedDynamicImport[];
14
23
  /**
15
24
  * Substrings, or globs when `*`/`?` present. Replaces the defaults `dist`,
16
25
  * `.test.`, `.spec.`; `node_modules`, `.next`, `.animus` always apply.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AA4C5D,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CA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AC,EAAE,MAAM,CAAC;IACvB;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;+CAE2C;IAC3C,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IACpC;;sDAEkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;gBAEY;IACZ,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC;IACd;;;OAGG;IACH,mBAAmB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAMD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAkInE;eAEc,aAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/vite-plugin",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "Animus static CSS extraction Vite plugin",
5
5
  "keywords": [
6
6
  "animus",
@@ -39,12 +39,12 @@
39
39
  "compile": "tsc --noEmit"
40
40
  },
41
41
  "dependencies": {
42
- "@animus-ui/extract": "0.1.26",
42
+ "@animus-ui/extract": "0.1.28",
43
43
  "browserslist": "^4.28.8",
44
44
  "lightningcss": "^1.33.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@animus-ui/assertions": "0.1.26"
47
+ "@animus-ui/assertions": "0.1.28"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@mdx-js/mdx": "^3.0.0",