@stillwind/integration 0.8.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +180 -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
package/CHANGELOG.md ADDED
@@ -0,0 +1,180 @@
1
+ # @stillwind/integration
2
+
3
+ ## 0.9.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Build Vite applications faster when pages reach source files only through dynamic imports, such as an `index.html` entry with lazy routes or Astro pages. A build now loads the source files that the project's `files` globs select into the type checker before the first compilation, so the checker no longer rebuilds its project for each newly found page.
8
+
9
+ - Start Vite development servers and apply edits of shared style modules faster. A development server now plans the document stylesheet once after a burst of compilations instead of after each compilation.
10
+
11
+ - Apply edits of a shared module faster in the Vite development server. A module that imports the edited module receives a hot update only when its transformed JavaScript changes.
12
+
13
+ - Apply edits of a shared module faster in the Vite development server. When an edit keeps the class names and types that a module exports, for example when it only changes utilities, the modules that import it are not compiled again. Their checker diagnostics then update when they are compiled for another reason.
14
+
15
+ - Start Vite development servers and apply edits faster in projects whose modules share styles. The development server now prepares the files that the build inputs reach once, and compilations share their scans and checker results until a file changes.
16
+
17
+ - Load the first page of a Vite development server faster. The server now starts the type checker when it starts, instead of at the first request that compiles a module.
18
+
19
+ - Update document CSS faster after an edit in Next and Turbopack development. Document CSS reconstruction now reuses the imports of modules whose source is unchanged and reads each level of the module graph concurrently, and Next route discovery reads route directories concurrently. Adding or removing a file still makes reconstruction resolve every import again.
20
+
21
+ - Start Vite development servers faster in large projects. While no browser is connected, compilations no longer plan the document stylesheet every 200 milliseconds, so the first server-rendered page of a cold start is ready sooner.
22
+
23
+ - Fix document CSS in large Next applications that use webpack. After an edit, the stylesheet failed with "Maximum call stack size exceeded" while its source map was read, so the page returned an error and the edit never applied.
24
+
25
+ - Keep Next.js development CSS in sync when routes are added or removed during stylesheet compilation.
26
+
27
+ - `minifyCss()` now makes more rewrites that keep the meaning of the CSS:
28
+
29
+ - A numeric `calc()` in a custom property value or another unparsed value becomes a literal, as in `--x:calc(95 * 1%)` to `--x:95%` and `--y:calc(10px / 4)` to `--y:2.5px`. A division stays when its result does not terminate, such as `calc(1px / 3)`, and a unitless result stays when it is not an integer, unless `@property` registers the custom property as a `<number>`. A negative result also folds, so a property such as `width` that clamps a negative `calc()` result to zero rejects the folded literal instead.
30
+ - Media features use their boolean form when it matches the same devices, as in `(hover:hover)` to `(hover)`.
31
+ - A lower and an upper range of one feature become one interval, as in `(width>=40rem) and (width<60rem)` to `(40rem<=width<60rem)`. Browser targets without range syntax still receive `min-` and `max-` features.
32
+ - `@supports` declarations lose whitespace next to commas.
33
+ - A repeated selector in a selector list is removed, as in `.a,.b,.a` to `.a,.b`.
34
+ - Keyframes that have equal declarations are merged, as in `0%{opacity:0}50%{opacity:0}` to `0%,50%{opacity:0}`.
35
+
36
+ - Update document CSS faster after an edit in Next and Turbopack development. When an edited module keeps its exports, the modules that import it are no longer compiled again, and their checker diagnostics are refreshed when they are compiled for another reason. Next with webpack also renders the document stylesheet once for each change instead of once for each compiler and layer.
37
+
38
+ - Build and edit Next applications faster. The Stillwind loaders for Turbopack and webpack in Next now reuse the evaluated configuration, the design system, and the type checker across modules in one process while the configuration and CSS files stay unchanged. Document CSS is compiled again only for the modules whose sources or imported modules changed since the previous reconstruction in the same process.
39
+
40
+ - Each published npm package and the VS Code extension now include `CHANGELOG.md`, so you can read the release notes of the installed version in `node_modules` or on the extension page.
41
+
42
+ - Start the React Router development server faster. Stillwind no longer compiles routes in the child compiler that React Router uses to read route exports during development, as it already did in builds.
43
+
44
+ - Vite builds and development servers now run TypeScript type collection once for all environments, such as client and SSR, while the environments resolve imports of source files to the same files. This shortens builds and the first page load. Packages may resolve differently, for example when SSR externalizes them. An environment that resolves an import of a source file differently continues with its own type collection.
45
+
46
+ Hosts that share a `CompilationProject` can set `resolverDomain` on `CompilerHost` to name their resolver. When another domain resolves an import of a source file differently, preparation and compilation reject with `ResolutionMismatchError`. Prepared import links no longer point the checker at package runtime files, so the checker resolves package types itself.
47
+
48
+ - Production Vite builds compile faster. Compilations in one build now share scanned sources, import resolutions, and type facts, and React Router builds no longer compile styles for route-export scans and client route stubs.
49
+
50
+ - Build Next applications with Turbopack faster. A production build now loads the entries and the source files that the project's `files` globs select into one type checker that the loader and document CSS compilers of a worker process share, so the checker no longer rebuilds its project for each compiled module.
51
+
52
+ - Apply edits faster in Next development servers that use Turbopack. The Stillwind loaders of a worker process now keep the project files in one type checker between compilations and watch the application directory for changes, so an edit no longer reloads the whole project into the checker.
53
+
54
+ - Compile modules faster when they import other style modules. A compilation no longer builds output again for imported modules that did not change.
55
+
56
+ - Build Vue, Svelte, and Astro projects faster. A module that several entries import is no longer compiled again for each entry while its source and the facts that it reads stay unchanged, and component files now receive the same stylesheet imports as a dependency and as an entry.
57
+
58
+ - Compile faster when many modules import the same styles. A compilation no longer rebuilds the dependencies whose source did not change, and development servers no longer render the whole stylesheet again when a compilation leaves its producers unchanged. Editing a shared style module in a Vite development server now applies the change sooner.
59
+
60
+ - `minifyCss()` now removes whitespace next to commas in values that Lightning CSS does not parse, such as custom property values and values that contain `var()`. Inside such a `calc()` or other math function, it also removes whitespace next to `*` and `/`. For example, `calc(var(--spacing) * 4)` becomes `calc(var(--spacing)*4)`, so minified CSS is smaller.
61
+
62
+ - Build webpack and Rspack applications faster with `StillwindPlugin`. The producer loaders of a compiler now share one design system, compiler session, and type checker while the configuration and CSS files stay unchanged, and document CSS reconstruction reuses their compiled modules instead of compiling every producer again. In watch mode, the shared checker receives the files that webpack or Rspack reports as changed before each compilation.
63
+
64
+ - Updated dependencies:
65
+ - @stillwind/config@0.9.0
66
+ - @stillwind/host@0.9.0
67
+ - @stillwind/native@0.9.0
68
+ - stillwind@0.9.0
69
+
70
+ ## 0.8.0
71
+
72
+ ### Patch Changes
73
+
74
+ - A React Router production build no longer fails at random with `Server-only module referenced by client` for a route that imports a `.server` module with `?stillwind.css`, or whose styles depend on a `.server` module. Rolldown could pass the option that Stillwind uses to skip React Router's check to a different resolution that runs at the same time. Stillwind now resolves such an import again when React Router reports this error. Imports that remain in client code are still checked.
75
+
76
+ - Updated dependencies:
77
+ - @stillwind/config@0.8.0
78
+ - @stillwind/host@0.8.0
79
+ - @stillwind/native@0.8.0
80
+ - stillwind@0.8.0
81
+
82
+ ## 0.7.0
83
+
84
+ ### Patch Changes
85
+
86
+ - Astro sites that use the ClientRouter now keep Stillwind styles from client scripts after a client-side navigation. Previously, the stylesheet that a client script loaded was removed from the page head when the router swapped pages, so elements that the script created stayed unstyled until a full reload.
87
+
88
+ - Rules that a Tailwind CSS JavaScript plugin nests inside `@scope` within a selector, such as `@scope (&)`, now stay inside the `@scope` block, as the same rules in a CSS `@utility` do. Previously, each nested selector moved into the `@scope` prelude, so a selector that used `:scope` matched the document root instead of the scoping root and the rule never applied. For example, daisyUI's `join` lost the radius of its outer corners.
89
+
90
+ A plugin that passes `addUtilities()` or `addComponents()` an `@scope` rule outside any selector, such as `{ "@scope (.theme)": { ".item": { … } } }`, now fails with an error. Previously, Stillwind generated CSS that styled other elements than Tailwind CSS does, without a diagnostic.
91
+
92
+ - A SvelteKit server that uses `@stillwind/integration/sveltekit/handle` now starts when the package is installed from npm. Previously, the SSR build left the handle as an external import, so a production server, for example one built with `@sveltejs/adapter-node`, failed to start with `Cannot find package '$app'`. You can remove an `ssr.noExternal` entry that you added for `@stillwind/integration` as a workaround.
93
+
94
+ - Astro components whose frontmatter ends with a `//` line comment now pass `stillwind lint` and the build. Previously, such components failed with SW31005 ("Astro frontmatter coordinates do not match source"), so a trailing comment such as `// TODO` or a tool directive could fail the whole site build.
95
+
96
+ - The npm package page now shows that each package includes TypeScript declarations. Packages without a root JavaScript entry declare an empty root module, so TypeScript setups that ignore `exports` report a missing export instead of resolving unrelated types.
97
+
98
+ - Updated dependencies:
99
+ - @stillwind/config@0.7.0
100
+ - @stillwind/host@0.7.0
101
+ - @stillwind/native@0.7.0
102
+ - stillwind@0.7.0
103
+
104
+ ## 0.6.0
105
+
106
+ ### Patch Changes
107
+
108
+ - Vite-based integrations, including Astro, now warn when application code or a framework option such as Starlight's `customCss` imports the CSS entrypoint selected in `stillwind.config.ts`. The integration already delivers the compiled CSS, and importing the entrypoint also sends its uncompiled `@theme` and `@utility` rules to the page. Remove the import to fix the warning.
109
+
110
+ - In development, pages that link `/__stillwind/style.css?environment=ssr` now reload that stylesheet when the CSS changes. Theme edits now reach pages that never load the Stillwind client runtime, such as resumable Qwik pages, without importing the CSS entrypoint or reloading the page.
111
+
112
+ - The packages now have npm keywords, so the npm search, the Astro integrations library, and other directories that read `keywords` can find them by the frameworks, build tools, and editors that they support. Each package description now states what the package does and which tools it supports.
113
+
114
+ - Updated dependencies:
115
+ - @stillwind/config@0.6.0
116
+ - @stillwind/host@0.6.0
117
+ - @stillwind/native@0.6.0
118
+ - stillwind@0.6.0
119
+
120
+ ## 0.5.0
121
+
122
+ ### Patch Changes
123
+
124
+ - During Vite development, server rendering now shows a component edit even when a framework transforms the edited file for the server before the hot update runs. Previously, TanStack Start could keep rendering the component from before the edit until the server restarted.
125
+
126
+ - Updated dependencies:
127
+ - @stillwind/config@0.5.0
128
+ - @stillwind/host@0.5.0
129
+ - @stillwind/native@0.5.0
130
+ - stillwind@0.5.0
131
+
132
+ ## 0.4.1
133
+
134
+ ### Patch Changes
135
+
136
+ - Updated dependencies:
137
+ - @stillwind/config@0.4.1
138
+ - @stillwind/host@0.4.1
139
+ - @stillwind/native@0.4.1
140
+ - stillwind@0.4.1
141
+
142
+ ## 0.4.0
143
+
144
+ ### Patch Changes
145
+
146
+ - Updated dependencies:
147
+ - @stillwind/config@0.4.0
148
+ - @stillwind/host@0.4.0
149
+ - @stillwind/native@0.4.0
150
+ - stillwind@0.4.0
151
+
152
+ ## 0.3.0
153
+
154
+ ### Patch Changes
155
+
156
+ - Updated dependencies:
157
+ - @stillwind/config@0.3.0
158
+ - @stillwind/host@0.3.0
159
+ - @stillwind/native@0.3.0
160
+ - stillwind@0.3.0
161
+
162
+ ## 0.2.0
163
+
164
+ ### Patch Changes
165
+
166
+ - Updated dependencies:
167
+ - @stillwind/config@0.2.0
168
+ - @stillwind/host@0.2.0
169
+ - @stillwind/native@0.2.0
170
+ - stillwind@0.2.0
171
+
172
+ ## 0.1.0
173
+
174
+ ### Patch Changes
175
+
176
+ - Updated dependencies:
177
+ - @stillwind/config@0.1.0
178
+ - @stillwind/host@0.1.0
179
+ - @stillwind/native@0.1.0
180
+ - stillwind@0.1.0
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Registers an in-process CSS getter, replacing any previous getter for the same identity.
3
+ *
3
4
  * @param id - Bridge and server-environment identity used by the generated SSR module.
