edgeone 1.1.18-beta.2 → 1.1.18-beta.3
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/edgeone-dist/cli.js +168 -169
- package/edgeone-dist/pages/dev/runner-worker.js +16 -17
- package/package.json +1 -1
|
@@ -1307,8 +1307,7 @@ const server = http.createServer(async (req, res) => {
|
|
|
1307
1307
|
server.listen(port, () => {
|
|
1308
1308
|
});
|
|
1309
1309
|
|
|
1310
|
-
export { server };`,h=Vs.default.join(".edgeone/node-functions","index.mjs"),S={stdin:{contents:f,loader:"ts",resolveDir:process.cwd()},bundle:!0,format:"esm",platform:"node",target:"node14",outfile:h,minify:!1,treeShaking:!0,banner:{js:Vj}};await hw.default.build(S)}async buildProdMode(){try{let e=".edgeone/node-functions";try{await Yi.default.promises.rm(e,{recursive:!0,force:!0})}catch{}try{await Yi.default.promises.mkdir(e,{recursive:!0})}catch(n){throw new e0(`Failed to prepare output directory: ${n.message}`,"OUTPUT_DIR_ERROR")}b$&&await D$(),await this.saveRouteMetadata(this.generateRoutes()),gs("Node functions build start"),await this.buildCloudFunctions(),gs("\u2728 Node functions build completed successfully")}catch(e){throw new e0(`Build failed in production mode: ${e.message}`,"BUILD_ERROR")}}async buildDevMode(){try{let e=".edgeone/node-functions";try{await Yi.default.promises.rm(e,{recursive:!0,force:!0}),await Yi.default.promises.mkdir(e,{recursive:!0})}catch(o){throw new e0(`Failed to prepare output directory: ${o.message}`,"OUTPUT_DIR_ERROR")}b$&&await D$(),await this.saveRouteMetadata(this.generateRoutes()),await this.buildCloudFunctions({watch:!0});let n=Vs.default.join(e,"launcher.js");await hw.default.build({stdin:{contents:this.generateLauncherCode(),loader:"ts",resolveDir:process.cwd()},bundle:!0,format:"cjs",platform:"node",target:"node14",outfile:n,minify:!1}),gs("\u2728 Node functions for dev mode build completed successfully")}catch(e){throw new e0(`Build failed in development mode: ${e.message}`,"BUILD_ERROR")}}async build(e={port:9e3}){if(this.wrapPort=e.port,this.functionList=[],await this.scanDirectory(R2.FUNCTION),this.functionList=this.removeDuplicateRoutes(this.functionList),this.functionList=this.functionList.filter(u=>Yi.default.existsSync(u.filePath)?!0:(console.warn(`File not found, skipping: ${u.filePath}`),!1)),this.functionList.length===0)return gs("No node functions found"),{logicText:"",bundleText:"",cssText:"",routes:[]};this.mode==="dev"?await this.buildDevMode():await this.buildProdMode();let o=this.generateRoutes().map(u=>this.generateRouteMetadata(u.filePath,u));return{logicText:this.logicText,bundleText:this.bundleText,cssText:this.cssText,routes:o}}}});var Uh,BJe,jJe,qJe,UJe,N$,F$,yw,M$=qt(()=>{G4();zm();Gg();zp();J4();Uh=require("fs"),BJe=require("path"),jJe=require("esbuild"),qJe="./.edgeone/edge-functions/index.js",UJe="./.edgeone/edge-functions/meta.json",N$=/^\/(?:[^/]+\/)*\[(.+?)\]/,F$=/^\/(?:[^/]+\/)*\[\[(.+?)\]\]$/,yw=class{mode;env;logicText;bundleText;cssText;functionList;functionListKeys;functionIndex;silent;FUNCTIONPATH;
|
|
1311
|
-
`),this.functionList=this.functionList.filter(n=>this.functionListKeys.includes(n.routePath)),this.cssText){let n=Tl("edgeone.json");if(Uh.existsSync(n)){let{staticDir:o}=JSON.parse(Uh.readFileSync(n).toString()),u=`${Tl(o)}/edgeone_pages_assets/index.css`;__(u,this.cssText)}}this.logicText&&(this.bundleText=`
|
|
1310
|
+
export { server };`,h=Vs.default.join(".edgeone/node-functions","index.mjs"),S={stdin:{contents:f,loader:"ts",resolveDir:process.cwd()},bundle:!0,format:"esm",platform:"node",target:"node14",outfile:h,minify:!1,treeShaking:!0,banner:{js:Vj}};await hw.default.build(S)}async buildProdMode(){try{let e=".edgeone/node-functions";try{await Yi.default.promises.rm(e,{recursive:!0,force:!0})}catch{}try{await Yi.default.promises.mkdir(e,{recursive:!0})}catch(n){throw new e0(`Failed to prepare output directory: ${n.message}`,"OUTPUT_DIR_ERROR")}b$&&await D$(),await this.saveRouteMetadata(this.generateRoutes()),gs("Node functions build start"),await this.buildCloudFunctions(),gs("\u2728 Node functions build completed successfully")}catch(e){throw new e0(`Build failed in production mode: ${e.message}`,"BUILD_ERROR")}}async buildDevMode(){try{let e=".edgeone/node-functions";try{await Yi.default.promises.rm(e,{recursive:!0,force:!0}),await Yi.default.promises.mkdir(e,{recursive:!0})}catch(o){throw new e0(`Failed to prepare output directory: ${o.message}`,"OUTPUT_DIR_ERROR")}b$&&await D$(),await this.saveRouteMetadata(this.generateRoutes()),await this.buildCloudFunctions({watch:!0});let n=Vs.default.join(e,"launcher.js");await hw.default.build({stdin:{contents:this.generateLauncherCode(),loader:"ts",resolveDir:process.cwd()},bundle:!0,format:"cjs",platform:"node",target:"node14",outfile:n,minify:!1}),gs("\u2728 Node functions for dev mode build completed successfully")}catch(e){throw new e0(`Build failed in development mode: ${e.message}`,"BUILD_ERROR")}}async build(e={port:9e3}){if(this.wrapPort=e.port,this.functionList=[],await this.scanDirectory(R2.FUNCTION),this.functionList=this.removeDuplicateRoutes(this.functionList),this.functionList=this.functionList.filter(u=>Yi.default.existsSync(u.filePath)?!0:(console.warn(`File not found, skipping: ${u.filePath}`),!1)),this.functionList.length===0)return gs("No node functions found"),{logicText:"",bundleText:"",cssText:"",routes:[]};this.mode==="dev"?await this.buildDevMode():await this.buildProdMode();let o=this.generateRoutes().map(u=>this.generateRouteMetadata(u.filePath,u));return{logicText:this.logicText,bundleText:this.bundleText,cssText:this.cssText,routes:o}}}});var Uh,BJe,jJe,qJe,UJe,N$,F$,yw,M$=qt(()=>{G4();zm();Gg();zp();J4();Uh=require("fs"),BJe=require("path"),jJe=require("esbuild"),qJe="./.edgeone/edge-functions/index.js",UJe="./.edgeone/edge-functions/meta.json",N$=/^\/(?:[^/]+\/)*\[(.+?)\]/,F$=/^\/(?:[^/]+\/)*\[\[(.+?)\]\]$/,yw=class{mode;env;logicText;bundleText;cssText;functionList;functionListKeys;functionIndex;silent;FUNCTIONPATH;constructor(e){if(this.mode=e.mode||"prod",this.env=e.env,this.logicText="",this.bundleText="",this.cssText="",this.functionList=[],this.functionListKeys=[],this.functionIndex=0,this.silent=e.silent,!e.env){let o={};try{let u=Tl("./.env");Uh.existsSync(u)||(u=Tl("./.env.local")),o=M_(u),delete o.TENCENT_SECRET_ID,delete o.TENCENT_SECRET_KEY,this.env=o}catch{this.env={};for(let[r,f]of Object.entries(process.env))/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(r)&&(this.env[r]=f)}}let n=Tl("./edge-functions");Uh.existsSync(n)?this.FUNCTIONPATH="./edge-functions":this.FUNCTIONPATH="./functions"}static async decide(){let e=Tl("./edge-functions"),o=Uh.existsSync(e)?"./edge-functions":"./functions";try{return Uh.readdirSync(o).length>0}catch{return!1}}initBuildState(){this.logicText="",this.bundleText="",this.cssText="",this.functionList=[],this.functionListKeys=[],this.functionIndex=0}async build(){if(this.initBuildState(),await this.readIndexFiles(this.FUNCTIONPATH),this.functionList=this.functionList.filter(n=>this.functionListKeys.includes(n.routePath)),this.cssText){let n=Tl("edgeone.json");if(Uh.existsSync(n)){let{staticDir:o}=JSON.parse(Uh.readFileSync(n).toString()),u=`${Tl(o)}/edgeone_pages_assets/index.css`;__(u,this.cssText)}}this.logicText&&(this.bundleText=`
|
|
1312
1311
|
let global = globalThis;
|
|
1313
1312
|
|
|
1314
1313
|
class MessageChannel {
|
|
@@ -1374,45 +1373,45 @@ export { server };`,h=Vs.default.join(".edgeone/node-functions","index.mjs"),S={
|
|
|
1374
1373
|
}
|
|
1375
1374
|
return pagesFunctionResponse({request, params, env: ${this.env?JSON.stringify(this.env):"{}"}, waitUntil });
|
|
1376
1375
|
}
|
|
1377
|
-
addEventListener('fetch', event=>{return event.respondWith(handleRequest({request:event.request,params: {}, env: ${this.env?JSON.stringify(this.env):"{}"}, waitUntil: event.waitUntil }))});`,__(qJe,this.bundleText),gs("\u2728 Compiled edge functions successfully"));let e=JSON.stringify({routes:this.functionList||[]},null,2);return this.logicText&&__(UJe,e),{bundle:this.bundleText,meta:e,routes:this.functionList||[],watch:[]}}async readIndexFiles(e){try{let n=Uh.readdirSync(e);for(let o of n){let u=BJe.join(e,o);if(Uh.statSync(u).isDirectory())this.readIndexFiles(u);else if(/\.(ts|js|cjs|tsx|jsx)$/.test(o)){let f=Uh.readFileSync(u,"utf-8");if(this.isPagesFunction(f)){let h=this.bundleAndGetString(u);h&&this.isPagesFunction(h.text)&&this.arrangeText(h)}}}}catch(n){this.mode==="dev"&&console.log("error",n.message)}}isPagesFunction(e){return e.indexOf("onRequest")>-1}matchPath(e){let n=/^\/(?:[^/]+\/)*\[\[(.+?)\]\]$/;if(n.test(e)&&e.indexOf("[[")>-1){let o=n.exec(e);if(o[1])return{id:o[1],mode:2,left:e.replace(`[[${o[1]}]]`,"")}}else if(N$.test(e)){let o=N$.exec(e),u=/\[(.*?)\]/g,f=e.match(u).map(S=>S.slice(1,-1)),h=JSON.parse(JSON.stringify(e));if(f==null||f.forEach(S=>{h=h.replace(`[${S}]`,"([^/]*)")}),h=h.replace(/\//g,"\\/"),o[1])return{id:f,mode:1,left:h}}else return{id:"",mode:0,left:""}}arrangeText(e){let n=e.text;if(/onRequest(?![a-zA-Z])/.test(n)){n=e.text.replace(/\}\)\(\)\;\n(
|
|
1376
|
+
addEventListener('fetch', event=>{return event.respondWith(handleRequest({request:event.request,params: {}, env: ${this.env?JSON.stringify(this.env):"{}"}, waitUntil: event.waitUntil }))});`,__(qJe,this.bundleText),gs("\u2728 Compiled edge functions successfully"));let e=JSON.stringify({routes:this.functionList||[]},null,2);return this.logicText&&__(UJe,e),{bundle:this.bundleText,meta:e,routes:this.functionList||[],watch:[]}}async readIndexFiles(e){try{let n=Uh.readdirSync(e);for(let o of n){let u=BJe.join(e,o);if(Uh.statSync(u).isDirectory())this.readIndexFiles(u);else if(/\.(ts|js|cjs|tsx|jsx)$/.test(o)){let f=Uh.readFileSync(u,"utf-8");if(this.isPagesFunction(f)){let h=this.bundleAndGetString(u);h&&this.isPagesFunction(h.text)&&this.arrangeText(h)}}}}catch(n){this.mode==="dev"&&console.log("error",n.message)}}isPagesFunction(e){return e.indexOf("onRequest")>-1}matchPath(e){let n=/^\/(?:[^/]+\/)*\[\[(.+?)\]\]$/;if(n.test(e)&&e.indexOf("[[")>-1){let o=n.exec(e);if(o[1])return{id:o[1],mode:2,left:e.replace(`[[${o[1]}]]`,"")}}else if(N$.test(e)){let o=N$.exec(e),u=/\[(.*?)\]/g,f=e.match(u).map(S=>S.slice(1,-1)),h=JSON.parse(JSON.stringify(e));if(f==null||f.forEach(S=>{h=h.replace(`[${S}]`,"([^/]*)")}),h=h.replace(/\//g,"\\/"),o[1])return{id:f,mode:1,left:h}}else return{id:"",mode:0,left:""}}arrangeText(e){let n=e.text;if(/onRequest(?![a-zA-Z])/.test(n)){n=e.text.replace(/\}\)\(\)\;\n(?:\/\*[\s\S]*?\*\/\n?)*responseFoo/,`
|
|
1378
1377
|
pagesFunctionResponse = onRequest;
|
|
1379
|
-
})();`);let u=this.matchPath(`${e.path}`)
|
|
1380
|
-
if(
|
|
1378
|
+
})();`);let u=this.matchPath(`${e.path}`);if(u.mode===0)this.logicText+=`
|
|
1379
|
+
if('${e.path}' === urlInfo.pathname) {
|
|
1381
1380
|
matchedFunc = true;
|
|
1382
1381
|
${n}
|
|
1383
1382
|
}
|
|
1384
|
-
|
|
1385
|
-
if(
|
|
1383
|
+
`,this.recordFunc(e,"onRequest");else if(u.mode===1)this.logicText+=`
|
|
1384
|
+
if(/^${u.left}$/.test(urlInfo.pathname)) {
|
|
1386
1385
|
routeParams = ${JSON.stringify(u)};
|
|
1387
1386
|
matchedFunc = true;
|
|
1388
1387
|
${n}
|
|
1389
1388
|
}
|
|
1390
|
-
|
|
1391
|
-
if(
|
|
1389
|
+
`,this.recordFunc(e,"onRequest");else if(u.mode===2){let r=F$.exec(`${e.path}`),f=`${e.path}`.replace(`[[${r[1]}]]`,"").replace(/\//g,"\\/");this.logicText+=`
|
|
1390
|
+
if(/^${f}(.+?)$/.test(urlInfo.pathname)) {
|
|
1392
1391
|
routeParams = ${JSON.stringify(u)};
|
|
1393
1392
|
matchedFunc = true;
|
|
1394
1393
|
${n}
|
|
1395
1394
|
}
|
|
1396
|
-
|
|
1395
|
+
`,this.recordFunc(e,"onRequest")}}Bj.forEach(u=>{if(n.indexOf(u.funcName)>-1){n=e.text.replace(/\}\)\(\)\;\n(?:\/\*[\s\S]*?\*\/\n?)*responseFoo/,`
|
|
1397
1396
|
pagesFunctionResponse = ${u.funcName};
|
|
1398
|
-
})();`);let r=this.matchPath(e.path)
|
|
1399
|
-
if(
|
|
1397
|
+
})();`);let r=this.matchPath(e.path);if(r.mode===0)this.logicText+=`
|
|
1398
|
+
if('${e.path}' === urlInfo.pathname && request.method === '${u.method}') {
|
|
1400
1399
|
matchedFunc = true;
|
|
1401
1400
|
${n}
|
|
1402
1401
|
}
|
|
1403
|
-
|
|
1404
|
-
if(
|
|
1402
|
+
`,this.recordFunc(e,u.funcName);else if(r.mode===1)this.logicText+=`
|
|
1403
|
+
if(/^${r.left}$/.test(urlInfo.pathname) && request.method === '${u.method}') {
|
|
1405
1404
|
routeParams = ${JSON.stringify(r)};
|
|
1406
1405
|
matchedFunc = true;
|
|
1407
1406
|
${n}
|
|
1408
1407
|
}
|
|
1409
|
-
|
|
1410
|
-
if(
|
|
1408
|
+
`,this.recordFunc(e,u.funcName);else if(r.mode===2){let f=F$.exec(`${e.path}`),h=`${e.path}`.replace(`[[${f[1]}]]`,"").replace(/\//g,"\\/");this.logicText+=`
|
|
1409
|
+
if(/^${h}(.+?)$/.test(urlInfo.pathname) && request.method === '${u.method}') {
|
|
1411
1410
|
routeParams = ${JSON.stringify(r)};
|
|
1412
1411
|
matchedFunc = true;
|
|
1413
1412
|
${n}
|
|
1414
1413
|
}
|
|
1415
|
-
|
|
1414
|
+
`,this.recordFunc(e,u.funcName)}}}),this.functionIndex=this.functionIndex+1}getMountPath(e){let n=e.replace(/\/([^/]+)$/g,"");return n||"/"}recordFunc(e,n){try{let o=e.path.replace(this.FUNCTIONPATH.replace(/\.\//,""),"").replace(/\/\[\[([^/]+)\]\]$/,"/:$1*").replace(/\/\[([^/]+)\]/g,"/:$1");this.functionListKeys.push(o);let u=G0,r=[];if(n==="onRequest"){for(let h of u)e.text.toLowerCase().includes("onrequest"+h.toLowerCase())&&r.push(h);r.length||(r=[...G0])}else r=[n.replace("onRequest","").toUpperCase()];let f=this.functionList.findIndex(h=>h.routePath===o);if(f>=0){let h=this.functionList[f],S=Array.isArray(h.method)?h.method:[h.method],v=Array.isArray(r)?r:[r],b=[...new Set([...S,...v])],P=[...new Set([...h.module,`${e.filePath}:${n}`])];this.functionList[f]={...h,method:b,module:P}}else{let h={routePath:o,mountPath:this.getMountPath(o),method:r,module:[`${e.filePath}:${n}`]};this.functionList.push(h)}}catch(o){console.log(o.message)}}bundleAndGetString(e){let n={};for(let f in this.env)/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(f)&&(n[`env.${f}`]=JSON.stringify(this.env[f]));let o=jJe.buildSync({entryPoints:[e],bundle:!0,write:!1,outfile:"./.tef_dist/assets.js",define:n}),{outputFiles:u}=o,r;for(let f of u)if(f.path.includes(".css"))this.cssText+=f.text;else{let h=/\.(js|ts|cjs|tsx|jsx)$/,S=f.text;e=e.replace(/\\/g,"/");let v=e.replace(/\/index\.(js|ts|cjs|tsx|jsx)/,".js").replace(h,"").replace(this.FUNCTIONPATH.replace(/\.\//,""),"");r={filePath:e.replace(this.FUNCTIONPATH,""),path:v===""?"/":v,text:`${S}responseFoo`}}return r}}});var U$=$((j1,q$)=>{"use strict";var MN=require("crypto");j1=q$.exports=MS;function MS(t,e){return e=B$(t,e),VJe(t,e)}j1.sha1=function(t){return MS(t)};j1.keys=function(t){return MS(t,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})};j1.MD5=function(t){return MS(t,{algorithm:"md5",encoding:"hex"})};j1.keysMD5=function(t){return MS(t,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var B2=MN.getHashes?MN.getHashes().slice():["sha1","md5"];B2.push("passthrough");var L$=["buffer","hex","binary","base64"];function B$(t,e){e=e||{};var n={};if(n.algorithm=e.algorithm||"sha1",n.encoding=e.encoding||"hex",n.excludeValues=!!e.excludeValues,n.algorithm=n.algorithm.toLowerCase(),n.encoding=n.encoding.toLowerCase(),n.ignoreUnknown=e.ignoreUnknown===!0,n.respectType=e.respectType!==!1,n.respectFunctionNames=e.respectFunctionNames!==!1,n.respectFunctionProperties=e.respectFunctionProperties!==!1,n.unorderedArrays=e.unorderedArrays===!0,n.unorderedSets=e.unorderedSets!==!1,n.unorderedObjects=e.unorderedObjects!==!1,n.replacer=e.replacer||void 0,n.excludeKeys=e.excludeKeys||void 0,typeof t>"u")throw new Error("Object argument required.");for(var o=0;o<B2.length;++o)B2[o].toLowerCase()===n.algorithm.toLowerCase()&&(n.algorithm=B2[o]);if(B2.indexOf(n.algorithm)===-1)throw new Error('Algorithm "'+n.algorithm+'" not supported. supported values: '+B2.join(", "));if(L$.indexOf(n.encoding)===-1&&n.algorithm!=="passthrough")throw new Error('Encoding "'+n.encoding+'" not supported. supported values: '+L$.join(", "));return n}function R$(t){if(typeof t!="function")return!1;var e=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;return e.exec(Function.prototype.toString.call(t))!=null}function VJe(t,e){var n;e.algorithm!=="passthrough"?n=MN.createHash(e.algorithm):n=new j$,typeof n.write>"u"&&(n.write=n.update,n.end=n.update);var o=LN(e,n);if(o.dispatch(t),n.update||n.end(""),n.digest)return n.digest(e.encoding==="buffer"?void 0:e.encoding);var u=n.read();return e.encoding==="buffer"?u:u.toString(e.encoding)}j1.writeToStream=function(t,e,n){return typeof n>"u"&&(n=e,e={}),e=B$(t,e),LN(e,n).dispatch(t)};function LN(t,e,n){n=n||[];var o=function(u){return e.update?e.update(u,"utf8"):e.write(u,"utf8")};return{dispatch:function(u){t.replacer&&(u=t.replacer(u));var r=typeof u;return u===null&&(r="null"),this["_"+r](u)},_object:function(u){var r=/\[object (.*)\]/i,f=Object.prototype.toString.call(u),h=r.exec(f);h?h=h[1]:h="unknown:["+f+"]",h=h.toLowerCase();var S=null;if((S=n.indexOf(u))>=0)return this.dispatch("[CIRCULAR:"+S+"]");if(n.push(u),typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(u))return o("buffer:"),o(u);if(h!=="object"&&h!=="function"&&h!=="asyncfunction")if(this["_"+h])this["_"+h](u);else{if(t.ignoreUnknown)return o("["+h+"]");throw new Error('Unknown object type "'+h+'"')}else{var v=Object.keys(u);t.unorderedObjects&&(v=v.sort()),t.respectType!==!1&&!R$(u)&&v.splice(0,0,"prototype","__proto__","constructor"),t.excludeKeys&&(v=v.filter(function(P){return!t.excludeKeys(P)})),o("object:"+v.length+":");var b=this;return v.forEach(function(P){b.dispatch(P),o(":"),t.excludeValues||b.dispatch(u[P]),o(",")})}},_array:function(u,r){r=typeof r<"u"?r:t.unorderedArrays!==!1;var f=this;if(o("array:"+u.length+":"),!r||u.length<=1)return u.forEach(function(v){return f.dispatch(v)});var h=[],S=u.map(function(v){var b=new j$,P=n.slice(),F=LN(t,b,P);return F.dispatch(v),h=h.concat(P.slice(n.length)),b.read().toString()});return n=n.concat(h),S.sort(),this._array(S,!1)},_date:function(u){return o("date:"+u.toJSON())},_symbol:function(u){return o("symbol:"+u.toString())},_error:function(u){return o("error:"+u.toString())},_boolean:function(u){return o("bool:"+u.toString())},_string:function(u){o("string:"+u.length+":"),o(u.toString())},_function:function(u){o("fn:"),R$(u)?this.dispatch("[native]"):this.dispatch(u.toString()),t.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(u.name)),t.respectFunctionProperties&&this._object(u)},_number:function(u){return o("number:"+u.toString())},_xml:function(u){return o("xml:"+u.toString())},_null:function(){return o("Null")},_undefined:function(){return o("Undefined")},_regexp:function(u){return o("regex:"+u.toString())},_uint8array:function(u){return o("uint8array:"),this.dispatch(Array.prototype.slice.call(u))},_uint8clampedarray:function(u){return o("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(u))},_int8array:function(u){return o("uint8array:"),this.dispatch(Array.prototype.slice.call(u))},_uint16array:function(u){return o("uint16array:"),this.dispatch(Array.prototype.slice.call(u))},_int16array:function(u){return o("uint16array:"),this.dispatch(Array.prototype.slice.call(u))},_uint32array:function(u){return o("uint32array:"),this.dispatch(Array.prototype.slice.call(u))},_int32array:function(u){return o("uint32array:"),this.dispatch(Array.prototype.slice.call(u))},_float32array:function(u){return o("float32array:"),this.dispatch(Array.prototype.slice.call(u))},_float64array:function(u){return o("float64array:"),this.dispatch(Array.prototype.slice.call(u))},_arraybuffer:function(u){return o("arraybuffer:"),this.dispatch(new Uint8Array(u))},_url:function(u){return o("url:"+u.toString(),"utf8")},_map:function(u){o("map:");var r=Array.from(u);return this._array(r,t.unorderedSets!==!1)},_set:function(u){o("set:");var r=Array.from(u);return this._array(r,t.unorderedSets!==!1)},_file:function(u){return o("file:"),this.dispatch([u.name,u.size,u.type,u.lastModfied])},_blob:function(){if(t.ignoreUnknown)return o("[blob]");throw Error(`Hashing Blob objects is currently not supported
|
|
1416
1415
|
(see https://github.com/puleos/object-hash/issues/26)
|
|
1417
1416
|
Use "options.replacer" or "options.ignoreUnknown"
|
|
1418
1417
|
`)},_domwindow:function(){return o("domwindow")},_bigint:function(u){return o("bigint:"+u.toString())},_process:function(){return o("process")},_timer:function(){return o("timer")},_pipe:function(){return o("pipe")},_tcp:function(){return o("tcp")},_udp:function(){return o("udp")},_tty:function(){return o("tty")},_statwatcher:function(){return o("statwatcher")},_securecontext:function(){return o("securecontext")},_connection:function(){return o("connection")},_zlib:function(){return o("zlib")},_context:function(){return o("context")},_nodescript:function(){return o("nodescript")},_httpparser:function(){return o("httpparser")},_dataview:function(){return o("dataview")},_signal:function(){return o("signal")},_fsevent:function(){return o("fsevent")},_tlswrap:function(){return o("tlswrap")}}}function j$(){return{buf:"",write:function(t){this.buf+=t},end:function(t){this.buf+=t},read:function(){return this.buf}}}});var H$=$(t0=>{"use strict";var WJe=t0&&t0.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t0,"__esModule",{value:!0});t0.Skeleton=t0.Cell=t0.Header=void 0;var ip=WJe(Bs()),j2=d_(),zJe=U$(),RN=class extends ip.default.Component{constructor(){super(...arguments),this.header=LS({cell:this.getConfig().skeleton,padding:this.getConfig().padding,skeleton:{component:this.getConfig().skeleton,line:"\u2500",left:"\u250C",right:"\u2510",cross:"\u252C"}}),this.heading=LS({cell:this.getConfig().header,padding:this.getConfig().padding,skeleton:{component:this.getConfig().skeleton,line:" ",left:"\u2502",right:"\u2502",cross:"\u2502"}}),this.separator=LS({cell:this.getConfig().skeleton,padding:this.getConfig().padding,skeleton:{component:this.getConfig().skeleton,line:"\u2500",left:"\u251C",right:"\u2524",cross:"\u253C"}}),this.data=LS({cell:this.getConfig().cell,padding:this.getConfig().padding,skeleton:{component:this.getConfig().skeleton,line:" ",left:"\u2502",right:"\u2502",cross:"\u2502"}}),this.footer=LS({cell:this.getConfig().skeleton,padding:this.getConfig().padding,skeleton:{component:this.getConfig().skeleton,line:"\u2500",left:"\u2514",right:"\u2518",cross:"\u2534"}})}getConfig(){return{data:this.props.data,columns:this.props.columns||this.getDataKeys(),padding:this.props.padding||1,header:this.props.header||V$,cell:this.props.cell||W$,skeleton:this.props.skeleton||z$}}getDataKeys(){let e=new Set;for(let n of this.props.data)for(let o in n)e.add(o);return Array.from(e)}getColumns(){let{columns:e,padding:n}=this.getConfig();return e.map(u=>{let r=String(u).length,f=this.props.data.map(S=>{let v=S[u];return v==null||v==null?0:String(v).length}),h=Math.max(...f,r)+n*2;return{column:u,width:h,key:String(u)}})}getHeadings(){let{columns:e}=this.getConfig();return e.reduce((o,u)=>({...o,[u]:u}),{})}render(){let e=this.getColumns(),n=this.getHeadings();return ip.default.createElement(j2.Box,{flexDirection:"column"},this.header({key:"header",columns:e,data:{}}),this.heading({key:"heading",columns:e,data:n}),this.props.data.map((o,u)=>{let r=`row-${(0,zJe.sha1)(o)}-${u}`;return ip.default.createElement(j2.Box,{flexDirection:"column",key:r},this.separator({key:`separator-${r}`,columns:e,data:{}}),this.data({key:`data-${r}`,columns:e,data:o}))}),this.footer({key:"footer",columns:e,data:{}}))}};t0.default=RN;function LS(t){let e=t.skeleton;return n=>ip.default.createElement(j2.Box,{flexDirection:"row"},ip.default.createElement(e.component,null,e.left),...HJe(o=>{let u=`${n.key}-hseparator-${o}`;return ip.default.createElement(e.component,{key:u},e.cross)},n.columns.map((o,u)=>{let r=n.data[o.column];if(r==null||r==null){let f=`${n.key}-empty-${o.key}`;return ip.default.createElement(t.cell,{key:f,column:u},e.line.repeat(o.width))}else{let f=`${n.key}-cell-${o.key}`,h=t.padding,S=o.width-String(r).length-t.padding;return ip.default.createElement(t.cell,{key:f,column:u},`${e.line.repeat(h)}${String(r)}${e.line.repeat(S)}`)}})),ip.default.createElement(e.component,null,e.right))}function V$(t){return ip.default.createElement(j2.Text,{bold:!0,color:"blue"},t.children)}t0.Header=V$;function W$(t){return ip.default.createElement(j2.Text,null,t.children)}t0.Cell=W$;function z$(t){return ip.default.createElement(j2.Text,{bold:!0},t.children)}t0.Skeleton=z$;function HJe(t,e){return e.reduce((o,u,r)=>o.length===0?[u]:[...o,t(r),u],[])}});async function q1(){return await E_("login_region")}var H1t,$1t,gw=qt(()=>{zm();zp();H1t=require("fs"),$1t=require("path")});var vw,BN=qt(()=>{vw=(t,e)=>{try{process.send(JSON.stringify({name:"error",value:JSON.stringify({message:t,appid:process.env.AppId,error:{message:e.message,stack:e.stack},app_type:"cli",instance_id:process.env.ProjectId||""})}))}catch{}}});var Eo=$((G1t,Y$)=>{"use strict";var{FORCE_COLOR:$Je,NODE_DISABLE_COLORS:YJe,TERM:KJe}=process.env,xs={enabled:!YJe&&KJe!=="dumb"&&$Je!=="0",reset:Ws(0,0),bold:Ws(1,22),dim:Ws(2,22),italic:Ws(3,23),underline:Ws(4,24),inverse:Ws(7,27),hidden:Ws(8,28),strikethrough:Ws(9,29),black:Ws(30,39),red:Ws(31,39),green:Ws(32,39),yellow:Ws(33,39),blue:Ws(34,39),magenta:Ws(35,39),cyan:Ws(36,39),white:Ws(37,39),gray:Ws(90,39),grey:Ws(90,39),bgBlack:Ws(40,49),bgRed:Ws(41,49),bgGreen:Ws(42,49),bgYellow:Ws(43,49),bgBlue:Ws(44,49),bgMagenta:Ws(45,49),bgCyan:Ws(46,49),bgWhite:Ws(47,49)};function $$(t,e){let n=0,o,u="",r="";for(;n<t.length;n++)o=t[n],u+=o.open,r+=o.close,e.includes(o.close)&&(e=e.replace(o.rgx,o.close+o.open));return u+e+r}function GJe(t,e){let n={has:t,keys:e};return n.reset=xs.reset.bind(n),n.bold=xs.bold.bind(n),n.dim=xs.dim.bind(n),n.italic=xs.italic.bind(n),n.underline=xs.underline.bind(n),n.inverse=xs.inverse.bind(n),n.hidden=xs.hidden.bind(n),n.strikethrough=xs.strikethrough.bind(n),n.black=xs.black.bind(n),n.red=xs.red.bind(n),n.green=xs.green.bind(n),n.yellow=xs.yellow.bind(n),n.blue=xs.blue.bind(n),n.magenta=xs.magenta.bind(n),n.cyan=xs.cyan.bind(n),n.white=xs.white.bind(n),n.gray=xs.gray.bind(n),n.grey=xs.grey.bind(n),n.bgBlack=xs.bgBlack.bind(n),n.bgRed=xs.bgRed.bind(n),n.bgGreen=xs.bgGreen.bind(n),n.bgYellow=xs.bgYellow.bind(n),n.bgBlue=xs.bgBlue.bind(n),n.bgMagenta=xs.bgMagenta.bind(n),n.bgCyan=xs.bgCyan.bind(n),n.bgWhite=xs.bgWhite.bind(n),n}function Ws(t,e){let n={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(o){return this!==void 0&&this.has!==void 0?(this.has.includes(t)||(this.has.push(t),this.keys.push(n)),o===void 0?this:xs.enabled?$$(this.keys,o+""):o+""):o===void 0?GJe([t],[n]):xs.enabled?$$([n],o+""):o+""}}Y$.exports=xs});var G$=$((J1t,K$)=>{"use strict";K$.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var xw=$((X1t,J$)=>{"use strict";J$.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),n=new RegExp(e,"g");return typeof t=="string"?t.replace(n,""):t}});var bo=$((Z1t,X$)=>{"use strict";var jN="\x1B",_o=`${jN}[`,JJe="\x07",qN={to(t,e){return e?`${_o}${e+1};${t+1}H`:`${_o}${t+1}G`},move(t,e){let n="";return t<0?n+=`${_o}${-t}D`:t>0&&(n+=`${_o}${t}C`),e<0?n+=`${_o}${-e}A`:e>0&&(n+=`${_o}${e}B`),n},up:(t=1)=>`${_o}${t}A`,down:(t=1)=>`${_o}${t}B`,forward:(t=1)=>`${_o}${t}C`,backward:(t=1)=>`${_o}${t}D`,nextLine:(t=1)=>`${_o}E`.repeat(t),prevLine:(t=1)=>`${_o}F`.repeat(t),left:`${_o}G`,hide:`${_o}?25l`,show:`${_o}?25h`,save:`${jN}7`,restore:`${jN}8`},XJe={up:(t=1)=>`${_o}S`.repeat(t),down:(t=1)=>`${_o}T`.repeat(t)},ZJe={screen:`${_o}2J`,up:(t=1)=>`${_o}1J`.repeat(t),down:(t=1)=>`${_o}J`.repeat(t),line:`${_o}2K`,lineEnd:`${_o}K`,lineStart:`${_o}1K`,lines(t){let e="";for(let n=0;n<t;n++)e+=this.line+(n<t-1?qN.up():"");return t&&(e+=qN.left),e}};X$.exports={cursor:qN,scroll:XJe,erase:ZJe,beep:JJe}});var rY=$((Q1t,tY)=>{"use strict";function QJe(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=eXe(t))||e&&t&&typeof t.length=="number"){n&&(t=n);var o=0,u=function(){};return{s:u,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(v){throw v},f:u}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|