payload-live-preview 1.0.2 → 1.0.4
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 +150 -84
- package/dist/adapters/astro/RichText.astro +8 -4
- package/dist/adapters/astro/index.d.ts +84 -9
- package/dist/adapters/astro/index.js +1 -363
- package/dist/adapters/astro/index.js.map +1 -1
- package/dist/adapters/astro/middleware-entry.d.ts +1 -1
- package/dist/adapters/astro/middleware-entry.js +1 -296
- package/dist/adapters/astro/middleware-entry.js.map +1 -1
- package/dist/adapters/nextjs/index.d.ts +24 -10
- package/dist/adapters/nextjs/index.js +1 -305
- package/dist/adapters/nextjs/index.js.map +1 -1
- package/dist/adapters/nuxt/index.d.ts +20 -10
- package/dist/adapters/nuxt/index.js +1 -293
- package/dist/adapters/nuxt/index.js.map +1 -1
- package/dist/adapters/sveltekit/index.d.ts +22 -6
- package/dist/adapters/sveltekit/index.js +1 -272
- package/dist/adapters/sveltekit/index.js.map +1 -1
- package/dist/codegen-astro.js +1 -609
- package/dist/codegen-astro.js.map +1 -1
- package/dist/codegen-cli.js +1 -665
- package/dist/codegen-cli.js.map +1 -1
- package/dist/codegen.cjs +1 -550
- package/dist/codegen.cjs.map +1 -1
- package/dist/codegen.js +1 -546
- package/dist/codegen.js.map +1 -1
- package/dist/core.cjs +1 -3719
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1210 -7
- package/dist/core.d.ts +1210 -7
- package/dist/core.js +1 -3692
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -4118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1359 -34
- package/dist/index.d.ts +1359 -34
- package/dist/index.js +1 -4075
- package/dist/index.js.map +1 -1
- package/dist/{middleware-BwIlf0jW.d.cts → middleware-CkSeLZ-9.d.ts} +35 -19
- package/dist/payload.cjs +1 -30
- package/dist/payload.cjs.map +1 -1
- package/dist/payload.d.cts +4 -3
- package/dist/payload.d.ts +4 -3
- package/dist/payload.js +1 -28
- package/dist/payload.js.map +1 -1
- package/package.json +55 -16
- package/dist/adapters/astro/index.cjs +0 -370
- package/dist/adapters/astro/index.cjs.map +0 -1
- package/dist/adapters/astro/index.d.cts +0 -105
- package/dist/adapters/astro/middleware-entry.cjs +0 -303
- package/dist/adapters/astro/middleware-entry.cjs.map +0 -1
- package/dist/adapters/astro/middleware-entry.d.cts +0 -15
- package/dist/adapters/nextjs/index.cjs +0 -309
- package/dist/adapters/nextjs/index.cjs.map +0 -1
- package/dist/adapters/nextjs/index.d.cts +0 -75
- package/dist/adapters/nuxt/index.cjs +0 -299
- package/dist/adapters/nuxt/index.cjs.map +0 -1
- package/dist/adapters/nuxt/index.d.cts +0 -126
- package/dist/adapters/sveltekit/index.cjs +0 -275
- package/dist/adapters/sveltekit/index.cjs.map +0 -1
- package/dist/adapters/sveltekit/index.d.cts +0 -80
- package/dist/bind-BSgxoQhN.d.cts +0 -1137
- package/dist/bind-BSgxoQhN.d.ts +0 -1137
- package/dist/codegen-astro.cjs +0 -612
- package/dist/codegen-astro.cjs.map +0 -1
- package/dist/codegen-astro.d.cts +0 -54
- package/dist/codegen-cli.cjs +0 -669
- package/dist/codegen-cli.cjs.map +0 -1
- package/dist/codegen-cli.d.cts +0 -19
- package/dist/middleware-BwIlf0jW.d.ts +0 -168
- package/dist/preview-request-DAvxm18T.d.cts +0 -68
- package/dist/preview-request-DAvxm18T.d.ts +0 -68
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
* For projects that already use `sequence(...)`, compose the returned
|
|
15
15
|
* handle with the others; it never short-circuits the chain.
|
|
16
16
|
*
|
|
17
|
+
* The built-in signals detect preview intent only. They do not
|
|
18
|
+
* authenticate the request. Place application-owned server
|
|
19
|
+
* authorization around this handle and invoke it only after success
|
|
20
|
+
* when draft data, credentials, private cache policy, CSP changes, or
|
|
21
|
+
* runtime injection are gated.
|
|
22
|
+
*
|
|
17
23
|
* @module @adapters/sveltekit
|
|
18
24
|
*/
|
|
19
25
|
interface LivePreviewSvelteKitOptions {
|
|
@@ -26,14 +32,19 @@ interface LivePreviewSvelteKitOptions {
|
|
|
26
32
|
readonly mergeDepth?: number;
|
|
27
33
|
readonly autoInject?: boolean;
|
|
28
34
|
/**
|
|
29
|
-
* `'preview-only'` (default) — inject only into responses
|
|
30
|
-
*
|
|
35
|
+
* `'preview-only'` (default) — inject only into responses carrying
|
|
36
|
+
* preview intent. The signals are client-controlled and do not
|
|
37
|
+
* authorize access. `'always'` — every HTML response.
|
|
31
38
|
*/
|
|
32
39
|
readonly inject?: 'preview-only' | 'always';
|
|
33
|
-
/** Query params that
|
|
40
|
+
/** Query params that signal preview intent. Default `['preview', 'draft', 'livePreview']`. */
|
|
34
41
|
readonly previewQueryParams?: readonly string[];
|
|
35
|
-
/** Which signals count as
|
|
42
|
+
/** Which signals count as preview intent. Default: query, fetch-dest, referer. */
|
|
36
43
|
readonly previewSignals?: readonly ('query' | 'fetch-dest' | 'referer')[];
|
|
44
|
+
/**
|
|
45
|
+
* Synchronous route/content filter for script injection only. It is
|
|
46
|
+
* not authentication and does not suppress CSP handling.
|
|
47
|
+
*/
|
|
37
48
|
readonly shouldInject?: (request: Request) => boolean;
|
|
38
49
|
/**
|
|
39
50
|
* CSP management: `'frame-ancestors'` (default) merges only the
|
|
@@ -71,9 +82,14 @@ type SvelteKitHandle = (input: {
|
|
|
71
82
|
*
|
|
72
83
|
* 1. Generates a CSP nonce and writes it to `event.locals.livePreviewNonce`
|
|
73
84
|
* so consumer-rendered scripts can read it from the load function.
|
|
74
|
-
* 2. On preview
|
|
85
|
+
* 2. On requests carrying preview intent, uses
|
|
86
|
+
* `resolve(..., { transformPageChunk })`
|
|
75
87
|
* to inject the script into the `<head>` of the HTML response.
|
|
76
|
-
* 3. Merges the `Content-Security-Policy` header on
|
|
88
|
+
* 3. Merges the `Content-Security-Policy` header on those responses.
|
|
89
|
+
*
|
|
90
|
+
* Call this handle only after application-owned authorization when
|
|
91
|
+
* those response mutations are privileged. `shouldInject` is not an
|
|
92
|
+
* authorization boundary and does not disable CSP handling.
|
|
77
93
|
*/
|
|
78
94
|
declare function livePreviewHandle(options?: LivePreviewSvelteKitOptions): SvelteKitHandle;
|
|
79
95
|
|