@tsmodule/tsmodule 40.19.0 → 41.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.
@@ -1,12 +1,12 @@
1
1
 
2
2
  if(typeof process<"u"){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 R,isAbsolute as se,join as ye,normalize as Le,resolve as Me}from"path";import{posix as Ae}from"path";import{win32 as Se}from"path";import{fileURLToPath as Be,pathToFileURL as ie,URL as P}from"url";import{readFile as Fe}from"fs/promises";import{transform as le}from"esbuild";var G={NODE_ENV:"production"};try{let{env:e}=await import("process");e.NODE_ENV&&(G.NODE_ENV=e.NODE_ENV)}catch{}var C=typeof window>"u"&&G.NODE_ENV==="development";import{Console as Te}from"console";var $=(e=0)=>o=>`\x1B[${o+e}m`,V=(e=0)=>o=>`\x1B[${38+e};5;${o}m`,H=(e=0)=>(o,t,r)=>`\x1B[${38+e};2;${o};${t};${r}m`,l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Y=Object.keys(l.modifier),S=Object.keys(l.color),B=Object.keys(l.bgColor),J=[...S,...B];function ue(){let e=new Map;for(let[o,t]of Object.entries(l)){for(let[r,n]of Object.entries(t))l[r]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},t[r]=l[r],e.set(n[0],n[1]);Object.defineProperty(l,o,{value:t,enumerable:!1})}return Object.defineProperty(l,"codes",{value:e,enumerable:!1}),l.color.close="\x1B[39m",l.bgColor.close="\x1B[49m",l.color.ansi=$(),l.color.ansi256=V(),l.color.ansi16m=H(),l.bgColor.ansi=$(10),l.bgColor.ansi256=V(10),l.bgColor.ansi16m=H(10),Object.defineProperties(l,{rgbToAnsi256:{value(o,t,r){return o===t&&t===r?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(r/255*5)},enumerable:!1},hexToRgb:{value(o){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(o.toString(16));if(!t)return[0,0,0];let[r]=t;r.length===3&&(r=[...r].map(s=>s+s).join(""));let n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:o=>l.rgbToAnsi256(...l.hexToRgb(o)),enumerable:!1},ansi256ToAnsi:{value(o){if(o<8)return 30+o;if(o<16)return 90+(o-8);let t,r,n;if(o>=232)t=((o-232)*10+8)/255,r=t,n=t;else{o-=16;let u=o%36;t=Math.floor(o/36)/5,r=Math.floor(u/6)/5,n=u%6/5}let s=Math.max(t,r,n)*2;if(s===0)return 30;let i=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return s===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(o,t,r)=>l.ansi256ToAnsi(l.rgbToAnsi256(o,t,r)),enumerable:!1},hexToAnsi:{value:o=>l.ansi256ToAnsi(l.hexToAnsi256(o)),enumerable:!1}}),l}var ae=ue(),f=ae;import F from"node:process";import fe from"node:os";import W from"node:tty";function a(e,o=F.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:c}=F,N;a("no-color")||a("no-colors")||a("color=false")||a("color=never")?N=0:(a("color")||a("colors")||a("color=true")||a("color=always"))&&(N=1);function me(){if("FORCE_COLOR"in c)return c.FORCE_COLOR==="true"?1:c.FORCE_COLOR==="false"?0:c.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(c.FORCE_COLOR,10),3)}function pe(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function ge(e,{streamIsTTY:o,sniffFlags:t=!0}={}){let r=me();r!==void 0&&(N=r);let n=t?N: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(c.TERM==="dumb")return s;if(F.platform==="win32"){let i=fe.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in c)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(i=>i in c)||c.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in c)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(c.TEAMCITY_VERSION)?1:0;if("TF_BUILD"in c&&"AGENT_NAME"in c)return 1;if(c.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in c){let i=Number.parseInt((c.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(c.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(c.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(c.TERM)||"COLORTERM"in c?1:s}function K(e,o={}){let t=ge(e,{streamIsTTY:e&&e.isTTY,...o});return pe(t)}var de={stdout:K({isTTY:W.isatty(1)}),stderr:K({isTTY:W.isatty(2)})},z=de;function X(e,o,t){let r=e.indexOf(o);if(r===-1)return e;let n=o.length,s=0,i="";do i+=e.slice(s,r)+o+t,s=r+n,r=e.indexOf(o,s);while(r!==-1);return i+=e.slice(s),i}function q(e,o,t,r){let n=0,s="";do{let i=e[r-1]==="\r";s+=e.slice(n,i?r-1:r)+o+(i?`\r
4
+ import{extname as O,isAbsolute as Q,join as he,normalize as be,resolve as Ee}from"path";import{posix as Oe}from"path";import{win32 as Re}from"path";import{fileURLToPath as Ce,pathToFileURL as X,URL as U}from"url";import{readFile as Te}from"fs/promises";import{transform as ee}from"esbuild";var k={NODE_ENV:"production"};try{let{env:e}=await import("process");e.NODE_ENV&&(k.NODE_ENV=e.NODE_ENV)}catch{}var C=typeof window>"u"&&k.NODE_ENV==="development";import{Console as de}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,r,t)=>`\x1B[${38+e};2;${o};${r};${t}m`,i={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},j=Object.keys(i.modifier),A=Object.keys(i.color),M=Object.keys(i.bgColor),$=[...A,...M];function re(){let e=new Map;for(let[o,r]of Object.entries(i)){for(let[t,n]of Object.entries(r))i[t]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[t]=i[t],e.set(n[0],n[1]);Object.defineProperty(i,o,{value:r,enumerable:!1})}return Object.defineProperty(i,"codes",{value:e,enumerable:!1}),i.color.close="\x1B[39m",i.bgColor.close="\x1B[49m",i.color.ansi=D(),i.color.ansi256=P(),i.color.ansi16m=G(),i.bgColor.ansi=D(10),i.bgColor.ansi256=P(10),i.bgColor.ansi16m=G(10),Object.defineProperties(i,{rgbToAnsi256:{value(o,r,t){return o===r&&r===t?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(r/255*5)+Math.round(t/255*5)},enumerable:!1},hexToRgb:{value(o){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(o.toString(16));if(!r)return[0,0,0];let[t]=r;t.length===3&&(t=[...t].map(s=>s+s).join(""));let n=Number.parseInt(t,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:o=>i.rgbToAnsi256(...i.hexToRgb(o)),enumerable:!1},ansi256ToAnsi:{value(o){if(o<8)return 30+o;if(o<16)return 90+(o-8);let r,t,n;if(o>=232)r=((o-232)*10+8)/255,t=r,n=r;else{o-=16;let c=o%36;r=Math.floor(o/36)/5,t=Math.floor(c/6)/5,n=c%6/5}let s=Math.max(r,t,n)*2;if(s===0)return 30;let l=30+(Math.round(n)<<2|Math.round(t)<<1|Math.round(r));return s===2&&(l+=60),l},enumerable:!1},rgbToAnsi:{value:(o,r,t)=>i.ansi256ToAnsi(i.rgbToAnsi256(o,r,t)),enumerable:!1},hexToAnsi:{value:o=>i.ansi256ToAnsi(i.hexToAnsi256(o)),enumerable:!1}}),i}var te=re(),f=te;import B from"node:process";import ne from"node:os";import V from"node:tty";function a(e,o=B.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",t=o.indexOf(r+e),n=o.indexOf("--");return t!==-1&&(n===-1||t<n)}var{env:u}=B,T;a("no-color")||a("no-colors")||a("color=false")||a("color=never")?T=0:(a("color")||a("colors")||a("color=true")||a("color=always"))&&(T=1);function se(){if("FORCE_COLOR"in u)return u.FORCE_COLOR==="true"?1:u.FORCE_COLOR==="false"?0:u.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(u.FORCE_COLOR,10),3)}function le(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function ie(e,{streamIsTTY:o,sniffFlags:r=!0}={}){let t=se();t!==void 0&&(T=t);let n=r?T:t;if(n===0)return 0;if(r){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(u.TERM==="dumb")return s;if(B.platform==="win32"){let l=ne.release().split(".");return Number(l[0])>=10&&Number(l[2])>=10586?Number(l[2])>=14931?3:2:1}if("CI"in u)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(l=>l in u)||u.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in u)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(u.TEAMCITY_VERSION)?1:0;if("TF_BUILD"in u&&"AGENT_NAME"in u)return 1;if(u.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in u){let l=Number.parseInt((u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(u.TERM_PROGRAM){case"iTerm.app":return l>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(u.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(u.TERM)||"COLORTERM"in u?1:s}function H(e,o={}){let r=ie(e,{streamIsTTY:e&&e.isTTY,...o});return le(r)}var ue={stdout:H({isTTY:V.isatty(1)}),stderr:H({isTTY:V.isatty(2)})},Y=ue;function W(e,o,r){let t=e.indexOf(o);if(t===-1)return e;let n=o.length,s=0,l="";do l+=e.slice(s,t)+o+r,s=t+n,t=e.indexOf(o,s);while(t!==-1);return l+=e.slice(s),l}function K(e,o,r,t){let n=0,s="";do{let l=e[t-1]==="\r";s+=e.slice(n,l?t-1:t)+o+(l?`\r
5
5
  `:`
6
- `)+t,n=r+1,r=e.indexOf(`
7
- `,n)}while(r!==-1);return s+=e.slice(n),s}var{stdout:Q,stderr:Z}=z,w=Symbol("GENERATOR"),g=Symbol("STYLER"),E=Symbol("IS_EMPTY"),ee=["ansi","ansi","ansi256","ansi16m"],d=Object.create(null),he=(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=Q?Q.level:0;e.level=o.level===void 0?t:o.level};var be=e=>{let o=(...t)=>t.join(" ");return he(o,e),Object.setPrototypeOf(o,x.prototype),o};function x(e){return be(e)}Object.setPrototypeOf(x.prototype,Function.prototype);for(let[e,o]of Object.entries(f))d[e]={get(){let t=v(this,U(o.open,o.close,this[g]),this[E]);return Object.defineProperty(this,e,{value:t}),t}};d.visible={get(){let e=v(this,this[g],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var I=(e,o,t,...r)=>e==="rgb"?o==="ansi16m"?f[t].ansi16m(...r):o==="ansi256"?f[t].ansi256(f.rgbToAnsi256(...r)):f[t].ansi(f.rgbToAnsi(...r)):e==="hex"?I("rgb",o,t,...f.hexToRgb(...r)):f[t][e](...r),Ee=["rgb","hex","ansi256"];for(let e of Ee){d[e]={get(){let{level:t}=this;return function(...r){let n=U(I(e,ee[t],"color",...r),f.color.close,this[g]);return v(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=U(I(e,ee[t],"bgColor",...r),f.bgColor.close,this[g]);return v(this,n,this[E])}}}}var xe=Object.defineProperties(()=>{},{...d,level:{enumerable:!0,get(){return this[w].level},set(e){this[w].level=e}}}),U=(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}},v=(e,o,t)=>{let r=(...n)=>Oe(r,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(r,xe),r[w]=e,r[g]=o,r[E]=t,r},Oe=(e,o)=>{if(e.level<=0||!o)return e[E]?"":o;let t=e[g];if(t===void 0)return o;let{openAll:r,closeAll:n}=t;if(o.includes("\x1B"))for(;t!==void 0;)o=X(o,t.close,t.open),t=t.parent;let s=o.indexOf(`
8
- `);return s!==-1&&(o=q(o,n,r,s)),r+o+n};Object.defineProperties(x.prototype,d);var Re=x(),We=x({level:Z?Z.level:0});var j=Re;var m=new Te({stdout:process.stdout,stderr:process.stderr,groupIndentation:4}),h=e=>{if(C){let{name:o}=e;return{log(...t){let r=j.bgBlue.white(` [${o}] `);m.log(`${r}`,`
6
+ `)+r,n=t+1,t=e.indexOf(`
7
+ `,n)}while(t!==-1);return s+=e.slice(n),s}var{stdout:J,stderr:z}=Y,F=Symbol("GENERATOR"),p=Symbol("STYLER"),b=Symbol("IS_EMPTY"),q=["ansi","ansi","ansi256","ansi16m"],d=Object.create(null),ce=(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 r=J?J.level:0;e.level=o.level===void 0?r:o.level};var ae=e=>{let o=(...r)=>r.join(" ");return ce(o,e),Object.setPrototypeOf(o,E.prototype),o};function E(e){return ae(e)}Object.setPrototypeOf(E.prototype,Function.prototype);for(let[e,o]of Object.entries(f))d[e]={get(){let r=N(this,w(o.open,o.close,this[p]),this[b]);return Object.defineProperty(this,e,{value:r}),r}};d.visible={get(){let e=N(this,this[p],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var S=(e,o,r,...t)=>e==="rgb"?o==="ansi16m"?f[r].ansi16m(...t):o==="ansi256"?f[r].ansi256(f.rgbToAnsi256(...t)):f[r].ansi(f.rgbToAnsi(...t)):e==="hex"?S("rgb",o,r,...f.hexToRgb(...t)):f[r][e](...t),fe=["rgb","hex","ansi256"];for(let e of fe){d[e]={get(){let{level:r}=this;return function(...t){let n=w(S(e,q[r],"color",...t),f.color.close,this[p]);return N(this,n,this[b])}}};let o="bg"+e[0].toUpperCase()+e.slice(1);d[o]={get(){let{level:r}=this;return function(...t){let n=w(S(e,q[r],"bgColor",...t),f.bgColor.close,this[p]);return N(this,n,this[b])}}}}var me=Object.defineProperties(()=>{},{...d,level:{enumerable:!0,get(){return this[F].level},set(e){this[F].level=e}}}),w=(e,o,r)=>{let t,n;return r===void 0?(t=e,n=o):(t=r.openAll+e,n=o+r.closeAll),{open:e,close:o,openAll:t,closeAll:n,parent:r}},N=(e,o,r)=>{let t=(...n)=>ge(t,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(t,me),t[F]=e,t[p]=o,t[b]=r,t},ge=(e,o)=>{if(e.level<=0||!o)return e[b]?"":o;let r=e[p];if(r===void 0)return o;let{openAll:t,closeAll:n}=r;if(o.includes("\x1B"))for(;r!==void 0;)o=W(o,r.close,r.open),r=r.parent;let s=o.indexOf(`
8
+ `);return s!==-1&&(o=K(o,n,t,s)),t+o+n};Object.defineProperties(E.prototype,d);var pe=E(),je=E({level:z?z.level:0});var I=pe;var m=new de({stdout:process.stdout,stderr:process.stderr,groupIndentation:4}),h=e=>{if(C){let{name:o}=e;return{log(...r){let t=I.bgBlue.white(` [${o}] `);m.log(`${t}`,`
9
9
 
10
- `,...t),m.log()},group(){m.log();let t=j.bgBlue.white(` [${o}] `);m.group(t),m.log()},groupEnd(){m.log(`
10
+ `,...r),m.log()},group(){m.log();let r=I.bgBlue.white(` [${o}] `);m.group(r),m.log()},groupEnd(){m.log(`
11
11
  `,"-".repeat(20),`
12
- `),m.groupEnd()}}}else return{log(){},group(){},groupEnd(){}}};import{existsSync as Ce}from"fs";import{fileURLToPath as Ne}from"url";var oe=/\.[mc]?tsx?(?=\?|$)/,te=/\.([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"}},re=Object.keys(O);var _=e=>{let o=Ne(e);if(Ce(o))return e},ne=e=>{for(let o of e)if(_(o))return o},k=e=>{let o=re.filter(t=>t.includes("ts")).concat([".js"]);return ne(o.map(t=>e+t))},ve=e=>{let o=re.filter(t=>t.includes("js")).concat([".js"]);return ne(o.map(t=>e+t))},D=e=>{let o=ve(e);if(o)return o;let t=k(e);if(t)return t};var we=async(e,o,t)=>{let{parentURL:r}=o,n=h(we);if(n.log("Resolving specifier:",{importedFromURL:r,specifier:e}),!e.startsWith(".")&&!se(e))return n.log("Using defaultResolve for named module:",{specifier:e}),t(e,o,t);let{href:s}=ie(process.cwd()),{href:i}=new P(r||s);n.log("Finding import URL for",{specifier:e,baseURL:i});let u=e;e.startsWith("file://")||(se(e)?(n.log("Setting import URL to absolute specifier."),u=ie(Me(Le(e))).href):(n.log("Setting import URL relative to baseURL."),u=new P(e,i).href),n.log("Resolved import URL:",{importedFileURL:u,importedFromURL:r}));let y=R(r??"").toLowerCase(),T=R(u).toLowerCase();if(n.log("Rewriting file extension:",{parentExtension:y,specifierExtension:T}),T){let p=u.substring(0,u.lastIndexOf(T));if(n.log("Re-resolving specifier:",{unresolvedSpecifier:p}),te.test(T)&&oe.test(y)){let A=k(p);if(A)return n.log("Found JS import in TS:",{unresolvedSpecifier:p,resolvedTsSourceFile:A}),{url:A,shortCircuit:!0}}return _(p)?(n.log("Found file at unresolved specifier:",{unresolvedSpecifier:p}),{url:p,shortCircuit:!0}):t(e,o,t)}n.log("Resolving incomplete URL import to file:",{specifier:e});let L=D(u);if(L)return n.log("Resolved import URL to file:",{resolvedFile:L}),{url:L,shortCircuit:!0};let ce=new P(ye(u,"index")).href,M=D(ce);return M?(n.log("Resolved import URL to index file:",{resolvedIndexFile:M}),{url:M,shortCircuit:!0}):t(e,o,t)},Ie=async(e,o,t)=>{let r=h(Ie);if(r.log("Loading source file:",{url:e}),!e.includes(Se.sep)&&!e.includes(Ae.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=Be(e),u=await Fe(i,"utf8");return{format:"module",source:(await le(u.toString(),{...s,sourcefile:i,format:"esm"})).code,shortCircuit:!0}},Ue=async(e,o,t)=>{let r=h(Ue);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))},je=async(e,o,t)=>{let r=h(je);r.log("Transforming source from context:",{context:o});let{url:n}=o,s=R(n),i=O[s];return i?{source:(await le(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{Ue as getFormat,Ie as load,we as resolve,je as transformSource};
12
+ `),m.groupEnd()}}}else return{log(){},group(){},groupEnd(){}}};import{checkExtensions as Z,checkTsExtensions as Ne,fileExists as xe,isJs as ve,isTs as ye,MODULE_LOADERS as _}from"../utils/resolve.js";var Le=async(e,o,r)=>{let{parentURL:t}=o,n=h(Le);if(n.log("Resolving specifier:",{importedFromURL:t,specifier:e}),!e.startsWith(".")&&!Q(e))return n.log("Using defaultResolve for named module:",{specifier:e}),r(e,o,r);let{href:s}=X(process.cwd()),{href:l}=new U(t||s);n.log("Finding import URL for",{specifier:e,baseURL:l});let c=e;e.startsWith("file://")||(Q(e)?(n.log("Setting import URL to absolute specifier."),c=X(Ee(be(e))).href):(n.log("Setting import URL relative to baseURL."),c=new U(e,l).href),n.log("Resolved import URL:",{importedFileURL:c,importedFromURL:t}));let x=O(t??"").toLowerCase(),R=O(c).toLowerCase();if(n.log("Rewriting file extension:",{parentExtension:x,specifierExtension:R}),R){let g=c.substring(0,c.lastIndexOf(R));if(n.log("Re-resolving specifier:",{unresolvedSpecifier:g}),ve.test(R)&&ye.test(x)){let L=Ne(g);if(L)return n.log("Found JS import in TS:",{unresolvedSpecifier:g,resolvedTsSourceFile:L}),{url:L,shortCircuit:!0}}return xe(g)?(n.log("Found file at unresolved specifier:",{unresolvedSpecifier:g}),{url:g,shortCircuit:!0}):r(e,o,r)}n.log("Resolving incomplete URL import to file:",{specifier:e});let v=Z(c);if(v)return n.log("Resolved import URL to file:",{resolvedFile:v}),{url:v,shortCircuit:!0};let oe=new U(he(c,"index")).href,y=Z(oe);return y?(n.log("Resolved import URL to index file:",{resolvedIndexFile:y}),{url:y,shortCircuit:!0}):r(e,o,r)},Ae=async(e,o,r)=>{let t=h(Ae);if(t.log("Loading source file:",{url:e}),!e.includes(Re.sep)&&!e.includes(Oe.sep))return t.log("Using defaultLoad for named module:",{url:e}),r(e,o,r);let n=O(e),s=_[n];if(!s)return t.log("No loader found, using defaultLoad:",{url:e}),r(e,o,r);let l=Ce(e),c=await Te(l,"utf8");return{format:"module",source:(await ee(c.toString(),{...s,sourcefile:l,format:"esm"})).code,shortCircuit:!0}},Me=async(e,o,r)=>{let t=h(Me);t.log("Getting format for source file:",{url:e});let n=O(e);return _[n]?{format:"module"}:(t.log("No loader found, using default format:",{url:e}),r(e,o,r))},Be=async(e,o,r)=>{let t=h(Be);t.log("Transforming source from context:",{context:o});let{url:n}=o,s=O(n),l=_[s];return l?{source:(await ee(e.toString(),{...l,logLevel:"info",charset:"utf8",target:"esnext",sourcefile:o.url,format:o.format==="module"?"esm":"cjs"})).code}:(t.log("No loader found, using default transformer:",{url:n}),r(e,o,r))};export{Me as getFormat,Ae as load,Le as resolve,Be as transformSource};
@@ -0,0 +1,2 @@
1
+ import { Plugin } from "esbuild";
2
+ export declare const relativeExternsPlugin: Plugin;
@@ -0,0 +1,4 @@
1
+
2
+ if(typeof process<"u"){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 t={name:"relative-externs",setup(e){e.onResolve({filter:/^\.\.?\//},({path:n,importer:r})=>r.includes("node_modules")?null:{path:n,external:!0})}};export{t as relativeExternsPlugin};
@@ -1,4 +1,4 @@
1
1
 
2
2
  if(typeof process<"u"){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 t={"./package.json":"./package.json",".":"./dist/index.js","./*":"./dist/*/index.js"},e={packageJson:{type:"module",platform:"node",engines:{node:">=14"},types:"dist/index.d.ts",files:["dist"],exports:t,scripts:{dev:"tsmodule dev",build:"tsmodule build",test:"ava",pretest:"tsmodule build",prepublishOnly:"yarn test",lint:"eslint src --fix"}},files:["tsconfig.json",".eslintrc",".gitignore","tsconfig.export.json","LICENSE","ava.config.mjs"],dependencies:[],devDependencies:["@types/node","@tsmodule/tsmodule","@typescript-eslint/eslint-plugin","@typescript-eslint/parser","ava","eslint","typescript"]},s={default:e,react:{packageJson:{platform:"browser",style:"dist/bundle.css",exports:{...t,"./*":"./dist/components/*/index.js","./styles":"./dist/bundle.css","./styles/*":"./dist/components/*/index.css"},scripts:{export:"tsmodule build",dev:"next dev",build:"next build",start:"next start",lint:"next lint --fix",pretest:"tsmodule build --runtime-only",test:"ava",prepublishOnly:"yarn export && yarn test"}},files:["next-env.d.ts","next.config.js","postcss.config.js","tailwind.config.js"],dependencies:["react@^18.2.0","react-dom@^18.2.0"],devDependencies:[...e.devDependencies,"@types/react@^18.0.23","@types/react-dom@^18.0.7","eslint-config-next","@tsmodule/react","next","tailwindcss","autoprefixer","cssnano","postcss","postcss-import"]}};export{s as specification};
4
+ export*from"./types.js";var t={"./package.json":"./package.json",".":"./dist/index.js","./*":"./dist/*/index.js"},e={packageJson:{type:"module",platform:"node",engines:{node:">=14"},types:"dist/index.d.ts",files:["dist"],exports:t,scripts:{dev:"tsmodule dev",build:"tsmodule build",test:"ava",pretest:"tsmodule build",prepublishOnly:"yarn test",lint:"eslint src --fix"}},files:["tsconfig.json",".eslintrc",".gitignore","tsconfig.export.json","LICENSE","ava.config.mjs"],dependencies:[],devDependencies:["@types/node","@tsmodule/tsmodule","@typescript-eslint/eslint-plugin","@typescript-eslint/parser","ava","eslint","typescript"]},s={default:e,react:{packageJson:{platform:"browser",style:"dist/bundle.css",exports:{...t,"./*":"./dist/components/*/index.js","./styles":"./dist/bundle.css","./styles/*":"./dist/components/*/index.css"},scripts:{export:"tsmodule build",dev:"next dev",build:"next build",start:"next start",lint:"next lint --fix",pretest:"tsmodule build --runtime-only",test:"ava",prepublishOnly:"yarn export && yarn test"}},files:["next-env.d.ts","next.config.js","postcss.config.js","tailwind.config.js"],dependencies:["react@^18.2.0","react-dom@^18.2.0"],devDependencies:[...e.devDependencies,"@types/react@^18.0.23","@types/react-dom@^18.0.7","eslint-config-next","@tsmodule/react","next","tailwindcss","autoprefixer","cssnano","postcss","postcss-import"]}};export{s as specification};