@stillwind/integration 0.7.0 → 0.9.0
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/CHANGELOG.md +180 -0
- package/dist/astro/development.d.ts +2 -0
- package/dist/astro/development.js +2 -0
- package/dist/astro/development.js.map +1 -1
- package/dist/astro/index.d.ts +1 -1
- package/dist/astro/index.js +8 -2
- package/dist/astro/index.js.map +1 -1
- package/dist/{emission-BVi5aRbb.js → emission-BpaN4Z4m.js} +212 -69
- package/dist/emission-BpaN4Z4m.js.map +1 -0
- package/dist/fresh/index.d.ts +1 -1
- package/dist/fresh/index.js +1 -1
- package/dist/{index-DFfbZxNT.d.ts → index-B6EtrWus.d.ts} +2 -2
- package/dist/loader-cache-DfOGY8AJ.js +231 -0
- package/dist/loader-cache-DfOGY8AJ.js.map +1 -0
- package/dist/next/css-loader.d.ts +5 -2
- package/dist/next/css-loader.js +7 -2
- package/dist/next/css-loader.js.map +1 -1
- package/dist/next/index.js +2 -0
- package/dist/next/index.js.map +1 -1
- package/dist/{node-loader-D-3Ynpy1.d.ts → node-loader-Bqg7E5zq.d.ts} +6 -3
- package/dist/nuxt/index.d.ts +2 -2
- package/dist/nuxt/index.js +2 -1
- package/dist/nuxt/index.js.map +1 -1
- package/dist/{plugin-aV0zIIAe.d.ts → plugin-BAG0ZI1X.d.ts} +58 -6
- package/dist/{plugin-mPiBLdqa.js → plugin-D-45o54j.js} +5 -2
- package/dist/plugin-D-45o54j.js.map +1 -0
- package/dist/{plugin-DOKl8qk3.js → plugin-DQH8QlYh.js} +379 -44
- package/dist/plugin-DQH8QlYh.js.map +1 -0
- package/dist/{project-DUGu8g_L.d.ts → project-B_KFQist.d.ts} +2 -2
- package/dist/project-egWF2vWJ.js +428 -0
- package/dist/project-egWF2vWJ.js.map +1 -0
- package/dist/{project-BNw0nZBE.d.ts → project-mB7CODIs.d.ts} +46 -7
- package/dist/rsbuild/index.d.ts +4 -1
- package/dist/rsbuild/index.js +2 -2
- package/dist/rsbuild/index.js.map +1 -1
- package/dist/rspack/index.d.ts +1 -1
- package/dist/rspack/index.js +1 -1
- package/dist/session-Cxf4D6oQ.d.ts +163 -0
- package/dist/source-entries-J5azZ_-z.js +350 -0
- package/dist/source-entries-J5azZ_-z.js.map +1 -0
- package/dist/turbopack/css-loader.d.ts +5 -2
- package/dist/turbopack/css-loader.js +53 -17
- package/dist/turbopack/css-loader.js.map +1 -1
- package/dist/turbopack/index.d.ts +2 -2
- package/dist/turbopack/loader.d.ts +3 -2
- package/dist/turbopack/loader.js +10 -4
- package/dist/turbopack/loader.js.map +1 -1
- package/dist/turbopack/node-loader.d.ts +1 -1
- package/dist/turbopack/node-loader.js +1 -0
- package/dist/turbopack/node-loader.js.map +1 -1
- package/dist/vite/index.d.ts +2 -2
- package/dist/vite/index.js +1 -1
- package/dist/vite/runtime.d.ts +10 -3
- package/dist/vite/runtime.js +8 -1
- package/dist/vite/runtime.js.map +1 -1
- package/dist/webpack/css-loader.js +1 -1
- package/dist/webpack/document-loader.d.ts +4 -1
- package/dist/webpack/document-loader.js +5 -2
- package/dist/webpack/document-loader.js.map +1 -1
- package/dist/webpack/fragment-loader.d.ts +1 -0
- package/dist/webpack/fragment-loader.js +1 -0
- package/dist/webpack/fragment-loader.js.map +1 -1
- package/dist/webpack/index.d.ts +1 -1
- package/dist/webpack/index.js +1 -1
- package/dist/webpack/loader.js +15 -21
- package/dist/webpack/loader.js.map +1 -1
- package/dist/webpack/source-loader.d.ts +1 -0
- package/dist/webpack/source-loader.js +1 -0
- package/dist/webpack/source-loader.js.map +1 -1
- package/package.json +19 -17
- package/dist/binding-files-Ds5NpyVV.js +0 -45
- package/dist/binding-files-Ds5NpyVV.js.map +0 -1
- package/dist/emission-BVi5aRbb.js.map +0 -1
- package/dist/plugin-DOKl8qk3.js.map +0 -1
- package/dist/plugin-mPiBLdqa.js.map +0 -1
- package/dist/project-C3IH7geC.js +0 -182
- package/dist/project-C3IH7geC.js.map +0 -1
- package/dist/session-B9_rp9TH.d.ts +0 -72
- package/dist/session-DHUCQMG5.js +0 -117
- package/dist/session-DHUCQMG5.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { a as buildCompilerOptions, i as SharedTypeFacts, n as isSourceEntry, o as warnSkippedCss, r as IntegrationSession, t as buildSourceEntries } from "./source-entries-J5azZ_-z.js";
|
|
1
2
|
import { a as eachMapping, i as TraceMap, n as addSegment, r as toEncodedMap, t as GenMapping } from "./gen-mapping-D7jFzOEh.js";
|
|
2
|
-
import { n as buildCompilerOptions, r as warnSkippedCss, t as IntegrationSession } from "./session-DHUCQMG5.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
-
import { attachPlugins, cleanModuleId, compilerModuleId, composeFrameworkSourceMap, createStylesheetResolver, cssEntrypoint, cssWithSourceMap, decodeCssSourceMap, fileSourceKind, finalizeCss, finalizeModuleWithMap, isStylesheet, loadCssGraph, moduleSourceMap, nodePluginHost, warnRejectedNames } from "@stillwind/host";
|
|
6
|
-
import { dirname, isAbsolute, posix, relative, resolve } from "node:path";
|
|
5
|
+
import { attachPlugins, cleanModuleId, compilerModuleId, composeFrameworkSourceMap, createStylesheetResolver, cssEntrypoint, cssWithSourceMap, decodeCssSourceMap, fileSourceKind, finalizeCss, finalizeModuleWithMap, isStylesheet, loadCssGraph, moduleSourceMap, nodePluginHost, resolveTypeFactsEnvironment, tracePhase, warnRejectedNames } from "@stillwind/host";
|
|
6
|
+
import { dirname, extname, isAbsolute, posix, relative, resolve } from "node:path";
|
|
7
7
|
import { readFile, readdir, realpath } from "node:fs/promises";
|
|
8
8
|
import { minifyCss } from "@stillwind/native";
|
|
9
9
|
import { isFileServingAllowed } from "vite";
|
|
@@ -21,6 +21,7 @@ const runtimeId = "\0stillwind:runtime";
|
|
|
21
21
|
const runtimeSpecifier = "virtual:stillwind/runtime";
|
|
22
22
|
/**
|
|
23
23
|
* Derives a compiler identity while retaining the source identity's query or fragment suffix.
|
|
24
|
+
*
|
|
24
25
|
* @param root - Absolute project root used by compilerModuleId.
|
|
25
26
|
* @param id - Full source resolver identity.
|
|
26
27
|
* @returns The compiler identity of the cleaned path followed by its original suffix.
|
|
@@ -74,6 +75,7 @@ function renderChunkStyles(project, name, context, code, chunk, loadSingleStyles
|
|
|
74
75
|
const { manifest, buildCss } = project.buildOutput(name);
|
|
75
76
|
/**
|
|
76
77
|
* Records a stylesheet in the chunk's Vite metadata, creating the metadata when absent.
|
|
78
|
+
*
|
|
77
79
|
* @param file - Emitted asset filename without the public base prefix.
|
|
78
80
|
*/
|
|
79
81
|
const attachCss = (file) => {
|
|
@@ -158,6 +160,7 @@ if (typeof document !== "undefined") {
|
|
|
158
160
|
// src/vite/css-minify.ts
|
|
159
161
|
/**
|
|
160
162
|
* Minifies expanded CSS and reports native parser warnings through the bundler.
|
|
163
|
+
*
|
|
161
164
|
* @param css - Generated CSS with valid resource URLs or resource placeholder tokens.
|
|
162
165
|
* @param settings - Browser targets shared with compiler generation.
|
|
163
166
|
* @param context - Bundler warning reporter.
|
|
@@ -179,6 +182,7 @@ function minifyStylesheet(css, settings, context, sourceMap) {
|
|
|
179
182
|
// src/vite/file-access.ts
|
|
180
183
|
/**
|
|
181
184
|
* Checks both the requested and canonical file before a plugin reads it.
|
|
185
|
+
*
|
|
182
186
|
* @param id - Absolute filesystem identity, optionally with a query or fragment removed for access checks.
|
|
183
187
|
* @param server - Optional development server whose file-serving policy applies to both paths.
|
|
184
188
|
* @returns The canonical absolute path after resolving symlinks.
|
|
@@ -300,6 +304,7 @@ function partitionStylesheet(parts) {
|
|
|
300
304
|
// src/vite/resources.ts
|
|
301
305
|
/**
|
|
302
306
|
* Converts local resource placeholders to escaped Vite filesystem URLs.
|
|
307
|
+
*
|
|
303
308
|
* @param resources - Placeholder records whose files have already passed access checks.
|
|
304
309
|
* @returns A new map of placeholders to JSON-escaped URL contents without surrounding quotes.
|
|
305
310
|
*/
|
|
@@ -308,6 +313,7 @@ function resourceReplacements(resources) {
|
|
|
308
313
|
}
|
|
309
314
|
/**
|
|
310
315
|
* Encodes an absolute file path as a Vite filesystem URL.
|
|
316
|
+
*
|
|
311
317
|
* @param file - Canonical absolute path, using either path separator spelling.
|
|
312
318
|
* @returns An /@fs/ URL with each path segment encoded for use in stylesheet resource requests.
|
|
313
319
|
*/
|
|
@@ -316,6 +322,7 @@ function resourceUrl(file) {
|
|
|
316
322
|
}
|
|
317
323
|
/**
|
|
318
324
|
* Extracts a readable identity from a bundler resolution without checking file existence or access.
|
|
325
|
+
*
|
|
319
326
|
* @param result - Resolution, possibly external or a file URI. Absolute external paths remain readable.
|
|
320
327
|
* @param description - Resource description included in failure messages.
|
|
321
328
|
* @returns The resolved identity, converting file URIs to filesystem paths.
|
|
@@ -329,6 +336,7 @@ function resolvedFile(result, description) {
|
|
|
329
336
|
}
|
|
330
337
|
/**
|
|
331
338
|
* Replaces recorded CSS tokens in map order without further URL escaping.
|
|
339
|
+
*
|
|
332
340
|
* @param css - Generated text containing resource placeholders.
|
|
333
341
|
* @param references - Placeholders mapped to replacement contents already escaped for CSS.
|
|
334
342
|
* @returns Replaced CSS. The supplied map is unchanged.
|
|
@@ -459,6 +467,7 @@ function buildHooks(project) {
|
|
|
459
467
|
// src/vite/http.ts
|
|
460
468
|
/**
|
|
461
469
|
* Ends a response with JSON and disables caching for development snapshots.
|
|
470
|
+
*
|
|
462
471
|
* @param response - Writable response whose status and content-type/cache-control headers are replaced.
|
|
463
472
|
* @param value - Value accepted by JSON.stringify.
|
|
464
473
|
* @param statusCode - HTTP status to send, defaulting to 200.
|
|
@@ -482,7 +491,81 @@ function sendJson(response, value, statusCode = 200) {
|
|
|
482
491
|
*/
|
|
483
492
|
function developmentHooks(project) {
|
|
484
493
|
const { settings, inputs, valueSpecifier, documentPlan, publish, compile } = project;
|
|
494
|
+
/**
|
|
495
|
+
* Compilations of changed files that {@link Plugin.watchChange} started for the next hot update,
|
|
496
|
+
* keyed by file path without a query.
|
|
497
|
+
*/
|
|
498
|
+
const pending = /* @__PURE__ */ new Map();
|
|
499
|
+
/**
|
|
500
|
+
* Compiles a changed producer and the producers that read the changed file as a dependency.
|
|
501
|
+
*
|
|
502
|
+
* @param name - Environment name.
|
|
503
|
+
* @param id - Changed file path without a query.
|
|
504
|
+
* @param type - Vite file event.
|
|
505
|
+
* @param read - Reads the current text of the changed file.
|
|
506
|
+
* @param host - Resolution, watch, and warning operations of the calling hook.
|
|
507
|
+
* @returns The recorded input before the change, the new source and its compilation when the
|
|
508
|
+
* file is a recorded producer, the consumers to check, and their new JavaScript. A consumer
|
|
509
|
+
* whose compilation fails or that is not compiled for the event has no JavaScript.
|
|
510
|
+
* @throws If the compilation of the changed producer fails.
|
|
511
|
+
*/
|
|
512
|
+
const compileChange = async (name, id, type, read, host) => {
|
|
513
|
+
const state = project.environment(name);
|
|
514
|
+
const previous = inputs(name).get(id);
|
|
515
|
+
let consumers = [...inputs(name).values()].filter((input) => !input.manual && input.id !== id && input.sourceDependencies.has(id));
|
|
516
|
+
const source = previous && type !== "delete" ? await read() : void 0;
|
|
517
|
+
const result = source === void 0 ? void 0 : await compile(name, source, id, host);
|
|
518
|
+
if (result !== void 0 && consumers.length > 0 && state.keepsInterface(id)) consumers = [];
|
|
519
|
+
const codes = /* @__PURE__ */ new Map();
|
|
520
|
+
for (const consumer of consumers) {
|
|
521
|
+
let code;
|
|
522
|
+
if (type === "update") try {
|
|
523
|
+
code = (await compile(name, consumer.code, consumer.id, host))?.code;
|
|
524
|
+
} catch {}
|
|
525
|
+
codes.set(consumer.id, code);
|
|
526
|
+
}
|
|
527
|
+
return {
|
|
528
|
+
previous,
|
|
529
|
+
source,
|
|
530
|
+
result,
|
|
531
|
+
consumers,
|
|
532
|
+
codes
|
|
533
|
+
};
|
|
534
|
+
};
|
|
485
535
|
return {
|
|
536
|
+
/**
|
|
537
|
+
* Starts the compilations of a changed file for the next hot update of this environment.
|
|
538
|
+
*
|
|
539
|
+
* Vite runs this hook before it invalidates the modules of the file, and runs the hot update
|
|
540
|
+
* after the modules are invalidated. A request that arrives while a hot update compiles has to
|
|
541
|
+
* transform the invalidated module, and the module runner of an SSR environment can reload
|
|
542
|
+
* while that request still evaluates modules. The request then mixes module instances from
|
|
543
|
+
* before and after the reload. For example, SvelteKit renders a page with a second instance
|
|
544
|
+
* of the Svelte runtime and fails. A request that arrives while this hook compiles still uses
|
|
545
|
+
* the modules from before the change.
|
|
546
|
+
*
|
|
547
|
+
* @param file - Changed file path.
|
|
548
|
+
* @param change - Vite file event. Only `update` events start compilations.
|
|
549
|
+
*/
|
|
550
|
+
async watchChange(file, change) {
|
|
551
|
+
const name = this.environment?.name;
|
|
552
|
+
const server = settings.devServerRef;
|
|
553
|
+
const environment = name === void 0 ? void 0 : server?.environments[name];
|
|
554
|
+
const id = cleanModuleId(file);
|
|
555
|
+
pending.delete(id);
|
|
556
|
+
if (change.event !== "update" || !environment || project.environment(name).designSystem.observes(resolve(file), false)) return;
|
|
557
|
+
const compiled = compileChange(name, id, "update", () => readFile(file, "utf8"), {
|
|
558
|
+
resolve: (specifier, importer, options) => environment.pluginContainer.resolveId(specifier, importer, options),
|
|
559
|
+
addWatchFile: (id) => {
|
|
560
|
+
server?.watcher.add(id);
|
|
561
|
+
},
|
|
562
|
+
warn: (message) => {
|
|
563
|
+
this.warn(message);
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
pending.set(id, compiled);
|
|
567
|
+
await compiled.catch(() => {});
|
|
568
|
+
},
|
|
486
569
|
/**
|
|
487
570
|
* Recompiles changed styles and selects JavaScript modules that require hot invalidation.
|
|
488
571
|
*
|
|
@@ -491,9 +574,10 @@ function developmentHooks(project) {
|
|
|
491
574
|
*
|
|
492
575
|
* @param context - Vite hot-update event with the current server, changed file, and source
|
|
493
576
|
* reader.
|
|
494
|
-
* @returns Modules affected by a design-system update,
|
|
495
|
-
*
|
|
496
|
-
*
|
|
577
|
+
* @returns Modules affected by a design-system update, the changed modules together with the
|
|
578
|
+
* producers whose JavaScript changed after an edit of a file that they read as a dependency, an
|
|
579
|
+
* empty list when a producer edit changes only CSS and no request has compiled the edited source
|
|
580
|
+
* yet, or `undefined` to retain normal Vite handling.
|
|
497
581
|
*/
|
|
498
582
|
async hotUpdate(context) {
|
|
499
583
|
const name = this.environment.name;
|
|
@@ -517,11 +601,25 @@ function developmentHooks(project) {
|
|
|
517
601
|
for (const module of modules) this.environment.moduleGraph.invalidateModule(module, /* @__PURE__ */ new Set(), context.timestamp, true);
|
|
518
602
|
return modules;
|
|
519
603
|
}
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
604
|
+
const prepared = context.type === "update" ? pending.get(id) : void 0;
|
|
605
|
+
pending.delete(id);
|
|
606
|
+
const { previous, source, result, consumers, codes } = await (prepared ?? compileChange(name, id, context.type, () => context.read(), host));
|
|
607
|
+
const stale = [];
|
|
608
|
+
for (const consumer of consumers) {
|
|
609
|
+
const module = codes.get(consumer.id) === consumer.javascript ? void 0 : this.environment.moduleGraph.getModuleById(consumer.id);
|
|
610
|
+
if (module) {
|
|
611
|
+
this.environment.moduleGraph.invalidateModule(module, /* @__PURE__ */ new Set(), context.timestamp, true);
|
|
612
|
+
stale.push(module);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
if (source !== void 0 || consumers.length > 0) try {
|
|
524
616
|
await publish(name, host);
|
|
617
|
+
} catch (error) {
|
|
618
|
+
if (!stale.length) throw error;
|
|
619
|
+
this.warn(`Stillwind update failed; retaining published styles: ${String(error)}`);
|
|
620
|
+
return [.../* @__PURE__ */ new Set([...context.modules, ...stale])];
|
|
621
|
+
}
|
|
622
|
+
if (previous && source !== void 0) {
|
|
525
623
|
const values = [];
|
|
526
624
|
for (const input of inputs(name).values()) {
|
|
527
625
|
if (!input.manual) continue;
|
|
@@ -532,9 +630,14 @@ function developmentHooks(project) {
|
|
|
532
630
|
values.push(value);
|
|
533
631
|
}
|
|
534
632
|
}
|
|
535
|
-
if (values.length) return [.../* @__PURE__ */ new Set([
|
|
633
|
+
if (values.length || stale.length) return [.../* @__PURE__ */ new Set([
|
|
634
|
+
...context.modules,
|
|
635
|
+
...values,
|
|
636
|
+
...stale
|
|
637
|
+
])];
|
|
536
638
|
if (!previous.manual && previous.code !== source && result?.code === previous.javascript) return [];
|
|
537
639
|
}
|
|
640
|
+
if (stale.length) return [.../* @__PURE__ */ new Set([...context.modules, ...stale])];
|
|
538
641
|
} catch (error) {
|
|
539
642
|
this.warn(`Stillwind update failed; retaining published styles: ${String(error)}`);
|
|
540
643
|
}
|
|
@@ -637,6 +740,7 @@ function publicCssSourceMap(sources, map) {
|
|
|
637
740
|
const visible = /* @__PURE__ */ new Map();
|
|
638
741
|
/**
|
|
639
742
|
* Allows a known source inside the project to use a public relative name.
|
|
743
|
+
*
|
|
640
744
|
* @param id - Resolver identity whose query and fragment are removed before checking its path.
|
|
641
745
|
*/
|
|
642
746
|
const add = (id) => {
|
|
@@ -672,6 +776,7 @@ function cssForBrowser(sources, output, replacements) {
|
|
|
672
776
|
const browserTarget = /^(android|chrome|edge|firefox|ie|ios|opera|safari|samsung)(\d+(?:\.\d+){0,2})$/;
|
|
673
777
|
/**
|
|
674
778
|
* Selects browser versions from Vite's resolved CSS target without inferring versions from JS levels.
|
|
779
|
+
*
|
|
675
780
|
* @param target - Resolved CSS target, including disabled targets and language-level strings.
|
|
676
781
|
* @returns A copy of the browser list, or an empty list if any entry cannot identify browser versions.
|
|
677
782
|
*/
|
|
@@ -681,6 +786,7 @@ function inheritCssTarget(target) {
|
|
|
681
786
|
}
|
|
682
787
|
/**
|
|
683
788
|
* Converts Stillwind browser versions to Lightning CSS's packed minimum versions.
|
|
789
|
+
*
|
|
684
790
|
* @param target - Validated compiler targets. Omission and empty lists leave minifier targets unspecified.
|
|
685
791
|
* @returns Browser versions with the oldest entry retained for each browser and ios named ios_saf.
|
|
686
792
|
* @throws If a target cannot be represented by Lightning CSS's three one-byte version components.
|
|
@@ -703,6 +809,7 @@ function minifyTargets(target) {
|
|
|
703
809
|
// src/vite/finalize.ts
|
|
704
810
|
/**
|
|
705
811
|
* Finalizes source while retaining prefix metadata for source-map generation.
|
|
812
|
+
*
|
|
706
813
|
* @param code - Compiled JavaScript before finalization.
|
|
707
814
|
* @param includeStylesheet - Whether to prepend the shared virtual stylesheet import.
|
|
708
815
|
* @returns Final code, the inserted prefix, and host finalization's removed intervals.
|
|
@@ -710,6 +817,52 @@ function minifyTargets(target) {
|
|
|
710
817
|
function finalizeModuleWithMap$1(code, includeStylesheet = true) {
|
|
711
818
|
return finalizeModuleWithMap(code, includeStylesheet ? virtualCssId : void 0);
|
|
712
819
|
}
|
|
820
|
+
// src/vite/server-source-resolve.ts
|
|
821
|
+
/** Text of the error that React Router throws when a client module resolves a server-only source. */
|
|
822
|
+
const serverOnlyImportMessage = "Server-only module referenced by client";
|
|
823
|
+
/** Number of resolutions before a React Router server-only import error is passed to the caller. */
|
|
824
|
+
const serverSourceResolveAttempts = 5;
|
|
825
|
+
/**
|
|
826
|
+
* Resolves an import whose target may be a server-only source, through the other Vite plugins.
|
|
827
|
+
*
|
|
828
|
+
* Rolldown can deliver the `custom` option of one `this.resolve()` call to a different call that
|
|
829
|
+
* runs at the same time (https://github.com/rolldown/rolldown/issues/11180). It stores the options
|
|
830
|
+
* of each pending call under the current size of a map. After an earlier call finishes, a new call
|
|
831
|
+
* can receive the key of a pending call and replace its options. React Router then does not see
|
|
832
|
+
* the flag from {@link ServerSourceResolveOptions} and throws for a valid Stillwind read, for example
|
|
833
|
+
* `../server.server.js?stillwind.css` in a route module. This retry is a workaround and is not
|
|
834
|
+
* needed after Rolldown gives each pending call its own key. Other plugin errors and other
|
|
835
|
+
* failures are passed to the caller without a retry.
|
|
836
|
+
*
|
|
837
|
+
* @param resolve - Resolver of the current Vite hook context. Each call must be independent, so
|
|
838
|
+
* the same arguments can be resolved again. Each call receives a new options object.
|
|
839
|
+
* @param specifier - Import text without the Stillwind resource query.
|
|
840
|
+
* @param importer - Resolver identity of the importing module.
|
|
841
|
+
* @returns The result of the first resolution that does not throw React Router's server-only
|
|
842
|
+
* import error.
|
|
843
|
+
* @throws The error of the last attempt if each attempt throws React Router's server-only import
|
|
844
|
+
* error, or the first error of another kind.
|
|
845
|
+
*/
|
|
846
|
+
async function resolveServerSource(resolve, specifier, importer) {
|
|
847
|
+
for (let attempt = 1;; attempt++) try {
|
|
848
|
+
return await resolve(specifier, importer, {
|
|
849
|
+
skipSelf: true,
|
|
850
|
+
custom: { "react-router:dot-server": true }
|
|
851
|
+
});
|
|
852
|
+
} catch (error) {
|
|
853
|
+
if (attempt >= serverSourceResolveAttempts || !isServerOnlyImportError(error)) throw error;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Checks whether a resolver error, or one of its causes, is React Router's server-only import error.
|
|
858
|
+
*
|
|
859
|
+
* @param error - Value thrown by a resolver. Rolldown can wrap the plugin error in another error.
|
|
860
|
+
* @returns True when the message of the error or of a cause contains React Router's message.
|
|
861
|
+
*/
|
|
862
|
+
function isServerOnlyImportError(error) {
|
|
863
|
+
for (let current = error; current instanceof Error; current = current.cause) if (current.message.includes(serverOnlyImportMessage)) return true;
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
713
866
|
// src/vite/compile.ts
|
|
714
867
|
/**
|
|
715
868
|
* Compiles a producer and prepares its generated imports, source map, and cache metadata.
|
|
@@ -732,9 +885,17 @@ function finalizeModuleWithMap$1(code, includeStylesheet = true) {
|
|
|
732
885
|
* @throws If dependency loading, compilation, or upstream-map reading fails.
|
|
733
886
|
*/
|
|
734
887
|
async function compileProducer(compiler, settings, config, registry, code, id, context, previous) {
|
|
888
|
+
/**
|
|
889
|
+
* Selects the automatic stylesheet import of a producer.
|
|
890
|
+
*
|
|
891
|
+
* @param id - Full Vite identity of the producer.
|
|
892
|
+
* @returns The producer stylesheet module for an SFC with automatic document CSS, or undefined.
|
|
893
|
+
*/
|
|
894
|
+
const stylesheetImports = (id) => /\.(?:astro|svelte|vue)$/.test(cleanModuleId(id)) && config.automatic !== false ? [registry.source("producer", id)] : void 0;
|
|
735
895
|
const sfc = /\.(?:astro|svelte|vue)$/.test(cleanModuleId(id));
|
|
736
896
|
/**
|
|
737
897
|
* Gives a producer a document identity suitable for compiler reports and maps.
|
|
898
|
+
*
|
|
738
899
|
* @param id - Full resolver identity. Queries and fragments are removed from the document name.
|
|
739
900
|
* @returns An encoded `stillwind-virtual:` URI for virtual modules, or a file URL for a file.
|
|
740
901
|
*/
|
|
@@ -742,35 +903,36 @@ async function compileProducer(compiler, settings, config, registry, code, id, c
|
|
|
742
903
|
const clean = cleanModuleId(id);
|
|
743
904
|
return clean.startsWith("\0") || clean.startsWith("virtual:") ? `stillwind-virtual:${encodeURIComponent(clean)}` : pathToFileURL(clean).href;
|
|
744
905
|
};
|
|
906
|
+
const sourceDependencies = /* @__PURE__ */ new Set();
|
|
745
907
|
const output = await compiler.compile(code, id, {
|
|
746
|
-
resolve: (specifier, importer) => context.resolve(specifier, importer,
|
|
747
|
-
skipSelf: true,
|
|
748
|
-
custom: { "react-router:dot-server": true }
|
|
749
|
-
}),
|
|
908
|
+
resolve: (specifier, importer) => resolveServerSource((specifier, importer, options) => context.resolve(specifier, importer, options), specifier, importer),
|
|
750
909
|
read: (id) => readFile(cleanModuleId(id), "utf8"),
|
|
751
910
|
describe: (resolvedId) => {
|
|
752
911
|
const virtual = resolvedId.startsWith("\0") || resolvedId.startsWith("virtual:");
|
|
753
912
|
const file = virtual ? resolve(settings.projectRoot, ".stillwind-checker", `${createHash("sha256").update(resolvedId).digest("hex")}.ts`) : cleanModuleId(resolvedId);
|
|
754
913
|
const { syntax, format } = fileSourceKind(resolvedId);
|
|
914
|
+
const checkerFile = virtual || file === resolvedId ? file : `${file}.stillwind-${createHash("sha256").update(resolvedId).digest("hex").slice(0, 16)}${extname(file)}`;
|
|
755
915
|
return {
|
|
756
916
|
moduleId: virtual ? `virtual:${encodeURIComponent(resolvedId)}` : sourceModuleId(settings.projectRoot, resolvedId),
|
|
757
917
|
document: {
|
|
758
918
|
uri: documentUri(resolvedId),
|
|
759
919
|
format
|
|
760
920
|
},
|
|
761
|
-
checkerFileName:
|
|
921
|
+
checkerFileName: checkerFile,
|
|
762
922
|
projectionFileName: file.replaceAll("\\", "/"),
|
|
763
923
|
syntax
|
|
764
924
|
};
|
|
765
925
|
},
|
|
766
926
|
watch: (id) => {
|
|
767
|
-
|
|
927
|
+
sourceDependencies.add(cleanModuleId(id));
|
|
928
|
+
if (!settings.watching) context.addWatchFile(id);
|
|
768
929
|
},
|
|
769
930
|
warn: (message) => {
|
|
770
931
|
context.warn(message);
|
|
771
|
-
}
|
|
932
|
+
},
|
|
933
|
+
stylesheetImports
|
|
772
934
|
}, {
|
|
773
|
-
stylesheetImports:
|
|
935
|
+
stylesheetImports: stylesheetImports(id),
|
|
774
936
|
moduleCssImport: registry.source("value", id)
|
|
775
937
|
});
|
|
776
938
|
if (!output?.code) return;
|
|
@@ -797,7 +959,8 @@ async function compileProducer(compiler, settings, config, registry, code, id, c
|
|
|
797
959
|
manual: output.hasModuleCssImport || config.automatic === false,
|
|
798
960
|
hasModuleCssImport: output.hasModuleCssImport,
|
|
799
961
|
javascript,
|
|
800
|
-
dependencies: output.compositionModules
|
|
962
|
+
dependencies: output.compositionModules,
|
|
963
|
+
sourceDependencies
|
|
801
964
|
},
|
|
802
965
|
result: {
|
|
803
966
|
code: javascript,
|
|
@@ -818,6 +981,8 @@ async function compileProducer(compiler, settings, config, registry, code, id, c
|
|
|
818
981
|
var DesignSystem = class {
|
|
819
982
|
settings;
|
|
820
983
|
config;
|
|
984
|
+
name;
|
|
985
|
+
shared;
|
|
821
986
|
/** Compiler session retained across CSS reloads and replaced when initialization restarts. */
|
|
822
987
|
#compiler;
|
|
823
988
|
/** Plugin runtime of the applied design system, kept as the previous runtime of reloads. */
|
|
@@ -860,10 +1025,15 @@ var DesignSystem = class {
|
|
|
860
1025
|
*
|
|
861
1026
|
* @param settings - Shared project settings configured before initialization.
|
|
862
1027
|
* @param config - Compiler options that identify the CSS entrypoint.
|
|
1028
|
+
* @param name - Vite environment name, used as the resolver domain in shared type facts.
|
|
1029
|
+
* @param shared - Returns type facts shared with the other environments of the project. Each
|
|
1030
|
+
* new compiler session calls it once.
|
|
863
1031
|
*/
|
|
864
|
-
constructor(settings, config) {
|
|
1032
|
+
constructor(settings, config, name, shared) {
|
|
865
1033
|
this.settings = settings;
|
|
866
1034
|
this.config = config;
|
|
1035
|
+
this.name = name;
|
|
1036
|
+
this.shared = shared;
|
|
867
1037
|
}
|
|
868
1038
|
/**
|
|
869
1039
|
* Obtains the initialized compiler session.
|
|
@@ -909,13 +1079,15 @@ var DesignSystem = class {
|
|
|
909
1079
|
return this.cssObservedFiles.has(file) || entry && this.cssObservedDirectories.has(dirname(file));
|
|
910
1080
|
}
|
|
911
1081
|
/**
|
|
912
|
-
* Marks a design-system revision pending when an observed file changes
|
|
1082
|
+
* Marks a design-system revision pending when an observed file changes, and discards the
|
|
1083
|
+
* compiler's shared sources and facts for any changed file.
|
|
913
1084
|
*
|
|
914
1085
|
* @param file - Absolute path of the changed file. Paths that {@link DesignSystem.observes}
|
|
915
|
-
* rejects
|
|
1086
|
+
* rejects do not mark a revision pending.
|
|
916
1087
|
* @param entry - Whether the event adds or removes the file.
|
|
917
1088
|
*/
|
|
918
1089
|
changed(file, entry) {
|
|
1090
|
+
this.#compiler?.sourceChanged(file, entry);
|
|
919
1091
|
if (this.observes(file, entry)) this.cssChange++;
|
|
920
1092
|
}
|
|
921
1093
|
/**
|
|
@@ -942,7 +1114,7 @@ var DesignSystem = class {
|
|
|
942
1114
|
const version = this.settings.watching && !this.settings.cssWatching ? await designSystemVersion(loaded.dependencies, loaded.directories) : void 0;
|
|
943
1115
|
if (this.settings.cssWatching && change !== this.cssChange) continue;
|
|
944
1116
|
this.#compiler?.close();
|
|
945
|
-
this.#compiler = new IntegrationSession(this.settings.projectRoot, loaded.loader, this.config, this.settings.watching, this.settings.compilerMode, loaded.plugins);
|
|
1117
|
+
this.#compiler = new IntegrationSession(this.settings.projectRoot, loaded.loader, this.config, this.settings.watching, this.settings.compilerMode, loaded.plugins, this.settings.fixedEntries, this.settings.watching && this.settings.cssWatching ? this.settings.entries : void 0, this.shared?.(), this.name);
|
|
946
1118
|
this.#plugins = loaded.plugins;
|
|
947
1119
|
this.#initialized = true;
|
|
948
1120
|
this.resources = loaded.resources;
|
|
@@ -1082,6 +1254,7 @@ async function loadDesignSystem(settings, config, resolveImport, dependencies, s
|
|
|
1082
1254
|
const root = realpathSync(entry);
|
|
1083
1255
|
/**
|
|
1084
1256
|
* Watches relative candidates before resolution and the resolved file after success.
|
|
1257
|
+
*
|
|
1085
1258
|
* @param specifier - CSS import or resource request passed to the configured resolver.
|
|
1086
1259
|
* @param importer - Full identity of the source containing the request.
|
|
1087
1260
|
* @returns The resolver's identity with its query and fragment retained.
|
|
@@ -1182,7 +1355,9 @@ async function designSystemVersion(files, directories) {
|
|
|
1182
1355
|
return hash.digest("hex");
|
|
1183
1356
|
}
|
|
1184
1357
|
// src/vite/module-registry.ts
|
|
1185
|
-
/**
|
|
1358
|
+
/**
|
|
1359
|
+
* References issued by one project environment. Unknown IDs never supply file paths.
|
|
1360
|
+
*/
|
|
1186
1361
|
var ModuleRegistry = class {
|
|
1187
1362
|
root;
|
|
1188
1363
|
environment;
|
|
@@ -1192,6 +1367,7 @@ var ModuleRegistry = class {
|
|
|
1192
1367
|
#projections = /* @__PURE__ */ new Map();
|
|
1193
1368
|
/**
|
|
1194
1369
|
* Creates an empty registry for one project environment.
|
|
1370
|
+
*
|
|
1195
1371
|
* @param root - Project root used to derive compiler identities from source resolver identities.
|
|
1196
1372
|
* @param environment - Environment name included in every issued reference's fingerprint.
|
|
1197
1373
|
*/
|
|
@@ -1201,6 +1377,7 @@ var ModuleRegistry = class {
|
|
|
1201
1377
|
}
|
|
1202
1378
|
/**
|
|
1203
1379
|
* Issues a deterministic reference. Identical fragments reuse their fixed payloads.
|
|
1380
|
+
*
|
|
1204
1381
|
* @param kind - Reference family included in the virtual prefix and fingerprint.
|
|
1205
1382
|
* @param key - Source identity or serialized fragment content used within that family.
|
|
1206
1383
|
* @param entry - Owned payload fixed under the resulting identity.
|
|
@@ -1218,6 +1395,7 @@ var ModuleRegistry = class {
|
|
|
1218
1395
|
}
|
|
1219
1396
|
/**
|
|
1220
1397
|
* Registers a source-backed generated module.
|
|
1398
|
+
*
|
|
1221
1399
|
* @param kind - CSS value, projection, or producer registration module family.
|
|
1222
1400
|
* @param sourceId - Full resolver identity, including queries that select distinct source.
|
|
1223
1401
|
* @returns A deterministic reference for that environment, family, and compiler module identity.
|
|
@@ -1232,6 +1410,7 @@ var ModuleRegistry = class {
|
|
|
1232
1410
|
}
|
|
1233
1411
|
/**
|
|
1234
1412
|
* Registers CSS with only the resource records whose placeholders occur in it.
|
|
1413
|
+
*
|
|
1235
1414
|
* @param css - Generated fragment text before resource replacement.
|
|
1236
1415
|
* @param resources - Available placeholder records. The supplied map is unchanged.
|
|
1237
1416
|
* @returns A reference fingerprinted from CSS and selected records in map order.
|
|
@@ -1250,6 +1429,7 @@ var ModuleRegistry = class {
|
|
|
1250
1429
|
}
|
|
1251
1430
|
/**
|
|
1252
1431
|
* Looks up an issued public or resolved virtual reference.
|
|
1432
|
+
*
|
|
1253
1433
|
* @param id - virtual:stillwind identity or its NUL-prefixed resolved spelling.
|
|
1254
1434
|
* @returns The retained payload, or undefined for an unregistered identity.
|
|
1255
1435
|
*/
|
|
@@ -1258,6 +1438,7 @@ var ModuleRegistry = class {
|
|
|
1258
1438
|
}
|
|
1259
1439
|
/**
|
|
1260
1440
|
* Replaces an importer's projection edges and removes previous references with no remaining owner.
|
|
1441
|
+
*
|
|
1261
1442
|
* @param importer - Full resolver identity of the original importing document.
|
|
1262
1443
|
* @param sources - Authored projection specifiers mapped to resolved source identities. The map is copied.
|
|
1263
1444
|
*/
|
|
@@ -1268,6 +1449,7 @@ var ModuleRegistry = class {
|
|
|
1268
1449
|
}
|
|
1269
1450
|
/**
|
|
1270
1451
|
* Resolves a projection only through an importer's previously registered edge.
|
|
1452
|
+
*
|
|
1271
1453
|
* @param specifier - Authored projection request, including ?stillwind.css.
|
|
1272
1454
|
* @param importer - Full importer identity. Omission cannot select an edge.
|
|
1273
1455
|
* @returns The issued reference, or undefined when no corresponding edge exists.
|
|
@@ -1277,12 +1459,14 @@ var ModuleRegistry = class {
|
|
|
1277
1459
|
}
|
|
1278
1460
|
/**
|
|
1279
1461
|
* Removes source-backed references and projection edges after source removal.
|
|
1462
|
+
*
|
|
1280
1463
|
* @param sourceId - Full resolver identity to remove.
|
|
1281
1464
|
* @param file - Whether to match all queries and fragments of the cleaned file identity.
|
|
1282
1465
|
*/
|
|
1283
1466
|
remove(sourceId, file = false) {
|
|
1284
1467
|
/**
|
|
1285
1468
|
* Applies the selected source-removal policy to a registered identity.
|
|
1469
|
+
*
|
|
1286
1470
|
* @param id - Full resolver identity from a source entry or projection importer.
|
|
1287
1471
|
* @returns Whether the exact identity, or its cleaned file identity when requested, matches.
|
|
1288
1472
|
*/
|
|
@@ -1319,7 +1503,7 @@ var ModuleRegistry = class {
|
|
|
1319
1503
|
* resolved or read.
|
|
1320
1504
|
*/
|
|
1321
1505
|
async function resolveStylesheet(designSystem, settings, sources, revision, modules, context, complete = false) {
|
|
1322
|
-
const plan = designSystem.compiler.native.planStylesheet({
|
|
1506
|
+
const plan = tracePhase("stylesheet-plan", modules.length, () => designSystem.compiler.native.planStylesheet({
|
|
1323
1507
|
modules,
|
|
1324
1508
|
coverage: complete ? {
|
|
1325
1509
|
kind: "complete",
|
|
@@ -1327,7 +1511,7 @@ async function resolveStylesheet(designSystem, settings, sources, revision, modu
|
|
|
1327
1511
|
revision: String(revision)
|
|
1328
1512
|
} : { kind: "observed" },
|
|
1329
1513
|
placement: "document"
|
|
1330
|
-
}, settings.watching ? settings.devSourceMaps : settings.sourceMaps);
|
|
1514
|
+
}, settings.watching ? settings.devSourceMaps : settings.sourceMaps));
|
|
1331
1515
|
warnRejectedNames(plan.rejectedNames, (message) => context.warn(message));
|
|
1332
1516
|
const resources = new Map(designSystem.resources);
|
|
1333
1517
|
for (const resource of plan.resources) {
|
|
@@ -1404,13 +1588,14 @@ var ViteEnvironment = class {
|
|
|
1404
1588
|
* @param config - Compiler options shared by the project.
|
|
1405
1589
|
* @param invalidate - Invalidates Vite source identities whose JavaScript changes after a
|
|
1406
1590
|
* design-system reload.
|
|
1591
|
+
* @param shared - Returns type facts shared with the other environments of the project.
|
|
1407
1592
|
*/
|
|
1408
|
-
constructor(name, settings, config, invalidate) {
|
|
1593
|
+
constructor(name, settings, config, invalidate, shared) {
|
|
1409
1594
|
this.name = name;
|
|
1410
1595
|
this.settings = settings;
|
|
1411
1596
|
this.config = config;
|
|
1412
1597
|
this.invalidate = invalidate;
|
|
1413
|
-
this.#designSystem = new DesignSystem(settings, config);
|
|
1598
|
+
this.#designSystem = new DesignSystem(settings, config, name, shared);
|
|
1414
1599
|
}
|
|
1415
1600
|
/**
|
|
1416
1601
|
* Exposes design-system reload progress without allowing callers to replace its state.
|
|
@@ -1461,6 +1646,19 @@ var ViteEnvironment = class {
|
|
|
1461
1646
|
this.#designSystem.changed(file, entry);
|
|
1462
1647
|
}
|
|
1463
1648
|
/**
|
|
1649
|
+
* Tests whether a changed file exposes the same exports to other producers as before the change.
|
|
1650
|
+
*
|
|
1651
|
+
* @param file - Resolver identity of a file that {@link changed} received with `entry` false and
|
|
1652
|
+
* that a producer compilation prepared again since then.
|
|
1653
|
+
* @returns False when the compiler is not initialized, no producer imports the file, or the
|
|
1654
|
+
* exports cannot be compared. True means that compiling the importing producers again gives the
|
|
1655
|
+
* same JavaScript and CSS.
|
|
1656
|
+
* @throws If checker input installation fails.
|
|
1657
|
+
*/
|
|
1658
|
+
keepsInterface(file) {
|
|
1659
|
+
return this.#designSystem.initialized && this.#designSystem.compiler.keepsInterface(file);
|
|
1660
|
+
}
|
|
1661
|
+
/**
|
|
1464
1662
|
* Closes the environment's type-facts service while retaining native compiler state and producer
|
|
1465
1663
|
* inputs.
|
|
1466
1664
|
*/
|
|
@@ -1494,6 +1692,7 @@ var ViteEnvironment = class {
|
|
|
1494
1692
|
await this.#designSystem.ensure(context, () => {
|
|
1495
1693
|
this.revision++;
|
|
1496
1694
|
});
|
|
1695
|
+
if (this.settings.watching) this.#designSystem.compiler.startChecker();
|
|
1497
1696
|
});
|
|
1498
1697
|
}
|
|
1499
1698
|
/**
|
|
@@ -1687,6 +1886,16 @@ var ViteEnvironment = class {
|
|
|
1687
1886
|
});
|
|
1688
1887
|
}
|
|
1689
1888
|
/**
|
|
1889
|
+
* Advances the publication revision without planning a stylesheet.
|
|
1890
|
+
*
|
|
1891
|
+
* A producer module embeds the revision when it loads and requests a snapshot when its document
|
|
1892
|
+
* holds an older one. Call this after a compilation whose snapshot is delivered later, so that
|
|
1893
|
+
* producers loaded in between request a snapshot that includes the compilation.
|
|
1894
|
+
*/
|
|
1895
|
+
advance() {
|
|
1896
|
+
this.revision++;
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1690
1899
|
* Advances the publication revision and delivers a current document stylesheet snapshot.
|
|
1691
1900
|
*
|
|
1692
1901
|
* The operation is serialized with compilation. A planning failure rejects before the callback is
|
|
@@ -1789,6 +1998,23 @@ var ViteEnvironment = class {
|
|
|
1789
1998
|
};
|
|
1790
1999
|
// src/vite/project.ts
|
|
1791
2000
|
/**
|
|
2001
|
+
* Milliseconds without another compilation before a delayed development publication plans the
|
|
2002
|
+
* stylesheet.
|
|
2003
|
+
*/
|
|
2004
|
+
const PUBLISH_DELAY = 20;
|
|
2005
|
+
/**
|
|
2006
|
+
* Lists the source files that the build inputs name.
|
|
2007
|
+
*
|
|
2008
|
+
* @param config - Resolved build configuration.
|
|
2009
|
+
* @returns Absolute script and component paths from the top-level and environment inputs, without
|
|
2010
|
+
* queries and duplicates. Virtual and relative inputs are left out.
|
|
2011
|
+
*/
|
|
2012
|
+
function buildEntries(config) {
|
|
2013
|
+
const input = (build) => (build?.rolldownOptions ?? build?.rollupOptions)?.input;
|
|
2014
|
+
const inputs = [input(config.build), ...Object.values(config.environments).map((environment) => input(environment.build))];
|
|
2015
|
+
return [...new Set(inputs.flatMap((input) => typeof input === "string" ? [input] : Array.isArray(input) ? input : Object.values(input ?? {})).map(cleanModuleId).filter((id) => isAbsolute(id) && isSourceEntry(id)))];
|
|
2016
|
+
}
|
|
2017
|
+
/**
|
|
1792
2018
|
* Creates project state shared by compiler, development, and build plugins.
|
|
1793
2019
|
*
|
|
1794
2020
|
* Call `configure` before environment initialization, then `attachServer` when serving. Close the
|
|
@@ -1805,6 +2031,7 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
1805
2031
|
watching: false,
|
|
1806
2032
|
cssWatching: false,
|
|
1807
2033
|
compilerMode: "release",
|
|
2034
|
+
entries: [],
|
|
1808
2035
|
projectRoot: "",
|
|
1809
2036
|
assetsDirectory: "assets",
|
|
1810
2037
|
publicBase: "/",
|
|
@@ -1825,9 +2052,18 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
1825
2052
|
const documentStylesheets = /* @__PURE__ */ new Map();
|
|
1826
2053
|
/** CSS of the latest publication that refreshed document stylesheets, keyed by environment name. */
|
|
1827
2054
|
const publishedDocumentCss = /* @__PURE__ */ new Map();
|
|
2055
|
+
/** Delayed publications keyed by environment name, with the time of their first request. */
|
|
2056
|
+
const delayedPublications = /* @__PURE__ */ new Map();
|
|
1828
2057
|
let bindings = /* @__PURE__ */ new WeakMap();
|
|
1829
2058
|
/**
|
|
2059
|
+
* Type facts that the environments share while they resolve imports alike. Configuration
|
|
2060
|
+
* replaces it because the TypeScript settings may change.
|
|
2061
|
+
*/
|
|
2062
|
+
let sharedTypeFacts;
|
|
2063
|
+
const shareTypeFacts = () => sharedTypeFacts ??= new SharedTypeFacts(resolveTypeFactsEnvironment(settings.projectRoot, config.tsconfig));
|
|
2064
|
+
/**
|
|
1830
2065
|
* Gets or creates the compiler state owned by one Vite environment.
|
|
2066
|
+
*
|
|
1831
2067
|
* @param owner - Owning Vite instance, or a name selecting the current state. Omission selects `client`.
|
|
1832
2068
|
* @returns The retained environment state. Newly created non-client states invalidate their
|
|
1833
2069
|
* affected modules in the corresponding development module graph.
|
|
@@ -1840,7 +2076,7 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
1840
2076
|
if (name === "client") return;
|
|
1841
2077
|
const graph = settings.devServerRef?.environments[name]?.moduleGraph;
|
|
1842
2078
|
for (const id of ids) for (const module of graph?.getModulesByFile(cleanModuleId(id)) ?? []) graph.invalidateModule(module);
|
|
1843
|
-
});
|
|
2079
|
+
}, shareTypeFacts);
|
|
1844
2080
|
environments.set(name, state);
|
|
1845
2081
|
if (typeof owner !== "string") bindings.set(owner, state);
|
|
1846
2082
|
}
|
|
@@ -1855,6 +2091,7 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
1855
2091
|
/** Releases checker services in all currently retained compiler environments. */
|
|
1856
2092
|
const closeTypeFacts = () => {
|
|
1857
2093
|
for (const state of environments.values()) state.closeTypeFacts();
|
|
2094
|
+
sharedTypeFacts?.close();
|
|
1858
2095
|
};
|
|
1859
2096
|
/**
|
|
1860
2097
|
* Replaces compiler environments and applied settings after resolving project configuration.
|
|
@@ -1869,6 +2106,8 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
1869
2106
|
const cssTarget = viteConfig.environments.client?.build.cssTarget ?? viteConfig.build.cssTarget;
|
|
1870
2107
|
const resolved = await resolveIntegrationConfig(inline, applicationRoot() ?? viteConfig.root, { target: inheritCssTarget(cssTarget) });
|
|
1871
2108
|
for (const state of environments.values()) state.close();
|
|
2109
|
+
sharedTypeFacts?.close();
|
|
2110
|
+
sharedTypeFacts = void 0;
|
|
1872
2111
|
environments.clear();
|
|
1873
2112
|
bindings = /* @__PURE__ */ new WeakMap();
|
|
1874
2113
|
for (const key of Object.keys(config)) delete config[key];
|
|
@@ -1888,11 +2127,14 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
1888
2127
|
settings.cssTargets = settings.minifyCss ? minifyTargets(config.target) : void 0;
|
|
1889
2128
|
settings.watching = viteConfig.command === "serve";
|
|
1890
2129
|
settings.compilerMode = settings.watching ? "development" : "release";
|
|
2130
|
+
settings.entries = buildEntries(viteConfig);
|
|
2131
|
+
settings.fixedEntries = settings.watching || viteConfig.build.watch ? void 0 : await buildSourceEntries(settings.entries, resolved.scope);
|
|
1891
2132
|
};
|
|
1892
2133
|
/** Detaches the current server's change listeners and closes its configuration discovery watchers. */
|
|
1893
2134
|
let stopCssWatching = () => {};
|
|
1894
2135
|
/**
|
|
1895
2136
|
* Replaces server watch registrations and retains the server for module invalidation and HMR.
|
|
2137
|
+
*
|
|
1896
2138
|
* @param server - Configured development server. A null watch setting disables these watches.
|
|
1897
2139
|
* @throws If a missing configuration's parent directory cannot be watched.
|
|
1898
2140
|
*/
|
|
@@ -1903,6 +2145,7 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
1903
2145
|
if (!settings.cssWatching) return;
|
|
1904
2146
|
/**
|
|
1905
2147
|
* Restarts on configuration changes or invalidates affected compiler environments.
|
|
2148
|
+
*
|
|
1906
2149
|
* @param event - Watch event. Only `add`, `change`, and `unlink` are handled.
|
|
1907
2150
|
* @param file - Changed filesystem path, normalized before dependency lookup.
|
|
1908
2151
|
*/
|
|
@@ -1933,12 +2176,19 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
1933
2176
|
/** Detaches server listeners, closes discovery watchers, and closes every retained compiler environment. */
|
|
1934
2177
|
const close = () => {
|
|
1935
2178
|
stopCssWatching();
|
|
2179
|
+
for (const { timer, done } of delayedPublications.values()) {
|
|
2180
|
+
clearTimeout(timer);
|
|
2181
|
+
done.resolve();
|
|
2182
|
+
}
|
|
2183
|
+
delayedPublications.clear();
|
|
1936
2184
|
documentStylesheets.clear();
|
|
1937
2185
|
publishedDocumentCss.clear();
|
|
1938
2186
|
for (const state of environments.values()) state.close();
|
|
2187
|
+
sharedTypeFacts?.close();
|
|
1939
2188
|
};
|
|
1940
2189
|
/**
|
|
1941
2190
|
* Publishes a CSS snapshot through the matching environment's HMR channel when serving.
|
|
2191
|
+
*
|
|
1942
2192
|
* @param name - Vite environment name, or undefined for `client`.
|
|
1943
2193
|
* @param context - Resolver and watch operations used to refresh the environment's CSS.
|
|
1944
2194
|
* @returns A promise that resolves after publication, or immediately when no active server exists.
|
|
@@ -1971,6 +2221,42 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
1971
2221
|
});
|
|
1972
2222
|
});
|
|
1973
2223
|
};
|
|
2224
|
+
const publishSoon = (name) => {
|
|
2225
|
+
const server = settings.devServerRef;
|
|
2226
|
+
if (!settings.watching || !server) return;
|
|
2227
|
+
const environmentName = name ?? "client";
|
|
2228
|
+
environment(name).advance();
|
|
2229
|
+
const now = performance.now();
|
|
2230
|
+
const pending = delayedPublications.get(environmentName);
|
|
2231
|
+
if (pending) clearTimeout(pending.timer);
|
|
2232
|
+
const first = pending?.first ?? now;
|
|
2233
|
+
const done = pending?.done ?? Promise.withResolvers();
|
|
2234
|
+
const run = async () => {
|
|
2235
|
+
delayedPublications.delete(environmentName);
|
|
2236
|
+
const target = server.environments[environmentName];
|
|
2237
|
+
try {
|
|
2238
|
+
if (!target || server.ws.clients.size === 0) return;
|
|
2239
|
+
await publish(name, {
|
|
2240
|
+
resolve: (specifier, importer, options) => target.pluginContainer.resolveId(specifier, importer, options),
|
|
2241
|
+
addWatchFile: (id) => {
|
|
2242
|
+
server.watcher.add(id);
|
|
2243
|
+
},
|
|
2244
|
+
warn: (message) => {
|
|
2245
|
+
server.config.logger.warn(message);
|
|
2246
|
+
}
|
|
2247
|
+
});
|
|
2248
|
+
} catch (error) {
|
|
2249
|
+
server.config.logger.warn(`Stillwind update failed; retaining published styles: ${String(error)}`);
|
|
2250
|
+
} finally {
|
|
2251
|
+
done.resolve();
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
delayedPublications.set(environmentName, {
|
|
2255
|
+
timer: setTimeout(run, Math.max(0, Math.min(PUBLISH_DELAY, first + 200 - now))),
|
|
2256
|
+
first,
|
|
2257
|
+
done
|
|
2258
|
+
});
|
|
2259
|
+
};
|
|
1974
2260
|
const project = {
|
|
1975
2261
|
forConfig: (viteConfig) => {
|
|
1976
2262
|
let generation = generations.get(viteConfig);
|
|
@@ -2006,6 +2292,8 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
2006
2292
|
documentPlan: (name, context, complete = false, selection) => environment(name).documentPlan(context, complete, selection),
|
|
2007
2293
|
snapshot: (name, context) => environment(name).snapshot(context),
|
|
2008
2294
|
publish,
|
|
2295
|
+
publishSoon,
|
|
2296
|
+
publications: (name) => delayedPublications.get(name ?? "client")?.done.promise ?? Promise.resolve(),
|
|
2009
2297
|
observeDocumentStylesheet: (name, url) => {
|
|
2010
2298
|
let urls = documentStylesheets.get(name);
|
|
2011
2299
|
if (!urls) {
|
|
@@ -2023,9 +2311,33 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
|
|
|
2023
2311
|
};
|
|
2024
2312
|
return project;
|
|
2025
2313
|
}
|
|
2314
|
+
// src/vite/react-router.ts
|
|
2315
|
+
/**
|
|
2316
|
+
* Identifies React Router's child compiler that transforms routes only to read export names.
|
|
2317
|
+
*
|
|
2318
|
+
* @param config - Resolved configuration of the compiler that owns the hook.
|
|
2319
|
+
* @returns True for the child compiler with React Router's route plugins and without its main
|
|
2320
|
+
* plugin, in both development and builds. The child does not generate application JavaScript or
|
|
2321
|
+
* CSS.
|
|
2322
|
+
*/
|
|
2323
|
+
function isReactRouterExportScan(config) {
|
|
2324
|
+
return config.command === "serve" && config.plugins.some((plugin) => plugin.name === "react-router:virtual-modules") && !config.plugins.some((plugin) => plugin.name === "react-router");
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Identifies a client route module that React Router replaces with re-exports of its route file.
|
|
2328
|
+
*
|
|
2329
|
+
* @param id - Full Vite identity of the module.
|
|
2330
|
+
* @param config - Resolved configuration of the environment that transforms the module.
|
|
2331
|
+
* @returns True when React Router's build plugin selects the module through its query. Its later
|
|
2332
|
+
* transform discards the code of the earlier transforms, and the route file supplies the styles.
|
|
2333
|
+
*/
|
|
2334
|
+
function isReactRouterClientRoute(id, config) {
|
|
2335
|
+
return id.endsWith("?__react-router-build-client-route") && config.plugins.some((plugin) => plugin.name === "react-router:build-client-route");
|
|
2336
|
+
}
|
|
2026
2337
|
// src/vite/projection-imports.ts
|
|
2027
2338
|
/**
|
|
2028
2339
|
* Finds literal projection imports in a source document without evaluating its code.
|
|
2340
|
+
*
|
|
2029
2341
|
* @param code - Original source, optionally in a supported component format.
|
|
2030
2342
|
* @param id - Full source identity whose cleaned path determines the frontend and parser language.
|
|
2031
2343
|
* @returns Distinct static and literal dynamic requests ending in ?stillwind.css, in traversal order.
|
|
@@ -2057,6 +2369,7 @@ async function projectionImports(code, id) {
|
|
|
2057
2369
|
const imports = /* @__PURE__ */ new Set();
|
|
2058
2370
|
/**
|
|
2059
2371
|
* Collects literal projection requests while traversing enumerable AST fields.
|
|
2372
|
+
*
|
|
2060
2373
|
* @param node - Parser AST node or child value. Primitive values are skipped.
|
|
2061
2374
|
*/
|
|
2062
2375
|
const visit = (node) => {
|
|
@@ -2079,8 +2392,8 @@ const warnedEntrypointImports = /* @__PURE__ */ new WeakSet();
|
|
|
2079
2392
|
/**
|
|
2080
2393
|
* Creates source transform and watch hooks for the project compiler plugin.
|
|
2081
2394
|
*
|
|
2082
|
-
* Development
|
|
2083
|
-
* Vite hook context.
|
|
2395
|
+
* Development compilations advance the CSS revision and publish one snapshot after a burst of
|
|
2396
|
+
* compilations. Invalid projection imports fail through the Vite hook context.
|
|
2084
2397
|
*
|
|
2085
2398
|
* @param project - Project configured and initialized by the compiler plugin.
|
|
2086
2399
|
* @param virtualModules - Virtual module hooks for the same project, used to reload cached
|
|
@@ -2091,11 +2404,12 @@ const warnedEntrypointImports = /* @__PURE__ */ new WeakSet();
|
|
|
2091
2404
|
* configured CSS entrypoint is imported as an ordinary stylesheet.
|
|
2092
2405
|
*/
|
|
2093
2406
|
function transformHooks(project, virtualModules, options = {}) {
|
|
2094
|
-
const { settings, publish, compile } = project;
|
|
2407
|
+
const { settings, publish, publishSoon, compile } = project;
|
|
2095
2408
|
const cachedVirtualModules = /* @__PURE__ */ new Map();
|
|
2096
2409
|
return {
|
|
2097
2410
|
/**
|
|
2098
2411
|
* Selects cached modules that need current compiler state and records virtual modules for reloading.
|
|
2412
|
+
*
|
|
2099
2413
|
* @param module - Cached module descriptor whose id includes any source query.
|
|
2100
2414
|
* @returns Whether to rerun transformation for Stillwind virtual modules or supported application sources.
|
|
2101
2415
|
*/
|
|
@@ -2114,6 +2428,7 @@ function transformHooks(project, virtualModules, options = {}) {
|
|
|
2114
2428
|
},
|
|
2115
2429
|
/**
|
|
2116
2430
|
* Invalidates changed configuration or removes deleted source state and publishes resulting CSS.
|
|
2431
|
+
*
|
|
2117
2432
|
* @param id - Watched filesystem identity.
|
|
2118
2433
|
* @param change - Vite event. Source removal is performed only for delete events.
|
|
2119
2434
|
* @returns Completion of removal and publication when required.
|
|
@@ -2129,6 +2444,7 @@ function transformHooks(project, virtualModules, options = {}) {
|
|
|
2129
2444
|
order: options.order === "normal" ? void 0 : "pre",
|
|
2130
2445
|
/**
|
|
2131
2446
|
* Reserves authored CSS names, registers source projections, and compiles supported producers.
|
|
2447
|
+
*
|
|
2132
2448
|
* @param code - Source after earlier transforms in the configured order.
|
|
2133
2449
|
* @param id - Full Vite identity, including queries that select distinct source.
|
|
2134
2450
|
* @returns Compiler output, a reloaded virtual module, or undefined when no transformed source is needed.
|
|
@@ -2148,17 +2464,14 @@ function transformHooks(project, virtualModules, options = {}) {
|
|
|
2148
2464
|
await project.environment(name).reserveAuthoredCss(id, code, this);
|
|
2149
2465
|
return;
|
|
2150
2466
|
}
|
|
2151
|
-
if (!/\.(?:[cm]?[jt]sx?|astro|svelte|vue)$/.test(cleanModuleId(id)) || id.includes("node_modules") || id.startsWith("\0") || /[?&](?:raw|url|type)(?:[=&]|$)/.test(id)) return;
|
|
2467
|
+
if (!/\.(?:[cm]?[jt]sx?|astro|svelte|vue)$/.test(cleanModuleId(id)) || id.includes("node_modules") || id.startsWith("\0") || /[?&](?:raw|url|type)(?:[=&]|$)/.test(id) || this.environment && isReactRouterClientRoute(id, this.environment.getTopLevelConfig())) return;
|
|
2152
2468
|
if (options.originalSource) {
|
|
2153
2469
|
id = cleanModuleId(id);
|
|
2154
2470
|
code = await readFile(await readableFile(id, settings.devServerRef), "utf8");
|
|
2155
2471
|
}
|
|
2156
2472
|
const projections = /* @__PURE__ */ new Map();
|
|
2157
2473
|
for (const specifier of await projectionImports(code, id)) {
|
|
2158
|
-
const source = await this.resolve(specifier.slice(0, -14), id
|
|
2159
|
-
skipSelf: true,
|
|
2160
|
-
custom: { "react-router:dot-server": true }
|
|
2161
|
-
});
|
|
2474
|
+
const source = await resolveServerSource(this.resolve.bind(this), specifier.slice(0, -14), id);
|
|
2162
2475
|
if (!source || source.external) this.error(`Cannot resolve Stillwind projection ${specifier}`);
|
|
2163
2476
|
await readableFile(source.id, settings.devServerRef);
|
|
2164
2477
|
projections.set(specifier, source.id);
|
|
@@ -2166,7 +2479,7 @@ function transformHooks(project, virtualModules, options = {}) {
|
|
|
2166
2479
|
if (!/stillwind\/(?:alpine|astro|lit|preact|qwik|react|solid|svelte|vanilla|vue|module-css)/.test(code)) {
|
|
2167
2480
|
if (project.inputs(name).get(id)) {
|
|
2168
2481
|
await project.environment(name).removeSource(id);
|
|
2169
|
-
|
|
2482
|
+
publishSoon(name);
|
|
2170
2483
|
}
|
|
2171
2484
|
await project.environment(name).projections(id, projections);
|
|
2172
2485
|
return;
|
|
@@ -2178,7 +2491,7 @@ function transformHooks(project, virtualModules, options = {}) {
|
|
|
2178
2491
|
warn: this.warn.bind(this)
|
|
2179
2492
|
} : this;
|
|
2180
2493
|
const result = await compile(name, code, id, context);
|
|
2181
|
-
|
|
2494
|
+
publishSoon(name);
|
|
2182
2495
|
return result;
|
|
2183
2496
|
}
|
|
2184
2497
|
}
|
|
@@ -2228,6 +2541,7 @@ function virtualModuleHooks(project) {
|
|
|
2228
2541
|
return {
|
|
2229
2542
|
/**
|
|
2230
2543
|
* Resolves runtime aliases and issued references in the current environment's registry.
|
|
2544
|
+
*
|
|
2231
2545
|
* @param id - Authored request or resolved virtual identity.
|
|
2232
2546
|
* @param importer - Full importer identity required for registered projection edges.
|
|
2233
2547
|
* @returns A resolved virtual identity or packaged runtime path, or undefined for unrelated requests.
|
|
@@ -2251,6 +2565,7 @@ function virtualModuleHooks(project) {
|
|
|
2251
2565
|
},
|
|
2252
2566
|
/**
|
|
2253
2567
|
* Loads generated runtime, producer, projection, fragment, and explicit CSS-value modules.
|
|
2568
|
+
*
|
|
2254
2569
|
* @param id - Resolved virtual identity issued or recognized by this environment.
|
|
2255
2570
|
* @returns Generated JavaScript or snapshot CSS and its map, or undefined for unrelated modules.
|
|
2256
2571
|
* @throws If a reference is invalid, source or resource access fails, or CSS planning or compilation fails.
|
|
@@ -2408,6 +2723,7 @@ const hooks = /* @__PURE__ */ new WeakMap();
|
|
|
2408
2723
|
function attachVueHooks(plugins, project) {
|
|
2409
2724
|
/**
|
|
2410
2725
|
* Composes a Vue block's map through the recorded Stillwind transform for its source file.
|
|
2726
|
+
*
|
|
2411
2727
|
* @param result - Original load or transform result, left unchanged when a required map is absent.
|
|
2412
2728
|
* @param id - Full Vue block identity, including its `vue` query.
|
|
2413
2729
|
* @param environment - Vite environment whose top-level configuration owns the recorded input.
|
|
@@ -2437,6 +2753,7 @@ function attachVueHooks(plugins, project) {
|
|
|
2437
2753
|
const handler = typeof hook === "function" ? hook : hook.handler;
|
|
2438
2754
|
/**
|
|
2439
2755
|
* Runs the saved Vue load hook with its original receiver, then composes its map.
|
|
2756
|
+
*
|
|
2440
2757
|
* @param id - Resolver identity passed by Vite.
|
|
2441
2758
|
* @param args - Remaining load-hook arguments forwarded unchanged.
|
|
2442
2759
|
* @returns The delegated result with its map composed when the recorded input permits it.
|
|
@@ -2455,6 +2772,7 @@ function attachVueHooks(plugins, project) {
|
|
|
2455
2772
|
const handler = typeof hook === "function" ? hook : hook.handler;
|
|
2456
2773
|
/**
|
|
2457
2774
|
* Composes Vue's map and reloads components with explicit CSS values on template edits.
|
|
2775
|
+
*
|
|
2458
2776
|
* @param code - Vue block source passed by Vite.
|
|
2459
2777
|
* @param id - Resolver identity passed by Vite.
|
|
2460
2778
|
* @param args - Remaining transform-hook arguments forwarded unchanged.
|
|
@@ -2515,20 +2833,24 @@ function createVitePlugins(project, transform = {}) {
|
|
|
2515
2833
|
enforce: "pre",
|
|
2516
2834
|
/**
|
|
2517
2835
|
* Initializes the project owned by this configuration and composes Vue source maps.
|
|
2836
|
+
*
|
|
2518
2837
|
* @param config - Resolved Vite configuration whose plugin chain includes Stillwind.
|
|
2519
2838
|
* @returns Completion of project configuration.
|
|
2520
2839
|
* @throws If configuration discovery or evaluation fails.
|
|
2521
2840
|
*/
|
|
2522
2841
|
async configResolved(config) {
|
|
2842
|
+
if (isReactRouterExportScan(config)) return;
|
|
2523
2843
|
await project.forConfig(config).configure(config);
|
|
2524
2844
|
attachVueHooks(config.plugins, project);
|
|
2525
2845
|
},
|
|
2526
2846
|
/**
|
|
2527
2847
|
* Defers watch registration until the server's plugin setup succeeds.
|
|
2848
|
+
*
|
|
2528
2849
|
* @param server - Server whose configuration owns the project.
|
|
2529
2850
|
* @returns A post hook that attaches watches and records the server's environments.
|
|
2530
2851
|
*/
|
|
2531
2852
|
configureServer(server) {
|
|
2853
|
+
if (isReactRouterExportScan(server.config)) return;
|
|
2532
2854
|
const generation = project.forConfig(server.config);
|
|
2533
2855
|
return () => {
|
|
2534
2856
|
generation.attachServer(server);
|
|
@@ -2538,17 +2860,21 @@ function createVitePlugins(project, transform = {}) {
|
|
|
2538
2860
|
},
|
|
2539
2861
|
/**
|
|
2540
2862
|
* Creates compiler hooks while Vite resolves plugins for an environment.
|
|
2863
|
+
*
|
|
2541
2864
|
* @param environment - Descriptor supplied during plugin resolution. Runtime hooks receive
|
|
2542
2865
|
* their owning instance as this.environment.
|
|
2543
2866
|
* @returns Hooks that initialize and close the compiler state owned by this.environment.
|
|
2544
2867
|
*/
|
|
2545
2868
|
applyToEnvironment(environment) {
|
|
2869
|
+
if (isReactRouterExportScan(environment.getTopLevelConfig())) return false;
|
|
2546
2870
|
const generation = project.forConfig(environment.getTopLevelConfig());
|
|
2547
2871
|
return compilerPlugin(generation, transform, (owner) => {
|
|
2548
2872
|
servers.get(generation)?.delete(owner);
|
|
2549
2873
|
});
|
|
2550
2874
|
},
|
|
2551
|
-
/**
|
|
2875
|
+
/**
|
|
2876
|
+
* Releases projects after all environments owned by their server have closed.
|
|
2877
|
+
*/
|
|
2552
2878
|
closeServer() {
|
|
2553
2879
|
for (const [generation, remaining] of servers) if (remaining.size === 0) {
|
|
2554
2880
|
generation.close();
|
|
@@ -2561,13 +2887,17 @@ function createVitePlugins(project, transform = {}) {
|
|
|
2561
2887
|
enforce: "pre",
|
|
2562
2888
|
apply: "serve",
|
|
2563
2889
|
configureServer(server) {
|
|
2890
|
+
if (isReactRouterExportScan(server.config)) return;
|
|
2564
2891
|
const hook = developmentHooks(project.forConfig(server.config)).configureServer;
|
|
2565
2892
|
if (typeof hook === "function") return hook.call(this, server);
|
|
2566
2893
|
},
|
|
2567
2894
|
applyToEnvironment(environment) {
|
|
2568
|
-
|
|
2895
|
+
if (isReactRouterExportScan(environment.getTopLevelConfig())) return false;
|
|
2896
|
+
const { hotUpdate, watchChange } = developmentHooks(project.forConfig(environment.getTopLevelConfig()));
|
|
2569
2897
|
return {
|
|
2570
2898
|
name: "stillwind:development",
|
|
2899
|
+
perEnvironmentWatchChangeDuringDev: true,
|
|
2900
|
+
watchChange,
|
|
2571
2901
|
hotUpdate: transform.originalSource && typeof hotUpdate === "function" ? {
|
|
2572
2902
|
order: "pre",
|
|
2573
2903
|
handler: hotUpdate
|
|
@@ -2605,6 +2935,7 @@ function compilerPlugin(project, transform, closed) {
|
|
|
2605
2935
|
perEnvironmentWatchChangeDuringDev: true,
|
|
2606
2936
|
/**
|
|
2607
2937
|
* Delegates generated-reference resolution using the current environment's hook context.
|
|
2938
|
+
*
|
|
2608
2939
|
* @param id - Requested module identity.
|
|
2609
2940
|
* @param importer - Importing resolver identity, when available.
|
|
2610
2941
|
* @param options - Vite resolution options forwarded unchanged.
|
|
@@ -2615,6 +2946,7 @@ function compilerPlugin(project, transform, closed) {
|
|
|
2615
2946
|
},
|
|
2616
2947
|
/**
|
|
2617
2948
|
* Delegates generated-module loading through the current environment's registry.
|
|
2949
|
+
*
|
|
2618
2950
|
* @param id - Resolved module identity.
|
|
2619
2951
|
* @param options - Vite load options forwarded unchanged.
|
|
2620
2952
|
* @returns The virtual loader's result, or undefined when no callable hook is available.
|
|
@@ -2625,6 +2957,7 @@ function compilerPlugin(project, transform, closed) {
|
|
|
2625
2957
|
...transformHooks(project, virtualModules, transform),
|
|
2626
2958
|
/**
|
|
2627
2959
|
* Refreshes configuration, registers its watches, and starts the current compiler environment.
|
|
2960
|
+
*
|
|
2628
2961
|
* @returns Completion of configuration refresh and environment initialization.
|
|
2629
2962
|
* @throws If refresh or environment startup fails.
|
|
2630
2963
|
*/
|
|
@@ -2633,7 +2966,9 @@ function compilerPlugin(project, transform, closed) {
|
|
|
2633
2966
|
for (const file of project.configurationFiles) this.addWatchFile(file);
|
|
2634
2967
|
await project.environment(this.environment).start(this);
|
|
2635
2968
|
},
|
|
2636
|
-
/**
|
|
2969
|
+
/**
|
|
2970
|
+
* Releases this environment's state when its plugin container closes.
|
|
2971
|
+
*/
|
|
2637
2972
|
closeBundle() {
|
|
2638
2973
|
project.closeEnvironment(this.environment);
|
|
2639
2974
|
closed(this.environment);
|
|
@@ -2642,4 +2977,4 @@ function compilerPlugin(project, transform, closed) {
|
|
|
2642
2977
|
}
|
|
2643
2978
|
export { renderChunkStyles as i, stillwind as n, createViteProject as r, createVitePlugins as t };
|
|
2644
2979
|
|
|
2645
|
-
//# sourceMappingURL=plugin-
|
|
2980
|
+
//# sourceMappingURL=plugin-DQH8QlYh.js.map
|