prismic 1.6.1-pr.167.848e261 → 1.6.1-pr.167.9bc8f2f

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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h as d,i as f,l as p,m,n as h,o as g,s as _,t as ee,u as v,v as y,w as b,y as te}from"./string-CZzaGI5e.mjs";import{n as ne,t as re}from"./package-BM0VY0Z3.mjs";import{_ as ie,a as ae,c as oe,d as se,f as ce,i as le,l as ue,n as de,p as x,r as S,s as fe,u as C}from"./schemas-CyhgtjZl.mjs";import{a as w,f as pe,i as T,m as me,n as E,o as D,p as he,r as ge,t as _e,u as ve}from"./request-DClMWmnH.mjs";import{a as ye,s as be}from"./packageJson-BNFJTFZF.mjs";import{n as xe,t as Se}from"./env-DbZx_TgQ.mjs";import{a as Ce,c as we,i as O,n as Te,r as k,s as Ee,t as De}from"./auth-IehtWQjS.mjs";import{a as Oe,i as A,n as ke,r as Ae,t as je}from"./segment-B-S9hUWo.mjs";import{t as Me}from"./update-notifier-DRnj_qgr.mjs";import*as Ne from"node:util";import{parseArgs as Pe,promisify as Fe}from"node:util";import{fileURLToPath as Ie,pathToFileURL as Le}from"node:url";import{createHash as Re}from"node:crypto";import{dirname as ze,join as Be,posix as Ve,sep as He}from"node:path";import{exec as Ue,execFile as We}from"node:child_process";import{Readable as Ge}from"node:stream";import{createInterface as Ke}from"node:readline";import*as qe from"node:http";import*as j from"node:os";import{setTimeout as Je}from"node:timers/promises";import{isMainThread as Ye,threadId as Xe}from"worker_threads";import*as Ze from"node:diagnostics_channel";import{subscribe as Qe}from"node:diagnostics_channel";import{createReadStream as $e,existsSync as et,readFile as tt,readFileSync as nt,readdir as rt}from"node:fs";import{Worker as it}from"node:worker_threads";import*as at from"node:https";import{createGzip as ot}from"node:zlib";import*as st from"node:net";import*as ct from"node:tls";import{AsyncLocalStorage as lt}from"node:async_hooks";function M(e,t){return async function(){let{positionals:n={},options:r={}}=e,i=e.name.split(` `).length,a=process.argv.slice(1+i),o=Object.keys(n).length>0,s=Pe({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(ut(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new P(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new P(`Missing required option: --${e}`);await t(s)}}function ut(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[ee(t)];o.push(``),o.push(`USAGE`);let s=` ${e.name}`;if(a.length>0&&(s+=` `+a.map(e=>`<${e}>`).join(` `)),s+=` [options]`,o.push(s),a.length>0){o.push(``),o.push(`ARGUMENTS`);let e=[];for(let t in r){let n=r[t],i=n.description+(n.required?` (required)`:``);e.push([` <${t}>`,i])}o.push(h(e))}o.push(``),o.push(`OPTIONS`);let c=[];if(i){let e=Object.keys(i);for(let t of e){let e=i[t],n=`${e.short?`-${e.short}, `:` `}--${t}${e.type===`string`?` string`:``}`,r=e.description+(e.required?` (required)`:``);c.push({left:n,description:r})}}c.push({left:`-h, --help`,description:`Show help for command`});let l=c.map(e=>[` ${e.left}`,e.description]);if(o.push(h(l)),n)for(let e in n){let t=ee(n[e]);o.push(``),o.push(e);for(let e of t.split(`
2
+ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h as d,i as f,l as p,m,n as h,o as g,s as _,t as ee,u as v,v as y,w as b,y as te}from"./string-CZzaGI5e.mjs";import{n as ne,t as re}from"./package-CcYrcl2G.mjs";import{_ as ie,a as ae,c as oe,d as se,f as ce,i as le,l as ue,n as de,p as x,r as S,s as fe,u as C}from"./schemas-CyhgtjZl.mjs";import{a as w,f as pe,i as T,m as me,n as E,o as D,p as he,r as ge,t as _e,u as ve}from"./request-DClMWmnH.mjs";import{a as ye,s as be}from"./packageJson-BNFJTFZF.mjs";import{n as xe,t as Se}from"./env-DbZx_TgQ.mjs";import{a as Ce,c as we,i as O,n as Te,r as k,s as Ee,t as De}from"./auth-IehtWQjS.mjs";import{a as Oe,i as A,n as ke,r as Ae,t as je}from"./segment-3VN9f-fz.mjs";import{t as Me}from"./update-notifier-CAEkNAPx.mjs";import*as Ne from"node:util";import{parseArgs as Pe,promisify as Fe}from"node:util";import{fileURLToPath as Ie,pathToFileURL as Le}from"node:url";import{createHash as Re}from"node:crypto";import{dirname as ze,join as Be,posix as Ve,sep as He}from"node:path";import{exec as Ue,execFile as We}from"node:child_process";import{Readable as Ge}from"node:stream";import{createInterface as Ke}from"node:readline";import*as qe from"node:http";import*as j from"node:os";import{setTimeout as Je}from"node:timers/promises";import{isMainThread as Ye,threadId as Xe}from"worker_threads";import*as Ze from"node:diagnostics_channel";import{subscribe as Qe}from"node:diagnostics_channel";import{createReadStream as $e,existsSync as et,readFile as tt,readFileSync as nt,readdir as rt}from"node:fs";import{Worker as it}from"node:worker_threads";import*as at from"node:https";import{createGzip as ot}from"node:zlib";import*as st from"node:net";import*as ct from"node:tls";import{AsyncLocalStorage as lt}from"node:async_hooks";function M(e,t){return async function(){let{positionals:n={},options:r={}}=e,i=e.name.split(` `).length,a=process.argv.slice(1+i),o=Object.keys(n).length>0,s=Pe({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(ut(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new P(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new P(`Missing required option: --${e}`);await t(s)}}function ut(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[ee(t)];o.push(``),o.push(`USAGE`);let s=` ${e.name}`;if(a.length>0&&(s+=` `+a.map(e=>`<${e}>`).join(` `)),s+=` [options]`,o.push(s),a.length>0){o.push(``),o.push(`ARGUMENTS`);let e=[];for(let t in r){let n=r[t],i=n.description+(n.required?` (required)`:``);e.push([` <${t}>`,i])}o.push(h(e))}o.push(``),o.push(`OPTIONS`);let c=[];if(i){let e=Object.keys(i);for(let t of e){let e=i[t],n=`${e.short?`-${e.short}, `:` `}--${t}${e.type===`string`?` string`:``}`,r=e.description+(e.required?` (required)`:``);c.push({left:n,description:r})}}c.push({left:`-h, --help`,description:`Show help for command`});let l=c.map(e=>[` ${e.left}`,e.description]);if(o.push(h(l)),n)for(let e in n){let t=ee(n[e]);o.push(``),o.push(e);for(let e of t.split(`
3
3
  `))o.push(e?` ${e}`:``)}o.push(``),o.push(`LEARN MORE`);let u=e.name.split(` `)[0];return o.push(` Use \`${u} <command> --help\` for more information about a command.`),o.join(`
4
4
  `)}function N(e){let t=e.name.split(` `).length;return async function(){let{positionals:[n]}=Pe({args:process.argv.slice(1+t),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1}),r=n?e.commands[n]:void 0;if(r){await r.handler();return}if(n)throw new P(`Unknown command: ${n}`);console.info(dt(e))}}function dt(e){let{name:t,description:n,sections:r,commands:i}=e,a=[n];a.push(``),a.push(`USAGE`),a.push(` ${t} <command> [options]`),a.push(``),a.push(`COMMANDS`);let o=Object.entries(i).map(([e,t])=>[` ${e}`,t.description]);if(a.push(h(o)),a.push(``),a.push(`OPTIONS`),a.push(` -h, --help Show help for command`),r)for(let e in r){let t=ee(r[e]);a.push(``),a.push(e);for(let e of t.split(`
5
5
  `))a.push(e?` ${e}`:``)}return a.push(``),a.push(`LEARN MORE`),a.push(` Use \`${t} <command> --help\` for more information about a command.`),a.join(`
@@ -214,7 +214,7 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
214
214
 
215
215
  Reports what would be pushed to or pulled from Prismic, plus any local
216
216
  model files with uncommitted git changes that would block pull and push.
217
- `,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n}=e,i=await O(),s=await k(),c=await o(),l=await u(),[d,f,p,m,h]=await Promise.all([Dr(l),c.getCustomTypeLibraries(),c.getSliceLibraries(),c.getCustomTypes(),c.getSlices()]),g=t,_,v,y;if(i){n&&(g=await Er({env:n,repo:t,token:i,host:s}));let[e,a,o]=await Promise.all([r({token:i,host:s}),cn({repo:g,token:i,host:s}),fn({repo:g,token:i,host:s})]);_=e.email,v=z(m.map(e=>e.model),a,{getKey:e=>e.id}),y=z(h.map(e=>e.model),o,{getKey:e=>e.id})}let b=[];d&&(b=(await Or(d)).filter(e=>e.pathname.endsWith(`/model.json`)&&p.some(t=>he(t,e))||e.pathname.endsWith(`/index.json`)&&f.some(t=>he(t,e))).map(e=>me(l,e))),console.info(`Repository: ${t}`),n&&console.info(`Environment: ${n}`),_?console.info(`Authenticated as: ${_}`):console.info("Not logged in — log in with `prismic login` to compare with remote.");let te=v!==void 0&&y!==void 0&&v.insert.length===0&&v.update.length===0&&v.delete.length===0&&y.insert.length===0&&y.update.length===0&&y.delete.length===0;if(te&&b.length===0){console.info(``),console.info(`Already up to date.`);return}if(v&&y){let e=[],t=[...v.insert.map(e=>` ${e.id} (custom type)`),...y.insert.map(e=>` ${e.id} (slice)`)];t.length>0&&e.push([`Local-only:`,...t]);let n=[...v.delete.map(e=>` ${e.id} (custom type)`),...y.delete.map(e=>` ${e.id} (slice)`)];n.length>0&&e.push([`Remote-only:`,...n]);let r=[...v.update.map(e=>` ${e.id} (custom type)`),...y.update.map(e=>` ${e.id} (slice)`)];r.length>0&&e.push([`Differ:`,...r]);for(let t of e){console.info(``);for(let e of t)console.info(e)}}if(b.length>0&&(console.info(``),console.info(ee`
217
+ `,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n}=e,i=await O(),s=await k(),c=await o(),l=await u(),[d,f,p,m,h]=await Promise.all([Dr(l),c.getCustomTypeLibraries(),c.getSliceLibraries(),c.getCustomTypes(),c.getSlices()]),g=t,_,v,y;if(i){n&&(g=await Er({env:n,repo:t,token:i,host:s}));let[e,a,o]=await Promise.all([r({token:i,host:s}),cn({repo:g,token:i,host:s}),fn({repo:g,token:i,host:s})]);_=e.email,v=z(m.map(e=>e.model),a,{getKey:e=>e.id}),y=z(h.map(e=>e.model),o,{getKey:e=>e.id})}let b=[];d&&(b=(await Or(d)).filter(e=>e.pathname.endsWith(`/model.json`)&&p.some(t=>he(t,e))||e.pathname.endsWith(`/index.json`)&&f.some(t=>he(t,e))).map(e=>me(l,e))),console.info(`Repository: ${t}`),n&&console.info(`Environment: ${n}`),_?console.info(`Authenticated as: ${_}`):(console.info("Not logged in — log in with `prismic login` to compare with remote."),n&&console.info(`Environment flag ignored — log in to use --env.`));let te=v!==void 0&&y!==void 0&&v.insert.length===0&&v.update.length===0&&v.delete.length===0&&y.insert.length===0&&y.update.length===0&&y.delete.length===0;if(te&&b.length===0){console.info(``),console.info(`Already up to date.`);return}if(v&&y){let e=[],t=[...v.insert.map(e=>` ${e.id} (custom type)`),...y.insert.map(e=>` ${e.id} (slice)`)];t.length>0&&e.push([`Local-only:`,...t]);let n=[...v.delete.map(e=>` ${e.id} (custom type)`),...y.delete.map(e=>` ${e.id} (slice)`)];n.length>0&&e.push([`Remote-only:`,...n]);let r=[...v.update.map(e=>` ${e.id} (custom type)`),...y.update.map(e=>` ${e.id} (slice)`)];r.length>0&&e.push([`Differ:`,...r]);for(let t of e){console.info(``);for(let e of t)console.info(e)}}if(b.length>0&&(console.info(``),console.info(ee`
218
218
  Pull and push won't run while these model files have uncommitted git changes:
219
219
  ${b.join(`
220
220
  `)}
@@ -0,0 +1 @@
1
+ var e=`prismic`,t=`1.6.1-pr.167.9bc8f2f`;export{t as n,e as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./package-BM0VY0Z3.mjs";import{n}from"./env-DbZx_TgQ.mjs";import{readFile as r}from"node:fs/promises";import{fileURLToPath as i}from"node:url";import{randomUUID as a}from"node:crypto";import{join as o}from"node:path";import{spawn as s}from"node:child_process";import{homedir as c}from"node:os";const l=process.env.PRISMIC_ENV&&process.env.PRISMIC_ENV!==`production`?`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`:`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`;let u=!1,d=``,f,p;const m={app:{name:t,version:e}},h=[],g=[];async function _(){try{if(n.TEST||(u=await T(),!u))return;d=a(),process.on(`exit`,C)}catch{u=!1}}function v(e,t={}){if(!u)return;let{repository:n=p,watch:r}=t,i={commandType:e,fullCommand:process.argv.join(` `)};n&&(i.repository=n),r!==void 0&&(i.watch=r),h.push({event:`Prismic CLI Start`,properties:i,context:S(n)})}function y(e,t={}){if(!u)return;let{success:n=!process.exitCode,error:r,repository:i=p,watch:a}=t,o={commandType:e,fullCommand:process.argv.join(` `),success:n};i&&(o.repository=i),a!==void 0&&(o.watch=a),r!==void 0&&(o.error=(r instanceof Error?r.message:String(r)).slice(0,512)),h.push({event:`Prismic CLI End`,properties:o,context:S(i)})}function b(e){u&&(f=e.shortId,g.push({userId:f,anonymousId:d,integrations:{Intercom:{user_hash:e.intercomHash}},context:m,timestamp:new Date().toISOString()}))}function x(e){p=e}function S(e){let t={...m};return e&&(t.groupId={Repository:e}),t}function C(){if(!(h.length===0&&g.length===0)){try{let e=Buffer.from(JSON.stringify({trackEvents:h.map(e=>({...f?{userId:f}:{},anonymousId:d,event:e.event,properties:{nodeVersion:process.versions.node,...e.properties},context:e.context,timestamp:new Date().toISOString()})),identifyEvents:g})).toString(`base64`),t=i(new URL(`./subprocesses/sendSegmentEvents.mjs`,import.meta.url));s(process.execPath,[t,e],{detached:!0,stdio:`ignore`}).unref()}catch{}h.length=0,g.length=0}}async function w(e,t){let n={"Content-Type":`application/json`,Authorization:`Basic ${btoa(l+`:`)}`};await Promise.allSettled([...e.map(e=>fetch(`https://api.segment.io/v1/track`,{method:`POST`,headers:n,body:JSON.stringify(e)}).catch(()=>{})),...t.map(e=>fetch(`https://api.segment.io/v1/identify`,{method:`POST`,headers:n,body:JSON.stringify(e)}).catch(()=>{}))])}async function T(){try{return!((await E(o(c(),`.prismicrc`)))?.telemetry===!1||(await E(o(process.cwd(),`.prismicrc`)))?.telemetry===!1)}catch{return!0}}async function E(e){try{let t=await r(e,`utf8`);return JSON.parse(t)}catch{return}}export{v as a,y as i,b as n,w as o,x as r,_ as t};
1
+ import{n as e,t}from"./package-CcYrcl2G.mjs";import{n}from"./env-DbZx_TgQ.mjs";import{readFile as r}from"node:fs/promises";import{fileURLToPath as i}from"node:url";import{randomUUID as a}from"node:crypto";import{join as o}from"node:path";import{spawn as s}from"node:child_process";import{homedir as c}from"node:os";const l=process.env.PRISMIC_ENV&&process.env.PRISMIC_ENV!==`production`?`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`:`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`;let u=!1,d=``,f,p;const m={app:{name:t,version:e}},h=[],g=[];async function _(){try{if(n.TEST||(u=await T(),!u))return;d=a(),process.on(`exit`,C)}catch{u=!1}}function v(e,t={}){if(!u)return;let{repository:n=p,watch:r}=t,i={commandType:e,fullCommand:process.argv.join(` `)};n&&(i.repository=n),r!==void 0&&(i.watch=r),h.push({event:`Prismic CLI Start`,properties:i,context:S(n)})}function y(e,t={}){if(!u)return;let{success:n=!process.exitCode,error:r,repository:i=p,watch:a}=t,o={commandType:e,fullCommand:process.argv.join(` `),success:n};i&&(o.repository=i),a!==void 0&&(o.watch=a),r!==void 0&&(o.error=(r instanceof Error?r.message:String(r)).slice(0,512)),h.push({event:`Prismic CLI End`,properties:o,context:S(i)})}function b(e){u&&(f=e.shortId,g.push({userId:f,anonymousId:d,integrations:{Intercom:{user_hash:e.intercomHash}},context:m,timestamp:new Date().toISOString()}))}function x(e){p=e}function S(e){let t={...m};return e&&(t.groupId={Repository:e}),t}function C(){if(!(h.length===0&&g.length===0)){try{let e=Buffer.from(JSON.stringify({trackEvents:h.map(e=>({...f?{userId:f}:{},anonymousId:d,event:e.event,properties:{nodeVersion:process.versions.node,...e.properties},context:e.context,timestamp:new Date().toISOString()})),identifyEvents:g})).toString(`base64`),t=i(new URL(`./subprocesses/sendSegmentEvents.mjs`,import.meta.url));s(process.execPath,[t,e],{detached:!0,stdio:`ignore`}).unref()}catch{}h.length=0,g.length=0}}async function w(e,t){let n={"Content-Type":`application/json`,Authorization:`Basic ${btoa(l+`:`)}`};await Promise.allSettled([...e.map(e=>fetch(`https://api.segment.io/v1/track`,{method:`POST`,headers:n,body:JSON.stringify(e)}).catch(()=>{})),...t.map(e=>fetch(`https://api.segment.io/v1/identify`,{method:`POST`,headers:n,body:JSON.stringify(e)}).catch(()=>{}))])}async function T(){try{return!((await E(o(c(),`.prismicrc`)))?.telemetry===!1||(await E(o(process.cwd(),`.prismicrc`)))?.telemetry===!1)}catch{return!0}}async function E(e){try{let t=await r(e,`utf8`);return JSON.parse(t)}catch{return}}export{v as a,y as i,b as n,w as o,x as r,_ as t};
@@ -1 +1 @@
1
- import"../env-DbZx_TgQ.mjs";import{o as e}from"../segment-B-S9hUWo.mjs";const{trackEvents:t,identifyEvents:n}=JSON.parse(Buffer.from(process.argv[2],`base64`).toString());try{await e(t,n)}catch{}export{};
1
+ import"../env-DbZx_TgQ.mjs";import{o as e}from"../segment-3VN9f-fz.mjs";const{trackEvents:t,identifyEvents:n}=JSON.parse(Buffer.from(process.argv[2],`base64`).toString());try{await e(t,n)}catch{}export{};
@@ -1 +1 @@
1
- import"../packageJson-BNFJTFZF.mjs";import{n as e}from"../update-notifier-DRnj_qgr.mjs";const[t,n]=process.argv.slice(2);try{await e(t,new URL(n))}catch{}export{};
1
+ import"../packageJson-BNFJTFZF.mjs";import{n as e}from"../update-notifier-CAEkNAPx.mjs";const[t,n]=process.argv.slice(2);try{await e(t,new URL(n))}catch{}export{};
@@ -1 +1 @@
1
- import{n as e}from"./package-BM0VY0Z3.mjs";import{_ as t,d as n,l as r,p as i,s as a}from"./schemas-CyhgtjZl.mjs";import{o}from"./request-DClMWmnH.mjs";import{i as s}from"./packageJson-BNFJTFZF.mjs";import{mkdir as c,readFile as l,writeFile as u}from"node:fs/promises";import{fileURLToPath as d}from"node:url";import{dirname as f}from"node:path";import{spawn as p}from"node:child_process";const m=a({latestKnownVersion:n(i()),lastUpdateCheckAt:n(r())});async function h(t){try{if(g())return;let n=await _(t.statePath),r=e;if(n?.latestKnownVersion&&v(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`,()=>{b(t.npmPackageName,t.statePath)})}catch{}}function g(){return process.env.NO_UPDATE_NOTIFIER===`0`?!1:!!(process.env.NO_UPDATE_NOTIFIER===`1`||process.env.CI||!process.stderr.isTTY)}async function _(e){try{let n=await l(e,`utf-8`);return t(m,JSON.parse(n))}catch{return}}function v(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 y(e,t){let n=await s(e),r=d(t);await c(f(r),{recursive:!0}),await u(r,o({latestKnownVersion:n,lastUpdateCheckAt:Date.now()}))}function b(e,t){try{let n=d(new URL(`./subprocesses/updateVersionState.mjs`,import.meta.url));p(process.execPath,[n,e,t.href],{detached:!0,stdio:`ignore`}).unref()}catch{}}export{y as n,h as t};
1
+ import{n as e}from"./package-CcYrcl2G.mjs";import{_ as t,d as n,l as r,p as i,s as a}from"./schemas-CyhgtjZl.mjs";import{o}from"./request-DClMWmnH.mjs";import{i as s}from"./packageJson-BNFJTFZF.mjs";import{mkdir as c,readFile as l,writeFile as u}from"node:fs/promises";import{fileURLToPath as d}from"node:url";import{dirname as f}from"node:path";import{spawn as p}from"node:child_process";const m=a({latestKnownVersion:n(i()),lastUpdateCheckAt:n(r())});async function h(t){try{if(g())return;let n=await _(t.statePath),r=e;if(n?.latestKnownVersion&&v(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`,()=>{b(t.npmPackageName,t.statePath)})}catch{}}function g(){return process.env.NO_UPDATE_NOTIFIER===`0`?!1:!!(process.env.NO_UPDATE_NOTIFIER===`1`||process.env.CI||!process.stderr.isTTY)}async function _(e){try{let n=await l(e,`utf-8`);return t(m,JSON.parse(n))}catch{return}}function v(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 y(e,t){let n=await s(e),r=d(t);await c(f(r),{recursive:!0}),await u(r,o({latestKnownVersion:n,lastUpdateCheckAt:Date.now()}))}function b(e,t){try{let n=d(new URL(`./subprocesses/updateVersionState.mjs`,import.meta.url));p(process.execPath,[n,e,t.href],{detached:!0,stdio:`ignore`}).unref()}catch{}}export{y as n,h as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismic",
3
- "version": "1.6.1-pr.167.848e261",
3
+ "version": "1.6.1-pr.167.9bc8f2f",
4
4
  "description": "Prismic's official command line tool",
5
5
  "keywords": [
6
6
  "prismic",
@@ -1 +0,0 @@
1
- var e=`prismic`,t=`1.6.1-pr.167.848e261`;export{t as n,e as t};