prismic 0.0.0-pr.28.59bf330
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/LICENSE +202 -0
- package/README.md +69 -0
- package/dist/builders-hKD4IrLX-DsO7BUQw.mjs +97 -0
- package/dist/dist-B11B2hHn.mjs +1 -0
- package/dist/dist-DT8CtumB.mjs +1 -0
- package/dist/framework-CfjEoVk0.mjs +17 -0
- package/dist/index.mjs +2537 -0
- package/dist/nextjs-9z7YrSnS.mjs +312 -0
- package/dist/nuxt-KoJ61G2q.mjs +59 -0
- package/dist/sveltekit-DjXKCG78.mjs +226 -0
- package/package.json +58 -0
- package/src/codegen-types.ts +82 -0
- package/src/codegen.ts +45 -0
- package/src/custom-type-add-field-boolean.ts +185 -0
- package/src/custom-type-add-field-color.ts +168 -0
- package/src/custom-type-add-field-date.ts +171 -0
- package/src/custom-type-add-field-embed.ts +168 -0
- package/src/custom-type-add-field-geo-point.ts +165 -0
- package/src/custom-type-add-field-group.ts +142 -0
- package/src/custom-type-add-field-image.ts +168 -0
- package/src/custom-type-add-field-key-text.ts +168 -0
- package/src/custom-type-add-field-link.ts +191 -0
- package/src/custom-type-add-field-number.ts +200 -0
- package/src/custom-type-add-field-rich-text.ts +192 -0
- package/src/custom-type-add-field-select.ts +174 -0
- package/src/custom-type-add-field-timestamp.ts +171 -0
- package/src/custom-type-add-field-uid.ts +151 -0
- package/src/custom-type-add-field.ts +116 -0
- package/src/custom-type-connect-slice.ts +178 -0
- package/src/custom-type-create.ts +98 -0
- package/src/custom-type-disconnect-slice.ts +134 -0
- package/src/custom-type-list.ts +110 -0
- package/src/custom-type-remove-field.ts +135 -0
- package/src/custom-type-remove.ts +103 -0
- package/src/custom-type-set-name.ts +102 -0
- package/src/custom-type-view.ts +118 -0
- package/src/custom-type.ts +85 -0
- package/src/docs-fetch.ts +146 -0
- package/src/docs-list.ts +131 -0
- package/src/docs.ts +54 -0
- package/src/env.d.ts +12 -0
- package/src/framework/index.ts +399 -0
- package/src/framework/nextjs.templates.ts +426 -0
- package/src/framework/nextjs.ts +216 -0
- package/src/framework/nuxt.templates.ts +74 -0
- package/src/framework/nuxt.ts +250 -0
- package/src/framework/sveltekit.templates.ts +278 -0
- package/src/framework/sveltekit.ts +241 -0
- package/src/index.ts +155 -0
- package/src/init.ts +173 -0
- package/src/lib/auth.ts +200 -0
- package/src/lib/browser.ts +11 -0
- package/src/lib/config.ts +111 -0
- package/src/lib/custom-types-api.ts +385 -0
- package/src/lib/field-path.ts +81 -0
- package/src/lib/file.ts +49 -0
- package/src/lib/json.ts +3 -0
- package/src/lib/packageJson.ts +35 -0
- package/src/lib/profile.ts +39 -0
- package/src/lib/request.ts +116 -0
- package/src/lib/segment.ts +145 -0
- package/src/lib/sentry.ts +63 -0
- package/src/lib/string.ts +10 -0
- package/src/lib/url.ts +31 -0
- package/src/locale-add.ts +116 -0
- package/src/locale-list.ts +107 -0
- package/src/locale-remove.ts +88 -0
- package/src/locale-set-default.ts +131 -0
- package/src/locale.ts +60 -0
- package/src/login.ts +45 -0
- package/src/logout.ts +36 -0
- package/src/page-type-add-field-boolean.ts +179 -0
- package/src/page-type-add-field-color.ts +165 -0
- package/src/page-type-add-field-date.ts +168 -0
- package/src/page-type-add-field-embed.ts +165 -0
- package/src/page-type-add-field-geo-point.ts +162 -0
- package/src/page-type-add-field-group.ts +139 -0
- package/src/page-type-add-field-image.ts +165 -0
- package/src/page-type-add-field-key-text.ts +165 -0
- package/src/page-type-add-field-link.ts +188 -0
- package/src/page-type-add-field-number.ts +197 -0
- package/src/page-type-add-field-rich-text.ts +189 -0
- package/src/page-type-add-field-select.ts +171 -0
- package/src/page-type-add-field-timestamp.ts +168 -0
- package/src/page-type-add-field-uid.ts +148 -0
- package/src/page-type-add-field.ts +116 -0
- package/src/page-type-connect-slice.ts +178 -0
- package/src/page-type-create.ts +128 -0
- package/src/page-type-disconnect-slice.ts +134 -0
- package/src/page-type-list.ts +109 -0
- package/src/page-type-remove-field.ts +135 -0
- package/src/page-type-remove.ts +103 -0
- package/src/page-type-set-name.ts +102 -0
- package/src/page-type-set-repeatable.ts +111 -0
- package/src/page-type-view.ts +118 -0
- package/src/page-type.ts +90 -0
- package/src/preview-add.ts +126 -0
- package/src/preview-get-simulator.ts +104 -0
- package/src/preview-list.ts +106 -0
- package/src/preview-remove-simulator.ts +80 -0
- package/src/preview-remove.ts +109 -0
- package/src/preview-set-name.ts +137 -0
- package/src/preview-set-simulator.ts +116 -0
- package/src/preview.ts +75 -0
- package/src/pull.ts +236 -0
- package/src/push.ts +409 -0
- package/src/repo-create.ts +175 -0
- package/src/repo-get-access.ts +86 -0
- package/src/repo-list.ts +100 -0
- package/src/repo-set-access.ts +100 -0
- package/src/repo-set-name.ts +102 -0
- package/src/repo-view.ts +113 -0
- package/src/repo.ts +70 -0
- package/src/slice-add-field-boolean.ts +219 -0
- package/src/slice-add-field-color.ts +205 -0
- package/src/slice-add-field-date.ts +205 -0
- package/src/slice-add-field-embed.ts +205 -0
- package/src/slice-add-field-geo-point.ts +202 -0
- package/src/slice-add-field-group.ts +170 -0
- package/src/slice-add-field-image.ts +202 -0
- package/src/slice-add-field-key-text.ts +205 -0
- package/src/slice-add-field-link.ts +224 -0
- package/src/slice-add-field-number.ts +205 -0
- package/src/slice-add-field-rich-text.ts +229 -0
- package/src/slice-add-field-select.ts +211 -0
- package/src/slice-add-field-timestamp.ts +205 -0
- package/src/slice-add-field.ts +111 -0
- package/src/slice-add-variation.ts +142 -0
- package/src/slice-create.ts +164 -0
- package/src/slice-list-variations.ts +71 -0
- package/src/slice-list.ts +60 -0
- package/src/slice-remove-field.ts +125 -0
- package/src/slice-remove-variation.ts +113 -0
- package/src/slice-remove.ts +92 -0
- package/src/slice-rename.ts +104 -0
- package/src/slice-set-screenshot.ts +239 -0
- package/src/slice-view.ts +83 -0
- package/src/slice.ts +95 -0
- package/src/status.ts +834 -0
- package/src/sync.ts +259 -0
- package/src/token-create.ts +203 -0
- package/src/token-delete.ts +182 -0
- package/src/token-list.ts +223 -0
- package/src/token-set-name.ts +193 -0
- package/src/token.ts +60 -0
- package/src/webhook-add-header.ts +118 -0
- package/src/webhook-create.ts +152 -0
- package/src/webhook-disable.ts +109 -0
- package/src/webhook-enable.ts +132 -0
- package/src/webhook-list.ts +93 -0
- package/src/webhook-remove-header.ts +117 -0
- package/src/webhook-remove.ts +106 -0
- package/src/webhook-set-triggers.ts +148 -0
- package/src/webhook-status.ts +90 -0
- package/src/webhook-test.ts +106 -0
- package/src/webhook-view.ts +147 -0
- package/src/webhook.ts +95 -0
- package/src/whoami.ts +62 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import{_ as e,c as t,t as n,u as r}from"./framework-CfjEoVk0.mjs";import{t as i}from"./dist-B11B2hHn.mjs";import{createRequire as a}from"node:module";import{mkdir as o,writeFile as s}from"node:fs/promises";const c=t`
|
|
2
|
+
return (
|
|
3
|
+
<section
|
|
4
|
+
data-slice-type={slice.slice_type}
|
|
5
|
+
data-slice-variation={slice.variation}
|
|
6
|
+
>
|
|
7
|
+
Placeholder component for {slice.slice_type} (variation: {slice.variation}) slices.
|
|
8
|
+
<br />
|
|
9
|
+
<strong>You can edit this slice directly in your code editor.</strong>
|
|
10
|
+
</section>
|
|
11
|
+
)
|
|
12
|
+
`;function l(e){let{name:n,typescript:r}=e,a=i(n),o=t`
|
|
13
|
+
import { FC } from "react";
|
|
14
|
+
import { Content } from "@prismicio/client";
|
|
15
|
+
import { SliceComponentProps } from "@prismicio/react";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Props for \`${a}\`.
|
|
19
|
+
*/
|
|
20
|
+
export type ${a}Props = SliceComponentProps<Content.${a}Slice>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Component for "${n}" Slices.
|
|
24
|
+
*/
|
|
25
|
+
const ${a}: FC<${a}Props> = ({ slice }) => {
|
|
26
|
+
${c}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default ${a}
|
|
30
|
+
`,s=t`
|
|
31
|
+
/**
|
|
32
|
+
* @typedef {import("@prismicio/client").Content.${a}Slice} ${a}Slice
|
|
33
|
+
* @typedef {import("@prismicio/react").SliceComponentProps<${a}Slice>} ${a}Props
|
|
34
|
+
* @type {import("react").FC<${a}Props>}
|
|
35
|
+
*/
|
|
36
|
+
const ${a} = ({ slice }) => {
|
|
37
|
+
${c}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default ${a};
|
|
41
|
+
`;return r?o:s}function u(e){let{typescript:n,appRouter:r,hasSrcDirectory:i}=e,a=`${i?`..`:`.`}/prismic.config.json`,o,s;return r?n?(o=t`
|
|
42
|
+
import {
|
|
43
|
+
createClient as baseCreateClient,
|
|
44
|
+
type ClientConfig,
|
|
45
|
+
type Route,
|
|
46
|
+
} from "@prismicio/client";
|
|
47
|
+
import { enableAutoPreviews } from "@prismicio/next";
|
|
48
|
+
import prismicConfig from "${a}";
|
|
49
|
+
`,s=t`
|
|
50
|
+
/**
|
|
51
|
+
* Creates a Prismic client for the project's repository. The client is used to
|
|
52
|
+
* query content from the Prismic API.
|
|
53
|
+
*
|
|
54
|
+
* @param config - Configuration for the Prismic client.
|
|
55
|
+
*/
|
|
56
|
+
export const createClient = (config: ClientConfig = {}) => {
|
|
57
|
+
const client = baseCreateClient(repositoryName, {
|
|
58
|
+
routes,
|
|
59
|
+
fetchOptions:
|
|
60
|
+
process.env.NODE_ENV === 'production'
|
|
61
|
+
? { next: { tags: ['prismic'] }, cache: 'force-cache' }
|
|
62
|
+
: { next: { revalidate: 5 } },
|
|
63
|
+
...config,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
enableAutoPreviews({ client });
|
|
67
|
+
|
|
68
|
+
return client;
|
|
69
|
+
};
|
|
70
|
+
`):(o=t`
|
|
71
|
+
import { createClient as baseCreateClient } from "@prismicio/client";
|
|
72
|
+
import { enableAutoPreviews } from "@prismicio/next";
|
|
73
|
+
import prismicConfig from "${a}";
|
|
74
|
+
`,s=t`
|
|
75
|
+
/**
|
|
76
|
+
* Creates a Prismic client for the project's repository. The client is used to
|
|
77
|
+
* query content from the Prismic API.
|
|
78
|
+
*
|
|
79
|
+
* @param {import("@prismicio/client").ClientConfig} config - Configuration for the Prismic client.
|
|
80
|
+
*/
|
|
81
|
+
export const createClient = (config = {}) => {
|
|
82
|
+
const client = baseCreateClient(repositoryName, {
|
|
83
|
+
routes,
|
|
84
|
+
fetchOptions:
|
|
85
|
+
process.env.NODE_ENV === 'production'
|
|
86
|
+
? { next: { tags: ['prismic'] }, cache: 'force-cache' }
|
|
87
|
+
: { next: { revalidate: 5 } },
|
|
88
|
+
...config,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
enableAutoPreviews({ client });
|
|
92
|
+
|
|
93
|
+
return client;
|
|
94
|
+
};
|
|
95
|
+
`):n?(o=t`
|
|
96
|
+
import { createClient as baseCreateClient, type Routes } from "@prismicio/client";
|
|
97
|
+
import { enableAutoPreviews, type CreateClientConfig } from "@prismicio/next/pages";
|
|
98
|
+
import prismicConfig from "${a}";
|
|
99
|
+
`,s=t`
|
|
100
|
+
/**
|
|
101
|
+
* Creates a Prismic client for the project's repository. The client is used to
|
|
102
|
+
* query content from the Prismic API.
|
|
103
|
+
*
|
|
104
|
+
* @param config - Configuration for the Prismic client.
|
|
105
|
+
*/
|
|
106
|
+
export const createClient = ({ previewData, req, ...config }: CreateClientConfig = {}) => {
|
|
107
|
+
const client = baseCreateClient(repositoryName, {
|
|
108
|
+
routes,
|
|
109
|
+
...config,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
enableAutoPreviews({ client, previewData, req });
|
|
113
|
+
|
|
114
|
+
return client;
|
|
115
|
+
};
|
|
116
|
+
`):(o=t`
|
|
117
|
+
import { createClient as baseCreateClient } from "@prismicio/client";
|
|
118
|
+
import { enableAutoPreviews } from "@prismicio/next/pages";
|
|
119
|
+
import prismicConfig from "${a}";
|
|
120
|
+
`,s=t`
|
|
121
|
+
/**
|
|
122
|
+
* Creates a Prismic client for the project's repository. The client is used to
|
|
123
|
+
* query content from the Prismic API.
|
|
124
|
+
*
|
|
125
|
+
* @param {import("@prismicio/next/pages").CreateClientConfig} config - Configuration for the Prismic client.
|
|
126
|
+
*/
|
|
127
|
+
export const createClient = ({ previewData, req, ...config } = {}) => {
|
|
128
|
+
const client = baseCreateClient(repositoryName, {
|
|
129
|
+
routes,
|
|
130
|
+
...config,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
enableAutoPreviews({ client, previewData, req });
|
|
134
|
+
|
|
135
|
+
return client;
|
|
136
|
+
};
|
|
137
|
+
`),n?t`
|
|
138
|
+
${o}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The project's Prismic repository name.
|
|
142
|
+
*/
|
|
143
|
+
export const repositoryName = prismicConfig.repositoryName;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* A list of Route Resolver objects that define how a document's \`url\` field is resolved.
|
|
147
|
+
*
|
|
148
|
+
* {@link https://prismic.io/docs/route-resolver#route-resolver}
|
|
149
|
+
*
|
|
150
|
+
* Note: \`prismic sync\` may append new default routes for Page Types. Feel free
|
|
151
|
+
* to edit these to match your site's routing structure.
|
|
152
|
+
*/
|
|
153
|
+
// TODO: Update the routes array to match your project's route structure.
|
|
154
|
+
const routes: Route[] = [
|
|
155
|
+
// Examples:
|
|
156
|
+
// { type: "homepage", path: "/" },
|
|
157
|
+
// { type: "page", path: "/:uid" },
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
${s}
|
|
161
|
+
`:t`
|
|
162
|
+
${o}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The project's Prismic repository name.
|
|
166
|
+
*/
|
|
167
|
+
export const repositoryName = prismicConfig.repositoryName;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* A list of Route Resolver objects that define how a document's \`url\` field is resolved.
|
|
171
|
+
*
|
|
172
|
+
* {@link https://prismic.io/docs/route-resolver#route-resolver}
|
|
173
|
+
*
|
|
174
|
+
* Note: \`prismic sync\` may append new default routes for Page Types. Feel free
|
|
175
|
+
* to edit these to match your site's routing structure.
|
|
176
|
+
*
|
|
177
|
+
* @type {import("@prismicio/client").Route[]}
|
|
178
|
+
*/
|
|
179
|
+
// TODO: Update the routes array to match your project's route structure.
|
|
180
|
+
const routes = [
|
|
181
|
+
// Examples:
|
|
182
|
+
// { type: "homepage", path: "/" },
|
|
183
|
+
// { type: "page", path: "/:uid" },
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
${s}
|
|
187
|
+
`}function d(e){let{typescript:n,appRouter:r}=e;return r?n?t`
|
|
188
|
+
import {
|
|
189
|
+
SliceSimulator,
|
|
190
|
+
SliceSimulatorParams,
|
|
191
|
+
getSlices,
|
|
192
|
+
} from "@prismicio/next";
|
|
193
|
+
import { SliceZone } from "@prismicio/react";
|
|
194
|
+
|
|
195
|
+
import { components } from "../../slices";
|
|
196
|
+
|
|
197
|
+
export default async function SliceSimulatorPage({
|
|
198
|
+
searchParams,
|
|
199
|
+
}: SliceSimulatorParams) {
|
|
200
|
+
const { state } = await searchParams
|
|
201
|
+
const slices = getSlices(state);
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<SliceSimulator>
|
|
205
|
+
<SliceZone slices={slices} components={components} />
|
|
206
|
+
</SliceSimulator>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
`:t`
|
|
210
|
+
import { SliceSimulator, getSlices } from "@prismicio/next";
|
|
211
|
+
import { SliceZone } from "@prismicio/react";
|
|
212
|
+
|
|
213
|
+
import { components } from "../../slices";
|
|
214
|
+
|
|
215
|
+
export default async function SliceSimulatorPage({ searchParams }) {
|
|
216
|
+
const { state } = await searchParams
|
|
217
|
+
const slices = getSlices(state);
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<SliceSimulator>
|
|
221
|
+
<SliceZone slices={slices} components={components} />
|
|
222
|
+
</SliceSimulator>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
`:t`
|
|
226
|
+
import { SliceSimulator } from "@prismicio/next/pages";
|
|
227
|
+
import { SliceZone } from "@prismicio/react";
|
|
228
|
+
|
|
229
|
+
import { components } from "../slices";
|
|
230
|
+
|
|
231
|
+
export default function SliceSimulatorPage() {
|
|
232
|
+
return (
|
|
233
|
+
<SliceSimulator
|
|
234
|
+
sliceZone={(props) => <SliceZone {...props} components={components} />}
|
|
235
|
+
/>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
`}function f(e){let{typescript:n,appRouter:r}=e;return r?n?t`
|
|
239
|
+
import { NextRequest } from "next/server";
|
|
240
|
+
import { redirectToPreviewURL } from "@prismicio/next";
|
|
241
|
+
|
|
242
|
+
import { createClient } from "../../../prismicio";
|
|
243
|
+
|
|
244
|
+
export async function GET(request: NextRequest) {
|
|
245
|
+
const client = createClient();
|
|
246
|
+
|
|
247
|
+
return await redirectToPreviewURL({ client, request });
|
|
248
|
+
}
|
|
249
|
+
`:t`
|
|
250
|
+
import { redirectToPreviewURL } from "@prismicio/next";
|
|
251
|
+
|
|
252
|
+
import { createClient } from "../../../prismicio";
|
|
253
|
+
|
|
254
|
+
export async function GET(request) {
|
|
255
|
+
const client = createClient();
|
|
256
|
+
|
|
257
|
+
return await redirectToPreviewURL({ client, request });
|
|
258
|
+
}
|
|
259
|
+
`:n?t`
|
|
260
|
+
import { NextApiRequest, NextApiResponse } from "next";
|
|
261
|
+
import { setPreviewData, redirectToPreviewURL } from "@prismicio/next/pages";
|
|
262
|
+
|
|
263
|
+
import { createClient } from "../../prismicio";
|
|
264
|
+
|
|
265
|
+
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
266
|
+
const client = createClient({ req });
|
|
267
|
+
|
|
268
|
+
setPreviewData({ req, res });
|
|
269
|
+
|
|
270
|
+
return await redirectToPreviewURL({ req, res, client });
|
|
271
|
+
};
|
|
272
|
+
`:t`
|
|
273
|
+
import { setPreviewData, redirectToPreviewURL } from "@prismicio/next/pages";
|
|
274
|
+
|
|
275
|
+
import { createClient } from "../../prismicio";
|
|
276
|
+
|
|
277
|
+
export default async function handler(req, res) {
|
|
278
|
+
const client = createClient({ req });
|
|
279
|
+
|
|
280
|
+
setPreviewData({ req, res });
|
|
281
|
+
|
|
282
|
+
return await redirectToPreviewURL({ req, res, client });
|
|
283
|
+
};
|
|
284
|
+
`}function p(e){let{typescript:n,appRouter:r}=e;return r?t`
|
|
285
|
+
import { exitPreview } from "@prismicio/next";
|
|
286
|
+
|
|
287
|
+
export function GET() {
|
|
288
|
+
return exitPreview();
|
|
289
|
+
}
|
|
290
|
+
`:n?t`
|
|
291
|
+
import { NextApiRequest, NextApiResponse } from "next";
|
|
292
|
+
import { exitPreview } from "@prismicio/next/pages";
|
|
293
|
+
|
|
294
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
295
|
+
return exitPreview({ req, res });
|
|
296
|
+
}
|
|
297
|
+
`:t`
|
|
298
|
+
import { exitPreview } from "@prismicio/next/pages";
|
|
299
|
+
|
|
300
|
+
export default function handler(req, res) {
|
|
301
|
+
return exitPreview({ req, res });
|
|
302
|
+
}
|
|
303
|
+
`}function m(e){let{supportsCacheLife:n}=e;return t`
|
|
304
|
+
import { NextResponse } from "next/server";
|
|
305
|
+
import { revalidateTag } from "next/cache";
|
|
306
|
+
|
|
307
|
+
export async function POST() {
|
|
308
|
+
revalidateTag("prismic"${n?`, "max"`:``});
|
|
309
|
+
|
|
310
|
+
return NextResponse.json({ revalidated: true, now: Date.now() });
|
|
311
|
+
}
|
|
312
|
+
`}var h=class extends n{id=`next`;async getDependencies(){return{"@prismicio/client":`^${await r(`@prismicio/client`)}`,"@prismicio/react":`^${await r(`@prismicio/react`)}`,"@prismicio/next":`^${await r(`@prismicio/next`)}`}}async initProject(){await super.initProject(),await this.#i(),await this.#a(),await this.#o(),await this.#s(),await this.#c()}async createSliceComponent(e,t){let n=await this.getJsFileExtension(),r=new URL(`index.${n}x`,t);return await s(r,l({name:e.name,typescript:await this.checkIsTypeScriptProject()})),{componentPath:r}}getSliceImportPath(e){return`./${e}`}async getDefaultSliceLibraryPath(t){let n=new URL(`src/`,t),r=await e(n)?n:t;return new URL(`slices/`,r)}async getClientFilePath(){return await this.#t()?`src/prismicio.ts`:`prismicio.ts`}async getSlicesDirectoryPath(){return await this.#t()?`src/slices/`:`slices/`}getSliceComponentExtensions(){return[`.tsx`,`.ts`,`.jsx`,`.js`]}async getRoutePath(e){let t=await this.#t()?`src/app`:`app`;switch(e){case`/slice-simulator`:return{path:`${t}/slice-simulator/page`,extensions:[`.tsx`,`.ts`,`.jsx`,`.js`]};case`/api/preview`:return{path:`${t}/api/preview/route`,extensions:[`.ts`,`.js`]};case`/api/exit-preview`:return{path:`${t}/api/exit-preview/route`,extensions:[`.ts`,`.js`]};case`/api/revalidate`:return{path:`${t}/api/revalidate/route`,extensions:[`.ts`,`.js`]};default:return null}}async#e(){return await e(await this.#r(`app`))}async#t(){let t=await this.getProjectRoot();return await e(new URL(`src/`,t))}async#n(){let e=await this.getProjectRoot(),{version:t}=a(new URL(`package.json`,e))(`next/package.json`);return t}async#r(e){let t=await this.getProjectRoot(),n=await this.#t()?`src/`:``;return new URL(`${n}${e}`,t)}async#i(){let t=await this.getJsFileExtension(),n=await this.#r(`prismicio.${t}`);await e(n)||await s(n,u({typescript:await this.checkIsTypeScriptProject(),appRouter:await this.#e(),hasSrcDirectory:await this.#t()}))}async#a(){let t=await this.#e(),n=await this.checkIsTypeScriptProject(),r=`${await this.getJsFileExtension()}x`,i=t?`app/slice-simulator/page.${r}`:`pages/slice-simulator.${r}`,a=await this.#r(i);if(await e(a))return;let c=d({typescript:n,appRouter:t});await o(new URL(`.`,a),{recursive:!0}),await s(a,c)}async#o(){let t=await this.#e(),n=await this.checkIsTypeScriptProject(),r=await this.getJsFileExtension(),i=t?`app/api/preview/route.${r}`:`pages/api/preview.${r}`,a=await this.#r(i);if(await e(a))return;let c=f({typescript:n,appRouter:t});await o(new URL(`.`,a),{recursive:!0}),await s(a,c)}async#s(){let t=await this.#e(),n=await this.checkIsTypeScriptProject(),r=await this.getJsFileExtension(),i=t?`app/api/exit-preview/route.${r}`:`pages/api/exit-preview.${r}`,a=await this.#r(i);if(await e(a))return;let c=p({typescript:n,appRouter:t});await o(new URL(`.`,a),{recursive:!0}),await s(a,c)}async#c(){if(!await this.#e())return;let t=await this.getJsFileExtension(),n=await this.#r(`app/api/revalidate/route.${t}`);if(await e(n))return;let r=await this.#n(),i=m({supportsCacheLife:Number.parseInt(r.split(`.`)[0])>=16});await o(new URL(`.`,n),{recursive:!0}),await s(n,i)}};export{h as NextJsFramework};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import{_ as e,c as t,h as n,p as r,t as i,u as a}from"./framework-CfjEoVk0.mjs";import{t as o}from"./dist-B11B2hHn.mjs";import{n as s,r as c,t as l}from"./builders-hKD4IrLX-DsO7BUQw.mjs";import{mkdir as u,readFile as d,rm as f,writeFile as p}from"node:fs/promises";import{relative as m}from"node:path";import{fileURLToPath as h}from"node:url";function g(e){let{name:n,typescript:r}=e,i=o(n);return r?t`
|
|
2
|
+
<script setup lang="ts">
|
|
3
|
+
import type { Content } from "@prismicio/client";
|
|
4
|
+
|
|
5
|
+
// The array passed to \`getSliceComponentProps\` is purely optional.
|
|
6
|
+
// Consider it as a visual hint for you when templating your slice.
|
|
7
|
+
defineProps(getSliceComponentProps<Content.${i}Slice>(
|
|
8
|
+
["slice", "index", "slices", "context"]
|
|
9
|
+
));
|
|
10
|
+
<\/script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<section
|
|
14
|
+
:data-slice-type="slice.slice_type"
|
|
15
|
+
:data-slice-variation="slice.variation"
|
|
16
|
+
>
|
|
17
|
+
Placeholder component for {{ slice.slice_type }} (variation: {{ slice.variation }}) slices.
|
|
18
|
+
<br />
|
|
19
|
+
<strong>You can edit this slice directly in your code editor.</strong>
|
|
20
|
+
</section>
|
|
21
|
+
</template>
|
|
22
|
+
`:t`
|
|
23
|
+
<script setup>
|
|
24
|
+
// The array passed to \`getSliceComponentProps\` is purely optional.
|
|
25
|
+
// Consider it as a visual hint for you when templating your slice.
|
|
26
|
+
defineProps(getSliceComponentProps(["slice", "index", "slices", "context"]));
|
|
27
|
+
<\/script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<section
|
|
31
|
+
:data-slice-type="slice.slice_type"
|
|
32
|
+
:data-slice-variation="slice.variation"
|
|
33
|
+
>
|
|
34
|
+
Placeholder component for {{ slice.slice_type }} (variation: {{ slice.variation }}) slices.
|
|
35
|
+
<br />
|
|
36
|
+
<strong>You can edit this slice directly in your code editor.</strong>
|
|
37
|
+
</section>
|
|
38
|
+
</template>
|
|
39
|
+
`}function _(e){let{typescript:n}=e,r=[`setup`];return n&&r.push(`lang="ts"`),t`
|
|
40
|
+
<script ${r.join(` `)}>
|
|
41
|
+
import { components } from "~/slices";
|
|
42
|
+
<\/script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<SliceSimulator #default="{ slices }">
|
|
46
|
+
<SliceZone :slices="slices" :components="components" />
|
|
47
|
+
</SliceSimulator>
|
|
48
|
+
</template>
|
|
49
|
+
`}const v=`@nuxtjs/prismic`;var y=class extends i{id=`nuxt`;async getDependencies(){return{"@prismicio/client":`^${await a(`@prismicio/client`)}`,[v]:`^${await a(v)}`}}async initProject(){await super.initProject(),await this.#t(),await this.#n(),await this.#r(),await this.#i()}async createSliceComponent(e,t){let n=new URL(`index.vue`,t);return await p(n,g({name:e.name,typescript:await this.checkIsTypeScriptProject()})),{componentPath:n}}getSliceImportPath(e){return`./${e}/index.vue`}async getDefaultSliceLibraryPath(e){let t=await this.#e();return new URL(`slices/`,t)}async getClientFilePath(){return null}async getSlicesDirectoryPath(){let t=await this.getProjectRoot();return await e(new URL(`app/`,t))?`app/slices/`:await e(new URL(`src/`,t))?`src/slices/`:`slices/`}getSliceComponentExtensions(){return[`.vue`]}async getRoutePath(e){return e===`/slice-simulator`?{path:`pages/slice-simulator`,extensions:[`.vue`]}:null}async generateSliceLibraryIndexContents(e){return t`
|
|
50
|
+
// Code generated by Prismic. DO NOT EDIT.
|
|
51
|
+
|
|
52
|
+
import { defineAsyncComponent } from "vue";
|
|
53
|
+
import { defineSliceZoneComponents } from "@prismicio/vue";
|
|
54
|
+
|
|
55
|
+
export const components = defineSliceZoneComponents({
|
|
56
|
+
${(await Promise.all(e.map(async e=>{let t=m(h(e.library),h(e.directory));return`${e.model.id}: defineAsyncComponent(() => import("./${t}/index.vue"))`}))).join(`,
|
|
57
|
+
`)}
|
|
58
|
+
});
|
|
59
|
+
`}async#e(){let t=await this.getProjectRoot(),n=new URL(`app/`,t);if(await e(n))return n;let r=new URL(`src/`,t);return await e(r)?r:t}async#t(){let t=await this.getProjectRoot(),n=new URL(`nuxt.config.js`,t);if(await e(n)||(n=new URL(`nuxt.config.ts`,t)),!await e(n))return;let r=h(n),i=await s(r),a=i.exports.default.$type===`function-call`?i.exports.default.$args[0]:i.exports.default,o=!1;(a.modules||[]).find(e=>typeof e==`string`?e===v:Array.isArray(e)?(o=!!e[1],e[0]===v):!1)||(a.modules||=[],a.modules.push(v)),o||(i.imports.$prepend({from:`./prismic.config.json`,imported:`repositoryName`}),a.prismic||={},a.prismic.endpoint=l.raw(`repositoryName`)),await c(i,r)}async#n(){let t=await this.getProjectRoot(),n=await this.checkIsTypeScriptProject(),r=new URL(`app/pages/`,t),i=new URL(`src/pages/`,t),a=new URL(`pages/`,t),o;o=await e(r)?r:await e(i)?i:await e(a)?a:new URL(`pages/`,await this.#e());let s=new URL(`slice-simulator.vue`,o);if(await e(s))return;let c=_({typescript:n});await u(o,{recursive:!0}),await p(s,c)}async#r(){let t=await this.#e(),n=new URL(`app.vue`,t);if(!await e(n))return;let r=await d(n,`utf8`);if(!r.includes(`<NuxtWelcome`))return;let i=new URL(`pages/index.vue`,t);await e(i)||(await u(new URL(`.`,i),{recursive:!0}),await p(i,r)),await f(n)}async#i(){let t=await this.getProjectRoot(),i=await e(new URL(`app/`,t)),a=await e(new URL(`src/`,t));if(!i&&!a)return;let o=await r();if(!o.ok)return;let s=o.config.libraries;!s||JSON.stringify(s)!==JSON.stringify([`./slices`])||(await this.getSlices()).length>0||await n({libraries:[i?`./app/slices`:`./src/slices`]})}};export{y as NuxtFramework};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import{_ as e,c as t,t as n,u as r}from"./framework-CfjEoVk0.mjs";import{t as i}from"./dist-B11B2hHn.mjs";import{n as a}from"./builders-hKD4IrLX-DsO7BUQw.mjs";import{createRequire as o}from"node:module";import{mkdir as s,writeFile as c}from"node:fs/promises";function l(e){let{typescript:n}=e;return n?t`
|
|
2
|
+
import { createClient as baseCreateClient, type Route } from "@prismicio/client";
|
|
3
|
+
import { type CreateClientConfig, enableAutoPreviews } from '@prismicio/svelte/kit';
|
|
4
|
+
import prismicConfig from "../../prismic.config.json";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The project's Prismic repository name.
|
|
8
|
+
*/
|
|
9
|
+
export const repositoryName = prismicConfig.repositoryName;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A list of Route Resolver objects that define how a document's \`url\` field is resolved.
|
|
13
|
+
*
|
|
14
|
+
* {@link https://prismic.io/docs/route-resolver}
|
|
15
|
+
*
|
|
16
|
+
* Note: \`prismic sync\` may append new default routes for Page Types. Feel free
|
|
17
|
+
* to edit these to match your site's routing structure.
|
|
18
|
+
*/
|
|
19
|
+
// TODO: Update the routes array to match your project's route structure.
|
|
20
|
+
const routes: Route[] = [
|
|
21
|
+
// Examples:
|
|
22
|
+
// { type: "homepage", path: "/" },
|
|
23
|
+
// { type: "page", path: "/:uid" },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a Prismic client for the project's repository. The client is used to
|
|
28
|
+
* query content from the Prismic API.
|
|
29
|
+
*
|
|
30
|
+
* @param config - Configuration for the Prismic client.
|
|
31
|
+
*/
|
|
32
|
+
export const createClient = ({ cookies, ...config }: CreateClientConfig = {}) => {
|
|
33
|
+
const client = baseCreateClient(repositoryName, {
|
|
34
|
+
routes,
|
|
35
|
+
...config,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
enableAutoPreviews({ client, cookies });
|
|
39
|
+
|
|
40
|
+
return client;
|
|
41
|
+
};
|
|
42
|
+
`:t`
|
|
43
|
+
import { createClient as baseCreateClient } from "@prismicio/client";
|
|
44
|
+
import { enableAutoPreviews } from '@prismicio/svelte/kit';
|
|
45
|
+
import prismicConfig from "../../prismic.config.json";
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The project's Prismic repository name.
|
|
49
|
+
*/
|
|
50
|
+
export const repositoryName = prismicConfig.repositoryName;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A list of Route Resolver objects that define how a document's \`url\` field is resolved.
|
|
54
|
+
*
|
|
55
|
+
* {@link https://prismic.io/docs/route-resolver#route-resolver}
|
|
56
|
+
*
|
|
57
|
+
* Note: \`prismic sync\` may append new default routes for Page Types. Feel free
|
|
58
|
+
* to edit these to match your site's routing structure.
|
|
59
|
+
*
|
|
60
|
+
* @type {import("@prismicio/client").Route[]}
|
|
61
|
+
*/
|
|
62
|
+
// TODO: Update the routes array to match your project's route structure.
|
|
63
|
+
const routes = [
|
|
64
|
+
// Examples:
|
|
65
|
+
// { type: "homepage", path: "/" },
|
|
66
|
+
// { type: "page", path: "/:uid" },
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Creates a Prismic client for the project's repository. The client is used to
|
|
71
|
+
* query content from the Prismic API.
|
|
72
|
+
*
|
|
73
|
+
* @param {import('@prismicio/svelte/kit').CreateClientConfig} config - Configuration for the Prismic client.
|
|
74
|
+
*/
|
|
75
|
+
export const createClient = ({ cookies, ...config } = {}) => {
|
|
76
|
+
const client = baseCreateClient(repositoryName, {
|
|
77
|
+
routes,
|
|
78
|
+
...config,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
enableAutoPreviews({ client, cookies });
|
|
82
|
+
|
|
83
|
+
return client;
|
|
84
|
+
};
|
|
85
|
+
`}function u(e){let{version:n}=e,r=t`
|
|
86
|
+
<script>
|
|
87
|
+
import { SliceSimulator, SliceZone } from '@prismicio/svelte';
|
|
88
|
+
import { components } from '$lib/slices';
|
|
89
|
+
<\/script>
|
|
90
|
+
|
|
91
|
+
<!-- Slot syntax is used for backward compatibility with Svelte <=4. -->
|
|
92
|
+
<SliceSimulator let:slices>
|
|
93
|
+
<SliceZone {slices} {components} />
|
|
94
|
+
</SliceSimulator>
|
|
95
|
+
`,i=t`
|
|
96
|
+
<script>
|
|
97
|
+
import { SliceSimulator, SliceZone } from '@prismicio/svelte';
|
|
98
|
+
import { components } from '$lib/slices';
|
|
99
|
+
<\/script>
|
|
100
|
+
|
|
101
|
+
<SliceSimulator let:slices>
|
|
102
|
+
<SliceZone {slices} {components} />
|
|
103
|
+
</SliceSimulator>
|
|
104
|
+
`;return n<=4?i:r}function d(e){let{typescript:n}=e;return n?t`
|
|
105
|
+
import { redirectToPreviewURL } from '@prismicio/svelte/kit';
|
|
106
|
+
import { createClient } from '$lib/prismicio';
|
|
107
|
+
import type { RequestHandler } from "./$types";
|
|
108
|
+
|
|
109
|
+
export const GET: RequestHandler = async ({ fetch, request, cookies }) => {
|
|
110
|
+
const client = createClient({ fetch });
|
|
111
|
+
|
|
112
|
+
return await redirectToPreviewURL({ client, request, cookies });
|
|
113
|
+
}
|
|
114
|
+
`:t`
|
|
115
|
+
import { redirectToPreviewURL } from '@prismicio/svelte/kit';
|
|
116
|
+
import { createClient } from '$lib/prismicio';
|
|
117
|
+
|
|
118
|
+
/* @type {import("./$types").RequestHandler} */
|
|
119
|
+
export async function GET({ fetch, request, cookies }) {
|
|
120
|
+
const client = createClient({ fetch });
|
|
121
|
+
|
|
122
|
+
return await redirectToPreviewURL({ client, request, cookies });
|
|
123
|
+
}
|
|
124
|
+
`}function f(e){let{version:n}=e,r=t`
|
|
125
|
+
<script>
|
|
126
|
+
import { isFilled, asImageSrc } from '@prismicio/client';
|
|
127
|
+
import { PrismicPreview } from '@prismicio/svelte/kit';
|
|
128
|
+
import { page } from '$app/state';
|
|
129
|
+
import { repositoryName } from '$lib/prismicio';
|
|
130
|
+
|
|
131
|
+
const { children } = $props();
|
|
132
|
+
<\/script>
|
|
133
|
+
|
|
134
|
+
<svelte:head>
|
|
135
|
+
<title>{page.data.page?.data.meta_title}</title>
|
|
136
|
+
<meta property="og:title" content={page.data.page?.data.meta_title} />
|
|
137
|
+
{#if isFilled.keyText(page.data.page?.data.meta_description)}
|
|
138
|
+
<meta name="description" content={page.data.page.data.meta_description} />
|
|
139
|
+
<meta property="og:description" content={page.data.page.data.meta_description} />
|
|
140
|
+
{/if}
|
|
141
|
+
{#if isFilled.image(page.data.page?.data.meta_image)}
|
|
142
|
+
<meta property="og:image" content={asImageSrc(page.data.page.data.meta_image)} />
|
|
143
|
+
{/if}
|
|
144
|
+
</svelte:head>
|
|
145
|
+
{@render children()}
|
|
146
|
+
<PrismicPreview {repositoryName} />
|
|
147
|
+
`,i=t`
|
|
148
|
+
<script>
|
|
149
|
+
import { isFilled, asImageSrc } from '@prismicio/client';
|
|
150
|
+
import { PrismicPreview } from '@prismicio/svelte/kit';
|
|
151
|
+
import { page } from '$app/state';
|
|
152
|
+
import { repositoryName } from '$lib/prismicio';
|
|
153
|
+
<\/script>
|
|
154
|
+
|
|
155
|
+
<svelte:head>
|
|
156
|
+
<title>{page.data.page?.data.meta_title}</title>
|
|
157
|
+
<meta property="og:title" content={page.data.page?.data.meta_title} />
|
|
158
|
+
{#if isFilled.keyText(page.data.page?.data.meta_description)}
|
|
159
|
+
<meta name="description" content={page.data.page.data.meta_description} />
|
|
160
|
+
<meta property="og:description" content={page.data.page.data.meta_description} />
|
|
161
|
+
{/if}
|
|
162
|
+
{#if isFilled.image(page.data.page?.data.meta_image)}
|
|
163
|
+
<meta property="og:image" content={asImageSrc(page.data.page.data.meta_image)} />
|
|
164
|
+
{/if}
|
|
165
|
+
</svelte:head>
|
|
166
|
+
<slot />
|
|
167
|
+
<PrismicPreview {repositoryName} />
|
|
168
|
+
`;return n<=4?i:r}const p=t`
|
|
169
|
+
<section data-slice-type={slice.slice_type} data-slice-variation={slice.variation}>
|
|
170
|
+
Placeholder component for {slice.slice_type} (variation: {slice.variation}) slices.
|
|
171
|
+
<br />
|
|
172
|
+
<strong>You can edit this slice directly in your code editor.</strong>
|
|
173
|
+
</section>
|
|
174
|
+
`;function m(e){let{name:n,typescript:r,version:a}=e,o=i(n),s=t`
|
|
175
|
+
<script lang="ts">
|
|
176
|
+
import type { Content } from '@prismicio/client';
|
|
177
|
+
import type { SliceComponentProps } from '@prismicio/svelte';
|
|
178
|
+
|
|
179
|
+
type Props = SliceComponentProps<Content.${o}Slice>;
|
|
180
|
+
|
|
181
|
+
const { slice }: Props = $props();
|
|
182
|
+
<\/script>
|
|
183
|
+
|
|
184
|
+
${p}
|
|
185
|
+
`,c=t`
|
|
186
|
+
<script>
|
|
187
|
+
/* @typedef {import("@prismicio/client").Content} Content */
|
|
188
|
+
/* @typedef {import("@prismicio/svelte").SliceComponentProps} SliceComponentProps */
|
|
189
|
+
|
|
190
|
+
/* @type {SliceComponentProps<Content.${o}Slice>} */
|
|
191
|
+
const { slice } = $props();
|
|
192
|
+
<\/script>
|
|
193
|
+
|
|
194
|
+
${p}
|
|
195
|
+
`,l=t`
|
|
196
|
+
<script lang="ts">
|
|
197
|
+
import type { Content } from '@prismicio/client';
|
|
198
|
+
|
|
199
|
+
export let slice: Content.${o}Slice;
|
|
200
|
+
<\/script>
|
|
201
|
+
|
|
202
|
+
${p}
|
|
203
|
+
`,u=t`
|
|
204
|
+
<script>
|
|
205
|
+
/** @type {import("@prismicio/client").Content.${o}Slice} */
|
|
206
|
+
export let slice;
|
|
207
|
+
<\/script>
|
|
208
|
+
|
|
209
|
+
${p}
|
|
210
|
+
`;return r?a<=4?l:s:a<=4?u:c}var h=class extends n{id=`sveltekit`;async getDependencies(){return{"@prismicio/client":`^${await r(`@prismicio/client`)}`,"@prismicio/svelte":`^${await r(`@prismicio/svelte`)}`}}async initProject(){await super.initProject(),await this.#e(),await this.#t(),await this.#n(),await this.#r(),await this.#i(),await this.#a(),await this.#o(),await this.#s()}async createSliceComponent(e,t){let n=new URL(`index.svelte`,t);return await c(n,m({name:e.name,typescript:await this.checkIsTypeScriptProject(),version:await this.#c()})),{componentPath:n}}getSliceImportPath(e){return`./${e}/index.svelte`}async getDefaultSliceLibraryPath(e){return new URL(`src/lib/slices/`,e)}async getClientFilePath(){return`src/lib/prismicio.ts`}async getSlicesDirectoryPath(){return`src/lib/slices/`}getSliceComponentExtensions(){return[`.svelte`]}async getRoutePath(e){switch(e){case`/slice-simulator`:return{path:`src/routes/slice-simulator/+page`,extensions:[`.svelte`]};case`/api/preview`:return{path:`src/routes/api/preview/+server`,extensions:[`.ts`,`.js`]};default:return null}}async#e(){let t=await this.getJsFileExtension(),n=await this.getProjectRoot(),r=new URL(`src/lib/prismicio.${t}`,n);if(await e(r))return;let i=l({typescript:await this.checkIsTypeScriptProject()});await s(new URL(`.`,r),{recursive:!0}),await c(r,i)}async#t(){let t=await this.getProjectRoot(),n=new URL(`src/routes/slice-simulator/+page.svelte`,t);if(await e(n))return;let r=u({version:await this.#c()});await s(new URL(`.`,n),{recursive:!0}),await c(n,r)}async#n(){let n=await this.getJsFileExtension(),r=await this.getProjectRoot(),i=new URL(`src/params/preview.${n}`,r);if(await e(i))return;let a=t`
|
|
211
|
+
export function match(param) {
|
|
212
|
+
return param === 'preview';
|
|
213
|
+
}
|
|
214
|
+
`;await s(new URL(`.`,i),{recursive:!0}),await c(i,a)}async#r(){let t=await this.getJsFileExtension(),n=await this.getProjectRoot(),r=new URL(`src/routes/api/preview/+server.${t}`,n);if(await e(r))return;let i=d({typescript:await this.checkIsTypeScriptProject()});await s(new URL(`.`,r),{recursive:!0}),await c(r,i)}async#i(){let n=await this.getProjectRoot(),r=new URL(`src/routes/[[preview=preview]]/README.md`,n);if(await e(r))return;let i=t`
|
|
215
|
+
This directory adds support for optional \`/preview\` routes. Do not remove this directory.
|
|
216
|
+
|
|
217
|
+
All routes within this directory will be served using the following URLs:
|
|
218
|
+
|
|
219
|
+
- \`/example-route\` (prerendered)
|
|
220
|
+
- \`/preview/example-route\` (server-rendered)
|
|
221
|
+
|
|
222
|
+
See <https://prismic.io/docs/svelte-preview> for more information.
|
|
223
|
+
`;await s(new URL(`.`,r),{recursive:!0}),await c(r,i)}async#a(){let n=await this.getJsFileExtension(),r=await this.getProjectRoot(),i=new URL(`src/routes/+layout.server.${n}`,r);if(await e(i))return;let a=t`
|
|
224
|
+
export const prerender = "auto";
|
|
225
|
+
`;await s(new URL(`.`,i),{recursive:!0}),await c(i,a)}async#o(){let t=await this.getProjectRoot(),n=new URL(`src/routes/+layout.svelte`,t);if(await e(n))return;let r=f({version:await this.#c()});await s(new URL(`.`,n),{recursive:!0}),await c(n,r)}async#s(){let t=await this.getProjectRoot(),n=new URL(`vite.config.js`,t);if(await e(n)||(n=new URL(`vite.config.ts`,t)),!await e(n))return;let r=n.pathname,i=await a(r);if(i.exports.default.$type!==`function-call`)return;let o=i.exports.default.$args[0];o.server??={},o.server.fs??={},o.server.fs.allow??=[],o.server.fs.allow.includes(`./prismic.config.json`)||o.server.fs.allow.push(`./prismic.config.json`);let s=i.generate().code.replace(/\n\s*\n(?=\s*server:)/,`
|
|
226
|
+
`);await c(n,s)}async#c(){let e=await this.getProjectRoot(),{version:t}=o(new URL(`package.json`,e))(`svelte/package.json`),n=Number.parseInt(t.split(`.`)[0]);return Number.isNaN(n)?1/0:n}};export{h as SvelteKitFramework};
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prismic",
|
|
3
|
+
"version": "0.0.0-pr.28.59bf330",
|
|
4
|
+
"description": "Prismic's official command line tool",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"prismic",
|
|
7
|
+
"typescript"
|
|
8
|
+
],
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"author": "Prismic <contact@prismic.io> (https://prismic.io)",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "ssh://git@github.com/prismicio/cli.git"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"prismic": "./dist/index.mjs"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"./dist",
|
|
20
|
+
"./src"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsdown",
|
|
28
|
+
"dev": "tsdown --watch",
|
|
29
|
+
"format": "oxfmt",
|
|
30
|
+
"prepare": "npm run build",
|
|
31
|
+
"lint": "oxlint --deny-warnings",
|
|
32
|
+
"types": "tsc --noEmit",
|
|
33
|
+
"unit": "vitest run --coverage",
|
|
34
|
+
"unit:watch": "vitest watch",
|
|
35
|
+
"test": "npm run lint && npm run types && npm run unit && npm run build"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@prismicio/types-internal": "3.16.1",
|
|
39
|
+
"@sentry/node-core": "10.42.0",
|
|
40
|
+
"@types/node": "25.0.9",
|
|
41
|
+
"@vitest/coverage-v8": "4.0.17",
|
|
42
|
+
"change-case": "5.4.4",
|
|
43
|
+
"dedent": "^1.7.2",
|
|
44
|
+
"detect-indent": "^7.0.2",
|
|
45
|
+
"magicast": "0.5.1",
|
|
46
|
+
"oxfmt": "^0.24.0",
|
|
47
|
+
"oxlint": "1.39.0",
|
|
48
|
+
"prismic-ts-codegen": "^0.1.28",
|
|
49
|
+
"tinyglobby": "^0.2.15",
|
|
50
|
+
"tsdown": "0.19.0",
|
|
51
|
+
"typescript": "5.9.3",
|
|
52
|
+
"valibot": "^1.2.0",
|
|
53
|
+
"vitest": "4.0.17"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=24"
|
|
57
|
+
}
|
|
58
|
+
}
|