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