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
|
@@ -15,10 +15,15 @@
|
|
|
15
15
|
* body because `NextResponse.next()` carries no body.
|
|
16
16
|
*
|
|
17
17
|
* - `createLivePreviewMiddleware(options)` — merges CSP headers
|
|
18
|
-
* (`frame-ancestors`) onto preview
|
|
19
|
-
* path only activates when you pass it a
|
|
20
|
-
* carries an HTML body (custom servers,
|
|
21
|
-
* HTML) — in standard `middleware.ts`
|
|
18
|
+
* (`frame-ancestors`) onto responses carrying preview intent. Its
|
|
19
|
+
* script-injection path only activates when you pass it a
|
|
20
|
+
* `Response` that actually carries an HTML body (custom servers,
|
|
21
|
+
* route handlers returning HTML) — in standard `middleware.ts`
|
|
22
|
+
* use `autoInject: false`.
|
|
23
|
+
*
|
|
24
|
+
* Preview intent is not authorization. Run application-owned server
|
|
25
|
+
* authentication first and use its result to gate draft data, cache
|
|
26
|
+
* policy, privileged headers, CSP changes, and script rendering.
|
|
22
27
|
*
|
|
23
28
|
* @module @adapters/nextjs
|
|
24
29
|
*/
|
|
@@ -32,14 +37,19 @@ interface LivePreviewNextOptions {
|
|
|
32
37
|
readonly mergeDepth?: number;
|
|
33
38
|
readonly autoInject?: boolean;
|
|
34
39
|
/**
|
|
35
|
-
* `'preview-only'` (default) — inject only into responses
|
|
36
|
-
*
|
|
40
|
+
* `'preview-only'` (default) — inject only into responses carrying
|
|
41
|
+
* preview intent. The signals are client-controlled and do not
|
|
42
|
+
* authorize access. `'always'` — every HTML response.
|
|
37
43
|
*/
|
|
38
44
|
readonly inject?: 'preview-only' | 'always';
|
|
39
|
-
/** Query params that
|
|
45
|
+
/** Query params that signal preview intent. Default `['preview', 'draft', 'livePreview']`. */
|
|
40
46
|
readonly previewQueryParams?: readonly string[];
|
|
41
|
-
/** Which signals count as
|
|
47
|
+
/** Which signals count as preview intent. Default: query, fetch-dest, referer. */
|
|
42
48
|
readonly previewSignals?: readonly ('query' | 'fetch-dest' | 'referer')[];
|
|
49
|
+
/**
|
|
50
|
+
* Synchronous route/content filter for script injection only. It is
|
|
51
|
+
* not authentication and does not suppress CSP handling.
|
|
52
|
+
*/
|
|
43
53
|
readonly shouldInject?: (request: Request) => boolean;
|
|
44
54
|
/**
|
|
45
55
|
* CSP management: `'frame-ancestors'` (default) merges only the
|
|
@@ -61,12 +71,16 @@ type NextMiddleware = (request: Request) => Promise<Response | undefined>;
|
|
|
61
71
|
/**
|
|
62
72
|
* Build a Next.js-compatible middleware operating on the standard
|
|
63
73
|
* `Request` / `Response` pair. Wrap with `NextResponse.next()` in your
|
|
64
|
-
* project to integrate with Next's request pipeline.
|
|
74
|
+
* project to integrate with Next's request pipeline. Invoke it only
|
|
75
|
+
* after application-owned authorization when its response mutations
|
|
76
|
+
* are privileged.
|
|
65
77
|
*/
|
|
66
78
|
declare function createLivePreviewMiddleware(options?: LivePreviewNextOptions): (request: Request, response: Response) => Promise<Response>;
|
|
67
79
|
/**
|
|
68
80
|
* Render the live-preview `<script>` tag — for embedding manually in
|
|
69
|
-
* App Router or Pages Router layouts.
|
|
81
|
+
* App Router or Pages Router layouts. Rendering must be gated by the
|
|
82
|
+
* application's verified preview authorization, not merely an intent
|
|
83
|
+
* query parameter.
|
|
70
84
|
*/
|
|
71
85
|
declare function renderLivePreviewScript(options?: LivePreviewNextOptions & {
|
|
72
86
|
readonly nonce?: string;
|