3 lines
22 KiB
JavaScript
3 lines
22 KiB
JavaScript
"use strict";var Ie=Object.defineProperty;var l=(e,r)=>Ie(e,"name",{value:r,configurable:!0});var je=require("node:crypto"),w=require("node:module"),We=require("node:worker_threads"),R=require("./node-features-CEjg7cMX.cjs"),o=require("./register-C557imBs.cjs"),h=require("node:url"),te=require("node:fs"),be=require("node:fs/promises"),y=require("./index-6kqi0x0U.cjs"),re=require("./client-D3mGB526.cjs"),S=require("node:path"),F=typeof document<"u"?document.currentScript:null;const Me=l(()=>({active:!0,parsedTsconfig:void 0}),"createDefaultData"),se=l(e=>{const r={active:!0,namespace:e?.namespace,onImport:e?.onImport,parsedTsconfig:void 0,port:e?.port,tsconfig:e?.tsconfig};return e?.tsconfig!==!1&&(r.parsedTsconfig=o.loadTsconfig(e?.tsconfig??process.env.TSX_TSCONFIG_PATH)),r},"createData"),Oe=l(e=>async r=>{if(!r)throw new Error(`tsx must be loaded with --import instead of --loader
|
|
The --loader flag was deprecated in Node v20.6.0 and v18.19.0`);Object.assign(e,se(r)),r.port&&r.port.on("message",t=>{t==="deactivate"&&(e.active=!1,r.port.postMessage({type:"deactivated"}))})},"createInitialize"),$e=l(e=>()=>(e.parsedTsconfig=o.loadTsconfig(process.env.TSX_TSCONFIG_PATH),"process.setSourceMapsEnabled(true);"),"createGlobalPreload"),Ce=l(e=>{const{pathname:r}=new URL(e),t=S.extname(r);if(t===".mts"||t===".mjs")return"module";if(t===".cts"||t===".cjs")return"commonjs";if(t===".js"||o.tsExtensions.includes(t))return o.getPackageType(e)},"getFormatFromFileUrl"),Je=l(e=>{const{pathname:r}=new URL(e),t=S.extname(r);if(t===".mts"||t===".mjs")return"module";if(t===".cts"||t===".cjs")return"commonjs";if(t===".js"||o.tsExtensions.includes(t))return o.getPackageTypeSync(e)},"getFormatFromFileUrlSync"),ne="tsx-namespace",E=`${ne}=`,I="tsx-commonjs-export-preparse",_e=`${I}=1`,j="tsx-commonjs-virtual-query",W=new Map,Ne=/^data:/i,T=l(e=>Ne.test(e),"isDataUrl"),H=l((e,r)=>e.slice(1).split("&").filter(t=>t&&r.every(s=>!t.startsWith(s))).join("&"),"getQueryWithoutParameters"),_=l((e,r)=>{const t=H(e,r);return t?`?${t}`:""},"getSearchWithoutParameters"),qe=l(e=>e.replaceAll(/\/\*[\s\S]*?\*\/|\/\/[^\n\r]*/g,""),"stripComments"),Ae=l(e=>{const r=qe(e);if(/^\s*export\s*\*/.test(r))return"named";if(/^\s*import\s*\*\s*as\s+[\w$]+/.test(r))return"namespace";const t=r.match(/\{([^}]*)\}/)?.[1];if(t)return t.split(",").some(s=>{const n=s.trim().split(/\s+as\s+/)[0];return!!(n&&n!=="default")})?"named":void 0},"getCommonJsImportBinding"),xe=l((e,r,t)=>{const s=W.get(e);if(!s)return!1;try{const[n]=y.parseEsm(s);return n.some(a=>{if(a.d!==-1||a.n!==r)return!1;const i=Ae(s.slice(a.ss,a.s));return i==="named"||t&&i==="namespace"})}catch{return!1}},"parentImportsCommonJsExports"),v=l(e=>{const r=e.indexOf("?"),t=e.indexOf("#");if(T(e)){if(t===-1)return;const s=e.slice(t+1),n=s.lastIndexOf("&"),a=s.slice(n+1);return a.startsWith(E)?a.slice(E.length):void 0}if(!(r===-1||t!==-1&&t<r))return new URLSearchParams(e.slice(r,t===-1?void 0:t)).get(ne)??void 0},"getNamespace"),oe=R.isFeatureSupported(R.importAttributes)?"importAttributes":"importAssertions",ae=l(e=>e==="commonjs"||e==="commonjs-typescript","isCommonJsFormat"),ie=l(e=>e==="module-typescript"||e==="typescript","isModuleTypeScriptFormat"),Be=R.isFeatureSupported(R.esmLoadReadFile),Qe=[`${j}=`],N=[`${I}=`,`${j}=`],L=l((e,r)=>r.parsedTsconfig&&o.je(r.parsedTsconfig,e)?r.parsedTsconfig.config:void 0,"getTsconfigRaw"),De=l(e=>{if(!e.searchParams.has(j))return;const{pathname:r}=e,t=r.toLowerCase().lastIndexOf("%3f");if(t===-1)return;const s=new URL(e);return s.pathname=r.slice(0,t),s.search="",h.fileURLToPath(s)},"getFilePathFromVirtualQuery"),G=l(e=>{const r=e.startsWith(o.fileUrlPrefix)?new URL(e):void 0,t=r?h.fileURLToPath(r):e,s=r&&De(r),n=s||t,a=r&&s?h.pathToFileURL(n).toString()+_(r.search,Qe):e;return{fileUrl:r,filePath:n,loadUrl:a}},"getFileLoadContext"),ce=l((e,r)=>{if(!r?.search)return e;const t=_(r.search,N);return t?h.pathToFileURL(e).toString()+t:e},"getTransformPath"),le=l((e,r,t)=>{const s=[...r?H(r.search,[E,...N]).split("&").filter(Boolean):[],...t?[`namespace=${encodeURIComponent(t)}`]:[]].join("&");return s?`${e}?${s}`:e},"getFilePathWithQuery"),He=new TextDecoder,me=l(e=>typeof e=="string"?e:He.decode(e),"decodeSource"),Ge=l((e,r)=>{const t=new URL(r),s=r.startsWith(o.fileUrlPrefix)?G(r).filePath:void 0;if(T(r)){if(e.namespace){const a=`${E}${e.namespace}`;t.hash===`#${a}`?t.hash="":t.hash.endsWith(`&${a}`)&&(t.hash=t.hash.slice(0,-a.length-1))}}else t.searchParams.delete("tsx-namespace"),t.searchParams.delete(I),t.searchParams.delete(j);s&&(t.pathname=new URL(h.pathToFileURL(s)).pathname);const n=t.toString();return e.port&&e.port.postMessage({type:"load",url:n}),e.onImport?.(n),n},"notifyLoad"),de=l((e,r)=>{if(!e.active)return!1;const t=v(r);if(e.namespace!==t)return!1;const s=Ge(e,r);return re.parent.send&&re.parent.send({type:"dependency",path:s}),!0},"prepareLoad"),ue=l((e,r)=>{if(!o.isJsonPattern.test(e))return r;const t=r[oe];return t?.type?r:{...r,[oe]:{...t,type:"json"}}},"prepareJsonAttributes"),z=l(({conditions:e})=>e?.includes("require")===!0&&!e.includes("import"),"isCommonJsRequireContext$1"),ze=l(e=>{const r=l(async(t,s,n)=>{if(!de(e,t))return n(t,s);const a=v(t),{fileUrl:i,filePath:c,loadUrl:u}=G(t),f=ue(u,s),m=await n(u,f);o.logEsm(3,"loaded by next loader",{url:t,loadUrl:u,loaded:m});const d=i?.searchParams.has(I)===!0,p=m.format,g=i?new URL(h.pathToFileURL(c)):void 0;if(g&&i&&(g.search=_(i.search,N)),ae(p)&&i&&m.responseURL?.startsWith("file:")&&!c.endsWith(".cjs")){const P=await be.readFile(h.pathToFileURL(c),"utf8"),C=y.isESM(P);if(p==="commonjs-typescript"||!c.endsWith(".js")||C){if(!Be){if(d&&C&&o.implicitTsExtensionsPattern.test(c)){const J=await y.transform(P,c,{define:{"import.meta.url":JSON.stringify(g.toString())},tsconfigRaw:L(c,e)});return W.set(t,J.code),{format:"module",source:o.inlineSourceMap(J)}}return m}if(!a&&!d&&!c.endsWith(".cts"))return m;const Z=!!(a||d||_(i.search,N)),ee=y.transformSync(P,ce(c,i),{cjsBanner:Z?`require = require("node:module").createRequire(${JSON.stringify(h.pathToFileURL(c).toString())});`:void 0,tsconfigRaw:L(c,e)});if(m.format="commonjs",m.source=o.inlineSourceMap(ee),Z){const J=le(c,i,a);m.responseURL=`data:text/javascript,${encodeURIComponent(ee.code)}?filePath=${encodeURIComponent(J)}`}return o.logEsm(3,"returning CJS export annotation",m),m}}if(!m.source)return m;const U=me(m.source),$=p==="json"&&!z(s);if(p==="commonjs-typescript"){const P=y.transformSync(U,c,{tsconfigRaw:L(c,e)});return{...m,format:"commonjs",source:o.inlineSourceMap(P)}}if($||ie(p)||o.tsExtensionsPattern.test(t)){const P=await y.transform(U,c,{tsconfigRaw:L(c,e)});return W.set(t,P.code),{format:"module",source:o.inlineSourceMap(P)}}if(m.format==="module"){const P=y.transformDynamicImport(c,U);P?(m.source=o.inlineSourceMap(P),W.set(t,P.code)):W.set(t,U)}return m},"load");return o.debugEnabled?async(t,s,n)=>{o.logEsm(2,"load",{url:t,context:s});const a=await r(t,s,n);return o.logEsm(1,"loaded",{url:t,result:a}),a}:r},"createLoad"),Xe=l(e=>{const r=l((t,s,n)=>{if(z(s)&&o.isGlobalCjsLoaderActive()||!de(e,t))return n(t,s);const a=v(t),{fileUrl:i,filePath:c,loadUrl:u}=G(t),f=ue(u,s),m=n(u,f);o.logEsm(3,"loaded by next loader",{url:t,loadUrl:u,loaded:m});const d=m.format;if(ae(d)&&R.isFeatureSupported(R.esmLoadReadFile)&&m.responseURL?.startsWith("file:")&&!c.endsWith(".cjs")){const U=te.readFileSync(h.pathToFileURL(c),"utf8");if(d==="commonjs-typescript"||!c.endsWith(".js")||y.isESM(U)){const $=y.transformSync(U,ce(c,i),{tsconfigRaw:L(c,e)}),P=!a&&o.isGlobalCjsLoaderActive(),C=le(c,i,a);return m.format="commonjs",m.shouldBeReloadedByCJSLoader=P,m.source=o.inlineSourceMap($),P||(m.responseURL=`data:text/javascript,${encodeURIComponent($.code)}?filePath=${encodeURIComponent(C)}`),o.logEsm(3,"returning CJS export annotation",m),m}}if(!m.source)return m;const p=me(m.source),g=d==="json"&&!z(s);if(d==="commonjs-typescript"){const U=y.transformSync(p,c,{tsconfigRaw:L(c,e)});return{...m,format:"commonjs",shouldBeReloadedByCJSLoader:!1,source:o.inlineSourceMap(U)}}if(g||ie(d)||o.tsExtensionsPattern.test(t)){const U=y.transformEsmSync(p,c,{tsconfigRaw:L(c,e)});return{format:"module",source:o.inlineSourceMap(U)}}if(m.format==="module"){const U=y.transformDynamicImport(c,p);U&&(m.source=o.inlineSourceMap(U))}return m},"load");return o.debugEnabled?(t,s,n)=>{o.logEsm(2,"loadSync",{url:t,context:s});const a=r(t,s,n);return o.logEsm(1,"loadedSync",{url:t,result:a}),a}:r},"createLoadSync"),ke=l(e=>{if(o.isFilePath(e)||e.startsWith("#")||e.includes(":"))return!1;const r=e.split("/"),t=r[0]?.startsWith("@")?2:1;return r.length>t&&r.slice(0,t).every(Boolean)},"isBarePackageSubpath"),Ve=l(e=>{const r=e.lastIndexOf(o.nodeModulesPath);if(r===-1)return;const s=e.slice(r+o.nodeModulesPath.length).split(S.sep),n=s[0]?.startsWith("@")?2:1;if(!(s.length<=n||!s[n-1]))return S.join(e.slice(0,r),"node_modules",...s.slice(0,n))},"getPackageDirectory"),fe=l((e,r)=>{if(!ke(e)||!r.startsWith(o.fileUrlPrefix))return;const t=h.fileURLToPath(r),s=Ve(t);if(!s)return;const a=y.readJsonFile(S.join(s,"package.json"))?.exports;if(a!=null)return{kind:"root-exports"};const i=y.readJsonFile(S.join(t,"package.json"));return typeof i?.main!="string"||!i.main?{kind:"legacy-directory"}:{kind:"legacy-directory",mainUrl:h.pathToFileURL(S.resolve(t,i.main)).toString()}},"getPackageSubpathDirectoryInfo"),Ke=R.isFeatureSupported(R.esmLoadReadFile),pe=/^(?:[a-z][\d+.a-z-]*:\/\/|data:|file:|node:)/i,he=l(e=>!o.isFilePath(e)&&!pe.test(e),"isTsconfigPathAliasSpecifier"),q=l(e=>{if(e.url)return e.url;const r=e.message.match(/^Cannot find module '([^']+)'/);if(r){const[,s]=r;return s}const t=e.message.match(/^Cannot find package '([^']+)'/);if(t){const[,s]=t;if(!S.isAbsolute(s))return;const n=h.pathToFileURL(s);if(n.pathname.endsWith("/")&&(n.pathname+="package.json"),n.pathname.endsWith("/package.json")){const a=y.readJsonFile(n);if(a?.main)return new URL(a.main,n).toString()}else return n.toString()}},"getMissingPathFromNotFound"),b=l(e=>e==="ERR_MODULE_NOT_FOUND"||e==="MODULE_NOT_FOUND","isModuleNotFound"),A=l(e=>e instanceof Error&&(b(e.code)||e.code==="ERR_UNSUPPORTED_DIR_IMPORT"),"isDirectoryEntryMiss"),x=l(e=>e.conditions.includes("require")&&!e.conditions.includes("import"),"isCommonJsRequireContext"),X=l(e=>{const r=e.indexOf("?"),t=e.indexOf("#");return r===-1?t:t===-1?r:Math.min(r,t)},"getUrlMetadataIndex"),ge=l((e,r)=>r||!o.isFilePath(e)&&!pe.test(e)?e.indexOf("?"):X(e),"getSpecifierMetadataIndex"),Pe=l(e=>{if(e?.startsWith(o.fileUrlPrefix))return h.fileURLToPath(new URL(e))},"getParentFilePath"),Ye=l(e=>{if(!e)return!1;const r=Pe(e);if(r)return o.tsExtensionsPattern.test(r);const t=X(e);return o.tsExtensionsPattern.test(t===-1?e:e.slice(0,t))},"isTypeScriptParent"),M=l(e=>{const r=Pe(e);return r!==void 0&&o.isDependencyPath(r)},"isParentDependency"),ye=l(e=>S.extname(new URL(e).pathname)===".js"&&o.isDependencyPath(h.fileURLToPath(e)),"isImplicitJavaScriptDependency"),Ue=l((e,r)=>Ye(e)||r&&!M(e),"resolvesTsExtensions"),Ze=l((e,r)=>{const t=X(e),s=t===-1?e:e.slice(0,t);try{if(s.startsWith(o.fileUrlPrefix))return h.fileURLToPath(s);if(S.isAbsolute(s))return s;if(o.isRelativePath(s)&&r?.startsWith(o.fileUrlPrefix))return h.fileURLToPath(new URL(s,r))}catch{}},"getProbeFilePath"),Se=l((e,r)=>{const t=Ze(e,r);return t!==void 0&&!te.existsSync(t)},"candidateDoesntExist"),B=l(async(e,r,t,s)=>{const n=o.getExtensionResolution(e);if(o.logEsm(3,"resolveExtensions",{url:e,context:r,throwError:s,tryPaths:n}),!n)return;let a;for(const i of n)if(!Se(i,r.parentURL))try{return await t(i,r)}catch(c){const{code:u}=c;if(!b(u)&&u!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw c;a=c}if(s){if(a===void 0)return t(n[0],r);throw a}},"resolveExtensions"),O=l((e,r,t,s)=>{const n=o.getExtensionResolution(e);if(o.logEsm(3,"resolveExtensionsSync",{url:e,context:r,throwError:s,tryPaths:n}),!n)return;let a;for(const i of n)if(!Se(i,r.parentURL))try{return t(i,r)}catch(c){const{code:u}=c;if(!b(u)&&u!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw c;a=c}if(s){if(a===void 0)return t(n[0],r);throw a}},"resolveExtensionsSync"),et=l(async(e,r,t,s)=>{const n=s.parsedTsconfig?.config.compilerOptions?.allowJs??!1,a=Ue(r.parentURL,n);if(o.logEsm(3,"resolveBase",{specifier:e,context:r,specifierStartsWithFileUrl:e.startsWith(o.fileUrlPrefix),isRelativePath:o.isRelativePath(e),resolveTsExtensions:a,allowJs:n}),(e.startsWith(o.fileUrlPrefix)||o.isRelativePath(e))&&a){const i=await B(e,r,t,void 0);if(o.logEsm(3,"resolveBase resolved",{specifier:e,context:r,resolved:i}),i)return i}try{return await t(e,r)}catch(i){if(o.logEsm(3,"resolveBase error",{specifier:e,context:r,error:i}),i instanceof Error){const c=i;if(b(c.code)){const u=q(c);if(u){const f=await B(u,r,t,void 0);if(f)return f}}}throw i}},"resolveBase"),k=l((e,r,t,s)=>{const n=s.parsedTsconfig?.config.compilerOptions?.allowJs??!1,a=Ue(r.parentURL,n);if(o.logEsm(3,"resolveBaseSync",{specifier:e,context:r,specifierStartsWithFileUrl:e.startsWith(o.fileUrlPrefix),isRelativePath:o.isRelativePath(e),resolveTsExtensions:a,allowJs:n}),(e.startsWith(o.fileUrlPrefix)||o.isRelativePath(e))&&a){const i=O(e,r,t,void 0);if(o.logEsm(3,"resolveBaseSync resolved",{specifier:e,context:r,resolved:i}),i)return i}try{return t(e,r)}catch(i){if(o.logEsm(3,"resolveBaseSync error",{specifier:e,context:r,error:i}),i instanceof Error){const c=i;if(b(c.code)){const u=q(c);if(u){const f=O(u,r,t,void 0);if(f)return f}}}throw i}},"resolveBaseSync"),V=l(async(e,r,t,s)=>{if(o.logEsm(3,"resolveDirectory",{specifier:e,context:r,isDirectory:o.isDirectoryPattern.test(e)}),(e==="."||e===".."||e.endsWith("/.."))&&(e+="/"),o.isDirectoryPattern.test(e)){const n=new URL(e,r.parentURL);return n.pathname=S.join(n.pathname,"index"),await B(n.toString(),r,t,!0)}try{return await et(e,r,t,s)}catch(n){if(n instanceof Error){o.logEsm(3,"resolveDirectory error",{specifier:e,context:r,error:n});const a=n;if(a.code==="ERR_UNSUPPORTED_DIR_IMPORT"){const i=q(a);if(i){if(e.startsWith("#"))throw n;const c=fe(e,i);if(c?.kind==="root-exports")throw n;if(c?.mainUrl){try{return await t(c.mainUrl,r)}catch(m){if(!A(m))throw m}try{return await V(c.mainUrl,r,t,s)}catch(m){if(!A(m))throw m}}const u=`${i}/index`,f=await B(u,r,t);if(f)return f}}}throw n}},"resolveDirectory"),K=l((e,r,t,s)=>{if(o.logEsm(3,"resolveDirectorySync",{specifier:e,context:r,isDirectory:o.isDirectoryPattern.test(e)}),(e==="."||e===".."||e.endsWith("/.."))&&(e+="/"),o.isDirectoryPattern.test(e)){const n=x(r);if(n&&!o.isFilePath(e))return k(e,r,t,s);const a=new URL(e,r.parentURL);return a.pathname=S.join(a.pathname,"index"),n?O(h.fileURLToPath(a),r,t,!1)??k(e,r,t,s):O(a.toString(),r,t,!0)}try{return k(e,r,t,s)}catch(n){if(n instanceof Error){o.logEsm(3,"resolveDirectorySync error",{specifier:e,context:r,error:n});const a=n;if(a.code==="ERR_UNSUPPORTED_DIR_IMPORT"){const i=q(a);if(i){if(e.startsWith("#"))throw n;const c=fe(e,i);if(c?.kind==="root-exports")throw n;if(c?.mainUrl){try{return t(c.mainUrl,r)}catch(m){if(!A(m))throw m}try{return K(c.mainUrl,r,t,s)}catch(m){if(!A(m))throw m}}const u=`${i}/index`,f=O(u,r,t);if(f)return f}}}throw n}},"resolveDirectorySync"),tt=l(async(e,r,t,s)=>{const n=he(e);if(o.logEsm(3,"resolveTsPaths",{specifier:e,context:r,tsconfigPathAliasSpecifier:n,tsconfig:s.parsedTsconfig,fromNodeModules:M(r.parentURL)}),n&&s.parsedTsconfig&&!M(r.parentURL)){const a=o.wt(s.parsedTsconfig,e);o.logEsm(3,"resolveTsPaths",{possiblePaths:a});for(const i of a)try{return await V(h.pathToFileURL(i).toString(),r,t,s)}catch{}}return V(e,r,t,s)},"resolveTsPaths"),rt=l((e,r,t,s)=>{const n=he(e);if(o.logEsm(3,"resolveTsPathsSync",{specifier:e,context:r,tsconfigPathAliasSpecifier:n,tsconfig:s.parsedTsconfig,fromNodeModules:M(r.parentURL)}),n&&s.parsedTsconfig&&!M(r.parentURL)){const a=o.wt(s.parsedTsconfig,e);o.logEsm(3,"resolveTsPathsSync",{possiblePaths:a});for(const i of a)try{return K(h.pathToFileURL(i).toString(),r,t,s)}catch{}}return K(e,r,t,s)},"resolveTsPathsSync"),Q="tsx://",Y=l((e,r)=>{const t=e.indexOf("#"),s=t===-1?e:e.slice(0,t),n=t===-1?"":e.slice(t);return`${s}${s.includes("?")?"&":"?"}${r}${n}`},"addQuery"),D=l((e,r)=>T(e)?`${e}${e.includes("#")?"&":"#"}${E}${r}`:Y(e,`${E}${r}`),"addNamespace"),Re=l((e,r)=>{const t=r.indexOf("#"),s=r[0]==="?"?r.slice(1,t===-1?void 0:t):"",n=t===-1?"":r.slice(t),a=e.indexOf("#"),i=a===-1?e:e.slice(0,a),c=a===-1?"":e.slice(a),u=s?Y(i,s):i;return new URL(`${u}${n||c}`).toString()},"mergeUrlMetadata"),ve=l((e,r,t)=>{if(r!=="commonjs"||!e.startsWith(o.fileUrlPrefix)||!o.implicitTsExtensionsPattern.test(e))return e;const s=new URL(e),n=[H(s.search,[E]),...t?[`namespace=${encodeURIComponent(t)}`]:[]].filter(Boolean).join("&");return n?(s.pathname+=`%3F${n}`,s.searchParams.set(j,"1"),s.toString()):e},"preserveCommonJsQueryIdentity"),st=l(e=>{const r=l(async(t,s,n)=>{if(!e.active||t.startsWith("node:"))return n(t,s);const a=s.parentURL&&v(s.parentURL);let i=T(t)?a:v(t)??a;if(e.namespace){let g;if(t.startsWith(Q)){try{g=JSON.parse(t.slice(Q.length))}catch{}g?.namespace&&(i=g.namespace)}if(e.namespace!==i)return n(t,s);g&&(t=g.specifier,s.parentURL=g.parentURL)}if(T(t)){const g=await n(t,s);return e.namespace?{...g,url:D(g.url,e.namespace)}:g}const c=ge(t,x(s)),u=c===-1?t:t.slice(0,c),f=c===-1?"":t.slice(c),m=await tt(u,s,n,e);if(o.logEsm(2,"nextResolve",{resolved:m}),m.format==="builtin")return m;const d={...m};d.url.startsWith(o.fileUrlPrefix)&&(d.format==="module-typescript"?d.format="module":d.format==="commonjs-typescript"?d.format="commonjs":!d.format&&!ye(d.url)&&(d.format=await Ce(d.url),o.logEsm(2,"getFormatFromFileUrl",{resolved:d,format:d.format}))),f&&(d.url=Re(d.url,f));const p=s.parentURL&&d.format==="commonjs"&&o.implicitTsExtensionsPattern.test(d.url)&&(new URL(s.parentURL).searchParams.has(I)||xe(s.parentURL,t,Ke));return i&&v(d.url)===void 0&&(d.url=D(d.url,i)),p&&(d.url=Y(d.url,_e)),(i||p)&&(d.url=ve(d.url,d.format,i)),d},"resolve");return o.debugEnabled?async(t,s,n)=>{o.logEsm(2,"resolve",{specifier:t,context:s});const a=await r(t,s,n);return o.logEsm(1,"resolved",{specifier:t,context:s,result:a}),a}:r},"createResolve"),nt=l(e=>{const r=l((t,s,n)=>{if(!e.active||t.startsWith("node:")||x(s)&&o.isGlobalCjsLoaderActive())return n(t,s);const a=s.parentURL&&v(s.parentURL);let i=T(t)?a:v(t)??a;if(e.namespace){let p;if(t.startsWith(Q)){try{p=JSON.parse(t.slice(Q.length))}catch{}p?.namespace&&(i=p.namespace)}if(e.namespace!==i)return n(t,s);p&&(t=p.specifier,s.parentURL=p.parentURL)}if(T(t)){const p=n(t,s);return e.namespace?{...p,url:D(p.url,e.namespace)}:p}const c=ge(t,x(s)),u=c===-1?t:t.slice(0,c),f=c===-1?"":t.slice(c),m=rt(u,s,n,e);if(o.logEsm(2,"nextResolve",{resolved:m}),m.format==="builtin")return m;const d={...m};return d.url.startsWith(o.fileUrlPrefix)&&(d.format==="module-typescript"?d.format="module":d.format==="commonjs-typescript"?d.format="commonjs":!d.format&&!ye(d.url)&&(d.format=Je(d.url),o.logEsm(2,"getFormatFromFileUrlSync",{resolved:d,format:d.format}))),f&&(d.url=Re(d.url,f)),i&&v(d.url)===void 0&&(d.url=D(d.url,i)),d.url=ve(d.url,d.format,i),d},"resolve");return o.debugEnabled?(t,s,n)=>{o.logEsm(2,"resolveSync",{specifier:t,context:s});const a=r(t,s,n);return o.logEsm(1,"resolvedSync",{specifier:t,context:s,result:a}),a}:r},"createResolveSync"),Ee=l(e=>(r,t)=>{if(!t)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");const s=t.startsWith(o.fileUrlPrefix)?t:h.pathToFileURL(t).toString();return import(`tsx://${JSON.stringify({specifier:r,parentURL:s,namespace:e})}`)},"createScopedImport");let Te=!1;const ot=l(e=>{const r=[];for(let t=0;t<e.length;t+=1){const s=e[t];if(s==="--import"){const n=e[t+1];n&&r.push(n),t+=1}else s.startsWith("--import=")&&r.push(s.slice(9))}return r},"collectImportSpecifiers"),at=l(()=>[...(process.env.NODE_OPTIONS??"").matchAll(/(?:^|\s)--import(?:=|\s+)(\S+)/g)].map(([,e])=>e),"collectNodeOptionsImportSpecifiers"),Le=[new URL("loader.mjs",typeof document>"u"?require("url").pathToFileURL(__filename).href:F&&F.src||new URL("register-Ciecs-Zx.cjs",document.baseURI).href).toString(),new URL("esm/index.mjs",typeof document>"u"?require("url").pathToFileURL(__filename).href:F&&F.src||new URL("register-Ciecs-Zx.cjs",document.baseURI).href).toString()],it=new Set(["tsx","tsx/esm",...Le,...Le.map(e=>decodeURI(new URL(e).pathname))]),ct=l(e=>it.has(e),"isTsxImport"),we=l(e=>/\.(?:[cm]?ts|tsx)(?:[?#].*)?$/.test(e),"isTypeScriptImport"),lt=l(()=>{const e=ot(process.execArgv),r=e.findIndex(ct);return r>0&&e.slice(0,r).some(we)},"hasCliTypeScriptPreload"),mt=at().some(we)||lt(),Fe=typeof w.registerHooks=="function"&&R.isFeatureSupported(R.moduleRegisterHooksCjsReload)&&!mt,dt=l(e=>{if(!w.register&&!Fe)throw new Error(`This version of Node.js (${process.version}) does not support module.register(). Please upgrade to Node v18.19 or v20.6 and above.`);if(!Te){const{_resolveFilename:c}=w;w._resolveFilename=(u,...f)=>c(o.interopCjsExports(u),...f),Te=!0}const{sourceMapsEnabled:r}=process;if(process.setSourceMapsEnabled(!0),Fe){const c=se({namespace:e?.namespace,onImport:e?.onImport,tsconfig:e?.tsconfig}),u=w.registerHooks({load:Xe(c),resolve:nt(c)}),f=l(async()=>{c.active=!1,u.deregister(),r===!1&&process.setSourceMapsEnabled(!1)},"unregister2");return e?.namespace&&(f.import=Ee(e.namespace),f.unregister=f),f}const{port1:t,port2:s}=new We.MessageChannel;w.register(`./esm/index.mjs?${je.randomUUID()}`,{parentURL:typeof document>"u"?require("url").pathToFileURL(__filename).href:F&&F.src||new URL("register-Ciecs-Zx.cjs",document.baseURI).href,data:{port:s,namespace:e?.namespace,tsconfig:e?.tsconfig},transferList:[s]});const n=e?.onImport,a=n&&(c=>{c.type==="load"&&n(c.url)});a&&(t.on("message",a),t.unref());const i=l(()=>(r===!1&&process.setSourceMapsEnabled(!1),a&&t.off("message",a),t.postMessage("deactivate"),new Promise(c=>{const u=l(f=>{f.type==="deactivated"&&(c(),t.off("message",u))},"onDeactivated");t.on("message",u)})),"unregister");return e?.namespace&&(i.import=Ee(e.namespace),i.unregister=i),i},"register");exports.createDefaultData=Me,exports.createGlobalPreload=$e,exports.createInitialize=Oe,exports.createLoad=ze,exports.createResolve=st,exports.register=dt;
|