3 lines
17 KiB
JavaScript
3 lines
17 KiB
JavaScript
|
|
var $e=Object.defineProperty;var i=(e,s)=>$e(e,"name",{value:s,configurable:!0});import T from"node:module";import{MessageChannel as We}from"node:worker_threads";import{i as j,b as Je,e as z,m as be}from"./node-features-B9BBLzwu.mjs";import{l as re,t as oe,g as Oe,a as Ne,d as b,b as d,e as V,f as S,h as L,j as K,k as Ae,m as g,n as Me,w as ne,o as ae,p as O,q as ce,s as N,u as Be}from"./register-BnTWPeIB.mjs";import{pathToFileURL as h,fileURLToPath as Y}from"node:url";import{readFileSync as qe}from"node:fs";import{readFile as Qe}from"node:fs/promises";import{p as He,i as ie,t as me,a as A,b as le,c as Ge,r as Xe}from"./index-XurvG3JN.mjs";import{p as de}from"./client-D_mPDF5S.mjs";import U from"node:path";const I={active:!0,parsedTsconfig:void 0},ue=i(e=>{const s={active:!0,namespace:e?.namespace,onImport:e?.onImport,parsedTsconfig:void 0,port:e?.port,tsconfig:e?.tsconfig};return e?.tsconfig!==!1&&(s.parsedTsconfig=re(e?.tsconfig??process.env.TSX_TSCONFIG_PATH)),s},"createData"),ze=i(async e=>{if(!e)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(I,ue(e)),e.port&&e.port.on("message",s=>{s==="deactivate"&&(I.active=!1,e.port.postMessage({type:"deactivated"}))})},"initialize"),Ve=i(()=>(I.parsedTsconfig=re(process.env.TSX_TSCONFIG_PATH),"process.setSourceMapsEnabled(true);"),"globalPreload"),Ke=i(e=>{const{pathname:s}=new URL(e),t=U.extname(s);if(t===".mts"||t===".mjs")return"module";if(t===".cts"||t===".cjs")return"commonjs";if(t===".js"||oe.includes(t))return Oe(e)},"getFormatFromFileUrl"),Ye=i(e=>{const{pathname:s}=new URL(e),t=U.extname(s);if(t===".mts"||t===".mjs")return"module";if(t===".cts"||t===".cjs")return"commonjs";if(t===".js"||oe.includes(t))return Ne(e)},"getFormatFromFileUrlSync"),R="tsx-namespace=",M="tsx-commonjs-export-preparse",fe=`${M}=1`,F="tsx-commonjs-virtual-query",C=new Map,Z=i((e,s)=>e.slice(1).split("&").filter(t=>t&&s.every(r=>!t.startsWith(r))).join("&"),"getQueryWithoutParameters"),B=i((e,s)=>{const t=Z(e,s);return t?`?${t}`:""},"getSearchWithoutParameters"),Ze=i(e=>e.replaceAll(/\/\*[\s\S]*?\*\/|\/\/[^\n\r]*/g,""),"stripComments"),De=i(e=>{const s=Ze(e);if(/^\s*export\s*\*/.test(s))return"named";if(/^\s*import\s*\*\s*as\s+[\w$]+/.test(s))return"namespace";const t=s.match(/\{([^}]*)\}/)?.[1];if(t)return t.split(",").some(r=>{const o=r.trim().split(/\s+as\s+/)[0];return!!(o&&o!=="default")})?"named":void 0},"getCommonJsImportBinding"),ke=i((e,s,t)=>{const r=C.get(e);if(!r)return!1;try{const[o]=He(r);return o.some(n=>{if(n.d!==-1||n.n!==s)return!1;const m=De(r.slice(n.ss,n.s));return m==="named"||t&&m==="namespace"})}catch{return!1}},"parentImportsCommonJsExports"),v=i(e=>{const s=e.indexOf(R);if(s===-1)return;const t=e[s-1];if(t!=="?"&&t!=="&")return;const r=s+R.length,o=e.indexOf("&",r);return o===-1?e.slice(r):e.slice(r,o)},"getNamespace"),pe=j(Je)?"importAttributes":"importAssertions",he=i(e=>e==="commonjs"||e==="commonjs-typescript","isCommonJsFormat"),ge=i(e=>e==="module-typescript"||e==="typescript","isModuleTypeScriptFormat"),xe=j(z),et=[`${F}=`],q=[`${M}=`,`${F}=`],w=i((e,s)=>s.parsedTsconfig&&Ae(s.parsedTsconfig,e)?s.parsedTsconfig.config:void 0,"getTsconfigRaw"),tt=i(e=>{if(!e.searchParams.has(F))return;const{pathname:s}=e,t=s.toLowerCase().lastIndexOf("%3f");if(t===-1)return;const r=new URL(e);return r.pathname=s.slice(0,t),r.search="",Y(r)},"getFilePathFromVirtualQuery"),D=i(e=>{const s=e.startsWith(g)?new URL(e):void 0,t=s?Y(s):e,r=s&&tt(s),o=r||t,n=s&&r?h(o).toString()+B(s.search,et):e;return{fileUrl:s,filePath:o,loadUrl:n}},"getFileLoadContext"),ye=i((e,s)=>{if(!s?.search)return e;const t=B(s.search,q);return t?h(e).toString()+t:e},"getTransformPath"),Pe=i((e,s,t)=>{const r=[...s?Z(s.search,[R,...q]).split("&").filter(Boolean):[],...t?[`namespace=${encodeURIComponent(t)}`]:[]].join("&");return r?`${e}?${r}`:e},"getFilePathWithQuery"),st=new TextDecoder,Se=i(e=>typeof e=="string"?e:st.decode(e),"decodeSource"),rt=i((e,s)=>{const t=new URL(s),r=s.startsWith(g)?D(s).filePath:void 0;t.searchParams.delete("tsx-namespace"),t.searchParams.delete(M),t.searchParams.delete(F),r&&(t.pathname=new URL(h(r)).pathname);const o=t.toString();return e.port&&e.port.postMessage({type:"load",url:o}),e.onImport?.(o),o},"notifyLoad"),Re=i((e,s)=>{if(!e.active)return!1;const t=v(s);if(e.namespace&&e.namespace!==t)return!1;const r=rt(e,s);return de.send&&de.send({type:"dependency",path:r}),!0},"prepareLoad"),Ue=i((e,s)=>{if(!Me.test(e))return s;const t=s[pe];return t?.type?s:{...s,[pe]:{...t,type:"json"}}},"prepareJsonAttributes"),k=i(({conditions:e})=>e?.includes("require")===!0&&!e.includes("import"),"isCommonJsRequireContext$1"),ot=i(e=>{const s=i(async(t,r,o)=>{if(!Re(e,t))return o(t,r);const n=v(t),{fileUrl:m,filePath:c,loadUrl:a}=D(t),u=Ue(a,r),l=await o(a,u);d(3,"loaded by next loader",{url:t,loadUrl:a,loaded:l});const y=m?.searchParams.has(M)===!0,P=l.format,E=m?new URL(h(c)):void 0;if(E&&m&&(E.search=B(m.search,q)),he(P)&&m&&l.responseURL?.startsWith("file:")&&!c.endsWith(".cjs")){const f=await Qe(h(c),"utf8"),W=ie(f);if(P==="commonjs-typescript"||!c.endsWith(
|