@tenphi/tasty 0.0.0-snapshot.cd6580c → 0.0.0-snapshot.cdcb69f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{astro-r3wQ-RQn.js → astro-CeYENy2x.js} +62 -68
- package/dist/astro-CeYENy2x.js.map +1 -0
- package/dist/{babel-Bu_bhevw.d.ts → babel-DWCsafYw.d.ts} +2 -2
- package/dist/{collector-CudWaexa.js → collector-B3OsM252.js} +3 -3
- package/dist/{collector-CudWaexa.js.map → collector-B3OsM252.js.map} +1 -1
- package/dist/{config-CHz_SFr_.js → config-B3gPdCqd.js} +71 -15
- package/dist/config-B3gPdCqd.js.map +1 -0
- package/dist/{config-ClpSyptP.d.ts → config-LfIDmVHx.d.ts} +28 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +5 -5
- package/dist/{core-COC2UQ48.js → core-DGm0CFHP.js} +102 -34
- package/dist/core-DGm0CFHP.js.map +1 -0
- package/dist/css-resources-Cyl_axbI.js +149 -0
- package/dist/css-resources-Cyl_axbI.js.map +1 -0
- package/dist/{css-writer-Dji9t0wk.js → css-writer-Bgowobbx.js} +3 -3
- package/dist/{css-writer-Dji9t0wk.js.map → css-writer-Bgowobbx.js.map} +1 -1
- package/dist/{format-rules-U9Od0aqv.js → format-rules-XRw9u7d4.js} +3 -29
- package/dist/format-rules-XRw9u7d4.js.map +1 -0
- package/dist/{hydrate-DA-ttBga.js → hydrate-CNOmZprz.js} +2 -2
- package/dist/{hydrate-DA-ttBga.js.map → hydrate-CNOmZprz.js.map} +1 -1
- package/dist/{index-CV_fhEm0.d.ts → index-Bm9ltvdH.d.ts} +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-KkxDZ9xu.js → keyframes-DE-OE76F.js} +2 -2
- package/dist/{keyframes-KkxDZ9xu.js.map → keyframes-DE-OE76F.js.map} +1 -1
- package/dist/{merge-styles-BGM4RJWC.js → merge-styles-DuoZEsm9.js} +2 -2
- package/dist/{merge-styles-BGM4RJWC.js.map → merge-styles-DuoZEsm9.js.map} +1 -1
- package/dist/{resolve-recipes-DbeVYQFr.js → resolve-recipes-H9NqOQuP.js} +3 -3
- package/dist/{resolve-recipes-DbeVYQFr.js.map → resolve-recipes-H9NqOQuP.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro-middleware-extract-static.js +1 -1
- package/dist/ssr/astro-middleware-extract.js +1 -1
- package/dist/ssr/astro-middleware-static.js +1 -1
- package/dist/ssr/astro-middleware.js +1 -1
- package/dist/ssr/astro.d.ts +9 -1
- package/dist/ssr/astro.js +1 -1
- package/dist/ssr/index.js +3 -3
- package/dist/ssr/next-config.d.ts +66 -0
- package/dist/ssr/next-config.js +115 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +8 -1
- package/dist/ssr/next.js +26 -9
- package/dist/ssr/next.js.map +1 -1
- package/dist/ssr-collector-ref-COs_ioWl.js +29 -0
- package/dist/ssr-collector-ref-COs_ioWl.js.map +1 -0
- package/dist/static/index.js +1 -1
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +4 -4
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.js +1 -1
- package/dist/zero/next.d.ts +1 -1
- package/docs/debug.md +13 -0
- package/docs/runtime-benchmarks.md +177 -12
- package/docs/ssr.md +151 -31
- package/package.json +15 -7
- package/dist/astro-r3wQ-RQn.js.map +0 -1
- package/dist/config-CHz_SFr_.js.map +0 -1
- package/dist/core-COC2UQ48.js.map +0 -1
- package/dist/format-rules-U9Od0aqv.js.map +0 -1
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
# Runtime Benchmarks
|
|
2
2
|
|
|
3
3
|
Tasty keeps its performance claims in reproducible benchmarks rather than
|
|
4
|
-
combining unlike measurements into one score. The repository measures
|
|
4
|
+
combining unlike measurements into one score. The repository measures five
|
|
5
5
|
different costs:
|
|
6
6
|
|
|
7
7
|
1. Style parsing and generation in Node.
|
|
8
8
|
2. The React overhead of an empty `tasty({})` wrapper.
|
|
9
9
|
3. Cold browser generation and injection compared with equivalent CSS that is
|
|
10
10
|
already on the page.
|
|
11
|
+
4. The steady-state interaction path — mod flips and styled subtrees opening
|
|
12
|
+
and closing after the page has loaded.
|
|
13
|
+
5. Page-load cold start: network, module compilation, execution and first
|
|
14
|
+
paint, end to end in a throttled browser.
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
The first four are focused microbenchmarks, not page-level scores. The fifth is
|
|
17
|
+
a page-level measurement and is the only one that answers "what does a visitor
|
|
18
|
+
wait for". Run them several times on an otherwise idle machine and use a
|
|
19
|
+
production profile to decide whether any cost matters in an application.
|
|
15
20
|
|
|
16
21
|
## Reproducing the Results
|
|
17
22
|
|
|
@@ -19,17 +24,21 @@ to decide whether any cost matters in an application.
|
|
|
19
24
|
pnpm bench
|
|
20
25
|
pnpm bench:overhead
|
|
21
26
|
pnpm bench:injection
|
|
27
|
+
pnpm bench:interaction
|
|
28
|
+
pnpm bench:cold-start
|
|
22
29
|
```
|
|
23
30
|
|
|
24
|
-
`pnpm bench` runs the core pipeline benchmarks in Node. The
|
|
25
|
-
|
|
26
|
-
`pnpm test:setup` to download Chromium
|
|
31
|
+
`pnpm bench` runs the core pipeline benchmarks in Node. The rest use production
|
|
32
|
+
code paths in headless Chromium. The first checkout may require
|
|
33
|
+
`pnpm test:setup` to download Chromium, and `pnpm bench:cold-start` needs a
|
|
34
|
+
current `dist/` — run `pnpm build` first.
|
|
27
35
|
|
|
28
36
|
Run the Node and browser suites separately so they do not compete for CPU. The
|
|
29
|
-
browser timer has 0.1 ms resolution, so
|
|
37
|
+
browser timer has 0.1 ms resolution, so the browser benchmarks perform many
|
|
30
38
|
matched operations per sample and divide the absolute difference by the number
|
|
31
|
-
of elements or
|
|
32
|
-
the results
|
|
39
|
+
of elements, rules or interactions. Machine load, browser versions, and CPU
|
|
40
|
+
power will move the results — on a loaded machine the absolute columns drift
|
|
41
|
+
several percent while the raw/Tasty delta holds, so read the delta.
|
|
33
42
|
|
|
34
43
|
## Core Style Pipeline
|
|
35
44
|
|
|
@@ -159,10 +168,158 @@ together. Because the same resolution pattern is present in each workload's
|
|
|
159
168
|
control, the difference answers the narrower delivery question: how much extra
|
|
160
169
|
work did Tasty perform when the same CSS was not already there?
|
|
161
170
|
|
|
171
|
+
## Steady-State Interaction
|
|
172
|
+
|
|
173
|
+
The benchmarks above measure mounting and whole-tree updates. A running
|
|
174
|
+
application spends most of its time on neither. It flips mods — hovered,
|
|
175
|
+
pressed, selected, expanded — on elements whose styles never change, one
|
|
176
|
+
element at a time, and it mounts and unmounts small styled subtrees as menus
|
|
177
|
+
and dialogs open. Both paths go through the state-map and ref-counting
|
|
178
|
+
machinery rather than the parser, so a regression in them is invisible to every
|
|
179
|
+
other benchmark here.
|
|
180
|
+
|
|
181
|
+
[`tasty-interaction.bench.tsx`](../src/tasty-interaction.bench.tsx) pairs each
|
|
182
|
+
case with a raw-DOM equivalent driven by a hand-written stylesheet that
|
|
183
|
+
produces the same computed color and background in both states. The benchmark
|
|
184
|
+
fails if either arm resolves to anything else, so an arm that quietly rendered
|
|
185
|
+
unstyled elements cannot report a flattering number.
|
|
186
|
+
|
|
187
|
+
Each leaf owns its own `useState`, which is what keeps a single-element
|
|
188
|
+
interaction single: re-rendering the root to flip one row would time the whole
|
|
189
|
+
tree. One toggle is far below Chromium's 0.1 ms timer resolution, so a sample
|
|
190
|
+
flips a 100-element tree three times over — 300 commits — and the churn case
|
|
191
|
+
performs 20 open/close cycles. Divide the raw/Tasty difference by those counts.
|
|
192
|
+
|
|
193
|
+
Two things had to be sized deliberately, and both are the difference between a
|
|
194
|
+
readable number and noise:
|
|
195
|
+
|
|
196
|
+
- **The tree is small (100 elements), not large.** React locates a leaf's
|
|
197
|
+
pending update by walking the sibling list, so in a 1,000-element tree a
|
|
198
|
+
single-element update costs ~68 us of traversal — identical in both arms and
|
|
199
|
+
an order of magnitude above anything the styling layer contributes.
|
|
200
|
+
- **The sample resolves style once, not once per flip.** Forcing a recalc
|
|
201
|
+
between flips costs ~70 us in both arms, which buries the delta the same way.
|
|
202
|
+
The browser's side of an interaction is real, but it is the browser's;
|
|
203
|
+
resolution boundaries are what the injection benchmark above measures.
|
|
204
|
+
|
|
205
|
+
The contract check also reads the injected CSS **before** any toggle and fails
|
|
206
|
+
if the hovered rule is not already there. That a style map's states all ship in
|
|
207
|
+
one chunk on first render is the premise of this case; if the hovered rule
|
|
208
|
+
arrived lazily, the first sample would be timing injection.
|
|
209
|
+
|
|
210
|
+
On an Apple M1 Max with React 19.2.8 and Chromium 151, across several runs:
|
|
211
|
+
|
|
212
|
+
| Workload | Raw elements | Tasty mods | Extra per unit |
|
|
213
|
+
| ---------------------------------------------------- | -----------: | -----------: | -----------------------: |
|
|
214
|
+
| 300 single-element mod toggles in a 100-element tree | 2.1–2.5 ms | 2.7–3.1 ms | 1.6–2.1 us / interaction |
|
|
215
|
+
| 20 mount + unmount cycles of a 200-element subtree | 7.6–8.0 ms | 12.6–12.7 ms | 1.22–1.27 us / element |
|
|
216
|
+
|
|
217
|
+
The absolute columns move several percent with machine load; the delta between
|
|
218
|
+
the arms is the stable quantity, so read that rather than either column.
|
|
219
|
+
|
|
220
|
+
Two things are worth reading out of this.
|
|
221
|
+
|
|
222
|
+
A mod flip on an already-mounted element costs about 2 us. The CSS for both
|
|
223
|
+
states already exists — Tasty emits every state of a style map in one chunk on
|
|
224
|
+
first render — so both arms perform the same commit, and what is left is
|
|
225
|
+
Tasty's props and mod handling. That is the same order as the ~1 us empty
|
|
226
|
+
wrapper measured above, which is most of where it comes from.
|
|
227
|
+
|
|
228
|
+
Subtree churn is not about styling at all. Its ~1.25 us per element sits right
|
|
229
|
+
on the empty-wrapper mount cost, because the styles are already cached:
|
|
230
|
+
reopening a menu re-pays the React wrapper, not the style pipeline.
|
|
231
|
+
|
|
232
|
+
## Page-Load Cold Start
|
|
233
|
+
|
|
234
|
+
Every benchmark above deliberately excludes the network, module compilation and
|
|
235
|
+
the first render. [`scripts/cold-start`](../scripts/cold-start) measures exactly
|
|
236
|
+
those: what a visitor waits for between requesting a page and seeing styled
|
|
237
|
+
content, in a real Chromium under CDP network and CPU throttling.
|
|
238
|
+
|
|
239
|
+
Three pages render the same 50 styled components and are verified, before any
|
|
240
|
+
timing, to produce the same 50 elements at the same computed color:
|
|
241
|
+
|
|
242
|
+
- **baseline** — the components server-rendered: identical markup, identical
|
|
243
|
+
class names, a linked stylesheet, and no Tasty on the page. Every other
|
|
244
|
+
column is a delta against this one.
|
|
245
|
+
- **runtime** — Tasty generates the CSS in the browser, as a client-rendered
|
|
246
|
+
application does. The run asserts it really did (69 rules generated).
|
|
247
|
+
- **prewarm** — the same, after one throwaway `computeStyles()` against a
|
|
248
|
+
detached root before the first component renders.
|
|
249
|
+
|
|
250
|
+
Each cell is the median of 5 uncached loads in a fresh browser context. The run
|
|
251
|
+
ends at the first contentful paint, observed through a `PerformanceObserver`
|
|
252
|
+
rather than counted in animation frames — `requestAnimationFrame` fires before
|
|
253
|
+
paint, so a page that commits fast can reach its second frame with nothing
|
|
254
|
+
painted yet.
|
|
255
|
+
|
|
256
|
+
The Tasty bundle is built from what the page imports (`tasty`, `configure`,
|
|
257
|
+
`computeStyles`, `tastyDebug`), so it is tree-shaken the way an application's
|
|
258
|
+
would be: 52.0 KB brotli, 186 KB raw. Re-exporting the whole library instead
|
|
259
|
+
adds ~4 KB brotli of code no page here calls, which would inflate the column
|
|
260
|
+
that dominates this result.
|
|
261
|
+
|
|
262
|
+
On an Apple M1 Max with React 19.2.8 and Chromium 151, first contentful paint:
|
|
263
|
+
|
|
264
|
+
| Link / CPU | baseline | runtime | prewarm | Tasty's cost |
|
|
265
|
+
| --------------------- | -------: | ------: | ------: | -----------: |
|
|
266
|
+
| No throttling, 1x | 44 ms | 56 ms | 56 ms | +12 ms |
|
|
267
|
+
| Fast 4G, 1x | 744 ms | 924 ms | 920 ms | +180 ms |
|
|
268
|
+
| Slow 4G, 1x | 2764 ms | 3708 ms | 3712 ms | +944 ms |
|
|
269
|
+
| No throttling, 4x CPU | 156 ms | 204 ms | 204 ms | +48 ms |
|
|
270
|
+
| Fast 4G, 4x CPU | 820 ms | 1052 ms | 1048 ms | +232 ms |
|
|
271
|
+
| Slow 4G, 4x CPU | 2824 ms | 3836 ms | 3844 ms | +1012 ms |
|
|
272
|
+
|
|
273
|
+
That is one full run of the matrix; a second moved every cell by under 5%.
|
|
274
|
+
|
|
275
|
+
**The cost is the bundle, not the work.** On Slow 4G the extra transfer alone
|
|
276
|
+
accounts for 946 ms of the 944 ms FCP delta — the whole of it, within noise.
|
|
277
|
+
Everything Tasty then *does* is small by comparison:
|
|
278
|
+
|
|
279
|
+
| Phase (Slow 4G, 1x) | baseline | runtime | prewarm |
|
|
280
|
+
| ----------------------- | -------: | ------: | ------: |
|
|
281
|
+
| js+css transfer | 2150 ms | 3096 ms | 3096 ms |
|
|
282
|
+
| module compile (shared) | 1.7 ms | 1.6 ms | 1.5 ms |
|
|
283
|
+
| tasty top-level execute | — | 0.9 ms | 1.1 ms |
|
|
284
|
+
| `configure()` | — | 0.5 ms | 0.4 ms |
|
|
285
|
+
| prewarm | — | — | 4.7 ms |
|
|
286
|
+
| render 1st component | 2.0 ms | 6.7 ms | 2.5 ms |
|
|
287
|
+
| render 49 more | 1.0 ms | 6.0 ms | 5.7 ms |
|
|
288
|
+
|
|
289
|
+
Importing Tasty costs about 1 ms of top-level execution; `configure()` costs
|
|
290
|
+
half of one. The rest of the CPU delta — under 10 ms for 50 components — is
|
|
291
|
+
generation and injection, which is the cost the injection benchmark isolates.
|
|
292
|
+
|
|
293
|
+
One asymmetry is worth naming: the control links a render-blocking stylesheet
|
|
294
|
+
and the runtime modes have none, so the control's first paint waits for CSS the
|
|
295
|
+
runtime modes never request. That is the real difference between the two
|
|
296
|
+
delivery models, not a thumb on the scale, but it means the FCP delta is not
|
|
297
|
+
purely "what Tasty costs to execute".
|
|
298
|
+
|
|
299
|
+
**Prewarming moves the wake-up, it does not remove it.** The first styled render
|
|
300
|
+
is ~4.5 ms more expensive than the ones after it, because that is when the
|
|
301
|
+
engine's deferred payload is actually compiled. A throwaway `computeStyles()`
|
|
302
|
+
against a detached root pays it early: `render 1st` drops from 6.7 ms to
|
|
303
|
+
2.5 ms. The prewarm itself costs 4.7 ms, so FCP does not move. It is worth
|
|
304
|
+
doing only when something else can overlap it, or when the first render is on a
|
|
305
|
+
latency-critical path and the page has idle time before it.
|
|
306
|
+
|
|
307
|
+
**Retained heap.** After a forced collection, the runtime page holds about
|
|
308
|
+
1,013 KB more than the control (2,626 KB vs 1,613 KB) for 50 components — the
|
|
309
|
+
parser caches, the chunk cache, the injector's registry and the generated CSS.
|
|
310
|
+
The control is not zero either; most of its 1.6 MB is React and the DOM.
|
|
311
|
+
|
|
312
|
+
CPU throttling changes which line moves. At 4x, module compilation of the
|
|
313
|
+
larger graph becomes visible (7.4 ms → 26 ms) where at 1x it is free: V8
|
|
314
|
+
pre-parses at import and compiles lazily, so a slower CPU pays for code the
|
|
315
|
+
faster one never fully compiled. Transfer numbers from the unthrottled cells
|
|
316
|
+
are not worth reading — with no emulated link, resource timings are scheduling
|
|
317
|
+
jitter.
|
|
318
|
+
|
|
162
319
|
## Reading the Results Together
|
|
163
320
|
|
|
164
|
-
Do not add
|
|
165
|
-
They describe different paths:
|
|
321
|
+
Do not add the microbenchmark numbers together to estimate an application
|
|
322
|
+
blindly. They describe different paths:
|
|
166
323
|
|
|
167
324
|
- A stable `tasty()` factory can skip the style pipeline on later renders, but
|
|
168
325
|
its React wrapper still participates in reconciliation.
|
|
@@ -170,9 +327,17 @@ They describe different paths:
|
|
|
170
327
|
rule.
|
|
171
328
|
- A genuinely new style pays generation and injection once, then becomes
|
|
172
329
|
reusable.
|
|
330
|
+
- A mod flip on an already-styled element pays neither; it is a class-name
|
|
331
|
+
change.
|
|
173
332
|
- Browser style resolution, layout, and paint depend on the actual document and
|
|
174
333
|
need application-level profiling.
|
|
175
334
|
|
|
335
|
+
The cold-start measurement is the one that puts the rest in proportion. On a
|
|
336
|
+
slow connection, essentially all of Tasty's page-load cost is transferring the
|
|
337
|
+
library; the generation and injection the microbenchmarks obsess over is ~10 ms
|
|
338
|
+
for 50 components. Bundle size is therefore the lever with the largest effect
|
|
339
|
+
on first paint, and the runtime levers matter for what happens after it.
|
|
340
|
+
|
|
176
341
|
The practical optimization target is therefore repeated work: keep style input
|
|
177
342
|
stable when possible, reuse generated chunks, and generate CSS at build or
|
|
178
343
|
server time when runtime flexibility is unnecessary.
|
package/docs/ssr.md
CHANGED
|
@@ -86,6 +86,92 @@ export default function RootLayout({
|
|
|
86
86
|
|
|
87
87
|
That's it. All `tasty()` components inside the tree automatically get SSR support. No per-component changes needed.
|
|
88
88
|
|
|
89
|
+
### Optional shared globals stylesheet
|
|
90
|
+
|
|
91
|
+
By default, configured global CSS is included in the streamed Tasty style tag
|
|
92
|
+
for every route. `withTastyNext()` can move that stable CSS into one
|
|
93
|
+
content-hashed stylesheet shared by all routes while leaving component and hook
|
|
94
|
+
styles in the normal streaming path.
|
|
95
|
+
|
|
96
|
+
Keep the Tasty config in a side-effect-free module:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
// app/tasty.config.ts
|
|
100
|
+
import type { TastyConfig } from '@tenphi/tasty';
|
|
101
|
+
|
|
102
|
+
const config: TastyConfig = {
|
|
103
|
+
tokens: { $gap: '8px', '#brand': 'rebeccapurple' },
|
|
104
|
+
globalStyles: { body: { margin: '0', color: '#brand' } },
|
|
105
|
+
fontFaces: {
|
|
106
|
+
Brand: { src: 'url("/fonts/brand.woff2") format("woff2")' },
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default config;
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Use it from the Next config:
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
// next.config.ts
|
|
117
|
+
import { withTastyNext } from '@tenphi/tasty/ssr/next-config';
|
|
118
|
+
import config from './app/tasty.config';
|
|
119
|
+
|
|
120
|
+
export default withTastyNext({
|
|
121
|
+
config,
|
|
122
|
+
})({
|
|
123
|
+
// your Next.js config
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The runtime must receive the same config. Import and configure it before the
|
|
128
|
+
registry renders:
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
// app/tasty-registry.tsx
|
|
132
|
+
'use client';
|
|
133
|
+
|
|
134
|
+
import { configure } from '@tenphi/tasty';
|
|
135
|
+
import { TastyRegistry } from '@tenphi/tasty/ssr/next';
|
|
136
|
+
import config from './tasty.config';
|
|
137
|
+
|
|
138
|
+
configure(config);
|
|
139
|
+
|
|
140
|
+
export default function TastyStyleRegistry({ children }) {
|
|
141
|
+
return <TastyRegistry>{children}</TastyRegistry>;
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The generated file contains eager configuration artifacts: built-in and custom
|
|
146
|
+
`@property` rules, tokens and presets, `@font-face`, `@counter-style`, native
|
|
147
|
+
CSS `@function` definitions, and `globalStyles`. Route-dependent component
|
|
148
|
+
rules and calls to `useGlobalStyles`, `useRawCSS`, `useKeyframes`,
|
|
149
|
+
`useProperty`, `useFontFace`, `useCounterStyle`, and `useFunction` remain
|
|
150
|
+
route-specific. Configured keyframes also remain lazy and are streamed only
|
|
151
|
+
when a route references them.
|
|
152
|
+
|
|
153
|
+
The default output directory is `public/_tasty`. The wrapper adds the generated
|
|
154
|
+
URL to `TastyRegistry`, respects `basePath`, preserves existing `env` and
|
|
155
|
+
`headers` config, and serves the content-hashed file with an immutable one-year
|
|
156
|
+
cache header on Next server deployments. Static exports keep the content-hashed
|
|
157
|
+
URL and leave cache headers to the hosting provider. Older hashes are not
|
|
158
|
+
deleted automatically, so rolling deployments cannot break pages from the
|
|
159
|
+
previous build; clean the generated directory as part of a clean deployment if
|
|
160
|
+
needed. Page-relative CSS resources such as
|
|
161
|
+
`url(../fonts/brand.woff2)` are rejected because moving them would change their
|
|
162
|
+
meaning; use root-relative, absolute, or data URLs.
|
|
163
|
+
|
|
164
|
+
`withTastyNext()` options:
|
|
165
|
+
|
|
166
|
+
| Option | Type | Default | Description |
|
|
167
|
+
| ------------ | ------------- | ------------------------- | ---------------------------------------------------------------------- |
|
|
168
|
+
| `config` | `TastyConfig` | — | Config object; takes precedence over `configFile` |
|
|
169
|
+
| `configFile` | `string` | — | Project-relative config module path; requires the optional `jiti` peer |
|
|
170
|
+
| `rootDir` | `string` | current directory | Next app root when the build runs from a monorepo root |
|
|
171
|
+
| `outputDir` | `string` | `public/_tasty` | Filesystem output directory |
|
|
172
|
+
| `publicPath` | `string` | inferred from `outputDir` | Root-relative URL; required when output is outside `public` |
|
|
173
|
+
| `enabled` | `boolean` | `true` | Disable generation without changing wrapper composition |
|
|
174
|
+
|
|
89
175
|
### How it works
|
|
90
176
|
|
|
91
177
|
- `TastyRegistry` is a `'use client'` component, but Next.js still server-renders it on initial page load. The `'use client'` boundary is required solely to access `useServerInsertedHTML` — **not** because `tasty()` components need the client.
|
|
@@ -130,13 +216,13 @@ The nonce is automatically applied to all `<style>` and `<script>` tags injected
|
|
|
130
216
|
|
|
131
217
|
Tasty offers several levels of Astro integration. Choose the one that matches your needs:
|
|
132
218
|
|
|
133
|
-
| Setup
|
|
134
|
-
|
|
|
135
|
-
| Zero setup
|
|
136
|
-
| `tastyIntegration({ islands: false })`
|
|
137
|
-
| `tastyIntegration()`
|
|
138
|
-
| `tastyIntegration({ css: { mode: 'extract' } })`
|
|
139
|
-
| `tastyIntegration({ islands: false, css: { mode: 'extract' } })` | One line
|
|
219
|
+
| Setup | Config needed | Deduplication | Hooks work | Client JS |
|
|
220
|
+
| ---------------------------------------------------------------- | ------------- | ------------------------- | ---------------------- | -------------- |
|
|
221
|
+
| Zero setup | None | Per render tree | Yes (within each tree) | None |
|
|
222
|
+
| `tastyIntegration({ islands: false })` | One line | Cross-tree | Yes | None |
|
|
223
|
+
| `tastyIntegration()` | One line | Cross-tree | Yes | Auto-hydration |
|
|
224
|
+
| `tastyIntegration({ css: { mode: 'extract' } })` | One line | Cross-tree and cross-page | Yes | Auto-hydration |
|
|
225
|
+
| `tastyIntegration({ islands: false, css: { mode: 'extract' } })` | One line | Cross-tree and cross-page | Yes | None |
|
|
140
226
|
|
|
141
227
|
### Zero setup (static pages)
|
|
142
228
|
|
|
@@ -235,8 +321,8 @@ This gives the same middleware deduplication and hook support, but ships zero cl
|
|
|
235
321
|
|
|
236
322
|
#### Build-wide CSS extraction
|
|
237
323
|
|
|
238
|
-
Static Astro builds can move
|
|
239
|
-
|
|
324
|
+
Static Astro builds can move Tasty CSS into content-hashed, browser-cacheable
|
|
325
|
+
shared and page assets:
|
|
240
326
|
|
|
241
327
|
```ts
|
|
242
328
|
export default defineConfig({
|
|
@@ -257,14 +343,38 @@ output. Extraction requires Astro 5 or newer and only applies to prerendered
|
|
|
257
343
|
production pages. Development, preview-time SSR, and on-demand routes continue
|
|
258
344
|
to receive the normal inline `<style data-tasty-ssr>` output.
|
|
259
345
|
|
|
260
|
-
Extraction
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
346
|
+
Extraction writes every artifact emitted by all styled pages to a shared
|
|
347
|
+
stylesheet. Each page's strict set difference is written to a separate page
|
|
348
|
+
stylesheet. The shared link comes first and the page link follows, so shared
|
|
349
|
+
styles form the base cascade and page-only styles can override them. A fully
|
|
350
|
+
shared page omits the empty page stylesheet. If generated pages have no common
|
|
351
|
+
artifacts, each page receives only its page stylesheet.
|
|
352
|
+
|
|
353
|
+
The shared-base/page-override order is the extraction-mode cascade contract.
|
|
354
|
+
It does not preserve an inline artifact order where a page-only rule originally
|
|
355
|
+
appeared before a shared rule. Use shared styles for defaults and page-only
|
|
356
|
+
styles for overrides.
|
|
357
|
+
|
|
358
|
+
Extracted CSS preserves resource URLs verbatim. Relative URLs in an inline
|
|
359
|
+
style resolve from the page, but in an extracted stylesheet they resolve from
|
|
360
|
+
the asset directory. Use absolute URLs or data URLs when extraction is enabled.
|
|
361
|
+
Root-relative URLs such as `url(/fonts/brand.woff2)` are also safe while the
|
|
362
|
+
stylesheet stays on the page's origin. The build fails with a clear error if an
|
|
363
|
+
artifact contains a page-relative or fragment-only URL, including URL strings
|
|
364
|
+
in `image-set()`, `image()`, `src()`, and `@import`.
|
|
365
|
+
|
|
366
|
+
Assets are written under Astro's configured `build.assets` directory (for
|
|
367
|
+
example, `/_astro/tasty.shared.a1b2c3.css` and
|
|
368
|
+
`/_astro/tasty.page.d4e5f6.css`). Links include the configured Astro `base`, so
|
|
369
|
+
nested routes do not need relative-path handling. Content hashes and output are
|
|
370
|
+
deterministic for identical builds. If `build.assetsPrefix` is configured,
|
|
371
|
+
Tasty uses its CSS-specific prefix (or `fallback`) just like Astro-generated
|
|
372
|
+
stylesheets. When that prefix points to a different origin, root-relative
|
|
373
|
+
resources would resolve against the asset origin rather than the page's origin,
|
|
374
|
+
so the build rejects them as well. Tasty compares the prefix with Astro's `site`
|
|
375
|
+
when it is configured; without `site`, an absolute or protocol-relative prefix
|
|
376
|
+
is treated conservatively as cross-origin. Use a fully absolute resource URL in
|
|
377
|
+
that configuration.
|
|
268
378
|
|
|
269
379
|
### Manual middleware (advanced)
|
|
270
380
|
|
|
@@ -300,12 +410,13 @@ Astro's `@astrojs/react` renderer calls `renderToString()` for each React compon
|
|
|
300
410
|
- The middleware reads the full response body, then injects the collected CSS into `</head>` before sending the final HTML.
|
|
301
411
|
- In extraction mode, prerendered responses also carry temporary structured
|
|
302
412
|
artifact metadata. `astro:build:done` uses those collector-provided
|
|
303
|
-
boundaries to write
|
|
304
|
-
the metadata.
|
|
413
|
+
boundaries to write shared and page assets and rewrite generated HTML, then
|
|
414
|
+
removes the metadata. Artifact boundaries are never inferred by splitting or
|
|
415
|
+
reparsing the generated CSS.
|
|
305
416
|
|
|
306
417
|
### CSP nonce
|
|
307
418
|
|
|
308
|
-
Call `configure({ nonce: '...' })` before any rendering happens. The middleware reads the nonce and applies it to injected `<style>` and `<script>` tags. In extraction mode,
|
|
419
|
+
Call `configure({ nonce: '...' })` before any rendering happens. The middleware reads the nonce and applies it to injected `<style>` and `<script>` tags. In extraction mode, the external stylesheet links retain the nonce.
|
|
309
420
|
|
|
310
421
|
---
|
|
311
422
|
|
|
@@ -388,12 +499,13 @@ const stream = await runWithCollector(collector, () =>
|
|
|
388
499
|
|
|
389
500
|
### Entry points
|
|
390
501
|
|
|
391
|
-
| Import path
|
|
392
|
-
|
|
|
393
|
-
| `@tenphi/tasty/ssr`
|
|
394
|
-
| `@tenphi/tasty/ssr/next`
|
|
395
|
-
| `@tenphi/tasty/ssr/
|
|
396
|
-
| `@tenphi/tasty/ssr/astro
|
|
502
|
+
| Import path | Description |
|
|
503
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
504
|
+
| `@tenphi/tasty/ssr` | Core SSR API: `ServerStyleCollector`, `createServerStyleCollector`, `runWithCollector`, `hydrateTastyClasses` |
|
|
505
|
+
| `@tenphi/tasty/ssr/next` | Next.js App Router: `TastyRegistry` component |
|
|
506
|
+
| `@tenphi/tasty/ssr/next-config` | Next.js config wrapper: shared, content-hashed global stylesheet |
|
|
507
|
+
| `@tenphi/tasty/ssr/astro` | Astro: `tastyIntegration`, `tastyMiddleware` |
|
|
508
|
+
| `@tenphi/tasty/ssr/astro-client` | Astro: client-side cache hydration (auto-injected by integration, or import manually) |
|
|
397
509
|
| `@tenphi/tasty/ssr/astro-middleware`<br>`@tenphi/tasty/ssr/astro-middleware-static`<br>`@tenphi/tasty/ssr/astro-middleware-extract`<br>`@tenphi/tasty/ssr/astro-middleware-extract-static` | Astro: the middleware entrypoints `tastyIntegration()` registers via `addMiddleware()`. Exported so Astro can resolve them by specifier; you should not import them. For manual setups use `tastyMiddleware()`. |
|
|
398
510
|
|
|
399
511
|
### `ServerStyleCollector`
|
|
@@ -414,7 +526,7 @@ Constructor: `new ServerStyleCollector(namePrefix?)`, or use the `createServerSt
|
|
|
414
526
|
| `allocateCounterStyleName(providedName?)` | Allocate a counter-style name. Returns `providedName` if given, otherwise generates one using `${namePrefix}c${counter}` (e.g. `tc0`, `tc1`, ...). |
|
|
415
527
|
| `collectGlobalStyles(key, css)` | Record global styles (from `useGlobalStyles`). Deduplicated by key. |
|
|
416
528
|
| `collectRawCSS(key, css)` | Record raw CSS text (from `useRawCSS`). Deduplicated by key. |
|
|
417
|
-
| `collectInternals()` | Collect
|
|
529
|
+
| `collectInternals()` | Collect eager configured globals: `@property`, `:root` tokens and presets, `@font-face`, `@counter-style`, `@function`, and `globalStyles`. Called automatically on first chunk collection; idempotent. |
|
|
418
530
|
| `getCSS()` | Get all collected CSS as a single string. For non-streaming SSR. |
|
|
419
531
|
| `flushCSS()` | Get only CSS collected since the last flush. For streaming SSR. |
|
|
420
532
|
| `getRenderedClassNames()` | Get the list of class names rendered so far. Serialized to `window.__TASTY__` for client hydration via `hydrateTastyClasses()`. |
|
|
@@ -423,10 +535,18 @@ Constructor: `new ServerStyleCollector(namePrefix?)`, or use the `createServerSt
|
|
|
423
535
|
|
|
424
536
|
Next.js App Router component. Props:
|
|
425
537
|
|
|
426
|
-
| Prop
|
|
427
|
-
|
|
|
428
|
-
| `children`
|
|
429
|
-
| `transferCache`
|
|
538
|
+
| Prop | Type | Default | Description |
|
|
539
|
+
| ------------------ | ----------------- | --------- | ------------------------------------------------------------------------- |
|
|
540
|
+
| `children` | `ReactNode` | required | Application tree |
|
|
541
|
+
| `transferCache` | `boolean` | `true` | Embed cache state script for zero-cost hydration |
|
|
542
|
+
| `sharedStylesheet` | `string \| false` | generated | Override the shared URL, or disable generated shared CSS for the registry |
|
|
543
|
+
|
|
544
|
+
### `withTastyNext(options)`
|
|
545
|
+
|
|
546
|
+
Next.js configuration wrapper exported from
|
|
547
|
+
`@tenphi/tasty/ssr/next-config`. It generates a shared stylesheet from eager
|
|
548
|
+
Tasty configuration artifacts and wires its URL and immutable cache header
|
|
549
|
+
into the Next config. Route-specific CSS continues through `TastyRegistry`.
|
|
430
550
|
|
|
431
551
|
### `tastyIntegration(options?)`
|
|
432
552
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/tasty",
|
|
3
|
-
"version": "0.0.0-snapshot.
|
|
3
|
+
"version": "0.0.0-snapshot.cdcb69f",
|
|
4
4
|
"description": "A design-system-integrated styling system and DSL for concise, state-aware UI styling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,6 +52,11 @@
|
|
|
52
52
|
"import": "./dist/ssr/next.js",
|
|
53
53
|
"default": "./dist/ssr/next.js"
|
|
54
54
|
},
|
|
55
|
+
"./ssr/next-config": {
|
|
56
|
+
"types": "./dist/ssr/next-config.d.ts",
|
|
57
|
+
"import": "./dist/ssr/next-config.js",
|
|
58
|
+
"default": "./dist/ssr/next-config.js"
|
|
59
|
+
},
|
|
55
60
|
"./ssr/astro": {
|
|
56
61
|
"types": "./dist/ssr/astro.d.ts",
|
|
57
62
|
"import": "./dist/ssr/astro.js",
|
|
@@ -120,6 +125,8 @@
|
|
|
120
125
|
"bench:browser": "vitest bench --project browser",
|
|
121
126
|
"bench:overhead": "vitest bench --config vitest.production-browser-bench.config.ts src/tasty-overhead.bench.tsx",
|
|
122
127
|
"bench:injection": "vitest bench --config vitest.production-browser-bench.config.ts src/tasty-injection.bench.ts",
|
|
128
|
+
"bench:interaction": "vitest bench --config vitest.production-browser-bench.config.ts src/tasty-interaction.bench.tsx",
|
|
129
|
+
"bench:cold-start": "node scripts/cold-start/index.mjs",
|
|
123
130
|
"prepublishOnly": "pnpm run build",
|
|
124
131
|
"changeset": "changeset",
|
|
125
132
|
"version": "changeset version",
|
|
@@ -191,23 +198,24 @@
|
|
|
191
198
|
"@eslint/js": "^10.0.1",
|
|
192
199
|
"@size-limit/esbuild": "^12.0.0",
|
|
193
200
|
"@size-limit/file": "^12.0.0",
|
|
194
|
-
"@tenphi/eslint-plugin-tasty": "^0.
|
|
201
|
+
"@tenphi/eslint-plugin-tasty": "^1.0.5",
|
|
195
202
|
"@testing-library/jest-dom": "^6.9.1",
|
|
196
203
|
"@testing-library/react": "^16.3.2",
|
|
197
204
|
"@types/babel__core": "^7.20.5",
|
|
198
205
|
"@types/babel__helper-plugin-utils": "^7.10.3",
|
|
199
|
-
"@types/node": "^
|
|
206
|
+
"@types/node": "^24.13.3",
|
|
200
207
|
"@types/react": "^19.0.0",
|
|
201
208
|
"@types/react-dom": "^19.0.0",
|
|
202
209
|
"@vitest/browser-playwright": "^4.1.10",
|
|
203
210
|
"astro": "^5.18.2",
|
|
211
|
+
"esbuild": "^0.27.7",
|
|
204
212
|
"eslint": "^10.0.0",
|
|
205
213
|
"eslint-config-prettier": "^10.1.8",
|
|
206
214
|
"jiti": "^2.6.1",
|
|
207
215
|
"knip": "^5.61.3",
|
|
208
216
|
"next": "^16.0.0",
|
|
209
217
|
"playwright": "^1.62.1",
|
|
210
|
-
"prettier": "^3.
|
|
218
|
+
"prettier": "^3.9.6",
|
|
211
219
|
"react": "^19.0.0",
|
|
212
220
|
"react-dom": "^19.0.0",
|
|
213
221
|
"size-limit": "^12.0.0",
|
|
@@ -222,13 +230,13 @@
|
|
|
222
230
|
"name": "main (import *)",
|
|
223
231
|
"path": "dist/index.js",
|
|
224
232
|
"import": "*",
|
|
225
|
-
"limit": "57.
|
|
233
|
+
"limit": "57.5 kB"
|
|
226
234
|
},
|
|
227
235
|
{
|
|
228
236
|
"name": "core (import *)",
|
|
229
237
|
"path": "dist/core/index.js",
|
|
230
238
|
"import": "*",
|
|
231
|
-
"limit": "54.
|
|
239
|
+
"limit": "54.5 kB"
|
|
232
240
|
},
|
|
233
241
|
{
|
|
234
242
|
"name": "static",
|
|
@@ -256,7 +264,7 @@
|
|
|
256
264
|
"path",
|
|
257
265
|
"crypto"
|
|
258
266
|
],
|
|
259
|
-
"limit": "49.
|
|
267
|
+
"limit": "49.6 kB"
|
|
260
268
|
}
|
|
261
269
|
]
|
|
262
270
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"astro-r3wQ-RQn.js","names":[],"sources":["../src/ssr/astro-extraction.ts","../src/ssr/astro.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { readdir, readFile, writeFile, mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { ServerStyleArtifact } from './collector';\n\nconst METADATA_START = '<template data-tasty-extract>';\nconst METADATA_END = '</template>';\n\ninterface ExtractablePage {\n path: string;\n html: string;\n artifacts: ServerStyleArtifact[];\n styleStart: number;\n replacementEnd: number;\n styleOpen: string;\n}\n\nexport function createExtractionMetadata(\n artifacts: ServerStyleArtifact[],\n): string {\n const encoded = Buffer.from(JSON.stringify(artifacts), 'utf8').toString(\n 'base64',\n );\n return `${METADATA_START}${encoded}${METADATA_END}`;\n}\n\nfunction parseExtractablePage(\n path: string,\n html: string,\n): ExtractablePage | null {\n const metadataStart = html.indexOf(METADATA_START);\n if (metadataStart === -1) return null;\n\n const metadataContentStart = metadataStart + METADATA_START.length;\n const metadataEnd = html.indexOf(METADATA_END, metadataContentStart);\n if (metadataEnd === -1) return null;\n\n const encoded = html.slice(metadataContentStart, metadataEnd);\n let artifacts: ServerStyleArtifact[];\n try {\n artifacts = JSON.parse(\n Buffer.from(encoded, 'base64').toString('utf8'),\n ) as ServerStyleArtifact[];\n } catch {\n return null;\n }\n\n const styleStart = html.lastIndexOf('<style data-tasty-ssr', metadataStart);\n if (styleStart === -1) return null;\n const styleOpenEnd = html.indexOf('>', styleStart);\n const styleEnd = html.indexOf('</style>', styleOpenEnd + 1);\n if (\n styleOpenEnd === -1 ||\n styleEnd === -1 ||\n styleEnd + '</style>'.length !== metadataStart\n ) {\n return null;\n }\n\n return {\n path,\n html,\n artifacts,\n styleStart,\n replacementEnd: metadataEnd + METADATA_END.length,\n styleOpen: html.slice(styleStart, styleOpenEnd + 1),\n };\n}\n\nasync function findHTMLFiles(dir: string): Promise<string[]> {\n const paths: string[] = [];\n const entries = await readdir(dir, { withFileTypes: true });\n entries.sort((a, b) => a.name.localeCompare(b.name));\n for (const entry of entries) {\n const path = join(dir, entry.name);\n if (entry.isDirectory()) {\n paths.push(...(await findHTMLFiles(path)));\n } else if (entry.isFile() && entry.name.endsWith('.html')) {\n paths.push(path);\n }\n }\n return paths;\n}\n\nfunction findSequence(haystack: string[], needle: string[]): number {\n if (needle.length === 0) return -1;\n outer: for (let i = 0; i <= haystack.length - needle.length; i++) {\n for (let j = 0; j < needle.length; j++) {\n if (haystack[i + j] !== needle[j]) continue outer;\n }\n return i;\n }\n return -1;\n}\n\n/** Find the largest byte-sized artifact block that is contiguous on every page. */\nfunction selectSharedArtifacts(\n pages: ExtractablePage[],\n): ServerStyleArtifact[] {\n if (pages.length < 2) return [];\n\n const source = pages.reduce((shortest, page) =>\n page.artifacts.length < shortest.artifacts.length ? page : shortest,\n );\n const otherIds = pages\n .filter((page) => page !== source)\n .map((page) => page.artifacts.map(({ id }) => id));\n const sourceIds = source.artifacts.map(({ id }) => id);\n\n let best: ServerStyleArtifact[] = [];\n let bestBytes = 0;\n for (let start = 0; start < source.artifacts.length; start++) {\n let length = source.artifacts.length - start;\n for (const pageIds of otherIds) {\n let pageLength = 0;\n for (let pageStart = 0; pageStart < pageIds.length; pageStart++) {\n if (pageIds[pageStart] !== sourceIds[start]) continue;\n let matchLength = 1;\n while (\n start + matchLength < sourceIds.length &&\n pageStart + matchLength < pageIds.length &&\n sourceIds[start + matchLength] === pageIds[pageStart + matchLength]\n ) {\n matchLength++;\n }\n pageLength = Math.max(pageLength, matchLength);\n }\n length = Math.min(length, pageLength);\n if (length === 0) break;\n }\n\n const candidate = source.artifacts.slice(start, start + length);\n const bytes = candidate.reduce((total, item) => total + item.css.length, 0);\n if (bytes > bestBytes) {\n best = candidate;\n bestBytes = bytes;\n }\n }\n\n return best;\n}\n\nfunction stylesheetHref(\n base: string,\n assets: string,\n filename: string,\n): string {\n const basePath = base === '/' ? '' : `/${base.replace(/^\\/+|\\/+$/g, '')}`;\n const assetsPath = assets.replace(/^\\/+|\\/+$/g, '');\n return `${basePath}/${assetsPath}/${filename}`;\n}\n\nfunction styleTag(styleOpen: string, artifacts: ServerStyleArtifact[]): string {\n if (artifacts.length === 0) return '';\n return `${styleOpen}${artifacts.map(({ css }) => css).join('\\n')}</style>`;\n}\n\nfunction transformPage(\n page: ExtractablePage,\n selected: ServerStyleArtifact[],\n href: string,\n): string {\n const selectedIds = selected.map(({ id }) => id);\n const pageIds = page.artifacts.map(({ id }) => id);\n const first = findSequence(pageIds, selectedIds);\n if (first === -1) {\n const metadataStart = page.html.indexOf(METADATA_START, page.styleStart);\n return (\n page.html.slice(0, metadataStart) + page.html.slice(page.replacementEnd)\n );\n }\n\n const before = page.artifacts.slice(0, first);\n const after = page.artifacts.slice(first + selected.length);\n const nonceAttr = page.styleOpen.match(/\\snonce=\"[^\"]*\"/)?.[0] ?? '';\n const link = `<link rel=\"stylesheet\" href=\"${href}\" data-tasty-ssr${nonceAttr}>`;\n const replacement =\n styleTag(page.styleOpen, before) + link + styleTag(page.styleOpen, after);\n\n return (\n page.html.slice(0, page.styleStart) +\n replacement +\n page.html.slice(page.replacementEnd)\n );\n}\n\nexport async function extractAstroCSS(options: {\n dir: URL;\n base: string;\n assets: string;\n}): Promise<void> {\n const outputDir = fileURLToPath(options.dir);\n const paths = await findHTMLFiles(outputDir);\n const pages = (\n await Promise.all(\n paths.map(async (path) =>\n parseExtractablePage(path, await readFile(path, 'utf8')),\n ),\n )\n ).filter((page): page is ExtractablePage => page !== null);\n if (pages.length === 0) return;\n\n const selected = selectSharedArtifacts(pages);\n if (selected.length === 0) {\n for (const page of pages) {\n const metadataStart = page.html.indexOf(METADATA_START, page.styleStart);\n await writeFile(\n page.path,\n page.html.slice(0, metadataStart) +\n page.html.slice(page.replacementEnd),\n );\n }\n return;\n }\n\n const css = selected.map(({ css }) => css).join('\\n');\n const hash = createHash('sha256').update(css).digest('hex').slice(0, 12);\n const filename = `tasty.${hash}.css`;\n const assetDir = join(outputDir, options.assets);\n await mkdir(assetDir, { recursive: true });\n await writeFile(join(assetDir, filename), css);\n\n const href = stylesheetHref(options.base, options.assets, filename);\n for (const page of pages) {\n await writeFile(page.path, transformPage(page, selected, href));\n }\n}\n","/**\n * Astro integration for Tasty SSR.\n *\n * Provides:\n * - tastyIntegration() — Astro Integration API (recommended)\n * - tastyMiddleware() — manual middleware for advanced composition\n *\n * Import from '@tenphi/tasty/ssr/astro'.\n */\n\nimport { getConfig } from '../config';\nimport { getSSRCollector, runWithCollector } from './async-storage';\nimport { createExtractionMetadata, extractAstroCSS } from './astro-extraction';\nimport { ServerStyleCollector } from './collector';\nimport { registerSSRCollectorGetterGlobal } from './ssr-collector-ref';\n\n// Wire up ALS-based collector discovery so computeStyles() can find\n// the collector set by tastyMiddleware's runWithCollector().\n// Uses globalThis so the getter is visible across Astro's separate\n// module graphs (middleware vs page components).\nregisterSSRCollectorGetterGlobal(getSSRCollector);\n\nexport interface TastyMiddlewareOptions {\n /**\n * Whether to embed the class-list script for client hydration.\n * Set to false to skip class transfer (e.g. for CSP restrictions).\n * Without it, client components may re-inject CSS that already exists\n * in server-rendered `<style>` tags. Default: true.\n */\n transferCache?: boolean;\n}\n\ninterface InternalTastyMiddlewareOptions extends TastyMiddlewareOptions {\n extractionMetadata?: boolean;\n}\n\n/**\n * Create an Astro middleware that collects Tasty styles during SSR.\n *\n * All React components rendered during the request will have their\n * computeStyles() calls captured by the collector via AsyncLocalStorage.\n * After rendering, the middleware injects the collected CSS into </head>.\n *\n * @example Manual middleware setup\n * ```ts\n * // src/middleware.ts\n * import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';\n * export const onRequest = tastyMiddleware();\n * ```\n *\n * @example Composing with other middleware\n * ```ts\n * // src/middleware.ts\n * import { sequence } from 'astro:middleware';\n * import { tastyMiddleware } from '@tenphi/tasty/ssr/astro';\n *\n * export const onRequest = sequence(\n * tastyMiddleware(),\n * myOtherMiddleware,\n * );\n * ```\n */\nexport function tastyMiddleware(options?: TastyMiddlewareOptions) {\n const internalOptions = options as InternalTastyMiddlewareOptions | undefined;\n return async (\n context: { isPrerendered?: boolean },\n next: () => Promise<Response>,\n ): Promise<Response> => {\n const transferCache = options?.transferCache ?? true;\n const extractionMetadata =\n internalOptions?.extractionMetadata === true &&\n context.isPrerendered === true;\n const collector = new ServerStyleCollector();\n\n // Run the entire request — including body stream consumption — inside\n // the ALS context so that components rendering lazily during stream\n // reads can still find the collector via getSSRCollector().\n type Rendered =\n | { response: Response }\n | { html: string | null; status: number; headers: Headers };\n\n const rendered = await runWithCollector<Promise<Rendered>>(\n collector,\n async (): Promise<Rendered> => {\n const response = await next();\n const body = response.body;\n\n // Only process HTML responses. Reading a non-HTML body (e.g. an\n // image, font, or JSON endpoint) as UTF-8 text corrupts binary\n // payloads: every byte >= 0x80 is decoded to U+FFFD and re-encoded\n // as EF BF BD. Pass anything that isn't HTML straight through.\n const contentType = response.headers.get('content-type') ?? '';\n if (!body || !contentType.includes('text/html')) {\n return { response };\n }\n\n const reader = body.pipeThrough(new TextDecoderStream()).getReader();\n const parts: string[] = [];\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n parts.push(value);\n }\n return {\n html: parts.join(''),\n status: response.status,\n headers: response.headers,\n };\n },\n );\n\n // Non-HTML responses are returned untouched to avoid corrupting\n // binary payloads.\n if ('response' in rendered) {\n return rendered.response;\n }\n\n if (!rendered.html) {\n return new Response(null, {\n status: rendered.status,\n headers: rendered.headers,\n });\n }\n\n let { html } = rendered;\n\n const css = collector.getCSS();\n if (!css) {\n return new Response(html, {\n status: rendered.status,\n headers: rendered.headers,\n });\n }\n\n const nonce = getConfig().nonce;\n const nonceAttr = nonce ? ` nonce=\"${nonce}\"` : '';\n const styleTag = `<style data-tasty-ssr${nonceAttr}>${css}</style>`;\n const metadataTag = extractionMetadata\n ? createExtractionMetadata(collector.getArtifacts())\n : '';\n\n let cacheTag = '';\n if (transferCache) {\n const classNames = collector.getRenderedClassNames();\n if (classNames.length > 0) {\n const classListJSON = classNames.map((n) => `\"${n}\"`).join(',');\n cacheTag = `<script${nonceAttr}>(window.__TASTY__=window.__TASTY__||[]).push(${classListJSON})</script>`;\n }\n }\n\n const injection = styleTag + metadataTag + cacheTag;\n const idx = html.indexOf('</head>');\n if (idx !== -1) {\n html = html.slice(0, idx) + injection + html.slice(idx);\n } else {\n html = injection + html;\n }\n\n const headers = new Headers(rendered.headers);\n headers.delete('content-length');\n\n return new Response(html, {\n status: rendered.status,\n headers,\n });\n };\n}\n\n// ============================================================================\n// Astro Integration API\n// ============================================================================\n\n/**\n * Package subpaths of the middleware entrypoints registered by\n * `tastyIntegration()`.\n *\n * These must be bare specifiers rather than\n * `new URL('./astro-middleware.js', import.meta.url)`. The bundler is free to\n * hoist `tastyIntegration` into a shared chunk at a different directory depth\n * than `dist/ssr/`, which makes a relative URL resolve to a file that does not\n * exist and breaks the build for every consumer. A package subpath is resolved\n * by the consumer through our `exports` map, so it never depends on the\n * chunk layout.\n *\n * There are separate entrypoints instead of one parameterised entrypoint because\n * `addMiddleware()` cannot pass options: the integration runs when the Astro\n * config is loaded, while the middleware module is evaluated in the server\n * runtime — a different process for built output — so module-level state set\n * by the integration is not visible to the middleware.\n */\nconst MIDDLEWARE_ENTRYPOINT = '@tenphi/tasty/ssr/astro-middleware';\nconst MIDDLEWARE_ENTRYPOINT_STATIC =\n '@tenphi/tasty/ssr/astro-middleware-static';\nconst MIDDLEWARE_ENTRYPOINT_EXTRACT =\n '@tenphi/tasty/ssr/astro-middleware-extract';\nconst MIDDLEWARE_ENTRYPOINT_EXTRACT_STATIC =\n '@tenphi/tasty/ssr/astro-middleware-extract-static';\n\nexport interface TastyIntegrationCSSOptions {\n /** CSS delivery mode. Extraction only applies to prerendered builds. */\n mode?: 'inline' | 'extract';\n}\n\nexport interface TastyIntegrationOptions {\n /**\n * Enable island hydration support.\n *\n * When `true` (default): injects a client hydration script via\n * `injectScript('before-hydration')` and sets `transferCache: true`\n * on the middleware. Islands skip the style pipeline during hydration.\n *\n * When `false`: no client JS is shipped and `transferCache` is set\n * to `false`. Use this for fully static sites without `client:*`\n * directives.\n */\n islands?: boolean;\n /** Configure inline or build-wide extracted CSS delivery. */\n css?: TastyIntegrationCSSOptions;\n}\n\n/**\n * Astro integration that automatically sets up Tasty SSR.\n *\n * Registers middleware for cross-component CSS deduplication and\n * optionally injects a client hydration script for island support.\n *\n * @example Basic setup (with islands)\n * ```ts\n * // astro.config.mjs\n * import { tastyIntegration } from '@tenphi/tasty/ssr/astro';\n *\n * export default defineConfig({\n * integrations: [tastyIntegration()],\n * });\n * ```\n *\n * @example Static-only (no client JS)\n * ```ts\n * // astro.config.mjs\n * import { tastyIntegration } from '@tenphi/tasty/ssr/astro';\n *\n * export default defineConfig({\n * integrations: [tastyIntegration({ islands: false })],\n * });\n * ```\n */\nexport function tastyIntegration(options?: TastyIntegrationOptions) {\n const { islands = true } = options ?? {};\n const cssMode = options?.css?.mode ?? 'inline';\n let base = '/';\n let assets = '_astro';\n\n return {\n name: '@tenphi/tasty',\n hooks: {\n 'astro:config:setup': ({\n addMiddleware,\n injectScript,\n }: {\n addMiddleware: (middleware: {\n entrypoint: string | URL;\n order: 'pre' | 'post';\n }) => void;\n injectScript: (\n stage: 'head-inline' | 'before-hydration' | 'page' | 'page-ssr',\n content: string,\n ) => void;\n }) => {\n addMiddleware({\n entrypoint:\n cssMode === 'extract'\n ? islands\n ? MIDDLEWARE_ENTRYPOINT_EXTRACT\n : MIDDLEWARE_ENTRYPOINT_EXTRACT_STATIC\n : islands\n ? MIDDLEWARE_ENTRYPOINT\n : MIDDLEWARE_ENTRYPOINT_STATIC,\n order: 'pre',\n });\n\n if (islands) {\n injectScript(\n 'before-hydration',\n `import \"@tenphi/tasty/ssr/astro-client\";`,\n );\n }\n },\n 'astro:config:done': ({\n config,\n }: {\n config: { base?: string; build?: { assets?: string } };\n }) => {\n base = config.base ?? '/';\n assets = config.build?.assets ?? '_astro';\n },\n 'astro:build:done': async ({ dir }: { dir: URL }) => {\n if (cssMode !== 'extract') return;\n await extractAstroCSS({ dir, base, assets });\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;AAOA,MAAM,iBAAiB;AACvB,MAAM,eAAe;AAWrB,SAAgB,yBACd,WACQ;CAIR,OAAO,GAAG,iBAHM,OAAO,KAAK,KAAK,UAAU,SAAS,GAAG,MAAM,CAAC,CAAC,SAC7D,QAE+B,IAAI;AACvC;AAEA,SAAS,qBACP,MACA,MACwB;CACxB,MAAM,gBAAgB,KAAK,QAAQ,cAAc;CACjD,IAAI,kBAAkB,IAAI,OAAO;CAEjC,MAAM,uBAAuB,gBAAgB;CAC7C,MAAM,cAAc,KAAK,QAAQ,cAAc,oBAAoB;CACnE,IAAI,gBAAgB,IAAI,OAAO;CAE/B,MAAM,UAAU,KAAK,MAAM,sBAAsB,WAAW;CAC5D,IAAI;CACJ,IAAI;EACF,YAAY,KAAK,MACf,OAAO,KAAK,SAAS,QAAQ,CAAC,CAAC,SAAS,MAAM,CAChD;CACF,QAAQ;EACN,OAAO;CACT;CAEA,MAAM,aAAa,KAAK,YAAY,yBAAyB,aAAa;CAC1E,IAAI,eAAe,IAAI,OAAO;CAC9B,MAAM,eAAe,KAAK,QAAQ,KAAK,UAAU;CACjD,MAAM,WAAW,KAAK,QAAQ,YAAY,eAAe,CAAC;CAC1D,IACE,iBAAiB,MACjB,aAAa,MACb,WAAW,MAAsB,eAEjC,OAAO;CAGT,OAAO;EACL;EACA;EACA;EACA;EACA,gBAAgB,cAAc;EAC9B,WAAW,KAAK,MAAM,YAAY,eAAe,CAAC;CACpD;AACF;AAEA,eAAe,cAAc,KA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