prismic 1.23.0 → 1.24.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-CuXozoyY.mjs +189 -0
- package/dist/{auth-NkX7Docj.mjs → auth-CsokWsVo.mjs} +2 -2
- package/dist/index.mjs +94 -94
- package/dist/{nextjs-TJI3bKFA.mjs → nextjs-D65xFGap.mjs} +51 -51
- package/dist/{nuxt-DfWyc1bJ.mjs → nuxt-YzpEi3A5.mjs} +11 -11
- package/dist/package-DCbOjRWH.mjs +1 -0
- package/dist/packageJson-B1_pkZr8.mjs +2 -0
- package/dist/request-Dx4vx1nN.mjs +30 -0
- package/dist/{segment-yGieXuDf.mjs → segment-DkMwCXor.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-7mpC1weE.mjs +273 -0
- package/dist/sveltekit-CpIdkani.mjs +1 -0
- package/dist/sveltekit2-C9cZPBvU.mjs +50 -0
- package/dist/{update-notifier-ChP_LYxw.mjs → update-notifier-d8fLG6jz.mjs} +1 -1
- package/package.json +7 -7
- package/dist/adapters-Bt9QKcJb.mjs +0 -191
- package/dist/package-Dyw1b366.mjs +0 -1
- package/dist/packageJson-Bxht6H4y.mjs +0 -2
- package/dist/request-DJTl_0US.mjs +0 -30
- package/dist/sveltekit-CC1sBn9O.mjs +0 -302
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import{_ as e,d as t,dt as n,ot as r,s as i,st as a,t as o,u as s,x as c}from"./adapters-CuXozoyY.mjs";import{_ as l,l as u}from"./request-Dx4vx1nN.mjs";import{n as d,s as f}from"./packageJson-B1_pkZr8.mjs";import{t as p}from"./taggedTemplateLiteral-DygvE_Ih.mjs";import{readFile as m,rm as h}from"node:fs/promises";import{relative as g}from"node:path";import{fileURLToPath as _}from"node:url";var v,y,b,x,S,C;function w({typescript:e}){return e?r`
|
|
2
|
+
import { createClient as baseCreateClient } from "@prismicio/client";
|
|
3
|
+
import { type CreateClientConfig, enableAutoPreviews } from '@prismicio/svelte/kit';
|
|
4
|
+
import { PUBLIC_PRISMIC_ENVIRONMENT } from '$app/env/public';
|
|
5
|
+
import prismicConfig from "../../prismic.config.json";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The project's Prismic repository name.
|
|
9
|
+
*/
|
|
10
|
+
export const repositoryName =
|
|
11
|
+
PUBLIC_PRISMIC_ENVIRONMENT || prismicConfig.repositoryName;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a Prismic client for the project's repository. The client is used to
|
|
15
|
+
* query content from the Prismic API.
|
|
16
|
+
*
|
|
17
|
+
* @param config - Configuration for the Prismic client.
|
|
18
|
+
*/
|
|
19
|
+
export const createClient = ({ cookies, ...config }: CreateClientConfig = {}) => {
|
|
20
|
+
const client = baseCreateClient(repositoryName, {
|
|
21
|
+
routes: prismicConfig.routes,
|
|
22
|
+
...config,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
enableAutoPreviews({ client, cookies });
|
|
26
|
+
|
|
27
|
+
return client;
|
|
28
|
+
};
|
|
29
|
+
`:r`
|
|
30
|
+
import { createClient as baseCreateClient } from "@prismicio/client";
|
|
31
|
+
import { enableAutoPreviews } from '@prismicio/svelte/kit';
|
|
32
|
+
import { PUBLIC_PRISMIC_ENVIRONMENT } from '$app/env/public';
|
|
33
|
+
import prismicConfig from "../../prismic.config.json";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The project's Prismic repository name.
|
|
37
|
+
*/
|
|
38
|
+
export const repositoryName =
|
|
39
|
+
PUBLIC_PRISMIC_ENVIRONMENT || prismicConfig.repositoryName;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates a Prismic client for the project's repository. The client is used to
|
|
43
|
+
* query content from the Prismic API.
|
|
44
|
+
*
|
|
45
|
+
* @param {import('@prismicio/svelte/kit').CreateClientConfig} config - Configuration for the Prismic client.
|
|
46
|
+
*/
|
|
47
|
+
export const createClient = ({ cookies, ...config } = {}) => {
|
|
48
|
+
const client = baseCreateClient(repositoryName, {
|
|
49
|
+
routes: prismicConfig.routes,
|
|
50
|
+
...config,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
enableAutoPreviews({ client, cookies });
|
|
54
|
+
|
|
55
|
+
return client;
|
|
56
|
+
};
|
|
57
|
+
`}function T(){return r`
|
|
58
|
+
PUBLIC_PRISMIC_ENVIRONMENT: {
|
|
59
|
+
public: true,
|
|
60
|
+
schema: (value) => value,
|
|
61
|
+
description: "The Prismic environment to use instead of the production repository.",
|
|
62
|
+
},
|
|
63
|
+
`}function E(){return r`
|
|
64
|
+
import { defineEnvVars } from "@sveltejs/kit/env";
|
|
65
|
+
|
|
66
|
+
export const variables = defineEnvVars({
|
|
67
|
+
${T()}
|
|
68
|
+
});
|
|
69
|
+
`}function D({extension:e}){return r(v||=p([`
|
|
70
|
+
<script>
|
|
71
|
+
import { SliceSimulator, SliceZone } from '@prismicio/svelte';
|
|
72
|
+
import { components } from '#lib/slices/index.`,`';
|
|
73
|
+
<\/script>
|
|
74
|
+
|
|
75
|
+
<SliceSimulator>
|
|
76
|
+
{#snippet children({ slices })}
|
|
77
|
+
<SliceZone {slices} {components} />
|
|
78
|
+
{/snippet}
|
|
79
|
+
</SliceSimulator>
|
|
80
|
+
`]),e)}function O({typescript:e}){return e?r`
|
|
81
|
+
import { redirectToPreviewURL } from '@prismicio/svelte/kit';
|
|
82
|
+
import { createClient } from '#lib/prismicio.ts';
|
|
83
|
+
import type { RequestHandler } from "./$types";
|
|
84
|
+
|
|
85
|
+
export const GET: RequestHandler = async ({ fetch, request, cookies }) => {
|
|
86
|
+
const client = createClient({ fetch });
|
|
87
|
+
|
|
88
|
+
return await redirectToPreviewURL({ client, request, cookies });
|
|
89
|
+
}
|
|
90
|
+
`:r`
|
|
91
|
+
import { redirectToPreviewURL } from '@prismicio/svelte/kit';
|
|
92
|
+
import { createClient } from '#lib/prismicio.js';
|
|
93
|
+
|
|
94
|
+
/* @type {import("./$types").RequestHandler} */
|
|
95
|
+
export async function GET({ fetch, request, cookies }) {
|
|
96
|
+
const client = createClient({ fetch });
|
|
97
|
+
|
|
98
|
+
return await redirectToPreviewURL({ client, request, cookies });
|
|
99
|
+
}
|
|
100
|
+
`}function k({extension:e}){return r`
|
|
101
|
+
import { repositoryName } from "#lib/prismicio.${e}";
|
|
102
|
+
|
|
103
|
+
export const prerender = "auto";
|
|
104
|
+
|
|
105
|
+
export function load() {
|
|
106
|
+
return { repositoryName };
|
|
107
|
+
}
|
|
108
|
+
`}function A(){return r(y||=p([`
|
|
109
|
+
<script>
|
|
110
|
+
import { isFilled, asImageSrc } from '@prismicio/client';
|
|
111
|
+
import { PrismicPreview } from '@prismicio/svelte/kit';
|
|
112
|
+
import { page } from '$app/state';
|
|
113
|
+
|
|
114
|
+
const { data, children } = $props();
|
|
115
|
+
<\/script>
|
|
116
|
+
|
|
117
|
+
<svelte:head>
|
|
118
|
+
<title>{page.data.page?.data.meta_title}</title>
|
|
119
|
+
<meta property="og:title" content={page.data.page?.data.meta_title} />
|
|
120
|
+
{#if isFilled.keyText(page.data.page?.data.meta_description)}
|
|
121
|
+
<meta name="description" content={page.data.page.data.meta_description} />
|
|
122
|
+
<meta property="og:description" content={page.data.page.data.meta_description} />
|
|
123
|
+
{/if}
|
|
124
|
+
{#if isFilled.image(page.data.page?.data.meta_image)}
|
|
125
|
+
<meta property="og:image" content={asImageSrc(page.data.page.data.meta_image)} />
|
|
126
|
+
{/if}
|
|
127
|
+
</svelte:head>
|
|
128
|
+
{@render children()}
|
|
129
|
+
<PrismicPreview repositoryName={data.repositoryName} />
|
|
130
|
+
`]))}function j({typescript:e}){return r(e?b||=p([`
|
|
131
|
+
<script lang="ts">
|
|
132
|
+
import { SliceZone } from "@prismicio/svelte";
|
|
133
|
+
import { components } from "#lib/slices/index.ts";
|
|
134
|
+
import type { PageProps } from "./$types";
|
|
135
|
+
|
|
136
|
+
const { data }: PageProps = $props();
|
|
137
|
+
<\/script>
|
|
138
|
+
|
|
139
|
+
<SliceZone slices={data.page.data.slices} {components} />
|
|
140
|
+
`]):x||=p([`
|
|
141
|
+
<script>
|
|
142
|
+
import { SliceZone } from "@prismicio/svelte";
|
|
143
|
+
import { components } from "#lib/slices/index.js";
|
|
144
|
+
|
|
145
|
+
const { data } = $props();
|
|
146
|
+
<\/script>
|
|
147
|
+
|
|
148
|
+
<SliceZone slices={data.page.data.slices} {components} />
|
|
149
|
+
`]))}function M({model:e,typescript:t}){return e.repeatable?t?r`
|
|
150
|
+
import type { PageServerLoad } from "./$types";
|
|
151
|
+
import { createClient } from "#lib/prismicio.ts";
|
|
152
|
+
|
|
153
|
+
export const load: PageServerLoad = async ({ params, fetch, cookies }) => {
|
|
154
|
+
const client = createClient({ fetch, cookies });
|
|
155
|
+
const page = await client.getByUID("${e.id}", params.uid);
|
|
156
|
+
|
|
157
|
+
return { page };
|
|
158
|
+
};
|
|
159
|
+
`:r`
|
|
160
|
+
import { createClient } from "#lib/prismicio.js";
|
|
161
|
+
|
|
162
|
+
/** @type {import("./$types").PageServerLoad} */
|
|
163
|
+
export async function load({ params, fetch, cookies }) {
|
|
164
|
+
const client = createClient({ fetch, cookies });
|
|
165
|
+
const page = await client.getByUID("${e.id}", params.uid);
|
|
166
|
+
|
|
167
|
+
return { page };
|
|
168
|
+
}
|
|
169
|
+
`:t?r`
|
|
170
|
+
import type { PageServerLoad } from "./$types";
|
|
171
|
+
import { createClient } from "#lib/prismicio.ts";
|
|
172
|
+
|
|
173
|
+
export const load: PageServerLoad = async ({ fetch, cookies }) => {
|
|
174
|
+
const client = createClient({ fetch, cookies });
|
|
175
|
+
const page = await client.getSingle("${e.id}");
|
|
176
|
+
|
|
177
|
+
return { page };
|
|
178
|
+
};
|
|
179
|
+
`:r`
|
|
180
|
+
import { createClient } from "#lib/prismicio.js";
|
|
181
|
+
|
|
182
|
+
/* @type {import("./$types").PageServerLoad} */
|
|
183
|
+
export async function load({ fetch, cookies }) {
|
|
184
|
+
const client = createClient({ fetch, cookies });
|
|
185
|
+
const page = await client.getSingle("${e.id}");
|
|
186
|
+
|
|
187
|
+
return { page };
|
|
188
|
+
}
|
|
189
|
+
`}const N=r`
|
|
190
|
+
<section data-slice-type={slice.slice_type} data-slice-variation={slice.variation}>
|
|
191
|
+
Placeholder component for {slice.slice_type} (variation: {slice.variation}) slices.
|
|
192
|
+
<br />
|
|
193
|
+
<strong>You can edit this slice directly in your code editor.</strong>
|
|
194
|
+
</section>
|
|
195
|
+
`;function P({name:e,typescript:t}){let i=n(e);return r(t?S||=p([`
|
|
196
|
+
<script lang="ts">
|
|
197
|
+
import type { Content } from '@prismicio/client';
|
|
198
|
+
import type { SliceComponentProps } from '@prismicio/svelte';
|
|
199
|
+
|
|
200
|
+
type Props = SliceComponentProps<Content.`,`Slice>;
|
|
201
|
+
|
|
202
|
+
const { slice }: Props = $props();
|
|
203
|
+
<\/script>
|
|
204
|
+
|
|
205
|
+
`,`
|
|
206
|
+
`]):C||=p([`
|
|
207
|
+
<script>
|
|
208
|
+
/* @typedef {import("@prismicio/client").Content} Content */
|
|
209
|
+
/* @typedef {import("@prismicio/svelte").SliceComponentProps} SliceComponentProps */
|
|
210
|
+
|
|
211
|
+
/* @type {SliceComponentProps<Content.`,`Slice>} */
|
|
212
|
+
const { slice } = $props();
|
|
213
|
+
<\/script>
|
|
214
|
+
|
|
215
|
+
`,`
|
|
216
|
+
`]),i,N)}var F;const I=[`<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 L=class extends o{id=`sveltekit`;environmentEnvVarName=`PUBLIC_PRISMIC_ENVIRONMENT`;localPreviewConfig={name:`Development`,websiteURL:`http://localhost:5173`,resolverPath:`/api/preview`};async setupProject(){await d({"@prismicio/client":`^${await f(`@prismicio/client`)}`,"@prismicio/svelte":`^${await f(`@prismicio/svelte`)}`});let n=await c(),i=await s(),a=await e();await t(new URL(`src/lib/prismicio.${i}`,n),w({typescript:a})),await z(`src/env`)||await l(new URL(`src/env.${i}`,n),E()),await t(new URL(`src/routes/slice-simulator/+page.svelte`,n),D({extension:i})),await t(new URL(`src/params/preview.${i}`,n),r`
|
|
217
|
+
export function match(param) {
|
|
218
|
+
return param === 'preview';
|
|
219
|
+
}
|
|
220
|
+
`),await t(new URL(`src/routes/api/preview/+server.${i}`,n),O({typescript:a})),await t(new URL(`src/routes/[[preview=preview]]/README.md`,n),r`
|
|
221
|
+
This directory adds support for optional \`/preview\` routes. Do not remove this directory.
|
|
222
|
+
|
|
223
|
+
All routes within this directory will be served using the following URLs:
|
|
224
|
+
|
|
225
|
+
- \`/example-route\` (prerendered)
|
|
226
|
+
- \`/preview/example-route\` (server-rendered)
|
|
227
|
+
|
|
228
|
+
See <https://prismic.io/docs/svelte-preview> for more information.
|
|
229
|
+
`);let o=await z(`src/routes/+layout.server`);o||await l(new URL(`src/routes/+layout.server.${i}`,n),k({extension:i})),(!o||(await m(new URL(o,n),`utf8`)).includes(`repositoryName`))&&await t(new URL(`src/routes/+layout.svelte`,n),A()),await R()}async getSetupInstructions(){let e=await c(),t=await u(new URL(`src/routes/+page.svelte`,e))&&await u(new URL(`src/routes/[[preview=preview]]/+page.svelte`,e))&&r`
|
|
230
|
+
Action required: delete src/routes/+page.svelte.
|
|
231
|
+
|
|
232
|
+
It also serves / and hides your Prismic home page in
|
|
233
|
+
src/routes/[[preview=preview]]/+page.svelte. Move anything you need
|
|
234
|
+
from it first.
|
|
235
|
+
`;return[await this.getEnvStep(),await this.getPreviewStep(),t].filter(Boolean).join(`
|
|
236
|
+
|
|
237
|
+
`)||void 0}async getEnvStep(){let e=await z(`src/env`);if(e&&!(await m(new URL(e,await c()),`utf8`)).includes(`PUBLIC_PRISMIC_ENVIRONMENT`))return r`
|
|
238
|
+
Action required: add PUBLIC_PRISMIC_ENVIRONMENT to ${e}.
|
|
239
|
+
|
|
240
|
+
Your project does not build until you do this. Add these lines to
|
|
241
|
+
defineEnvVars({ ... }):
|
|
242
|
+
|
|
243
|
+
${T().replace(/^/gm,` `)}
|
|
244
|
+
`}async getPreviewStep(){if(await i(`PrismicPreview`))return;let e=await z(`src/routes/+layout.server`)??`src/routes/+layout.server.${await s()}`,t=!(await m(new URL(e,await c()),`utf8`).catch(()=>``)).includes(`repositoryName`)&&`Return repositoryName from load in ${e}, creating the file if needed:\n\n${k({extension:e.split(`.`).pop()}).replace(/^/gm,` `)}`;return[r(F||=p([`
|
|
245
|
+
Action required: add <PrismicPreview> to your root layout.
|
|
246
|
+
|
|
247
|
+
Previews do not work until you do this, and the CLI cannot edit your
|
|
248
|
+
layout for you. Make the change now.
|
|
249
|
+
|
|
250
|
+
Change the lines marked - and + in src/routes/+layout.svelte:
|
|
251
|
+
|
|
252
|
+
<script>
|
|
253
|
+
+ import { PrismicPreview } from "@prismicio/svelte/kit";
|
|
254
|
+
|
|
255
|
+
- let { children } = $props();
|
|
256
|
+
+ let { data, children } = $props();
|
|
257
|
+
<\/script>
|
|
258
|
+
|
|
259
|
+
{@render children()}
|
|
260
|
+
+ <PrismicPreview repositoryName={data.repositoryName} />
|
|
261
|
+
`])),t,"Run `prismic docs view sveltekit` for details."].filter(Boolean).join(`
|
|
262
|
+
|
|
263
|
+
`)}async createSliceIndexFile(e){let t=(await this.getSlices()).filter(t=>t.library.href===e.href),i=t.map(t=>{let r=g(_(e),_(t.directory));return`import ${n(t.model.name)} from "./${r}/index.svelte";`}),o=t.map(e=>`${a(e.model.id)}: ${n(e.model.name)}`),c=r`
|
|
264
|
+
// Code generated by Prismic. DO NOT EDIT.
|
|
265
|
+
|
|
266
|
+
${i.join(`
|
|
267
|
+
`)}
|
|
268
|
+
|
|
269
|
+
export const components = {
|
|
270
|
+
${o.join(`,
|
|
271
|
+
`)}
|
|
272
|
+
};
|
|
273
|
+
`;await l(new URL(`index.${await s()}`,e),c)}async getDefaultSliceLibrary(){return new URL(`src/lib/slices/`,await c())}async createSliceComponent(t,n){let r=P({name:t.name,typescript:await e()});await l(new URL(`index.svelte`,n),r)}async getPageFiles(t,n){let r=new URL(`src/routes/[[preview=preview]]/${n}/`,await c()),i=await e();return[{path:new URL(`+page.svelte`,r),contents:j({typescript:i})},{path:new URL(`+page.server.${await s()}`,r),contents:M({model:t,typescript:i})}]}};async function R(){let e=new URL(`src/routes/+page.svelte`,await c()),t=await m(e,`utf8`).catch(()=>void 0);I.includes(t?.replace(/\s/g,``)??``)&&await h(e)}async function z(e){let t=await c();for(let n of[`js`,`ts`])if(await u(new URL(`${e}.${n}`,t)))return`${e}.${n}`}export{M as a,w as c,k as i,A as l,R as n,j as o,z as r,O as s,L as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as SvelteKitAdapter}from"./sveltekit-7mpC1weE.mjs";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import{_ as e,d as t,ot as n,s as r,u as i,x as a}from"./adapters-CuXozoyY.mjs";import{_ as o,l as s}from"./request-Dx4vx1nN.mjs";import{n as c,s as l}from"./packageJson-B1_pkZr8.mjs";import{t as u}from"./taggedTemplateLiteral-DygvE_Ih.mjs";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y}from"./sveltekit-7mpC1weE.mjs";import{readFile as b}from"node:fs/promises";var x;function S(e){return e.replace(/#lib\/(\w+)(?:\/index)?\.\w+/g,`$lib/$1`)}function C({typescript:e}){return f({typescript:e}).replace(`{ PUBLIC_PRISMIC_ENVIRONMENT } from '$app/env/public'`,`{ env } from '$env/dynamic/public'`).replace(`PUBLIC_PRISMIC_ENVIRONMENT ||`,`env.PUBLIC_PRISMIC_ENVIRONMENT ||`)}function w(){return n(x||=u([`
|
|
2
|
+
<script>
|
|
3
|
+
import { SliceSimulator, SliceZone } from '@prismicio/svelte';
|
|
4
|
+
import { components } from '$lib/slices';
|
|
5
|
+
<\/script>
|
|
6
|
+
|
|
7
|
+
<SliceSimulator let:slices>
|
|
8
|
+
<SliceZone {slices} {components} />
|
|
9
|
+
</SliceSimulator>
|
|
10
|
+
`]))}function T({typescript:e}){return S(v({typescript:e}))}function E(){return S(p({extension:`js`}))}function D({typescript:e}){return S(g({typescript:e}))}function O({model:e,typescript:t}){return S(d({model:e,typescript:t}))}var k,A=class extends y{async setupProject(){await c({"@prismicio/client":`^${await l(`@prismicio/client`)}`,"@prismicio/svelte":`^2`});let r=await a(),s=await i(),u=await e();await t(new URL(`src/lib/prismicio.${s}`,r),C({typescript:u})),await t(new URL(`src/routes/slice-simulator/+page.svelte`,r),w()),await t(new URL(`src/params/preview.${s}`,r),n`
|
|
11
|
+
export function match(param) {
|
|
12
|
+
return param === 'preview';
|
|
13
|
+
}
|
|
14
|
+
`),await t(new URL(`src/routes/api/preview/+server.${s}`,r),T({typescript:u})),await t(new URL(`src/routes/[[preview=preview]]/README.md`,r),n`
|
|
15
|
+
This directory adds support for optional \`/preview\` routes. Do not remove this directory.
|
|
16
|
+
|
|
17
|
+
All routes within this directory will be served using the following URLs:
|
|
18
|
+
|
|
19
|
+
- \`/example-route\` (prerendered)
|
|
20
|
+
- \`/preview/example-route\` (server-rendered)
|
|
21
|
+
|
|
22
|
+
See <https://prismic.io/docs/svelte-preview> for more information.
|
|
23
|
+
`);let d=await _(`src/routes/+layout.server`);d||await o(new URL(`src/routes/+layout.server.${s}`,r),E()),(!d||(await b(new URL(d,r),`utf8`)).includes(`repositoryName`))&&await t(new URL(`src/routes/+layout.svelte`,r),m()),await h()}async getSetupInstructions(){let e=await a(),t=await _(`src/routes/+layout.server`)??`src/routes/+layout.server.${await i()}`,o=await b(new URL(t,e),`utf8`).catch(()=>``);return[!await r(`PrismicPreview`)&&[n(k||=u([`
|
|
24
|
+
Action required: add <PrismicPreview> to your root layout.
|
|
25
|
+
|
|
26
|
+
Previews do not work until you do this, and the CLI cannot edit your
|
|
27
|
+
layout for you. Make the change now.
|
|
28
|
+
|
|
29
|
+
Change the lines marked - and + in src/routes/+layout.svelte:
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
+ import { PrismicPreview } from "@prismicio/svelte/kit";
|
|
33
|
+
|
|
34
|
+
- let { children } = $props();
|
|
35
|
+
+ let { data, children } = $props();
|
|
36
|
+
<\/script>
|
|
37
|
+
|
|
38
|
+
{@render children()}
|
|
39
|
+
+ <PrismicPreview repositoryName={data.repositoryName} />
|
|
40
|
+
`])),!o.includes(`repositoryName`)&&`Return repositoryName from load in ${t}, creating the file if needed:\n\n${E().replace(/^/gm,` `)}`,"Run `prismic docs view sveltekit` for details."].filter(Boolean).join(`
|
|
41
|
+
|
|
42
|
+
`),await s(new URL(`src/routes/+page.svelte`,e))&&await s(new URL(`src/routes/[[preview=preview]]/+page.svelte`,e))&&n`
|
|
43
|
+
Action required: delete src/routes/+page.svelte.
|
|
44
|
+
|
|
45
|
+
It also serves / and hides your Prismic home page in
|
|
46
|
+
src/routes/[[preview=preview]]/+page.svelte. Move anything you need
|
|
47
|
+
from it first.
|
|
48
|
+
`].filter(Boolean).join(`
|
|
49
|
+
|
|
50
|
+
`)||void 0}async getPageFiles(t,n){let r=new URL(`src/routes/[[preview=preview]]/${n}/`,await a()),o=await e();return[{path:new URL(`+page.svelte`,r),contents:D({typescript:o})},{path:new URL(`+page.server.${await i()}`,r),contents:O({model:t,typescript:o})}]}};export{A as SvelteKit2Adapter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./package-
|
|
1
|
+
import{n as e}from"./package-DCbOjRWH.mjs";import{I as t,M as n,P as r,_ as i,c as a,f as o,k as s}from"./request-Dx4vx1nN.mjs";import{s as c}from"./packageJson-B1_pkZr8.mjs";import{fileURLToPath as l}from"node:url";import{spawn as u}from"node:child_process";const d=s({latestKnownVersion:r(t()),lastUpdateCheckAt:r(n())});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 o(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 i(t,a({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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prismic",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Prismic's official command line tool",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prismic",
|
|
@@ -36,23 +36,23 @@
|
|
|
36
36
|
"test": "npm run lint && npm run types && npm run unit"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@anthropic-ai/claude-agent-sdk": "^0.3.
|
|
40
|
-
"@openai/codex-sdk": "^0.
|
|
39
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.296",
|
|
40
|
+
"@openai/codex-sdk": "^0.162.1",
|
|
41
41
|
"@prismicio/types-internal": "4.7.0",
|
|
42
|
-
"@types/node": "26.6.
|
|
42
|
+
"@types/node": "26.6.5",
|
|
43
43
|
"change-case": "5.4.4",
|
|
44
44
|
"dedent": "^1.7.2",
|
|
45
45
|
"detect-indent": "^7.0.2",
|
|
46
46
|
"github-slugger": "2.0.0",
|
|
47
47
|
"oxfmt": "^0.72.0",
|
|
48
48
|
"oxlint": "1.87.0",
|
|
49
|
-
"prismic-ts-codegen": "^0.1.
|
|
49
|
+
"prismic-ts-codegen": "^0.1.31",
|
|
50
50
|
"tinyexec": "^1.3.1",
|
|
51
51
|
"tinyglobby": "^0.2.17",
|
|
52
|
-
"tsdown": "0.23.
|
|
52
|
+
"tsdown": "0.23.1",
|
|
53
53
|
"typescript": "7.0.2",
|
|
54
54
|
"vitest": "5.0.3",
|
|
55
|
-
"zod": "^4.6.
|
|
55
|
+
"zod": "^4.6.6"
|
|
56
56
|
},
|
|
57
57
|
"devEngines": {
|
|
58
58
|
"runtime": {
|