@flexkit/cli 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -152,12 +152,12 @@ ${I.style.description(o.description)}`:"";return `${[C,a,D].filter(Boolean).join
|
|
|
152
152
|
${p}${h}${y}${qy.default.cursorHide}`});var tF=EA($y());var eF=`${bI().name} ${bI().version} node-${process.version} ${AF__default.default.platform()} (${AF__default.default.arch()})`;function vg(t){return new Promise(A=>{setTimeout(A,t);})}var KK=t=>typeof t=="object"&&t.constructor===Object,qC=class extends events.EventEmitter{argv;apiUrl;authUrl;authConfig;stdin;stdout;stderr;output;config;agent;flexkitConfig;localConfigPath;requestIdCounter;input;constructor(A){super(),this.agent=A.agent,this.argv=A.argv,this.apiUrl=A.apiUrl,this.authUrl=A.authUrl,this.authConfig=A.authConfig,this.stdin=A.stdin,this.stdout=A.stdout,this.stderr=A.stderr,this.output=A.output,this.config=A.config,this.flexkitConfig=A.flexkitConfig,this.localConfigPath=A.localConfigPath,this.requestIdCounter=1;let e={prefix:(0, ca.gray)("?"),style:{answer:ca.gray}};this.input={text:g=>Oy({theme:e,...g},{input:this.stdin,output:this.stderr}),checkbox:g=>Yy({theme:e,...g},{input:this.stdin,output:this.stderr}),expand:g=>Py({theme:e,...g},{input:this.stdin,output:this.stderr}),confirm:g=>Ty({theme:e,...g},{input:this.stdin,output:this.stderr}),select:g=>_y({theme:e,...g},{input:this.stdin,output:this.stderr})};}retry(A,{retries:e=3,maxTimeout:g=1/0}={}){return (0, tF.default)(A,{retries:e,maxTimeout:g,onRetry:this._onRetry})}_fetch(A,e={}){let g=this.apiUrl;e.projectId&&(g=this.apiUrl.replace("https://",`https://${e.projectId}.`));let i=new url.URL(A,g),I=new Headers(e.headers);I.set("user-agent",eF),this.authConfig.token&&I.set("authorization",this.authConfig.token);let C;KK(e.body)?(C=JSON.stringify(e.body),I.set("content-type","application/json; charset=utf-8")):C=e.body;let B=this.requestIdCounter++,{json:s,retry:u,projectId:E,headers:c,body:Q,...r}=e;return this.output.time(n=>n?`#${B.toString()} \u2190 ${n.status.toString()} ${n.statusText}: ${n.headers.get("x-vercel-id")??""}`:`#${B.toString()} \u2192 ${e.method??"GET"} ${i.href}`,fetch(i,{...r,headers:I,body:C}))}fetch(A,e={}){return this.retry(async g=>{let i=await this._fetch(A,e);if(!i.ok){let C=await Cs(i);if(i.status>=400&&i.status<500)return g(C),null;throw C}if(e.json===false)return i;let I=i.headers.get("content-type");return I?I.includes("application/json")?i.json():i:null},e.retry)}async*fetchPaginated(A,e){let g=typeof A=="string"?new url.URL(A,this.apiUrl):new url.URL(A.href);g.searchParams.has("limit")||g.searchParams.set("limit","100");let i;do{i&&(await vg(100),g.searchParams.set("until",String(i)));let I=await this.fetch(g.href,e);yield I,i=I.pagination.next;}while(i)}_onRetry=(A,e)=>{if(A instanceof Error){this.output.debug(`Retrying (attempt ${e.toString()}): ${A.toString()}
|
|
153
153
|
${A.stack??""}`);return}this.output.debug(`Retrying (attempt ${e.toString()}): ${String(A)}`);};get cwd(){return process.cwd()}set cwd(A){process.chdir(A);}};var la=Symbol("fileName");var HK=["flexkit.config.js","flexkit.config.jsx","flexkit.config.ts","flexkit.config.tsx"],TI;async function Da(t,A){if(TI)return TI;let e;try{e=process.cwd();}catch(C){if(qe(C)&&C.code==="ENOENT")return new Ir;throw C}if(A){let C=WB__default.default.resolve(e,A);if(!_B__default.default.existsSync(C))return new qg([je(C)]);t.debug(`Found config in provided --local-config path ${C}`);let B=await gF(C);if(B instanceof ug)return B;let s=Array.isArray(B)?B:[B];return TI={[la]:A,projects:s},TI}let g=HK.map(C=>WB__default.default.join(e,C)).find(C=>_B__default.default.existsSync(C))??"not-found";if(g==="not-found")return new qg([je(e)]);t.debug(`Attempting to read config from ${g}`);let i=await gF(g);if(i instanceof ug)return i;let I=Array.isArray(i)?i:[i];return TI={[la]:A,projects:I},TI}async function gF(t){let A=WB__default.default.dirname(t),e;try{e=WB__default.default.resolve(A,`${TK()}-temp.mjs`),await iF__namespace.build({entryPoints:[t],bundle:!0,outfile:e,format:"esm",platform:"node",target:"node16",ignoreAnnotations:!0,loader:{".css":"empty"},banner:{js:`
|
|
154
154
|
import { createRequire } from 'module';
|
|
155
|
-
import
|
|
155
|
+
import __flexkitReact from 'react';
|
|
156
156
|
const require = createRequire(import.meta.url);
|
|
157
|
-
globalThis.React =
|
|
157
|
+
globalThis.React = __flexkitReact;
|
|
158
158
|
globalThis.__require = require;
|
|
159
159
|
globalThis.__util = require('util');
|
|
160
|
-
`},plugins:[{name:"handle-node-builtins",setup(C){C.onResolve({filter:/^react
|
|
160
|
+
`},plugins:[{name:"handle-node-builtins",setup(C){C.onResolve({filter:/^react(?:\/jsx-runtime|\/jsx-dev-runtime)?$/},B=>({path:B.path,external:!0})),C.onResolve({filter:/^react-dom(?:\/client|\/server|\/test-utils)?$/},B=>({path:B.path,external:!0})),C.onResolve({filter:/^util$/},()=>({path:"util-stub",namespace:"node-builtin"})),C.onResolve({filter:/^(?:tty|os|path|fs|stream|events|assert|process)$/},B=>({path:B.path,namespace:"node-builtin"})),C.onLoad({filter:/^util-stub$/,namespace:"node-builtin"},()=>({contents:`
|
|
161
161
|
const util = globalThis.__util;
|
|
162
162
|
export default util;
|
|
163
163
|
export const {
|