tsx 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var T=require("worker_threads"),R=require("../node-features-57cbd763.cjs"),F=require("module"),v=require("../source-map.cjs"),h=require("path"),g=require("url"),E=require("../index-bb73d2cd.cjs"),O=require("../resolve-ts-path-3fca13b7.cjs"),p=require("get-tsconfig"),k=require("fs");require("esbuild"),require("crypto"),require("os");var d=typeof document<"u"?document.currentScript:null;const b=()=>{const{port1:e,port2:t}=new T.MessageChannel;v.installSourceMapSupport(),process.send&&e.addListener("message",r=>{r.type==="dependency"&&process.send(r)}),e.unref(),F.register("./index.mjs",{parentURL:typeof document>"u"?require("url").pathToFileURL(__filename).href:d&&d.src||new URL("esm/index.cjs",document.baseURI).href,data:{port:t},transferList:[t]})},f=new Map;async function x(e){if(f.has(e))return f.get(e);if(!await k.promises.access(e).then(()=>!0,()=>!1)){f.set(e,void 0);return}const r=await k.promises.readFile(e,"utf8");try{const o=JSON.parse(r);return f.set(e,o),o}catch{throw new Error(`Error parsing: ${e}`)}}async function N(e){let t=new URL("package.json",e);for(;!t.pathname.endsWith("/node_modules/package.json");){const r=g.fileURLToPath(t),o=await x(r);if(o)return o;const n=t;if(t=new URL("../package.json",t),t.pathname===n.pathname)break}}async function A(e){var t;const r=await N(e);return(t=r==null?void 0:r.type)!=null?t:"commonjs"}const m=process.env.TSX_TSCONFIG_PATH?{path:h.resolve(process.env.TSX_TSCONFIG_PATH),config:p.parseTsconfig(process.env.TSX_TSCONFIG_PATH)}:p.getTsconfig(),D=m&&p.createFilesMatcher(m),S=m&&p.createPathsMatcher(m),U="file://",y=/\.([cm]?ts|[tj]sx)($|\?)/,I=/\.json(?:$|\?)/,J=e=>{const t=h.extname(e);if(t===".json")return"json";if(t===".mjs"||t===".mts")return"module";if(t===".cjs"||t===".cts")return"commonjs"},C=e=>{const t=J(e);if(t)return t;if(y.test(e))return A(e)},q=v.installSourceMapSupport(),M=/\/(?:$|\?)/;let l=process.send?process.send.bind(process):void 0;const W=async e=>{if(!e)throw new Error(`tsx must be loaded with --import instead of --loader
1
+ "use strict";var T=require("worker_threads"),R=require("../node-features-fa497138.cjs"),F=require("module"),v=require("../source-map.cjs"),h=require("path"),g=require("url"),E=require("../index-bb73d2cd.cjs"),O=require("../resolve-ts-path-3fca13b7.cjs"),p=require("get-tsconfig"),k=require("fs");require("esbuild"),require("crypto"),require("os");var d=typeof document<"u"?document.currentScript:null;const b=()=>{const{port1:e,port2:t}=new T.MessageChannel;v.installSourceMapSupport(),process.send&&e.addListener("message",r=>{r.type==="dependency"&&process.send(r)}),e.unref(),F.register("./index.mjs",{parentURL:typeof document>"u"?require("url").pathToFileURL(__filename).href:d&&d.src||new URL("esm/index.cjs",document.baseURI).href,data:{port:t},transferList:[t]})},f=new Map;async function x(e){if(f.has(e))return f.get(e);if(!await k.promises.access(e).then(()=>!0,()=>!1)){f.set(e,void 0);return}const r=await k.promises.readFile(e,"utf8");try{const o=JSON.parse(r);return f.set(e,o),o}catch{throw new Error(`Error parsing: ${e}`)}}async function N(e){let t=new URL("package.json",e);for(;!t.pathname.endsWith("/node_modules/package.json");){const r=g.fileURLToPath(t),o=await x(r);if(o)return o;const n=t;if(t=new URL("../package.json",t),t.pathname===n.pathname)break}}async function A(e){var t;const r=await N(e);return(t=r==null?void 0:r.type)!=null?t:"commonjs"}const m=process.env.TSX_TSCONFIG_PATH?{path:h.resolve(process.env.TSX_TSCONFIG_PATH),config:p.parseTsconfig(process.env.TSX_TSCONFIG_PATH)}:p.getTsconfig(),D=m&&p.createFilesMatcher(m),S=m&&p.createPathsMatcher(m),U="file://",y=/\.([cm]?ts|[tj]sx)($|\?)/,I=/\.json(?:$|\?)/,J=e=>{const t=h.extname(e);if(t===".json")return"json";if(t===".mjs"||t===".mts")return"module";if(t===".cjs"||t===".cts")return"commonjs"},C=e=>{const t=J(e);if(t)return t;if(y.test(e))return A(e)},q=v.installSourceMapSupport(),M=/\/(?:$|\?)/;let l=process.send?process.send.bind(process):void 0;const W=async e=>{if(!e)throw new Error(`tsx must be loaded with --import instead of --loader
2
2
  The --loader flag was deprecated in Node v20.6.0`);const{port:t}=e;l=t.postMessage.bind(t)},G=({port:e})=>(l=e.postMessage.bind(e),`
3
3
  const require = getBuiltin('module').createRequire("${typeof document>"u"?require("url").pathToFileURL(__filename).href:d&&d.src||new URL("esm/index.cjs",document.baseURI).href}");
4
4
  require('tsx/source-map').installSourceMapSupport(port);
@@ -1,4 +1,4 @@
1
- import{MessageChannel as O,isMainThread as S}from"worker_threads";import{i as F,s as N}from"../node-features-ef8dee58.mjs";import U from"module";import{installSourceMapSupport as w}from"../source-map.mjs";import d from"path";import{fileURLToPath as _,pathToFileURL as b}from"url";import{b as v,t as A}from"../index-a0bec4d2.mjs";import{r as D}from"../resolve-ts-path-eb3847f5.mjs";import{parseTsconfig as L,getTsconfig as x,createFilesMatcher as J,createPathsMatcher as I}from"get-tsconfig";import P from"fs";import"esbuild";import"crypto";import"os";const $=()=>{const{port1:t,port2:s}=new O;w(),process.send&&t.addListener("message",r=>{r.type==="dependency"&&process.send(r)}),t.unref(),U.register("./index.mjs",{parentURL:import.meta.url,data:{port:s},transferList:[s]})},m=new Map;async function C(t){if(m.has(t))return m.get(t);if(!await P.promises.access(t).then(()=>!0,()=>!1)){m.set(t,void 0);return}const r=await P.promises.readFile(t,"utf8");try{const o=JSON.parse(r);return m.set(t,o),o}catch{throw new Error(`Error parsing: ${t}`)}}async function W(t){let s=new URL("package.json",t);for(;!s.pathname.endsWith("/node_modules/package.json");){const r=_(s),o=await C(r);if(o)return o;const n=s;if(s=new URL("../package.json",s),s.pathname===n.pathname)break}}async function q(t){var s;const r=await W(t);return(s=r==null?void 0:r.type)!=null?s:"commonjs"}const f=process.env.TSX_TSCONFIG_PATH?{path:d.resolve(process.env.TSX_TSCONFIG_PATH),config:L(process.env.TSX_TSCONFIG_PATH)}:x(),G=f&&J(f),T=f&&I(f),E="file://",g=/\.([cm]?ts|[tj]sx)($|\?)/,H=/\.json(?:$|\?)/,X=t=>{const s=d.extname(t);if(s===".json")return"json";if(s===".mjs"||s===".mts")return"module";if(s===".cjs"||s===".cts")return"commonjs"},K=t=>{const s=X(t);if(s)return s;if(g.test(t))return q(t)},k=w(),R=/\/(?:$|\?)/;let u=process.send?process.send.bind(process):void 0;const Q=async t=>{if(!t)throw new Error(`tsx must be loaded with --import instead of --loader
1
+ import{MessageChannel as O,isMainThread as S}from"worker_threads";import{i as F,s as N}from"../node-features-32913946.mjs";import U from"module";import{installSourceMapSupport as w}from"../source-map.mjs";import d from"path";import{fileURLToPath as _,pathToFileURL as b}from"url";import{b as v,t as A}from"../index-a0bec4d2.mjs";import{r as D}from"../resolve-ts-path-eb3847f5.mjs";import{parseTsconfig as L,getTsconfig as x,createFilesMatcher as J,createPathsMatcher as I}from"get-tsconfig";import P from"fs";import"esbuild";import"crypto";import"os";const $=()=>{const{port1:t,port2:s}=new O;w(),process.send&&t.addListener("message",r=>{r.type==="dependency"&&process.send(r)}),t.unref(),U.register("./index.mjs",{parentURL:import.meta.url,data:{port:s},transferList:[s]})},m=new Map;async function C(t){if(m.has(t))return m.get(t);if(!await P.promises.access(t).then(()=>!0,()=>!1)){m.set(t,void 0);return}const r=await P.promises.readFile(t,"utf8");try{const o=JSON.parse(r);return m.set(t,o),o}catch{throw new Error(`Error parsing: ${t}`)}}async function W(t){let s=new URL("package.json",t);for(;!s.pathname.endsWith("/node_modules/package.json");){const r=_(s),o=await C(r);if(o)return o;const n=s;if(s=new URL("../package.json",s),s.pathname===n.pathname)break}}async function q(t){var s;const r=await W(t);return(s=r==null?void 0:r.type)!=null?s:"commonjs"}const f=process.env.TSX_TSCONFIG_PATH?{path:d.resolve(process.env.TSX_TSCONFIG_PATH),config:L(process.env.TSX_TSCONFIG_PATH)}:x(),G=f&&J(f),T=f&&I(f),E="file://",g=/\.([cm]?ts|[tj]sx)($|\?)/,H=/\.json(?:$|\?)/,X=t=>{const s=d.extname(t);if(s===".json")return"json";if(s===".mjs"||s===".mts")return"module";if(s===".cjs"||s===".cts")return"commonjs"},K=t=>{const s=X(t);if(s)return s;if(g.test(t))return q(t)},k=w(),R=/\/(?:$|\?)/;let u=process.send?process.send.bind(process):void 0;const Q=async t=>{if(!t)throw new Error(`tsx must be loaded with --import instead of --loader
2
2
  The --loader flag was deprecated in Node v20.6.0`);const{port:s}=t;u=s.postMessage.bind(s)},z=({port:t})=>(u=t.postMessage.bind(t),`
3
3
  const require = getBuiltin('module').createRequire("${import.meta.url}");
4
4
  require('tsx/source-map').installSourceMapSupport(port);
package/dist/loader.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var n=require("./pkgroll_create-require-c530e400.cjs"),a=require("repl"),c=require("esbuild"),r=require("./esm/index.cjs");require("module"),require("worker_threads"),require("./node-features-57cbd763.cjs"),require("./source-map.cjs"),require("path"),require("url"),require("./index-bb73d2cd.cjs"),require("crypto"),require("fs"),require("os"),require("./resolve-ts-path-3fca13b7.cjs"),require("get-tsconfig");function q(e){const{eval:u}=e,l=async function(i,s,t,o){try{i=(await c.transform(i,{sourcefile:t,loader:"ts",tsconfigRaw:{compilerOptions:{preserveValueImports:!0}},define:{require:"global.require"}})).code}catch{}return u.call(this,i,s,t,o)};e.eval=l}const{start:v}=a;a.start=function(){const e=Reflect.apply(v,this,arguments);return q(e),e},n.require("./cjs/index.cjs"),exports.globalPreload=r.globalPreload,exports.initialize=r.initialize,exports.load=r.load,exports.resolve=r.resolve;
1
+ "use strict";var n=require("./pkgroll_create-require-c530e400.cjs"),a=require("repl"),c=require("esbuild"),r=require("./esm/index.cjs");require("module"),require("worker_threads"),require("./node-features-fa497138.cjs"),require("./source-map.cjs"),require("path"),require("url"),require("./index-bb73d2cd.cjs"),require("crypto"),require("fs"),require("os"),require("./resolve-ts-path-3fca13b7.cjs"),require("get-tsconfig");function q(e){const{eval:u}=e,l=async function(i,s,t,o){try{i=(await c.transform(i,{sourcefile:t,loader:"ts",tsconfigRaw:{compilerOptions:{preserveValueImports:!0}},define:{require:"global.require"}})).code}catch{}return u.call(this,i,s,t,o)};e.eval=l}const{start:v}=a;a.start=function(){const e=Reflect.apply(v,this,arguments);return q(e),e},n.require("./cjs/index.cjs"),exports.globalPreload=r.globalPreload,exports.initialize=r.initialize,exports.load=r.load,exports.resolve=r.resolve;
package/dist/loader.mjs CHANGED
@@ -1 +1 @@
1
- import{r as s}from"./pkgroll_create-require-b92e8e0d.mjs";import i from"repl";import{transform as l}from"esbuild";import{globalPreload as V,initialize as k,load as A,resolve as B}from"./esm/index.mjs";import"module";import"worker_threads";import"./node-features-ef8dee58.mjs";import"./source-map.mjs";import"path";import"url";import"./index-a0bec4d2.mjs";import"crypto";import"fs";import"os";import"./resolve-ts-path-eb3847f5.mjs";import"get-tsconfig";function n(r){const{eval:e}=r,a=async function(t,p,o,m){try{t=(await l(t,{sourcefile:o,loader:"ts",tsconfigRaw:{compilerOptions:{preserveValueImports:!0}},define:{require:"global.require"}})).code}catch{}return e.call(this,t,p,o,m)};r.eval=a}const{start:c}=i;i.start=function(){const r=Reflect.apply(c,this,arguments);return n(r),r},s("./cjs/index.cjs");export{V as globalPreload,k as initialize,A as load,B as resolve};
1
+ import{r as s}from"./pkgroll_create-require-b92e8e0d.mjs";import i from"repl";import{transform as l}from"esbuild";import{globalPreload as V,initialize as k,load as A,resolve as B}from"./esm/index.mjs";import"module";import"worker_threads";import"./node-features-32913946.mjs";import"./source-map.mjs";import"path";import"url";import"./index-a0bec4d2.mjs";import"crypto";import"fs";import"os";import"./resolve-ts-path-eb3847f5.mjs";import"get-tsconfig";function n(r){const{eval:e}=r,a=async function(t,p,o,m){try{t=(await l(t,{sourcefile:o,loader:"ts",tsconfigRaw:{compilerOptions:{preserveValueImports:!0}},define:{require:"global.require"}})).code}catch{}return e.call(this,t,p,o,m)};r.eval=a}const{start:c}=i;i.start=function(){const r=Reflect.apply(c,this,arguments);return n(r),r},s("./cjs/index.cjs");export{V as globalPreload,k as initialize,A as load,B as resolve};
@@ -0,0 +1 @@
1
+ const e=process.versions.node.split(".").map(Number),s=(t,o=e)=>o[0]-t[0]||o[1]-t[1]||o[2]-t[2];s([20,0,0])>=0;const r=s([20,6,0])>=0,c=s([21,0,0])>=0||s([20,10,0])>=0,p=s([21,0,0])>=0;export{c as i,r as s,p as t};
@@ -0,0 +1 @@
1
+ "use strict";const o=process.versions.node.split(".").map(Number),t=(s,e=o)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2];t([20,0,0])>=0;const r=t([20,6,0])>=0,u=t([21,0,0])>=0||t([20,10,0])>=0,p=t([21,0,0])>=0;exports.importAttributes=u,exports.supportsModuleRegister=r,exports.testRunnerGlob=p;
@@ -0,0 +1 @@
1
+ var r="4.4.0";export{r as v};
@@ -0,0 +1 @@
1
+ "use strict";var r="4.4.0";exports.version=r;
@@ -1 +1 @@
1
- "use strict";var o=require("./pkgroll_create-require-c530e400.cjs"),l=require("os");if(require("./suppress-warnings.cjs"),require("module"),o.require("./cjs/index.cjs"),process.send){let t=function(e){process.send({type:"kill",signal:e}),process.listenerCount(e)===0&&process.exit(128+l.constants.signals[e])};const r=["SIGINT","SIGTERM"];for(const e of r)process.on(e,t);const{listenerCount:n}=process;process.listenerCount=function(e){let s=Reflect.apply(n,this,arguments);return r.includes(e)&&(s-=1),s};const{listeners:i}=process;process.listeners=function(e){const s=Reflect.apply(i,this,arguments);return r.includes(e)?s.filter(c=>c!==t):s}}
1
+ "use strict";var o=require("./pkgroll_create-require-c530e400.cjs"),l=require("os");if(require("./suppress-warnings.cjs"),require("module"),o.require("./cjs/index.cjs"),process.send){const t=e=>{process.send({type:"kill",signal:e}),process.listenerCount(e)===0&&process.exit(128+l.constants.signals[e])},r=["SIGINT","SIGTERM"];for(const e of r)process.on(e,t);const{listenerCount:n,listeners:i}=process;process.listenerCount=function(e){let s=Reflect.apply(n,this,arguments);return r.includes(e)&&(s-=1),s},process.listeners=function(e){const s=Reflect.apply(i,this,arguments);return r.includes(e)?s.filter(c=>c!==t):s}}
@@ -1 +1 @@
1
- import{r as c}from"./pkgroll_create-require-b92e8e0d.mjs";import{constants as l}from"os";import"./suppress-warnings.mjs";import"module";if(c("./cjs/index.cjs"),process.send){let r=function(s){process.send({type:"kill",signal:s}),process.listenerCount(s)===0&&process.exit(128+l.signals[s])};const t=["SIGINT","SIGTERM"];for(const s of t)process.on(s,r);const{listenerCount:n}=process;process.listenerCount=function(s){let e=Reflect.apply(n,this,arguments);return t.includes(s)&&(e-=1),e};const{listeners:o}=process;process.listeners=function(s){const e=Reflect.apply(o,this,arguments);return t.includes(s)?e.filter(i=>i!==r):e}}
1
+ import{r as c}from"./pkgroll_create-require-b92e8e0d.mjs";import{constants as l}from"os";import"./suppress-warnings.mjs";import"module";if(c("./cjs/index.cjs"),process.send){const r=s=>{process.send({type:"kill",signal:s}),process.listenerCount(s)===0&&process.exit(128+l.signals[s])},t=["SIGINT","SIGTERM"];for(const s of t)process.on(s,r);const{listenerCount:n,listeners:o}=process;process.listenerCount=function(s){let e=Reflect.apply(n,this,arguments);return t.includes(s)&&(e-=1),e},process.listeners=function(s){const e=Reflect.apply(o,this,arguments);return t.includes(s)?e.filter(i=>i!==r):e}}
package/dist/repl.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var n=require("repl"),c=require("./package-a03af1f4.cjs"),l=require("./index-bb73d2cd.cjs");require("url"),require("esbuild"),require("crypto"),require("fs"),require("path"),require("os"),console.log(`Welcome to tsx v${c.version} (Node.js ${process.version}).
1
+ "use strict";var n=require("repl"),c=require("./package-f17f0cea.cjs"),l=require("./index-bb73d2cd.cjs");require("url"),require("esbuild"),require("crypto"),require("fs"),require("path"),require("os"),console.log(`Welcome to tsx v${c.version} (Node.js ${process.version}).
2
2
  Type ".help" for more information.`);const r=n.start(),{eval:u}=r,p=async function(o,s,e,t){const a=await l.transform(o,e,{loader:"ts",tsconfigRaw:{compilerOptions:{preserveValueImports:!0}},define:{require:"global.require"}}).catch(i=>(console.log(i.message),{code:`
3
3
  `}));return u.call(this,a.code,s,e,t)};r.eval=p;
package/dist/repl.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import a from"repl";import{v as l}from"./package-47993f5d.mjs";import{b as m}from"./index-a0bec4d2.mjs";import"url";import"esbuild";import"crypto";import"fs";import"path";import"os";console.log(`Welcome to tsx v${l} (Node.js ${process.version}).
1
+ import a from"repl";import{v as l}from"./package-e15f6aa4.mjs";import{b as m}from"./index-a0bec4d2.mjs";import"url";import"esbuild";import"crypto";import"fs";import"path";import"os";console.log(`Welcome to tsx v${l} (Node.js ${process.version}).
2
2
  Type ".help" for more information.`);const r=a.start(),{eval:p}=r,c=async function(e,t,o,s){const i=await m(e,o,{loader:"ts",tsconfigRaw:{compilerOptions:{preserveValueImports:!0}},define:{require:"global.require"}}).catch(n=>(console.log(n.message),{code:`
3
3
  `}));return p.call(this,i.code,t,o,s)};r.eval=c;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsx",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM files",
5
5
  "keywords": [
6
6
  "esbuild",
@@ -1 +0,0 @@
1
- "use strict";const e=process.versions.node.split(".").map(Number),s=t=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2];s([20,0,0])>=0;const o=s([20,6,0])>=0,r=s([21,0,0])>=0||s([20,10,0])>=0;exports.importAttributes=r,exports.supportsModuleRegister=o;
@@ -1 +0,0 @@
1
- const e=process.versions.node.split(".").map(Number),s=o=>e[0]-o[0]||e[1]-o[1]||e[2]-o[2];s([20,0,0])>=0;const t=s([20,6,0])>=0,r=s([21,0,0])>=0||s([20,10,0])>=0;export{r as i,t as s};
@@ -1 +0,0 @@
1
- var r="4.3.0";export{r as v};
@@ -1 +0,0 @@
1
- "use strict";var r="4.3.0";exports.version=r;