4
5
  * @param getCss - Getter for the current document plan, invoked on each SSR request.
5
6
  * @returns A disposer that removes only this registration and preserves a later replacement.
@@ -7,6 +8,7 @@
7
8
  export declare function registerDevelopmentCss(id: string, getCss: () => Promise<string>): () => void;
8
9
  /**
9
10
  * Reads the current CSS from a registered project.
11
+ *
10
12
  * @param id - Identity registered by the active development bridge.
11
13
  * @returns The current document stylesheet from the registered getter.
12
14
  * @throws If the registration is absent or its getter fails.
@@ -4,6 +4,7 @@ const projectsKey = Symbol.for("@stillwind/integration.astro.development-css");
4
4
  const host = process;
5
5
  /**
6
6
  * Registers an in-process CSS getter, replacing any previous getter for the same identity.
7
+ *
7
8
  * @param id - Bridge and server-environment identity used by the generated SSR module.
8
9
  * @param getCss - Getter for the current document plan, invoked on each SSR request.
9
10
  * @returns A disposer that removes only this registration and preserves a later replacement.
@@ -20,6 +21,7 @@ function registerDevelopmentCss(id, getCss) {
20
21
  }
21
22
  /**
22
23
  * Reads the current CSS from a registered project.
24
+ *
23
25
  * @param id - Identity registered by the active development bridge.
24
26
  * @returns The current document stylesheet from the registered getter.
25
27
  * @throws If the registration is absent or its getter fails.
@@ -1 +1 @@
1
- {"version":3,"file":"development.js","names":[],"sources":["../../src/astro/development.ts"],"sourcesContent":["import process from \"node:process\";\n\nconst projectsKey = Symbol.for(\"@stillwind/integration.astro.development-css\");\n\n/** Active CSS getters keyed by bridge and server-environment identity. */\ntype Projects = Map<string, () => Promise<string>>;\n\n// Vite module runners can evaluate another copy of this module in the same process.\nconst host = process as NodeJS.Process & {\n /** Registry shared across copies evaluated by Vite module runners in this process. */\n [projectsKey]?: Projects;\n};\n\n/**\n * Registers an in-process CSS getter, replacing any previous getter for the same identity.\n * @param id - Bridge and server-environment identity used by the generated SSR module.\n * @param getCss - Getter for the current document plan, invoked on each SSR request.\n * @returns A disposer that removes only this registration and preserves a later replacement.\n */\nexport function registerDevelopmentCss(id: string, getCss: () => Promise<string>): () => void {\n const projects = (host[projectsKey] ??= new Map());\n projects.set(id, getCss);\n return () => {\n const current = host[projectsKey];\n if (current?.get(id) === getCss) {\n current.delete(id);\n if (!current.size) {\n delete host[projectsKey];\n }\n }\n };\n}\n\n/**\n * Reads the current CSS from a registered project.\n * @param id - Identity registered by the active development bridge.\n * @returns The current document stylesheet from the registered getter.\n * @throws If the registration is absent or its getter fails.\n */\nexport async function getDevelopmentCss(id: string): Promise<string> {\n const getCss = host[projectsKey]?.get(id);\n if (!getCss) {\n throw new Error(\"Stillwind Astro development project is unavailable\");\n }\n return getCss();\n}\n"],"mappings":";;AAEA,MAAM,cAAc,OAAO,IAAI,8CAA8C;AAM7E,MAAM,OAAO;;;;;;;AAWb,SAAgB,uBAAuB,IAAY,QAA2C;CAE5F,CADkB,KAAK,iCAAiB,IAAI,IAAI,EAAA,CACvC,IAAI,IAAI,MAAM;CACvB,aAAa;EACX,MAAM,UAAU,KAAK;EACrB,IAAI,SAAS,IAAI,EAAE,MAAM,QAAQ;GAC/B,QAAQ,OAAO,EAAE;GACjB,IAAI,CAAC,QAAQ,MACX,OAAO,KAAK;EAEhB;CACF;AACF;;;;;;;AAQA,eAAsB,kBAAkB,IAA6B;CACnE,MAAM,SAAS,KAAK,YAAY,EAAE,IAAI,EAAE;CACxC,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,oDAAoD;CAEtE,OAAO,OAAO;AAChB"}
1
+ {"version":3,"file":"development.js","names":[],"sources":["../../src/astro/development.ts"],"sourcesContent":["import process from \"node:process\";\n\nconst projectsKey = Symbol.for(\"@stillwind/integration.astro.development-css\");\n\n/**\n * Active CSS getters keyed by bridge and server-environment identity.\n */\ntype Projects = Map<string, () => Promise<string>>;\n\n// Vite module runners can evaluate another copy of this module in the same process.\nconst host = process as NodeJS.Process & {\n /** Registry shared across copies evaluated by Vite module runners in this process. */\n [projectsKey]?: Projects;\n};\n\n/**\n * Registers an in-process CSS getter, replacing any previous getter for the same identity.\n *\n * @param id - Bridge and server-environment identity used by the generated SSR module.\n * @param getCss - Getter for the current document plan, invoked on each SSR request.\n * @returns A disposer that removes only this registration and preserves a later replacement.\n */\nexport function registerDevelopmentCss(id: string, getCss: () => Promise<string>): () => void {\n const projects = (host[projectsKey] ??= new Map());\n projects.set(id, getCss);\n return () => {\n const current = host[projectsKey];\n if (current?.get(id) === getCss) {\n current.delete(id);\n if (!current.size) {\n delete host[projectsKey];\n }\n }\n };\n}\n\n/**\n * Reads the current CSS from a registered project.\n *\n * @param id - Identity registered by the active development bridge.\n * @returns The current document stylesheet from the registered getter.\n * @throws If the registration is absent or its getter fails.\n */\nexport async function getDevelopmentCss(id: string): Promise<string> {\n const getCss = host[projectsKey]?.get(id);\n if (!getCss) {\n throw new Error(\"Stillwind Astro development project is unavailable\");\n }\n return getCss();\n}\n"],"mappings":";;AAEA,MAAM,cAAc,OAAO,IAAI,8CAA8C;AAQ7E,MAAM,OAAO;;;;;;;;AAYb,SAAgB,uBAAuB,IAAY,QAA2C;CAE5F,CADkB,KAAK,iCAAiB,IAAI,IAAI,EAAA,CACvC,IAAI,IAAI,MAAM;CACvB,aAAa;EACX,MAAM,UAAU,KAAK;EACrB,IAAI,SAAS,IAAI,EAAE,MAAM,QAAQ;GAC/B,QAAQ,OAAO,EAAE;GACjB,IAAI,CAAC,QAAQ,MACX,OAAO,KAAK;EAEhB;CACF;AACF;;;;;;;;AASA,eAAsB,kBAAkB,IAA6B;CACnE,MAAM,SAAS,KAAK,YAAY,EAAE,IAAI,EAAE;CACxC,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,oDAAoD;CAEtE,OAAO,OAAO;AAChB"}
@@ -1,4 +1,4 @@
1
- import { t as IntegrationConfig } from "../project-DUGu8g_L.js";
1
+ import { t as IntegrationConfig } from "../project-B_KFQist.js";
2
2
  import { AstroIntegration } from "astro";
