@fictjs/ssr 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -4
- package/dist/chunk-LW7ALN63.js +1129 -0
- package/dist/experimental.cjs +780 -0
- package/dist/experimental.d.cts +164 -0
- package/dist/experimental.d.ts +164 -0
- package/dist/experimental.js +7 -0
- package/dist/index.cjs +76 -165
- package/dist/index.d.cts +2 -154
- package/dist/index.d.ts +2 -154
- package/dist/index.js +8 -1082
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -250,11 +250,17 @@ interface RenderToStringOptions {
|
|
|
250
250
|
snapshotTarget?: 'container' | 'body' | 'head'
|
|
251
251
|
|
|
252
252
|
// Runtime Configuration
|
|
253
|
-
exposeGlobals?: boolean // Default:
|
|
253
|
+
exposeGlobals?: boolean // Default: false; opt-in compatibility mode
|
|
254
254
|
manifest?: Record<string, string> | string
|
|
255
255
|
}
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
+
By default SSR does not write `window`, `document`, `Node`, or related DOM constructors to
|
|
259
|
+
`globalThis`. This keeps concurrent renders from racing over process-global DOM state. Components
|
|
260
|
+
should use Fict's render-provided document/ownerDocument paths; set `exposeGlobals: true` only for
|
|
261
|
+
legacy code that still reads DOM globals during server render. That compatibility mode is restored
|
|
262
|
+
on `dispose()`, but it is not concurrency-safe while overlapping renders are active.
|
|
263
|
+
|
|
258
264
|
### renderToDocument
|
|
259
265
|
|
|
260
266
|
```typescript
|
|
@@ -306,6 +312,10 @@ The asset is published as `@fictjs/ssr/fict-stream-runtime.js`. Build tools that
|
|
|
306
312
|
need to materialize it themselves can import `createStreamRuntimeCode` from
|
|
307
313
|
`@fictjs/ssr/stream-runtime`.
|
|
308
314
|
|
|
315
|
+
Trusted Types deployments should use this external observer runtime. The patch
|
|
316
|
+
runtime moves `<template>` content with DOM APIs (`content` + `insertBefore`) and
|
|
317
|
+
does not call `innerHTML`, `insertAdjacentHTML`, `eval`, or `Function`.
|
|
318
|
+
|
|
309
319
|
### renderToPipeableStream
|
|
310
320
|
|
|
311
321
|
Node.js-style stream variant (compatible with `pipe()`).
|
|
@@ -324,10 +334,11 @@ await allReady
|
|
|
324
334
|
### renderToPartial
|
|
325
335
|
|
|
326
336
|
Generate a complete shell HTML plus a deferred patch stream for Partial Prerendering workflows.
|
|
327
|
-
This is an advanced API and currently considered **Preview** in v1.0.
|
|
337
|
+
This is an advanced API and currently considered **Experimental Preview** in v1.0; do not treat the return shape as frozen.
|
|
338
|
+
Import it from the explicit Preview entrypoint, not the supported package main export.
|
|
328
339
|
|
|
329
340
|
```typescript
|
|
330
|
-
import { renderToPartial } from '@fictjs/ssr'
|
|
341
|
+
import { renderToPartial } from '@fictjs/ssr/experimental'
|
|
331
342
|
|
|
332
343
|
const { shell, stream, shellReady, allReady } = renderToPartial(() => <App />, {
|
|
333
344
|
mode: 'shell',
|
|
@@ -469,7 +480,7 @@ Generated detailed `fict.manifest.json` during production build, mapping virtual
|
|
|
469
480
|
|
|
470
481
|
## Partial Prerendering
|
|
471
482
|
|
|
472
|
-
`renderToPartial()` enables a PPR-style split:
|
|
483
|
+
`renderToPartial()` is an **Experimental Preview** API that enables a PPR-style split:
|
|
473
484
|
|
|
474
485
|
1. **Shell phase**: serve/cache `shell` as static-first HTML.
|
|
475
486
|
2. **Deferred phase**: deliver `stream` patches for resolved Suspense boundaries.
|