Files
2026-11-01 20:14:25 +01:00

3 lines
16 KiB
JavaScript

#!/usr/bin/env node
"use strict";var ce=Object.defineProperty;var i=(e,r)=>ce(e,"name",{value:r,configurable:!0});var _=require("node:crypto"),R=require("node:module"),le=require("node:worker_threads"),n=require("../../register-B1c7OH6V.cjs"),p=require("node:url"),M=require("node:fs");require("node:fs/promises");var N=require("../../client-XItNFmsq.cjs"),P=require("node:path");require("../../require-CVaYn9z3.cjs"),require("fs"),require("os"),require("path"),require("esbuild"),require("node:os"),require("node:util"),require("node:net");var S=typeof document<"u"?document.currentScript:null;const me=i(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=n.loadTsconfig(e?.tsconfig??process.env.TSX_TSCONFIG_PATH)),r},"createData"),de=i(e=>{const{pathname:r}=new URL(e),t=P.extname(r);if(t===".mts"||t===".mjs")return"module";if(t===".cts"||t===".cjs")return"commonjs";if(t===".js"||n.tsExtensions.includes(t))return n.getPackageTypeSync(e)},"getFormatFromFileUrlSync"),F="tsx-namespace",U=`${F}=`,J="tsx-commonjs-export-preparse",v="tsx-commonjs-virtual-query",ue=/^data:/i,L=i(e=>ue.test(e),"isDataUrl"),E=i((e,r)=>e.slice(1).split("&").filter(t=>t&&r.every(s=>!t.startsWith(s))).join("&"),"getQueryWithoutParameters"),A=i((e,r)=>{const t=E(e,r);return t?`?${t}`:""},"getSearchWithoutParameters"),I=i(e=>{const r=e.indexOf("?"),t=e.indexOf("#");if(L(e)){if(t===-1)return;const s=e.slice(t+1),o=s.lastIndexOf("&"),a=s.slice(o+1);return a.startsWith(U)?a.slice(U.length):void 0}if(!(r===-1||t!==-1&&t<r))return new URLSearchParams(e.slice(r,t===-1?void 0:t)).get(F)??void 0},"getNamespace"),B=n.isFeatureSupported(n.importAttributes)?"importAttributes":"importAssertions",fe=i(e=>e==="commonjs"||e==="commonjs-typescript","isCommonJsFormat"),pe=i(e=>e==="module-typescript"||e==="typescript","isModuleTypeScriptFormat");n.isFeatureSupported(n.esmLoadReadFile);const he=[`${v}=`],k=[`${J}=`,`${v}=`],j=i((e,r)=>r.parsedTsconfig&&n.je(r.parsedTsconfig,e)?r.parsedTsconfig.config:void 0,"getTsconfigRaw"),Q=i((e,r)=>{const t=r?`${e}?namespace=${encodeURIComponent(r)}`:p.pathToFileURL(e).toString();return`require = require("node:module").createRequire(${JSON.stringify(t)});`},"getCjsRequireBanner"),ge=i(e=>{if(!e.searchParams.has(v))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="",p.fileURLToPath(s)},"getFilePathFromVirtualQuery"),D=i(e=>{const r=e.startsWith(n.fileUrlPrefix)?new URL(e):void 0,t=r?p.fileURLToPath(r):e,s=r&&ge(r),o=s||t,a=r&&s?p.pathToFileURL(o).toString()+A(r.search,he):e;return{fileUrl:r,filePath:o,loadUrl:a}},"getFileLoadContext"),Pe=i((e,r)=>{if(!r?.search)return e;const t=A(r.search,k);return t?p.pathToFileURL(e).toString()+t:e},"getTransformPath"),ye=i((e,r,t)=>{const s=[...r?E(r.search,[U,...k]).split("&").filter(Boolean):[],...t?[`namespace=${encodeURIComponent(t)}`]:[]].join("&");return s?`${e}?${s}`:e},"getFilePathWithQuery"),Se=new TextDecoder,Ue=i(e=>typeof e=="string"?e:Se.decode(e),"decodeSource"),Re=i((e,r)=>{const t=new URL(r),s=r.startsWith(n.fileUrlPrefix)?D(r).filePath:void 0;if(L(r)){if(e.namespace){const a=`${U}${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(J),t.searchParams.delete(v);s&&(t.pathname=new URL(p.pathToFileURL(s)).pathname);const o=t.toString();return e.port&&e.port.postMessage({type:"load",url:o}),e.onImport?.(o),o},"notifyLoad"),ve=i((e,r)=>{if(!e.active)return!1;const t=I(r);if(e.namespace!==t)return!1;const s=Re(e,r);return N.parent.send&&N.parent.send({type:"dependency",path:s}),!0},"prepareLoad"),Le=i((e,r)=>{if(!n.isJsonPattern.test(e))return r;const t=r[B];return t?.type?r:{...r,[B]:{...t,type:"json"}}},"prepareJsonAttributes"),H=i(({conditions:e})=>e?.includes("require")===!0&&!e.includes("import"),"isCommonJsRequireContext$1"),Ie=i(e=>{const r=i((t,s,o)=>{if(H(s)&&n.isGlobalCjsLoaderActive()||!ve(e,t))return o(t,s);const a=I(t),{fileUrl:l,filePath:c,loadUrl:m}=D(t),f=Le(m,s),d=o(m,f);n.logEsm(3,"loaded by next loader",{url:t,loadUrl:m,loaded:d});const g=d.format;if(fe(g)&&n.isFeatureSupported(n.esmLoadReadFile)&&d.responseURL?.startsWith("file:")&&!c.endsWith(".cjs")){const y=M.readFileSync(p.pathToFileURL(c),"utf8");if(g==="commonjs-typescript"||!c.endsWith(".js")||n.isESM(y)){const b=!a&&n.isGlobalCjsLoaderActive(),O=n.transformSync(y,Pe(c,l),{cjsBanner:a?Q(c,a):void 0,tsconfigRaw:j(c,e)}),ie=ye(c,l,a);return d.format="commonjs",d.shouldBeReloadedByCJSLoader=b,d.source=n.inlineSourceMap(O),b||(d.responseURL=`data:text/javascript,${encodeURIComponent(O.code)}?filePath=${encodeURIComponent(ie)}`),n.logEsm(3,"returning CJS export annotation",d),d}}if(!d.source)return d;const u=Ue(d.source),h=g==="json"&&!H(s);if(g==="commonjs-typescript"){const y=n.transformSync(u,c,{cjsBanner:a?Q(c,a):void 0,tsconfigRaw:j(c,e)});return{...d,format:"commonjs",shouldBeReloadedByCJSLoader:!1,source:n.inlineSourceMap(y)}}if(h||pe(g)||n.tsExtensionsPattern.test(t)){const y=n.transformEsmSync(u,c,{tsconfigRaw:j(c,e)});return{format:"module",source:n.inlineSourceMap(y)}}if(d.format==="module"){const y=n.transformDynamicImport(c,u);y&&(d.source=n.inlineSourceMap(y))}return d},"load");return n.debugEnabled?(t,s,o)=>{n.logEsm(2,"loadSync",{url:t,context:s});const a=r(t,s,o);return n.logEsm(1,"loadedSync",{url:t,result:a}),a}:r},"createLoadSync"),Te=i(e=>{if(n.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"),Fe=i(e=>{const r=e.lastIndexOf(n.nodeModulesPath);if(r===-1)return;const s=e.slice(r+n.nodeModulesPath.length).split(P.sep),o=s[0]?.startsWith("@")?2:1;if(!(s.length<=o||!s[o-1]))return P.join(e.slice(0,r),"node_modules",...s.slice(0,o))},"getPackageDirectory"),Ee=i((e,r)=>{if(!Te(e)||!r.startsWith(n.fileUrlPrefix))return;const t=p.fileURLToPath(r),s=Fe(t);if(!s)return;const a=n.readJsonFile(P.join(s,"package.json"))?.exports;if(a!=null)return{kind:"root-exports"};const l=n.readJsonFile(P.join(t,"package.json"));return typeof l?.main!="string"||!l.main?{kind:"legacy-directory"}:{kind:"legacy-directory",mainUrl:p.pathToFileURL(P.resolve(t,l.main)).toString()}},"getPackageSubpathDirectoryInfo");n.isFeatureSupported(n.esmLoadReadFile);const G=/^(?:[a-z][\d+.a-z-]*:\/\/|data:|file:|node:)/i,je=i(e=>!n.isFilePath(e)&&!G.test(e),"isTsconfigPathAliasSpecifier"),V=i(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(!P.isAbsolute(s))return;const o=p.pathToFileURL(s);if(o.pathname.endsWith("/")&&(o.pathname+="package.json"),o.pathname.endsWith("/package.json")){const a=n.readJsonFile(o);if(a?.main)return new URL(a.main,o).toString()}else return o.toString()}},"getMissingPathFromNotFound"),w=i(e=>e==="ERR_MODULE_NOT_FOUND"||e==="MODULE_NOT_FOUND","isModuleNotFound"),z=i(e=>e instanceof Error&&(w(e.code)||e.code==="ERR_UNSUPPORTED_DIR_IMPORT"),"isDirectoryEntryMiss"),x=i(e=>e.conditions.includes("require")&&!e.conditions.includes("import"),"isCommonJsRequireContext"),C=i(e=>{const r=e.indexOf("?"),t=e.indexOf("#");return r===-1?t:t===-1?r:Math.min(r,t)},"getUrlMetadataIndex"),we=i((e,r)=>r||!n.isFilePath(e)&&!G.test(e)?e.indexOf("?"):C(e),"getSpecifierMetadataIndex"),X=i(e=>{if(e?.startsWith(n.fileUrlPrefix))return p.fileURLToPath(new URL(e))},"getParentFilePath"),xe=i(e=>{if(!e)return!1;const r=X(e);if(r)return n.tsExtensionsPattern.test(r);const t=C(e);return n.tsExtensionsPattern.test(t===-1?e:e.slice(0,t))},"isTypeScriptParent"),q=i(e=>{const r=X(e);return r!==void 0&&n.isDependencyPath(r)},"isParentDependency"),Ce=i(e=>P.extname(new URL(e).pathname)===".js"&&n.isDependencyPath(p.fileURLToPath(e)),"isImplicitJavaScriptDependency"),qe=i((e,r)=>xe(e)||r&&!q(e),"resolvesTsExtensions"),We=i((e,r)=>{const t=C(e),s=t===-1?e:e.slice(0,t);try{if(s.startsWith(n.fileUrlPrefix))return p.fileURLToPath(s);if(P.isAbsolute(s))return s;if(n.isRelativePath(s)&&r?.startsWith(n.fileUrlPrefix))return p.fileURLToPath(new URL(s,r))}catch{}},"getProbeFilePath"),$e=i((e,r)=>{const t=We(e,r);return t!==void 0&&!M.existsSync(t)},"candidateDoesntExist"),T=i((e,r,t,s)=>{const o=n.getExtensionResolution(e);if(n.logEsm(3,"resolveExtensionsSync",{url:e,context:r,throwError:s,tryPaths:o}),!o)return;let a;for(const l of o)if(!$e(l,r.parentURL))try{return t(l,r)}catch(c){const{code:m}=c;if(!w(m)&&m!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw c;a=c}if(s){if(a===void 0)return t(o[0],r);throw a}},"resolveExtensionsSync"),W=i((e,r,t,s)=>{const o=s.parsedTsconfig?.config.compilerOptions?.allowJs??!1,a=qe(r.parentURL,o);if(n.logEsm(3,"resolveBaseSync",{specifier:e,context:r,specifierStartsWithFileUrl:e.startsWith(n.fileUrlPrefix),isRelativePath:n.isRelativePath(e),resolveTsExtensions:a,allowJs:o}),(e.startsWith(n.fileUrlPrefix)||n.isRelativePath(e))&&a){const l=T(e,r,t,void 0);if(n.logEsm(3,"resolveBaseSync resolved",{specifier:e,context:r,resolved:l}),l)return l}try{return t(e,r)}catch(l){if(n.logEsm(3,"resolveBaseSync error",{specifier:e,context:r,error:l}),l instanceof Error){const c=l;if(w(c.code)){const m=V(c);if(m){const f=T(m,r,t,void 0);if(f)return f}}}throw l}},"resolveBaseSync"),$=i((e,r,t,s)=>{if(n.logEsm(3,"resolveDirectorySync",{specifier:e,context:r,isDirectory:n.isDirectoryPattern.test(e)}),(e==="."||e===".."||e.endsWith("/.."))&&(e+="/"),n.isDirectoryPattern.test(e)){const o=x(r);if(o&&!n.isFilePath(e))return W(e,r,t,s);const a=new URL(e,r.parentURL);return a.pathname=P.join(a.pathname,"index"),o?T(p.fileURLToPath(a),r,t,!1)??W(e,r,t,s):T(a.toString(),r,t,!0)}try{return W(e,r,t,s)}catch(o){if(o instanceof Error){n.logEsm(3,"resolveDirectorySync error",{specifier:e,context:r,error:o});const a=o;if(a.code==="ERR_UNSUPPORTED_DIR_IMPORT"){const l=V(a);if(l){if(e.startsWith("#"))throw o;const c=Ee(e,l);if(c?.kind==="root-exports")throw o;if(c?.mainUrl){try{return t(c.mainUrl,r)}catch(d){if(!z(d))throw d}try{return $(c.mainUrl,r,t,s)}catch(d){if(!z(d))throw d}}const m=`${l}/index`,f=T(m,r,t);if(f)return f}}}throw o}},"resolveDirectorySync"),be=i((e,r,t,s)=>{const o=je(e);if(n.logEsm(3,"resolveTsPathsSync",{specifier:e,context:r,tsconfigPathAliasSpecifier:o,tsconfig:s.parsedTsconfig,fromNodeModules:q(r.parentURL)}),o&&s.parsedTsconfig&&!q(r.parentURL)){const a=n.wt(s.parsedTsconfig,e);n.logEsm(3,"resolveTsPathsSync",{possiblePaths:a});for(const l of a)try{return $(p.pathToFileURL(l).toString(),r,t,s)}catch{}}return $(e,r,t,s)},"resolveTsPathsSync"),K="tsx://",Y=i((e,r)=>{const t=e.indexOf("#"),s=t===-1?e:e.slice(0,t),o=t===-1?"":e.slice(t);return`${s}${s.includes("?")?"&":"?"}${r}${o}`},"addQuery"),Z=i((e,r)=>L(e)?`${e}${e.includes("#")?"&":"#"}${U}${r}`:Y(e,`${U}${r}`),"addNamespace"),Oe=i((e,r)=>{const t=r.indexOf("#"),s=r[0]==="?"?r.slice(1,t===-1?void 0:t):"",o=t===-1?"":r.slice(t),a=e.indexOf("#"),l=a===-1?e:e.slice(0,a),c=a===-1?"":e.slice(a),m=s?Y(l,s):l;return new URL(`${m}${o||c}`).toString()},"mergeUrlMetadata"),ee=i((e,r)=>{if(r===void 0)return e;const t=new URL(e);if(t.searchParams.has(v))return e;const s=t.pathname.toLowerCase().lastIndexOf("%3f");if(s===-1)return e;const o=t.pathname.slice(s+3);if(o.includes("/"))return e;const a=new URLSearchParams(o.replaceAll("%25","%"));return a.get("namespace")!==r?e:(a.delete("namespace"),a.set(F,r),t.pathname=t.pathname.slice(0,s),t.search=a.toString(),t.toString())},"restoreCjsBridgeNamespace"),_e=i((e,r,t)=>{if(r!=="commonjs"||!e.startsWith(n.fileUrlPrefix)||!n.implicitTsExtensionsPattern.test(e))return e;const s=new URL(e),o=[E(s.search,[U]),...t?[`namespace=${encodeURIComponent(t)}`]:[]].filter(Boolean).join("&");return o?(s.pathname+=`%3F${o}`,s.searchParams.set(v,"1"),s.toString()):e},"preserveCommonJsQueryIdentity"),Me=i(e=>{const r=i((t,s,o)=>{if(!e.active||t.startsWith("node:")||x(s)&&n.isGlobalCjsLoaderActive())return o(t,s);t.startsWith(n.fileUrlPrefix)&&(t=ee(t,e.namespace));const{parentURL:a}=s;a?.startsWith(n.fileUrlPrefix)&&(s.parentURL=ee(a,e.namespace));const l=s.parentURL&&I(s.parentURL);let c=L(t)?l:I(t)??l;if(e.namespace){let h;if(t.startsWith(K)){try{h=JSON.parse(t.slice(K.length))}catch{}h?.namespace&&(c=h.namespace)}if(e.namespace!==c)return o(t,s);h&&(t=h.specifier,s.parentURL=h.parentURL)}if(L(t)){const h=o(t,s);return e.namespace?{...h,url:Z(h.url,e.namespace)}:h}const m=we(t,x(s)),f=m===-1?t:t.slice(0,m),d=m===-1?"":t.slice(m),g=be(f,s,o,e);if(n.logEsm(2,"nextResolve",{resolved:g}),g.format==="builtin"||g.url.startsWith("node:"))return g;const u={...g};return u.url.startsWith(n.fileUrlPrefix)&&(u.format==="module-typescript"?u.format="module":u.format==="commonjs-typescript"?u.format="commonjs":!u.format&&!Ce(u.url)&&(u.format=de(u.url),n.logEsm(2,"getFormatFromFileUrlSync",{resolved:u,format:u.format}))),d&&(u.url=Oe(u.url,d)),c&&I(u.url)===void 0&&(u.url=Z(u.url,c)),u.url=_e(u.url,u.format,c),u},"resolve");return n.debugEnabled?(t,s,o)=>{n.logEsm(2,"resolveSync",{specifier:t,context:s});const a=r(t,s,o);return n.logEsm(1,"resolvedSync",{specifier:t,context:s,result:a}),a}:r},"createResolveSync"),te=i(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(n.fileUrlPrefix)?t:p.pathToFileURL(t).toString();return import(`tsx://${JSON.stringify({specifier:r,parentURL:s,namespace:e})}`)},"createScopedImport");let re=!1;const Ne=i(e=>{const r=[];for(let t=0;t<e.length;t+=1){const s=e[t];if(s==="--import"){const o=e[t+1];o&&r.push(o),t+=1}else s.startsWith("--import=")&&r.push(s.slice(9))}return r},"collectImportSpecifiers"),Je=i(()=>[...(process.env.NODE_OPTIONS??"").matchAll(/(?:^|\s)--import(?:=|\s+)(\S+)/g)].map(([,e])=>e),"collectNodeOptionsImportSpecifiers"),se=[new URL("loader.mjs",typeof document>"u"?require("url").pathToFileURL(__filename).href:S&&S.tagName.toUpperCase()==="SCRIPT"&&S.src||new URL("esm/api/index.cjs",document.baseURI).href).toString(),new URL("esm/index.mjs",typeof document>"u"?require("url").pathToFileURL(__filename).href:S&&S.tagName.toUpperCase()==="SCRIPT"&&S.src||new URL("esm/api/index.cjs",document.baseURI).href).toString()],Ae=new Set(["tsx","tsx/esm",...se,...se.map(e=>decodeURI(new URL(e).pathname))]),Be=i(e=>Ae.has(e),"isTsxImport"),ne=i(e=>/\.(?:[cm]?ts|tsx)(?:[?#].*)?$/.test(e),"isTypeScriptImport"),ke=i(()=>{const e=Ne(process.execArgv),r=e.findIndex(Be);return r>0&&e.slice(0,r).some(ne)},"hasCliTypeScriptPreload"),Qe=Je().some(ne)||ke(),oe=typeof R.registerHooks=="function"&&n.isFeatureSupported(n.moduleRegisterHooksCjsReload)&&!Qe,ae=i(e=>{if(!R.register&&!oe)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(!re){const{_resolveFilename:c}=R;R._resolveFilename=(m,...f)=>c(n.interopCjsExports(m),...f),re=!0}const{sourceMapsEnabled:r}=process;if(process.setSourceMapsEnabled(!0),oe){const c=me({namespace:e?.namespace,onImport:e?.onImport,tsconfig:e?.tsconfig}),m=R.registerHooks({load:Ie(c),resolve:Me(c)}),f=i((async()=>{c.active=!1,m.deregister(),r===!1&&process.setSourceMapsEnabled(!1)}),"unregister2");return e?.namespace&&(f.import=te(e.namespace),f.unregister=f),f}const{port1:t,port2:s}=new le.MessageChannel;R.register(`./esm/index.mjs?${_.randomUUID()}`,{parentURL:typeof document>"u"?require("url").pathToFileURL(__filename).href:S&&S.tagName.toUpperCase()==="SCRIPT"&&S.src||new URL("esm/api/index.cjs",document.baseURI).href,data:{port:s,namespace:e?.namespace,tsconfig:e?.tsconfig},transferList:[s]});const o=e?.onImport,a=o&&(c=>{c.type==="load"&&o(c.url)});a&&(t.on("message",a),t.unref());const l=i(()=>(r===!1&&process.setSourceMapsEnabled(!1),a&&t.off("message",a),t.postMessage("deactivate"),new Promise(c=>{const m=i(f=>{f.type==="deactivated"&&(c(),t.off("message",m))},"onDeactivated");t.on("message",m)})),"unregister");return e?.namespace&&(l.import=te(e.namespace),l.unregister=l),l},"register"),De=i((e,r)=>{if(!r||typeof r=="object"&&!r.parentURL)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");const t=typeof r=="string",s=t?r:r.parentURL,o=_.randomUUID(),a=n.register({namespace:o});return!n.isFeatureSupported(n.esmLoadReadFile)&&!n.isBarePackageNamePattern.test(e)&&n.cjsExtensionPattern.test(e)?Promise.resolve(a.require(e,s)):ae({namespace:o,...t?{}:r}).import(e,s)},"tsImport");exports.register=ae,exports.tsImport=De;