@prisma/cli-dev 0.8.2 → 0.9.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/accelerate-6KR7K7Y5.js +494 -0
- package/dist/chunk-6CY7FTXB.js +12 -0
- package/dist/chunk-7LVVKN3Q.js +2 -0
- package/dist/chunk-C743SY2X.js +2 -0
- package/dist/chunk-IUA2KLPR.js +34 -0
- package/dist/chunk-J2EYU3K5.js +2 -0
- package/dist/chunk-MKAOBCJL.js +2 -0
- package/dist/chunk-PKHPXFYF.js +4 -0
- package/dist/chunk-VMZVNK7U.js +2 -0
- package/dist/chunk-VN3SER5K.js +2 -0
- package/dist/chunk-WAQNVDRS.js +15 -0
- package/dist/chunk-ZZ7TGN5J.js +2 -0
- package/dist/client-ROT4AZYN.js +2 -0
- package/dist/dist-44BN73S3.js +24 -0
- package/dist/dist-FF6JPL3Y.js +2 -0
- package/dist/dist-OWTPHSRP.js +2 -0
- package/dist/http-exception-IXDDLQOJ.js +2 -0
- package/dist/index.js +100 -18
- package/dist/list-AF7WT6HT.js +5 -0
- package/dist/logger-5NORX5VG.js +2 -0
- package/dist/nodefs-MQZB2OFY.js +2 -0
- package/dist/opfs-ahp-W7WVBYAH.js +4 -0
- package/dist/pg_dump-F2HW5KLY.js +3 -0
- package/dist/prompt-AVJG6SAC.js +46 -0
- package/dist/proxy-signals-TJILVQAL.js +2 -0
- package/dist/remove-BWVQMMM4.js +9 -0
- package/dist/stop-XM5K7ZMT.js +5 -0
- package/dist/tiny-4VNDEAK3.js +2 -0
- package/dist/utility-5QZDATLM.js +2 -0
- package/package.json +8 -10
- package/dist/chunk-D5MRRGDK.js +0 -12
- package/dist/chunk-XOIFSEIB.js +0 -2
- package/dist/chunk-ZKMEOIRF.js +0 -2
- package/dist/list-K5DAVLAS.js +0 -3
- package/dist/remove-6QJTZ5SK.js +0 -9
- package/dist/stop-CRL2UWAK.js +0 -5
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{d as v,g as M,l as R}from"./chunk-IUA2KLPR.js";import"./chunk-C743SY2X.js";import"./chunk-J2EYU3K5.js";function u(i,t=i){return`\x1B]8;;${i.toString()}\x07${t.toString()}\x1B]8;;\x07`}function B(i){return typeof i=="object"&&i!==null}function G(i){return B(i)&&typeof i.length=="number"}function N(i){return Array.isArray(i)?i:i===void 0?[]:G(i)||i instanceof Set?Array.from(i):[i]}var h=N;var A=new WeakMap,$=new WeakMap,g=class{constructor(t,e){this.value=t,$.set(this,e)}set value(t){A.set(this,t)}get value(){let t=A.get(this),e=$.get(this);return e.get&&(t=e.get(t)),t===void 0?t="":t=String(t),t}},p=g;var W=class{constructor(t,e){this.list=[],this.load(t,e)}load(t,e){for(let n of h(t)){let r=new Map(e.list.map(s=>[s,new p(n[s.name],s)]));this.list.push(r)}}},E=W;var x=class{constructor(t){this.left=t.left,this.right=t.right}length(){return this.left.length+this.right.length}},T=x;var z=new WeakMap,b=class{constructor(t={}){this.name=t.name,this.width=t.width,this.maxWidth=t.maxWidth,this.minWidth=t.minWidth,this.noWrap=t.noWrap,this.break=t.break,this.contentWrappable=t.contentWrappable,this.contentWidth=t.contentWidth,this.minContentWidth=t.minContentWidth,this.padding=t.padding||{left:" ",right:" "},this.generatedWidth=null}set padding(t){z.set(this,new T(t))}get padding(){return z.get(this)}get wrappedContentWidth(){return Math.max(this.generatedWidth-this.padding.length(),0)}isResizable(){return!this.isFixed()}isFixed(){return this.width!==void 0||this.noWrap||!this.contentWrappable}generateWidth(){this.generatedWidth=this.width||this.contentWidth+this.padding.length()}generateMinWidth(){this.minWidth=this.minContentWidth+this.padding.length()}},w=b;var y=new WeakMap,k=class i{constructor(t){this.list=[];for(let e of h(t))this.add(e)}totalWidth(){return this.list.length?this.list.map(t=>t.generatedWidth).reduce((t,e)=>t+e):0}totalFixedWidth(){return this.getFixed().map(t=>t.generatedWidth).reduce((t,e)=>t+e,0)}get(t){return this.list.find(e=>e.name===t)}getResizable(){return this.list.filter(t=>t.isResizable())}getFixed(){return this.list.filter(t=>t.isFixed())}add(t){let e=t instanceof w?t:new w(t);return this.list.push(e),e}get maxWidth(){y.get(this)}set maxWidth(t){y.set(this,t)}autoSize(){let t=y.get(this);for(let n of this.list)n.generateWidth(),n.generateMinWidth();for(let n of this.list)n.maxWidth!==void 0&&n.generatedWidth>n.maxWidth&&(n.generatedWidth=n.maxWidth),n.minWidth!==void 0&&n.generatedWidth<n.minWidth&&(n.generatedWidth=n.minWidth);let e={total:this.totalWidth(),view:t,diff:this.totalWidth()-t,totalFixed:this.totalFixedWidth(),totalResizable:Math.max(t-this.totalFixedWidth(),0)};if(e.diff>0){let n=this.getResizable();for(let o of n)o.generatedWidth=Math.floor(e.totalResizable/n.length);let r=this.list.filter(o=>o.generatedWidth>o.contentWidth),s=this.list.filter(o=>o.generatedWidth<o.contentWidth),a=0;for(let o of r){let c=o.generatedWidth;o.generateWidth(),a+=c-o.generatedWidth}for(let o of s)o.generatedWidth+=Math.floor(a/s.length)}return this}static getColumns(t){let e=new i;for(let n of h(t))for(let r in n){let s=e.get(r);s||(s=e.add({name:r,contentWidth:0,minContentWidth:0}))}return e}},j=k;var m={chunk:/[^\s-]+?-\b|\S+|\s+|\r\n?|\n/g,ansiEscapeSequence:/\u001b.*?m/g},C=class{constructor(t="",e={}){this._lines=String(t).split(/\r\n|\n/g),this.options={eol:`
|
|
3
|
+
`,width:30,...e}}lines(){return this._lines.map(F,this).map(t=>t.match(m.chunk)||["~~empty~~"]).map(t=>this.options.break?t.map(K,this):t).map(t=>t.flat()).map(t=>t.reduce((e,n)=>{let r=e[e.length-1];return S(n).length+S(r).length>this.options.width?e.push(n):e[e.length-1]+=n,e},[""])).flat().map(F,this).filter(t=>t.trim()).map(t=>t.replace("~~empty~~",""))}wrap(){return this.lines().join(this.options.eol)}toString(){return this.wrap()}static wrap(t,e){return new this(t,e).wrap()}static lines(t,e){return new this(t,e).lines()}static isWrappable(t=""){let e=String(t).match(m.chunk);return e?e.length>1:!1}static getChunks(t){return t.match(m.chunk)||[]}};function F(i){return this.options.noTrim?i:i.trim()}function S(i){return i.replace(m.ansiEscapeSequence,"")}function K(i){if(S(i).length>this.options.width){let t=i.split(""),e,n=[];for(;(e=t.splice(0,this.options.width)).length;)n.push(e.join(""));return n}else return i}var d=C;var U=/\u001b.*?m/g;function f(i){return i.replace(U,"")}function _(i){return U.test(i)}function V(i){let t=i.map(e=>e.length);return Math.max(...t)}function H(i,t,e){let n=i.length-f(i).length;return i=i||"",(t.left||"")+i.padEnd(e-t.length()+n)+(t.right||"")}function O(i){return d.getChunks(i).reduce((e,n)=>Math.max(n.length,e),0)}function D(i){let e=i.reduce((n,r)=>{for(let s of Object.keys(r))n.includes(s)||n.push(s);return n},[]).filter(n=>!i.some(s=>{let a=s[n];return a!==void 0&&typeof a!="string"||typeof a=="string"&&/\S+/.test(a)}));return i.map(n=>{for(let r of e)delete n[r];return n})}function P(i={},t={}){let e=Object.assign({},i);return typeof e.padding=="object"?(e.padding.left===void 0&&(e.padding.left=t.padding.left),e.padding.right===void 0&&(e.padding.right=t.padding.right)):e.padding=t.padding,e.maxWidth===void 0&&(e.maxWidth=t.maxWidth),e.columns===void 0&&(e.columns=t.columns),e.eol===void 0&&(e.eol=t.eol),e}var L=class{constructor(t,e={}){let n={padding:{left:" ",right:" "},maxWidth:80,columns:[],eol:`
|
|
4
|
+
`};this.options=P(e,n),this.rows=null,this.columns=null,this.load(t)}load(t){let e=this.options;e.ignoreEmptyColumns&&(t=D(t)),this.columns=j.getColumns(t),this.columns.maxWidth=e.maxWidth;for(let n of this.columns.list)n.padding=e.padding,n.noWrap=e.noWrap,n.break=e.break,e.break&&(n.contentWrappable=!0);for(let n of e.columns){let r=this.columns.get(n.name);r&&(n.padding&&(r.padding.left=n.padding.left,r.padding.right=n.padding.right),r.width=n.width,r.maxWidth=n.maxWidth,r.minWidth=n.minWidth,r.noWrap=n.noWrap,r.break=n.break,n.break&&(r.contentWrappable=!0),r.get=n.get)}for(let n of h(t))for(let r in n){let s=this.columns.get(r),o=new p(n[r],s).value;_(o)&&(o=f(o)),o.length>s.contentWidth&&(s.contentWidth=o.length);let c=O(o);c>s.minContentWidth&&(s.minContentWidth=c),s.contentWrappable||(s.contentWrappable=d.isWrappable(o))}return this.columns.autoSize(),this.rows=new E(t,this.columns),this}getWrapped(){return this.columns.autoSize(),this.rows.list.map(t=>{let e=[];for(let[n,r]of t.entries())n.noWrap?e.push(r.value.split(/\r\n?|\n/)):e.push(d.lines(r.value,{width:n.wrappedContentWidth,break:n.break,noTrim:this.options.noTrim}));return e})}getLines(){let t=this.getWrapped(),e=[];return t.forEach(n=>{let r=V(n);for(let s=0;s<r;s++){let a=[];n.forEach(o=>{a.push(o[s]||"")}),e.push(a)}}),e}renderLines(){return this.getLines().map(e=>e.reduce((n,r,s)=>{let a=this.columns.list[s];return n+H(r,a.padding,a.generatedWidth)},""))}toString(){return this.renderLines().join(this.options.eol)+this.options.eol}},q=L;var J={...R},Q={description:"List available servers",name:"ls"},$t={args:J,meta:Q,run:async i=>{let t=await M.scan({debug:i.args.debug}),e=new q([{name:l("name"),status:l("status"),urls:l("urls")},...t.map(n=>({name:n.name,status:n.status,urls:X(n)}))]);v.log(e.toString())}};function l(i){return`\x1B[1m${i}\x1B[0m`}function X(i){if(i.status!=="running")return"";let t=Y(i),e=Z(i),n=tt(i);return[t?`${l("DATABASE_URL")}: ${t}`:null,e?`${l("TCP")}: ${e}`:null,n?`${l("Terminal")}: ${n}`:null].filter(Boolean).join(`
|
|
5
|
+
`)}function Y(i){let{url:t}=i.exports?.ppg||{};if(!t)return"";let e=new URL(t),n=e.searchParams.get("api_key");return e.searchParams.set("api_key",`${n.slice(0,4)}...${n.slice(-4)}`),u(t,e)}function Z(i){let{connectionString:t,prismaORMConnectionString:e}=i.exports?.database||{};if(!e&&!t)return"";let n=new URL(e||t);return u(n,`${n.protocol}//...@${n.host}/...`)}function tt(i){let{connectionString:t,terminalCommand:e}=i.exports?.database||{};if(!t||!e)return"";let n=new URL(t);return u(e,`...psql -h ${n.hostname} -p ${n.port} ...`)}export{$t as ListCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import"./chunk-J2EYU3K5.js";function c(){let{process:o,Deno:r}=globalThis;return!(typeof r?.noColor=="boolean"?r.noColor:o!==void 0?"NO_COLOR"in o?.env:!1)}var m=o=>{let[r,e]=[",","."];return o.map(n=>n.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r)).join(e)},d=o=>{let r=Date.now()-o;return m([r<1e3?r+"ms":Math.round(r/1e3)+"s"])},$=o=>{if(c())switch(o/100|0){case 5:return`\x1B[31m${o}\x1B[0m`;case 4:return`\x1B[33m${o}\x1B[0m`;case 3:return`\x1B[36m${o}\x1B[0m`;case 2:return`\x1B[32m${o}\x1B[0m`}return`${o}`};function s(o,r,e,t,n=0,l){let a=r==="<--"?`${r} ${e} ${t}`:`${r} ${e} ${t} ${$(n)} ${l}`;o(a)}var x=(o=console.log)=>async function(e,t){let{method:n,url:l}=e.req,a=l.slice(l.indexOf("/",8));s(o,"<--",n,a);let i=Date.now();await t(),s(o,"-->",n,a,e.res.status,d(i))};export{x as logger};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{i as m,m as i,n}from"./chunk-7LVVKN3Q.js";import"./chunk-J2EYU3K5.js";import*as o from"fs";import*as r from"path";m();var u=class extends n{constructor(s){super(s),this.rootDir=r.resolve(s),o.existsSync(r.join(this.rootDir))||o.mkdirSync(this.rootDir)}async init(s,e){return this.pg=s,{emscriptenOpts:{...e,preRun:[...e.preRun||[],t=>{let p=t.FS.filesystems.NODEFS;t.FS.mkdir(i),t.FS.mount(p,{root:this.rootDir},i)}]}}}async closeFs(){this.pg.Module.FS.quit()}};export{u as NodeFS};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{d as s,e as m,f as M,g as o,h as W,i as z,o as R,p as H}from"./chunk-7LVVKN3Q.js";import"./chunk-J2EYU3K5.js";z();var L="state.txt",J="data",v={DIR:16384,FILE:32768},_,I,N,j,f,k,y,T,F,O,S,l,A,E,P,g,w,D,C,x,q=class extends R{constructor(t,{initialPoolSize:e=1e3,maintainedPoolSize:a=100,debug:i=!1}={}){super(t,{debug:i}),m(this,l),m(this,_),m(this,I),m(this,N),m(this,j),m(this,f),m(this,k,new Map),m(this,y,new Map),m(this,T,0),m(this,F,new Map),m(this,O,new Map),this.lastCheckpoint=0,this.checkpointInterval=1e3*60,this.poolCounter=0,m(this,S,new Set),this.initialPoolSize=e,this.maintainedPoolSize=a}async init(t,e){return await o(this,l,A).call(this),super.init(t,e)}async syncToFs(t=!1){await this.maybeCheckpointState(),await this.maintainPool(),t||this.flush()}async closeFs(){for(let t of s(this,y).values())t.close();s(this,f).flush(),s(this,f).close(),this.pg.Module.FS.quit()}async maintainPool(t){t=t||this.maintainedPoolSize;let e=t-this.state.pool.length,a=[];for(let i=0;i<e;i++)a.push(new Promise(async r=>{++this.poolCounter;let h=`${(Date.now()-1704063600).toString(16).padStart(8,"0")}-${this.poolCounter.toString(16).padStart(8,"0")}`,c=await s(this,N).getFileHandle(h,{create:!0}),d=await c.createSyncAccessHandle();s(this,k).set(h,c),s(this,y).set(h,d),o(this,l,P).call(this,{opp:"createPoolFile",args:[h]}),this.state.pool.push(h),r()}));for(let i=0;i>e;i--)a.push(new Promise(async r=>{let h=this.state.pool.pop();o(this,l,P).call(this,{opp:"deletePoolFile",args:[h]});let c=s(this,k).get(h);s(this,y).get(h)?.close(),await s(this,N).removeEntry(c.name),s(this,k).delete(h),s(this,y).delete(h),r()}));await Promise.all(a)}_createPoolFileState(t){this.state.pool.push(t)}_deletePoolFileState(t){let e=this.state.pool.indexOf(t);e>-1&&this.state.pool.splice(e,1)}async maybeCheckpointState(){Date.now()-this.lastCheckpoint>this.checkpointInterval&&await this.checkpointState()}async checkpointState(){let t=new TextEncoder().encode(JSON.stringify(this.state));s(this,f).truncate(0),s(this,f).write(t,{at:0}),s(this,f).flush(),this.lastCheckpoint=Date.now()}flush(){for(let t of s(this,S))try{t.flush()}catch{}s(this,S).clear()}chmod(t,e){o(this,l,E).call(this,{opp:"chmod",args:[t,e]},()=>{this._chmodState(t,e)})}_chmodState(t,e){let a=o(this,l,w).call(this,t);a.mode=e}close(t){let e=o(this,l,D).call(this,t);s(this,F).delete(t),s(this,O).delete(e)}fstat(t){let e=o(this,l,D).call(this,t);return this.lstat(e)}lstat(t){let e=o(this,l,w).call(this,t),a=e.type==="file"?s(this,y).get(e.backingFilename).getSize():0,i=4096;return{dev:0,ino:0,mode:e.mode,nlink:1,uid:0,gid:0,rdev:0,size:a,blksize:i,blocks:Math.ceil(a/i),atime:e.lastModified,mtime:e.lastModified,ctime:e.lastModified}}mkdir(t,e){o(this,l,E).call(this,{opp:"mkdir",args:[t,e]},()=>{this._mkdirState(t,e)})}_mkdirState(t,e){let a=o(this,l,g).call(this,t),i=a.pop(),r=[],h=this.state.root;for(let d of a){if(r.push(t),!Object.prototype.hasOwnProperty.call(h.children,d))if(e?.recursive)this.mkdir(r.join("/"));else throw new p("ENOENT","No such file or directory");if(h.children[d].type!=="directory")throw new p("ENOTDIR","Not a directory");h=h.children[d]}if(Object.prototype.hasOwnProperty.call(h.children,i))throw new p("EEXIST","File exists");let c={type:"directory",lastModified:Date.now(),mode:e?.mode||v.DIR,children:{}};h.children[i]=c}open(t,e,a){if(o(this,l,w).call(this,t).type!=="file")throw new p("EISDIR","Is a directory");let i=o(this,l,C).call(this);return s(this,F).set(i,t),s(this,O).set(t,i),i}readdir(t){let e=o(this,l,w).call(this,t);if(e.type!=="directory")throw new p("ENOTDIR","Not a directory");return Object.keys(e.children)}read(t,e,a,i,r){let h=o(this,l,D).call(this,t),c=o(this,l,w).call(this,h);if(c.type!=="file")throw new p("EISDIR","Is a directory");return s(this,y).get(c.backingFilename).read(new Uint8Array(e.buffer,a,i),{at:r})}rename(t,e){o(this,l,E).call(this,{opp:"rename",args:[t,e]},()=>{this._renameState(t,e,!0)})}_renameState(t,e,a=!1){let i=o(this,l,g).call(this,t),r=i.pop(),h=o(this,l,w).call(this,i.join("/"));if(!Object.prototype.hasOwnProperty.call(h.children,r))throw new p("ENOENT","No such file or directory");let c=o(this,l,g).call(this,e),d=c.pop(),n=o(this,l,w).call(this,c.join("/"));if(a&&Object.prototype.hasOwnProperty.call(n.children,d)){let u=n.children[d];s(this,y).get(u.backingFilename).truncate(0),this.state.pool.push(u.backingFilename)}n.children[d]=h.children[r],delete h.children[r]}rmdir(t){o(this,l,E).call(this,{opp:"rmdir",args:[t]},()=>{this._rmdirState(t)})}_rmdirState(t){let e=o(this,l,g).call(this,t),a=e.pop(),i=o(this,l,w).call(this,e.join("/"));if(!Object.prototype.hasOwnProperty.call(i.children,a))throw new p("ENOENT","No such file or directory");let r=i.children[a];if(r.type!=="directory")throw new p("ENOTDIR","Not a directory");if(Object.keys(r.children).length>0)throw new p("ENOTEMPTY","Directory not empty");delete i.children[a]}truncate(t,e=0){let a=o(this,l,w).call(this,t);if(a.type!=="file")throw new p("EISDIR","Is a directory");let i=s(this,y).get(a.backingFilename);if(!i)throw new p("ENOENT","No such file or directory");i.truncate(e),s(this,S).add(i)}unlink(t){o(this,l,E).call(this,{opp:"unlink",args:[t]},()=>{this._unlinkState(t,!0)})}_unlinkState(t,e=!1){let a=o(this,l,g).call(this,t),i=a.pop(),r=o(this,l,w).call(this,a.join("/"));if(!Object.prototype.hasOwnProperty.call(r.children,i))throw new p("ENOENT","No such file or directory");let h=r.children[i];if(h.type!=="file")throw new p("EISDIR","Is a directory");if(delete r.children[i],e){let c=s(this,y).get(h.backingFilename);c?.truncate(0),s(this,S).add(c),s(this,O).has(t)&&(s(this,F).delete(s(this,O).get(t)),s(this,O).delete(t))}this.state.pool.push(h.backingFilename)}utimes(t,e,a){o(this,l,E).call(this,{opp:"utimes",args:[t,e,a]},()=>{this._utimesState(t,e,a)})}_utimesState(t,e,a){let i=o(this,l,w).call(this,t);i.lastModified=a}writeFile(t,e,a){let i=o(this,l,g).call(this,t),r=i.pop(),h=o(this,l,w).call(this,i.join("/"));if(Object.prototype.hasOwnProperty.call(h.children,r)){let n=h.children[r];n.lastModified=Date.now(),o(this,l,P).call(this,{opp:"setLastModified",args:[t,n.lastModified]})}else{if(this.state.pool.length===0)throw new Error("No more file handles available in the pool");let n={type:"file",lastModified:Date.now(),mode:a?.mode||v.FILE,backingFilename:this.state.pool.pop()};h.children[r]=n,o(this,l,P).call(this,{opp:"createFileNode",args:[t,n]})}let c=h.children[r],d=s(this,y).get(c.backingFilename);e.length>0&&(d.write(typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e),{at:0}),t.startsWith("/pg_wal")&&s(this,S).add(d))}_createFileNodeState(t,e){let a=o(this,l,g).call(this,t),i=a.pop(),r=o(this,l,w).call(this,a.join("/"));r.children[i]=e;let h=this.state.pool.indexOf(e.backingFilename);return h>-1&&this.state.pool.splice(h,1),e}_setLastModifiedState(t,e){let a=o(this,l,w).call(this,t);a.lastModified=e}write(t,e,a,i,r){let h=o(this,l,D).call(this,t),c=o(this,l,w).call(this,h);if(c.type!=="file")throw new p("EISDIR","Is a directory");let d=s(this,y).get(c.backingFilename);if(!d)throw new p("EBADF","Bad file descriptor");let n=d.write(new Uint8Array(e,a,i),{at:r});return h.startsWith("/pg_wal")&&s(this,S).add(d),n}};_=new WeakMap,I=new WeakMap,N=new WeakMap,j=new WeakMap,f=new WeakMap,k=new WeakMap,y=new WeakMap,T=new WeakMap,F=new WeakMap,O=new WeakMap,S=new WeakMap,l=new WeakSet,A=async function(){M(this,_,await navigator.storage.getDirectory()),M(this,I,await o(this,l,x).call(this,this.dataDir,{create:!0})),M(this,N,await o(this,l,x).call(this,J,{from:s(this,I),create:!0})),M(this,j,await s(this,I).getFileHandle(L,{create:!0})),M(this,f,await s(this,j).createSyncAccessHandle());let t=new ArrayBuffer(s(this,f).getSize());s(this,f).read(t,{at:0});let e,a=new TextDecoder().decode(t).split(`
|
|
3
|
+
`),i=!1;try{e=JSON.parse(a[0])}catch{e={root:{type:"directory",lastModified:Date.now(),mode:v.DIR,children:{}},pool:[]},s(this,f).truncate(0),s(this,f).write(new TextEncoder().encode(JSON.stringify(e)),{at:0}),i=!0}this.state=e;let r=a.slice(1).filter(Boolean).map(n=>JSON.parse(n));for(let n of r){let u=`_${n.opp}State`;if(typeof this[u]=="function")try{this[u].bind(this)(...n.args)}catch(b){console.warn("Error applying OPFS AHP WAL entry",n,b)}}let h=[],c=async n=>{if(n.type==="file")try{let u=await s(this,N).getFileHandle(n.backingFilename),b=await u.createSyncAccessHandle();s(this,k).set(n.backingFilename,u),s(this,y).set(n.backingFilename,b)}catch(u){console.error("Error opening file handle for node",n,u)}else for(let u of Object.values(n.children))h.push(c(u))};await c(this.state.root);let d=[];for(let n of this.state.pool)d.push(new Promise(async u=>{s(this,k).has(n)&&console.warn("File handle already exists for pool file",n);let b=await s(this,N).getFileHandle(n),B=await b.createSyncAccessHandle();s(this,k).set(n,b),s(this,y).set(n,B),u()}));await Promise.all([...h,...d]),await this.maintainPool(i?this.initialPoolSize:this.maintainedPoolSize)},E=function(t,e){let a=o(this,l,P).call(this,t);try{e()}catch(i){throw s(this,f).truncate(a),i}},P=function(t){let e=JSON.stringify(t),a=new TextEncoder().encode(`
|
|
4
|
+
${e}`),i=s(this,f).getSize();return s(this,f).write(a,{at:i}),s(this,S).add(s(this,f)),i},g=function(t){return t.split("/").filter(Boolean)},w=function(t,e){let a=o(this,l,g).call(this,t),i=e||this.state.root;for(let r of a){if(i.type!=="directory")throw new p("ENOTDIR","Not a directory");if(!Object.prototype.hasOwnProperty.call(i.children,r))throw new p("ENOENT","No such file or directory");i=i.children[r]}return i},D=function(t){let e=s(this,F).get(t);if(!e)throw new p("EBADF","Bad file descriptor");return e},C=function(){let t=++W(this,T)._;for(;s(this,F).has(t);)W(this,T)._++;return t},x=async function(t,e){let a=o(this,l,g).call(this,t),i=e?.from||s(this,_);for(let r of a)i=await i.getDirectoryHandle(r,{create:e?.create});return i};var p=class extends Error{constructor(t,e){super(e),typeof t=="number"?this.code=t:typeof t=="string"&&(this.code=H[t])}};export{q as OpfsAhpFS};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import"./chunk-J2EYU3K5.js";var S=class extends Error{constructor(t){super(`Exit with code ${t}`),this.code=t}},v=class{appendFileSync(t,e,r={}){throw new Error("appendFileSync not implemented")}fsyncSync(t){throw new Error("fsyncSync not implemented")}linkSync(t,e){throw new Error("linkSync not implemented")}mkdirSync(t,e={}){throw new Error("mkdirSync not implemented")}readdirSync(t,e={}){throw new Error("readdirSync not implemented")}readFileSync(t,e={}){throw new Error("readFileSync not implemented")}readlinkSync(t,e={}){throw new Error("readlinkSync not implemented")}renameSync(t,e){throw new Error("renameSync not implemented")}rmdirSync(t,e={}){throw new Error("rmdirSync not implemented")}setFlagsSync(t,e){throw new Error("setFlagsSync not implemented")}statSync(t,e={}){throw new Error("statSync not implemented")}symlinkSync(t,e,r="file"){throw new Error("symlinkSync not implemented")}truncateSync(t,e=0){throw new Error("truncateSync not implemented")}unlinkSync(t){throw new Error("unlinkSync not implemented")}utimesSync(t,e,r){throw new Error("utimesSync not implemented")}writeFileSync(t,e,r={}){throw new Error("writeFileSync not implemented")}},P=class{constructor(t={}){if(this.args=t.args||[],this.env=t.env||{},this.fs=t.fs||new v,!this.fs)throw new Error("File system implementation required");this.fds=new Map([[0,{type:"stdio"}],[1,{type:"stdio"}],[2,{type:"stdio"}],[3,{type:"directory",preopenPath:"/"}]]),this.nextFd=this.fds.size,this.textDecoder=new TextDecoder,this.textEncoder=new TextEncoder,this.args_get=this.args_get.bind(this),this.args_sizes_get=this.args_sizes_get.bind(this),this.environ_get=this.environ_get.bind(this),this.environ_sizes_get=this.environ_sizes_get.bind(this),this.clock_res_get=this.clock_res_get.bind(this),this.clock_time_get=this.clock_time_get.bind(this),this.fd_close=this.fd_close.bind(this),this.fd_seek=this.fd_seek.bind(this),this.fd_write=this.fd_write.bind(this),this.fd_read=this.fd_read.bind(this),this.fd_fdstat_get=this.fd_fdstat_get.bind(this),this.fd_fdstat_set_flags=this.fd_fdstat_set_flags.bind(this),this.fd_prestat_get=this.fd_prestat_get.bind(this),this.fd_prestat_dir_name=this.fd_prestat_dir_name.bind(this),this.path_open=this.path_open.bind(this),this.path_filestat_get=this.path_filestat_get.bind(this),this.proc_exit=this.proc_exit.bind(this),this.fd_advise=this.fd_advise.bind(this),this.fd_allocate=this.fd_allocate.bind(this),this.fd_datasync=this.fd_datasync.bind(this),this.fd_filestat_get=this.fd_filestat_get.bind(this),this.fd_filestat_set_size=this.fd_filestat_set_size.bind(this),this.fd_filestat_set_times=this.fd_filestat_set_times.bind(this),this.fd_pread=this.fd_pread.bind(this),this.fd_pwrite=this.fd_pwrite.bind(this),this.fd_readdir=this.fd_readdir.bind(this),this.fd_renumber=this.fd_renumber.bind(this),this.fd_sync=this.fd_sync.bind(this),this.fd_tell=this.fd_tell.bind(this),this.path_create_directory=this.path_create_directory.bind(this),this.path_filestat_set_times=this.path_filestat_set_times.bind(this),this.path_link=this.path_link.bind(this),this.path_readlink=this.path_readlink.bind(this),this.path_remove_directory=this.path_remove_directory.bind(this),this.path_rename=this.path_rename.bind(this),this.path_symlink=this.path_symlink.bind(this),this.path_unlink_file=this.path_unlink_file.bind(this),this.poll_oneoff=this.poll_oneoff.bind(this),this.sock_accept=this.sock_accept.bind(this),this.sock_recv=this.sock_recv.bind(this),this.sock_send=this.sock_send.bind(this),this.sock_shutdown=this.sock_shutdown.bind(this),this.random_get=this.random_get.bind(this),this.sched_yield=this.sched_yield.bind(this)}setup(t){this.wasm=t}start(t){this.setup(t);try{return t._start&&t._start(),0}catch(e){if(e instanceof S)return e.code;throw e}}stdin(){return new Uint8Array}stdout(t){let e=this.textDecoder.decode(t).replace(/\n$/g,"");e&&console.log(e)}stderr(t){let e=this.textDecoder.decode(t).replace(/\n$/g,"");e&&console.error(e)}args_get(t,e){let r=new DataView(this.wasm.memory.buffer),s=new Uint8Array(this.wasm.memory.buffer);for(let i of this.args){r.setUint32(t,e,!0),t+=4;let n=this.textEncoder.encode(i);s.set(n,e),s[e+n.length]=0,e+=n.length+1}return 0}args_sizes_get(t,e){let r=new DataView(this.wasm.memory.buffer);r.setUint32(t,this.args.length,!0);let s=this.args.reduce((i,n)=>i+n.length+1,0);return r.setUint32(e,s,!0),0}environ_get(t,e){let r=new DataView(this.wasm.memory.buffer),s=new Uint8Array(this.wasm.memory.buffer);for(let[i,n]of Object.entries(this.env)){r.setUint32(t,e,!0),t+=4;let f=`${i}=${n}\0`,d=this.textEncoder.encode(f);s.set(d,e),e+=d.length}return 0}environ_sizes_get(t,e){let r=new DataView(this.wasm.memory.buffer),s=Object.keys(this.env).length;r.setUint32(t,s,!0);let i=Object.entries(this.env).reduce((n,[f,d])=>n+f.length+d.length+2,0);return r.setUint32(e,i,!0),0}clock_res_get(t,e){let r=new DataView(this.wasm.memory.buffer),s;switch(t){case 0:s=1000000n;break;case 1:s=1000n;break;default:return 28}return r.setBigUint64(e,s,!0),0}clock_time_get(t,e,r){let s=new DataView(this.wasm.memory.buffer),i;switch(t){case 0:{let n=Date.now();i=BigInt(n)*1000000n;break}case 1:{i=BigInt(Math.round(performance.now()*1e6));break}default:return 28}return s.setBigUint64(r,i,!0),0}fd_close(t){return this.fds.get(t)?(this.fds.delete(t),0):8}fd_seek(t,e,r,s){let i=this.fds.get(t);if(!i)return 8;if(i.type==="stdio")return 70;var n=null;let f=0,d=Number(e);try{n=this.fs.statSync(i.handle.path)}catch{return 29}switch(r){case 0:f=d;break;case 1:f=Number(i.handle.position)+d;break;case 2:f=Number(n.size)+d;break;default:return console.error("fd_seek invalid mode",r),28}return i.handle.position=f,new DataView(this.wasm.memory.buffer).setBigUint64(s,BigInt(f),!0),0}fd_write(t,e,r,s){let i=0,n=[],f=new DataView(this.wasm.memory.buffer),d=new Uint8Array(this.wasm.memory.buffer);for(let a=0;a<r;a++){let h=e+a*8,o=f.getUint32(h,!0),c=f.getUint32(h+4,!0);n.push(new Uint8Array(d.buffer,o,c)),i+=c}let l;if(n.length===1)l=n[0];else{l=new Uint8Array(i);let a=0;for(let h of n)l.set(h,a),a+=h.length}if(t===1)this.stdout(l);else if(t===2)this.stderr(l);else{let a=this.fds.get(t);if(!a)return 8;a.handle.position+=i;try{this.fs.writeFileSync(a.handle.path,l)}catch{return 29}}return f.setUint32(s,i,!0),0}fd_read(t,e,r,s){let i=this.fds.get(t);if(!i)return 8;let n=0,f=new DataView(this.wasm.memory.buffer),d=new Uint8Array(this.wasm.memory.buffer);try{let l;t===0?l=this.stdin():l=this.fs.readFileSync(i.handle.path);for(let a=0;a<r;a++){let h=e+a*8,o=f.getUint32(h,!0),c=f.getUint32(h+4,!0),m=i.handle.position,y=Math.min(m+c,l.length),p=y-m;if(p<=0||(d.set(new Uint8Array(l.slice(m,y)),o),n+=p,i.handle.position+=p,p<c))break}return f.setUint32(s,n,!0),0}catch{return 29}}path_open(t,e,r,s,i,n,f,d,l){var a=this.fds.get(t);if(!a)return 8;let h=new Uint8Array(this.wasm.memory.buffer).slice(r,r+s),o=this.textDecoder.decode(h),c=o;var m=0;let y=new DataView(this.wasm.memory.buffer);a.preopenPath&&(o.startsWith("/")&&(c=o.slice(1)),c=a.preopenPath+(a.preopenPath.endsWith("/")?"":"/")+c);var p=!1,u=null;let _=(i&1)==1,T=(i&2)==2,b=(i&4)==4,U=(i&8)==8;try{u=this.fs.statSync(c),p=!0}catch{}if((b||U)&&b&&p)return y.setUint32(l,m,!0),20;let D={path:c,position:0},B="file";m=this.nextFd++;let x={type:B,handle:D,fd:m};return this.fds.set(m,x),a=this.fds.get(m),a.handle.position=0,U&&(a.handle.size=0),y.setUint32(l,m,!0),0}proc_exit(t){throw new S(t)}fd_fdstat_get(t,e){let r=this.fds.get(t);if(!r)return 8;let s=new DataView(this.wasm.memory.buffer),i;switch(r.type){case"stdio":i=2;break;case"directory":i=3;break;case"file":i=4;break;default:i=0}s.setUint8(e,i);let n=0;r.append&&(n|=1),s.setUint16(e+2,n,!0);let f=0n;r.type==="file"?f=2097254:r.type==="directory"&&(f=100688384);let d=BigInt(f);return s.setBigUint64(e+8,d,!0),s.setBigUint64(e+16,d,!0),0}fd_fdstat_set_flags(t,e){let r=this.fds.get(t);if(!r)return 8;if(e&~31)return 28;if(r.type==="stdio")return 58;try{return r.append=!!(e&1),r.handle&&typeof this.fs.setFlagsSync=="function"&&this.fs.setFlagsSync(r.handle,e),0}catch{return 29}}fd_prestat_get(t,e){let r=this.fds.get(t);if(!r||r.type!=="directory"||!r.preopenPath)return 8;let s=new DataView(this.wasm.memory.buffer);s.setUint8(e,0);let i=r.preopenPath.length;return s.setUint32(e+4,i,!0),0}fd_prestat_dir_name(t,e,r){let s=this.fds.get(t);if(!s||s.type!=="directory"||!s.preopenPath)return 8;if(r<s.preopenPath.length)return 37;let i=new Uint8Array(this.wasm.memory.buffer),n=this.textEncoder.encode(s.preopenPath);return i.set(n,e),0}path_filestat_get(t,e,r,s,i){let n=this.fds.get(t);if(!n)return 8;let f=new Uint8Array(this.wasm.memory.buffer),d=new Uint8Array(f.buffer,r,s),l=this.textDecoder.decode(d);try{let a=l;n.preopenPath&&(l.startsWith("/")&&(a=l.slice(1)),a=n.preopenPath+(n.preopenPath.endsWith("/")?"":"/")+a);let h=this.fs.statSync(a,{followSymlinks:(e&void 0)!==0}),o=new DataView(this.wasm.memory.buffer);o.setBigUint64(i,BigInt(h.dev||0),!0),o.setBigUint64(i+8,BigInt(h.ino||0),!0);let c=0;return h.isFile()?c=4:h.isDirectory()?c=3:h.isSymbolicLink()?c=7:h.isCharacterDevice()?c=2:h.isBlockDevice()?c=1:h.isFIFO()&&(c=6),o.setUint8(i+16,c),o.setBigUint64(i+24,BigInt(h.nlink||1),!0),o.setBigUint64(i+32,BigInt(h.size||0),!0),o.setBigUint64(i+40,BigInt(h.atimeMs*1e6),!0),o.setBigUint64(i+48,BigInt(h.mtimeMs*1e6),!0),o.setBigUint64(i+56,BigInt(h.ctimeMs*1e6),!0),0}catch(a){return a.code==="ENOENT"?44:a.code==="EACCES"?2:29}}fd_advise(t,e,r,s){let i=this.fds.get(t);return i?i.type!=="file"?8:0:8}fd_allocate(t,e,r){let s=this.fds.get(t);if(!s||s.type!=="file")return 8;try{let i=this.fs.statSync(s.handle.path),n=Number(e)+Number(r);if(n>i.size){let f=new Uint8Array(n-i.size);this.fs.appendFileSync(s.handle.path,f)}return 0}catch{return 29}}fd_datasync(t){let e=this.fds.get(t);if(!e||e.type!=="file")return 8;try{return typeof this.fs.fsyncSync=="function"&&this.fs.fsyncSync(e.handle.path),0}catch{return 29}}fd_filestat_get(t,e){let r=this.fds.get(t);if(!r||!r.handle)return 8;let s=new DataView(this.wasm.memory.buffer),i=this.fs.statSync(r.handle.path);return s.setBigUint64(e,BigInt(i.dev),!0),s.setBigUint64(e+8,BigInt(i.ino),!0),s.setUint8(e+16,i.filetype),s.setBigUint64(e+24,BigInt(i.nlink),!0),s.setBigUint64(e+32,BigInt(i.size),!0),s.setBigUint64(e+38,BigInt(i.atime),!0),s.setBigUint64(e+46,BigInt(i.mtime),!0),s.setBigUint64(e+52,BigInt(i.ctime),!0),0}fd_filestat_set_size(t,e){let r=this.fds.get(t);if(!r||r.type!=="file")return 8;try{return this.fs.truncateSync(r.handle.path,Number(e)),0}catch{return 29}}fd_filestat_set_times(t,e,r,s){let i=this.fds.get(t);if(!i||i.type!=="file")return 8;try{let n={atime:Number(e)/1e9,mtime:Number(r)/1e9};return this.fs.utimesSync(i.handle.path,n.atime,n.mtime),0}catch{return 29}}fd_pread(t,e,r,s,i){let n=this.fds.get(t);if(!n||n.type!=="file")return 8;try{let f=this.fs.readFileSync(n.handle.path),d=0,l=new DataView(this.wasm.memory.buffer),a=new Uint8Array(this.wasm.memory.buffer),h=Number(s);for(let o=0;o<r;o++){let c=e+o*8,m=l.getUint32(c,!0),y=l.getUint32(c+4,!0),p=h+d,u=Math.min(p+y,f.length),_=u-p;if(_<=0||(a.set(new Uint8Array(f.slice(p,u)),m),d+=_,_<y))break}return l.setUint32(i,d,!0),0}catch{return 29}}fd_pwrite(t,e,r,s,i){let n=this.fds.get(t);if(!n||n.type!=="file")return 8;try{let f=0,d=[],l=new DataView(this.wasm.memory.buffer),a=new Uint8Array(this.wasm.memory.buffer);for(let m=0;m<r;m++){let y=e+m*8,p=l.getUint32(y,!0),u=l.getUint32(y+4,!0);d.push(new Uint8Array(a.buffer,p,u)),f+=u}let h;if(d.length===1)h=d[0];else{h=new Uint8Array(f);let m=0;for(let y of d)h.set(y,m),m+=y.length}let o=this.fs.readFileSync(n.handle.path),c=new Uint8Array(Math.max(Number(s)+h.length,o.length));return c.set(o),c.set(h,Number(s)),this.fs.writeFileSync(n.handle.path,c),l.setUint32(i,f,!0),0}catch{return 29}}fd_readdir(t,e,r,s,i){let n=this.fds.get(t);if(!n)return 8;if(n.type!=="directory")return 54;try{let f=this.fs.readdirSync(n.handle.path,{withFileTypes:!0}),d=new DataView(this.wasm.memory.buffer),l=new Uint8Array(this.wasm.memory.buffer),a=0,h=0,o=Number(s);for(let c=o;c<f.length;c++){let m=f[c],y=m.name,p=this.textEncoder.encode(y),u=24+p.length;if(a+u>r)break;d.setBigUint64(e+a,BigInt(c+1),!0),d.setBigUint64(e+a+8,0n,!0),d.setUint32(e+a+16,p.length,!0);let _=0;m.isFile()?_=4:m.isDirectory()&&(_=3),d.setUint8(e+a+20,_),l.set(p,e+a+24),a+=u,h++}return d.setUint32(i,a,!0),0}catch{return 29}}fd_renumber(t,e){let r=this.fds.get(t);return r?(this.fds.delete(e),this.fds.set(e,r),this.fds.delete(t),0):8}fd_sync(t){let e=this.fds.get(t);if(!e||e.type!=="file")return 8;try{return typeof this.fs.fsyncSync=="function"&&this.fs.fsyncSync(e.handle.path),0}catch{return 29}}fd_tell(t,e){let r=this.fds.get(t);return r?r.type!=="file"?8:(new DataView(this.wasm.memory.buffer).setBigUint64(e,BigInt(r.handle.position),!0),0):8}path_create_directory(t,e,r){let s=this.fds.get(t);if(!s)return 8;let i=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,r));try{let n=i;return s.preopenPath&&(i.startsWith("/")&&(n=i.slice(1)),n=s.preopenPath+"/"+n),this.fs.mkdirSync(n),0}catch{return 29}}path_filestat_set_times(t,e,r,s,i,n,f){let d=this.fds.get(t);if(!d)return 8;let l=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,r,s));try{let a=l;d.preopenPath&&(l.startsWith("/")&&(a=l.slice(1)),a=d.preopenPath+"/"+a);let h={atime:Number(i)/1e9,mtime:Number(n)/1e9};return this.fs.utimesSync(a,h.atime,h.mtime),0}catch{return 29}}path_link(t,e,r,s,i,n,f){let d=this.fds.get(t),l=this.fds.get(i);if(!d||!l)return 8;let a=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,r,s)),h=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,n,f));try{let o=a,c=h;return d.preopenPath&&(a.startsWith("/")&&(o=a.slice(1)),o=d.preopenPath+"/"+o),l.preopenPath&&(h.startsWith("/")&&(c=h.slice(1)),c=l.preopenPath+"/"+c),this.fs.linkSync(o,c),0}catch{return 29}}path_readlink(t,e,r,s,i,n){let f=this.fds.get(t);if(!f)return 8;let d=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,r));try{let l=d;f.preopenPath&&(d.startsWith("/")&&(l=d.slice(1)),l=f.preopenPath+"/"+l);let a=this.fs.readlinkSync(l),h=this.textEncoder.encode(a);return h.length>i?61:(new Uint8Array(this.wasm.memory.buffer).set(h,s),new DataView(this.wasm.memory.buffer).setUint32(n,h.length,!0),0)}catch{return 29}}path_remove_directory(t,e,r){let s=this.fds.get(t);if(!s)return 8;let i=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,r));try{let n=i;return s.preopenPath&&(i.startsWith("/")&&(n=i.slice(1)),n=s.preopenPath+"/"+n),this.fs.rmdirSync(n),0}catch{return 29}}path_rename(t,e,r,s,i,n){let f=this.fds.get(t),d=this.fds.get(s);if(!f||!d)return 8;let l=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,r)),a=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,i,n));try{let h=l,o=a;return f.preopenPath&&(l.startsWith("/")&&(h=l.slice(1)),h=f.preopenPath+"/"+h),d.preopenPath&&(a.startsWith("/")&&(o=a.slice(1)),o=d.preopenPath+"/"+o),this.fs.renameSync(h,o),0}catch{return 29}}path_symlink(t,e,r,s,i){let n=this.fds.get(r);if(!n)return 8;let f=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,t,e)),d=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,s,i));try{let l=d;return n.preopenPath&&(d.startsWith("/")&&(l=d.slice(1)),l=n.preopenPath+"/"+l),this.fs.symlinkSync(f,l),0}catch{return 29}}path_unlink_file(t,e,r){let s=this.fds.get(t);if(!s)return 8;let i=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,r));try{let n=i;return s.preopenPath&&(i.startsWith("/")&&(n=i.slice(1)),n=s.preopenPath+"/"+n),this.fs.unlinkSync(n),0}catch{return 29}}poll_oneoff(t,e,r,s){let i=new DataView(this.wasm.memory.buffer),n=0;for(let f=0;f<r;f++){let d=t+f*48,l=i.getBigUint64(d,!0),a=i.getUint8(d+8),h=e+n*32;i.setBigUint64(h,l,!0),i.setUint8(h+8,a),i.setUint8(h+9,1),i.setUint16(h+10,0,!0),n++}return i.setUint32(s,n,!0),0}random_get(t,e){let r=new Uint8Array(this.wasm.memory.buffer,t,e);return crypto.getRandomValues(r),0}sched_yield(){return os.sched_yield(),0}sock_accept(t,e){return 52}sock_recv(t,e,r){return 52}sock_send(t,e,r){return 52}sock_shutdown(t,e){return 52}};console.log("easywasi");var F=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";function I(t,e){return{...t,...Object.fromEntries(["appendFileSync","fsyncSync","linkSync","setFlagsSync","mkdirSync","readdirSync","readFileSync","readlinkSync","renameSync","rmdirSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","writeFileSync"].map(r=>{let s=r.slice(0,r.length-4);return s in t?[r,(...i)=>(r==="writeFileSync"&&i[0]==="/tmp/out.sql"&&e.push(i[1]),t[s](...i))]:[r,()=>{throw new Error(`${s} not implemented.`)}]}).filter(r=>r!==void 0))}}async function V({pg:t,args:e}){let r=new URL("./pg_dump.wasm",import.meta.url),s=[],i=I(t.Module.FS,s),n=new P({fs:i,args:["pg_dump",...e],env:{PWD:"/"}});n.stdout=h=>{};let f=new TextDecoder,d="";n.stderr=h=>{let o=f.decode(h);o&&(d+=o)},n.sched_yield=()=>{let h="/tmp/pglite/base/.s.PGSQL.5432.in",o="/tmp/pglite/base/.s.PGSQL.5432.out";if(i.analyzePath(h).exists){let c=i.readFileSync(h);if(i.unlinkSync(h),c[0]===0){let y=new Uint8Array([...W,...M,...N]);return i.writeFileSync(o,y),0}let m=t.execProtocolRawSync(c);i.writeFileSync(o,m)}return 0},await i.writeFile("/pg_dump","\0",{mode:18});let l;if(F){let h=await(await import("fs/promises")).readFile(r.toString().slice(7));l=await WebAssembly.instantiate(h,{wasi_snapshot_preview1:n})}else l=await WebAssembly.instantiateStreaming(fetch(r),{wasi_snapshot_preview1:n});let a;return await t.runExclusive(async()=>{a=n.start(l.instance.exports)}),[a,s,d]}async function z({pg:t,args:e,fileName:r="dump.sql"}){let s=(await t.query("SHOW SEARCH_PATH;")).rows[0].search_path,i="/tmp/out.sql",n=["-U","postgres","--inserts","-j","1","-f",i,"postgres"],[f,d,l]=await V({pg:t,args:[...e??[],...n]});if(t.exec(`DEALLOCATE ALL; SET SEARCH_PATH = ${s}`),f!==0)throw new Error(`pg_dump failed with exit code ${f}.
|
|
3
|
+
Error message: ${l}`);let a=new File(d,r,{type:"text/plain"});return t.Module.FS.unlink(i),a}function w(t){return t.charCodeAt(0)}function g(t){let e=new ArrayBuffer(4);return new DataView(e).setInt32(0,t,!1),new Uint8Array(e)}function k(t){let e=new TextEncoder().encode(t);return new Uint8Array([...e,0])}var W=new Uint8Array([w("R"),...g(8),...g(0)]),N=new Uint8Array([w("Z"),...g(5),w("I")]),A=k("server_version"),E=k("16.3 (PGlite 0.2.0)"),O=4+A.length+E.length,M=new Uint8Array([w("S"),...g(O),...A,...E]);export{z as pgDump};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import"./chunk-J2EYU3K5.js";import"util";import m,{stdin as iD,stdout as sD}from"process";import P from"readline";import{WriteStream as CD}from"tty";function nD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _,L;function aD(){if(L)return _;L=1;let t="\x1B",u=`${t}[`,e="\x07",r={to(D,n){return n?`${u}${n+1};${D+1}H`:`${u}${D+1}G`},move(D,n){let s="";return D<0?s+=`${u}${-D}D`:D>0&&(s+=`${u}${D}C`),n<0?s+=`${u}${-n}A`:n>0&&(s+=`${u}${n}B`),s},up:(D=1)=>`${u}${D}A`,down:(D=1)=>`${u}${D}B`,forward:(D=1)=>`${u}${D}C`,backward:(D=1)=>`${u}${D}D`,nextLine:(D=1)=>`${u}E`.repeat(D),prevLine:(D=1)=>`${u}F`.repeat(D),left:`${u}G`,hide:`${u}?25l`,show:`${u}?25h`,save:`${t}7`,restore:`${t}8`},F={up:(D=1)=>`${u}S`.repeat(D),down:(D=1)=>`${u}T`.repeat(D)},C={screen:`${u}2J`,up:(D=1)=>`${u}1J`.repeat(D),down:(D=1)=>`${u}J`.repeat(D),line:`${u}2K`,lineEnd:`${u}K`,lineStart:`${u}1K`,lines(D){let n="";for(let s=0;s<D;s++)n+=this.line+(s<D-1?r.up():"");return D&&(n+=r.left),n}};return _={cursor:r,scroll:F,erase:C,beep:e},_}var b=aD(),$={exports:{}},N;function oD(){if(N)return $.exports;N=1;let t=process||{},u=t.argv||[],e=t.env||{},r=!(e.NO_COLOR||u.includes("--no-color"))&&(!!e.FORCE_COLOR||u.includes("--color")||t.platform==="win32"||(t.stdout||{}).isTTY&&e.TERM!=="dumb"||!!e.CI),F=(n,s,E=n)=>c=>{let a=""+c,h=a.indexOf(s,n.length);return~h?n+C(a,s,E,h)+s:n+a+s},C=(n,s,E,c)=>{let a="",h=0;do a+=n.substring(h,c)+E,h=c+s.length,c=n.indexOf(s,h);while(~c);return a+n.substring(h)},D=(n=r)=>{let s=n?F:()=>String;return{isColorSupported:n,reset:s("\x1B[0m","\x1B[0m"),bold:s("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:s("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:s("\x1B[3m","\x1B[23m"),underline:s("\x1B[4m","\x1B[24m"),inverse:s("\x1B[7m","\x1B[27m"),hidden:s("\x1B[8m","\x1B[28m"),strikethrough:s("\x1B[9m","\x1B[29m"),black:s("\x1B[30m","\x1B[39m"),red:s("\x1B[31m","\x1B[39m"),green:s("\x1B[32m","\x1B[39m"),yellow:s("\x1B[33m","\x1B[39m"),blue:s("\x1B[34m","\x1B[39m"),magenta:s("\x1B[35m","\x1B[39m"),cyan:s("\x1B[36m","\x1B[39m"),white:s("\x1B[37m","\x1B[39m"),gray:s("\x1B[90m","\x1B[39m"),bgBlack:s("\x1B[40m","\x1B[49m"),bgRed:s("\x1B[41m","\x1B[49m"),bgGreen:s("\x1B[42m","\x1B[49m"),bgYellow:s("\x1B[43m","\x1B[49m"),bgBlue:s("\x1B[44m","\x1B[49m"),bgMagenta:s("\x1B[45m","\x1B[49m"),bgCyan:s("\x1B[46m","\x1B[49m"),bgWhite:s("\x1B[47m","\x1B[49m"),blackBright:s("\x1B[90m","\x1B[39m"),redBright:s("\x1B[91m","\x1B[39m"),greenBright:s("\x1B[92m","\x1B[39m"),yellowBright:s("\x1B[93m","\x1B[39m"),blueBright:s("\x1B[94m","\x1B[39m"),magentaBright:s("\x1B[95m","\x1B[39m"),cyanBright:s("\x1B[96m","\x1B[39m"),whiteBright:s("\x1B[97m","\x1B[39m"),bgBlackBright:s("\x1B[100m","\x1B[49m"),bgRedBright:s("\x1B[101m","\x1B[49m"),bgGreenBright:s("\x1B[102m","\x1B[49m"),bgYellowBright:s("\x1B[103m","\x1B[49m"),bgBlueBright:s("\x1B[104m","\x1B[49m"),bgMagentaBright:s("\x1B[105m","\x1B[49m"),bgCyanBright:s("\x1B[106m","\x1B[49m"),bgWhiteBright:s("\x1B[107m","\x1B[49m")}};return $.exports=D(),$.exports.createColors=D,$.exports}var ED=oD(),i=nD(ED);function lD({onlyFirst:t=!1}={}){let u=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(u,t?void 0:"g")}var cD=lD();function X(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(cD,"")}function DD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var uD={exports:{}};(function(t){var u={};t.exports=u,u.eastAsianWidth=function(r){var F=r.charCodeAt(0),C=r.length==2?r.charCodeAt(1):0,D=F;return 55296<=F&&F<=56319&&56320<=C&&C<=57343&&(F&=1023,C&=1023,D=F<<10|C,D+=65536),D==12288||65281<=D&&D<=65376||65504<=D&&D<=65510?"F":D==8361||65377<=D&&D<=65470||65474<=D&&D<=65479||65482<=D&&D<=65487||65490<=D&&D<=65495||65498<=D&&D<=65500||65512<=D&&D<=65518?"H":4352<=D&&D<=4447||4515<=D&&D<=4519||4602<=D&&D<=4607||9001<=D&&D<=9002||11904<=D&&D<=11929||11931<=D&&D<=12019||12032<=D&&D<=12245||12272<=D&&D<=12283||12289<=D&&D<=12350||12353<=D&&D<=12438||12441<=D&&D<=12543||12549<=D&&D<=12589||12593<=D&&D<=12686||12688<=D&&D<=12730||12736<=D&&D<=12771||12784<=D&&D<=12830||12832<=D&&D<=12871||12880<=D&&D<=13054||13056<=D&&D<=19903||19968<=D&&D<=42124||42128<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||55216<=D&&D<=55238||55243<=D&&D<=55291||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65106||65108<=D&&D<=65126||65128<=D&&D<=65131||110592<=D&&D<=110593||127488<=D&&D<=127490||127504<=D&&D<=127546||127552<=D&&D<=127560||127568<=D&&D<=127569||131072<=D&&D<=194367||177984<=D&&D<=196605||196608<=D&&D<=262141?"W":32<=D&&D<=126||162<=D&&D<=163||165<=D&&D<=166||D==172||D==175||10214<=D&&D<=10221||10629<=D&&D<=10630?"Na":D==161||D==164||167<=D&&D<=168||D==170||173<=D&&D<=174||176<=D&&D<=180||182<=D&&D<=186||188<=D&&D<=191||D==198||D==208||215<=D&&D<=216||222<=D&&D<=225||D==230||232<=D&&D<=234||236<=D&&D<=237||D==240||242<=D&&D<=243||247<=D&&D<=250||D==252||D==254||D==257||D==273||D==275||D==283||294<=D&&D<=295||D==299||305<=D&&D<=307||D==312||319<=D&&D<=322||D==324||328<=D&&D<=331||D==333||338<=D&&D<=339||358<=D&&D<=359||D==363||D==462||D==464||D==466||D==468||D==470||D==472||D==474||D==476||D==593||D==609||D==708||D==711||713<=D&&D<=715||D==717||D==720||728<=D&&D<=731||D==733||D==735||768<=D&&D<=879||913<=D&&D<=929||931<=D&&D<=937||945<=D&&D<=961||963<=D&&D<=969||D==1025||1040<=D&&D<=1103||D==1105||D==8208||8211<=D&&D<=8214||8216<=D&&D<=8217||8220<=D&&D<=8221||8224<=D&&D<=8226||8228<=D&&D<=8231||D==8240||8242<=D&&D<=8243||D==8245||D==8251||D==8254||D==8308||D==8319||8321<=D&&D<=8324||D==8364||D==8451||D==8453||D==8457||D==8467||D==8470||8481<=D&&D<=8482||D==8486||D==8491||8531<=D&&D<=8532||8539<=D&&D<=8542||8544<=D&&D<=8555||8560<=D&&D<=8569||D==8585||8592<=D&&D<=8601||8632<=D&&D<=8633||D==8658||D==8660||D==8679||D==8704||8706<=D&&D<=8707||8711<=D&&D<=8712||D==8715||D==8719||D==8721||D==8725||D==8730||8733<=D&&D<=8736||D==8739||D==8741||8743<=D&&D<=8748||D==8750||8756<=D&&D<=8759||8764<=D&&D<=8765||D==8776||D==8780||D==8786||8800<=D&&D<=8801||8804<=D&&D<=8807||8810<=D&&D<=8811||8814<=D&&D<=8815||8834<=D&&D<=8835||8838<=D&&D<=8839||D==8853||D==8857||D==8869||D==8895||D==8978||9312<=D&&D<=9449||9451<=D&&D<=9547||9552<=D&&D<=9587||9600<=D&&D<=9615||9618<=D&&D<=9621||9632<=D&&D<=9633||9635<=D&&D<=9641||9650<=D&&D<=9651||9654<=D&&D<=9655||9660<=D&&D<=9661||9664<=D&&D<=9665||9670<=D&&D<=9672||D==9675||9678<=D&&D<=9681||9698<=D&&D<=9701||D==9711||9733<=D&&D<=9734||D==9737||9742<=D&&D<=9743||9748<=D&&D<=9749||D==9756||D==9758||D==9792||D==9794||9824<=D&&D<=9825||9827<=D&&D<=9829||9831<=D&&D<=9834||9836<=D&&D<=9837||D==9839||9886<=D&&D<=9887||9918<=D&&D<=9919||9924<=D&&D<=9933||9935<=D&&D<=9953||D==9955||9960<=D&&D<=9983||D==10045||D==10071||10102<=D&&D<=10111||11093<=D&&D<=11097||12872<=D&&D<=12879||57344<=D&&D<=63743||65024<=D&&D<=65039||D==65533||127232<=D&&D<=127242||127248<=D&&D<=127277||127280<=D&&D<=127337||127344<=D&&D<=127386||917760<=D&&D<=917999||983040<=D&&D<=1048573||1048576<=D&&D<=1114109?"A":"N"},u.characterLength=function(r){var F=this.eastAsianWidth(r);return F=="F"||F=="W"||F=="A"?2:1};function e(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}u.length=function(r){for(var F=e(r),C=0,D=0;D<F.length;D++)C=C+this.characterLength(F[D]);return C},u.slice=function(r,F,C){textLen=u.length(r),F=F||0,C=C||1,F<0&&(F=textLen+F),C<0&&(C=textLen+C);for(var D="",n=0,s=e(r),E=0;E<s.length;E++){var c=s[E],a=u.length(c);if(n>=F-(a==2?1:0))if(n+a<=C)D+=c;else break;n+=a}return D}})(uD);var hD=uD.exports,BD=DD(hD),mD=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},bD=DD(mD);function f(t,u={}){if(typeof t!="string"||t.length===0||(u={ambiguousIsNarrow:!0,...u},t=X(t),t.length===0))return 0;t=t.replace(bD()," ");let e=u.ambiguousIsNarrow?1:2,r=0;for(let F of t){let C=F.codePointAt(0);if(!(C<=31||C>=127&&C<=159||C>=768&&C<=879))switch(BD.eastAsianWidth(F)){case"F":case"W":r+=2;break;case"A":r+=e;break;default:r+=1}}return r}var k=10,q=(t=0)=>u=>`\x1B[${u+t}m`,z=(t=0)=>u=>`\x1B[${38+t};5;${u}m`,G=(t=0)=>(u,e,r)=>`\x1B[${38+t};2;${u};${e};${r}m`,l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(l.modifier);var pD=Object.keys(l.color),gD=Object.keys(l.bgColor);[...pD,...gD];function AD(){let t=new Map;for(let[u,e]of Object.entries(l)){for(let[r,F]of Object.entries(e))l[r]={open:`\x1B[${F[0]}m`,close:`\x1B[${F[1]}m`},e[r]=l[r],t.set(F[0],F[1]);Object.defineProperty(l,u,{value:e,enumerable:!1})}return Object.defineProperty(l,"codes",{value:t,enumerable:!1}),l.color.close="\x1B[39m",l.bgColor.close="\x1B[49m",l.color.ansi=q(),l.color.ansi256=z(),l.color.ansi16m=G(),l.bgColor.ansi=q(k),l.bgColor.ansi256=z(k),l.bgColor.ansi16m=G(k),Object.defineProperties(l,{rgbToAnsi256:{value:(u,e,r)=>u===e&&e===r?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(e/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:u=>{let e=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!e)return[0,0,0];let[r]=e;r.length===3&&(r=[...r].map(C=>C+C).join(""));let F=Number.parseInt(r,16);return[F>>16&255,F>>8&255,F&255]},enumerable:!1},hexToAnsi256:{value:u=>l.rgbToAnsi256(...l.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:u=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let e,r,F;if(u>=232)e=((u-232)*10+8)/255,r=e,F=e;else{u-=16;let n=u%36;e=Math.floor(u/36)/5,r=Math.floor(n/6)/5,F=n%6/5}let C=Math.max(e,r,F)*2;if(C===0)return 30;let D=30+(Math.round(F)<<2|Math.round(r)<<1|Math.round(e));return C===2&&(D+=60),D},enumerable:!1},rgbToAnsi:{value:(u,e,r)=>l.ansi256ToAnsi(l.rgbToAnsi256(u,e,r)),enumerable:!1},hexToAnsi:{value:u=>l.ansi256ToAnsi(l.hexToAnsi256(u)),enumerable:!1}}),l}var dD=AD(),y=new Set(["\x1B","\x9B"]),fD=39,I="\x07",eD="[",$D="]",tD="m",W=`${$D}8;;`,K=t=>`${y.values().next().value}${eD}${t}${tD}`,Y=t=>`${y.values().next().value}${W}${t}${I}`,vD=t=>t.split(" ").map(u=>f(u)),M=(t,u,e)=>{let r=[...u],F=!1,C=!1,D=f(X(t[t.length-1]));for(let[n,s]of r.entries()){let E=f(s);if(D+E<=e?t[t.length-1]+=s:(t.push(s),D=0),y.has(s)&&(F=!0,C=r.slice(n+1).join("").startsWith(W)),F){C?s===I&&(F=!1,C=!1):s===tD&&(F=!1);continue}D+=E,D===e&&n<r.length-1&&(t.push(""),D=0)}!D&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},xD=t=>{let u=t.split(" "),e=u.length;for(;e>0&&!(f(u[e-1])>0);)e--;return e===u.length?t:u.slice(0,e).join(" ")+u.slice(e).join("")},yD=(t,u,e={})=>{if(e.trim!==!1&&t.trim()==="")return"";let r="",F,C,D=vD(t),n=[""];for(let[E,c]of t.split(" ").entries()){e.trim!==!1&&(n[n.length-1]=n[n.length-1].trimStart());let a=f(n[n.length-1]);if(E!==0&&(a>=u&&(e.wordWrap===!1||e.trim===!1)&&(n.push(""),a=0),(a>0||e.trim===!1)&&(n[n.length-1]+=" ",a++)),e.hard&&D[E]>u){let h=u-a,g=1+Math.floor((D[E]-h-1)/u);Math.floor((D[E]-1)/u)<g&&n.push(""),M(n,c,u);continue}if(a+D[E]>u&&a>0&&D[E]>0){if(e.wordWrap===!1&&a<u){M(n,c,u);continue}n.push("")}if(a+D[E]>u&&e.wordWrap===!1){M(n,c,u);continue}n[n.length-1]+=c}e.trim!==!1&&(n=n.map(E=>xD(E)));let s=[...n.join(`
|
|
3
|
+
`)];for(let[E,c]of s.entries()){if(r+=c,y.has(c)){let{groups:h}=new RegExp(`(?:\\${eD}(?<code>\\d+)m|\\${W}(?<uri>.*)${I})`).exec(s.slice(E).join(""))||{groups:{}};if(h.code!==void 0){let g=Number.parseFloat(h.code);F=g===fD?void 0:g}else h.uri!==void 0&&(C=h.uri.length===0?void 0:h.uri)}let a=dD.codes.get(Number(F));s[E+1]===`
|
|
4
|
+
`?(C&&(r+=Y("")),F&&a&&(r+=K(a))):c===`
|
|
5
|
+
`&&(F&&a&&(r+=K(F)),C&&(r+=Y(C)))}return r};function J(t,u,e){return String(t).normalize().replace(/\r\n/g,`
|
|
6
|
+
`).split(`
|
|
7
|
+
`).map(r=>yD(r,u,e)).join(`
|
|
8
|
+
`)}var wD=["up","down","left","right","space","enter","cancel"],x={actions:new Set(wD),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function rD(t,u){if(typeof t=="string")return x.aliases.get(t)===u;for(let e of t)if(e!==void 0&&rD(e,u))return!0;return!1}function _D(t,u){if(t===u)return;let e=t.split(`
|
|
9
|
+
`),r=u.split(`
|
|
10
|
+
`),F=[];for(let C=0;C<Math.max(e.length,r.length);C++)e[C]!==r[C]&&F.push(C);return F}globalThis.process.platform.startsWith("win");var U=Symbol("clack:cancel");function v(t,u){let e=t;e.isTTY&&e.setRawMode(u)}var kD=Object.defineProperty,MD=(t,u,e)=>u in t?kD(t,u,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[u]=e,B=(t,u,e)=>(MD(t,typeof u!="symbol"?u+"":u,e),e),A=class{constructor(u,e=!0){B(this,"input"),B(this,"output"),B(this,"_abortSignal"),B(this,"rl"),B(this,"opts"),B(this,"_render"),B(this,"_track",!1),B(this,"_prevFrame",""),B(this,"_subscribers",new Map),B(this,"_cursor",0),B(this,"state","initial"),B(this,"error",""),B(this,"value");let{input:r=iD,output:F=sD,render:C,signal:D,...n}=u;this.opts=n,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=C.bind(this),this._track=e,this._abortSignal=D,this.input=r,this.output=F}unsubscribe(){this._subscribers.clear()}setSubscriber(u,e){let r=this._subscribers.get(u)??[];r.push(e),this._subscribers.set(u,r)}on(u,e){this.setSubscriber(u,{cb:e})}once(u,e){this.setSubscriber(u,{cb:e,once:!0})}emit(u,...e){let r=this._subscribers.get(u)??[],F=[];for(let C of r)C.cb(...e),C.once&&F.push(()=>r.splice(r.indexOf(C),1));for(let C of F)C()}prompt(){return new Promise((u,e)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),u(U);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let r=new CD(0);r._write=(F,C,D)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),D()},this.input.pipe(r),this.rl=P.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50}),P.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),v(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(b.cursor.show),this.output.off("resize",this.render),v(this.input,!1),u(this.value)}),this.once("cancel",()=>{this.output.write(b.cursor.show),this.output.off("resize",this.render),v(this.input,!1),u(U)})})}onKeypress(u,e){if(this.state==="error"&&(this.state="active"),e?.name&&(!this._track&&x.aliases.has(e.name)&&this.emit("cursor",x.aliases.get(e.name)),x.actions.has(e.name)&&this.emit("cursor",e.name)),u&&(u.toLowerCase()==="y"||u.toLowerCase()==="n")&&this.emit("confirm",u.toLowerCase()==="y"),u===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),u&&this.emit("key",u.toLowerCase()),e?.name==="return"){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}rD([u,e?.name,e?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
11
|
+
`),v(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let u=J(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
12
|
+
`).length-1;this.output.write(b.cursor.move(-999,u*-1))}render(){let u=J(this._render(this)??"",process.stdout.columns,{hard:!0});if(u!==this._prevFrame){if(this.state==="initial")this.output.write(b.cursor.hide);else{let e=_D(this._prevFrame,u);if(this.restoreCursor(),e&&e?.length===1){let r=e[0];this.output.write(b.cursor.move(0,r)),this.output.write(b.erase.lines(1));let F=u.split(`
|
|
13
|
+
`);this.output.write(F[r]),this._prevFrame=u,this.output.write(b.cursor.move(0,F.length-r-1));return}if(e&&e?.length>1){let r=e[0];this.output.write(b.cursor.move(0,r)),this.output.write(b.erase.down());let F=u.split(`
|
|
14
|
+
`).slice(r);this.output.write(F.join(`
|
|
15
|
+
`)),this._prevFrame=u;return}this.output.write(b.erase.down())}this.output.write(u),this.state==="initial"&&(this.state="active"),this._prevFrame=u}}},S=class extends A{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(u){super(u,!1),this.value=!!u.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",e=>{this.output.write(b.cursor.move(0,-1)),this.value=e,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},SD=Object.defineProperty,TD=(t,u,e)=>u in t?SD(t,u,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[u]=e,Z=(t,u,e)=>(TD(t,typeof u!="symbol"?u+"":u,e),e),jD=class extends A{constructor(t){super(t,!1),Z(this,"options"),Z(this,"cursor",0),this.options=t.options,this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:u})=>u===t.cursorAt),0),this.on("key",u=>{u==="a"&&this.toggleAll()}),this.on("cursor",u=>{switch(u){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let t=this.value.length===this.options.length;this.value=t?[]:this.options.map(u=>u.value)}toggleValue(){let t=this.value.includes(this._value);this.value=t?this.value.filter(u=>u!==this._value):[...this.value,this._value]}},OD=Object.defineProperty,RD=(t,u,e)=>u in t?OD(t,u,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[u]=e,H=(t,u,e)=>(RD(t,typeof u!="symbol"?u+"":u,e),e),T=class extends A{constructor(u){super(u,!1),H(this,"options"),H(this,"cursor",0),this.options=u.options,this.cursor=this.options.findIndex(({value:e})=>e===u.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}},j=class extends A{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let u=this.value.slice(0,this.cursor),[e,...r]=this.value.slice(this.cursor);return`${u}${i.inverse(e)}${r.join("")}`}get cursor(){return this._cursor}constructor(u){super(u),this.on("finalize",()=>{this.value||(this.value=u.defaultValue)})}};function VD(){return m.platform!=="win32"?m.env.TERM!=="linux":!!m.env.CI||!!m.env.WT_SESSION||!!m.env.TERMINUS_SUBLIME||m.env.ConEmuTask==="{cmd::Cmder}"||m.env.TERM_PROGRAM==="Terminus-Sublime"||m.env.TERM_PROGRAM==="vscode"||m.env.TERM==="xterm-256color"||m.env.TERM==="alacritty"||m.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ID=VD(),p=(t,u)=>ID?t:u,WD=p("\u276F",">"),PD=p("\u25A0","x"),LD=p("\u25B2","x"),ND=p("\u2714","\u221A"),o=p(""),d=p(""),O=p("\u25CF",">"),R=p("\u25CB"," "),qD=p("\u25FB","[\u2022]"),Q=p("\u25FC","[+]"),zD=p("\u25FB","[ ]"),w=t=>{switch(t){case"initial":case"active":return i.cyan(WD);case"cancel":return i.red(PD);case"error":return i.yellow(LD);case"submit":return i.green(ND)}},V=t=>{let{cursor:u,options:e,style:r}=t,F=t.maxItems??Number.POSITIVE_INFINITY,C=Math.max(process.stdout.rows-4,0),D=Math.min(C,Math.max(F,5)),n=0;u>=n+D-3?n=Math.max(Math.min(u-D+3,e.length-D),0):u<n+2&&(n=Math.max(u-2,0));let s=D<e.length&&n>0,E=D<e.length&&n+D<e.length;return e.slice(n,n+D).map((c,a,h)=>{let g=a===0&&s,FD=a===h.length-1&&E;return g||FD?i.dim("..."):r(c,a+n===u)})},GD=t=>new j({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let u=`${i.gray(o)}
|
|
16
|
+
${w(this.state)} ${t.message}
|
|
17
|
+
`,e=t.placeholder?i.inverse(t.placeholder[0])+i.dim(t.placeholder.slice(1)):i.inverse(i.hidden("_")),r=this.value?this.valueWithCursor:e;switch(this.state){case"error":return`${u.trim()}
|
|
18
|
+
${i.yellow(o)} ${r}
|
|
19
|
+
${i.yellow(d)} ${i.yellow(this.error)}
|
|
20
|
+
`;case"submit":return`${u}${i.gray(o)} ${i.dim(this.value||t.placeholder)}`;case"cancel":return`${u}${i.gray(o)} ${i.strikethrough(i.dim(this.value??""))}${this.value?.trim()?`
|
|
21
|
+
${i.gray(o)}`:""}`;default:return`${u}${i.cyan(o)} ${r}
|
|
22
|
+
${i.cyan(d)}
|
|
23
|
+
`}}}).prompt(),KD=t=>{let u=t.active??"Yes",e=t.inactive??"No";return new S({active:u,inactive:e,initialValue:t.initialValue??!0,render(){let r=`${i.gray(o)}
|
|
24
|
+
${w(this.state)} ${t.message}
|
|
25
|
+
`,F=this.value?u:e;switch(this.state){case"submit":return`${r}${i.gray(o)} ${i.dim(F)}`;case"cancel":return`${r}${i.gray(o)} ${i.strikethrough(i.dim(F))}
|
|
26
|
+
${i.gray(o)}`;default:return`${r}${i.cyan(o)} ${this.value?`${i.green(O)} ${u}`:`${i.dim(R)} ${i.dim(u)}`} ${i.dim("/")} ${this.value?`${i.dim(R)} ${i.dim(e)}`:`${i.green(O)} ${e}`}
|
|
27
|
+
${i.cyan(d)}
|
|
28
|
+
`}}}).prompt()},YD=t=>{let u=(e,r)=>{let F=e.label??String(e.value);switch(r){case"selected":return`${i.dim(F)}`;case"active":return`${i.green(O)} ${F} ${e.hint?i.dim(`(${e.hint})`):""}`;case"cancelled":return`${i.strikethrough(i.dim(F))}`;default:return`${i.dim(R)} ${i.dim(F)}`}};return new T({options:t.options,initialValue:t.initialValue,render(){let e=`${i.gray(o)}
|
|
29
|
+
${w(this.state)} ${t.message}
|
|
30
|
+
`;switch(this.state){case"submit":return`${e}${i.gray(o)} ${u(this.options[this.cursor],"selected")}`;case"cancel":return`${e}${i.gray(o)} ${u(this.options[this.cursor],"cancelled")}
|
|
31
|
+
${i.gray(o)}`;default:return`${e}${i.cyan(o)} ${V({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(r,F)=>u(r,F?"active":"inactive")}).join(`
|
|
32
|
+
${i.cyan(o)} `)}
|
|
33
|
+
${i.cyan(d)}
|
|
34
|
+
`}}}).prompt()},JD=t=>{let u=(e,r)=>{let F=e.label??String(e.value);return r==="active"?`${i.cyan(qD)} ${F} ${e.hint?i.dim(`(${e.hint})`):""}`:r==="selected"?`${i.green(Q)} ${i.dim(F)}`:r==="cancelled"?`${i.strikethrough(i.dim(F))}`:r==="active-selected"?`${i.green(Q)} ${F} ${e.hint?i.dim(`(${e.hint})`):""}`:r==="submitted"?`${i.dim(F)}`:`${i.dim(zD)} ${i.dim(F)}`};return new jD({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(e){if(this.required&&e.length===0)return`Please select at least one option.
|
|
35
|
+
${i.reset(i.dim(`Press ${i.gray(i.bgWhite(i.inverse(" space ")))} to select, ${i.gray(i.bgWhite(i.inverse(" enter ")))} to submit`))}`},render(){let e=`${i.gray(o)}
|
|
36
|
+
${w(this.state)} ${t.message}
|
|
37
|
+
`,r=(F,C)=>{let D=this.value.includes(F.value);return C&&D?u(F,"active-selected"):D?u(F,"selected"):u(F,C?"active":"inactive")};switch(this.state){case"submit":return`${e}${i.gray(o)} ${this.options.filter(({value:F})=>this.value.includes(F)).map(F=>u(F,"submitted")).join(i.dim(", "))||i.dim("none")}`;case"cancel":{let F=this.options.filter(({value:C})=>this.value.includes(C)).map(C=>u(C,"cancelled")).join(i.dim(", "));return`${e}${i.gray(o)} ${F.trim()?`${F}
|
|
38
|
+
${i.gray(o)}`:""}`}case"error":{let F=this.error.split(`
|
|
39
|
+
`).map((C,D)=>D===0?`${i.yellow(d)} ${i.yellow(C)}`:` ${C}`).join(`
|
|
40
|
+
`);return`${e+i.yellow(o)} ${V({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
|
|
41
|
+
${i.yellow(o)} `)}
|
|
42
|
+
${F}
|
|
43
|
+
`}default:return`${e}${i.cyan(o)} ${V({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
|
|
44
|
+
${i.cyan(o)} `)}
|
|
45
|
+
${i.cyan(d)}
|
|
46
|
+
`}}}).prompt()};`${i.gray(o)}`;var UD=Symbol.for("cancel");async function ZD(t,u={}){let e=r=>{if(typeof r!="symbol"||r.toString()!=="Symbol(clack:cancel)")return r;switch(u.cancel){case"reject":{let F=new Error("Prompt cancelled.");throw F.name="ConsolaPromptCancelledError",Error.captureStackTrace&&Error.captureStackTrace(F,ZD),F}case"undefined":return;case"null":return null;case"symbol":return UD;default:case"default":return u.default??u.initial}};if(!u.type||u.type==="text")return await GD({message:t,defaultValue:u.default,placeholder:u.placeholder,initialValue:u.initial}).then(e);if(u.type==="confirm")return await KD({message:t,initialValue:u.initial}).then(e);if(u.type==="select")return await YD({message:t,options:u.options.map(r=>typeof r=="string"?{value:r,label:r}:r),initialValue:u.initial}).then(e);if(u.type==="multiselect")return await JD({message:t,options:u.options.map(r=>typeof r=="string"?{value:r,label:r}:r),required:u.required,initialValues:u.initial}).then(e);throw new Error(`Unknown prompt type: ${u.type}`)}export{UD as kCancel,ZD as prompt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import"./chunk-J2EYU3K5.js";import i from"constants";var n=Object.keys(i).filter(t=>t.startsWith("SIG")&&t!=="SIGPROF"&&t!=="SIGKILL");var f=t=>{let r=new Map;for(let s of n){let o=()=>{try{t.kill(s)}catch{}};try{process.on(s,o),r.set(s,o)}catch{}}let e=()=>{for(let[s,o]of r)process.removeListener(s,o)};return t.on("exit",e),e};export{f as proxySignals};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as i,b as g}from"./chunk-6CY7FTXB.js";import{a as c,b as p,e as r}from"./chunk-WAQNVDRS.js";import{d as e,g as l,h as f,i as n,l as d}from"./chunk-IUA2KLPR.js";import{B as s}from"./chunk-C743SY2X.js";import"./chunk-J2EYU3K5.js";var y={...d,force:{default:!1,description:"Stops any running servers before removing them. Default is `false`, which would fail the command if any server is running.",required:!1,type:"boolean"},name:{description:"Name(s)/pattern(s) of the server(s) to remove",required:!0,type:"positional",valueHint:"glob"}},S={description:"Remove servers",name:"rm"},E={args:y,meta:S,run:async a=>{let{debug:m,force:v,name:u}=a.args,C=u.split(","),o=await l.scan({debug:m,globs:C});if(o.length===0)return e.log(`\u26A0\uFE0F No ${r} servers found to remove.
|
|
3
|
+
`);if(!v&&o.some(n)){e.log(`\u{1F6AB} Some ${r} servers are currently running:
|
|
4
|
+
|
|
5
|
+
${i(o.filter(n))}
|
|
6
|
+
|
|
7
|
+
Use the ${p("--force")} flag to stop and remove them.`),s.exitCode||=1;return}if(e.log(`\u{1F5D1}\uFE0F Removing the following ${r} servers:
|
|
8
|
+
|
|
9
|
+
${i(o)}`),!await g({confirmationText:"i will lose local data",debug:a.args.debug}))return;(await Promise.allSettled(o.map(async t=>{await f(t,m),e.log(`\u{1F9F9} Removed ${r} server ${c(t.name)}.`)}))).some(t=>t.status==="rejected")&&(e.error(`Potentially failed to remove some ${r} servers.`),s.exitCode||=1),e.log("")}};export{E as RemoveCommand};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as l,b as f}from"./chunk-6CY7FTXB.js";import{a as p,e as o}from"./chunk-WAQNVDRS.js";import{d as e,g as i,i as n,j as a,l as m}from"./chunk-IUA2KLPR.js";import"./chunk-C743SY2X.js";import"./chunk-J2EYU3K5.js";var S={...m,name:{description:"Name(s)/pattern(s) of the server(s) to stop",required:!0,type:"positional",valueHint:"glob"}},u={description:"Stop servers",name:"stop"},h={args:S,meta:u,run:async c=>{let{debug:t,name:d}=c.args,g=d.split(","),s=(await i.scan({debug:t,globs:g})).filter(n);if(s.length===0)return e.log(`\u26A0\uFE0F No ${o} servers found to stop.
|
|
3
|
+
`);if(e.log(`\u26B0\uFE0F Stopping the following ${o} servers:
|
|
4
|
+
|
|
5
|
+
${l(s)}`),!await f({confirmationText:"i will interrupt sessions",debug:t}))return;(await Promise.allSettled(s.map(async r=>{await a(r,t),e.log(`\u{1F480} Stopped ${o} server ${p(r.name)}.`)}))).some(r=>r.status==="rejected")&&(e.error(`Potentially failed to stop some ${o} servers.`),process.exitCode||=1),e.log("")}};export{h as StopCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as _}from"./chunk-MKAOBCJL.js";import"./chunk-VMZVNK7U.js";import"./chunk-J2EYU3K5.js";var P=202,i=502,L=400,p=409,t=100,a=201,M=417;var v=403,x=504,F=410,l=505,S=418,c=419,H=507,G=500,Q=411,Y=423,m=420,h=405,g=301,f=302,C=207,y=300,B=511,V=204,q=203,W=406,b=404,w=501,K=304,X=200,j=206,k=402,Z=308,z=412,J=428,$=102,d=407,u=431,s=408,EE=413,TE=414,RE=416,eE=205,rE=303,OE=503,_E=101,NE=307,IE=429,AE=401,UE=422,oE=415,nE=305,N={ACCEPTED:P,BAD_GATEWAY:i,BAD_REQUEST:L,CONFLICT:p,CONTINUE:t,CREATED:a,EXPECTATION_FAILED:M,FORBIDDEN:v,GATEWAY_TIMEOUT:x,GONE:F,HTTP_VERSION_NOT_SUPPORTED:l,IM_A_TEAPOT:S,INSUFFICIENT_SPACE_ON_RESOURCE:c,INSUFFICIENT_STORAGE:H,INTERNAL_SERVER_ERROR:G,LENGTH_REQUIRED:Q,LOCKED:Y,METHOD_FAILURE:m,METHOD_NOT_ALLOWED:h,MOVED_PERMANENTLY:g,MOVED_TEMPORARILY:f,MULTI_STATUS:C,MULTIPLE_CHOICES:y,NETWORK_AUTHENTICATION_REQUIRED:B,NO_CONTENT:V,NON_AUTHORITATIVE_INFORMATION:q,NOT_ACCEPTABLE:W,NOT_FOUND:b,NOT_IMPLEMENTED:w,NOT_MODIFIED:K,OK:X,PARTIAL_CONTENT:j,PAYMENT_REQUIRED:k,PERMANENT_REDIRECT:Z,PRECONDITION_FAILED:z,PRECONDITION_REQUIRED:J,PROCESSING:$,PROXY_AUTHENTICATION_REQUIRED:d,REQUEST_HEADER_FIELDS_TOO_LARGE:u,REQUEST_TIMEOUT:s,REQUEST_TOO_LONG:EE,REQUEST_URI_TOO_LONG:TE,REQUESTED_RANGE_NOT_SATISFIABLE:RE,RESET_CONTENT:eE,SEE_OTHER:rE,SERVICE_UNAVAILABLE:OE,SWITCHING_PROTOCOLS:_E,TEMPORARY_REDIRECT:NE,TOO_MANY_REQUESTS:IE,UNAUTHORIZED:AE,UNPROCESSABLE_ENTITY:UE,UNSUPPORTED_MEDIA_TYPE:oE,USE_PROXY:nE};var I={202:"Accepted",502:"Bad Gateway",400:"Bad Request",409:"Conflict",100:"Continue",201:"Created",417:"Expectation Failed",424:"Failed Dependency",403:"Forbidden",504:"Gateway Timeout",410:"Gone",505:"HTTP Version Not Supported",418:"I'm a teapot",419:"Insufficient Space on Resource",507:"Insufficient Storage",500:"Internal Server Error",411:"Length Required",423:"Locked",420:"Method Failure",405:"Method Not Allowed",301:"Moved Permanently",302:"Moved Temporarily",207:"Multi-Status",300:"Multiple Choices",511:"Network Authentication Required",204:"No Content",203:"Non Authoritative Information",406:"Not Acceptable",404:"Not Found",501:"Not Implemented",304:"Not Modified",200:"OK",206:"Partial Content",402:"Payment Required",308:"Permanent Redirect",412:"Precondition Failed",428:"Precondition Required",102:"Processing",103:"Early Hints",426:"Upgrade Required",407:"Proxy Authentication Required",431:"Request Header Fields Too Large",408:"Request Timeout",413:"Request Entity Too Large",414:"Request-URI Too Long",416:"Requested Range Not Satisfiable",205:"Reset Content",303:"See Other",503:"Service Unavailable",101:"Switching Protocols",307:"Temporary Redirect",429:"Too Many Requests",401:"Unauthorized",451:"Unavailable For Legal Reasons",422:"Unprocessable Entity",415:"Unsupported Media Type",305:"Use Proxy",421:"Misdirected Request"},A={Accepted:202,"Bad Gateway":502,"Bad Request":400,Conflict:409,Continue:100,Created:201,"Expectation Failed":417,"Failed Dependency":424,Forbidden:403,"Gateway Timeout":504,Gone:410,"HTTP Version Not Supported":505,"I'm a teapot":418,"Insufficient Space on Resource":419,"Insufficient Storage":507,"Internal Server Error":500,"Length Required":411,Locked:423,"Method Failure":420,"Method Not Allowed":405,"Moved Permanently":301,"Moved Temporarily":302,"Multi-Status":207,"Multiple Choices":300,"Network Authentication Required":511,"No Content":204,"Non Authoritative Information":203,"Not Acceptable":406,"Not Found":404,"Not Implemented":501,"Not Modified":304,OK:200,"Partial Content":206,"Payment Required":402,"Permanent Redirect":308,"Precondition Failed":412,"Precondition Required":428,Processing:102,"Early Hints":103,"Upgrade Required":426,"Proxy Authentication Required":407,"Request Header Fields Too Large":431,"Request Timeout":408,"Request Entity Too Large":413,"Request-URI Too Long":414,"Requested Range Not Satisfiable":416,"Reset Content":205,"See Other":303,"Service Unavailable":503,"Switching Protocols":101,"Temporary Redirect":307,"Too Many Requests":429,Unauthorized:401,"Unavailable For Legal Reasons":451,"Unprocessable Entity":422,"Unsupported Media Type":415,"Use Proxy":305,"Misdirected Request":421};function DE(E){var T=I[E.toString()];if(!T)throw new Error("Status code does not exist: "+E);return T}function U(E){var T=A[E];if(!T)throw new Error("Reason phrase does not exist: "+E);return T}var o=DE;var e;(function(E){E[E.CONTINUE=100]="CONTINUE",E[E.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",E[E.PROCESSING=102]="PROCESSING",E[E.EARLY_HINTS=103]="EARLY_HINTS",E[E.OK=200]="OK",E[E.CREATED=201]="CREATED",E[E.ACCEPTED=202]="ACCEPTED",E[E.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",E[E.NO_CONTENT=204]="NO_CONTENT",E[E.RESET_CONTENT=205]="RESET_CONTENT",E[E.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",E[E.MULTI_STATUS=207]="MULTI_STATUS",E[E.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",E[E.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",E[E.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",E[E.SEE_OTHER=303]="SEE_OTHER",E[E.NOT_MODIFIED=304]="NOT_MODIFIED",E[E.USE_PROXY=305]="USE_PROXY",E[E.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",E[E.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",E[E.BAD_REQUEST=400]="BAD_REQUEST",E[E.UNAUTHORIZED=401]="UNAUTHORIZED",E[E.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",E[E.FORBIDDEN=403]="FORBIDDEN",E[E.NOT_FOUND=404]="NOT_FOUND",E[E.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",E[E.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",E[E.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",E[E.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",E[E.CONFLICT=409]="CONFLICT",E[E.GONE=410]="GONE",E[E.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",E[E.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",E[E.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",E[E.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",E[E.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",E[E.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",E[E.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",E[E.IM_A_TEAPOT=418]="IM_A_TEAPOT",E[E.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",E[E.METHOD_FAILURE=420]="METHOD_FAILURE",E[E.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",E[E.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",E[E.LOCKED=423]="LOCKED",E[E.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",E[E.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",E[E.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",E[E.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",E[E.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",E[E.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",E[E.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",E[E.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",E[E.BAD_GATEWAY=502]="BAD_GATEWAY",E[E.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",E[E.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",E[E.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",E[E.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",E[E.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(e||(e={}));var r=function(){return r=Object.assign||function(E){for(var T,R=1,D=arguments.length;R<D;R++){T=arguments[R];for(var O in T)Object.prototype.hasOwnProperty.call(T,O)&&(E[O]=T[O])}return E},r.apply(this,arguments)},vE=r(r({},N),{getStatusCode:U,getStatusText:o});var n=new _;n.post("/database/dump",async E=>{let T=E.get("db"),R=E.get("serverState");return await T.dump(R.databaseDumpPath),E.json({dumpPath:R.databaseDumpPath},e.CREATED)});var HE=n.get("/health",E=>E.json({name:E.get("serverState").name}));export{n as utilityRoute};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli-dev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Dev CLI for Prisma",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,22 +31,20 @@
|
|
|
31
31
|
],
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@arethetypeswrong/cli": "0.18.1",
|
|
34
|
+
"@clack/core": "0.5.0",
|
|
34
35
|
"@prisma/config": "6.8.2",
|
|
35
36
|
"@types/node": "22.15.21",
|
|
36
|
-
"tsup": "8.5.0",
|
|
37
|
-
"typescript": "5.8.3",
|
|
38
|
-
"vitest": "3.1.4",
|
|
39
|
-
"common-cli-utils": "^0.0.0",
|
|
40
|
-
"common-stuff": "^0.0.0"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@clack/core": "0.5.0",
|
|
44
37
|
"citty": "0.1.6",
|
|
45
38
|
"consola": "3.4.2",
|
|
46
39
|
"std-env": "3.9.0",
|
|
47
40
|
"table-layout": "4.1.1",
|
|
41
|
+
"tsup": "8.5.0",
|
|
42
|
+
"typescript": "5.8.3",
|
|
43
|
+
"vitest": "3.1.4",
|
|
48
44
|
"yocto-spinner": "1.0.0",
|
|
49
|
-
"@prisma/dev": "0.
|
|
45
|
+
"@prisma/dev": "0.12.0",
|
|
46
|
+
"common-cli-utils": "^0.0.0",
|
|
47
|
+
"common-stuff": "^0.0.0"
|
|
50
48
|
},
|
|
51
49
|
"scripts": {
|
|
52
50
|
"build": "tsup",
|
package/dist/chunk-D5MRRGDK.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as o,c as a,f as c}from"./chunk-ZKMEOIRF.js";function $(e){return` - ${e.map(t=>`${o(t.name)}`).join(`
|
|
3
|
-
- `)}`}import{TextPrompt as f}from"@clack/core";import{colorize as r}from"consola/utils";async function C(e){let{confirmationText:t,debug:m}=e;return c?typeof await new f({debug:m,render(){switch(this.state){case"active":case"error":case"initial":{let s=`
|
|
4
|
-
\u{1F9F7} To confirm, type ${a(t)} and press ${r("inverse"," \u23CE ")}:`,h=this.value?.length<=t.length&&t.startsWith(this.value),i=!this.error&&u(this.value,t),n=t.charAt(this.cursor)?r("inverse",t.charAt(this.cursor)):this.valueWithCursor.charAt(this.cursor),p=r("dim",t.slice(this.valueWithCursor.length)),l=i?`${t}${r("reset",r("strikethrough",r("dim",this.value.slice(t.length))))}${n}`:`${this.value}${n}`;return`${s}
|
|
5
|
-
|
|
6
|
-
${r(i?"greenBright":h?"reset":"redBright",`${r("hidden","_")}> ${l}`)}${p}
|
|
7
|
-
`}case"cancel":return`
|
|
8
|
-
Aborted!
|
|
9
|
-
|
|
10
|
-
`;case"submit":return`
|
|
11
|
-
`;default:return this.state,`
|
|
12
|
-
`}},validate:s=>u(s,t)?void 0:"!"}).prompt()=="string":!0}function u(e,t){return typeof e=="string"&&e.startsWith(t)}export{$ as a,C as b};
|
package/dist/chunk-XOIFSEIB.js
DELETED
package/dist/chunk-ZKMEOIRF.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{colorize as n}from"consola/utils";function u(r){return n("cyan",r)}function p(r){return n("magenta",r)}function c(r){return n("yellow",r)}function m(r){return n("white",r)}import{colorize as o}from"consola/utils";var f=o("inverse",`${t()}prisma dev${t()}`);function t(r=1){return r<1?"":o("hidden","_".repeat(r))}import{hasTTY as e,isCI as i}from"std-env";var C=!i&&e;export{u as a,p as b,c,m as d,f as e,C as f};
|
package/dist/list-K5DAVLAS.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-XOIFSEIB.js";import{ServerState as i}from"@prisma/dev/internal/state";import{defineCommand as m}from"citty";function o(t,n=t){return`\x1B]8;;${t.toString()}\x07${n.toString()}\x1B]8;;\x07`}import{consola as c}from"consola";import u from"table-layout";var l={...a},p={description:"List available servers",name:"ls"},U=m({args:l,meta:p,run:async t=>{let n=await i.scan({debug:t.args.debug}),e=new u([{name:s("name"),status:s("status"),urls:s("urls")},...n.map(r=>({name:r.name,status:r.status,urls:g(r)}))]);c.log(e.toString())}});function s(t){return`\x1B[1m${t}\x1B[0m`}function g(t){if(t.status!=="running")return"";let n=f(t),e=S(t),r=d(t);return[n?`${s("DATABASE_URL")}: ${n}`:null,e?`${s("TCP")}: ${e}`:null,r?`${s("Terminal")}: ${r}`:null].filter(Boolean).join(`
|
|
3
|
-
`)}function f(t){let{url:n}=t.exports?.ppg||{};if(!n)return"";let e=new URL(n),r=e.searchParams.get("api_key");return e.searchParams.set("api_key",`${r.slice(0,4)}...${r.slice(-4)}`),o(n,e)}function S(t){let{connectionString:n,prismaORMConnectionString:e}=t.exports?.database||{};if(!e&&!n)return"";let r=new URL(e||n);return o(r,`${r.protocol}//...@${r.host}/...`)}function d(t){let{connectionString:n,terminalCommand:e}=t.exports?.database||{};if(!n||!e)return"";let r=new URL(n);return o(e,`...psql -h ${r.hostname} -p ${r.port} ...`)}export{U as ListCommand};
|
package/dist/remove-6QJTZ5SK.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as s,b as f}from"./chunk-D5MRRGDK.js";import{a as m,b as l,e}from"./chunk-ZKMEOIRF.js";import{a}from"./chunk-XOIFSEIB.js";import{deleteServer as u,isServerRunning as d,ServerState as C}from"@prisma/dev/internal/state";import{defineCommand as y}from"citty";import{consola as r}from"consola";import{process as c}from"std-env";var S={...a,force:{default:!1,description:"Stops any running servers before removing them. Default is `false`, which would fail the command if any server is running.",required:!1,type:"boolean"},name:{description:"Name(s)/pattern(s) of the server(s) to remove",required:!0,type:"positional",valueHint:"glob"}},h={description:"Remove servers",name:"rm"},P=y({args:S,meta:h,run:async n=>{let{debug:i,force:p,name:g}=n.args,v=g.split(","),o=await C.scan({debug:i,globs:v});if(o.length===0)return r.log(`\u26A0\uFE0F No ${e} servers found to remove.
|
|
3
|
-
`);if(!p&&o.some(d)){r.log(`\u{1F6AB} Some ${e} servers are currently running:
|
|
4
|
-
|
|
5
|
-
${s(o.filter(d))}
|
|
6
|
-
|
|
7
|
-
Use the ${l("--force")} flag to stop and remove them.`),c.exitCode||=1;return}if(r.log(`\u{1F5D1}\uFE0F Removing the following ${e} servers:
|
|
8
|
-
|
|
9
|
-
${s(o)}`),!await f({confirmationText:"i will lose local data",debug:n.args.debug}))return;(await Promise.allSettled(o.map(async t=>{await u(t,i),r.log(`\u{1F9F9} Removed ${e} server ${m(t.name)}.`)}))).some(t=>t.status==="rejected")&&(r.error(`Potentially failed to remove some ${e} servers.`),c.exitCode||=1),r.log("")}});export{P as RemoveCommand};
|
package/dist/stop-CRL2UWAK.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b as m}from"./chunk-D5MRRGDK.js";import{a as n,e}from"./chunk-ZKMEOIRF.js";import{a as i}from"./chunk-XOIFSEIB.js";import{isServerRunning as c,killServer as d,ServerState as g}from"@prisma/dev/internal/state";import{defineCommand as S}from"citty";import{consola as o}from"consola";var u={...i,name:{description:"Name(s)/pattern(s) of the server(s) to stop",required:!0,type:"positional",valueHint:"glob"}},v={description:"Stop servers",name:"stop"},D=S({args:u,meta:v,run:async p=>{let{debug:t,name:l}=p.args,f=l.split(","),s=(await g.scan({debug:t,globs:f})).filter(c);if(s.length===0)return o.log(`\u26A0\uFE0F No ${e} servers found to stop.
|
|
3
|
-
`);if(o.log(`\u26B0\uFE0F Stopping the following ${e} servers:
|
|
4
|
-
|
|
5
|
-
${a(s)}`),!await m({confirmationText:"i will interrupt sessions",debug:t}))return;(await Promise.allSettled(s.map(async r=>{await d(r,t),o.log(`\u{1F480} Stopped ${e} server ${n(r.name)}.`)}))).some(r=>r.status==="rejected")&&(o.error(`Potentially failed to stop some ${e} servers.`),process.exitCode||=1),o.log("")}});export{D as StopCommand};
|