prismic 1.29.0 → 1.30.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-DWhQeyDo.mjs +197 -0
- package/dist/index.mjs +103 -97
- package/dist/{nextjs-Cydao8so.mjs → nextjs-4lBT3LWb.mjs} +63 -63
- package/dist/{nuxt-DZlxcDTY.mjs → nuxt-CXMFa4cT.mjs} +10 -10
- package/dist/package-DZJSt_MI.mjs +1 -0
- package/dist/{packageJson-Du_fIYqH.mjs → packageJson-BEVwXn1i.mjs} +3 -3
- package/dist/{segment-B2JRNROf.mjs → segment-BpOvsf06.mjs} +1 -1
- package/dist/subprocesses/sendSegmentEvents.mjs +1 -1
- package/dist/subprocesses/updateVersionState.mjs +1 -1
- package/dist/sveltekit-B-_UPD7T.mjs +1 -0
- package/dist/{sveltekit-DCytYnBb.mjs → sveltekit-D7e5u5rg.mjs} +29 -29
- package/dist/{sveltekit2-DbVLruSc.mjs → sveltekit2-xFDbKhF_.mjs} +1 -1
- package/dist/{update-notifier-BGQNWIvh.mjs → update-notifier-B86qEI1j.mjs} +1 -1
- package/package.json +3 -3
- package/dist/adapters-C-tqRizJ.mjs +0 -197
- package/dist/package-CR69YEZ6.mjs +0 -1
- package/dist/sveltekit-B3tYQDoW.mjs +0 -1
|
@@ -26,7 +26,7 @@ function J(e){return new wn({type:`optional`,innerType:e})}const Tn=/*@__PURE__*
|
|
|
26
26
|
function En(e){return new Tn({type:`nullable`,innerType:e})}// @__NO_SIDE_EFFECTS__
|
|
27
27
|
function Dn(e){return/* @__PURE__ */ J(/* @__PURE__ */ En(e))}const On=/*@__PURE__*/ k(`ZodMiniDefault`,(e,t)=>{Vt.init(e,t),U.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
28
28
|
function kn(e,t){return new On({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ee(t)}})}const An=/*@__PURE__*/ k(`ZodMiniCatch`,(e,t)=>{Wt.init(e,t),U.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
29
|
-
function jn(e,t){return new An({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Be(t)})}const Mn=/*@__PURE__*/ k(`ZodMiniPipe`,(e,t)=>{Gt.init(e,t),U.init(e,t)}),Nn=/*@__PURE__*/ k(`ZodMiniCodec`,(e,t)=>{Mn.init(e,t),Kt.init(e,t)}),Pn=(...e)=>/* @__PURE__ */ en({Codec:Nn,Boolean:cn,String:W},...e);function Fn(e){let t=new URL(e);return t.pathname.endsWith(`/`)||(t.pathname+=`/`),t}function In(e,t){return d(p(e),p(t))}function
|
|
29
|
+
function jn(e,t){return new An({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Be(t)})}const Mn=/*@__PURE__*/ k(`ZodMiniPipe`,(e,t)=>{Gt.init(e,t),U.init(e,t)}),Nn=/*@__PURE__*/ k(`ZodMiniCodec`,(e,t)=>{Mn.init(e,t),Kt.init(e,t)}),Pn=(...e)=>/* @__PURE__ */ en({Codec:Nn,Boolean:cn,String:W},...e);function Fn(e){let t=new URL(e);return t.pathname.endsWith(`/`)||(t.pathname+=`/`),t}function In(e){return/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.test(e)}function Ln(e,t){return d(p(e),p(t))}function Rn(e){let t=e.pathname.lastIndexOf(`.`);if(t!==-1)return e.pathname.slice(t+1).toLowerCase()||void 0}function zn(e,t){let n=d(p(e),p(t));return!(!n||n.startsWith(`..`)||l(n))}async function Y(e,t={}){let{json:n,notFoundMessage:r,unknownErrorMessage:i,schema:a,onUnauthorized:o,...s}=t,c=new Headers(t.headers);c.has(`Accept`)||c.set(`Accept`,`application/json`),c.has(`User-Agent`)||c.set(`User-Agent`,`prismic-cli`),`json`in t&&!c.has(`Content-Type`)&&c.set(`Content-Type`,`application/json`);let l=`json`in t?JSON.stringify(n):t.body,u=await fetch(e,{...s,body:l,headers:c}).catch(e=>{throw e instanceof TypeError&&e.message===`fetch failed`?new Bn(e.message,{cause:e}):e}),d=await u.text(),f;if(d)try{f=JSON.parse(d)}catch{f=d}if(u.ok)return a?F(a,f):f;switch(u.status){case 400:throw new Hn(u,f);case 401:case 403:{let n=!1,r=await o?.(r=>{n=!0;let i=new Headers(c);return new Headers(r?.headers).forEach((e,t)=>i.set(t,e)),Y(e,{...t,headers:i,onUnauthorized:void 0})},c);if(n)return r;throw u.status===401?new Gn(u,f):new Wn(u,f)}case 404:throw new Un(u,f,r);default:throw new Vn(u,f,i)}}var Bn=class extends Error{name=`NetworkError`},X=class extends Error{response;body;constructor(e,t,n){super(n),this.response=e,this.body=t}get status(){return this.response.status}get statusText(){return this.response.statusText}},Vn=class extends X{name=`UnknownRequestError`},Hn=class extends X{name=`BadRequestError`},Un=class extends X{name=`NotFoundRequestError`;constructor(e,t,n=`The requested resource was not found.`){super(e,t,n)}},Wn=class extends X{name=`ForbiddenRequestError`},Gn=class extends X{name=`UnauthorizedRequestError`};async function Kn(e,t={}){let{stop:n}=t,r=Fn(ee(process.cwd()));for(;;){let t=new URL(e,r);if(await Z(t))return t;if(n&&await Z(new URL(n,r)))return;let i=new URL(`..`,r);if(i.href===r.href)return;r=i}}async function Z(e){try{return await n(e),!0}catch{return!1}}function qn(e,t){let n=Promise.withResolvers(),r;for(let i of e)re(i)&&se(i,{recursive:!0,signal:t},()=>{clearTimeout(r),r=setTimeout(()=>n.resolve(),100)}).on(`error`,()=>{});return async e=>{await Promise.race([n.promise,te(e,void 0,{signal:t})]).catch(()=>{}),n=Promise.withResolvers()}}async function Jn(e,t){let n=new URL(`.`,e);await r(n,{recursive:!0}),await a(e,t)}async function Yn(e,t={}){let{schema:n}=t,r=await i(e,`utf8`),a;try{a=JSON.parse(r)}catch(t){throw SyntaxError(`${d(process.cwd(),p(e))} is not valid JSON.`,{cause:t})}return n?F(n,a):a}const Xn={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`};async function Zn(e){if(e.protocol===`http:`||e.protocol===`https:`){let t=await fetch(e);if(!t.ok)throw Error(`Failed to download file from "${e.toString()}" (HTTP ${t.status}).`);return await t.blob()}if(e.protocol===`file:`){let t=await i(e),n=Rn(e),r=n&&Xn[n]||`application/octet-stream`;return new Blob([t],{type:r})}throw Error(`Unsupported file protocol: ${e.protocol}`)}async function Qn(e){let n=await i(e,`utf8`);return t(n)}async function $n(e,t,n){let r=await Z(e),o=``;r&&(o=await i(e,`utf8`));let s=RegExp(`^${t}=.*$`,`mg`),c=`${t}=${n}`;s.test(o)?o=o.replace(s,c):(o&&!o.endsWith(`
|
|
30
30
|
`)&&(o+=`
|
|
31
|
-
`),o+=`${c}\n`),await a(e,o)}async function
|
|
32
|
-
`;await a(t,s)}async function
|
|
31
|
+
`),o+=`${c}\n`),await a(e,o)}async function er(e,t){if(!await Z(e))return;let n=await i(e,`utf8`),r=RegExp(`^${t}=.*$\n?`,`mg`);n=n.replace(r,``),await a(e,n)}function tr(e){return JSON.stringify(e,null,2)}const nr=/^(?:( )+|\t+)/,Q=`space`;function rr(e,t,n){return e&&t===Q&&n===1}function ir(e,t){let n=/* @__PURE__ */ new Map,r=0,i,a;for(let o of e.split(/\n/g)){if(!o)continue;let e=o.match(nr);if(e===null)r=0,i=``;else{let o=e[0].length,s=e[1]?Q:`tab`;if(rr(t,s,o))continue;s!==i&&(r=0),i=s;let c=1,l=0,u=o-r;if(r=o,u===0)c=0,l=1;else{let e=Math.abs(u);if(rr(t,s,e))continue;a=ar(s,e)}let d=n.get(a);n.set(a,d===void 0?[1,0]:[d[0]+c,d[1]+l])}}return n}function ar(e,t){return(e===Q?`s`:`t`)+String(t)}function or(e){return{type:e[0]===`s`?Q:`tab`,amount:Number(e.slice(1))}}function sr(e){let t,n=0,r=0;for(let[i,[a,o]]of e)(a>n||a===n&&o>r)&&(n=a,r=o,t=i);return t}function cr(e,t){return(e===Q?` `:` `).repeat(t)}function lr(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);let t=ir(e,!0);t.size===0&&(t=ir(e,!1));let n=sr(t),r,i=0,a=``;return n!==void 0&&({type:r,amount:i}=or(n),a=cr(r,i)),{amount:i,type:r,indent:a}}const ur=/^path$/i,dr={key:`PATH`,value:``};function fr(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!ur.test(t))continue;let n=e[t];return n?{key:t,value:n}:dr}return dr}function pr(e,t){let n=t.value.split(s),r=[],i=typeof e==`string`?e:p(e,{windows:!1}),a;do r.push(f(i,`node_modules`,`.bin`)),a=i,i=c(i);while(i!==a);r.push(c(process.execPath));let o=r.concat(n).join(s);return{key:t.key,value:o}}function mr(e,t,n=!0){let r={...process.env,...t};if(!n)return r;let i=pr(e,fr(r));return r[i.key]=i.value,r}const hr=e=>{let t=e.length,n=new de,r=()=>{--t===0&&n.end()};for(let t of e)ue(t,n,{end:!1}).then(r).catch(r);return n},gr=/([()\][%!^"`<>&|;, *?])/g,_r=/^#!\s*(.+)/,vr=/\.(?:com|exe)$/i,yr=/node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i,br=process.platform===`win32`,xr=[`.EXE`,`.CMD`,`.BAT`,`.COM`],Sr=[``];function Cr(e,t=[],n={}){if(n.shell===!0||!br)return{command:e,args:t,options:n};let r=wr(e,n),i=null;if(r!==null){let e=Buffer.alloc(150),t=null;try{t=ie(r,`r`),ae(t,e,0,150,0)}catch{}finally{t!==null&&ne(t)}let n=e.toString().match(_r);if(n!==null){let e=n[1].trim(),t=e.indexOf(` `),r=t===-1?e:e.slice(0,t),a=t===-1?``:e.slice(t+1),s=o(r);i=s===`env`?a||null:s}}if(i!==null&&r!==null&&(t=[r,...t],e=i,r=wr(e,n)),r===null||!vr.test(r)){let i=r!==null&&yr.test(r);e=u(e),e=e.replace(gr,`^$1`),t=t.map(e=>(e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(gr,`^$1`),i&&(e=e.replace(gr,`^$1`)),e)),t=[`/d`,`/s`,`/c`,`"${[e,...t].join(` `)}"`],e=n.env?.comspec??`cmd.exe`,n={...n,windowsVerbatimArguments:!0}}return{command:e,args:t,options:n}}function wr(e,t){let n=(t.cwd??le()).toString(),r=t.env??process.env,i=fr(r).value,a=e.includes(`/`)||e.includes(`\\`)?[``]:[n,...i.split(s)],o=r.PATHEXT?r.PATHEXT.split(s):xr;e.includes(`.`)&&o[0]!==``&&(o=[``,...o]);for(let t of[o,Sr])for(let r of a){let i=r.startsWith(`"`)&&r.endsWith(`"`)&&r.length>1?r.slice(1,-1):r,a=f(n,i,e);for(let e of t){let t=a+e;try{if(oe(t).isFile())return t}catch{}}}return null}var Tr=class extends Error{result;output;exitCode;get signalCode(){return this.result.signalCode}constructor(e,t,n,r){let i=`The process`;n&&(i=`The command \`${r?.length?`${n} ${r.map(e=>/[ "'`()]/.test(e)?JSON.stringify(e):e).join(` `)}`:n}\``);let a=e.exitCode??1;super(e.signalCode===null?`${i} exited with a non-zero status (${a})`:`${i} was killed by the signal ${e.signalCode}`),this.result=e,this.output=t,this.exitCode=a,Object.defineProperty(this,"result",{enumerable:!1,writable:!1,configurable:!1})}};const Er={timeout:void 0,persist:!1},Dr={windowsHide:!0};function Or(e){let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(),n;n.addEventListener(`abort`,()=>{t.abort(n.reason)},{signal:t.signal})}return t.signal}async function kr(e){let t=``;try{for await(let n of e)t+=n.toString()}catch{}return t}var Ar=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}get signalCode(){return this._process?.signalCode??null}constructor(e,t,n){this._options={...Er,...n},this._command=e,this._args=t??[],this._processClosed=new Promise(e=>{this._resolveClose=e})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,n){return Mr(e,t,{...n,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let n=hr(t),r=fe.createInterface({input:n});for await(let e of r)yield e.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&(this.exitCode!==0&&this.exitCode!==void 0||this.signalCode!==null))throw new Tr(this,void 0,this._command,this._args)}async _waitForOutput(){let e=this._process;if(!e)throw Error(`No process was started`);let[t,n]=await Promise.all([this._streamOut?kr(this._streamOut):``,this._streamErr?kr(this._streamErr):``]);await this._processClosed;let{stdin:r}=this._options;if(r&&typeof r!=`string`&&await r,e.removeAllListeners(),this._thrownError)throw this._thrownError;let i={stderr:n,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&(this.exitCode!==0&&this.exitCode!==void 0||this.signalCode!==null))throw new Tr(this,i,this._command,this._args);return i}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=this._options,t={...Dr,...e.nodeOptions},n=t?.cwd??le(),r=[];this._resetState(),e.timeout!==void 0&&r.push(AbortSignal.timeout(e.timeout)),e.signal!==void 0&&r.push(e.signal),e.persist===!0&&(t.detached=!0),r.length>0&&(t.signal=Or(r)),t.env=mr(n,t.env,e.nodePath);let i=Cr(this._command,this._args,t),a=ce(i.command,i.args,i.options);if(a.stderr&&(this._streamErr=a.stderr),a.stdout&&(this._streamOut=a.stdout),this._process=a,a.once(`error`,this._onError),a.once(`close`,this._onClose),a.stdin){let{stdin:t}=e;typeof t==`string`?a.stdin.end(t):t?.process?.stdout?.pipe(a.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(e=>{this._resolveClose=e}),this._thrownError=void 0}_onError=e=>{e.name===`AbortError`&&(!(e.cause instanceof Error)||e.cause.name!==`TimeoutError`)?this._aborted=!0:this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const jr=(e,t,n)=>{let r=new Ar(e,t,n);return r.spawn(),r},Mr=jr,Nr=/* @__PURE__ */ K({name:/* @__PURE__ */ J(/* @__PURE__ */ G()),dependencies:/* @__PURE__ */ J(/* @__PURE__ */ q(/* @__PURE__ */ G(),/* @__PURE__ */ G())),devDependencies:/* @__PURE__ */ J(/* @__PURE__ */ q(/* @__PURE__ */ G(),/* @__PURE__ */ G())),peerDependencies:/* @__PURE__ */ J(/* @__PURE__ */ q(/* @__PURE__ */ G(),/* @__PURE__ */ G())),packageManager:/* @__PURE__ */ J(/* @__PURE__ */ G())});async function Pr(){return await Yn(await $(),{schema:Nr})}async function $(){let e=await Kn(`package.json`);if(!e)throw new Fr;return e}var Fr=class extends Error{name=`MissingPackageJson`;message=`Could not find a package.json file.`};async function Ir(e){let t=await $(),n=await i(t,`utf8`),r=lr(n).indent||` `,o=JSON.parse(n);e(o);let s=JSON.stringify(o,null,r)+`
|
|
32
|
+
`;await a(t,s)}async function Lr(e){await Ir(t=>{let n={...t.dependencies};for(let[r,i]of Object.entries(e))t.devDependencies?.[r]?t.devDependencies[r]=i:n[r]=i;t.dependencies=Object.fromEntries(Object.entries(n).sort(([e],[t])=>e.localeCompare(t)))})}async function Rr(t){let n=e(await $());try{let{version:e}=n(`${t}/package.json`),r=Number.parseInt(e.split(`.`)[0]);return Number.isNaN(r)?1/0:r}catch{let{dependencies:e,devDependencies:n,peerDependencies:r}=await Pr(),i={...r,...e,...n}[t]??``,a=/^[\^~]?(\d+)/.exec(i)?.[1];return a?Number(a):1/0}}function zr(e,t){let n={...e.dependencies,...e.devDependencies},r={...t.dependencies,...t.devDependencies},i=e=>/\d+/.exec(e)?.[0];return Object.entries(r).filter(([e,t])=>{let r=e in n?i(n[e]):void 0;return r!==void 0&&r!==i(t)}).map(([e,t])=>({name:e,from:n[e],to:t}))}async function Br(e){await Ir(t=>{for(let n of[`dependencies`,`devDependencies`,`peerDependencies`]){let r=t[n];if(r)for(let t of e)delete r[t]}})}async function Vr(e){await Ir(t=>{t.name=e})}async function Hr(e){let{version:t}=await Y(new URL(`${e}/latest`,`https://registry.npmjs.org/`),{schema:/* @__PURE__ */ K({version:/* @__PURE__ */ G()})});return t}const Ur={npm:[`npm`,`install`],yarn:[`yarn`,`install`],pnpm:[`pnpm`,`install`],bun:[`bun`,`install`]};async function Wr(){return Ur[await qr()].join(` `)}async function Gr(){let e=await $(),t=new URL(`.`,e),n=await qr(),[r,...i]=Ur[n];await jr(r,i,{nodeOptions:{cwd:p(t),stdio:`inherit`},throwOnError:!0})}const Kr={"bun.lock":`bun`,"bun.lockb":`bun`,"pnpm-lock.yaml":`pnpm`,"yarn.lock":`yarn`,"package-lock.json":`npm`};async function qr(){let e=await Jr();if(e)return e;let t=await $();for(let e in Kr){let n=Kr[e];if(await Z(new URL(e,t)))return n}return`npm`}async function Jr(){try{let e=await Pr();if(!e.packageManager)return;let t=e.packageManager.split(`@`)[0];return t in Ur?t:void 0}catch{return}}export{vn as $,Y as A,ln as B,Hn as C,X as D,Un as E,on as F,En as G,an as H,jn as I,K as J,Dn as K,kn as L,zn as M,In as N,Gn as O,Ln as P,Pn as Q,xn as R,Jn as S,Bn as T,Cn as U,gn as V,hn as W,q as X,J as Y,G as Z,Yn as _,Rr as a,Ze as at,er as b,Gr as c,Vr as d,dn as et,jr as f,Qn as g,Kn as h,Wr as i,F as it,Fn as j,Vn as k,Pr as l,Z as m,Lr as n,Xt as nt,zr as o,Ye as ot,tr as p,sn as q,$ as r,$t as rt,Hr as s,Fr as t,rn as tt,Br as u,Zn as v,Wn as w,qn as x,$n as y,pn as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./package-
|
|
1
|
+
import{n as e,t}from"./package-DZJSt_MI.mjs";import{fileURLToPath as n}from"node:url";import{spawn as r}from"node:child_process";const i=[],a=[];let o,s;function c(e){let{writeKey:t}=e;o=e.anonymousId,s=e.userId,process.on(`exit`,()=>d({writeKey:t}))}function l(n){s=n.userId,a.push({userId:n.userId,anonymousId:o,integrations:{Intercom:{user_hash:n.intercomHash}},context:{app:{name:t,version:e}},timestamp:(/* @__PURE__ */ new Date()).toISOString()})}function u(n,r={}){let{properties:a,groupId:c}=r;i.push({event:n,properties:{nodeVersion:process.versions.node,os:process.platform,...a},context:{app:{name:t,version:e},groupId:c},userId:s,anonymousId:o,timestamp:(/* @__PURE__ */ new Date()).toISOString()})}function d(e){let{writeKey:t}=e;if(i.length!==0||a.length!==0){try{let e=Buffer.from(JSON.stringify({trackEvents:i.map(e=>({...e,userId:e.userId||s})),identifyEvents:a,writeKey:t})).toString(`base64`),o=n(new URL(`./subprocesses/sendSegmentEvents.mjs`,import.meta.url));r(process.execPath,[o,e],{detached:!0,stdio:`ignore`}).unref()}catch{}i.length=0,a.length=0}}async function f(e,t,n){let r={"Content-Type":`application/json`,Authorization:`Basic ${btoa(n+`:`)}`};await Promise.allSettled([...e.map(e=>fetch(`https://api.segment.io/v1/track`,{method:`POST`,headers:r,body:JSON.stringify(e)}).catch(()=>{})),...t.map(e=>fetch(`https://api.segment.io/v1/identify`,{method:`POST`,headers:r,body:JSON.stringify(e)}).catch(()=>{}))])}export{l as i,f as n,u as r,c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../segment-
|
|
1
|
+
import{n as e}from"../segment-BpOvsf06.mjs";const{trackEvents:t,identifyEvents:n,writeKey:r}=JSON.parse(Buffer.from(process.argv[2],`base64`).toString());try{await e(t,n,r)}catch{}export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../update-notifier-
|
|
1
|
+
import{n as e}from"../update-notifier-B86qEI1j.mjs";const[t,n]=process.argv.slice(2);try{await e(t,new URL(n))}catch{}export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as SvelteKitAdapter}from"./sveltekit-D7e5u5rg.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$t as e,
|
|
1
|
+
import{$t as e,_ as t,_n as n,d as r,en as i,s as a,t as o,u as s,x as c}from"./adapters-DWhQeyDo.mjs";import{S as l,m as u,n as d,s as f}from"./packageJson-BEVwXn1i.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:t}){return t?e`
|
|
2
2
|
import { createClient as baseCreateClient } from "@prismicio/client";
|
|
3
3
|
import { type CreateClientConfig, enableAutoPreviews } from '@prismicio/svelte/kit';
|
|
4
4
|
import { PUBLIC_PRISMIC_ENVIRONMENT } from '$app/env/public';
|
|
@@ -26,7 +26,7 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
26
26
|
|
|
27
27
|
return client;
|
|
28
28
|
};
|
|
29
|
-
`:
|
|
29
|
+
`:e`
|
|
30
30
|
import { createClient as baseCreateClient } from "@prismicio/client";
|
|
31
31
|
import { enableAutoPreviews } from '@prismicio/svelte/kit';
|
|
32
32
|
import { PUBLIC_PRISMIC_ENVIRONMENT } from '$app/env/public';
|
|
@@ -54,19 +54,19 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
54
54
|
|
|
55
55
|
return client;
|
|
56
56
|
};
|
|
57
|
-
`}function T(){return
|
|
57
|
+
`}function T(){return e`
|
|
58
58
|
PUBLIC_PRISMIC_ENVIRONMENT: {
|
|
59
59
|
public: true,
|
|
60
60
|
schema: (value) => value,
|
|
61
61
|
description: "The Prismic environment to use instead of the production repository.",
|
|
62
62
|
},
|
|
63
|
-
`}function E(){return
|
|
63
|
+
`}function E(){return e`
|
|
64
64
|
import { defineEnvVars } from "@sveltejs/kit/env";
|
|
65
65
|
|
|
66
66
|
export const variables = defineEnvVars({
|
|
67
67
|
${T()}
|
|
68
68
|
});
|
|
69
|
-
`}function D({extension:
|
|
69
|
+
`}function D({extension:t}){return e(v||=p([`
|
|
70
70
|
<script>
|
|
71
71
|
import { SliceSimulator, SliceZone } from '@prismicio/svelte';
|
|
72
72
|
import { components } from '#lib/slices/index.`,`';
|
|
@@ -77,7 +77,7 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
77
77
|
<SliceZone {slices} {components} />
|
|
78
78
|
{/snippet}
|
|
79
79
|
</SliceSimulator>
|
|
80
|
-
`]),
|
|
80
|
+
`]),t)}function O({typescript:t}){return t?e`
|
|
81
81
|
import { redirectToPreviewURL } from '@prismicio/svelte/kit';
|
|
82
82
|
import { createClient } from '#lib/prismicio.ts';
|
|
83
83
|
import type { RequestHandler } from "./$types";
|
|
@@ -87,7 +87,7 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
87
87
|
|
|
88
88
|
return await redirectToPreviewURL({ client, request, cookies });
|
|
89
89
|
}
|
|
90
|
-
`:
|
|
90
|
+
`:e`
|
|
91
91
|
import { redirectToPreviewURL } from '@prismicio/svelte/kit';
|
|
92
92
|
import { createClient } from '#lib/prismicio.js';
|
|
93
93
|
|
|
@@ -97,15 +97,15 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
97
97
|
|
|
98
98
|
return await redirectToPreviewURL({ client, request, cookies });
|
|
99
99
|
}
|
|
100
|
-
`}function k({extension:
|
|
101
|
-
import { repositoryName } from "#lib/prismicio.${
|
|
100
|
+
`}function k({extension:t}){return e`
|
|
101
|
+
import { repositoryName } from "#lib/prismicio.${t}";
|
|
102
102
|
|
|
103
103
|
export const prerender = "auto";
|
|
104
104
|
|
|
105
105
|
export function load() {
|
|
106
106
|
return { repositoryName };
|
|
107
107
|
}
|
|
108
|
-
`}function A(){return
|
|
108
|
+
`}function A(){return e(y||=p([`
|
|
109
109
|
<script>
|
|
110
110
|
import { isFilled, asImageSrc } from '@prismicio/client';
|
|
111
111
|
import { PrismicPreview } from '@prismicio/svelte/kit';
|
|
@@ -127,7 +127,7 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
127
127
|
</svelte:head>
|
|
128
128
|
{@render children()}
|
|
129
129
|
<PrismicPreview repositoryName={data.repositoryName} />
|
|
130
|
-
`]))}function j({typescript:
|
|
130
|
+
`]))}function j({typescript:t}){return e(t?b||=p([`
|
|
131
131
|
<script lang="ts">
|
|
132
132
|
import { SliceZone } from "@prismicio/svelte";
|
|
133
133
|
import { components } from "#lib/slices/index.ts";
|
|
@@ -146,53 +146,53 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
146
146
|
<\/script>
|
|
147
147
|
|
|
148
148
|
<SliceZone slices={data.page.data.slices} {components} />
|
|
149
|
-
`]))}function M({model:
|
|
149
|
+
`]))}function M({model:t,typescript:n}){return t.repeatable?n?e`
|
|
150
150
|
import type { PageServerLoad } from "./$types";
|
|
151
151
|
import { createClient } from "#lib/prismicio.ts";
|
|
152
152
|
|
|
153
153
|
export const load: PageServerLoad = async ({ params, fetch, cookies }) => {
|
|
154
154
|
const client = createClient({ fetch, cookies });
|
|
155
|
-
const page = await client.getByUID("${
|
|
155
|
+
const page = await client.getByUID("${t.id}", params.uid);
|
|
156
156
|
|
|
157
157
|
return { page };
|
|
158
158
|
};
|
|
159
|
-
`:
|
|
159
|
+
`:e`
|
|
160
160
|
import { createClient } from "#lib/prismicio.js";
|
|
161
161
|
|
|
162
162
|
/** @type {import("./$types").PageServerLoad} */
|
|
163
163
|
export async function load({ params, fetch, cookies }) {
|
|
164
164
|
const client = createClient({ fetch, cookies });
|
|
165
|
-
const page = await client.getByUID("${
|
|
165
|
+
const page = await client.getByUID("${t.id}", params.uid);
|
|
166
166
|
|
|
167
167
|
return { page };
|
|
168
168
|
}
|
|
169
|
-
`:n?
|
|
169
|
+
`:n?e`
|
|
170
170
|
import type { PageServerLoad } from "./$types";
|
|
171
171
|
import { createClient } from "#lib/prismicio.ts";
|
|
172
172
|
|
|
173
173
|
export const load: PageServerLoad = async ({ fetch, cookies }) => {
|
|
174
174
|
const client = createClient({ fetch, cookies });
|
|
175
|
-
const page = await client.getSingle("${
|
|
175
|
+
const page = await client.getSingle("${t.id}");
|
|
176
176
|
|
|
177
177
|
return { page };
|
|
178
178
|
};
|
|
179
|
-
`:
|
|
179
|
+
`:e`
|
|
180
180
|
import { createClient } from "#lib/prismicio.js";
|
|
181
181
|
|
|
182
182
|
/* @type {import("./$types").PageServerLoad} */
|
|
183
183
|
export async function load({ fetch, cookies }) {
|
|
184
184
|
const client = createClient({ fetch, cookies });
|
|
185
|
-
const page = await client.getSingle("${
|
|
185
|
+
const page = await client.getSingle("${t.id}");
|
|
186
186
|
|
|
187
187
|
return { page };
|
|
188
188
|
}
|
|
189
|
-
`}const N=
|
|
189
|
+
`}const N=e`
|
|
190
190
|
<section data-slice-type={slice.slice_type} data-slice-variation={slice.variation}>
|
|
191
191
|
Placeholder component for {slice.slice_type} (variation: {slice.variation}) slices.
|
|
192
192
|
<br />
|
|
193
193
|
<strong>You can edit this slice directly in your code editor.</strong>
|
|
194
194
|
</section>
|
|
195
|
-
`;function P({name:
|
|
195
|
+
`;function P({name:t,typescript:r}){let i=n(t);return e(r?S||=p([`
|
|
196
196
|
<script lang="ts">
|
|
197
197
|
import type { Content } from '@prismicio/client';
|
|
198
198
|
import type { SliceComponentProps } from '@prismicio/svelte';
|
|
@@ -213,11 +213,11 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
213
213
|
<\/script>
|
|
214
214
|
|
|
215
215
|
`,`
|
|
216
|
-
`]),
|
|
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 t();await r(new URL(`src/lib/prismicio.${i}`,n),w({typescript:a})),await z(`src/env`)||await l(new URL(`src/env.${i}`,n),E()),await r(new URL(`src/routes/slice-simulator/+page.svelte`,n),D({extension:i})),await r(new URL(`src/params/preview.${i}`,n),e`
|
|
217
217
|
export function match(param) {
|
|
218
218
|
return param === 'preview';
|
|
219
219
|
}
|
|
220
|
-
`),await r(new URL(`src/routes/api/preview/+server.${i}`,
|
|
220
|
+
`),await r(new URL(`src/routes/api/preview/+server.${i}`,n),O({typescript:a})),await r(new URL(`src/routes/[[preview=preview]]/README.md`,n),e`
|
|
221
221
|
This directory adds support for optional \`/preview\` routes. Do not remove this directory.
|
|
222
222
|
|
|
223
223
|
All routes within this directory will be served using the following URLs:
|
|
@@ -226,7 +226,7 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
226
226
|
- \`/preview/example-route\` (server-rendered)
|
|
227
227
|
|
|
228
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}`,
|
|
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 r(new URL(`src/routes/+layout.svelte`,n),A()),await R()}async getSetupInstructions(){let t=await c(),n=await u(new URL(`src/routes/+page.svelte`,t))&&await u(new URL(`src/routes/[[preview=preview]]/+page.svelte`,t))&&e`
|
|
230
230
|
Action required: delete src/routes/+page.svelte.
|
|
231
231
|
|
|
232
232
|
It also serves / and hides your Prismic home page in
|
|
@@ -234,14 +234,14 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
234
234
|
from it first.
|
|
235
235
|
`;return[await this.getEnvStep(),await this.getPreviewStep(),n].filter(Boolean).join(`
|
|
236
236
|
|
|
237
|
-
`)||void 0}async getEnvStep(){let
|
|
238
|
-
Action required: add PUBLIC_PRISMIC_ENVIRONMENT to ${
|
|
237
|
+
`)||void 0}async getEnvStep(){let t=await z(`src/env`);if(t&&!(await m(new URL(t,await c()),`utf8`)).includes(`PUBLIC_PRISMIC_ENVIRONMENT`))return e`
|
|
238
|
+
Action required: add PUBLIC_PRISMIC_ENVIRONMENT to ${t}.
|
|
239
239
|
|
|
240
240
|
Your project does not build until you do this. Add these lines to
|
|
241
241
|
defineEnvVars({ ... }):
|
|
242
242
|
|
|
243
243
|
${T().replace(/^/gm,` `)}
|
|
244
|
-
`}async getPreviewStep(){if(await a(`PrismicPreview`))return;let
|
|
244
|
+
`}async getPreviewStep(){if(await a(`PrismicPreview`))return;let t=await z(`src/routes/+layout.server`)??`src/routes/+layout.server.${await s()}`,n=!(await m(new URL(t,await c()),`utf8`).catch(()=>``)).includes(`repositoryName`)&&`Return repositoryName from load in ${t}, creating the file if needed:\n\n${k({extension:t.split(`.`).pop()}).replace(/^/gm,` `)}`;return[e(F||=p([`
|
|
245
245
|
Action required: add <PrismicPreview> to your root layout.
|
|
246
246
|
|
|
247
247
|
Previews do not work until you do this, and the CLI cannot edit your
|
|
@@ -260,7 +260,7 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
260
260
|
+ <PrismicPreview repositoryName={data.repositoryName} />
|
|
261
261
|
`])),n,"Run `prismic docs view sveltekit` for details."].filter(Boolean).join(`
|
|
262
262
|
|
|
263
|
-
`)}async createSliceIndexFile(
|
|
263
|
+
`)}async createSliceIndexFile(t){let r=(await this.getSlices()).filter(e=>e.library.href===t.href),a=r.map(e=>{let r=g(_(t),_(e.directory));return`import ${n(e.model.name)} from "./${r}/index.svelte";`}),o=r.map(e=>`${i(e.model.id)}: ${n(e.model.name)}`),c=e`
|
|
264
264
|
// Code generated by Prismic. DO NOT EDIT.
|
|
265
265
|
|
|
266
266
|
${a.join(`
|
|
@@ -270,4 +270,4 @@ import{$t as e,Qt as t,_ as n,d as r,gn as i,s as a,t as o,u as s,x as c}from"./
|
|
|
270
270
|
${o.join(`,
|
|
271
271
|
`)}
|
|
272
272
|
};
|
|
273
|
-
`;await l(new URL(`index.${await s()}`,
|
|
273
|
+
`;await l(new URL(`index.${await s()}`,t),c)}async getDefaultSliceLibrary(){return new URL(`src/lib/slices/`,await c())}async createSliceComponent(e,n){let r=P({name:e.name,typescript:await t()});await l(new URL(`index.svelte`,n),r)}async getPageFiles(e,n){let r=new URL(`src/routes/[[preview=preview]]/${n}/`,await c()),i=await t();return[{path:new URL(`+page.svelte`,r),contents:j({typescript:i})},{path:new URL(`+page.server.${await s()}`,r),contents:M({model:e,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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{$t as e,_ as t,d as n,s as r,u as i,x as a}from"./adapters-DWhQeyDo.mjs";import{S as o,m as s,n as c,s as l}from"./packageJson-BEVwXn1i.mjs";import{a as u,c as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v}from"./sveltekit-D7e5u5rg.mjs";import{t as y}from"./taggedTemplateLiteral-DygvE_Ih.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 d({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 e(x||=y([`
|
|
2
2
|
<script>
|
|
3
3
|
import { SliceSimulator, SliceZone } from '@prismicio/svelte';
|
|
4
4
|
import { components } from '$lib/slices';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./package-
|
|
1
|
+
import{n as e}from"./package-DZJSt_MI.mjs";import{S as t,W as n,Y as r,Z as i,_ as a,p as o,q as s,s as c}from"./packageJson-BEVwXn1i.mjs";import{fileURLToPath as l}from"node:url";import{spawn as u}from"node:child_process";const d=n({latestKnownVersion:r(i()),lastUpdateCheckAt:r(s())});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,n){let r=await c(e);await t(n,o({latestKnownVersion:r,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.30.0",
|
|
4
4
|
"description": "Prismic's official command line tool",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prismic",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@napi-rs/keyring": "^2.1.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@anthropic-ai/claude-agent-sdk": "^0.3.
|
|
43
|
-
"@openai/codex-sdk": "^0.
|
|
42
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.325",
|
|
43
|
+
"@openai/codex-sdk": "^0.169.0",
|
|
44
44
|
"@prismicio/types-internal": "4.7.0",
|
|
45
45
|
"@types/node": "26.6.6",
|
|
46
46
|
"change-case": "5.4.4",
|