3
3
  /**
4
4
  * Creates an Astro integration that applies Stillwind CSS to server-rendered documents and client
@@ -1,4 +1,4 @@
1
- import { i as renderChunkStyles, r as createViteProject, t as createVitePlugins } from "../plugin-ByYcpBcE.js";
1
+ import { i as renderChunkStyles, r as createViteProject, t as createVitePlugins } from "../plugin-DQH8QlYh.js";
2
2
  import { registerDevelopmentCss } from "./development.js";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { fileURLToPath } from "node:url";
@@ -45,6 +45,7 @@ function stillwind(config = {}) {
45
45
  hooks: {
46
46
  /**
47
47
  * Captures Astro's root and installs middleware plus Stillwind's Vite and document plugins.
48
+ *
48
49
  * @param options - Astro setup operations and application configuration.
49
50
  */
50
51
  "astro:config:setup"({ config: astroConfig, updateConfig, addMiddleware }) {
@@ -87,12 +88,15 @@ function stillwind(config = {}) {
87
88
  server.httpServer?.once("close", dispose);
88
89
  };
89
90
  },
90
- /** Removes the development bridge owned by the closing environment. */
91
+ /**
92
+ * Removes the development bridge owned by the closing environment.
93
+ */
91
94
  closeBundle() {
92
95
  if (this.environment) bridges.get(this.environment)?.();
93
96
  },
