prismic 1.4.0 → 1.5.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.
@@ -1,4 +1,4 @@
1
- import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t as d}from"./string-BBnEuzIe.mjs";import{n as f}from"./builders-hKD4IrLX-BHWJUmr1.mjs";import{createRequire as p}from"node:module";import{writeFile as m}from"node:fs/promises";import{fileURLToPath as h}from"node:url";import{relative as g}from"node:path";function _(e){let{typescript:t}=e;return t?d`
1
+ import{A as e,F as t,I as n,L as r,M as i,Z as a,c as o,j as s,l as c,n as l,t as u,w as d}from"./string-BCkmn3bO.mjs";import{n as f}from"./builders-hKD4IrLX-Dvmo19pp.mjs";import{createRequire as p}from"node:module";import{writeFile as m}from"node:fs/promises";import{fileURLToPath as h}from"node:url";import{relative as g}from"node:path";function _(e){let{typescript:t}=e;return t?u`
2
2
  import { createClient as baseCreateClient } from "@prismicio/client";
3
3
  import { type CreateClientConfig, enableAutoPreviews } from '@prismicio/svelte/kit';
4
4
  import prismicConfig from "../../prismic.config.json";
@@ -24,7 +24,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
24
24
 
25
25
  return client;
26
26
  };
27
- `:d`
27
+ `:u`
28
28
  import { createClient as baseCreateClient } from "@prismicio/client";
29
29
  import { enableAutoPreviews } from '@prismicio/svelte/kit';
30
30
  import prismicConfig from "../../prismic.config.json";
@@ -50,7 +50,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
50
50
 
51
51
  return client;
52
52
  };
53
- `}function v(e){let{version:t}=e,n=d`
53
+ `}function v(e){let{version:t}=e,n=u`
54
54
  <script>
55
55
  import { SliceSimulator, SliceZone } from '@prismicio/svelte';
56
56
  import { components } from '$lib/slices';
@@ -60,7 +60,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
60
60
  <SliceSimulator let:slices>
61
61
  <SliceZone {slices} {components} />
62
62
  </SliceSimulator>
63
- `,r=d`
63
+ `,r=u`
64
64
  <script>
65
65
  import { SliceSimulator, SliceZone } from '@prismicio/svelte';
66
66
  import { components } from '$lib/slices';
@@ -69,7 +69,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
69
69
  <SliceSimulator let:slices>
70
70
  <SliceZone {slices} {components} />
71
71
  </SliceSimulator>
72
- `;return t<=4?r:n}function y(e){let{typescript:t}=e;return t?d`
72
+ `;return t<=4?r:n}function y(e){let{typescript:t}=e;return t?u`
73
73
  import { redirectToPreviewURL } from '@prismicio/svelte/kit';
74
74
  import { createClient } from '$lib/prismicio';
75
75
  import type { RequestHandler } from "./$types";
@@ -79,7 +79,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
79
79
 
80
80
  return await redirectToPreviewURL({ client, request, cookies });
81
81
  }
82
- `:d`
82
+ `:u`
83
83
  import { redirectToPreviewURL } from '@prismicio/svelte/kit';
84
84
  import { createClient } from '$lib/prismicio';
85
85
 
@@ -89,7 +89,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
89
89
 
90
90
  return await redirectToPreviewURL({ client, request, cookies });
91
91
  }
92
- `}function b(e){let{version:t}=e,n=d`
92
+ `}function b(e){let{version:t}=e,n=u`
93
93
  <script>
94
94
  import { isFilled, asImageSrc } from '@prismicio/client';
95
95
  import { PrismicPreview } from '@prismicio/svelte/kit';
@@ -112,7 +112,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
112
112
  </svelte:head>
113
113
  {@render children()}
114
114
  <PrismicPreview {repositoryName} />
115
- `,r=d`
115
+ `,r=u`
116
116
  <script>
117
117
  import { isFilled, asImageSrc } from '@prismicio/client';
118
118
  import { PrismicPreview } from '@prismicio/svelte/kit';
@@ -133,7 +133,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
133
133
  </svelte:head>
134
134
  <slot />
135
135
  <PrismicPreview {repositoryName} />
