prismic 1.21.0 → 1.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/dist/adapters-DPb0t6EU.mjs +191 -0
- package/dist/{auth-Bi0hYnVj.mjs → auth-D17Z0IuK.mjs} +1 -1
- package/dist/index.mjs +124 -99
- package/dist/{nextjs-DP-ui31G.mjs → nextjs-Cj6xZEd3.mjs} +55 -55
- package/dist/{nuxt-V2Y8WzY1.mjs → nuxt-BwU_wt1u.mjs} +12 -12
- package/dist/package-BmR9etBQ.mjs +1 -0
- package/dist/{segment-CGLmVq2C.mjs → segment-DiEeqnUu.mjs} +1 -1
- package/dist/subprocesses/refreshToken.mjs +1 -1
- package/dist/subprocesses/sendSegmentEvents.mjs +1 -1
- package/dist/subprocesses/updateVersionState.mjs +1 -1
- package/dist/{sveltekit-q63_SgMi.mjs → sveltekit-C7Mpsvl-.mjs} +31 -31
- package/dist/{update-notifier-CWyOCy0G.mjs → update-notifier-BBo9CSjK.mjs} +1 -1
- package/package.json +1 -1
- package/dist/adapters-BAbISLsD.mjs +0 -189
- package/dist/package-IViHhlnH.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,b as t,c as n,g as r,l as i,nt as a,ot as o,t as s,tt as c,u as l}from"./adapters-DPb0t6EU.mjs";import{c as u,h as d}from"./request-DozpYv-V.mjs";import{n as f,o as p}from"./packageJson-Bvm9nRNl.mjs";import{t as m}from"./taggedTemplateLiteral-DygvE_Ih.mjs";import{readFile as h,rm as g}from"node:fs/promises";import{relative as _}from"node:path";import{fileURLToPath as v}from"node:url";var y,b,x,S,C,w,T,E,D,O;function k({typescript:e}){return e?c`
|
|
2
2
|
import { createClient as baseCreateClient } from "@prismicio/client";
|
|
3
3
|
import { type CreateClientConfig, enableAutoPreviews } from '@prismicio/svelte/kit';
|
|
4
4
|
import { env } from '$env/dynamic/public';
|
|
@@ -26,7 +26,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
26
26
|
|
|
27
27
|
return client;
|
|
28
28
|
};
|
|
29
|
-
`:
|
|
29
|
+
`:c`
|
|
30
30
|
import { createClient as baseCreateClient } from "@prismicio/client";
|
|
31
31
|
import { enableAutoPreviews } from '@prismicio/svelte/kit';
|
|
32
32
|
import { env } from '$env/dynamic/public';
|
|
@@ -54,7 +54,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
54
54
|
|
|
55
55
|
return client;
|
|
56
56
|
};
|
|
57
|
-
`}function A({version:e}){let
|
|
57
|
+
`}function A({version:e}){let t=c(y||=m([`
|
|
58
58
|
<script>
|
|
59
59
|
import { SliceSimulator, SliceZone } from '@prismicio/svelte';
|
|
60
60
|
import { components } from '$lib/slices';
|
|
@@ -64,7 +64,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
64
64
|
<SliceSimulator let:slices>
|
|
65
65
|
<SliceZone {slices} {components} />
|
|
66
66
|
</SliceSimulator>
|
|
67
|
-
`])),
|
|
67
|
+
`])),n=c(b||=m([`
|
|
68
68
|
<script>
|
|
69
69
|
import { SliceSimulator, SliceZone } from '@prismicio/svelte';
|
|
70
70
|
import { components } from '$lib/slices';
|
|
@@ -73,7 +73,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
73
73
|
<SliceSimulator let:slices>
|
|
74
74
|
<SliceZone {slices} {components} />
|
|
75
75
|
</SliceSimulator>
|
|
76
|
-
`]));return e<=4?
|
|
76
|
+
`]));return e<=4?n:t}function j({typescript:e}){return e?c`
|
|
77
77
|
import { redirectToPreviewURL } from '@prismicio/svelte/kit';
|
|
78
78
|
import { createClient } from '$lib/prismicio';
|
|
79
79
|
import type { RequestHandler } from "./$types";
|
|
@@ -83,7 +83,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
83
83
|
|
|
84
84
|
return await redirectToPreviewURL({ client, request, cookies });
|
|
85
85
|
}
|
|
86
|
-
`:
|
|
86
|
+
`:c`
|
|
87
87
|
import { redirectToPreviewURL } from '@prismicio/svelte/kit';
|
|
88
88
|
import { createClient } from '$lib/prismicio';
|
|
89
89
|
|
|
@@ -93,7 +93,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
93
93
|
|
|
94
94
|
return await redirectToPreviewURL({ client, request, cookies });
|
|
95
95
|
}
|
|
96
|
-
`}const M=
|
|
96
|
+
`}const M=c`
|
|
97
97
|
<svelte:head>
|
|
98
98
|
<title>{page.data.page?.data.meta_title}</title>
|
|
99
99
|
<meta property="og:title" content={page.data.page?.data.meta_title} />
|
|
@@ -105,7 +105,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
105
105
|
<meta property="og:image" content={asImageSrc(page.data.page.data.meta_image)} />
|
|
106
106
|
{/if}
|
|
107
107
|
</svelte:head>
|
|
108
|
-
`;function N(){return
|
|
108
|
+
`;function N(){return c`
|
|
109
109
|
import { repositoryName } from "$lib/prismicio";
|
|
110
110
|
|
|
111
111
|
export const prerender = "auto";
|
|
@@ -113,7 +113,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
113
113
|
export function load() {
|
|
114
114
|
return { repositoryName };
|
|
115
115
|
}
|
|
116
|
-
`}function P({version:e}){let
|
|
116
|
+
`}function P({version:e}){let t=c(x||=m([`
|
|
117
117
|
<script>
|
|
118
118
|
import { isFilled, asImageSrc } from '@prismicio/client';
|
|
119
119
|
import { PrismicPreview } from '@prismicio/svelte/kit';
|
|
@@ -125,7 +125,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
125
125
|
`,`
|
|
126
126
|
{@render children()}
|
|
127
127
|
<PrismicPreview repositoryName={data.repositoryName} />
|
|
128
|
-
`]),M),
|
|
128
|
+
`]),M),n=c(S||=m([`
|
|
129
129
|
<script>
|
|
130
130
|
import { isFilled, asImageSrc } from '@prismicio/client';
|
|
131
131
|
import { PrismicPreview } from '@prismicio/svelte/kit';
|
|
@@ -137,7 +137,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
137
137
|
`,`
|
|
138
138
|
<slot />
|
|
139
139
|
<PrismicPreview repositoryName={data.repositoryName} />
|
|
140
|
-
`]),M);return e<=4?
|
|
140
|
+
`]),M);return e<=4?n:t}function F({typescript:e}){return c(e?C||=m([`
|
|
141
141
|
<script lang="ts">
|
|
142
142
|
import { SliceZone } from "@prismicio/svelte";
|
|
143
143
|
import { components } from "$lib/slices";
|
|
@@ -156,7 +156,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
156
156
|
<\/script>
|
|
157
157
|
|
|
158
158
|
<SliceZone slices={data.page.data.slices} {components} />
|
|
159
|
-
`]))}function I({model:e,typescript:
|
|
159
|
+
`]))}function I({model:e,typescript:t}){return e.repeatable?t?c`
|
|
160
160
|
import type { PageServerLoad } from "./$types";
|
|
161
161
|
import { createClient } from "$lib/prismicio";
|
|
162
162
|
|
|
@@ -166,7 +166,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
166
166
|
|
|
167
167
|
return { page };
|
|
168
168
|
};
|
|
169
|
-
`:
|
|
169
|
+
`:c`
|
|
170
170
|
import { createClient } from "$lib/prismicio";
|
|
171
171
|
|
|
172
172
|
/** @type {import("./$types").PageServerLoad} */
|
|
@@ -176,7 +176,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
176
176
|
|
|
177
177
|
return { page };
|
|
178
178
|
}
|
|
179
|
-
`:
|
|
179
|
+
`:t?c`
|
|
180
180
|
import type { PageServerLoad } from "./$types";
|
|
181
181
|
import { createClient } from "$lib/prismicio";
|
|
182
182
|
|
|
@@ -186,7 +186,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
186
186
|
|
|
187
187
|
return { page };
|
|
188
188
|
};
|
|
189
|
-
`:
|
|
189
|
+
`:c`
|
|
190
190
|
import { createClient } from "$lib/prismicio";
|
|
191
191
|
|
|
192
192
|
/* @type {import("./$types").PageServerLoad} */
|
|
@@ -196,13 +196,13 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
196
196
|
|
|
197
197
|
return { page };
|
|
198
198
|
}
|
|
199
|
-
`}const L=
|
|
199
|
+
`}const L=c`
|
|
200
200
|
<section data-slice-type={slice.slice_type} data-slice-variation={slice.variation}>
|
|
201
201
|
Placeholder component for {slice.slice_type} (variation: {slice.variation}) slices.
|
|
202
202
|
<br />
|
|
203
203
|
<strong>You can edit this slice directly in your code editor.</strong>
|
|
204
204
|
</section>
|
|
205
|
-
`;function R({name:e,typescript:
|
|
205
|
+
`;function R({name:e,typescript:t,version:n}){let r=o(e),i=c(T||=m([`
|
|
206
206
|
<script lang="ts">
|
|
207
207
|
import type { Content } from '@prismicio/client';
|
|
208
208
|
import type { SliceComponentProps } from '@prismicio/svelte';
|
|
@@ -213,7 +213,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
213
213
|
<\/script>
|
|
214
214
|
|
|
215
215
|
`,`
|
|
216
|
-
`]),
|
|
216
|
+
`]),r,L),a=c(E||=m([`
|
|
217
217
|
<script>
|
|
218
218
|
/* @typedef {import("@prismicio/client").Content} Content */
|
|
219
219
|
/* @typedef {import("@prismicio/svelte").SliceComponentProps} SliceComponentProps */
|
|
@@ -223,7 +223,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
223
223
|
<\/script>
|
|
224
224
|
|
|
225
225
|
`,`
|
|
226
|
-
`]),
|
|
226
|
+
`]),r,L),s=c(D||=m([`
|
|
227
227
|
<script lang="ts">
|
|
228
228
|
import type { Content } from '@prismicio/client';
|
|
229
229
|
|
|
@@ -231,18 +231,18 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
231
231
|
<\/script>
|
|
232
232
|
|
|
233
233
|
`,`
|
|
234
|
-
`]),
|
|
234
|
+
`]),r,L),l=c(O||=m([`
|
|
235
235
|
<script>
|
|
236
236
|
/** @type {import("@prismicio/client").Content.`,`Slice} */
|
|
237
237
|
export let slice;
|
|
238
238
|
<\/script>
|
|
239
239
|
|
|
240
240
|
`,`
|
|
241
|
-
`]),
|
|
241
|
+
`]),r,L);return t?n<=4?s:i:n<=4?l:a}var z,B;const V=[`<h1>WelcometoSvelteKit</h1><p>Visit<ahref="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a>toreadthedocumentation</p>`,`<h1>WelcometoSvelteKit</h1><p>Visit<ahref="https://kit.svelte.dev">kit.svelte.dev</a>toreadthedocumentation</p>`];var H=class extends s{id=`sveltekit`;environmentEnvVarName=`PUBLIC_PRISMIC_ENVIRONMENT`;localPreviewConfig={name:`Development`,websiteURL:`http://localhost:5173`,resolverPath:`/api/preview`};async setupProject(){await f({"@prismicio/client":`^${await p(`@prismicio/client`)}`,"@prismicio/svelte":`^${await p(`@prismicio/svelte`)}`});let e=await t(),a=await i(),o=await r(),s=await n(`svelte`);await l(new URL(`src/lib/prismicio.${a}`,e),k({typescript:o})),await l(new URL(`src/routes/slice-simulator/+page.svelte`,e),A({version:s})),await l(new URL(`src/params/preview.${a}`,e),c`
|
|
242
242
|
export function match(param) {
|
|
243
243
|
return param === 'preview';
|
|
244
244
|
}
|
|
245
|
-
`),await
|
|
245
|
+
`),await l(new URL(`src/routes/api/preview/+server.${a}`,e),j({typescript:o})),await l(new URL(`src/routes/[[preview=preview]]/README.md`,e),c`
|
|
246
246
|
This directory adds support for optional \`/preview\` routes. Do not remove this directory.
|
|
247
247
|
|
|
248
248
|
All routes within this directory will be served using the following URLs:
|
|
@@ -251,7 +251,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
251
251
|
- \`/preview/example-route\` (server-rendered)
|
|
252
252
|
|
|
253
253
|
See <https://prismic.io/docs/svelte-preview> for more information.
|
|
254
|
-
`);let u=await W();u||await d(new URL(`src/routes/+layout.server.${
|
|
254
|
+
`);let u=await W();u||await d(new URL(`src/routes/+layout.server.${a}`,e),N()),(!u||(await h(new URL(u,e),`utf8`)).includes(`repositoryName`))&&await l(new URL(`src/routes/+layout.svelte`,e),P({version:s})),await U()}async getSetupInstructions(){let e=await t(),n=await u(new URL(`src/routes/+page.svelte`,e))&&await u(new URL(`src/routes/[[preview=preview]]/+page.svelte`,e))&&c`
|
|
255
255
|
Action required: delete src/routes/+page.svelte.
|
|
256
256
|
|
|
257
257
|
It also serves / and hides your Prismic home page in
|
|
@@ -259,7 +259,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
259
259
|
from it first.
|
|
260
260
|
`;return[await this.getPreviewStep(),n].filter(Boolean).join(`
|
|
261
261
|
|
|
262
|
-
`)||void 0}async getPreviewStep(){if(await
|
|
262
|
+
`)||void 0}async getPreviewStep(){if(await e(`PrismicPreview`))return;let r=await n(`svelte`)<=4?c(z||=m([`
|
|
263
263
|
Add the lines marked + to src/routes/+layout.svelte:
|
|
264
264
|
|
|
265
265
|
<script>
|
|
@@ -270,7 +270,7 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
270
270
|
|
|
271
271
|
<slot />
|
|
272
272
|
+ <PrismicPreview repositoryName={data.repositoryName} />
|
|
273
|
-
`])):
|
|
273
|
+
`])):c(B||=m([`
|
|
274
274
|
Change the lines marked - and + in src/routes/+layout.svelte:
|
|
275
275
|
|
|
276
276
|
<script>
|
|
@@ -282,21 +282,21 @@ import{D as e,E as t,_ as n,a as r,c as i,l as a,t as o,tt as s,u as c,x as l}fr
|
|
|
282
282
|
|
|
283
283
|
{@render children()}
|
|
284
284
|
+ <PrismicPreview repositoryName={data.repositoryName} />
|
|
285
|
-
`])),
|
|
285
|
+
`])),a=await W()??`src/routes/+layout.server.${await i()}`,o=!(await h(new URL(a,await t()),`utf8`).catch(()=>``)).includes(`repositoryName`)&&`Return repositoryName from load in ${a}, creating the file if needed:\n\n${N().replace(/^/gm,` `)}`;return[c`
|
|
286
286
|
Action required: add <PrismicPreview> to your root layout.
|
|
287
287
|
|
|
288
288
|
Previews do not work until you do this, and the CLI cannot edit your
|
|
289
289
|
layout for you. Make the change now.
|
|
290
|
-
`,
|
|
290
|
+
`,r,o,"Run `prismic docs view sveltekit` for details."].filter(Boolean).join(`
|
|
291
291
|
|
|
292
|
-
`)}async createSliceIndexFile(
|
|
292
|
+
`)}async createSliceIndexFile(e){let t=(await this.getSlices()).filter(t=>t.library.href===e.href),n=t.map(t=>{let n=_(v(e),v(t.directory));return`import ${o(t.model.name)} from "./${n}/index.svelte";`}),r=t.map(e=>`${a(e.model.id)}: ${o(e.model.name)}`),s=c`
|
|
293
293
|
// Code generated by Prismic. DO NOT EDIT.
|
|
294
294
|
|
|
295
|
-
${
|
|
295
|
+
${n.join(`
|
|
296
296
|
`)}
|
|
297
297
|
|
|
298
298
|
export const components = {
|
|
299
|
-
${
|
|
299
|
+
${r.join(`,
|
|
300
300
|
`)}
|
|
301
301
|
};
|
|
302
|
-
`;await d(new URL(`index.${await
|
|
302
|
+
`;await d(new URL(`index.${await i()}`,e),s)}async getDefaultSliceLibrary(){return new URL(`src/lib/slices/`,await t())}async createSliceComponent(e,t){let i=R({name:e.name,typescript:await r(),version:await n(`svelte`)});await d(new URL(`index.svelte`,t),i)}async getPageFiles(e,n){let a=new URL(`src/routes/[[preview=preview]]/${n}/`,await t()),o=await r();return[{path:new URL(`+page.svelte`,a),contents:F({typescript:o})},{path:new URL(`+page.server.${await i()}`,a),contents:I({model:e,typescript:o})}]}};async function U(){let e=new URL(`src/routes/+page.svelte`,await t()),n=await h(e,`utf8`).catch(()=>void 0);V.includes(n?.replace(/\s/g,``)??``)&&await g(e)}async function W(){let e=await t();for(let t of[`src/routes/+layout.server.js`,`src/routes/+layout.server.ts`])if(await u(new URL(t,e)))return t}export{H as SvelteKitAdapter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./package-
|
|
1
|
+
import{n as e}from"./package-BmR9etBQ.mjs";import{A as t,D as n,M as r,P as i,d as a,h as o,s}from"./request-DozpYv-V.mjs";import{o as c}from"./packageJson-Bvm9nRNl.mjs";import{fileURLToPath as l}from"node:url";import{spawn as u}from"node:child_process";const d=n({latestKnownVersion:r(i()),lastUpdateCheckAt:r(t())});async function f(t){try{if(p())return;let n=await m(t.statePath),r=e;if(n?.latestKnownVersion&&h(n.latestKnownVersion,r)){let e=`Update available: ${r} → ${n.latestKnownVersion}. Run \`npx ${t.npmPackageName}@latest --version\` to update.`;process.on(`exit`,()=>{try{console.error(`\n${e}`)}catch{}})}(!n?.lastUpdateCheckAt||Date.now()-n.lastUpdateCheckAt>864e5)&&process.on(`exit`,()=>{_(t.npmPackageName,t.statePath)})}catch{}}function p(){return process.env.NO_UPDATE_NOTIFIER!==`0`&&!(process.env.NO_UPDATE_NOTIFIER!==`1`&&!process.env.CI&&process.stderr.isTTY)}async function m(e){return a(e,{schema:d}).catch(()=>void 0)}function h(e,t){if(e.includes(`-`)||t.includes(`-`))return!1;let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);if(n.length!==3||r.length!==3||n.some(e=>!Number.isFinite(e))||r.some(e=>!Number.isFinite(e)))return!1;for(let e=0;e<3;e++){if(n[e]>r[e])return!0;if(n[e]<r[e])return!1}return!1}async function g(e,t){let n=await c(e);await o(t,s({latestKnownVersion:n,lastUpdateCheckAt:Date.now()}))}function _(e,t){try{let n=l(new URL(`./subprocesses/updateVersionState.mjs`,import.meta.url));u(process.execPath,[n,e,t.href],{detached:!0,stdio:`ignore`}).unref()}catch{}}export{g as n,f as t};
|