@stillwind/integration 0.8.0 → 0.10.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +190 -0
  2. package/dist/astro/development.d.ts +2 -0
  3. package/dist/astro/development.js +2 -0
  4. package/dist/astro/development.js.map +1 -1
  5. package/dist/astro/index.d.ts +1 -1
  6. package/dist/astro/index.js +8 -2
  7. package/dist/astro/index.js.map +1 -1
  8. package/dist/{emission-BVi5aRbb.js → emission-BpaN4Z4m.js} +212 -69
  9. package/dist/emission-BpaN4Z4m.js.map +1 -0
  10. package/dist/fresh/index.d.ts +1 -1
  11. package/dist/fresh/index.js +1 -1
  12. package/dist/{index-DFfbZxNT.d.ts → index-B6EtrWus.d.ts} +2 -2
  13. package/dist/loader-cache-DfOGY8AJ.js +231 -0
  14. package/dist/loader-cache-DfOGY8AJ.js.map +1 -0
  15. package/dist/next/css-loader.d.ts +5 -2
  16. package/dist/next/css-loader.js +7 -2
  17. package/dist/next/css-loader.js.map +1 -1
  18. package/dist/next/index.js +2 -0
  19. package/dist/next/index.js.map +1 -1
  20. package/dist/{node-loader-D-3Ynpy1.d.ts → node-loader-Bqg7E5zq.d.ts} +6 -3
  21. package/dist/nuxt/index.d.ts +2 -2
  22. package/dist/nuxt/index.js +2 -1
  23. package/dist/nuxt/index.js.map +1 -1
  24. package/dist/{plugin-aV0zIIAe.d.ts → plugin-BAG0ZI1X.d.ts} +58 -6
  25. package/dist/{plugin-mPiBLdqa.js → plugin-D-45o54j.js} +5 -2
  26. package/dist/plugin-D-45o54j.js.map +1 -0
  27. package/dist/{plugin-ByYcpBcE.js → plugin-DQH8QlYh.js} +331 -36
  28. package/dist/plugin-DQH8QlYh.js.map +1 -0
  29. package/dist/{project-DUGu8g_L.d.ts → project-B_KFQist.d.ts} +2 -2
  30. package/dist/project-egWF2vWJ.js +428 -0
  31. package/dist/project-egWF2vWJ.js.map +1 -0
  32. package/dist/{project-BNw0nZBE.d.ts → project-mB7CODIs.d.ts} +46 -7
  33. package/dist/rsbuild/index.d.ts +4 -1
  34. package/dist/rsbuild/index.js +2 -2
  35. package/dist/rsbuild/index.js.map +1 -1
  36. package/dist/rspack/index.d.ts +1 -1
  37. package/dist/rspack/index.js +1 -1
  38. package/dist/session-Cxf4D6oQ.d.ts +163 -0
  39. package/dist/source-entries-J5azZ_-z.js +350 -0
  40. package/dist/source-entries-J5azZ_-z.js.map +1 -0
  41. package/dist/turbopack/css-loader.d.ts +5 -2
  42. package/dist/turbopack/css-loader.js +53 -17
  43. package/dist/turbopack/css-loader.js.map +1 -1
  44. package/dist/turbopack/index.d.ts +2 -2
  45. package/dist/turbopack/loader.d.ts +3 -2
  46. package/dist/turbopack/loader.js +10 -4
  47. package/dist/turbopack/loader.js.map +1 -1
  48. package/dist/turbopack/node-loader.d.ts +1 -1
  49. package/dist/turbopack/node-loader.js +1 -0
  50. package/dist/turbopack/node-loader.js.map +1 -1
  51. package/dist/vite/index.d.ts +2 -2
  52. package/dist/vite/index.js +1 -1
  53. package/dist/vite/runtime.d.ts +10 -3
  54. package/dist/vite/runtime.js +8 -1
  55. package/dist/vite/runtime.js.map +1 -1
  56. package/dist/webpack/css-loader.js +1 -1
  57. package/dist/webpack/document-loader.d.ts +4 -1
  58. package/dist/webpack/document-loader.js +5 -2
  59. package/dist/webpack/document-loader.js.map +1 -1
  60. package/dist/webpack/fragment-loader.d.ts +1 -0
  61. package/dist/webpack/fragment-loader.js +1 -0
  62. package/dist/webpack/fragment-loader.js.map +1 -1
  63. package/dist/webpack/index.d.ts +1 -1
  64. package/dist/webpack/index.js +1 -1
  65. package/dist/webpack/loader.js +15 -21
  66. package/dist/webpack/loader.js.map +1 -1
  67. package/dist/webpack/source-loader.d.ts +1 -0
  68. package/dist/webpack/source-loader.js +1 -0
  69. package/dist/webpack/source-loader.js.map +1 -1
  70. package/package.json +19 -17
  71. package/dist/binding-files-Ds5NpyVV.js +0 -45
  72. package/dist/binding-files-Ds5NpyVV.js.map +0 -1
  73. package/dist/emission-BVi5aRbb.js.map +0 -1
  74. package/dist/plugin-ByYcpBcE.js.map +0 -1
  75. package/dist/plugin-mPiBLdqa.js.map +0 -1
  76. package/dist/project-C3IH7geC.js +0 -182
  77. package/dist/project-C3IH7geC.js.map +0 -1
  78. package/dist/session-B9_rp9TH.d.ts +0 -72
  79. package/dist/session-DHUCQMG5.js +0 -117
  80. package/dist/session-DHUCQMG5.js.map +0 -1
@@ -1,11 +1,12 @@
1
1
  import { loaderCompletion } from "../webpack/source-map-loader.js";
2
- import { n as createProject, t as compileGraph } from "../project-C3IH7geC.js";
2
+ import { n as createProject, t as compileGraph } from "../project-egWF2vWJ.js";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { cssWithSourceMap, decodeCssSourceMap } from "@stillwind/host";
5
5
  import path from "node:path";
6
6
  // src/turbopack/css-loader.ts
7
7
  /**
8
8
  * Starts document CSS reconstruction from entries captured in standalone Turbopack loader options.
9
+ *
9
10
  * @param this - Loader context that receives asynchronous CSS and source-map completion or an error.
10
11
  */