136
- `;return t<=4?r:n}function x(e){let{typescript:t}=e;return t?d`
136
+ `;return t<=4?r:n}function x(e){let{typescript:t}=e;return t?u`
137
137
  <script lang="ts">
138
138
  import { SliceZone } from "@prismicio/svelte";
139
139
  import { components } from "$lib/slices";
@@ -143,7 +143,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
143
143
  <\/script>
144
144
 
145
145
  <SliceZone slices={data.page.data.slices} {components} />
146
- `:d`
146
+ `:u`
147
147
  <script>
148
148
  import { SliceZone } from "@prismicio/svelte";
149
149
  import { components } from "$lib/slices";
@@ -152,7 +152,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
152
152
  <\/script>
153
153
 
154
154
  <SliceZone slices={data.page.data.slices} {components} />
155
- `}function S(e){let{model:t,typescript:n}=e;return t.repeatable?n?d`
155
+ `}function S(e){let{model:t,typescript:n}=e;return t.repeatable?n?u`
156
156
  import type { PageServerLoad } from "./$types";
157
157
  import { createClient } from "$lib/prismicio";
158
158
 
@@ -162,7 +162,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
162
162
 
163
163
  return { page };
164
164
  };
165
- `:d`
165
+ `:u`
166
166
  import { createClient } from "$lib/prismicio";
167
167
 
168
168
  /** @type {import("./$types").PageServerLoad} */
@@ -172,7 +172,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
172
172
 
173
173
  return { page };
174
174
  }
175
- `:n?d`
175
+ `:n?u`
176
176
  import type { PageServerLoad } from "./$types";
177
177
  import { createClient } from "$lib/prismicio";
178
178
 
@@ -182,7 +182,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
182
182
 
183
183
  return { page };
184
184
  };
185
- `:d`
185
+ `:u`
186
186
  import { createClient } from "$lib/prismicio";
187
187
 
188
188
  /* @type {import("./$types").PageServerLoad} */
@@ -192,13 +192,13 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
192
192
 
193
193
  return { page };
194
194
  }
195
- `}const C=d`
195
+ `}const C=u`
196
196
  <section data-slice-type={slice.slice_type} data-slice-variation={slice.variation}>
197
197
  Placeholder component for {slice.slice_type} (variation: {slice.variation}) slices.
198
198
  <br />
199
199
  <strong>You can edit this slice directly in your code editor.</strong>
200
200
  </section>
201
- `;function w(e){let{name:t,typescript:n,version:r}=e,i=a(t),o=d`
201
+ `;function w(e){let{name:t,typescript:n,version:r}=e,i=a(t),o=u`
202
202
  <script lang="ts">
203
203
  import type { Content } from '@prismicio/client';
204
204
  import type { SliceComponentProps } from '@prismicio/svelte';
@@ -209,7 +209,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
209
209
  <\/script>
210
210
 
211
211
  ${C}
212
- `,s=d`
212
+ `,s=u`
213
213
  <script>
214
214
  /* @typedef {import("@prismicio/client").Content} Content */
215
215
  /* @typedef {import("@prismicio/svelte").SliceComponentProps} SliceComponentProps */
@@ -219,7 +219,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
219
219
  <\/script>
220
220
 
221
221
  ${C}
222
- `,c=d`
222
+ `,c=u`
223
223
  <script lang="ts">
224
224
  import type { Content } from '@prismicio/client';
225
225
 
@@ -227,14 +227,14 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
227
227
  <\/script>
228
228
 
229
229
  ${C}
230
- `,l=d`
230
+ `,l=u`
231
231
  <script>
232
232
  /** @type {import("@prismicio/client").Content.${i}Slice} */
233
233
  export let slice;
234
234
  <\/script>
235
235
 
236
236
  ${C}
