rsnext/packages/next/compiled/cross-spawn/index.js

1 line
8.2 KiB
JavaScript
Raw Normal View History

(()=>{var e={321:(e,r,n)=>{"use strict";const t=n(81);const s=n(947);const o=n(237);function spawn(e,r,n){const c=s(e,r,n);const i=t.spawn(c.command,c.args,c.options);o.hookChildProcess(i,c);return i}function spawnSync(e,r,n){const c=s(e,r,n);const i=t.spawnSync(c.command,c.args,c.options);i.error=i.error||o.verifyENOENTSync(i.status,c);return i}e.exports=spawn;e.exports.spawn=spawn;e.exports.sync=spawnSync;e.exports._parse=s;e.exports._enoent=o},237:e=>{"use strict";const r=process.platform==="win32";function notFoundError(e,r){return Object.assign(new Error(`${r} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${r} ${e.command}`,path:e.command,spawnargs:e.args})}function hookChildProcess(e,n){if(!r){return}const t=e.emit;e.emit=function(r,s){if(r==="exit"){const r=verifyENOENT(s,n,"spawn");if(r){return t.call(e,"error",r)}}return t.apply(e,arguments)}}function verifyENOENT(e,n){if(r&&e===1&&!n.file){return notFoundError(n.original,"spawn")}return null}function verifyENOENTSync(e,n){if(r&&e===1&&!n.file){return notFoundError(n.original,"spawnSync")}return null}e.exports={hookChildProcess:hookChildProcess,verifyENOENT:verifyENOENT,verifyENOENTSync:verifyENOENTSync,notFoundError:notFoundError}},947:(e,r,n)=>{"use strict";const t=n(17);const s=n(726);const o=n(970);const c=n(614);const i=n(290);const a=n(849);const u=process.platform==="win32";const f=/\.(?:com|exe)$/i;const l=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;const p=s((()=>a.satisfies(process.version,"^4.8.0 || ^5.7.0 || >= 6.0.0",true)))||false;function detectShebang(e){e.file=o(e);const r=e.file&&i(e.file);if(r){e.args.unshift(e.file);e.command=r;return o(e)}return e.file}function parseNonShell(e){if(!u){return e}const r=detectShebang(e);const n=!f.test(r);if(e.options.forceShell||n){const n=l.test(r);e.command=t.normalize(e.command);e.command=c.command(e.command);e.args=e.args.map((e=>c.argument(e,n)));const s=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${s}"`];e.command=process.env.comspec||"cmd.exe";e.options.windowsVerbatimArguments=true}return e}function parseShell(e){if(p){return e}const r=[e.command].concat(e.args).join(" ");if(u){e.command=typeof e.options.shell==="string"?e.options.shell:process.env.comspec||"cmd.exe";e.args=["/d","/s","/c",`"${r}"`];e.options.windowsVerbatimArguments=true}else{if(typeof e.options.shell==="string"){e.command=e.options.shell}else if(process.platform==="android"){e.command="/system/bin/sh"}else{e.command="/bin/sh"}e.args=["-c",r]}return e}function parse(e,r,n){if(r&&!Array.isArray(r)){n=r;r=null}r=r?r.slice(0):[];n=Object.assign({},n);const t={command:e,args:r,options:n,file:undefined,original:{command:e,args:r}};return n.shell?parseShell(t):parseNonShell(t)}e.exports=parse},614:e=>{"use strict";const r=/([()\][%!^"`<>&|;, *?])/g;function escapeCommand(e){e=e.replace(r,"^$1");return e}function escapeArgument(e,n){e=`${e}`;e=e.replace(/(\\*)"/g,'$1$1\\"');e=e.replace(/(\\*)$/,"$1$1");e=`"${e}"`;e=e.replace(r,"^$1");if(n){e=e.replace(r,"^$1")}return e}e.exports.command=escapeCommand;e.exports.argument=escapeArgument},290:(e,r,n)=>{"use strict";const t=n(147);const s=n(629);function readShebang(e){const r=150;let n;if(Buffer.alloc){n=Buffer.alloc(r)}else{n=new Buffer(r);n.fill(0)}let o;try{o=t.openSync(e,"r");t.readSync(o,n,0,r,0);t.closeSync(o)}catch(e){}return s(n.toString())}e.exports=readShebang},970:(e,r,n)=>{"use strict";const t=n(17);const s=n(423);const o=n(838)();function resolveCommandAttempt(e,r){const n=process.cwd();const c=e.options.cwd!=null;if(c){try{process.chdir(e.options.cwd)}catch(e){}}let i;try{i=s.sync(e.command,{path:(e.options.env||process.env)[o],pathExt:r?t.delimiter:undefined})}catch(e){}finally{process.chdir(n)}if(i){i=t.resolve(c?e.options.cwd:"",i)}return i}function resolveCommand(e){return resolveCommandAttempt(e)||resolveCommandAttempt(e,true)}e.exports=resolveCommand},745:(e,r,n)=>{var t=n(147);var s;if(process.platform==="win32"||global.TESTING_WINDOWS){s=n(554)}else{s=n(138)}e.exports=isexe;isexe.sync=sync;function isexe(e,r,n){if(typeof r==="function"){n=r