94
97
  /**
95
98
  * Resolves stylesheet virtual modules and keeps the development bridge external on the server.
99
+ *
96
100
  * @param source - Authored module specifier.
97
101
  * @returns A virtual identity, an external bridge, or undefined for unrelated requests.
98
102
  * @throws If a client environment imports server-only styles or the CSS bridge.
@@ -112,6 +116,7 @@ function stillwind(config = {}) {
112
116
  },
113
117
  /**
114
118
  * Generates SSR stylesheet markup or the client listener that refreshes inline SSR CSS.
119
+ *
115
120
  * @param source - Resolved virtual module identity including its leading NUL.
116
121
  * @returns Generated JavaScript, or undefined for unrelated modules. Production markup retains a manifest placeholder.
117
122
  */
@@ -162,6 +167,7 @@ export async function getStyles() {
162
167
  },
163
168
  /**
164
169
  * Delivers client CSS and replaces the SSR marker with stylesheet links.
170
+ *
165
171
  * @param code - Rendered server or client JavaScript.
166
172
  * @param chunk - Chunk whose filename identifies the generated source map.
167
173
  * @returns Changed JavaScript and its map, or nothing when no styles need delivery.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/astro/index.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { moduleSourceMap } from \"@stillwind/host\";\nimport type { AstroIntegration } from \"astro\";\nimport type { ResolvedConfig } from \"vite\";\n\nimport { renderChunkStyles } from \"../vite/chunk-styles.ts\";\nimport { createVitePlugins } from \"../vite/plugin.ts\";\nimport {\n createViteProject,\n type EnvironmentOwner,\n type IntegrationConfig,\n} from \"../vite/project.ts\";\nimport { registerDevelopmentCss } from \"./development.ts\";\n\nexport type { IntegrationConfig } from \"../vite/project.ts\";\n\n/** Virtual server module imported by Astro middleware to obtain document stylesheet markup. */\nconst ID = \"virtual:stillwind/astro-styles\";\n\n/** Virtual client module that updates inline SSR styles when development CSS changes. */\nconst CLIENT_ID = ID + \"/client\";\n\n/** External server module that connects SSR rendering to the active development compiler. */\nconst BRIDGE_ID = \"@stillwind/integration/internal/astro-development\";\n\n/**\n * JavaScript string literal replaced with stylesheet links after the production graph is rendered.\n */\nconst MARKER = '\"__STILLWIND_ASTRO_STYLES_574f6dfce7c69466ab9516fb7fc6199a__\"';\n\n/**\n * Creates an Astro integration that applies Stillwind CSS to server-rendered documents and client\n * islands.\n *\n * Development SSR reads current CSS through a server bridge and embeds it in HTML. Production SSR\n * inserts links from the stylesheet manifest.\n *\n * @param config - File discovery, project selection, compiler overrides, and Vite CSS emission.\n * Omission discovers stillwind.config.* from Astro's application root when Vite is configured.\n * @returns An Astro integration that installs Stillwind Vite plugins, middleware, and document\n * stylesheet modules.\n */\nexport function stillwind(config: IntegrationConfig = {}): AstroIntegration {\n let applicationRoot: string | undefined;\n\n const project = createViteProject(config, () => applicationRoot);\n const plugins = createVitePlugins(project);\n const bridgeIds = new WeakMap<ResolvedConfig, string>();\n const bridges = new WeakMap<EnvironmentOwner, () => void>();\n const bridgeId = (configuration: ResolvedConfig) => {\n let id = bridgeIds.get(configuration);\n if (!id) {\n id = randomUUID();\n bridgeIds.set(configuration, id);\n }\n return id;\n };\n\n return {\n name: \"@stillwind/integration\",\n hooks: {\n /**\n * Captures Astro's root and installs middleware plus Stillwind's Vite and document plugins.\n * @param options - Astro setup operations and application configuration.\n */\n \"astro:config:setup\"({ config: astroConfig, updateConfig, addMiddleware }) {\n applicationRoot = fileURLToPath(astroConfig.root);\n addMiddleware({\n entrypoint: fileURLToPath(new URL(\"./middleware.js\", import.meta.url)).replaceAll(\n \"\\\\\",\n \"/\",\n ),\n order: \"pre\",\n });\n updateConfig({\n vite: {\n plugins: [\n plugins,\n {\n name: \"stillwind:astro-document\",\n /**\n * Registers a current-CSS bridge for each server environment and ties cleanup to server closure.\n * @param server - Vite server whose environments resolve SSR dependencies and register watches.\n * @throws If no SSR environment is available.\n */\n configureServer(server) {\n if (!server.environments.ssr) {\n throw new Error(\"Stillwind Astro requires an SSR environment\");\n }\n const generation = project.forConfig(server.config);\n const id = bridgeId(server.config);\n return () => {\n const disposers = Object.entries(server.environments)\n .filter(([name]) => name !== \"client\")\n .map(([name, environment]) => {\n const dispose = registerDevelopmentCss(`${id}:${name}`, async () => {\n const plan = await generation.documentPlan(name, {\n resolve: (specifier, importer, options) =>\n environment.pluginContainer.resolveId(specifier, importer, options),\n addWatchFile: (id) => {\n server.watcher.add(id);\n },\n warn: (message) => {\n server.config.logger.warn(message);\n },\n });\n return plan.css;\n });\n bridges.set(environment, dispose);\n return dispose;\n });\n /** Removes all bridge registrations owned by this server configuration. */\n const dispose = () => {\n for (const dispose of disposers) {\n dispose();\n }\n };\n server.httpServer?.once(\"close\", dispose);\n };\n },\n /** Removes the development bridge owned by the closing environment. */\n closeBundle() {\n if (this.environment) {\n bridges.get(this.environment)?.();\n }\n },\n /**\n * Resolves stylesheet virtual modules and keeps the development bridge external on the server.\n * @param source - Authored module specifier.\n * @returns A virtual identity, an external bridge, or undefined for unrelated requests.\n * @throws If a client environment imports server-only styles or the CSS bridge.\n */\n resolveId(source) {\n if (source === BRIDGE_ID) {\n if (this.environment?.name === \"client\") {\n this.error(\"Stillwind Astro CSS bridge is server-only\");\n }\n return {\n id: source,\n external: true,\n };\n }\n if (source === ID || source === CLIENT_ID) {\n if (source === ID && this.environment?.name === \"client\") {\n this.error(\"Stillwind Astro styles are server-only\");\n }\n return \"\\0\" + source;\n }\n return undefined;\n },\n /**\n * Generates SSR stylesheet markup or the client listener that refreshes inline SSR CSS.\n * @param source - Resolved virtual module identity including its leading NUL.\n * @returns Generated JavaScript, or undefined for unrelated modules. Production markup retains a manifest placeholder.\n */\n load(source) {\n const configuration = this.environment.getTopLevelConfig();\n const generation = project.forConfig(configuration);\n if (source === \"\\0\" + CLIENT_ID) {\n const endpoint =\n generation.settings.publicBase + \"__stillwind/style.css?environment=ssr\";\n return `// Stillwind SSR CSS (astro client)\nif (import.meta.hot) {\n let revision = 0;\n import.meta.hot.on(\"stillwind:css\", async () => {\n const requested = ++revision;\n const response = await fetch(${JSON.stringify(endpoint)});\n if (!response.ok) {\n throw new Error(\"Stillwind SSR CSS: \" + response.status);\n }\n const css = await response.text();\n if (requested === revision) {\n for (const style of document.querySelectorAll(\"style[data-stillwind-ssr]\")) {\n style.textContent = css;\n }\n }\n });\n}\n`;\n }\n if (source !== \"\\0\" + ID) {\n return;\n }\n if (generation.settings.watching) {\n const script = `<script type=\"module\" src=\"${generation.settings.publicBase}@id/__x00__${CLIENT_ID}\"></script>`;\n return `// Stillwind SSR CSS (astro with hot reload)\nimport { getDevelopmentCss } from ${JSON.stringify(BRIDGE_ID)};\n\nexport async function getStyles() {\n return \"<style data-stillwind-ssr>\" + escapeInlineCss(await getDevelopmentCss(${JSON.stringify(`${bridgeId(configuration)}:${this.environment.name}`)})) + \"</style>\" + ${JSON.stringify(script)};\n}\n\nfunction escapeInlineCss(css) {\n return css.replace(/<\\\\/style/gi, (match) => match.replace(\"/\", \"\\\\\\\\/\"));\n}\n`;\n }\n return `// Stillwind SSR CSS (astro)\nexport async function getStyles() {\n return ${MARKER};\n}\n`;\n },\n /**\n * Delivers client CSS and replaces the SSR marker with stylesheet links.\n * @param code - Rendered server or client JavaScript.\n * @param chunk - Chunk whose filename identifies the generated source map.\n * @returns Changed JavaScript and its map, or nothing when no styles need delivery.\n */\n renderChunk(code, chunk) {\n const generation = project.forConfig(this.environment.getTopLevelConfig());\n\n if (\n this.environment.name === \"client\" &&\n generation.config.emission !== \"split\"\n ) {\n return renderChunkStyles(generation, \"client\", this, code, chunk, true);\n }\n\n if (!code.includes(MARKER)) {\n return;\n }\n\n const build = generation.buildOutput(this.environment.name);\n const styles = (build?.manifest?.parts ?? [])\n .map(\n (part) =>\n `<link rel=\"stylesheet\" href=\"${part.href.replaceAll(\"&\", \"&amp;\").replaceAll('\"', \"&quot;\")}\">`,\n )\n .join(\"\");\n const index = code.indexOf(MARKER);\n if (index < 0) {\n this.error(\"Cannot locate the Astro stylesheet placeholder\");\n }\n const replacement = JSON.stringify(styles);\n const output =\n code.slice(0, index) + replacement + code.slice(index + MARKER.length);\n return {\n code: output,\n map: JSON.stringify(\n moduleSourceMap(\n code,\n output,\n chunk.fileName,\n [\n {\n originalStart: index,\n originalEnd: index + MARKER.length,\n generatedStart: index,\n generatedEnd: index + replacement.length,\n },\n ],\n [],\n \"\",\n ),\n ),\n };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;;;KAOjL;KACA,OAAO;;WAEd,OAAO;;;IAGF;;;;;;;IAOA,YAAY,MAAM,OAAO;KACvB,MAAM,aAAa,QAAQ,UAAU,KAAK,YAAY,kBAAkB,CAAC;KAEzE,IACE,KAAK,YAAY,SAAS,YAC1B,WAAW,OAAO,aAAa,SAE/B,OAAO,kBAAkB,YAAY,UAAU,MAAM,MAAM,OAAO,IAAI;KAGxE,IAAI,CAAC,KAAK,SAAS,MAAM,GACvB;KAIF,MAAM,UADQ,WAAW,YAAY,KAAK,YAAY,IAClC,CAAC,EAAE,UAAU,SAAS,CAAC,EAAA,CACxC,KACE,SACC,gCAAgC,KAAK,KAAK,WAAW,KAAK,OAAO,CAAC,CAAC,WAAW,MAAK,QAAQ,EAAE,GACjG,CAAC,CACA,KAAK,EAAE;KACV,MAAM,QAAQ,KAAK,QAAQ,MAAM;KACjC,IAAI,QAAQ,GACV,KAAK,MAAM,gDAAgD;KAE7D,MAAM,cAAc,KAAK,UAAU,MAAM;KACzC,MAAM,SACJ,KAAK,MAAM,GAAG,KAAK,IAAI,cAAc,KAAK,MAAM,QAAQ,EAAa;KACvE,OAAO;MACL,MAAM;MACN,KAAK,KAAK,UACR,gBACE,MACA,QACA,MAAM,UACN,CACE;OACE,eAAe;OACf,aAAa,QAAQ;OACrB,gBAAgB;OAChB,cAAc,QAAQ,YAAY;MACpC,CACF,GACA,CAAC,GACD,EACF,CACF;KACF;IACF;GACF,CACF,EACF,EACF,CAAC;EACH,EACF;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/astro/index.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { moduleSourceMap } from \"@stillwind/host\";\nimport type { AstroIntegration } from \"astro\";\nimport type { ResolvedConfig } from \"vite\";\n\nimport { renderChunkStyles } from \"../vite/chunk-styles.ts\";\nimport { createVitePlugins } from \"../vite/plugin.ts\";\nimport {\n createViteProject,\n type EnvironmentOwner,\n type IntegrationConfig,\n} from \"../vite/project.ts\";\nimport { registerDevelopmentCss } from \"./development.ts\";\n\nexport type { IntegrationConfig } from \"../vite/project.ts\";\n\n/** Virtual server module imported by Astro middleware to obtain document stylesheet markup. */\nconst ID = \"virtual:stillwind/astro-styles\";\n\n/** Virtual client module that updates inline SSR styles when development CSS changes. */\nconst CLIENT_ID = ID + \"/client\";\n\n/** External server module that connects SSR rendering to the active development compiler. */\nconst BRIDGE_ID = \"@stillwind/integration/internal/astro-development\";\n\n/**\n * JavaScript string literal replaced with stylesheet links after the production graph is rendered.\n */\nconst MARKER = '\"__STILLWIND_ASTRO_STYLES_574f6dfce7c69466ab9516fb7fc6199a__\"';\n\n/**\n * Creates an Astro integration that applies Stillwind CSS to server-rendered documents and client\n * islands.\n *\n * Development SSR reads current CSS through a server bridge and embeds it in HTML. Production SSR\n * inserts links from the stylesheet manifest.\n *\n * @param config - File discovery, project selection, compiler overrides, and Vite CSS emission.\n * Omission discovers stillwind.config.* from Astro's application root when Vite is configured.\n * @returns An Astro integration that installs Stillwind Vite plugins, middleware, and document\n * stylesheet modules.\n */\nexport function stillwind(config: IntegrationConfig = {}): AstroIntegration {\n let applicationRoot: string | undefined;\n\n const project = createViteProject(config, () => applicationRoot);\n const plugins = createVitePlugins(project);\n const bridgeIds = new WeakMap<ResolvedConfig, string>();\n const bridges = new WeakMap<EnvironmentOwner, () => void>();\n const bridgeId = (configuration: ResolvedConfig) => {\n let id = bridgeIds.get(configuration);\n if (!id) {\n id = randomUUID();\n bridgeIds.set(configuration, id);\n }\n return id;\n };\n\n return {\n name: \"@stillwind/integration\",\n hooks: {\n /**\n * Captures Astro's root and installs middleware plus Stillwind's Vite and document plugins.\n *\n * @param options - Astro setup operations and application configuration.\n */\n \"astro:config:setup\"({ config: astroConfig, updateConfig, addMiddleware }) {\n applicationRoot = fileURLToPath(astroConfig.root);\n addMiddleware({\n entrypoint: fileURLToPath(new URL(\"./middleware.js\", import.meta.url)).replaceAll(\n \"\\\\\",\n \"/\",\n ),\n order: \"pre\",\n });\n updateConfig({\n vite: {\n plugins: [\n plugins,\n {\n name: \"stillwind:astro-document\",\n /**\n * Registers a current-CSS bridge for each server environment and ties cleanup to server closure.\n * @param server - Vite server whose environments resolve SSR dependencies and register watches.\n * @throws If no SSR environment is available.\n */\n configureServer(server) {\n if (!server.environments.ssr) {\n throw new Error(\"Stillwind Astro requires an SSR environment\");\n }\n const generation = project.forConfig(server.config);\n const id = bridgeId(server.config);\n return () => {\n const disposers = Object.entries(server.environments)\n .filter(([name]) => name !== \"client\")\n .map(([name, environment]) => {\n const dispose = registerDevelopmentCss(`${id}:${name}`, async () => {\n const plan = await generation.documentPlan(name, {\n resolve: (specifier, importer, options) =>\n environment.pluginContainer.resolveId(specifier, importer, options),\n addWatchFile: (id) => {\n server.watcher.add(id);\n },\n warn: (message) => {\n server.config.logger.warn(message);\n },\n });\n return plan.css;\n });\n bridges.set(environment, dispose);\n return dispose;\n });\n /** Removes all bridge registrations owned by this server configuration. */\n const dispose = () => {\n for (const dispose of disposers) {\n dispose();\n }\n };\n server.httpServer?.once(\"close\", dispose);\n };\n },\n /**\n * Removes the development bridge owned by the closing environment.\n */\n closeBundle() {\n if (this.environment) {\n bridges.get(this.environment)?.();\n }\n },\n /**\n * Resolves stylesheet virtual modules and keeps the development bridge external on the server.\n *\n * @param source - Authored module specifier.\n * @returns A virtual identity, an external bridge, or undefined for unrelated requests.\n * @throws If a client environment imports server-only styles or the CSS bridge.\n */\n resolveId(source) {\n if (source === BRIDGE_ID) {\n if (this.environment?.name === \"client\") {\n this.error(\"Stillwind Astro CSS bridge is server-only\");\n }\n return {\n id: source,\n external: true,\n };\n }\n if (source === ID || source === CLIENT_ID) {\n if (source === ID && this.environment?.name === \"client\") {\n this.error(\"Stillwind Astro styles are server-only\");\n }\n return \"\\0\" + source;\n }\n return undefined;\n },\n /**\n * Generates SSR stylesheet markup or the client listener that refreshes inline SSR CSS.\n *\n * @param source - Resolved virtual module identity including its leading NUL.\n * @returns Generated JavaScript, or undefined for unrelated modules. Production markup retains a manifest placeholder.\n */\n load(source) {\n const configuration = this.environment.getTopLevelConfig();\n const generation = project.forConfig(configuration);\n if (source === \"\\0\" + CLIENT_ID) {\n const endpoint =\n generation.settings.publicBase + \"__stillwind/style.css?environment=ssr\";\n return `// Stillwind SSR CSS (astro client)\nif (import.meta.hot) {\n let revision = 0;\n import.meta.hot.on(\"stillwind:css\", async () => {\n const requested = ++revision;\n const response = await fetch(${JSON.stringify(endpoint)});\n if (!response.ok) {\n throw new Error(\"Stillwind SSR CSS: \" + response.status);\n }\n const css = await response.text();\n if (requested === revision) {\n for (const style of document.querySelectorAll(\"style[data-stillwind-ssr]\")) {\n style.textContent = css;\n }\n }\n });\n}\n`;\n }\n if (source !== \"\\0\" + ID) {\n return;\n }\n if (generation.settings.watching) {\n const script = `<script type=\"module\" src=\"${generation.settings.publicBase}@id/__x00__${CLIENT_ID}\"></script>`;\n return `// Stillwind SSR CSS (astro with hot reload)\nimport { getDevelopmentCss } from ${JSON.stringify(BRIDGE_ID)};\n\nexport async function getStyles() {\n return \"<style data-stillwind-ssr>\" + escapeInlineCss(await getDevelopmentCss(${JSON.stringify(`${bridgeId(configuration)}:${this.environment.name}`)})) + \"</style>\" + ${JSON.stringify(script)};\n}\n\nfunction escapeInlineCss(css) {\n return css.replace(/<\\\\/style/gi, (match) => match.replace(\"/\", \"\\\\\\\\/\"));\n}\n`;\n }\n return `// Stillwind SSR CSS (astro)\nexport async function getStyles() {\n return ${MARKER};\n}\n`;\n },\n /**\n * Delivers client CSS and replaces the SSR marker with stylesheet links.\n *\n * @param code - Rendered server or client JavaScript.\n * @param chunk - Chunk whose filename identifies the generated source map.\n * @returns Changed JavaScript and its map, or nothing when no styles need delivery.\n */\n renderChunk(code, chunk) {\n const generation = project.forConfig(this.environment.getTopLevelConfig());\n\n if (\n this.environment.name === \"client\" &&\n generation.config.emission !== \"split\"\n ) {\n return renderChunkStyles(generation, \"client\", this, code, chunk, true);\n }\n\n if (!code.includes(MARKER)) {\n return;\n }\n\n const build = generation.buildOutput(this.environment.name);\n const styles = (build?.manifest?.parts ?? [])\n .map(\n (part) =>\n `<link rel=\"stylesheet\" href=\"${part.href.replaceAll(\"&\", \"&amp;\").replaceAll('\"', \"&quot;\")}\">`,\n )\n .join(\"\");\n const index = code.indexOf(MARKER);\n if (index < 0) {\n this.error(\"Cannot locate the Astro stylesheet placeholder\");\n }\n const replacement = JSON.stringify(styles);\n const output =\n code.slice(0, index) + replacement + code.slice(index + MARKER.length);\n return {\n code: output,\n map: JSON.stringify(\n moduleSourceMap(\n code,\n output,\n chunk.fileName,\n [\n {\n originalStart: index,\n originalEnd: index + MARKER.length,\n generatedStart: index,\n generatedEnd: index + replacement.length,\n },\n ],\n [],\n \"\",\n ),\n ),\n };\n },\n },\n ],\n },\n });\n },\n },\n };\n}\n"],"mappings":";;;;;;;AAmBA,MAAM,KAAK;;AAGX,MAAM,YAAY,KAAK;;AAGvB,MAAM,YAAY;;;;AAKlB,MAAM,SAAS;;;;;;;;;;;;;AAcf,SAAgB,UAAU,SAA4B,CAAC,GAAqB;CAC1E,IAAI;CAEJ,MAAM,UAAU,kBAAkB,cAAc,eAAe;CAC/D,MAAM,UAAU,kBAAkB,OAAO;CACzC,MAAM,4BAAY,IAAI,QAAgC;CACtD,MAAM,0BAAU,IAAI,QAAsC;CAC1D,MAAM,YAAY,kBAAkC;EAClD,IAAI,KAAK,UAAU,IAAI,aAAa;EACpC,IAAI,CAAC,IAAI;GACP,KAAK,WAAW;GAChB,UAAU,IAAI,eAAe,EAAE;EACjC;EACA,OAAO;CACT;CAEA,OAAO;EACL,MAAM;EACN,OAAO;;;;;;AAML,qBAAqB,EAAE,QAAQ,aAAa,cAAc,iBAAiB;GACzE,kBAAkB,cAAc,YAAY,IAAI;GAChD,cAAc;IACZ,YAAY,cAAc,IAAI,IAAI,mBAAmB,YAAY,GAAG,CAAC,CAAC,CAAC,WACrE,MACA,GACF;IACA,OAAO;GACT,CAAC;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