237
- `;return n?r<=4?c:o:r<=4?l:s}var T=class extends u{id=`sveltekit`;async setupProject(){await c({"@prismicio/client":`^${await s(`@prismicio/client`)}`,"@prismicio/svelte":`^${await s(`@prismicio/svelte`)}`}),await E(),await D(),await O(),await k(),await A(),await j(),await M(),await P()}onProjectInitialized(){}async onSliceCreated(e,t){let i=a(e.name),s=new URL(i,r(t));await n(new URL(`index.svelte`,r(s)),w({name:e.name,typescript:await o(),version:await I()}))}onSliceUpdated(){}onSliceDeleted(){}async onCustomTypeCreated(e){e.format===`page`&&await N(e)}onCustomTypeUpdated(){}onCustomTypeDeleted(){}async createSliceIndexFile(e){let t=(await this.getSlices()).filter(t=>t.library.href===e.href),r=t.map(t=>`import ${a(t.model.name)} from "./${g(h(e),h(t.directory))}/index.svelte";`),i=t.map(e=>{let t=a(e.model.name);return`${e.model.id}: ${t}`}),o=d`
237
+ `;return n?r<=4?c:o:r<=4?l:s}var T=class extends l{id=`sveltekit`;async setupProject(){await e({"@prismicio/client":`^${await i(`@prismicio/client`)}`,"@prismicio/svelte":`^${await i(`@prismicio/svelte`)}`}),await E(),await D(),await O(),await k(),await A(),await j(),await M(),await P()}onProjectInitialized(){}async onSliceCreated(e,t){let i=a(e.name),s=new URL(i,r(t));await n(new URL(`index.svelte`,r(s)),w({name:e.name,typescript:await o(),version:await I()}))}onSliceUpdated(){}onSliceDeleted(){}async onCustomTypeCreated(e){e.format===`page`&&await N(e)}onCustomTypeUpdated(){}onCustomTypeDeleted(){}async createSliceIndexFile(e){let t=(await this.getSlices()).filter(t=>t.library.href===e.href),r=t.map(t=>`import ${a(t.model.name)} from "./${g(h(e),h(t.directory))}/index.svelte";`),i=t.map(e=>{let t=a(e.model.name);return`${e.model.id}: ${t}`}),o=u`
238
238
  // Code generated by Prismic. DO NOT EDIT.
239
239
 
