@tsmodule/tsmodule 31.2.0 → 33.1.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/commands/build/index.d.ts +20 -0
- package/dist/commands/build/index.js +19 -20
- package/dist/commands/build/lib/emitTsDeclarations.d.ts +13 -0
- package/dist/commands/build/lib/emitTsDeclarations.js +9 -9
- package/dist/commands/create/index.d.ts +3 -0
- package/dist/commands/create/index.js +12 -18
- package/dist/commands/create/lib/copyTemplate.d.ts +1 -0
- package/dist/commands/create/lib/copyTemplate.js +10 -0
- package/dist/commands/create/lib/rewritePkgJson.d.ts +1 -0
- package/dist/commands/create/lib/rewritePkgJson.js +1 -1
- package/dist/commands/dev/index.d.ts +1 -0
- package/dist/commands/dev/index.js +23 -24
- package/dist/commands/execute/index.d.ts +1 -0
- package/dist/commands/execute/index.js +5 -5
- package/dist/commands/normalize/index.d.ts +14 -0
- package/dist/commands/normalize/index.js +13 -15
- package/dist/commands/normalize/lib/typescriptApi.d.ts +7 -0
- package/dist/commands/normalize/lib/typescriptApi.js +9 -10
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +36 -43
- package/dist/loader/index.d.ts +11 -0
- package/dist/loader/index.js +5 -5
- package/dist/loader/types.d.ts +22 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/cwd.d.ts +7 -0
- package/dist/utils/cwd.js +3 -3
- package/dist/utils/pkgJson.d.ts +2 -0
- package/dist/utils/pkgJson.js +1 -1
- package/dist/utils/require.d.ts +1 -0
- package/dist/utils/resolve.d.ts +28 -0
- package/dist/utils/resolve.js +1 -1
- package/dist/utils/stdin.d.ts +1 -0
- package/dist/utils/stdin.js +5 -5
- package/package.json +10 -11
- package/dist/commands/create/lib/createTemplate.js +0 -10
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { GetFormatHook as ModuleGetFormatHook, LoadHook as ModuleLoadHook, ResolveHook as ModuleResolveHook, TransformHook as ModuleTransformSourceHook } from "./types";
|
2
|
+
export declare const resolve: ModuleResolveHook;
|
3
|
+
export declare const load: ModuleLoadHook;
|
4
|
+
/**
|
5
|
+
* @deprecated As of Node 17.
|
6
|
+
*/
|
7
|
+
export declare const getFormat: ModuleGetFormatHook;
|
8
|
+
/**
|
9
|
+
* @deprecated As of Node 17.
|
10
|
+
*/
|
11
|
+
export declare const transformSource: ModuleTransformSourceHook;
|
package/dist/loader/index.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
|
2
2
|
await(async()=>{let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");if(typeof globalThis.__filename>"u"&&(globalThis.__filename=i(import.meta.url)),typeof globalThis.__dirname>"u"&&(globalThis.__dirname=e(globalThis.__filename)),typeof globalThis.require>"u"){let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}})();
|
3
3
|
|
4
|
-
import{extname as
|
4
|
+
import{extname as R,isAbsolute as ee,join as Re,normalize as Te,resolve as ve}from"path";import{posix as Ce}from"path";import{win32 as Le}from"path";import{fileURLToPath as ye,pathToFileURL as oe,URL as k}from"url";import{readFile as Me}from"fs/promises";import{transform as te}from"esbuild";var j={NODE_ENV:"production"};try{let{env:e}=await import("process");e.NODE_ENV&&(j.NODE_ENV=e.NODE_ENV)}catch{}var N=j.NODE_ENV==="development";import{Console as be}from"console";var D=(e=0)=>o=>`\x1B[${o+e}m`,P=(e=0)=>o=>`\x1B[${38+e};5;${o}m`,G=(e=0)=>(o,t,r)=>`\x1B[${38+e};2;${o};${t};${r}m`;function ne(){let e=new Map,o={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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};o.color.gray=o.color.blackBright,o.bgColor.bgGray=o.bgColor.bgBlackBright,o.color.grey=o.color.blackBright,o.bgColor.bgGrey=o.bgColor.bgBlackBright;for(let[t,r]of Object.entries(o)){for(let[n,s]of Object.entries(r))o[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[n]=o[n],e.set(s[0],s[1]);Object.defineProperty(o,t,{value:r,enumerable:!1})}return Object.defineProperty(o,"codes",{value:e,enumerable:!1}),o.color.close="\x1B[39m",o.bgColor.close="\x1B[49m",o.color.ansi=D(),o.color.ansi256=P(),o.color.ansi16m=G(),o.bgColor.ansi=D(10),o.bgColor.ansi256=P(10),o.bgColor.ansi16m=G(10),Object.defineProperties(o,{rgbToAnsi256:{value:(t,r,n)=>t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(t.toString(16));if(!r)return[0,0,0];let{colorString:n}=r.groups;n.length===3&&(n=[...n].map(i=>i+i).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:t=>o.rgbToAnsi256(...o.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,s;if(t>=232)r=((t-232)*10+8)/255,n=r,s=r;else{t-=16;let f=t%36;r=Math.floor(t/36)/5,n=Math.floor(f/6)/5,s=f%6/5}let i=Math.max(r,n,s)*2;if(i===0)return 30;let c=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(c+=60),c},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>o.ansi256ToAnsi(o.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>o.ansi256ToAnsi(o.hexToAnsi256(t)),enumerable:!1}}),o}var se=ne(),u=se;import A from"node:process";import ie from"node:os";import V from"node:tty";function a(e,o=A.argv){let t=e.startsWith("-")?"":e.length===1?"-":"--",r=o.indexOf(t+e),n=o.indexOf("--");return r!==-1&&(n===-1||r<n)}var{env:l}=A,v;a("no-color")||a("no-colors")||a("color=false")||a("color=never")?v=0:(a("color")||a("colors")||a("color=true")||a("color=always"))&&(v=1);function le(){if("FORCE_COLOR"in l)return l.FORCE_COLOR==="true"?1:l.FORCE_COLOR==="false"?0:l.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(l.FORCE_COLOR,10),3)}function ce(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function ae(e,{streamIsTTY:o,sniffFlags:t=!0}={}){let r=le();r!==void 0&&(v=r);let n=t?v:r;if(n===0)return 0;if(t){if(a("color=16m")||a("color=full")||a("color=truecolor"))return 3;if(a("color=256"))return 2}if(e&&!o&&n===void 0)return 0;let s=n||0;if(l.TERM==="dumb")return s;if(A.platform==="win32"){let i=ie.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in l)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(i=>i in l)||l.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in l)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(l.TEAMCITY_VERSION)?1:0;if("TF_BUILD"in l&&"AGENT_NAME"in l)return 1;if(l.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in l){let i=Number.parseInt((l.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(l.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(l.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(l.TERM)||"COLORTERM"in l?1:s}function $(e,o={}){let t=ae(e,{streamIsTTY:e&&e.isTTY,...o});return ce(t)}var ue={stdout:$({isTTY:V.isatty(1)}),stderr:$({isTTY:V.isatty(2)})},H=ue;function Y(e,o,t){let r=e.indexOf(o);if(r===-1)return e;let n=o.length,s=0,i="";do i+=e.substr(s,r-s)+o+t,s=r+n,r=e.indexOf(o,s);while(r!==-1);return i+=e.slice(s),i}function W(e,o,t,r){let n=0,s="";do{let i=e[r-1]==="\r";s+=e.substr(n,(i?r-1:r)-n)+o+(i?`\r
|
5
5
|
`:`
|
6
6
|
`)+t,n=r+1,r=e.indexOf(`
|
7
|
-
`,n)}while(r!==-1);return s+=e.slice(n),s}var{stdout:
|
8
|
-
`);return s!==-1&&(o=
|
7
|
+
`,n)}while(r!==-1);return s+=e.slice(n),s}var{stdout:J,stderr:K}=H,B=Symbol("GENERATOR"),m=Symbol("STYLER"),E=Symbol("IS_EMPTY"),z=["ansi","ansi","ansi256","ansi16m"],d=Object.create(null),fe=(e,o={})=>{if(o.level&&!(Number.isInteger(o.level)&&o.level>=0&&o.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=J?J.level:0;e.level=o.level===void 0?t:o.level};var ge=e=>{let o=(...t)=>t.join(" ");return fe(o,e),Object.setPrototypeOf(o,x.prototype),o};function x(e){return ge(e)}Object.setPrototypeOf(x.prototype,Function.prototype);for(let[e,o]of Object.entries(u))d[e]={get(){let t=C(this,F(o.open,o.close,this[m]),this[E]);return Object.defineProperty(this,e,{value:t}),t}};d.visible={get(){let e=C(this,this[m],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var S=(e,o,t,...r)=>e==="rgb"?o==="ansi16m"?u[t].ansi16m(...r):o==="ansi256"?u[t].ansi256(u.rgbToAnsi256(...r)):u[t].ansi(u.rgbToAnsi(...r)):e==="hex"?S("rgb",o,t,...u.hexToRgb(...r)):u[t][e](...r),pe=["rgb","hex","ansi256"];for(let e of pe){d[e]={get(){let{level:t}=this;return function(...r){let n=F(S(e,z[t],"color",...r),u.color.close,this[m]);return C(this,n,this[E])}}};let o="bg"+e[0].toUpperCase()+e.slice(1);d[o]={get(){let{level:t}=this;return function(...r){let n=F(S(e,z[t],"bgColor",...r),u.bgColor.close,this[m]);return C(this,n,this[E])}}}}var me=Object.defineProperties(()=>{},{...d,level:{enumerable:!0,get(){return this[B].level},set(e){this[B].level=e}}}),F=(e,o,t)=>{let r,n;return t===void 0?(r=e,n=o):(r=t.openAll+e,n=o+t.closeAll),{open:e,close:o,openAll:r,closeAll:n,parent:t}},C=(e,o,t)=>{let r=(...n)=>de(r,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(r,me),r[B]=e,r[m]=o,r[E]=t,r},de=(e,o)=>{if(e.level<=0||!o)return e[E]?"":o;let t=e[m];if(t===void 0)return o;let{openAll:r,closeAll:n}=t;if(o.includes("\x1B"))for(;t!==void 0;)o=Y(o,t.close,t.open),t=t.parent;let s=o.indexOf(`
|
8
|
+
`);return s!==-1&&(o=W(o,n,r,s)),r+o+n};Object.defineProperties(x.prototype,d);var he=x(),Ve=x({level:K?K.level:0});var I=he;var g=new be({stdout:process.stdout,stderr:process.stderr,groupIndentation:4}),h=e=>{if(N){let{name:o}=e;return{log(...t){let r=I.bgBlue.white(` [${o}] `);g.log(`${r}`,`
|
9
9
|
|
10
|
-
`,...t),
|
10
|
+
`,...t),g.log()},group(){g.log();let t=I.bgBlue.white(` [${o}] `);g.group(t),g.log()},groupEnd(){g.log(`
|
11
11
|
`,"-".repeat(20),`
|
12
|
-
`),
|
12
|
+
`),g.groupEnd()}}}else return{log(){},group(){},groupEnd(){}}};import{existsSync as Ee}from"fs";import{fileURLToPath as xe}from"url";var X=/\.[mc]?tsx?(?=\?|$)/,q=/\.([mc])?js$/;var b={format:"esm",charset:"utf8",sourcemap:"inline",target:"node16",minify:!1},O={".mts":{...b,loader:"ts"},".jsx":{...b,loader:"jsx"},".tsx":{...b,loader:"tsx"},".cts":{...b,loader:"ts"},".ts":{...b,loader:"ts"},".json":{...b,loader:"json"}},Q=Object.keys(O);var w=e=>{let o=xe(e);if(Ee(o))return e},Z=e=>{for(let o of e)if(w(o))return o},_=e=>{let o=Q.filter(t=>t.includes("ts")).concat([".js"]);return Z(o.map(t=>e+t))},Oe=e=>{let o=Q.filter(t=>t.includes("js")).concat([".js"]);return Z(o.map(t=>e+t))},U=e=>{let o=Oe(e);if(o)return o;let t=_(e);if(t)return t};var Ne=async(e,o,t)=>{let{parentURL:r}=o,n=h(Ne);if(n.log("Resolving specifier:",{importedFromURL:r,specifier:e}),!e.startsWith(".")&&!ee(e))return n.log("Using defaultResolve for named module:",{specifier:e}),t(e,o,t);let{href:s}=oe(process.cwd()),{href:i}=new k(r||s);n.log("Finding import URL for",{specifier:e,baseURL:i});let c=e;e.startsWith("file://")||(ee(e)?(n.log("Setting import URL to absolute specifier."),c=oe(ve(Te(e))).href):(n.log("Setting import URL relative to baseURL."),c=new k(e,i).href),n.log("Resolved import URL:",{importedFileURL:c,importedFromURL:r}));let f=R(r??"").toLowerCase(),T=R(c).toLowerCase();if(n.log("Rewriting file extension:",{parentExtension:f,specifierExtension:T}),T){let p=c.substring(0,c.lastIndexOf(T));if(n.log("Re-resolving specifier:",{unresolvedSpecifier:p}),q.test(T)&&X.test(f)){let M=_(p);if(M)return n.log("Found JS import in TS:",{unresolvedSpecifier:p,resolvedTsSourceFile:M}),{url:M}}return w(p)?(n.log("Found file at unresolved specifier:",{unresolvedSpecifier:p}),{url:p}):t(e,o,t)}n.log("Resolving incomplete URL import to file:",{specifier:e});let L=U(c);if(L)return n.log("Resolved import URL to file:",{resolvedFile:L}),{url:L};let re=new k(Re(c,"index")).href,y=U(re);return y?(n.log("Resolved import URL to index file:",{resolvedIndexFile:y}),{url:y}):t(e,o,t)},Ae=async(e,o,t)=>{let r=h(Ae);if(r.log("Loading source file:",{url:e}),!e.includes(Le.sep)&&!e.includes(Ce.sep))return r.log("Using defaultLoad for named module:",{url:e}),t(e,o,t);let n=R(e),s=O[n];if(!s)return r.log("No loader found, using defaultLoad:",{url:e}),t(e,o,t);let i=ye(e),c=await Me(i,"utf8"),f=await te(c.toString(),{...s,sourcefile:i,format:"esm"});return{format:"module",source:f.code}},Be=async(e,o,t)=>{let r=h(Be);r.log("Getting format for source file:",{url:e});let n=R(e);return O[n]?{format:"module"}:(r.log("No loader found, using default format:",{url:e}),t(e,o,t))},Se=async(e,o,t)=>{let r=h(Se);r.log("Transforming source from context:",{context:o});let{url:n}=o,s=R(n),i=O[s];return i?{source:(await te(e.toString(),{...i,logLevel:"info",charset:"utf8",target:"esnext",sourcefile:o.url,format:o.format==="module"?"esm":"cjs"})).code}:(r.log("No loader found, using default transformer:",{url:n}),t(e,o,t))};export{Be as getFormat,Ae as load,Ne as resolve,Se as transformSource};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
export declare type Promisable<T> = Promise<T> | T;
|
2
|
+
export declare type ModuleSource = string | SharedArrayBuffer | Uint8Array;
|
3
|
+
export declare type ModuleFormat = "builtin" | "commonjs" | "json" | "module" | "wasm";
|
4
|
+
export declare type ResolveHook = (specifier: string, context: {
|
5
|
+
conditions: string[];
|
6
|
+
parentURL?: string;
|
7
|
+
}, fallback: ResolveHook) => Promisable<{
|
8
|
+
url: string;
|
9
|
+
format?: ModuleFormat;
|
10
|
+
}>;
|
11
|
+
export declare type GetFormatHook = (url: string, context: object, fallback: GetFormatHook) => Promisable<{
|
12
|
+
format: ModuleFormat;
|
13
|
+
}>;
|
14
|
+
export declare type TransformHook = (source: ModuleSource, context: Record<"url" | "format", string>, fallback: TransformHook) => Promisable<{
|
15
|
+
source: ModuleSource;
|
16
|
+
}>;
|
17
|
+
export declare type LoadHook = (url: string, context: {
|
18
|
+
format?: ModuleFormat;
|
19
|
+
}, fallback: LoadHook) => Promisable<{
|
20
|
+
format: ModuleFormat;
|
21
|
+
source: ModuleSource;
|
22
|
+
}>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "../loader/types";
|
package/dist/utils/cwd.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
await(async()=>{let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");if(typeof globalThis.__filename>"u"&&(globalThis.__filename=i(import.meta.url)),typeof globalThis.__dirname>"u"&&(globalThis.__dirname=e(globalThis.__filename)),typeof globalThis.require>"u"){let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}})();
|
3
3
|
|
4
|
-
import{extname as
|
4
|
+
import{extname as ee,resolve as m}from"path";var A=/\.[mc]?tsx?(?=\?|$)/;var y=/\.([mc])?[tj]sx$/;var a={format:"esm",charset:"utf8",sourcemap:"inline",target:"node16",minify:!1},$={".mts":{...a,loader:"ts"},".jsx":{...a,loader:"jsx"},".tsx":{...a,loader:"tsx"},".cts":{...a,loader:"ts"},".ts":{...a,loader:"ts"},".json":{...a,loader:"json"}},oe=Object.keys($);import{existsSync as k}from"fs";var B=(t=0)=>e=>`\x1B[${e+t}m`,v=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,M=(t=0)=>(e,r,o)=>`\x1B[${38+t};2;${e};${r};${o}m`;function G(){let t=new Map,e={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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,o]of Object.entries(e)){for(let[n,s]of Object.entries(o))e[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},o[n]=e[n],t.set(s[0],s[1]);Object.defineProperty(e,r,{value:o,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi=B(),e.color.ansi256=v(),e.color.ansi16m=M(),e.bgColor.ansi=B(10),e.bgColor.ansi256=v(10),e.bgColor.ansi16m=M(10),Object.defineProperties(e,{rgbToAnsi256:{value:(r,o,n)=>r===o&&o===n?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(o/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:r=>{let o=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!o)return[0,0,0];let{colorString:n}=o.groups;n.length===3&&(n=[...n].map(i=>i+i).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:r=>e.rgbToAnsi256(...e.hexToRgb(r)),enumerable:!1},ansi256ToAnsi:{value:r=>{if(r<8)return 30+r;if(r<16)return 90+(r-8);let o,n,s;if(r>=232)o=((r-232)*10+8)/255,n=o,s=o;else{r-=16;let b=r%36;o=Math.floor(r/36)/5,n=Math.floor(b/6)/5,s=b%6/5}let i=Math.max(o,n,s)*2;if(i===0)return 30;let h=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(o));return i===2&&(h+=60),h},enumerable:!1},rgbToAnsi:{value:(r,o,n)=>e.ansi256ToAnsi(e.rgbToAnsi256(r,o,n)),enumerable:!1},hexToAnsi:{value:r=>e.ansi256ToAnsi(e.hexToAnsi256(r)),enumerable:!1}}),e}var Y=G(),u=Y;import T from"node:process";import U from"node:os";import S from"node:tty";function c(t,e=T.argv){let r=t.startsWith("-")?"":t.length===1?"-":"--",o=e.indexOf(r+t),n=e.indexOf("--");return o!==-1&&(n===-1||o<n)}var{env:l}=T,x;c("no-color")||c("no-colors")||c("color=false")||c("color=never")?x=0:(c("color")||c("colors")||c("color=true")||c("color=always"))&&(x=1);function V(){if("FORCE_COLOR"in l)return l.FORCE_COLOR==="true"?1:l.FORCE_COLOR==="false"?0:l.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(l.FORCE_COLOR,10),3)}function K(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function W(t,{streamIsTTY:e,sniffFlags:r=!0}={}){let o=V();o!==void 0&&(x=o);let n=r?x:o;if(n===0)return 0;if(r){if(c("color=16m")||c("color=full")||c("color=truecolor"))return 3;if(c("color=256"))return 2}if(t&&!e&&n===void 0)return 0;let s=n||0;if(l.TERM==="dumb")return s;if(T.platform==="win32"){let i=U.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in l)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(i=>i in l)||l.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in l)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(l.TEAMCITY_VERSION)?1:0;if("TF_BUILD"in l&&"AGENT_NAME"in l)return 1;if(l.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in l){let i=Number.parseInt((l.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(l.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(l.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(l.TERM)||"COLORTERM"in l?1:s}function I(t,e={}){let r=W(t,{streamIsTTY:t&&t.isTTY,...e});return K(r)}var J={stdout:I({isTTY:S.isatty(1)}),stderr:I({isTTY:S.isatty(2)})},F=J;function N(t,e,r){let o=t.indexOf(e);if(o===-1)return t;let n=e.length,s=0,i="";do i+=t.substr(s,o-s)+e+r,s=o+n,o=t.indexOf(e,s);while(o!==-1);return i+=t.slice(s),i}function j(t,e,r,o){let n=0,s="";do{let i=t[o-1]==="\r";s+=t.substr(n,(i?o-1:o)-n)+e+(i?`\r
|
5
5
|
`:`
|
6
6
|
`)+r,n=o+1,o=t.indexOf(`
|
7
|
-
`,n)}while(o!==-1);return s+=t.slice(n),s}var{stdout:
|
8
|
-
`);return s!==-1&&(e=
|
7
|
+
`,n)}while(o!==-1);return s+=t.slice(n),s}var{stdout:_,stderr:L}=F,E=Symbol("GENERATOR"),f=Symbol("STYLER"),g=Symbol("IS_EMPTY"),w=["ansi","ansi","ansi256","ansi16m"],p=Object.create(null),z=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=_?_.level:0;t.level=e.level===void 0?r:e.level};var H=t=>{let e=(...r)=>r.join(" ");return z(e,t),Object.setPrototypeOf(e,d.prototype),e};function d(t){return H(t)}Object.setPrototypeOf(d.prototype,Function.prototype);for(let[t,e]of Object.entries(u))p[t]={get(){let r=O(this,R(e.open,e.close,this[f]),this[g]);return Object.defineProperty(this,t,{value:r}),r}};p.visible={get(){let t=O(this,this[f],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var C=(t,e,r,...o)=>t==="rgb"?e==="ansi16m"?u[r].ansi16m(...o):e==="ansi256"?u[r].ansi256(u.rgbToAnsi256(...o)):u[r].ansi(u.rgbToAnsi(...o)):t==="hex"?C("rgb",e,r,...u.hexToRgb(...o)):u[r][t](...o),X=["rgb","hex","ansi256"];for(let t of X){p[t]={get(){let{level:r}=this;return function(...o){let n=R(C(t,w[r],"color",...o),u.color.close,this[f]);return O(this,n,this[g])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);p[e]={get(){let{level:r}=this;return function(...o){let n=R(C(t,w[r],"bgColor",...o),u.bgColor.close,this[f]);return O(this,n,this[g])}}}}var q=Object.defineProperties(()=>{},{...p,level:{enumerable:!0,get(){return this[E].level},set(t){this[E].level=t}}}),R=(t,e,r)=>{let o,n;return r===void 0?(o=t,n=e):(o=r.openAll+t,n=e+r.closeAll),{open:t,close:e,openAll:o,closeAll:n,parent:r}},O=(t,e,r)=>{let o=(...n)=>Q(o,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(o,q),o[E]=t,o[f]=e,o[g]=r,o},Q=(t,e)=>{if(t.level<=0||!e)return t[g]?"":e;let r=t[f];if(r===void 0)return e;let{openAll:o,closeAll:n}=r;if(e.includes("\x1B"))for(;r!==void 0;)e=N(e,r.close,r.open),r=r.parent;let s=e.indexOf(`
|
8
|
+
`);return s!==-1&&(e=j(e,n,o,s)),o+e+n};Object.defineProperties(d.prototype,p);var Z=d(),be=d({level:L?L.level:0});var P=Z;var te=(t,e)=>{let r=ee(t);return r===e?t:t.substring(0,-r.length||t.length)},D=()=>{let t=process.cwd(),e=m(t,"src"),r=m(t,"dist");return{cwd:t,srcDir:e,outDir:r}},Te=t=>{t=m(t);let{srcDir:e,outDir:r}=D();return t.replace(e,r).replace(A,".js").replace(y,".js")},re=[".mts",".ts",".tsx"],Ee=t=>{t=m(t);let{srcDir:e,outDir:r}=D(),n=te(t,"").replace(r,e),s;for(let i of re){let h=`${n}${i}`;k(h)&&(s=h);let b=m(n,`index${i}`);k(b)&&(s=b)}if(!s)throw new Error(`Could not find source file for: ${P.bold(t)}`);return s};export{Te as getEmittedFile,Ee as getSourceFile,D as getWorkingDirs};
|
package/dist/utils/pkgJson.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
|
2
2
|
await(async()=>{let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");if(typeof globalThis.__filename>"u"&&(globalThis.__filename=i(import.meta.url)),typeof globalThis.__dirname>"u"&&(globalThis.__dirname=e(globalThis.__filename)),typeof globalThis.require>"u"){let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}})();
|
3
3
|
|
4
|
-
import{
|
4
|
+
import{readFile as s}from"fs/promises";import{resolve as t}from"path";var a=async()=>{let e=process.cwd(),o=t(e,"package.json");return await s(o,"utf-8")},c=async()=>{let e=await a();return JSON.parse(e)};export{c as getPackageJson,a as getPackageJsonFile};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
export declare const DEVELOPMENT_MODE: boolean;
|
2
|
+
export declare const isTs: RegExp;
|
3
|
+
export declare const isJs: RegExp;
|
4
|
+
export declare const isTsxOrJsx: RegExp;
|
5
|
+
export declare const isJsOrTs: RegExp;
|
6
|
+
export declare const BASE_CONFIG: {
|
7
|
+
format: string;
|
8
|
+
charset: string;
|
9
|
+
sourcemap: string;
|
10
|
+
target: string;
|
11
|
+
minify: boolean;
|
12
|
+
};
|
13
|
+
export declare type ModuleLoaders = {
|
14
|
+
[extension: string]: {
|
15
|
+
[configKey: string]: unknown;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
export declare const MODULE_LOADERS: ModuleLoaders;
|
19
|
+
export declare const POSSIBLE_EXTENSIONS: string[];
|
20
|
+
/**
|
21
|
+
* Force a Unix-like path.
|
22
|
+
*/
|
23
|
+
export declare const normalizeSpecifier: (specifier: string) => string;
|
24
|
+
export declare const fileExists: (fileUrl: string) => string | void;
|
25
|
+
export declare const fileExistsAny: (fileUrls: string[]) => string | void;
|
26
|
+
export declare const checkTsExtensions: (specifier: string) => string | void;
|
27
|
+
export declare const checkJsExtension: (specifier: string) => string | void;
|
28
|
+
export declare const checkExtensions: (specifier: string) => string | undefined;
|
package/dist/utils/resolve.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
|
2
2
|
await(async()=>{let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");if(typeof globalThis.__filename>"u"&&(globalThis.__filename=i(import.meta.url)),typeof globalThis.__dirname>"u"&&(globalThis.__dirname=e(globalThis.__filename)),typeof globalThis.require>"u"){let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}})();
|
3
3
|
|
4
|
-
import{existsSync as i}from"fs";import{fileURLToPath as c}from"url";import{posix as x}from"path";import{sep as p}from"path";var
|
4
|
+
import{existsSync as i}from"fs";import{fileURLToPath as c}from"url";import{posix as x}from"path";import{sep as p}from"path";var g=!1,O=/\.[mc]?tsx?(?=\?|$)/,h=/\.([mc])?js$/,S=/\.([mc])?[tj]sx$/,L=/\.([mc])?[tj]sx?$/,e={format:"esm",charset:"utf8",sourcemap:"inline",target:"node16",minify:!1},a={".mts":{...e,loader:"ts"},".jsx":{...e,loader:"jsx"},".tsx":{...e,loader:"tsx"},".cts":{...e,loader:"ts"},".ts":{...e,loader:"ts"},".json":{...e,loader:"json"}},n=Object.keys(a),M=s=>s.split(p).join(x.sep),l=s=>{let t=c(s);if(i(t))return s},r=s=>{for(let t of s)if(l(t))return t},m=s=>{let t=n.filter(o=>o.includes("ts")).concat([".js"]);return r(t.map(o=>s+o))},f=s=>{let t=n.filter(o=>o.includes("js")).concat([".js"]);return r(t.map(o=>s+o))},T=s=>{let t=f(s);if(t)return t;let o=m(s);if(o)return o};export{e as BASE_CONFIG,g as DEVELOPMENT_MODE,a as MODULE_LOADERS,n as POSSIBLE_EXTENSIONS,T as checkExtensions,f as checkJsExtension,m as checkTsExtensions,l as fileExists,r as fileExistsAny,h as isJs,L as isJsOrTs,O as isTs,S as isTsxOrJsx,M as normalizeSpecifier};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const readStdin: () => Promise<string>;
|
package/dist/utils/stdin.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
|
2
2
|
await(async()=>{let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");if(typeof globalThis.__filename>"u"&&(globalThis.__filename=i(import.meta.url)),typeof globalThis.__dirname>"u"&&(globalThis.__dirname=e(globalThis.__filename)),typeof globalThis.require>"u"){let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}})();
|
3
3
|
|
4
|
-
var
|
4
|
+
import{readFileSync as Z}from"fs";var v={NODE_ENV:"production"};try{let{env:r}=await import("process");r.NODE_ENV&&(v.NODE_ENV=r.NODE_ENV)}catch{}var T=v.NODE_ENV==="development";import{Console as X}from"console";var N=(r=0)=>e=>`\x1B[${e+r}m`,x=(r=0)=>e=>`\x1B[${38+r};5;${e}m`,M=(r=0)=>(e,o,t)=>`\x1B[${38+r};2;${e};${o};${t}m`;function k(){let r=new Map,e={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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[o,t]of Object.entries(e)){for(let[n,l]of Object.entries(t))e[n]={open:`\x1B[${l[0]}m`,close:`\x1B[${l[1]}m`},t[n]=e[n],r.set(l[0],l[1]);Object.defineProperty(e,o,{value:t,enumerable:!1})}return Object.defineProperty(e,"codes",{value:r,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi=N(),e.color.ansi256=x(),e.color.ansi16m=M(),e.bgColor.ansi=N(10),e.bgColor.ansi256=x(10),e.bgColor.ansi16m=M(10),Object.defineProperties(e,{rgbToAnsi256:{value:(o,t,n)=>o===t&&t===n?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:o=>{let t=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(o.toString(16));if(!t)return[0,0,0];let{colorString:n}=t.groups;n.length===3&&(n=[...n].map(s=>s+s).join(""));let l=Number.parseInt(n,16);return[l>>16&255,l>>8&255,l&255]},enumerable:!1},hexToAnsi256:{value:o=>e.rgbToAnsi256(...e.hexToRgb(o)),enumerable:!1},ansi256ToAnsi:{value:o=>{if(o<8)return 30+o;if(o<16)return 90+(o-8);let t,n,l;if(o>=232)t=((o-232)*10+8)/255,n=t,l=t;else{o-=16;let f=o%36;t=Math.floor(o/36)/5,n=Math.floor(f/6)/5,l=f%6/5}let s=Math.max(t,n,l)*2;if(s===0)return 30;let b=30+(Math.round(l)<<2|Math.round(n)<<1|Math.round(t));return s===2&&(b+=60),b},enumerable:!1},rgbToAnsi:{value:(o,t,n)=>e.ansi256ToAnsi(e.rgbToAnsi256(o,t,n)),enumerable:!1},hexToAnsi:{value:o=>e.ansi256ToAnsi(e.hexToAnsi256(o)),enumerable:!1}}),e}var G=k(),c=G;import C from"node:process";import V from"node:os";import S from"node:tty";function u(r,e=C.argv){let o=r.startsWith("-")?"":r.length===1?"-":"--",t=e.indexOf(o+r),n=e.indexOf("--");return t!==-1&&(n===-1||t<n)}var{env:i}=C,O;u("no-color")||u("no-colors")||u("color=false")||u("color=never")?O=0:(u("color")||u("colors")||u("color=true")||u("color=always"))&&(O=1);function Y(){if("FORCE_COLOR"in i)return i.FORCE_COLOR==="true"?1:i.FORCE_COLOR==="false"?0:i.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(i.FORCE_COLOR,10),3)}function $(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function U(r,{streamIsTTY:e,sniffFlags:o=!0}={}){let t=Y();t!==void 0&&(O=t);let n=o?O:t;if(n===0)return 0;if(o){if(u("color=16m")||u("color=full")||u("color=truecolor"))return 3;if(u("color=256"))return 2}if(r&&!e&&n===void 0)return 0;let l=n||0;if(i.TERM==="dumb")return l;if(C.platform==="win32"){let s=V.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in i)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(s=>s in i)||i.CI_NAME==="codeship"?1:l;if("TEAMCITY_VERSION"in i)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(i.TEAMCITY_VERSION)?1:0;if("TF_BUILD"in i&&"AGENT_NAME"in i)return 1;if(i.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in i){let s=Number.parseInt((i.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(i.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(i.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(i.TERM)||"COLORTERM"in i?1:l}function I(r,e={}){let o=U(r,{streamIsTTY:r&&r.isTTY,...e});return $(o)}var K={stdout:I({isTTY:S.isatty(1)}),stderr:I({isTTY:S.isatty(2)})},F=K;function _(r,e,o){let t=r.indexOf(e);if(t===-1)return r;let n=e.length,l=0,s="";do s+=r.substr(l,t-l)+e+o,l=t+n,t=r.indexOf(e,l);while(t!==-1);return s+=r.slice(l),s}function L(r,e,o,t){let n=0,l="";do{let s=r[t-1]==="\r";l+=r.substr(n,(s?t-1:t)-n)+e+(s?`\r
|
5
5
|
`:`
|
6
6
|
`)+o,n=t+1,t=r.indexOf(`
|
7
|
-
`,n)}while(t!==-1);return l+=r.slice(n),l}var{stdout:
|
8
|
-
`);return l!==-1&&(e=
|
7
|
+
`,n)}while(t!==-1);return l+=r.slice(n),l}var{stdout:w,stderr:P}=F,R=Symbol("GENERATOR"),g=Symbol("STYLER"),d=Symbol("IS_EMPTY"),D=["ansi","ansi","ansi256","ansi16m"],p=Object.create(null),W=(r,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let o=w?w.level:0;r.level=e.level===void 0?o:e.level};var H=r=>{let e=(...o)=>o.join(" ");return W(e,r),Object.setPrototypeOf(e,h.prototype),e};function h(r){return H(r)}Object.setPrototypeOf(h.prototype,Function.prototype);for(let[r,e]of Object.entries(c))p[r]={get(){let o=E(this,y(e.open,e.close,this[g]),this[d]);return Object.defineProperty(this,r,{value:o}),o}};p.visible={get(){let r=E(this,this[g],!0);return Object.defineProperty(this,"visible",{value:r}),r}};var B=(r,e,o,...t)=>r==="rgb"?e==="ansi16m"?c[o].ansi16m(...t):e==="ansi256"?c[o].ansi256(c.rgbToAnsi256(...t)):c[o].ansi(c.rgbToAnsi(...t)):r==="hex"?B("rgb",e,o,...c.hexToRgb(...t)):c[o][r](...t),q=["rgb","hex","ansi256"];for(let r of q){p[r]={get(){let{level:o}=this;return function(...t){let n=y(B(r,D[o],"color",...t),c.color.close,this[g]);return E(this,n,this[d])}}};let e="bg"+r[0].toUpperCase()+r.slice(1);p[e]={get(){let{level:o}=this;return function(...t){let n=y(B(r,D[o],"bgColor",...t),c.bgColor.close,this[g]);return E(this,n,this[d])}}}}var z=Object.defineProperties(()=>{},{...p,level:{enumerable:!0,get(){return this[R].level},set(r){this[R].level=r}}}),y=(r,e,o)=>{let t,n;return o===void 0?(t=r,n=e):(t=o.openAll+r,n=e+o.closeAll),{open:r,close:e,openAll:t,closeAll:n,parent:o}},E=(r,e,o)=>{let t=(...n)=>J(t,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(t,z),t[R]=r,t[g]=e,t[d]=o,t},J=(r,e)=>{if(r.level<=0||!e)return r[d]?"":e;let o=r[g];if(o===void 0)return e;let{openAll:t,closeAll:n}=o;if(e.includes("\x1B"))for(;o!==void 0;)e=_(e,o.close,o.open),o=o.parent;let l=e.indexOf(`
|
8
|
+
`);return l!==-1&&(e=L(e,n,t,l)),t+e+n};Object.defineProperties(h.prototype,p);var Q=h(),ge=h({level:P?P.level:0});var m=Q;var a=new X({stdout:process.stdout,stderr:process.stderr,groupIndentation:4}),A=r=>{if(T){let{name:e}=r;return{log(...o){let t=m.bgBlue.white(` [${e}] `);a.log(`${t}`,`
|
9
9
|
|
10
|
-
`,...o),
|
10
|
+
`,...o),a.log()},group(){a.log();let o=m.bgBlue.white(` [${e}] `);a.group(o),a.log()},groupEnd(){a.log(`
|
11
11
|
`,"-".repeat(20),`
|
12
|
-
`),
|
12
|
+
`),a.groupEnd()}}}else return{log(){},group(){},groupEnd(){}}};var j=(...r)=>{console.log(),console.log(...r),console.log()};function ee(r){return new Promise((e,o)=>{let t=[];function n(f){t.push(f)}function l(){b(),e(Buffer.concat(t))}function s(f){b(),o(f)}function b(){r.removeListener("data",n),r.removeListener("end",l),r.removeListener("error",s)}r.on("data",n),r.on("end",l),r.on("error",s)})}var re=async()=>{let r=A(re);r.log("Reading stdin");try{let o=Z(0).toString();if(o)return r.log("Found stdin",{stdin:o}),o}catch(o){r.log("Could not read stdin",{e:o})}return j(m.gray("Type your source code. Press Ctrl+D to finish.")),(await ee(process.stdin)).toString()};export{re as readStdin};
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@tsmodule/tsmodule",
|
3
3
|
"platform": "node",
|
4
4
|
"type": "module",
|
5
|
-
"version": "
|
5
|
+
"version": "33.1.0",
|
6
6
|
"repository": "tsmodule/tsmodule",
|
7
7
|
"description": "TypeScript Module loader and compiler",
|
8
8
|
"license": "MIT",
|
@@ -32,36 +32,35 @@
|
|
32
32
|
"test-production-bundle": "node runBundleTests.js",
|
33
33
|
"test": "yarn test-production-bundle",
|
34
34
|
"retest": "SKIP_TEST_SETUP=1 yarn test",
|
35
|
+
"retest-bundle": "SKIP_TEST_SETUP=1 yarn test-bundle",
|
35
36
|
"lint": "eslint --fix src",
|
36
|
-
"prepare": "yarn build
|
37
|
+
"prepare": "yarn build",
|
37
38
|
"prepublishOnly": "yarn test",
|
38
39
|
"release": "release-it"
|
39
40
|
},
|
40
41
|
"dependencies": {
|
41
42
|
"esbuild": "^0.14.25",
|
42
|
-
"typescript": "^4.6.
|
43
|
+
"typescript": "^4.6.3"
|
43
44
|
},
|
44
45
|
"devDependencies": {
|
45
|
-
"@types/fs-extra": "^9.0.13",
|
46
46
|
"@types/glob": "^7.2.0",
|
47
|
-
"@types/node": "^17.0.
|
48
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
49
|
-
"@typescript-eslint/parser": "^5.
|
47
|
+
"@types/node": "^17.0.23",
|
48
|
+
"@typescript-eslint/eslint-plugin": "^5.16.0",
|
49
|
+
"@typescript-eslint/parser": "^5.16.0",
|
50
50
|
"assert": "^2.0.0",
|
51
51
|
"ava": "^4.1.0",
|
52
|
-
"await-shell": "^34.
|
52
|
+
"await-shell": "^34.1.1",
|
53
53
|
"chalk": "^5.0.1",
|
54
54
|
"commander": "^9.0.0",
|
55
55
|
"create-debug-logger": "^3.0.0",
|
56
56
|
"eslint": "^8.11.0",
|
57
|
-
"eslint-config-next": "^12.1.
|
57
|
+
"eslint-config-next": "^12.1.1",
|
58
58
|
"fast-glob": "^3.2.11",
|
59
|
-
"fs-extra": "^10.0.1",
|
60
59
|
"glob": "^7.2.0",
|
61
60
|
"node-watch": "^0.7.3",
|
62
61
|
"ora": "^6.1.0",
|
63
62
|
"path": "^0.12.7",
|
64
|
-
"release-it": "^14.
|
63
|
+
"release-it": "^14.13.1"
|
65
64
|
},
|
66
65
|
"release-it": {
|
67
66
|
"git": {
|
@@ -1,10 +0,0 @@
|
|
1
|
-
|
2
|
-
await(async()=>{let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");if(typeof globalThis.__filename>"u"&&(globalThis.__filename=i(import.meta.url)),typeof globalThis.__dirname>"u"&&(globalThis.__dirname=e(globalThis.__filename)),typeof globalThis.require>"u"){let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}})();
|
3
|
-
|
4
|
-
var an=Object.create;var _e=Object.defineProperty;var ln=Object.getOwnPropertyDescriptor;var yn=Object.getOwnPropertyNames;var mn=Object.getPrototypeOf,dn=Object.prototype.hasOwnProperty;var hn=e=>_e(e,"__esModule",{value:!0});var P=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var Sn=(e,t)=>()=>(e&&(t=e(e=0)),t);var w=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var wn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of yn(t))!dn.call(e,i)&&(r||i!=="default")&&_e(e,i,{get:()=>t[i],enumerable:!(n=ln(t,i))||n.enumerable});return e},pn=(e,t)=>wn(hn(_e(e!=null?an(mn(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var f=Sn(()=>{});var W=w(Le=>{"use strict";f();Le.fromCallback=function(e){return Object.defineProperty(function(...t){if(typeof t[t.length-1]=="function")e.apply(this,t);else return new Promise((r,n)=>{e.call(this,...t,(i,o)=>i!=null?n(i):r(o))})},"name",{value:e.name})};Le.fromPromise=function(e){return Object.defineProperty(function(...t){let r=t[t.length-1];if(typeof r!="function")return e.apply(this,t);e.apply(this,t.slice(0,-1)).then(n=>r(null,n),r)},"name",{value:e.name})}});var be=w((Jo,Ze)=>{f();var K=P("constants"),qn=process.cwd,Se=null,Fn=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Se||(Se=qn.call(process)),Se};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Ie=process.chdir,process.chdir=function(e){Se=null,Ie.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Ie));var Ie;Ze.exports=xn;function xn(e){K.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||r(e),e.chown=o(e.chown),e.fchown=o(e.fchown),e.lchown=o(e.lchown),e.chmod=n(e.chmod),e.fchmod=n(e.fchmod),e.lchmod=n(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=i(e.chmodSync),e.fchmodSync=i(e.fchmodSync),e.lchmodSync=i(e.lchmodSync),e.stat=c(e.stat),e.fstat=c(e.fstat),e.lstat=c(e.lstat),e.statSync=a(e.statSync),e.fstatSync=a(e.fstatSync),e.lstatSync=a(e.lstatSync),e.lchmod||(e.lchmod=function(s,y,m){m&&process.nextTick(m)},e.lchmodSync=function(){}),e.lchown||(e.lchown=function(s,y,m,l){l&&process.nextTick(l)},e.lchownSync=function(){}),Fn==="win32"&&(e.rename=function(s){return function(y,m,l){var h=Date.now(),q=0;s(y,m,function p(O){if(O&&(O.code==="EACCES"||O.code==="EPERM")&&Date.now()-h<6e4){setTimeout(function(){e.stat(m,function(T,oe){T&&T.code==="ENOENT"?s(y,m,p):l(O)})},q),q<100&&(q+=10);return}l&&l(O)})}}(e.rename)),e.read=function(s){function y(m,l,h,q,p,O){var T;if(O&&typeof O=="function"){var oe=0;T=function(he,Xe,He){if(he&&he.code==="EAGAIN"&&oe<10)return oe++,s.call(e,m,l,h,q,p,T);O.apply(this,arguments)}}return s.call(e,m,l,h,q,p,T)}return Object.setPrototypeOf&&Object.setPrototypeOf(y,s),y}(e.read),e.readSync=function(s){return function(y,m,l,h,q){for(var p=0;;)try{return s.call(e,y,m,l,h,q)}catch(O){if(O.code==="EAGAIN"&&p<10){p++;continue}throw O}}}(e.readSync);function t(s){s.lchmod=function(y,m,l){s.open(y,K.O_WRONLY|K.O_SYMLINK,m,function(h,q){if(h){l&&l(h);return}s.fchmod(q,m,function(p){s.close(q,function(O){l&&l(p||O)})})})},s.lchmodSync=function(y,m){var l=s.openSync(y,K.O_WRONLY|K.O_SYMLINK,m),h=!0,q;try{q=s.fchmodSync(l,m),h=!1}finally{if(h)try{s.closeSync(l)}catch{}else s.closeSync(l)}return q}}function r(s){K.hasOwnProperty("O_SYMLINK")?(s.lutimes=function(y,m,l,h){s.open(y,K.O_SYMLINK,function(q,p){if(q){h&&h(q);return}s.futimes(p,m,l,function(O){s.close(p,function(T){h&&h(O||T)})})})},s.lutimesSync=function(y,m,l){var h=s.openSync(y,K.O_SYMLINK),q,p=!0;try{q=s.futimesSync(h,m,l),p=!1}finally{if(p)try{s.closeSync(h)}catch{}else s.closeSync(h)}return q}):(s.lutimes=function(y,m,l,h){h&&process.nextTick(h)},s.lutimesSync=function(){})}function n(s){return s&&function(y,m,l){return s.call(e,y,m,function(h){k(h)&&(h=null),l&&l.apply(this,arguments)})}}function i(s){return s&&function(y,m){try{return s.call(e,y,m)}catch(l){if(!k(l))throw l}}}function o(s){return s&&function(y,m,l,h){return s.call(e,y,m,l,function(q){k(q)&&(q=null),h&&h.apply(this,arguments)})}}function u(s){return s&&function(y,m,l){try{return s.call(e,y,m,l)}catch(h){if(!k(h))throw h}}}function c(s){return s&&function(y,m,l){typeof m=="function"&&(l=m,m=null);function h(q,p){p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),l&&l.apply(this,arguments)}return m?s.call(e,y,m,h):s.call(e,y,h)}}function a(s){return s&&function(y,m){var l=m?s.call(e,y,m):s.call(e,y);return l&&(l.uid<0&&(l.uid+=4294967296),l.gid<0&&(l.gid+=4294967296)),l}}function k(s){if(!s||s.code==="ENOSYS")return!0;var y=!process.getuid||process.getuid()!==0;return!!(y&&(s.code==="EINVAL"||s.code==="EPERM"))}}});var rt=w((Bo,tt)=>{f();var et=P("stream").Stream;tt.exports=gn;function gn(e){return{ReadStream:t,WriteStream:r};function t(n,i){if(!(this instanceof t))return new t(n,i);et.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var u=Object.keys(i),c=0,a=u.length;c<a;c++){var k=u[c];this[k]=i[k]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}e.open(this.path,this.flags,this.mode,function(s,y){if(s){o.emit("error",s),o.readable=!1;return}o.fd=y,o.emit("open",y),o._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);et.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),u=0,c=o.length;u<c;u++){var a=o[u];this[a]=i[a]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var it=w((Uo,nt)=>{"use strict";f();nt.exports=On;var Pn=Object.getPrototypeOf||function(e){return e.__proto__};function On(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:Pn(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var M=w((Yo,je)=>{f();var g=P("fs"),Dn=be(),Nn=rt(),Tn=it(),we=P("util"),R,Ee;typeof Symbol=="function"&&typeof Symbol.for=="function"?(R=Symbol.for("graceful-fs.queue"),Ee=Symbol.for("graceful-fs.previous")):(R="___graceful-fs.queue",Ee="___graceful-fs.previous");function Cn(){}function ct(e,t){Object.defineProperty(e,R,{get:function(){return t}})}var Z=Cn;we.debuglog?Z=we.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Z=function(){var e=we.format.apply(we,arguments);e="GFS4: "+e.split(/\n/).join(`
|
5
|
-
GFS4: `),console.error(e)});g[R]||(ot=global[R]||[],ct(g,ot),g.close=function(e){function t(r,n){return e.call(g,r,function(i){i||ut(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(t,Ee,{value:e}),t}(g.close),g.closeSync=function(e){function t(r){e.apply(g,arguments),ut()}return Object.defineProperty(t,Ee,{value:e}),t}(g.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Z(g[R]),P("assert").equal(g[R].length,0)}));var ot;global[R]||ct(global,g[R]);je.exports=Re(Tn(g));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!g.__patched&&(je.exports=Re(g),g.__patched=!0);function Re(e){Dn(e),e.gracefulify=Re,e.createReadStream=he,e.createWriteStream=Xe;var t=e.readFile;e.readFile=r;function r(d,v,E){return typeof v=="function"&&(E=v,v=null),_(d,v,E);function _(L,I,D,j){return t(L,I,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?te([_,[L,I,D],x,j||Date.now(),Date.now()]):typeof D=="function"&&D.apply(this,arguments)})}}var n=e.writeFile;e.writeFile=i;function i(d,v,E,_){return typeof E=="function"&&(_=E,E=null),L(d,v,E,_);function L(I,D,j,x,U){return n(I,D,j,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?te([L,[I,D,j,x],N,U||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=u);function u(d,v,E,_){return typeof E=="function"&&(_=E,E=null),L(d,v,E,_);function L(I,D,j,x,U){return o(I,D,j,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?te([L,[I,D,j,x],N,U||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}var c=e.copyFile;c&&(e.copyFile=a);function a(d,v,E,_){return typeof E=="function"&&(_=E,E=0),L(d,v,E,_);function L(I,D,j,x,U){return c(I,D,j,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?te([L,[I,D,j,x],N,U||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}var k=e.readdir;e.readdir=s;function s(d,v,E){return typeof v=="function"&&(E=v,v=null),_(d,v,E);function _(L,I,D,j){return k(L,I,function(x,U){x&&(x.code==="EMFILE"||x.code==="ENFILE")?te([_,[L,I,D],x,j||Date.now(),Date.now()]):(U&&U.sort&&U.sort(),typeof D=="function"&&D.call(this,x,U))})}}if(process.version.substr(0,4)==="v0.8"){var y=Nn(e);p=y.ReadStream,T=y.WriteStream}var m=e.ReadStream;m&&(p.prototype=Object.create(m.prototype),p.prototype.open=O);var l=e.WriteStream;l&&(T.prototype=Object.create(l.prototype),T.prototype.open=oe),Object.defineProperty(e,"ReadStream",{get:function(){return p},set:function(d){p=d},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return T},set:function(d){T=d},enumerable:!0,configurable:!0});var h=p;Object.defineProperty(e,"FileReadStream",{get:function(){return h},set:function(d){h=d},enumerable:!0,configurable:!0});var q=T;Object.defineProperty(e,"FileWriteStream",{get:function(){return q},set:function(d){q=d},enumerable:!0,configurable:!0});function p(d,v){return this instanceof p?(m.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}function O(){var d=this;Ce(d.path,d.flags,d.mode,function(v,E){v?(d.autoClose&&d.destroy(),d.emit("error",v)):(d.fd=E,d.emit("open",E),d.read())})}function T(d,v){return this instanceof T?(l.apply(this,arguments),this):T.apply(Object.create(T.prototype),arguments)}function oe(){var d=this;Ce(d.path,d.flags,d.mode,function(v,E){v?(d.destroy(),d.emit("error",v)):(d.fd=E,d.emit("open",E))})}function he(d,v){return new e.ReadStream(d,v)}function Xe(d,v){return new e.WriteStream(d,v)}var He=e.open;e.open=Ce;function Ce(d,v,E,_){return typeof E=="function"&&(_=E,E=null),L(d,v,E,_);function L(I,D,j,x,U){return He(I,D,j,function(N,Lo){N&&(N.code==="EMFILE"||N.code==="ENFILE")?te([L,[I,D,j,x],N,U||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}return e}function te(e){Z("ENQUEUE",e[0].name,e[1]),g[R].push(e),$e()}var pe;function ut(){for(var e=Date.now(),t=0;t<g[R].length;++t)g[R][t].length>2&&(g[R][t][3]=e,g[R][t][4]=e);$e()}function $e(){if(clearTimeout(pe),pe=void 0,g[R].length!==0){var e=g[R].shift(),t=e[0],r=e[1],n=e[2],i=e[3],o=e[4];if(i===void 0)Z("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-i>=6e4){Z("TIMEOUT",t.name,r);var u=r.pop();typeof u=="function"&&u.call(null,n)}else{var c=Date.now()-o,a=Math.max(o-i,1),k=Math.min(a*1.2,100);c>=k?(Z("RETRY",t.name,r),t.apply(null,r.concat([i]))):g[R].push(e)}pe===void 0&&(pe=setTimeout($e,0))}}});var b=w(V=>{"use strict";f();var st=W().fromCallback,B=M(),_n=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(e=>typeof B[e]=="function");Object.assign(V,B);_n.forEach(e=>{V[e]=st(B[e])});V.realpath.native=st(B.realpath.native);V.exists=function(e,t){return typeof t=="function"?B.exists(e,t):new Promise(r=>B.exists(e,r))};V.read=function(e,t,r,n,i,o){return typeof o=="function"?B.read(e,t,r,n,i,o):new Promise((u,c)=>{B.read(e,t,r,n,i,(a,k,s)=>{if(a)return c(a);u({bytesRead:k,buffer:s})})})};V.write=function(e,t,...r){return typeof r[r.length-1]=="function"?B.write(e,t,...r):new Promise((n,i)=>{B.write(e,t,...r,(o,u,c)=>{if(o)return i(o);n({bytesWritten:u,buffer:c})})})};typeof B.writev=="function"&&(V.writev=function(e,t,...r){return typeof r[r.length-1]=="function"?B.writev(e,t,...r):new Promise((n,i)=>{B.writev(e,t,...r,(o,u,c)=>{if(o)return i(o);n({bytesWritten:u,buffers:c})})})})});var at=w((Ko,ft)=>{"use strict";f();var Ln=P("path");ft.exports.checkPath=function(t){if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(Ln.parse(t).root,""))){let n=new Error(`Path contains invalid characters: ${t}`);throw n.code="EINVAL",n}}});var dt=w((Vo,Me)=>{"use strict";f();var lt=b(),{checkPath:yt}=at(),mt=e=>{let t={mode:511};return typeof e=="number"?e:{...t,...e}.mode};Me.exports.makeDir=async(e,t)=>(yt(e),lt.mkdir(e,{mode:mt(t),recursive:!0}));Me.exports.makeDirSync=(e,t)=>(yt(e),lt.mkdirSync(e,{mode:mt(t),recursive:!0}))});var Y=w((Qo,ht)=>{"use strict";f();var In=W().fromPromise,{makeDir:Rn,makeDirSync:Ae}=dt(),We=In(Rn);ht.exports={mkdirs:We,mkdirsSync:Ae,mkdirp:We,mkdirpSync:Ae,ensureDir:We,ensureDirSync:Ae}});var Q=w((Xo,wt)=>{"use strict";f();var $n=W().fromPromise,St=b();function jn(e){return St.access(e).then(()=>!0).catch(()=>!1)}wt.exports={pathExists:$n(jn),pathExistsSync:St.existsSync}});var Je=w((Ho,pt)=>{"use strict";f();var re=M();function Mn(e,t,r,n){re.open(e,"r+",(i,o)=>{if(i)return n(i);re.futimes(o,t,r,u=>{re.close(o,c=>{n&&n(u||c)})})})}function An(e,t,r){let n=re.openSync(e,"r+");return re.futimesSync(n,t,r),re.closeSync(n)}pt.exports={utimesMillis:Mn,utimesMillisSync:An}});var ee=w((zo,kt)=>{"use strict";f();var ne=b(),C=P("path"),Wn=P("util");function Jn(e,t,r){let n=r.dereference?i=>ne.stat(i,{bigint:!0}):i=>ne.lstat(i,{bigint:!0});return Promise.all([n(e),n(t).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,o])=>({srcStat:i,destStat:o}))}function Bn(e,t,r){let n,i=r.dereference?u=>ne.statSync(u,{bigint:!0}):u=>ne.lstatSync(u,{bigint:!0}),o=i(e);try{n=i(t)}catch(u){if(u.code==="ENOENT")return{srcStat:o,destStat:null};throw u}return{srcStat:o,destStat:n}}function Un(e,t,r,n,i){Wn.callbackify(Jn)(e,t,n,(o,u)=>{if(o)return i(o);let{srcStat:c,destStat:a}=u;if(a){if(ue(c,a)){let k=C.basename(e),s=C.basename(t);return r==="move"&&k!==s&&k.toLowerCase()===s.toLowerCase()?i(null,{srcStat:c,destStat:a,isChangingCase:!0}):i(new Error("Source and destination must not be the same."))}if(c.isDirectory()&&!a.isDirectory())return i(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!c.isDirectory()&&a.isDirectory())return i(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return c.isDirectory()&&Be(e,t)?i(new Error(ve(e,t,r))):i(null,{srcStat:c,destStat:a})})}function Yn(e,t,r,n){let{srcStat:i,destStat:o}=Bn(e,t,n);if(o){if(ue(i,o)){let u=C.basename(e),c=C.basename(t);if(r==="move"&&u!==c&&u.toLowerCase()===c.toLowerCase())return{srcStat:i,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!i.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(i.isDirectory()&&Be(e,t))throw new Error(ve(e,t,r));return{srcStat:i,destStat:o}}function Et(e,t,r,n,i){let o=C.resolve(C.dirname(e)),u=C.resolve(C.dirname(r));if(u===o||u===C.parse(u).root)return i();ne.stat(u,{bigint:!0},(c,a)=>c?c.code==="ENOENT"?i():i(c):ue(t,a)?i(new Error(ve(e,r,n))):Et(e,t,u,n,i))}function vt(e,t,r,n){let i=C.resolve(C.dirname(e)),o=C.resolve(C.dirname(r));if(o===i||o===C.parse(o).root)return;let u;try{u=ne.statSync(o,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(ue(t,u))throw new Error(ve(e,r,n));return vt(e,t,o,n)}function ue(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function Be(e,t){let r=C.resolve(e).split(C.sep).filter(i=>i),n=C.resolve(t).split(C.sep).filter(i=>i);return r.reduce((i,o,u)=>i&&n[u]===o,!0)}function ve(e,t,r){return`Cannot ${r} '${e}' to a subdirectory of itself, '${t}'.`}kt.exports={checkPaths:Un,checkPathsSync:Yn,checkParentPaths:Et,checkParentPathsSync:vt,isSrcSubdir:Be,areIdentical:ue}});var Nt=w((Zo,Dt)=>{"use strict";f();var J=M(),ce=P("path"),Gn=Y().mkdirs,Kn=Q().pathExists,Vn=Je().utimesMillis,se=ee();function Qn(e,t,r,n){typeof r=="function"&&!n?(n=r,r={}):typeof r=="function"&&(r={filter:r}),n=n||function(){},r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
6
|
-
|
7
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`),se.checkPaths(e,t,"copy",r,(i,o)=>{if(i)return n(i);let{srcStat:u,destStat:c}=o;se.checkParentPaths(e,u,t,"copy",a=>a?n(a):r.filter?xt(qt,c,e,t,r,n):qt(c,e,t,r,n))})}function qt(e,t,r,n,i){let o=ce.dirname(r);Kn(o,(u,c)=>{if(u)return i(u);if(c)return ke(e,t,r,n,i);Gn(o,a=>a?i(a):ke(e,t,r,n,i))})}function xt(e,t,r,n,i,o){Promise.resolve(i.filter(r,n)).then(u=>u?e(t,r,n,i,o):o(),u=>o(u))}function Xn(e,t,r,n,i){return n.filter?xt(ke,e,t,r,n,i):ke(e,t,r,n,i)}function ke(e,t,r,n,i){(n.dereference?J.stat:J.lstat)(t,(u,c)=>u?i(u):c.isDirectory()?ri(c,e,t,r,n,i):c.isFile()||c.isCharacterDevice()||c.isBlockDevice()?Hn(c,e,t,r,n,i):c.isSymbolicLink()?oi(e,t,r,n,i):c.isSocket()?i(new Error(`Cannot copy a socket file: ${t}`)):c.isFIFO()?i(new Error(`Cannot copy a FIFO pipe: ${t}`)):i(new Error(`Unknown file: ${t}`)))}function Hn(e,t,r,n,i,o){return t?zn(e,r,n,i,o):gt(e,r,n,i,o)}function zn(e,t,r,n,i){if(n.overwrite)J.unlink(r,o=>o?i(o):gt(e,t,r,n,i));else return n.errorOnExist?i(new Error(`'${r}' already exists`)):i()}function gt(e,t,r,n,i){J.copyFile(t,r,o=>o?i(o):n.preserveTimestamps?Zn(e.mode,t,r,i):qe(r,e.mode,i))}function Zn(e,t,r,n){return bn(e)?ei(r,e,i=>i?n(i):Ft(e,t,r,n)):Ft(e,t,r,n)}function bn(e){return(e&128)===0}function ei(e,t,r){return qe(e,t|128,r)}function Ft(e,t,r,n){ti(t,r,i=>i?n(i):qe(r,e,n))}function qe(e,t,r){return J.chmod(e,t,r)}function ti(e,t,r){J.stat(e,(n,i)=>n?r(n):Vn(t,i.atime,i.mtime,r))}function ri(e,t,r,n,i,o){return t?Pt(r,n,i,o):ni(e.mode,r,n,i,o)}function ni(e,t,r,n,i){J.mkdir(r,o=>{if(o)return i(o);Pt(t,r,n,u=>u?i(u):qe(r,e,i))})}function Pt(e,t,r,n){J.readdir(e,(i,o)=>i?n(i):Ot(o,e,t,r,n))}function Ot(e,t,r,n,i){let o=e.pop();return o?ii(e,o,t,r,n,i):i()}function ii(e,t,r,n,i,o){let u=ce.join(r,t),c=ce.join(n,t);se.checkPaths(u,c,"copy",i,(a,k)=>{if(a)return o(a);let{destStat:s}=k;Xn(s,u,c,i,y=>y?o(y):Ot(e,r,n,i,o))})}function oi(e,t,r,n,i){J.readlink(t,(o,u)=>{if(o)return i(o);if(n.dereference&&(u=ce.resolve(process.cwd(),u)),e)J.readlink(r,(c,a)=>c?c.code==="EINVAL"||c.code==="UNKNOWN"?J.symlink(u,r,i):i(c):(n.dereference&&(a=ce.resolve(process.cwd(),a)),se.isSrcSubdir(u,a)?i(new Error(`Cannot copy '${u}' to a subdirectory of itself, '${a}'.`)):e.isDirectory()&&se.isSrcSubdir(a,u)?i(new Error(`Cannot overwrite '${a}' with '${u}'.`)):ui(u,r,i)));else return J.symlink(u,r,i)})}function ui(e,t,r){J.unlink(t,n=>n?r(n):J.symlink(e,t,r))}Dt.exports=Qn});var It=w((bo,Lt)=>{"use strict";f();var $=M(),fe=P("path"),ci=Y().mkdirsSync,si=Je().utimesMillisSync,ae=ee();function fi(e,t,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
8
|
-
|
9
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:i}=ae.checkPathsSync(e,t,"copy",r);return ae.checkParentPathsSync(e,n,t,"copy"),ai(i,e,t,r)}function ai(e,t,r,n){if(n.filter&&!n.filter(t,r))return;let i=fe.dirname(r);return $.existsSync(i)||ci(i),Tt(e,t,r,n)}function li(e,t,r,n){if(!(n.filter&&!n.filter(t,r)))return Tt(e,t,r,n)}function Tt(e,t,r,n){let o=(n.dereference?$.statSync:$.lstatSync)(t);if(o.isDirectory())return pi(o,e,t,r,n);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return yi(o,e,t,r,n);if(o.isSymbolicLink())return ki(e,t,r,n);throw o.isSocket()?new Error(`Cannot copy a socket file: ${t}`):o.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${t}`):new Error(`Unknown file: ${t}`)}function yi(e,t,r,n,i){return t?mi(e,r,n,i):Ct(e,r,n,i)}function mi(e,t,r,n){if(n.overwrite)return $.unlinkSync(r),Ct(e,t,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function Ct(e,t,r,n){return $.copyFileSync(t,r),n.preserveTimestamps&&di(e.mode,t,r),Ue(r,e.mode)}function di(e,t,r){return hi(e)&&Si(r,e),wi(t,r)}function hi(e){return(e&128)===0}function Si(e,t){return Ue(e,t|128)}function Ue(e,t){return $.chmodSync(e,t)}function wi(e,t){let r=$.statSync(e);return si(t,r.atime,r.mtime)}function pi(e,t,r,n,i){return t?_t(r,n,i):Ei(e.mode,r,n,i)}function Ei(e,t,r,n){return $.mkdirSync(r),_t(t,r,n),Ue(r,e)}function _t(e,t,r){$.readdirSync(e).forEach(n=>vi(n,e,t,r))}function vi(e,t,r,n){let i=fe.join(t,e),o=fe.join(r,e),{destStat:u}=ae.checkPathsSync(i,o,"copy",n);return li(u,i,o,n)}function ki(e,t,r,n){let i=$.readlinkSync(t);if(n.dereference&&(i=fe.resolve(process.cwd(),i)),e){let o;try{o=$.readlinkSync(r)}catch(u){if(u.code==="EINVAL"||u.code==="UNKNOWN")return $.symlinkSync(i,r);throw u}if(n.dereference&&(o=fe.resolve(process.cwd(),o)),ae.isSrcSubdir(i,o))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${o}'.`);if($.statSync(r).isDirectory()&&ae.isSrcSubdir(o,i))throw new Error(`Cannot overwrite '${o}' with '${i}'.`);return qi(i,r)}else return $.symlinkSync(i,r)}function qi(e,t){return $.unlinkSync(t),$.symlinkSync(e,t)}Lt.exports=fi});var Fe=w((eu,Rt)=>{"use strict";f();var Fi=W().fromCallback;Rt.exports={copy:Fi(Nt()),copySync:It()}});var Yt=w((tu,Ut)=>{"use strict";f();var $t=M(),Wt=P("path"),F=P("assert"),le=process.platform==="win32";function Jt(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{e[r]=e[r]||$t[r],r=r+"Sync",e[r]=e[r]||$t[r]}),e.maxBusyTries=e.maxBusyTries||3}function Ye(e,t,r){let n=0;typeof t=="function"&&(r=t,t={}),F(e,"rimraf: missing path"),F.strictEqual(typeof e,"string","rimraf: path should be a string"),F.strictEqual(typeof r,"function","rimraf: callback function required"),F(t,"rimraf: invalid options argument provided"),F.strictEqual(typeof t,"object","rimraf: options should be object"),Jt(t),jt(e,t,function i(o){if(o){if((o.code==="EBUSY"||o.code==="ENOTEMPTY"||o.code==="EPERM")&&n<t.maxBusyTries){n++;let u=n*100;return setTimeout(()=>jt(e,t,i),u)}o.code==="ENOENT"&&(o=null)}r(o)})}function jt(e,t,r){F(e),F(t),F(typeof r=="function"),t.lstat(e,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&le)return Mt(e,t,n,r);if(i&&i.isDirectory())return xe(e,t,n,r);t.unlink(e,o=>{if(o){if(o.code==="ENOENT")return r(null);if(o.code==="EPERM")return le?Mt(e,t,o,r):xe(e,t,o,r);if(o.code==="EISDIR")return xe(e,t,o,r)}return r(o)})})}function Mt(e,t,r,n){F(e),F(t),F(typeof n=="function"),t.chmod(e,438,i=>{i?n(i.code==="ENOENT"?null:r):t.stat(e,(o,u)=>{o?n(o.code==="ENOENT"?null:r):u.isDirectory()?xe(e,t,r,n):t.unlink(e,n)})})}function At(e,t,r){let n;F(e),F(t);try{t.chmodSync(e,438)}catch(i){if(i.code==="ENOENT")return;throw r}try{n=t.statSync(e)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?ge(e,t,r):t.unlinkSync(e)}function xe(e,t,r,n){F(e),F(t),F(typeof n=="function"),t.rmdir(e,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?xi(e,t,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function xi(e,t,r){F(e),F(t),F(typeof r=="function"),t.readdir(e,(n,i)=>{if(n)return r(n);let o=i.length,u;if(o===0)return t.rmdir(e,r);i.forEach(c=>{Ye(Wt.join(e,c),t,a=>{if(!u){if(a)return r(u=a);--o===0&&t.rmdir(e,r)}})})})}function Bt(e,t){let r;t=t||{},Jt(t),F(e,"rimraf: missing path"),F.strictEqual(typeof e,"string","rimraf: path should be a string"),F(t,"rimraf: missing options"),F.strictEqual(typeof t,"object","rimraf: options should be object");try{r=t.lstatSync(e)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&le&&At(e,t,n)}try{r&&r.isDirectory()?ge(e,t,null):t.unlinkSync(e)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return le?At(e,t,n):ge(e,t,n);if(n.code!=="EISDIR")throw n;ge(e,t,n)}}function ge(e,t,r){F(e),F(t);try{t.rmdirSync(e)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")gi(e,t);else if(n.code!=="ENOENT")throw n}}function gi(e,t){if(F(e),F(t),t.readdirSync(e).forEach(r=>Bt(Wt.join(e,r),t)),le){let r=Date.now();do try{return t.rmdirSync(e,t)}catch{}while(Date.now()-r<500)}else return t.rmdirSync(e,t)}Ut.exports=Ye;Ye.sync=Bt});var ye=w((ru,Kt)=>{"use strict";f();var Pe=M(),Pi=W().fromCallback,Gt=Yt();function Oi(e,t){if(Pe.rm)return Pe.rm(e,{recursive:!0,force:!0},t);Gt(e,t)}function Di(e){if(Pe.rmSync)return Pe.rmSync(e,{recursive:!0,force:!0});Gt.sync(e)}Kt.exports={remove:Pi(Oi),removeSync:Di}});var er=w((nu,bt)=>{"use strict";f();var Ni=W().fromPromise,Xt=b(),Ht=P("path"),zt=Y(),Zt=ye(),Vt=Ni(async function(t){let r;try{r=await Xt.readdir(t)}catch{return zt.mkdirs(t)}return Promise.all(r.map(n=>Zt.remove(Ht.join(t,n))))});function Qt(e){let t;try{t=Xt.readdirSync(e)}catch{return zt.mkdirsSync(e)}t.forEach(r=>{r=Ht.join(e,r),Zt.removeSync(r)})}bt.exports={emptyDirSync:Qt,emptydirSync:Qt,emptyDir:Vt,emptydir:Vt}});var ir=w((iu,nr)=>{"use strict";f();var Ti=W().fromCallback,tr=P("path"),X=M(),rr=Y();function Ci(e,t){function r(){X.writeFile(e,"",n=>{if(n)return t(n);t()})}X.stat(e,(n,i)=>{if(!n&&i.isFile())return t();let o=tr.dirname(e);X.stat(o,(u,c)=>{if(u)return u.code==="ENOENT"?rr.mkdirs(o,a=>{if(a)return t(a);r()}):t(u);c.isDirectory()?r():X.readdir(o,a=>{if(a)return t(a)})})})}function _i(e){let t;try{t=X.statSync(e)}catch{}if(t&&t.isFile())return;let r=tr.dirname(e);try{X.statSync(r).isDirectory()||X.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")rr.mkdirsSync(r);else throw n}X.writeFileSync(e,"")}nr.exports={createFile:Ti(Ci),createFileSync:_i}});var fr=w((ou,sr)=>{"use strict";f();var Li=W().fromCallback,or=P("path"),H=M(),ur=Y(),Ii=Q().pathExists,{areIdentical:cr}=ee();function Ri(e,t,r){function n(i,o){H.link(i,o,u=>{if(u)return r(u);r(null)})}H.lstat(t,(i,o)=>{H.lstat(e,(u,c)=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),r(u);if(o&&cr(c,o))return r(null);let a=or.dirname(t);Ii(a,(k,s)=>{if(k)return r(k);if(s)return n(e,t);ur.mkdirs(a,y=>{if(y)return r(y);n(e,t)})})})})}function $i(e,t){let r;try{r=H.lstatSync(t)}catch{}try{let o=H.lstatSync(e);if(r&&cr(o,r))return}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}let n=or.dirname(t);return H.existsSync(n)||ur.mkdirsSync(n),H.linkSync(e,t)}sr.exports={createLink:Li(Ri),createLinkSync:$i}});var lr=w((uu,ar)=>{"use strict";f();var z=P("path"),me=M(),ji=Q().pathExists;function Mi(e,t,r){if(z.isAbsolute(e))return me.lstat(e,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:e,toDst:e}));{let n=z.dirname(t),i=z.join(n,e);return ji(i,(o,u)=>o?r(o):u?r(null,{toCwd:i,toDst:e}):me.lstat(e,c=>c?(c.message=c.message.replace("lstat","ensureSymlink"),r(c)):r(null,{toCwd:e,toDst:z.relative(n,e)})))}}function Ai(e,t){let r;if(z.isAbsolute(e)){if(r=me.existsSync(e),!r)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}else{let n=z.dirname(t),i=z.join(n,e);if(r=me.existsSync(i),r)return{toCwd:i,toDst:e};if(r=me.existsSync(e),!r)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:z.relative(n,e)}}}ar.exports={symlinkPaths:Mi,symlinkPathsSync:Ai}});var dr=w((cu,mr)=>{"use strict";f();var yr=M();function Wi(e,t,r){if(r=typeof t=="function"?t:r,t=typeof t=="function"?!1:t,t)return r(null,t);yr.lstat(e,(n,i)=>{if(n)return r(null,"file");t=i&&i.isDirectory()?"dir":"file",r(null,t)})}function Ji(e,t){let r;if(t)return t;try{r=yr.lstatSync(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}mr.exports={symlinkType:Wi,symlinkTypeSync:Ji}});var qr=w((su,kr)=>{"use strict";f();var Bi=W().fromCallback,Sr=P("path"),G=b(),wr=Y(),Ui=wr.mkdirs,Yi=wr.mkdirsSync,pr=lr(),Gi=pr.symlinkPaths,Ki=pr.symlinkPathsSync,Er=dr(),Vi=Er.symlinkType,Qi=Er.symlinkTypeSync,Xi=Q().pathExists,{areIdentical:vr}=ee();function Hi(e,t,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,G.lstat(t,(i,o)=>{!i&&o.isSymbolicLink()?Promise.all([G.stat(e),G.stat(t)]).then(([u,c])=>{if(vr(u,c))return n(null);hr(e,t,r,n)}):hr(e,t,r,n)})}function hr(e,t,r,n){Gi(e,t,(i,o)=>{if(i)return n(i);e=o.toDst,Vi(o.toCwd,r,(u,c)=>{if(u)return n(u);let a=Sr.dirname(t);Xi(a,(k,s)=>{if(k)return n(k);if(s)return G.symlink(e,t,c,n);Ui(a,y=>{if(y)return n(y);G.symlink(e,t,c,n)})})})})}function zi(e,t,r){let n;try{n=G.lstatSync(t)}catch{}if(n&&n.isSymbolicLink()){let c=G.statSync(e),a=G.statSync(t);if(vr(c,a))return}let i=Ki(e,t);e=i.toDst,r=Qi(i.toCwd,r);let o=Sr.dirname(t);return G.existsSync(o)||Yi(o),G.symlinkSync(e,t,r)}kr.exports={createSymlink:Bi(Hi),createSymlinkSync:zi}});var Tr=w((fu,Nr)=>{"use strict";f();var{createFile:Fr,createFileSync:xr}=ir(),{createLink:gr,createLinkSync:Pr}=fr(),{createSymlink:Or,createSymlinkSync:Dr}=qr();Nr.exports={createFile:Fr,createFileSync:xr,ensureFile:Fr,ensureFileSync:xr,createLink:gr,createLinkSync:Pr,ensureLink:gr,ensureLinkSync:Pr,createSymlink:Or,createSymlinkSync:Dr,ensureSymlink:Or,ensureSymlinkSync:Dr}});var Oe=w((au,Cr)=>{f();function Zi(e,{EOL:t=`
|
10
|
-
`,finalEOL:r=!0,replacer:n=null,spaces:i}={}){let o=r?t:"";return JSON.stringify(e,n,i).replace(/\n/g,t)+o}function bi(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}Cr.exports={stringify:Zi,stripBom:bi}});var Rr=w((lu,Ir)=>{f();var ie;try{ie=M()}catch{ie=P("fs")}var De=W(),{stringify:_r,stripBom:Lr}=Oe();async function eo(e,t={}){typeof t=="string"&&(t={encoding:t});let r=t.fs||ie,n="throws"in t?t.throws:!0,i=await De.fromCallback(r.readFile)(e,t);i=Lr(i);let o;try{o=JSON.parse(i,t?t.reviver:null)}catch(u){if(n)throw u.message=`${e}: ${u.message}`,u;return null}return o}var to=De.fromPromise(eo);function ro(e,t={}){typeof t=="string"&&(t={encoding:t});let r=t.fs||ie,n="throws"in t?t.throws:!0;try{let i=r.readFileSync(e,t);return i=Lr(i),JSON.parse(i,t.reviver)}catch(i){if(n)throw i.message=`${e}: ${i.message}`,i;return null}}async function no(e,t,r={}){let n=r.fs||ie,i=_r(t,r);await De.fromCallback(n.writeFile)(e,i,r)}var io=De.fromPromise(no);function oo(e,t,r={}){let n=r.fs||ie,i=_r(t,r);return n.writeFileSync(e,i,r)}var uo={readFile:to,readFileSync:ro,writeFile:io,writeFileSync:oo};Ir.exports=uo});var jr=w((yu,$r)=>{"use strict";f();var Ne=Rr();$r.exports={readJson:Ne.readFile,readJsonSync:Ne.readFileSync,writeJson:Ne.writeFile,writeJsonSync:Ne.writeFileSync}});var Te=w((mu,Wr)=>{"use strict";f();var co=W().fromCallback,de=M(),Mr=P("path"),Ar=Y(),so=Q().pathExists;function fo(e,t,r,n){typeof r=="function"&&(n=r,r="utf8");let i=Mr.dirname(e);so(i,(o,u)=>{if(o)return n(o);if(u)return de.writeFile(e,t,r,n);Ar.mkdirs(i,c=>{if(c)return n(c);de.writeFile(e,t,r,n)})})}function ao(e,...t){let r=Mr.dirname(e);if(de.existsSync(r))return de.writeFileSync(e,...t);Ar.mkdirsSync(r),de.writeFileSync(e,...t)}Wr.exports={outputFile:co(fo),outputFileSync:ao}});var Br=w((du,Jr)=>{"use strict";f();var{stringify:lo}=Oe(),{outputFile:yo}=Te();async function mo(e,t,r={}){let n=lo(t,r);await yo(e,n,r)}Jr.exports=mo});var Yr=w((hu,Ur)=>{"use strict";f();var{stringify:ho}=Oe(),{outputFileSync:So}=Te();function wo(e,t,r){let n=ho(t,r);So(e,n,r)}Ur.exports=wo});var Kr=w((Su,Gr)=>{"use strict";f();var po=W().fromPromise,A=jr();A.outputJson=po(Br());A.outputJsonSync=Yr();A.outputJSON=A.outputJson;A.outputJSONSync=A.outputJsonSync;A.writeJSON=A.writeJson;A.writeJSONSync=A.writeJsonSync;A.readJSON=A.readJson;A.readJSONSync=A.readJsonSync;Gr.exports=A});var zr=w((wu,Hr)=>{"use strict";f();var Eo=M(),Ke=P("path"),vo=Fe().copy,Xr=ye().remove,ko=Y().mkdirp,qo=Q().pathExists,Vr=ee();function Fo(e,t,r,n){typeof r=="function"&&(n=r,r={});let i=r.overwrite||r.clobber||!1;Vr.checkPaths(e,t,"move",r,(o,u)=>{if(o)return n(o);let{srcStat:c,isChangingCase:a=!1}=u;Vr.checkParentPaths(e,c,t,"move",k=>{if(k)return n(k);if(xo(t))return Qr(e,t,i,a,n);ko(Ke.dirname(t),s=>s?n(s):Qr(e,t,i,a,n))})})}function xo(e){let t=Ke.dirname(e);return Ke.parse(t).root===t}function Qr(e,t,r,n,i){if(n)return Ge(e,t,r,i);if(r)return Xr(t,o=>o?i(o):Ge(e,t,r,i));qo(t,(o,u)=>o?i(o):u?i(new Error("dest already exists.")):Ge(e,t,r,i))}function Ge(e,t,r,n){Eo.rename(e,t,i=>i?i.code!=="EXDEV"?n(i):go(e,t,r,n):n())}function go(e,t,r,n){vo(e,t,{overwrite:r,errorOnExist:!0},o=>o?n(o):Xr(e,n))}Hr.exports=Fo});var rn=w((pu,tn)=>{"use strict";f();var br=M(),Qe=P("path"),Po=Fe().copySync,en=ye().removeSync,Oo=Y().mkdirpSync,Zr=ee();function Do(e,t,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:o=!1}=Zr.checkPathsSync(e,t,"move",r);return Zr.checkParentPathsSync(e,i,t,"move"),No(t)||Oo(Qe.dirname(t)),To(e,t,n,o)}function No(e){let t=Qe.dirname(e);return Qe.parse(t).root===t}function To(e,t,r,n){if(n)return Ve(e,t,r);if(r)return en(t),Ve(e,t,r);if(br.existsSync(t))throw new Error("dest already exists.");return Ve(e,t,r)}function Ve(e,t,r){try{br.renameSync(e,t)}catch(n){if(n.code!=="EXDEV")throw n;return Co(e,t,r)}}function Co(e,t,r){return Po(e,t,{overwrite:r,errorOnExist:!0}),en(e)}tn.exports=Do});var on=w((Eu,nn)=>{"use strict";f();var _o=W().fromCallback;nn.exports={move:_o(zr()),moveSync:rn()}});var cn=w((vu,un)=>{"use strict";f();un.exports={...b(),...Fe(),...er(),...Tr(),...Kr(),...Y(),...on(),...Te(),...Q(),...ye()}});f();f();import{dirname as En,resolve as vn}from"path";import{fileURLToPath as kn}from"url";var ze=vn(En(kn(import.meta.url)),"..");var fn=pn(cn(),1);import{resolve as sn}from"path";var Fu=async(e,t)=>{let r=sn(ze,`./templates/${e}`),n=sn(t);await(0,fn.copy)(r,n,{overwrite:!0,recursive:!0})};export{Fu as copyTemplate};
|