11
12
  function turbopackCssLoader() {
@@ -13,32 +14,67 @@ function turbopackCssLoader() {
13
14
  }
14
15
  /**
15
16
  * Reconstructs a document stylesheet and resolves its local resources through the bundler.
17
+ *
16
18
  * @param context - Loader context whose callback receives CSS and a decoded map, or the operation error.
17
19
  * @param entries - Callback that selects absolute or project-relative entries after configuration is evaluated.
18
- * Dependency watches are registered during traversal, and the compiler's checker is closed after planning.
20
+ * Repeats reconstruction if entry discovery changes during compilation or resource resolution.
21
+ * Dependency watches are registered during traversal, and each attempt releases its project.
19
22
  */
20
23
  function emitStylesheet(context, entries) {
21
24
  const callback = loaderCompletion(context);
22
25
  (async () => {
23
- const project = await createProject(context);
24
- try {
25
- const plan = await compileGraph(await entries(project.options), project);
26
- const replacements = /* @__PURE__ */ new Map();
27
- for (const resource of [...project.loaded.resources, ...plan.resources]) {
28
- const file = await project.resolveAsset(resource.specifier, "moduleId" in resource ? project.compiler.resolverId(resource.moduleId) : resource.sourceName);
29
- project.host.watch(file);
30
- let request = path.relative(path.dirname(context.resourcePath), file).replaceAll("\\", "/");
31
- if (!request.startsWith(".")) request = `./${request}`;
32
- replacements.set(resource.placeholder, JSON.stringify(request).slice(1, -1));
26
+ for (;;) {
27
+ const project = await createProject(context);
28
+ try {
29
+ const selected = await entries(project.options);
30
+ let plan;
31
+ try {
32
+ plan = await compileGraph(selected, project);
33
+ } catch (error) {
34
+ if (error.code === "ENOENT" && !sameEntries(selected, await entries(project.options))) continue;
35
+ throw error;
36
+ }
37
+ const replacements = /* @__PURE__ */ new Map();
38
+ for (const resource of [...project.loaded.resources, ...plan.resources]) {
39
+ const file = await project.resolveAsset(resource.specifier, "moduleId" in resource ? project.graphCompiler.resolverId(resource.moduleId) : resource.sourceName);
40
+ project.host.watch(file);
41
+ let request = path.relative(path.dirname(context.resourcePath), file).replaceAll("\\", "/");
42
+ if (!request.startsWith(".")) request = `./${request}`;
43
+ replacements.set(resource.placeholder, JSON.stringify(request).slice(1, -1));
44
+ }
45
+ const key = JSON.stringify([
46
+ plan.coverage.kind === "complete" ? plan.coverage.revision : "",
47
+ context.resourcePath,
48
+ [...replacements]
49
+ ]);
50
+ const previous = renderedStylesheets.get(project.graphCompiler);
51
+ const output = previous?.key === key ? previous.output : decodeCssSourceMap(cssWithSourceMap(plan, replacements));
52
+ if (output.map && previous?.output !== output) output.map.sources = output.map.sources.map((source) => source.startsWith("file:") ? fileURLToPath(source).replaceAll("\\", "/") : source);
53
+ renderedStylesheets.set(project.graphCompiler, {
54
+ key,
55
+ output
56
+ });
57
+ if (!sameEntries(selected, await entries(project.options))) continue;
58
+ callback(null, output.code, output.map && {
59
+ ...output.map,
60
+ sources: [...output.map.sources],
61
+ sourcesContent: output.map.sourcesContent && [...output.map.sourcesContent]
62
+ });
63
+ return;
64
+ } finally {
65
+ project.release();
33
66
  }
34
- const output = decodeCssSourceMap(cssWithSourceMap(plan, replacements));
35
- if (output.map) output.map.sources = output.map.sources.map((source) => source.startsWith("file:") ? fileURLToPath(source).replaceAll("\\", "/") : source);
36
- callback(null, output.code, output.map);
37
- } finally {
38
- project.compiler.close();
39
67
  }
40
68
  })().catch(callback);
41
69
  }
70
+ /**
71
+ * Last stylesheet that each graph compiler rendered, with a key made of the plan revision, the
72
+ * carrier path, and the resource replacements. Equal keys give equal output.
73
+ */
74
+ const renderedStylesheets = /* @__PURE__ */ new WeakMap();
75
+ function sameEntries(previous, current) {
76
+ return previous.length === current.length && previous.every((entry, index) => entry === current[index]);
77
+ }
42
78
  export { turbopackCssLoader as default, emitStylesheet };
43
79
 
44
80
  //# sourceMappingURL=css-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"css-loader.js","names":[],"sources":["../../src/turbopack/css-loader.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { cssWithSourceMap, decodeCssSourceMap } from \"@stillwind/host\";\nimport type { LoaderContext } from \"webpack\";\n\nimport { loaderCompletion } from \"../webpack/source-map-loader.ts\";\nimport {\n compileGraph,\n createProject,\n type TurbopackLoaderOptions,\n type TurbopackProject,\n} from \"./project.ts\";\n\n/**\n * Starts document CSS reconstruction from entries captured in standalone Turbopack loader options.\n * @param this - Loader context that receives asynchronous CSS and source-map completion or an error.\n */\nexport default function turbopackCssLoader(this: LoaderContext<TurbopackLoaderOptions>) {\n emitStylesheet(this, async (options) => options.entries);\n}\n\n/**\n * Reconstructs a document stylesheet and resolves its local resources through the bundler.\n * @param context - Loader context whose callback receives CSS and a decoded map, or the operation error.\n * @param entries - Callback that selects absolute or project-relative entries after configuration is evaluated.\n * Dependency watches are registered during traversal, and the compiler's checker is closed after planning.\n */\nexport function emitStylesheet(\n context: LoaderContext<TurbopackLoaderOptions>,\n entries: (options: TurbopackProject[\"options\"]) => Promise<string[]>,\n): void {\n const callback = loaderCompletion(context);\n void (async () => {\n const project = await createProject(context);\n try {\n const plan = await compileGraph(await entries(project.options), project);\n const replacements = new Map<string, string>();\n for (const resource of [...project.loaded.resources, ...plan.resources]) {\n const file = await project.resolveAsset(\n resource.specifier,\n \"moduleId\" in resource\n ? project.compiler.resolverId(resource.moduleId)\n : resource.sourceName,\n );\n project.host.watch(file);\n let request = path.relative(path.dirname(context.resourcePath), file).replaceAll(\"\\\\\", \"/\");\n if (!request.startsWith(\".\")) {\n request = `./${request}`;\n }\n replacements.set(resource.placeholder, JSON.stringify(request).slice(1, -1));\n }\n const output = decodeCssSourceMap(cssWithSourceMap(plan, replacements));\n if (output.map) {\n output.map.sources = output.map.sources.map((source: string) =>\n source.startsWith(\"file:\") ? fileURLToPath(source).replaceAll(\"\\\\\", \"/\") : source,\n );\n }\n callback(null, output.code, output.map);\n } finally {\n project.compiler.close();\n }\n })().catch(callback);\n}\n"],"mappings":";;;;;;;;;;AAkBA,SAAwB,qBAAgE;CACtF,eAAe,MAAM,OAAO,YAAY,QAAQ,OAAO;AACzD;;;;;;;AAQA,SAAgB,eACd,SACA,SACM;CACN,MAAM,WAAW,iBAAiB,OAAO;CACzC,CAAM,YAAY;EAChB,MAAM,UAAU,MAAM,cAAc,OAAO;EAC3C,IAAI;GACF,MAAM,OAAO,MAAM,aAAa,MAAM,QAAQ,QAAQ,OAAO,GAAG,OAAO;GACvE,MAAM,+BAAe,IAAI,IAAoB;GAC7C,KAAK,MAAM,YAAY,CAAC,GAAG,QAAQ,OAAO,WAAW,GAAG,KAAK,SAAS,GAAG;IACvE,MAAM,OAAO,MAAM,QAAQ,aACzB,SAAS,WACT,cAAc,WACV,QAAQ,SAAS,WAAW,SAAS,QAAQ,IAC7C,SAAS,UACf;IACA,QAAQ,KAAK,MAAM,IAAI;IACvB,IAAI,UAAU,KAAK,SAAS,KAAK,QAAQ,QAAQ,YAAY,GAAG,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG;IAC1F,IAAI,CAAC,QAAQ,WAAW,GAAG,GACzB,UAAU,KAAK;IAEjB,aAAa,IAAI,SAAS,aAAa,KAAK,UAAU,OAAO,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC;GAC7E;GACA,MAAM,SAAS,mBAAmB,iBAAiB,MAAM,YAAY,CAAC;GACtE,IAAI,OAAO,KACT,OAAO,IAAI,UAAU,OAAO,IAAI,QAAQ,KAAK,WAC3C,OAAO,WAAW,OAAO,IAAI,cAAc,MAAM,CAAC,CAAC,WAAW,MAAM,GAAG,IAAI,MAC7E;GAEF,SAAS,MAAM,OAAO,MAAM,OAAO,GAAG;EACxC,UAAU;GACR,QAAQ,SAAS,MAAM;EACzB;CACF,EAAA,CAAG,CAAC,CAAC,MAAM,QAAQ;AACrB"}
1
+ {"version":3,"file":"css-loader.js","names":[],"sources":["../../src/turbopack/css-loader.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { cssWithSourceMap, decodeCssSourceMap } from \"@stillwind/host\";\nimport type { LoaderContext } from \"webpack\";\n\nimport { loaderCompletion } from \"../webpack/source-map-loader.ts\";\nimport {\n compileGraph,\n createProject,\n type TurbopackLoaderOptions,\n type TurbopackProject,\n} from \"./project.ts\";\n\n/**\n * Starts document CSS reconstruction from entries captured in standalone Turbopack loader options.\n *\n * @param this - Loader context that receives asynchronous CSS and source-map completion or an error.\n */\nexport default function turbopackCssLoader(this: LoaderContext<TurbopackLoaderOptions>) {\n emitStylesheet(this, async (options) => options.entries);\n}\n\n/**\n * Reconstructs a document stylesheet and resolves its local resources through the bundler.\n *\n * @param context - Loader context whose callback receives CSS and a decoded map, or the operation error.\n * @param entries - Callback that selects absolute or project-relative entries after configuration is evaluated.\n * Repeats reconstruction if entry discovery changes during compilation or resource resolution.\n * Dependency watches are registered during traversal, and each attempt releases its project.\n */\nexport function emitStylesheet(\n context: LoaderContext<TurbopackLoaderOptions>,\n entries: (options: TurbopackProject[\"options\"]) => Promise<string[]>,\n): void {\n const callback = loaderCompletion(context);\n void (async () => {\n for (;;) {\n const project = await createProject(context);\n try {\n const selected = await entries(project.options);\n let plan;\n try {\n plan = await compileGraph(selected, project);\n } catch (error) {\n if (\n (error as NodeJS.ErrnoException).code === \"ENOENT\" &&\n !sameEntries(selected, await entries(project.options))\n ) {\n continue;\n }\n throw error;\n }\n const replacements = new Map<string, string>();\n for (const resource of [...project.loaded.resources, ...plan.resources]) {\n const file = await project.resolveAsset(\n resource.specifier,\n \"moduleId\" in resource\n ? project.graphCompiler.resolverId(resource.moduleId)\n : resource.sourceName,\n );\n project.host.watch(file);\n let request = path\n .relative(path.dirname(context.resourcePath), file)\n .replaceAll(\"\\\\\", \"/\");\n if (!request.startsWith(\".\")) {\n request = `./${request}`;\n }\n replacements.set(resource.placeholder, JSON.stringify(request).slice(1, -1));\n }\n // Next runs this loader for the stylesheet carrier of each compiler and layer after one\n // edit. Rendering the stylesheet and its map takes most of a call that compiles nothing.\n const key = JSON.stringify([\n plan.coverage.kind === \"complete\" ? plan.coverage.revision : \"\",\n context.resourcePath,\n [...replacements],\n ]);\n const previous = renderedStylesheets.get(project.graphCompiler);\n const output =\n previous?.key === key\n ? previous.output\n : decodeCssSourceMap(cssWithSourceMap(plan, replacements));\n if (output.map && previous?.output !== output) {\n output.map.sources = output.map.sources.map((source: string) =>\n source.startsWith(\"file:\") ? fileURLToPath(source).replaceAll(\"\\\\\", \"/\") : source,\n );\n }\n renderedStylesheets.set(project.graphCompiler, { key, output });\n // Turbopack registers context dependencies after a loader finishes. A route added\n // during reconstruction can become part of that baseline without being in this CSS.\n if (!sameEntries(selected, await entries(project.options))) {\n continue;\n }\n // The bundler may change the map that it receives.\n callback(\n null,\n output.code,\n output.map && {\n ...output.map,\n sources: [...output.map.sources],\n sourcesContent: output.map.sourcesContent && [...output.map.sourcesContent],\n },\n );\n return;\n } finally {\n project.release();\n }\n }\n })().catch(callback);\n}\n\n/**\n * Last stylesheet that each graph compiler rendered, with a key made of the plan revision, the\n * carrier path, and the resource replacements. Equal keys give equal output.\n */\nconst renderedStylesheets = new WeakMap<\n TurbopackProject[\"graphCompiler\"],\n {\n key: string;\n output: ReturnType<typeof decodeCssSourceMap>;\n }\n>();\n\nfunction sameEntries(previous: readonly string[], current: readonly string[]): boolean {\n return (\n previous.length === current.length && previous.every((entry, index) => entry === current[index])\n );\n}\n"],"mappings":";;;;;;;;;;;AAmBA,SAAwB,qBAAgE;CACtF,eAAe,MAAM,OAAO,YAAY,QAAQ,OAAO;AACzD;;;;;;;;;AAUA,SAAgB,eACd,SACA,SACM;CACN,MAAM,WAAW,iBAAiB,OAAO;CACzC,CAAM,YAAY;EAChB,SAAS;GACP,MAAM,UAAU,MAAM,cAAc,OAAO;GAC3C,IAAI;IACF,MAAM,WAAW,MAAM,QAAQ,QAAQ,OAAO;IAC9C,IAAI;IACJ,IAAI;KACF,OAAO,MAAM,aAAa,UAAU,OAAO;IAC7C,SAAS,OAAO;KACd,IACG,MAAgC,SAAS,YAC1C,CAAC,YAAY,UAAU,MAAM,QAAQ,QAAQ,OAAO,CAAC,GAErD;KAEF,MAAM;IACR;IACA,MAAM,+BAAe,IAAI,IAAoB;IAC7C,KAAK,MAAM,YAAY,CAAC,GAAG,QAAQ,OAAO,WAAW,GAAG,KAAK,SAAS,GAAG;KACvE,MAAM,OAAO,MAAM,QAAQ,aACzB,SAAS,WACT,cAAc,WACV,QAAQ,cAAc,WAAW,SAAS,QAAQ,IAClD,SAAS,UACf;KACA,QAAQ,KAAK,MAAM,IAAI;KACvB,IAAI,UAAU,KACX,SAAS,KAAK,QAAQ,QAAQ,YAAY,GAAG,IAAI,CAAC,CAClD,WAAW,MAAM,GAAG;KACvB,IAAI,CAAC,QAAQ,WAAW,GAAG,GACzB,UAAU,KAAK;KAEjB,aAAa,IAAI,SAAS,aAAa,KAAK,UAAU,OAAO,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC;IAC7E;IAGA,MAAM,MAAM,KAAK,UAAU;KACzB,KAAK,SAAS,SAAS,aAAa,KAAK,SAAS,WAAW;KAC7D,QAAQ;KACR,CAAC,GAAG,YAAY;IAClB,CAAC;IACD,MAAM,WAAW,oBAAoB,IAAI,QAAQ,aAAa;IAC9D,MAAM,SACJ,UAAU,QAAQ,MACd,SAAS,SACT,mBAAmB,iBAAiB,MAAM,YAAY,CAAC;IAC7D,IAAI,OAAO,OAAO,UAAU,WAAW,QACrC,OAAO,IAAI,UAAU,OAAO,IAAI,QAAQ,KAAK,WAC3C,OAAO,WAAW,OAAO,IAAI,cAAc,MAAM,CAAC,CAAC,WAAW,MAAM,GAAG,IAAI,MAC7E;IAEF,oBAAoB,IAAI,QAAQ,eAAe;KAAE;KAAK;IAAO,CAAC;IAG9D,IAAI,CAAC,YAAY,UAAU,MAAM,QAAQ,QAAQ,OAAO,CAAC,GACvD;IAGF,SACE,MACA,OAAO,MACP,OAAO,OAAO;KACZ,GAAG,OAAO;KACV,SAAS,CAAC,GAAG,OAAO,IAAI,OAAO;KAC/B,gBAAgB,OAAO,IAAI,kBAAkB,CAAC,GAAG,OAAO,IAAI,cAAc;IAC5E,CACF;IACA;GACF,UAAU;IACR,QAAQ,QAAQ;GAClB;EACF;CACF,EAAA,CAAG,CAAC,CAAC,MAAM,QAAQ;AACrB;;;;;AAMA,MAAM,sCAAsB,IAAI,QAM9B;AAEF,SAAS,YAAY,UAA6B,SAAqC;CACrF,OACE,SAAS,WAAW,QAAQ,UAAU,SAAS,OAAO,OAAO,UAAU,UAAU,QAAQ,MAAM;AAEnG"}
@@ -1,5 +1,5 @@
1
- import "../project-BNw0nZBE.js";
2
- import { t as NodeLoaderOptions } from "../node-loader-D-3Ynpy1.js";
1
+ import { t as NodeLoaderOptions } from "../node-loader-Bqg7E5zq.js";
2
+ import "../project-mB7CODIs.js";
3
3
  import { SerializableInlineConfig } from "@stillwind/config";
4
4
  /**
5
5
  * Serializable inline settings and entry selection for standalone Turbopack rules.
@@ -1,13 +1,14 @@
1
- import { t as TurbopackLoaderOptions } from "../project-BNw0nZBE.js";
1
+ import { t as TurbopackLoaderOptions } from "../project-mB7CODIs.js";
2
2
  import { UpstreamSourceMap } from "@stillwind/host";
3
3
  import { LoaderContext } from "webpack";
4
4
  /**
5
5
  * Compiles producer source or emits a JavaScript CSS value for its module-css query.
6
+ *
6
7
  * @param this - Bundler loader context that supplies options, source identity, resolution, and async completion.
7
8
  * @param source - Original module text. Sources without recognized Stillwind imports pass through unchanged.
8
9
  * @param inputMap - Optional upstream map composed with compiler replacements for producer output.
9
10
  * @returns The immediate callback result for pass-through source, or undefined while asynchronous compilation runs.
10
- * Compilation registers dependencies, may add an automatic document carrier import, and closes its checker afterward.
11
+ * Compilation registers dependencies, may add an automatic document carrier import, and releases its project afterward.
11
12
  */
12
13
  export default function turbopackLoader(this: LoaderContext<TurbopackLoaderOptions>, source: string, inputMap: UpstreamSourceMap): void;
13
14
  //# sourceMappingURL=loader.d.ts.map
@@ -1,16 +1,17 @@
1
1
  import { loaderCompletion } from "../webpack/source-map-loader.js";
2
- import { n as createProject } from "../project-C3IH7geC.js";
2
+ import { n as createProject } from "../project-egWF2vWJ.js";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { composeModuleSourceMap, moduleSourceMap, warnRejectedNames } from "@stillwind/host";
5
5
  import path from "node:path";
6
6
  // src/turbopack/loader.ts
7
7
  /**
8
8
  * Compiles producer source or emits a JavaScript CSS value for its module-css query.
9
+ *
9
10
  * @param this - Bundler loader context that supplies options, source identity, resolution, and async completion.
10
11
  * @param source - Original module text. Sources without recognized Stillwind imports pass through unchanged.
11
12
  * @param inputMap - Optional upstream map composed with compiler replacements for producer output.
12
13
  * @returns The immediate callback result for pass-through source, or undefined while asynchronous compilation runs.
13
- * Compilation registers dependencies, may add an automatic document carrier import, and closes its checker afterward.
14
+ * Compilation registers dependencies, may add an automatic document carrier import, and releases its project afterward.
14
15
  */
15
16
  function turbopackLoader(source, inputMap) {
16
17
  const callback = loaderCompletion(this);
@@ -18,8 +19,13 @@ function turbopackLoader(source, inputMap) {
18
19
  (async () => {
19
20
  const project = await createProject(this);
20
21
  try {
22
+ project.compiler.sourceRead(this.resourcePath, source);
23
+ const resource = path.normalize(this.resourcePath);
21
24
  const request = `./${path.basename(this.resourcePath)}?stillwind-module-css`;
22
- const output = await project.compiler.compile(source, this.resourcePath, project.host, { moduleCssImport: request });
25
+ const output = await project.compiler.compile(source, this.resourcePath, {
26
+ ...project.host,
27
+ read: (id) => path.normalize(id) === resource ? Promise.resolve(source) : project.host.read(id)
28
+ }, { moduleCssImport: request });
23
29
  if (!output?.code) return callback(null, source, inputMap);
24
30
  if (new URLSearchParams(this.resourceQuery).has("stillwind-module-css")) {
25
31
  const plan = project.compiler.native.planStylesheet({
@@ -61,7 +67,7 @@ function turbopackLoader(source, inputMap) {
61
67
  }
62
68
  callback(null, code, composeModuleSourceMap(moduleSourceMap(source, output.code, this.resourcePath, output.mappings, [], ""), inputMap));
63
69
  } finally {
64
- project.compiler.close();
70
+ project.release();
65
71
  }
66
72
  })().catch(callback);
67
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","names":[],"sources":["../../src/turbopack/loader.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport {\n composeModuleSourceMap,\n moduleSourceMap,\n warnRejectedNames,\n type UpstreamSourceMap,\n} from \"@stillwind/host\";\nimport type { LoaderContext } from \"webpack\";\n\nimport { loaderCompletion } from \"../webpack/source-map-loader.ts\";\nimport { createProject, type TurbopackLoaderOptions } from \"./project.ts\";\n\n/**\n * Compiles producer source or emits a JavaScript CSS value for its module-css query.\n * @param this - Bundler loader context that supplies options, source identity, resolution, and async completion.\n * @param source - Original module text. Sources without recognized Stillwind imports pass through unchanged.\n * @param inputMap - Optional upstream map composed with compiler replacements for producer output.\n * @returns The immediate callback result for pass-through source, or undefined while asynchronous compilation runs.\n * Compilation registers dependencies, may add an automatic document carrier import, and closes its checker afterward.\n */\nexport default function turbopackLoader(\n this: LoaderContext<TurbopackLoaderOptions>,\n source: string,\n inputMap: UpstreamSourceMap,\n) {\n const callback = loaderCompletion(this);\n if (\n !/stillwind\\/(?:alpine|astro|lit|preact|qwik|react|solid|svelte|vanilla|vue|module-css)/.test(\n source,\n )\n ) {\n return callback(null, source, inputMap);\n }\n void (async () => {\n const project = await createProject(this);\n try {\n const request = `./${path.basename(this.resourcePath)}?stillwind-module-css`;\n const output = await project.compiler.compile(source, this.resourcePath, project.host, {\n moduleCssImport: request,\n });\n if (!output?.code) {\n return callback(null, source, inputMap);\n }\n if (new URLSearchParams(this.resourceQuery).has(\"stillwind-module-css\")) {\n const plan = project.compiler.native.planStylesheet({\n modules: [output.moduleId],\n coverage: { kind: \"observed\" },\n placement: \"document\",\n });\n warnRejectedNames(plan.rejectedNames, (message) => project.host.warn(message));\n const imports: string[] = [];\n const replacements: string[] = [];\n for (const resource of [...project.loaded.resources, ...plan.resources]) {\n const file = await project.resolveAsset(\n resource.specifier,\n \"moduleId\" in resource\n ? project.compiler.resolverId(resource.moduleId)\n : resource.sourceName,\n );\n project.host.watch(file);\n let request = path.relative(path.dirname(this.resourcePath), file).replaceAll(\"\\\\\", \"/\");\n if (!request.startsWith(\".\")) {\n request = `./${request}`;\n }\n const binding = `asset${imports.length}`;\n imports.push(`import ${binding} from ${JSON.stringify(request)};\\n`);\n replacements.push(\n `.replaceAll(${JSON.stringify(resource.placeholder)}, JSON.stringify(typeof ${binding} === \"string\" ? ${binding} : ${binding}.src).slice(1, -1))`,\n );\n }\n return callback(\n null,\n [\n \"// Stillwind CSS value (turbopack)\\n\",\n 'import { cssText } from \"stillwind/css\";\\n',\n ...imports,\n \"\\n\",\n `export const parts = ${JSON.stringify(plan.parts.map(({ key, css, banners }) => ({ key, css, banners })))}.map((part) => ({ ...part, css: part.css${replacements.join(\"\")} }));\\n`,\n \"export const css = cssText(parts);\\n\",\n \"export default css;\\n\",\n ].join(\"\"),\n );\n }\n let code = output.code;\n if (!output.hasModuleCssImport && project.options.compiler.automatic !== false) {\n let carrier = path\n .relative(\n path.dirname(this.resourcePath),\n fileURLToPath(\n new URL(\n \"./stillwind-turbopack.css\",\n import.meta.resolve(\"@stillwind/integration/turbopack\"),\n ),\n ),\n )\n .replaceAll(\"\\\\\", \"/\");\n if (!carrier.startsWith(\".\")) {\n carrier = `./${carrier}`;\n }\n code += `\\nimport ${JSON.stringify(carrier)};\\n`;\n }\n callback(\n null,\n code,\n composeModuleSourceMap(\n moduleSourceMap(source, output.code, this.resourcePath, output.mappings, [], \"\"),\n inputMap,\n ),\n );\n } finally {\n project.compiler.close();\n }\n })().catch(callback);\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,SAAwB,gBAEtB,QACA,UACA;CACA,MAAM,WAAW,iBAAiB,IAAI;CACtC,IACE,CAAC,wFAAwF,KACvF,MACF,GAEA,OAAO,SAAS,MAAM,QAAQ,QAAQ;CAExC,CAAM,YAAY;EAChB,MAAM,UAAU,MAAM,cAAc,IAAI;EACxC,IAAI;GACF,MAAM,UAAU,KAAK,KAAK,SAAS,KAAK,YAAY,EAAE;GACtD,MAAM,SAAS,MAAM,QAAQ,SAAS,QAAQ,QAAQ,KAAK,cAAc,QAAQ,MAAM,EACrF,iBAAiB,QACnB,CAAC;GACD,IAAI,CAAC,QAAQ,MACX,OAAO,SAAS,MAAM,QAAQ,QAAQ;GAExC,IAAI,IAAI,gBAAgB,KAAK,aAAa,CAAC,CAAC,IAAI,sBAAsB,GAAG;IACvE,MAAM,OAAO,QAAQ,SAAS,OAAO,eAAe;KAClD,SAAS,CAAC,OAAO,QAAQ;KACzB,UAAU,EAAE,MAAM,WAAW;KAC7B,WAAW;IACb,CAAC;IACD,kBAAkB,KAAK,gBAAgB,YAAY,QAAQ,KAAK,KAAK,OAAO,CAAC;IAC7E,MAAM,UAAoB,CAAC;IAC3B,MAAM,eAAyB,CAAC;IAChC,KAAK,MAAM,YAAY,CAAC,GAAG,QAAQ,OAAO,WAAW,GAAG,KAAK,SAAS,GAAG;KACvE,MAAM,OAAO,MAAM,QAAQ,aACzB,SAAS,WACT,cAAc,WACV,QAAQ,SAAS,WAAW,SAAS,QAAQ,IAC7C,SAAS,UACf;KACA,QAAQ,KAAK,MAAM,IAAI;KACvB,IAAI,UAAU,KAAK,SAAS,KAAK,QAAQ,KAAK,YAAY,GAAG,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG;KACvF,IAAI,CAAC,QAAQ,WAAW,GAAG,GACzB,UAAU,KAAK;KAEjB,MAAM,UAAU,QAAQ,QAAQ;KAChC,QAAQ,KAAK,UAAU,QAAQ,QAAQ,KAAK,UAAU,OAAO,EAAE,IAAI;KACnE,aAAa,KACX,eAAe,KAAK,UAAU,SAAS,WAAW,EAAE,0BAA0B,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,oBAC/H;IACF;IACA,OAAO,SACL,MACA;KACE;KACA;KACA,GAAG;KACH;KACA,wBAAwB,KAAK,UAAU,KAAK,MAAM,KAAK,EAAE,KAAK,KAAK,eAAe;MAAE;MAAK;MAAK;KAAQ,EAAE,CAAC,EAAE,0CAA0C,aAAa,KAAK,EAAE,EAAE;KAC3K;KACA;IACF,CAAC,CAAC,KAAK,EAAE,CACX;GACF;GACA,IAAI,OAAO,OAAO;GAClB,IAAI,CAAC,OAAO,sBAAsB,QAAQ,QAAQ,SAAS,cAAc,OAAO;IAC9E,IAAI,UAAU,KACX,SACC,KAAK,QAAQ,KAAK,YAAY,GAC9B,cACE,IAAI,IACF,6BACA,YAAY,QAAQ,kCAAkC,CACxD,CACF,CACF,CAAC,CACA,WAAW,MAAM,GAAG;IACvB,IAAI,CAAC,QAAQ,WAAW,GAAG,GACzB,UAAU,KAAK;IAEjB,QAAQ,YAAY,KAAK,UAAU,OAAO,EAAE;GAC9C;GACA,SACE,MACA,MACA,uBACE,gBAAgB,QAAQ,OAAO,MAAM,KAAK,cAAc,OAAO,UAAU,CAAC,GAAG,EAAE,GAC/E,QACF,CACF;EACF,UAAU;GACR,QAAQ,SAAS,MAAM;EACzB;CACF,EAAA,CAAG,CAAC,CAAC,MAAM,QAAQ;AACrB"}
1
+ {"version":3,"file":"loader.js","names":[],"sources":["../../src/turbopack/loader.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport {\n composeModuleSourceMap,\n moduleSourceMap,\n warnRejectedNames,\n type UpstreamSourceMap,\n} from \"@stillwind/host\";\nimport type { LoaderContext } from \"webpack\";\n\nimport { loaderCompletion } from \"../webpack/source-map-loader.ts\";\nimport { createProject, type TurbopackLoaderOptions } from \"./project.ts\";\n\n/**\n * Compiles producer source or emits a JavaScript CSS value for its module-css query.\n *\n * @param this - Bundler loader context that supplies options, source identity, resolution, and async completion.\n * @param source - Original module text. Sources without recognized Stillwind imports pass through unchanged.\n * @param inputMap - Optional upstream map composed with compiler replacements for producer output.\n * @returns The immediate callback result for pass-through source, or undefined while asynchronous compilation runs.\n * Compilation registers dependencies, may add an automatic document carrier import, and releases its project afterward.\n */\nexport default function turbopackLoader(\n this: LoaderContext<TurbopackLoaderOptions>,\n source: string,\n inputMap: UpstreamSourceMap,\n) {\n const callback = loaderCompletion(this);\n if (\n !/stillwind\\/(?:alpine|astro|lit|preact|qwik|react|solid|svelte|vanilla|vue|module-css)/.test(\n source,\n )\n ) {\n return callback(null, source, inputMap);\n }\n void (async () => {\n const project = await createProject(this);\n try {\n // Right after an edit, the loader filesystem can still return the previous text of the\n // resource. The shared sources then take the text that this call received.\n project.compiler.sourceRead(this.resourcePath, source);\n const resource = path.normalize(this.resourcePath);\n const request = `./${path.basename(this.resourcePath)}?stillwind-module-css`;\n const output = await project.compiler.compile(\n source,\n this.resourcePath,\n {\n ...project.host,\n read: (id) =>\n path.normalize(id) === resource ? Promise.resolve(source) : project.host.read(id),\n },\n {\n moduleCssImport: request,\n },\n );\n if (!output?.code) {\n return callback(null, source, inputMap);\n }\n if (new URLSearchParams(this.resourceQuery).has(\"stillwind-module-css\")) {\n const plan = project.compiler.native.planStylesheet({\n modules: [output.moduleId],\n coverage: { kind: \"observed\" },\n placement: \"document\",\n });\n warnRejectedNames(plan.rejectedNames, (message) => project.host.warn(message));\n const imports: string[] = [];\n const replacements: string[] = [];\n for (const resource of [...project.loaded.resources, ...plan.resources]) {\n const file = await project.resolveAsset(\n resource.specifier,\n \"moduleId\" in resource\n ? project.compiler.resolverId(resource.moduleId)\n : resource.sourceName,\n );\n project.host.watch(file);\n let request = path.relative(path.dirname(this.resourcePath), file).replaceAll(\"\\\\\", \"/\");\n if (!request.startsWith(\".\")) {\n request = `./${request}`;\n }\n const binding = `asset${imports.length}`;\n imports.push(`import ${binding} from ${JSON.stringify(request)};\\n`);\n replacements.push(\n `.replaceAll(${JSON.stringify(resource.placeholder)}, JSON.stringify(typeof ${binding} === \"string\" ? ${binding} : ${binding}.src).slice(1, -1))`,\n );\n }\n return callback(\n null,\n [\n \"// Stillwind CSS value (turbopack)\\n\",\n 'import { cssText } from \"stillwind/css\";\\n',\n ...imports,\n \"\\n\",\n `export const parts = ${JSON.stringify(plan.parts.map(({ key, css, banners }) => ({ key, css, banners })))}.map((part) => ({ ...part, css: part.css${replacements.join(\"\")} }));\\n`,\n \"export const css = cssText(parts);\\n\",\n \"export default css;\\n\",\n ].join(\"\"),\n );\n }\n let code = output.code;\n if (!output.hasModuleCssImport && project.options.compiler.automatic !== false) {\n let carrier = path\n .relative(\n path.dirname(this.resourcePath),\n fileURLToPath(\n new URL(\n \"./stillwind-turbopack.css\",\n import.meta.resolve(\"@stillwind/integration/turbopack\"),\n ),\n ),\n )\n .replaceAll(\"\\\\\", \"/\");\n if (!carrier.startsWith(\".\")) {\n carrier = `./${carrier}`;\n }\n code += `\\nimport ${JSON.stringify(carrier)};\\n`;\n }\n callback(\n null,\n code,\n composeModuleSourceMap(\n moduleSourceMap(source, output.code, this.resourcePath, output.mappings, [], \"\"),\n inputMap,\n ),\n );\n } finally {\n project.release();\n }\n })().catch(callback);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,SAAwB,gBAEtB,QACA,UACA;CACA,MAAM,WAAW,iBAAiB,IAAI;CACtC,IACE,CAAC,wFAAwF,KACvF,MACF,GAEA,OAAO,SAAS,MAAM,QAAQ,QAAQ;CAExC,CAAM,YAAY;EAChB,MAAM,UAAU,MAAM,cAAc,IAAI;EACxC,IAAI;GAGF,QAAQ,SAAS,WAAW,KAAK,cAAc,MAAM;GACrD,MAAM,WAAW,KAAK,UAAU,KAAK,YAAY;GACjD,MAAM,UAAU,KAAK,KAAK,SAAS,KAAK,YAAY,EAAE;GACtD,MAAM,SAAS,MAAM,QAAQ,SAAS,QACpC,QACA,KAAK,cACL;IACE,GAAG,QAAQ;IACX,OAAO,OACL,KAAK,UAAU,EAAE,MAAM,WAAW,QAAQ,QAAQ,MAAM,IAAI,QAAQ,KAAK,KAAK,EAAE;GACpF,GACA,EACE,iBAAiB,QACnB,CACF;GACA,IAAI,CAAC,QAAQ,MACX,OAAO,SAAS,MAAM,QAAQ,QAAQ;GAExC,IAAI,IAAI,gBAAgB,KAAK,aAAa,CAAC,CAAC,IAAI,sBAAsB,GAAG;IACvE,MAAM,OAAO,QAAQ,SAAS,OAAO,eAAe;KAClD,SAAS,CAAC,OAAO,QAAQ;KACzB,UAAU,EAAE,MAAM,WAAW;KAC7B,WAAW;IACb,CAAC;IACD,kBAAkB,KAAK,gBAAgB,YAAY,QAAQ,KAAK,KAAK,OAAO,CAAC;IAC7E,MAAM,UAAoB,CAAC;IAC3B,MAAM,eAAyB,CAAC;IAChC,KAAK,MAAM,YAAY,CAAC,GAAG,QAAQ,OAAO,WAAW,GAAG,KAAK,SAAS,GAAG;KACvE,MAAM,OAAO,MAAM,QAAQ,aACzB,SAAS,WACT,cAAc,WACV,QAAQ,SAAS,WAAW,SAAS,QAAQ,IAC7C,SAAS,UACf;KACA,QAAQ,KAAK,MAAM,IAAI;KACvB,IAAI,UAAU,KAAK,SAAS,KAAK,QAAQ,KAAK,YAAY,GAAG,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG;KACvF,IAAI,CAAC,QAAQ,WAAW,GAAG,GACzB,UAAU,KAAK;KAEjB,MAAM,UAAU,QAAQ,QAAQ;KAChC,QAAQ,KAAK,UAAU,QAAQ,QAAQ,KAAK,UAAU,OAAO,EAAE,IAAI;KACnE,aAAa,KACX,eAAe,KAAK,UAAU,SAAS,WAAW,EAAE,0BAA0B,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,oBAC/H;IACF;IACA,OAAO,SACL,MACA;KACE;KACA;KACA,GAAG;KACH;KACA,wBAAwB,KAAK,UAAU,KAAK,MAAM,KAAK,EAAE,KAAK,KAAK,eAAe;MAAE;MAAK;MAAK;KAAQ,EAAE,CAAC,EAAE,0CAA0C,aAAa,KAAK,EAAE,EAAE;KAC3K;KACA;IACF,CAAC,CAAC,KAAK,EAAE,CACX;GACF;GACA,IAAI,OAAO,OAAO;GAClB,IAAI,CAAC,OAAO,sBAAsB,QAAQ,QAAQ,SAAS,cAAc,OAAO;IAC9E,IAAI,UAAU,KACX,SACC,KAAK,QAAQ,KAAK,YAAY,GAC9B,cACE,IAAI,IACF,6BACA,YAAY,QAAQ,kCAAkC,CACxD,CACF,CACF,CAAC,CACA,WAAW,MAAM,GAAG;IACvB,IAAI,CAAC,QAAQ,WAAW,GAAG,GACzB,UAAU,KAAK;IAEjB,QAAQ,YAAY,KAAK,UAAU,OAAO,EAAE;GAC9C;GACA,SACE,MACA,MACA,uBACE,gBAAgB,QAAQ,OAAO,MAAM,KAAK,cAAc,OAAO,UAAU,CAAC,GAAG,EAAE,GAC/E,QACF,CACF;EACF,UAAU;GACR,QAAQ,QAAQ;EAClB;CACF,EAAA,CAAG,CAAC,CAAC,MAAM,QAAQ;AACrB"}
@@ -1,2 +1,2 @@
1
- import { n as nodeLoader, t as NodeLoaderOptions } from "../node-loader-D-3Ynpy1.js";
1
+ import { n as nodeLoader, t as NodeLoaderOptions } from "../node-loader-Bqg7E5zq.js";
2
2
  export { NodeLoaderOptions, nodeLoader as default };
@@ -2,6 +2,7 @@ import { pathToFileURL } from "node:url";
2
2
  // src/turbopack/node-loader.ts
3
3
  /**
4
4
  * Loads the compiler in Node without exposing its dependencies to Turbopack's loader tracing.
5
+ *
5
6
  * @param this - Loader context with an absolute implementation path and asynchronous completion.
6
7
  * @param source - Original source text forwarded to the implementation.
7
8
  * @param inputMap - Upstream source map forwarded unchanged.
@@ -1 +1 @@
1
- {"version":3,"file":"node-loader.js","names":[],"sources":["../../src/turbopack/node-loader.ts"],"sourcesContent":["import { pathToFileURL } from \"node:url\";\n\nimport type { UpstreamSourceMap } from \"@stillwind/host\";\nimport type { LoaderContext } from \"webpack\";\n\nimport type producerLoader from \"./loader.ts\";\nimport type { TurbopackLoaderOptions } from \"./project.ts\";\n\n/** Settings for a compiler loader that executes in Node. */\nexport type NodeLoaderOptions = TurbopackLoaderOptions & {\n /** Absolute path to the compiled loader implementation. */\n implementation: string;\n};\n\n/**\n * Loads the compiler in Node without exposing its dependencies to Turbopack's loader tracing.\n * @param this - Loader context with an absolute implementation path and asynchronous completion.\n * @param source - Original source text forwarded to the implementation.\n * @param inputMap - Upstream source map forwarded unchanged.\n * @returns Undefined. The implementation completes the loader callback and registers its dependencies.\n * Import and synchronous invocation errors complete the callback with an error.\n */\nexport default function nodeLoader(\n this: LoaderContext<NodeLoaderOptions>,\n source: string,\n inputMap: UpstreamSourceMap,\n) {\n const callback = this.async();\n const implementation = pathToFileURL(this.getOptions().implementation).href;\n void import(/* webpackIgnore: true */ implementation)\n .then((module: { default: typeof producerLoader }) =>\n module.default.call(this, source, inputMap),\n )\n .catch(callback);\n}\n"],"mappings":";;;;;;;;;;AAsBA,SAAwB,WAEtB,QACA,UACA;CACA,MAAM,WAAW,KAAK,MAAM;CAE5B;;EADuB,cAAc,KAAK,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;CAClB,CAClD,MAAM,WACL,OAAO,QAAQ,KAAK,MAAM,QAAQ,QAAQ,CAC5C,CAAC,CACA,MAAM,QAAQ;AACnB"}
1
+ {"version":3,"file":"node-loader.js","names":[],"sources":["../../src/turbopack/node-loader.ts"],"sourcesContent":["import { pathToFileURL } from \"node:url\";\n\nimport type { UpstreamSourceMap } from \"@stillwind/host\";\nimport type { LoaderContext } from \"webpack\";\n\nimport type producerLoader from \"./loader.ts\";\nimport type { TurbopackLoaderOptions } from \"./project.ts\";\n\n/**\n * Settings for a compiler loader that executes in Node.\n */\nexport type NodeLoaderOptions = TurbopackLoaderOptions & {\n /** Absolute path to the compiled loader implementation. */\n implementation: string;\n};\n\n/**\n * Loads the compiler in Node without exposing its dependencies to Turbopack's loader tracing.\n *\n * @param this - Loader context with an absolute implementation path and asynchronous completion.\n * @param source - Original source text forwarded to the implementation.\n * @param inputMap - Upstream source map forwarded unchanged.\n * @returns Undefined. The implementation completes the loader callback and registers its dependencies.\n * Import and synchronous invocation errors complete the callback with an error.\n */\nexport default function nodeLoader(\n this: LoaderContext<NodeLoaderOptions>,\n source: string,\n inputMap: UpstreamSourceMap,\n) {\n const callback = this.async();\n const implementation = pathToFileURL(this.getOptions().implementation).href;\n void import(/* webpackIgnore: true */ implementation)\n .then((module: { default: typeof producerLoader }) =>\n module.default.call(this, source, inputMap),\n )\n .catch(callback);\n}\n"],"mappings":";;;;;;;;;;;AAyBA,SAAwB,WAEtB,QACA,UACA;CACA,MAAM,WAAW,KAAK,MAAM;CAE5B;;EADuB,cAAc,KAAK,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;CAClB,CAClD,MAAM,WACL,OAAO,QAAQ,KAAK,MAAM,QAAQ,QAAQ,CAC5C,CAAC,CACA,MAAM,QAAQ;AACnB"}
@@ -1,3 +1,3 @@
1
- import { t as IntegrationConfig } from "../project-DUGu8g_L.js";
2
- import { t as stillwind } from "../index-DFfbZxNT.js";
1
+ import { t as IntegrationConfig } from "../project-B_KFQist.js";
2
+ import { t as stillwind } from "../index-B6EtrWus.js";
3
3
  export { type IntegrationConfig, stillwind };
@@ -1 +1 @@
1
- export { n as stillwind } from "../plugin-ByYcpBcE.js";
1
+ export { n as stillwind } from "../plugin-DQH8QlYh.js";
@@ -5,7 +5,9 @@ type StylesheetSourceMap = Readonly<Omit<EncodedSourceMap, "names" | "sources" |
5
5
  readonly sourcesContent?: readonly (string | null)[];
6
6
  readonly ignoreList?: readonly number[];
7
7
  };
8
- /** Ordered CSS partition activated by its producers or included unconditionally. */
8
+ /**
9
+ * Ordered CSS partition activated by its producers or included unconditionally.
10
+ */
9
11
  export interface StylesheetPart {
10
12
  /** Preserved notices required by this part. */
11
13
  readonly banners?: readonly string[];
@@ -16,7 +18,9 @@ export interface StylesheetPart {
16
18
  /** Map for this part. Null or omission means that no map is available. */
17
19
  readonly map?: StylesheetSourceMap | null;
18
20
  }
19
- /** Complete stylesheet and composition state published for one adapter revision. */
21
+ /**
22
+ * Complete stylesheet and composition state published for one adapter revision.
23
+ */
20
24
  export interface StylesheetSnapshot {
21
25
  /** Monotonic revision within the adapter environment. */
22
26
  readonly revision: number;
@@ -26,7 +30,9 @@ export interface StylesheetSnapshot {
26
30
  readonly dependencies: Readonly<Record<string, readonly string[]>>;
27
31
  }
28
32
  declare module "vite" {
29
- /** Extends Vite's typed HMR events with complete Stillwind stylesheet snapshots. */
33
+ /**
34
+ * Extends Vite's typed HMR events with complete Stillwind stylesheet snapshots.
35
+ */
30
36
  interface CustomEventMap {
31
37
  /** Stylesheet revision, ordered parts, and composition dependencies published by Stillwind. */
32
38
  "stillwind:css": StylesheetSnapshot;
@@ -38,6 +44,7 @@ declare module "vite" {
38
44
  * must return CSS for the selected parts in their existing order.
39
45
  * Returns operations for producer registration, snapshot updates and synchronization.
40
46
  * Snapshots older than the shared document revision are ignored.
47
+ *
41
48
  * @param options - Initial snapshot, snapshot endpoint, and optional renderer. Accepted snapshots are captured.
42
49
  * @returns Operations that update shared producer state and the owned style element.
43
50
  */
@@ -7,6 +7,7 @@ const documentKey = Symbol.for("stillwind.document");
7
7
  * must return CSS for the selected parts in their existing order.
8
8
  * Returns operations for producer registration, snapshot updates and synchronization.
9
9
  * Snapshots older than the shared document revision are ignored.
10
+ *
10
11
  * @param options - Initial snapshot, snapshot endpoint, and optional renderer. Accepted snapshots are captured.
11
12
  * @returns Operations that update shared producer state and the owned style element.
12
13
  */
@@ -18,7 +19,9 @@ function createDevelopmentRuntime(options) {
18
19
  revision: -1,
19
20
  active: /* @__PURE__ */ new Set()
20
21
  };
21
- /** Expands composition dependencies and writes active partitions into the shared style element. */
22
+ /**
23
+ * Expands composition dependencies and writes active partitions into the shared style element.
24
+ */
22
25
  function render() {
23
26
  if (!state.snapshot || typeof document === "undefined") return;
24
27
  const active = new Set(state.active);
@@ -33,6 +36,7 @@ function createDevelopmentRuntime(options) {
33
36
  }
34
37
  /**
35
38
  * Activates a producer and rerenders its CSS and composition dependencies.
39
+ *
36
40
  * @param id - Compiler module identity. Repeated registration has no additional ownership count.
37
41
  */
38
42
  function register(id) {
@@ -41,6 +45,7 @@ function createDevelopmentRuntime(options) {
41
45
  }
42
46
  /**
43
47
  * Removes a producer registration and rerenders the remaining active CSS.
48
+ *
44
49
  * @param id - Compiler module identity. Unknown identities have no effect on the set.
45
50
  */
46
51
  function unregister(id) {
@@ -51,6 +56,7 @@ function createDevelopmentRuntime(options) {
51
56
  * Fetches the current snapshot, sharing pending requests between producers.
52
57
  * Resolves after the document reaches `revision`; rejects on fetch or response
53
58
  * failures. Does not fetch when no document exists.
59
+ *
54
60
  * @param revision - Minimum adapter revision required before completion.
55
61
  * @returns Completion after a fetched snapshot reaches the requested revision, or immediately without a document.
56
62
  * @throws If fetching, decoding, or applying a snapshot fails.
@@ -69,6 +75,7 @@ function createDevelopmentRuntime(options) {
69
75
  }
70
76
  /**
71
77
  * Accepts a current or newer snapshot and rerenders shared document styles.
78
+ *
72
79
  * @param update - Complete snapshot to capture. Older revisions are ignored, and equal revisions are accepted.
73
80
  */
74
81
  function apply(update) {
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","names":[],"sources":["../../src/vite/runtime.ts"],"sourcesContent":["import type { EncodedSourceMap } from \"@jridgewell/trace-mapping\";\nimport { cssText } from \"stillwind/css\";\n\ntype StylesheetSourceMap = Readonly<\n Omit<EncodedSourceMap, \"names\" | \"sources\" | \"sourcesContent\" | \"ignoreList\">\n> & {\n readonly names: readonly string[];\n readonly sources: readonly (string | null)[];\n readonly sourcesContent?: readonly (string | null)[];\n readonly ignoreList?: readonly number[];\n};\n\n/** Ordered CSS partition activated by its producers or included unconditionally. */\nexport interface StylesheetPart {\n /** Preserved notices required by this part. */\n readonly banners?: readonly string[];\n /** CSS with resources already resolved for the browser. */\n readonly css: string;\n /** Compiler module ids that need this part; an empty list keeps it active unconditionally. */\n readonly producers: readonly string[];\n /** Map for this part. Null or omission means that no map is available. */\n readonly map?: StylesheetSourceMap | null;\n}\n\n/** Complete stylesheet and composition state published for one adapter revision. */\nexport interface StylesheetSnapshot {\n /** Monotonic revision within the adapter environment. */\n readonly revision: number;\n /** Partitions in stylesheet order, retained when filtering for active producers. */\n readonly parts: readonly StylesheetPart[];\n /** Composition dependencies keyed by compiler module id. */\n readonly dependencies: Readonly<Record<string, readonly string[]>>;\n}\n\ndeclare module \"vite\" {\n /** Extends Vite's typed HMR events with complete Stillwind stylesheet snapshots. */\n interface CustomEventMap {\n /** Stylesheet revision, ordered parts, and composition dependencies published by Stillwind. */\n \"stillwind:css\": StylesheetSnapshot;\n }\n}\n\n/** Mutable stylesheet state shared by runtime instances in the current global document context. */\ninterface DocumentState {\n /** Latest accepted revision. -1 identifies state before its first snapshot. */\n revision: number;\n /** Owned style element, recreated when it is no longer connected to the document. */\n style?: HTMLStyleElement;\n /** Registered compiler producer identities. Composition dependencies are expanded during rendering. */\n active: Set<string>;\n /** Owned complete snapshot fixed when its revision was accepted. */\n snapshot?: StylesheetSnapshot;\n /** Fetch-and-apply operation shared by overlapping synchronization requests. */\n pending?: Promise<void>;\n}\n\nconst documentKey = Symbol.for(\"stillwind.document\");\n\n/**\n * Reuses document state across runtime instances and applies the initial snapshot.\n * `endpoint` supplies snapshots for this environment. `renderCss`, when supplied,\n * must return CSS for the selected parts in their existing order.\n * Returns operations for producer registration, snapshot updates and synchronization.\n * Snapshots older than the shared document revision are ignored.\n * @param options - Initial snapshot, snapshot endpoint, and optional renderer. Accepted snapshots are captured.\n * @returns Operations that update shared producer state and the owned style element.\n */\nexport function createDevelopmentRuntime(options: {\n /** Initial complete snapshot applied unless its revision is older than shared document state. */\n snapshot: StylesheetSnapshot;\n /** URL returning a JSON snapshot for this compiler environment. */\n endpoint: string;\n /** Optional renderer receiving selected parts in stylesheet order and returning their combined CSS. */\n renderCss?: (parts: readonly StylesheetPart[]) => string;\n}) {\n const endpoint = options.endpoint;\n const renderCss = options.renderCss?.bind(options);\n const globals = globalThis as typeof globalThis & {\n /** State shared through Symbol.for across runtime module replacements. */\n [documentKey]?: DocumentState;\n };\n const state = (globals[documentKey] ??= {\n revision: -1,\n active: new Set(),\n });\n\n /** Expands composition dependencies and writes active partitions into the shared style element. */\n function render() {\n if (!state.snapshot || typeof document === \"undefined\") {\n return;\n }\n const active = new Set(state.active);\n for (const module of active) {\n for (const dependency of state.snapshot.dependencies[module] ?? []) {\n active.add(dependency);\n }\n }\n const parts = state.snapshot.parts.filter(\n (part) => !part.producers.length || part.producers.some((producer) => active.has(producer)),\n );\n if (!state.style?.isConnected) {\n state.style = document.createElement(\"style\");\n state.style.dataset.stillwind = \"\";\n document.head.append(state.style);\n }\n state.style.textContent = renderCss ? renderCss(parts) : cssText(parts);\n }\n\n /**\n * Activates a producer and rerenders its CSS and composition dependencies.\n * @param id - Compiler module identity. Repeated registration has no additional ownership count.\n */\n function register(id: string) {\n state.active.add(id);\n render();\n }\n\n /**\n * Removes a producer registration and rerenders the remaining active CSS.\n * @param id - Compiler module identity. Unknown identities have no effect on the set.\n */\n function unregister(id: string) {\n state.active.delete(id);\n render();\n }\n\n /**\n * Fetches the current snapshot, sharing pending requests between producers.\n * Resolves after the document reaches `revision`; rejects on fetch or response\n * failures. Does not fetch when no document exists.\n * @param revision - Minimum adapter revision required before completion.\n * @returns Completion after a fetched snapshot reaches the requested revision, or immediately without a document.\n * @throws If fetching, decoding, or applying a snapshot fails.\n */\n async function synchronize(revision: number) {\n if (typeof document === \"undefined\") {\n return;\n }\n do {\n state.pending ??= fetch(endpoint)\n .then((response) => {\n if (!response.ok) {\n throw new Error(\"Stillwind stylesheet synchronization failed\");\n }\n return response.json() as Promise<StylesheetSnapshot>;\n })\n .then(apply)\n .finally(() => {\n state.pending = undefined;\n });\n await state.pending;\n } while (state.revision < revision);\n }\n\n /**\n * Accepts a current or newer snapshot and rerenders shared document styles.\n * @param update - Complete snapshot to capture. Older revisions are ignored, and equal revisions are accepted.\n */\n function apply(update: StylesheetSnapshot) {\n if (update.revision < state.revision) {\n return;\n }\n state.snapshot = structuredClone(update);\n state.revision = state.snapshot.revision;\n render();\n }\n\n apply(options.snapshot);\n return {\n register,\n unregister,\n synchronize,\n apply,\n };\n}\n"],"mappings":";;AAwDA,MAAM,cAAc,OAAO,IAAI,oBAAoB;;;;;;;;;;AAWnD,SAAgB,yBAAyB,SAOtC;CACD,MAAM,WAAW,QAAQ;CACzB,MAAM,YAAY,QAAQ,WAAW,KAAK,OAAO;CACjD,MAAM,UAAU;CAIhB,MAAM,QAAS,QAAQ,iBAAiB;EACtC,UAAU;EACV,wBAAQ,IAAI,IAAI;CAClB;;CAGA,SAAS,SAAS;EAChB,IAAI,CAAC,MAAM,YAAY,OAAO,aAAa,aACzC;EAEF,MAAM,SAAS,IAAI,IAAI,MAAM,MAAM;EACnC,KAAK,MAAM,UAAU,QACnB,KAAK,MAAM,cAAc,MAAM,SAAS,aAAa,WAAW,CAAC,GAC/D,OAAO,IAAI,UAAU;EAGzB,MAAM,QAAQ,MAAM,SAAS,MAAM,QAChC,SAAS,CAAC,KAAK,UAAU,UAAU,KAAK,UAAU,MAAM,aAAa,OAAO,IAAI,QAAQ,CAAC,CAC5F;EACA,IAAI,CAAC,MAAM,OAAO,aAAa;GAC7B,MAAM,QAAQ,SAAS,cAAc,OAAO;GAC5C,MAAM,MAAM,QAAQ,YAAY;GAChC,SAAS,KAAK,OAAO,MAAM,KAAK;EAClC;EACA,MAAM,MAAM,cAAc,YAAY,UAAU,KAAK,IAAI,QAAQ,KAAK;CACxE;;;;;CAMA,SAAS,SAAS,IAAY;EAC5B,MAAM,OAAO,IAAI,EAAE;EACnB,OAAO;CACT;;;;;CAMA,SAAS,WAAW,IAAY;EAC9B,MAAM,OAAO,OAAO,EAAE;EACtB,OAAO;CACT;;;;;;;;;CAUA,eAAe,YAAY,UAAkB;EAC3C,IAAI,OAAO,aAAa,aACtB;EAEF,GAAG;GACD,MAAM,YAAY,MAAM,QAAQ,CAAC,CAC9B,MAAM,aAAa;IAClB,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MAAM,6CAA6C;IAE/D,OAAO,SAAS,KAAK;GACvB,CAAC,CAAC,CACD,KAAK,KAAK,CAAC,CACX,cAAc;IACb,MAAM,UAAU,KAAA;GAClB,CAAC;GACH,MAAM,MAAM;EACd,SAAS,MAAM,WAAW;CAC5B;;;;;CAMA,SAAS,MAAM,QAA4B;EACzC,IAAI,OAAO,WAAW,MAAM,UAC1B;EAEF,MAAM,WAAW,gBAAgB,MAAM;EACvC,MAAM,WAAW,MAAM,SAAS;EAChC,OAAO;CACT;CAEA,MAAM,QAAQ,QAAQ;CACtB,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"runtime.js","names":[],"sources":["../../src/vite/runtime.ts"],"sourcesContent":["import type { EncodedSourceMap } from \"@jridgewell/trace-mapping\";\nimport { cssText } from \"stillwind/css\";\n\ntype StylesheetSourceMap = Readonly<\n Omit<EncodedSourceMap, \"names\" | \"sources\" | \"sourcesContent\" | \"ignoreList\">\n> & {\n readonly names: readonly string[];\n readonly sources: readonly (string | null)[];\n readonly sourcesContent?: readonly (string | null)[];\n readonly ignoreList?: readonly number[];\n};\n\n/**\n * Ordered CSS partition activated by its producers or included unconditionally.\n */\nexport interface StylesheetPart {\n /** Preserved notices required by this part. */\n readonly banners?: readonly string[];\n /** CSS with resources already resolved for the browser. */\n readonly css: string;\n /** Compiler module ids that need this part; an empty list keeps it active unconditionally. */\n readonly producers: readonly string[];\n /** Map for this part. Null or omission means that no map is available. */\n readonly map?: StylesheetSourceMap | null;\n}\n\n/**\n * Complete stylesheet and composition state published for one adapter revision.\n */\nexport interface StylesheetSnapshot {\n /** Monotonic revision within the adapter environment. */\n readonly revision: number;\n /** Partitions in stylesheet order, retained when filtering for active producers. */\n readonly parts: readonly StylesheetPart[];\n /** Composition dependencies keyed by compiler module id. */\n readonly dependencies: Readonly<Record<string, readonly string[]>>;\n}\n\ndeclare module \"vite\" {\n /**\n * Extends Vite's typed HMR events with complete Stillwind stylesheet snapshots.\n */\n interface CustomEventMap {\n /** Stylesheet revision, ordered parts, and composition dependencies published by Stillwind. */\n \"stillwind:css\": StylesheetSnapshot;\n }\n}\n\n/**\n * Mutable stylesheet state shared by runtime instances in the current global document context.\n */\ninterface DocumentState {\n /** Latest accepted revision. -1 identifies state before its first snapshot. */\n revision: number;\n /** Owned style element, recreated when it is no longer connected to the document. */\n style?: HTMLStyleElement;\n /** Registered compiler producer identities. Composition dependencies are expanded during rendering. */\n active: Set<string>;\n /** Owned complete snapshot fixed when its revision was accepted. */\n snapshot?: StylesheetSnapshot;\n /** Fetch-and-apply operation shared by overlapping synchronization requests. */\n pending?: Promise<void>;\n}\n\nconst documentKey = Symbol.for(\"stillwind.document\");\n\n/**\n * Reuses document state across runtime instances and applies the initial snapshot.\n * `endpoint` supplies snapshots for this environment. `renderCss`, when supplied,\n * must return CSS for the selected parts in their existing order.\n * Returns operations for producer registration, snapshot updates and synchronization.\n * Snapshots older than the shared document revision are ignored.\n *\n * @param options - Initial snapshot, snapshot endpoint, and optional renderer. Accepted snapshots are captured.\n * @returns Operations that update shared producer state and the owned style element.\n */\nexport function createDevelopmentRuntime(options: {\n /** Initial complete snapshot applied unless its revision is older than shared document state. */\n snapshot: StylesheetSnapshot;\n /** URL returning a JSON snapshot for this compiler environment. */\n endpoint: string;\n /** Optional renderer receiving selected parts in stylesheet order and returning their combined CSS. */\n renderCss?: (parts: readonly StylesheetPart[]) => string;\n}) {\n const endpoint = options.endpoint;\n const renderCss = options.renderCss?.bind(options);\n const globals = globalThis as typeof globalThis & {\n /** State shared through Symbol.for across runtime module replacements. */\n [documentKey]?: DocumentState;\n };\n const state = (globals[documentKey] ??= {\n revision: -1,\n active: new Set(),\n });\n\n /**\n * Expands composition dependencies and writes active partitions into the shared style element.\n */\n function render() {\n if (!state.snapshot || typeof document === \"undefined\") {\n return;\n }\n const active = new Set(state.active);\n for (const module of active) {\n for (const dependency of state.snapshot.dependencies[module] ?? []) {\n active.add(dependency);\n }\n }\n const parts = state.snapshot.parts.filter(\n (part) => !part.producers.length || part.producers.some((producer) => active.has(producer)),\n );\n if (!state.style?.isConnected) {\n state.style = document.createElement(\"style\");\n state.style.dataset.stillwind = \"\";\n document.head.append(state.style);\n }\n state.style.textContent = renderCss ? renderCss(parts) : cssText(parts);\n }\n\n /**\n * Activates a producer and rerenders its CSS and composition dependencies.\n *\n * @param id - Compiler module identity. Repeated registration has no additional ownership count.\n */\n function register(id: string) {\n state.active.add(id);\n render();\n }\n\n /**\n * Removes a producer registration and rerenders the remaining active CSS.\n *\n * @param id - Compiler module identity. Unknown identities have no effect on the set.\n */\n function unregister(id: string) {\n state.active.delete(id);\n render();\n }\n\n /**\n * Fetches the current snapshot, sharing pending requests between producers.\n * Resolves after the document reaches `revision`; rejects on fetch or response\n * failures. Does not fetch when no document exists.\n *\n * @param revision - Minimum adapter revision required before completion.\n * @returns Completion after a fetched snapshot reaches the requested revision, or immediately without a document.\n * @throws If fetching, decoding, or applying a snapshot fails.\n */\n async function synchronize(revision: number) {\n if (typeof document === \"undefined\") {\n return;\n }\n do {\n state.pending ??= fetch(endpoint)\n .then((response) => {\n if (!response.ok) {\n throw new Error(\"Stillwind stylesheet synchronization failed\");\n }\n return response.json() as Promise<StylesheetSnapshot>;\n })\n .then(apply)\n .finally(() => {\n state.pending = undefined;\n });\n await state.pending;\n } while (state.revision < revision);\n }\n\n /**\n * Accepts a current or newer snapshot and rerenders shared document styles.\n *\n * @param update - Complete snapshot to capture. Older revisions are ignored, and equal revisions are accepted.\n */\n function apply(update: StylesheetSnapshot) {\n if (update.revision < state.revision) {\n return;\n }\n state.snapshot = structuredClone(update);\n state.revision = state.snapshot.revision;\n render();\n }\n\n apply(options.snapshot);\n return {\n register,\n unregister,\n synchronize,\n apply,\n };\n}\n"],"mappings":";;AAgEA,MAAM,cAAc,OAAO,IAAI,oBAAoB;;;;;;;;;;;AAYnD,SAAgB,yBAAyB,SAOtC;CACD,MAAM,WAAW,QAAQ;CACzB,MAAM,YAAY,QAAQ,WAAW,KAAK,OAAO;CACjD,MAAM,UAAU;CAIhB,MAAM,QAAS,QAAQ,iBAAiB;EACtC,UAAU;EACV,wBAAQ,IAAI,IAAI;CAClB;;;;CAKA,SAAS,SAAS;EAChB,IAAI,CAAC,MAAM,YAAY,OAAO,aAAa,aACzC;EAEF,MAAM,SAAS,IAAI,IAAI,MAAM,MAAM;EACnC,KAAK,MAAM,UAAU,QACnB,KAAK,MAAM,cAAc,MAAM,SAAS,aAAa,WAAW,CAAC,GAC/D,OAAO,IAAI,UAAU;EAGzB,MAAM,QAAQ,MAAM,SAAS,MAAM,QAChC,SAAS,CAAC,KAAK,UAAU,UAAU,KAAK,UAAU,MAAM,aAAa,OAAO,IAAI,QAAQ,CAAC,CAC5F;EACA,IAAI,CAAC,MAAM,OAAO,aAAa;GAC7B,MAAM,QAAQ,SAAS,cAAc,OAAO;GAC5C,MAAM,MAAM,QAAQ,YAAY;GAChC,SAAS,KAAK,OAAO,MAAM,KAAK;EAClC;EACA,MAAM,MAAM,cAAc,YAAY,UAAU,KAAK,IAAI,QAAQ,KAAK;CACxE;;;;;;CAOA,SAAS,SAAS,IAAY;EAC5B,MAAM,OAAO,IAAI,EAAE;EACnB,OAAO;CACT;;;;;;CAOA,SAAS,WAAW,IAAY;EAC9B,MAAM,OAAO,OAAO,EAAE;EACtB,OAAO;CACT;;;;;;;;;;CAWA,eAAe,YAAY,UAAkB;EAC3C,IAAI,OAAO,aAAa,aACtB;EAEF,GAAG;GACD,MAAM,YAAY,MAAM,QAAQ,CAAC,CAC9B,MAAM,aAAa;IAClB,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MAAM,6CAA6C;IAE/D,OAAO,SAAS,KAAK;GACvB,CAAC,CAAC,CACD,KAAK,KAAK,CAAC,CACX,cAAc;IACb,MAAM,UAAU,KAAA;GAClB,CAAC;GACH,MAAM,MAAM;EACd,SAAS,MAAM,WAAW;CAC5B;;;;;;CAOA,SAAS,MAAM,QAA4B;EACzC,IAAI,OAAO,WAAW,MAAM,UAC1B;EAEF,MAAM,WAAW,gBAAgB,MAAM;EACvC,MAAM,WAAW,MAAM,SAAS;EAChC,OAAO;CACT;CAEA,MAAM,QAAQ,QAAQ;CACtB,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
@@ -1,5 +1,5 @@
1
+ import { r as requireEmission } from "../emission-BpaN4Z4m.js";
1
2
  import { loaderCompletion } from "./source-map-loader.js";
2
- import { r as requireEmission } from "../emission-BVi5aRbb.js";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { decodeCssSourceMap } from "@stillwind/host";
5
5
  // src/webpack/css-loader.ts
@@ -4,9 +4,12 @@ import { LoaderContext } from "webpack";
4
4
  /**
5
5
  * Skips CSS extraction until the completed graph supplies document CSS. Extracting
6
6
  * empty CSS first would retain an empty module in mini-css-extract-plugin's graph.
7
+ *
7
8
  * @returns Empty source before reconstruction, otherwise leaves the loader chain active.
8
9
  */
9
10
  export declare function pitch(this: LoaderContext<unknown>): string | undefined;
10
- /** Preserves the host CSS pipeline's output and source map after reconstruction. */
11
+ /**
12
+ * Preserves the host CSS pipeline's output and source map after reconstruction.
13
+ */
11
14
  export default function documentLoader(this: LoaderContext<unknown>, source: string, map: SourceMapInput | null | undefined, additionalData?: LoaderAdditionalData): void;
12
15
  //# sourceMappingURL=document-loader.d.ts.map
@@ -1,16 +1,19 @@
1
+ import { r as requireEmission } from "../emission-BpaN4Z4m.js";
1
2
  import { loaderCompletion } from "./source-map-loader.js";
2
- import { r as requireEmission } from "../emission-BVi5aRbb.js";
3
3
  // src/webpack/document-loader.ts
4
4
  /**
5
5
  * Skips CSS extraction until the completed graph supplies document CSS. Extracting
6
6
  * empty CSS first would retain an empty module in mini-css-extract-plugin's graph.
7
+ *
7
8
  * @returns Empty source before reconstruction, otherwise leaves the loader chain active.
8
9
  */
9
10
  function pitch() {
10
11
  this.cacheable(false);
11
12
  if (requireEmission(this).__stillwindCss === void 0) return "";
12
13
  }
13
- /** Preserves the host CSS pipeline's output and source map after reconstruction. */
14
+ /**
15
+ * Preserves the host CSS pipeline's output and source map after reconstruction.
16
+ */
14
17
  function documentLoader(source, map, additionalData) {
15
18
  loaderCompletion(this)(null, source, map, additionalData);
16
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"document-loader.js","names":[],"sources":["../../src/webpack/document-loader.ts"],"sourcesContent":["import type { SourceMapInput } from \"@jridgewell/trace-mapping\";\nimport type { LoaderContext } from \"webpack\";\n\nimport { requireEmission } from \"./emission.ts\";\nimport { loaderCompletion, type LoaderAdditionalData } from \"./source-map-loader.ts\";\n\n/**\n * Skips CSS extraction until the completed graph supplies document CSS. Extracting\n * empty CSS first would retain an empty module in mini-css-extract-plugin's graph.\n * @returns Empty source before reconstruction, otherwise leaves the loader chain active.\n */\nexport function pitch(this: LoaderContext<unknown>): string | undefined {\n this.cacheable(false);\n if (requireEmission(this).__stillwindCss === undefined) {\n return \"\";\n }\n return undefined;\n}\n\n/** Preserves the host CSS pipeline's output and source map after reconstruction. */\nexport default function documentLoader(\n this: LoaderContext<unknown>,\n source: string,\n map: SourceMapInput | null | undefined,\n additionalData?: LoaderAdditionalData,\n): void {\n loaderCompletion(this)(null, source, map, additionalData);\n}\n"],"mappings":";;;;;;;;AAWA,SAAgB,QAAwD;CACtE,KAAK,UAAU,KAAK;CACpB,IAAI,gBAAgB,IAAI,CAAC,CAAC,mBAAmB,KAAA,GAC3C,OAAO;AAGX;;AAGA,SAAwB,eAEtB,QACA,KACA,gBACM;CACN,iBAAiB,IAAI,CAAC,CAAC,MAAM,QAAQ,KAAK,cAAc;AAC1D"}
1
+ {"version":3,"file":"document-loader.js","names":[],"sources":["../../src/webpack/document-loader.ts"],"sourcesContent":["import type { SourceMapInput } from \"@jridgewell/trace-mapping\";\nimport type { LoaderContext } from \"webpack\";\n\nimport { requireEmission } from \"./emission.ts\";\nimport { loaderCompletion, type LoaderAdditionalData } from \"./source-map-loader.ts\";\n\n/**\n * Skips CSS extraction until the completed graph supplies document CSS. Extracting\n * empty CSS first would retain an empty module in mini-css-extract-plugin's graph.\n *\n * @returns Empty source before reconstruction, otherwise leaves the loader chain active.\n */\nexport function pitch(this: LoaderContext<unknown>): string | undefined {\n this.cacheable(false);\n if (requireEmission(this).__stillwindCss === undefined) {\n return \"\";\n }\n return undefined;\n}\n\n/**\n * Preserves the host CSS pipeline's output and source map after reconstruction.\n */\nexport default function documentLoader(\n this: LoaderContext<unknown>,\n source: string,\n map: SourceMapInput | null | undefined,\n additionalData?: LoaderAdditionalData,\n): void {\n loaderCompletion(this)(null, source, map, additionalData);\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,QAAwD;CACtE,KAAK,UAAU,KAAK;CACpB,IAAI,gBAAgB,IAAI,CAAC,CAAC,mBAAmB,KAAA,GAC3C,OAAO;AAGX;;;;AAKA,SAAwB,eAEtB,QACA,KACA,gBACM;CACN,iBAAiB,IAAI,CAAC,CAAC,MAAM,QAAQ,KAAK,cAAc;AAC1D"}
@@ -1,6 +1,7 @@
1
1
  import { LoaderContext } from "webpack";
2
2
  /**
3
3
  * Decodes an immutable CSS fragment into a module that substitutes bundler-resolved asset URLs.
4
+ *
4
5
  * @param this - Loader context whose css query contains base64url-encoded UTF-8 fragment JSON.
5
6
  * @returns JavaScript importing referenced assets and exporting the fragment's CSS.
6
7
  * @throws If the css query is absent or its decoded JSON is invalid.
@@ -1,6 +1,7 @@
1
1
  // src/webpack/fragment-loader.ts
2
2
  /**
3
3
  * Decodes an immutable CSS fragment into a module that substitutes bundler-resolved asset URLs.
4
+ *
4
5
  * @param this - Loader context whose css query contains base64url-encoded UTF-8 fragment JSON.
5
6
  * @returns JavaScript importing referenced assets and exporting the fragment's CSS.
6
7
  * @throws If the css query is absent or its decoded JSON is invalid.
@@ -1 +1 @@
1
- {"version":3,"file":"fragment-loader.js","names":[],"sources":["../../src/webpack/fragment-loader.ts"],"sourcesContent":["import type { LoaderContext } from \"webpack\";\n\nimport type { CssFragment } from \"./css-value.ts\";\n\n/**\n * Decodes an immutable CSS fragment into a module that substitutes bundler-resolved asset URLs.\n * @param this - Loader context whose css query contains base64url-encoded UTF-8 fragment JSON.\n * @returns JavaScript importing referenced assets and exporting the fragment's CSS.\n * @throws If the css query is absent or its decoded JSON is invalid.\n */\nexport default function webpackFragmentLoader(this: LoaderContext<unknown>): string {\n const encoded = new URLSearchParams(this.resourceQuery).get(\"css\");\n if (!encoded) {\n throw new Error(\"Missing Stillwind CSS fragment\");\n }\n const { css, resources } = JSON.parse(\n Buffer.from(encoded, \"base64url\").toString(\"utf8\"),\n ) as CssFragment;\n const imports = resources.map(\n (resource, index) => `import asset${index} from ${JSON.stringify(resource.id)};\\n`,\n );\n const replacements = resources\n .map(\n (resource, index) =>\n `.replaceAll(${JSON.stringify(resource.placeholder)}, JSON.stringify(typeof asset${index} === \"string\" ? asset${index} : asset${index}.src).slice(1, -1))`,\n )\n .join(\"\");\n return [\n \"// Stillwind CSS fragment (webpack)\\n\",\n ...imports,\n \"\\n\",\n `export const css = ${JSON.stringify(css)}${replacements};\\n`,\n ].join(\"\");\n}\n"],"mappings":";;;;;;;AAUA,SAAwB,wBAA4D;CAClF,MAAM,UAAU,IAAI,gBAAgB,KAAK,aAAa,CAAC,CAAC,IAAI,KAAK;CACjE,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,gCAAgC;CAElD,MAAM,EAAE,KAAK,cAAc,KAAK,MAC9B,OAAO,KAAK,SAAS,WAAW,CAAC,CAAC,SAAS,MAAM,CACnD;CACA,MAAM,UAAU,UAAU,KACvB,UAAU,UAAU,eAAe,MAAM,QAAQ,KAAK,UAAU,SAAS,EAAE,EAAE,IAChF;CACA,MAAM,eAAe,UAClB,KACE,UAAU,UACT,eAAe,KAAK,UAAU,SAAS,WAAW,EAAE,+BAA+B,MAAM,uBAAuB,MAAM,UAAU,MAAM,oBAC1I,CAAC,CACA,KAAK,EAAE;CACV,OAAO;EACL;EACA,GAAG;EACH;EACA,sBAAsB,KAAK,UAAU,GAAG,IAAI,aAAa;CAC3D,CAAC,CAAC,KAAK,EAAE;AACX"}
1
+ {"version":3,"file":"fragment-loader.js","names":[],"sources":["../../src/webpack/fragment-loader.ts"],"sourcesContent":["import type { LoaderContext } from \"webpack\";\n\nimport type { CssFragment } from \"./css-value.ts\";\n\n/**\n * Decodes an immutable CSS fragment into a module that substitutes bundler-resolved asset URLs.\n *\n * @param this - Loader context whose css query contains base64url-encoded UTF-8 fragment JSON.\n * @returns JavaScript importing referenced assets and exporting the fragment's CSS.\n * @throws If the css query is absent or its decoded JSON is invalid.\n */\nexport default function webpackFragmentLoader(this: LoaderContext<unknown>): string {\n const encoded = new URLSearchParams(this.resourceQuery).get(\"css\");\n if (!encoded) {\n throw new Error(\"Missing Stillwind CSS fragment\");\n }\n const { css, resources } = JSON.parse(\n Buffer.from(encoded, \"base64url\").toString(\"utf8\"),\n ) as CssFragment;\n const imports = resources.map(\n (resource, index) => `import asset${index} from ${JSON.stringify(resource.id)};\\n`,\n );\n const replacements = resources\n .map(\n (resource, index) =>\n `.replaceAll(${JSON.stringify(resource.placeholder)}, JSON.stringify(typeof asset${index} === \"string\" ? asset${index} : asset${index}.src).slice(1, -1))`,\n )\n .join(\"\");\n return [\n \"// Stillwind CSS fragment (webpack)\\n\",\n ...imports,\n \"\\n\",\n `export const css = ${JSON.stringify(css)}${replacements};\\n`,\n ].join(\"\");\n}\n"],"mappings":";;;;;;;;AAWA,SAAwB,wBAA4D;CAClF,MAAM,UAAU,IAAI,gBAAgB,KAAK,aAAa,CAAC,CAAC,IAAI,KAAK;CACjE,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,gCAAgC;CAElD,MAAM,EAAE,KAAK,cAAc,KAAK,MAC9B,OAAO,KAAK,SAAS,WAAW,CAAC,CAAC,SAAS,MAAM,CACnD;CACA,MAAM,UAAU,UAAU,KACvB,UAAU,UAAU,eAAe,MAAM,QAAQ,KAAK,UAAU,SAAS,EAAE,EAAE,IAChF;CACA,MAAM,eAAe,UAClB,KACE,UAAU,UACT,eAAe,KAAK,UAAU,SAAS,WAAW,EAAE,+BAA+B,MAAM,uBAAuB,MAAM,UAAU,MAAM,oBAC1I,CAAC,CACA,KAAK,EAAE;CACV,OAAO;EACL;EACA,GAAG;EACH;EACA,sBAAsB,KAAK,UAAU,GAAG,IAAI,aAAa;CAC3D,CAAC,CAAC,KAAK,EAAE;AACX"}
@@ -1,3 +1,3 @@
1
- import { t as StillwindPlugin } from "../plugin-aV0zIIAe.js";
1
+ import { t as StillwindPlugin } from "../plugin-BAG0ZI1X.js";
2
2
  import { InlineConfig as IntegrationConfig } from "@stillwind/config";
3
3
  export { type IntegrationConfig, StillwindPlugin };
@@ -1 +1 @@
1
- export { t as StillwindPlugin } from "../plugin-mPiBLdqa.js";
1
+ export { t as StillwindPlugin } from "../plugin-D-45o54j.js";
@@ -1,9 +1,8 @@
1
- import { n as buildCompilerOptions, t as IntegrationSession } from "../session-DHUCQMG5.js";
1
+ import { a as createLoaderHost, c as classifyRequest, d as virtualRequest, i as useProject, l as relativeRequest, n as recordProducer, o as watchCompilerFiles, s as sourceDescriptor, u as requestOptions } from "../emission-BpaN4Z4m.js";
2
2
  import { loaderCompletion } from "./source-map-loader.js";
3
- import { a as watchCompilerFiles, c as relativeRequest, i as createLoaderHost, l as requestOptions, n as recordProducer, o as sourceDescriptor, s as classifyRequest, u as virtualRequest } from "../emission-BVi5aRbb.js";
4
3
  import { createHash } from "node:crypto";
5
- import { fileURLToPath, pathToFileURL } from "node:url";
6
- import { cleanModuleId, composeModuleSourceMap, cssEntrypoint, finalizeModuleWithMap, loadCssGraph, moduleSourceMap, nodePluginHost, warnRejectedNames } from "@stillwind/host";
4
+ import { fileURLToPath } from "node:url";
5
+ import { cleanModuleId, composeModuleSourceMap, finalizeModuleWithMap, moduleSourceMap, warnRejectedNames } from "@stillwind/host";
7
6
  import path from "node:path";
8
7
  import { resolveIntegrationConfig } from "@stillwind/config/node";
9
8
  // src/webpack/css-value.ts
@@ -74,7 +73,7 @@ function webpackLoader(source, inputMap, additionalData) {
74
73
  if (passthrough) return callback(null, source, inputMap);
75
74
  if (!projection && !cssValue && !/stillwind\/(?:alpine|astro|lit|preact|qwik|react|solid|svelte|vanilla|vue|module-css)/.test(text)) return callback(null, source, inputMap);
76
75
  const supplied = requestOptions(this.getOptions());
77
- let compiler;
76
+ let release;
78
77
  const { read, readDependency, dependencySources, resolveCss, resolveAsset, resolve, watch, warn } = createLoaderHost(this, import.meta.filename);
79
78
  (async () => {
80
79
  const configuration = this._compilation?.__stillwindConfiguration ?? await resolveIntegrationConfig(supplied, this.rootContext);
@@ -84,28 +83,19 @@ function webpackLoader(source, inputMap, additionalData) {
84
83
  if (config.naming) this.cacheable(false);
85
84
  /**
86
85
  * Creates a virtual module request using this source file's framework and compiler settings.
86
+ *
87
87
  * @param query - Stillwind virtual query selecting the requested CSS or value module.
88
88
  * @returns An inline loader request retaining the resource path and resolved configuration.
89
89
  */
90
90
  const request = (query) => virtualRequest(this.resourcePath, sfc, config, import.meta.filename, query, supplied);
91
91
  watchCompilerFiles(watch);
92
92
  const root = path.resolve(this.rootContext, config.root ?? ".");
93
- const css = path.resolve(root, cssEntrypoint(config));
94
- const loaded = await loadCssGraph(css, buildCompilerOptions(config), {
95
- resolve: resolveCss,
93
+ const lease = await useProject(this, configuration.scope, config, root, this.mode === "development" ? "development" : "release", {
96
94
  read,
97
- documentUri: (id) => pathToFileURL(id).href,
98
- sourceMapSource: (id) => pathToFileURL(id).href,
99
- watch,
100
- watchDirectory: (id) => this.addContextDependency(id),
101
- plugins: nodePluginHost
102
- }, void 0, void 0, {
103
- plugins: config.plugins,
104
- tailwind: config.tailwind,
105
- important: config.important,
106
- root
95
+ resolveCss
107
96
  });
108
- compiler = new IntegrationSession(root, loaded.loader, config, false, this.mode === "development" ? "development" : "release", loaded.plugins);
97
+ release = lease.done;
98
+ const { loaded, compiler, outputs } = lease.value;
109
99
  const session = compiler.native;
110
100
  const output = await compiler.compile(projection || cssValue ? await read(this.resourcePath) : text, projection || cssValue ? this.resourcePath : id, {
111
101
  describe: (id) => sourceDescriptor(root, id),
@@ -117,6 +107,10 @@ function webpackLoader(source, inputMap, additionalData) {
117
107
  stylesheetImports: sfc && !projection && !cssValue && config.automatic !== false ? [request("stillwind.css")] : void 0,
118
108
  moduleCssImport: request("stillwind-module-css")
119
109
  });
110
+ if (!projection && !cssValue) outputs.set(id, {
111
+ source: text,
112
+ moduleId: output?.moduleId
113
+ });
120
114
  if (!output?.code) return callback(null, projection ? "" : source, projection ? null : inputMap);
121
115
  const plan = session.planStylesheet({
122
116
  modules: [output.moduleId],
@@ -150,7 +144,7 @@ function webpackLoader(source, inputMap, additionalData) {
150
144
  sourceMapSource: sourceDescriptor(root, id).document.uri,
151
145
  map: typeof inputMap === "string" ? inputMap : JSON.stringify(inputMap)
152
146
  } : void 0,
153
- dependencies: await Promise.all([...dependencySources].map(async ([id, pending]) => {
147
+ dependencies: await Promise.all([...dependencySources].filter(([dependency]) => dependency !== id).map(async ([id, pending]) => {
154
148
  const { source, map } = await pending;
155
149
  return {
156
150
  id,
@@ -187,7 +181,7 @@ function webpackLoader(source, inputMap, additionalData) {
187
181
  }
188
182
  };
189
183
  callback(null, code, composedMap, metadata);
190
- })().catch((error) => callback(error)).finally(() => compiler?.close());
184
+ })().catch((error) => callback(error)).finally(() => release?.());
191
185
  }
192
186
  /**
193
187
  * Keeps webpack pitch data available for sharing transformed SFC code and maps with framework