4 lines
7 KiB
JavaScript
4 lines
7 KiB
JavaScript
"use strict";var B=Object.defineProperty;var c=(t,e)=>B(t,"name",{value:e,configurable:!0});var z=require("./get-pipe-path-BoR10qr8.cjs"),p=require("node:module"),m=require("node:path"),O=require("node:url"),x=require("get-tsconfig"),G=require("node:fs"),v=require("./index-BsW12Ot9.cjs"),U=require("./client-D6NvIMSC.cjs");const F=c(t=>{if(!t.startsWith("data:text/javascript,"))return;const e=t.indexOf("?");if(e===-1)return;const n=new URLSearchParams(t.slice(e+1)).get("filePath");if(n)return n},"getOriginalFilePath"),R=c(t=>{const e=F(t);return e&&(p._cache[e]=p._cache[t],delete p._cache[t],t=e),t},"interopCjsExports"),H=c(t=>{const e=t.indexOf(":");if(e!==-1)return t.slice(0,e)},"getScheme"),L=c(t=>t[0]==="."&&(t[1]==="/"||t[1]==="."||t[2]==="/"),"isRelativePath"),y=c(t=>L(t)||m.isAbsolute(t),"isFilePath"),X=c(t=>{if(y(t))return!0;const e=H(t);return e&&e!=="node"},"requestAcceptsQuery"),E="file://",W=/\.([cm]?ts|[tj]sx)($|\?)/,K=/[/\\].+\.(?:cts|cjs)(?:$|\?)/,V=/\.json($|\?)/,_=/\/(?:$|\?)/,Y=/^(?:@[^/]+\/)?[^/\\]+$/,$=`${m.sep}node_modules${m.sep}`;exports.fileMatcher=void 0,exports.tsconfigPathsMatcher=void 0,exports.allowJs=!1;const D=c(t=>{let e=null;if(t){const r=m.resolve(t);e={path:r,config:x.parseTsconfig(r)}}else{try{e=x.getTsconfig()}catch{}if(!e)return}exports.fileMatcher=x.createFilesMatcher(e),exports.tsconfigPathsMatcher=x.createPathsMatcher(e),exports.allowJs=e?.config.compilerOptions?.allowJs??!1},"loadTsconfig"),M=c(t=>Array.from(t).length>0?`?${t.toString()}`:"","urlSearchParamsStringify"),Z=`
|
|
//# sourceMappingURL=data:application/json;base64,`,N=c(()=>process.sourceMapsEnabled??!0,"shouldApplySourceMap"),S=c(({code:t,map:e})=>t+Z+Buffer.from(JSON.stringify(e),"utf8").toString("base64"),"inlineSourceMap"),q=[".cts",".mts",".ts",".tsx",".jsx"],ee=[".js",".cjs",".mjs"],C=[".ts",".tsx",".jsx"],w=c((t,e,r,n)=>{const s=Object.getOwnPropertyDescriptor(t,e);s?.set?t[e]=r:(!s||s.configurable)&&Object.defineProperty(t,e,{value:r,enumerable:s?.enumerable||n?.enumerable,writable:n?.writable??(s?s.writable:!0),configurable:n?.configurable??(s?s.configurable:!0)})},"safeSet"),te=c((t,e,r)=>{const n=e[".js"],s=c((a,o)=>{if(t.enabled===!1)return n(a,o);const[l,f]=o.split("?");if((new URLSearchParams(f).get("namespace")??void 0)!==r)return n(a,o);U.parent?.send&&U.parent.send({type:"dependency",path:l});const d=q.some(h=>l.endsWith(h)),P=ee.some(h=>l.endsWith(h));if(!d&&!P)return n(a,l);let u=G.readFileSync(l,"utf8");if(l.endsWith(".cjs")){const h=v.transformDynamicImport(o,u);h&&(u=N()?S(h):h.code)}else if(d||v.isESM(u)){const h=v.transformSync(u,o,{tsconfigRaw:exports.fileMatcher?.(l)});u=N()?S(h):h.code}a._compile(u,l)},"transformer");w(e,".js",s);for(const a of C)w(e,a,s,{enumerable:!r,writable:!0,configurable:!0});return w(e,".mjs",s,{writable:!0,configurable:!0}),()=>{e[".js"]===s&&(e[".js"]=n);for(const a of[...C,".mjs"])e[a]===s&&delete e[a]}},"createExtensions"),se=c(t=>e=>{if((e==="."||e===".."||e.endsWith("/.."))&&(e+="/"),_.test(e)){let r=m.join(e,"index.js");e.startsWith("./")&&(r=`./${r}`);try{return t(r)}catch{}}try{return t(e)}catch(r){const n=r;if(n.code==="MODULE_NOT_FOUND")try{return t(`${e}${m.sep}index.js`)}catch{}throw n}},"createImplicitResolver"),A=[".js",".json"],J=[".ts",".tsx",".jsx"],ne=[...J,...A],re=[...A,...J],g=Object.create(null);g[".js"]=[".ts",".tsx",".js",".jsx"],g[".jsx"]=[".tsx",".ts",".jsx",".js"],g[".cjs"]=[".cts"],g[".mjs"]=[".mts"];const Q=c(t=>{const e=t.split("?"),r=e[1]?`?${e[1]}`:"",[n]=e,s=m.extname(n),a=[],o=g[s];if(o){const f=n.slice(0,-s.length);a.push(...o.map(i=>f+i+r))}const l=!(t.startsWith(E)||y(n))||n.includes($)||n.includes("/node_modules/")?re:ne;return a.push(...l.map(f=>n+f+r)),a},"mapTsExtensions"),b=c((t,e,r)=>{if(_.test(e)||!r&&!exports.allowJs)return;const n=Q(e);if(n)for(const s of n)try{return t(s)}catch(a){const{code:o}=a;if(o!=="MODULE_NOT_FOUND"&&o!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw a}},"resolveTsFilename"),ae=c((t,e)=>r=>{if(y(r)){const n=b(t,r,e);if(n)return n}try{return t(r)}catch(n){const s=n;if(s.code==="MODULE_NOT_FOUND"){if(typeof s.path=="string"&&s.path.endsWith(`${m.sep}package.json`)){const o=s.message.match(/^Cannot find module '([^']+)'$/);if(o){const f=o[1],i=b(t,f,e);if(i)return i}const l=s.message.match(/^Cannot find module '([^']+)'. Please verify that the package.json has a valid "main" entry$/);if(l){const f=l[1],i=b(t,f,e);if(i)return i}}const a=b(t,r,e);if(a)return a}throw s}},"createTsExtensionResolver"),I="at cjsPreparseModuleExports (node:internal",ce=c(t=>{const e=t.stack.split(`
|
|
`).slice(1);return e[1].includes(I)||e[2].includes(I)},"isFromCjsLexer"),oe=c((t,e)=>{const r=t.split("?"),n=new URLSearchParams(r[1]);if(e?.filename){const s=F(e.filename);let a;if(s){const f=s.split("?"),i=f[0];a=f[1],e.filename=i,e.path=m.dirname(i),e.paths=p._nodeModulePaths(e.path),p._cache[i]=e}a||(a=e.filename.split("?")[1]);const l=new URLSearchParams(a).get("namespace");l&&n.append("namespace",l)}return[r[0],n,(s,a)=>(m.isAbsolute(s)&&!s.endsWith(".json")&&!s.endsWith(".node")&&!(a===0&&ce(new Error))&&(s+=M(n)),s)]},"preserveQuery"),ie=c((t,e,r)=>{if(t.startsWith(E)&&(t=O.fileURLToPath(t)),exports.tsconfigPathsMatcher&&!y(t)&&!e?.filename?.includes($)){const n=exports.tsconfigPathsMatcher(t);for(const s of n)try{return r(s)}catch{}}return r(t)},"resolveTsPaths"),le=c((t,e,r)=>(n,s,...a)=>{if(t.enabled===!1)return e(n,s,...a);n=R(n);const[o,l,f]=oe(n,s);if((l.get("namespace")??void 0)!==r)return e(n,s,...a);let i=c(P=>e(P,s,...a),"nextResolveSimple");i=ae(i,!!(s?.filename&&W.test(s.filename))),i=se(i);const d=ie(o,s,i);return f(d,a.length)},"createResolveFilename"),k=c((t,e)=>{if(!e)throw new Error("The current file path (__filename or import.meta.url) must be provided in the second argument of tsx.require()");return t.startsWith(".")?((typeof e=="string"&&e.startsWith(E)||e instanceof URL)&&(e=O.fileURLToPath(e)),m.resolve(m.dirname(e),t)):t},"resolveContext"),fe=c(t=>{const{sourceMapsEnabled:e}=process,r={enabled:!0};D(process.env.TSX_TSCONFIG_PATH),process.setSourceMapsEnabled(!0);const n=p._resolveFilename,s=le(r,n,t?.namespace);p._resolveFilename=s;const a=te(r,p._extensions,t?.namespace),o=c(()=>{e===!1&&process.setSourceMapsEnabled(!1),r.enabled=!1,p._resolveFilename===s&&(p._resolveFilename=n),a()},"unregister");if(t?.namespace){const l=c((i,d)=>{const P=k(i,d),[u,h]=P.split("?"),j=new URLSearchParams(h);return t.namespace&&!u.startsWith("node:")&&j.set("namespace",t.namespace),z.require(u+M(j))},"scopedRequire");o.require=l;const f=c((i,d,P)=>{const u=k(i,d),[h,j]=u.split("?"),T=new URLSearchParams(j);return t.namespace&&!h.startsWith("node:")&&T.set("namespace",t.namespace),s(h+M(T),module,!1,P)},"scopedResolve");o.resolve=f,o.unregister=o}return o},"register");exports.cjsExtensionPattern=K,exports.fileUrlPrefix=E,exports.inlineSourceMap=S,exports.interopCjsExports=R,exports.isBarePackageNamePattern=Y,exports.isDirectoryPattern=_,exports.isJsonPattern=V,exports.isRelativePath=L,exports.loadTsconfig=D,exports.mapTsExtensions=Q,exports.register=fe,exports.requestAcceptsQuery=X,exports.tsExtensionsPattern=W;
|