240
240
  ${r.join(`
@@ -244,11 +244,11 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
244
244
  ${i.join(`,
245
245
  `)}
246
246
  };
247
- `,s=`index.${await F()}`;await n(new URL(s,e),o)}async getDefaultSliceLibrary(){let e=await l();return new URL(`src/lib/slices/`,e)}};async function E(){let e=await F(),t=await l(),r=new URL(`src/lib/prismicio.${e}`,t);await i(r)||await n(r,_({typescript:await o()}))}async function D(){let e=await l(),t=new URL(`src/routes/slice-simulator/+page.svelte`,e);await i(t)||await n(t,v({version:await I()}))}async function O(){let e=await F(),t=await l(),r=new URL(`src/params/preview.${e}`,t);await i(r)||await n(r,d`
247
+ `,s=`index.${await F()}`;await n(new URL(s,e),o)}async getDefaultSliceLibrary(){let e=await c();return new URL(`src/lib/slices/`,e)}};async function E(){let e=await F(),r=await c(),i=new URL(`src/lib/prismicio.${e}`,r);await t(i)||await n(i,_({typescript:await o()}))}async function D(){let e=await c(),r=new URL(`src/routes/slice-simulator/+page.svelte`,e);await t(r)||await n(r,v({version:await I()}))}async function O(){let e=await F(),r=await c(),i=new URL(`src/params/preview.${e}`,r);await t(i)||await n(i,u`
248
248
  export function match(param) {
249
249
  return param === 'preview';
250
250
  }
251
- `)}async function k(){let e=await F(),t=await l(),r=new URL(`src/routes/api/preview/+server.${e}`,t);await i(r)||await n(r,y({typescript:await o()}))}async function A(){let e=await l(),t=new URL(`src/routes/[[preview=preview]]/README.md`,e);await i(t)||await n(t,d`
251
+ `)}async function k(){let e=await F(),r=await c(),i=new URL(`src/routes/api/preview/+server.${e}`,r);await t(i)||await n(i,y({typescript:await o()}))}async function A(){let e=await c(),r=new URL(`src/routes/[[preview=preview]]/README.md`,e);await t(r)||await n(r,u`
252
252
  This directory adds support for optional \`/preview\` routes. Do not remove this directory.
253
253
 
254
254
  All routes within this directory will be served using the following URLs:
@@ -257,7 +257,7 @@ import{A as e,C as t,F as n,I as r,P as i,X as a,c as o,j as s,k as c,l,n as u,t
257
257
  - \`/preview/example-route\` (server-rendered)
258
258
 
259
259
  See <https://prismic.io/docs/svelte-preview> for more information.
260
- `)}async function j(){let e=await F(),t=await l(),r=new URL(`src/routes/+layout.server.${e}`,t);await i(r)||await n(r,d`
260
+ `)}async function j(){let e=await F(),r=await c(),i=new URL(`src/routes/+layout.server.${e}`,r);await t(i)||await n(i,u`
261
261
  export const prerender = "auto";
262
- `)}async function M(){let e=await l(),t=new URL(`src/routes/+layout.svelte`,e);await i(t)||await n(t,b({version:await I()}))}async function N(e){let r=t(e).split(`/`).filter(Boolean).map(e=>e.startsWith(`:`)?`[${e.slice(1)}]`:e).join(`/`),a=await l(),s=await F(),c=new URL(`src/routes/[[preview=preview]]/${r}/`,a),u=new URL(`+page.svelte`,c);await i(u)||await n(u,x({typescript:await o()}));let d=new URL(`+page.server.${s}`,c);await i(d)||await n(d,S({model:e,typescript:await o()}))}async function P(){let e=await l(),t=new URL(`vite.config.js`,e);if(await i(t)||(t=new URL(`vite.config.ts`,e)),!await i(t))return;let n=t.pathname,r=await f(n);if(r.exports.default.$type!==`function-call`)return;let a=r.exports.default.$args[0];a.server??={},a.server.fs??={},a.server.fs.allow??=[],a.server.fs.allow.includes(`./prismic.config.json`)||a.server.fs.allow.push(`./prismic.config.json`);let o=r.generate().code.replace(/\n\s*\n(?=\s*server:)/,`
263
- `);await m(t,o)}async function F(){return await o()?`ts`:`js`}async function I(){let{version:t}=p(await e())(`svelte/package.json`),n=Number.parseInt(t.split(`.`)[0]);return Number.isNaN(n)?1/0:n}export{T as SvelteKitAdapter};
262
+ `)}async function M(){let e=await c(),r=new URL(`src/routes/+layout.svelte`,e);await t(r)||await n(r,b({version:await I()}))}async function N(e){let r=d(e).split(`/`).filter(Boolean).map(e=>e.startsWith(`:`)?`[${e.slice(1)}]`:e).join(`/`),i=await c(),a=await F(),s=new URL(`src/routes/[[preview=preview]]/${r}/`,i),l=new URL(`+page.svelte`,s);await t(l)||await n(l,x({typescript:await o()}));let u=new URL(`+page.server.${a}`,s);await t(u)||await n(u,S({model:e,typescript:await o()}))}async function P(){let e=await c(),n=new URL(`vite.config.js`,e);if(await t(n)||(n=new URL(`vite.config.ts`,e)),!await t(n))return;let r=n.pathname,i=await f(r);if(i.exports.default.$type!==`function-call`)return;let a=i.exports.default.$args[0];a.server??={},a.server.fs??={},a.server.fs.allow??=[],a.server.fs.allow.includes(`./prismic.config.json`)||a.server.fs.allow.push(`./prismic.config.json`);let o=i.generate().code.replace(/\n\s*\n(?=\s*server:)/,`
263
+ `);await m(n,o)}async function F(){return await o()?`ts`:`js`}async function I(){let{version:e}=p(await s())(`svelte/package.json`),t=Number.parseInt(e.split(`.`)[0]);return Number.isNaN(t)?1/0:t}export{T as SvelteKitAdapter};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismic",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Prismic's official command line tool",
5
5
  "keywords": [
6
6
  "prismic",
@@ -42,6 +42,7 @@
42
42
  "cross-env": "^10.1.0",
43
43
  "dedent": "^1.7.2",
44
44
  "detect-indent": "^7.0.2",
45
+ "github-slugger": "2.0.0",
45
46
  "magicast": "0.5.1",
46
47
  "oxfmt": "^0.24.0",
47
48
  "oxlint": "1.39.0",