This commit is contained in:
2026-10-19 12:16:49 -04:00
parent d7ecab6494
commit 6d3f470922
10446 changed files with 1626249 additions and 2216 deletions
Generated Vendored
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Generated Vendored
+32
View File
@@ -0,0 +1,32 @@
<h1 align="center">
<br>
<picture>
<source media="(prefers-color-scheme: dark)" srcset=".github/logo-dark.svg">
<img width="160" alt="tsx" src=".github/logo-light.svg">
</picture>
<br><br>
<a href="https://npm.im/tsx"><img src="https://badgen.net/npm/v/tsx"></a> <a href="https://npm.im/tsx"><img src="https://badgen.net/npm/dm/tsx"></a>
</h1>
<p align="center">
TypeScript Execute (tsx): The easiest way to run TypeScript in Node.js
<br><br>
<a href="https://tsx.hirok.io">Documentation</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://tsx.hirok.io/getting-started">Getting started →</a>
</p>
<br>
<p align="center">
<a href="https://github.com/sponsors/privatenumber/sponsorships?tier_id=398771"><img width="412" src="https://raw.githubusercontent.com/privatenumber/sponsors/master/banners/assets/donate.webp"></a>
<a href="https://github.com/sponsors/privatenumber/sponsorships?tier_id=416984"><img width="412" src="https://raw.githubusercontent.com/privatenumber/sponsors/master/banners/assets/sponsor.webp"></a>
</p>
<p align="center"><sup><i>Already a sponsor?</i> Join the discussion in the <a href="https://github.com/pvtnbr/tsx">Development repo</a>!</sup></p>
## Sponsors
<p align="center">
<a href="https://github.com/sponsors/privatenumber">
<img src="https://cdn.jsdelivr.net/gh/privatenumber/sponsors/sponsorkit/sponsors.svg">
</a>
</p>
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env node
"use strict";var r=require("../../register-B1c7OH6V.cjs"),e=require("../../require-CVaYn9z3.cjs");require("node:module"),require("node:path"),require("node:url"),require("node:fs"),require("fs"),require("os"),require("path"),require("esbuild"),require("node:crypto"),require("node:os"),require("../../client-XItNFmsq.cjs"),require("node:net"),require("node:util"),exports.register=r.register,exports.require=e.tsxRequire;
+35
View File
@@ -0,0 +1,35 @@
type RegisterOptions = {
namespace?: string;
};
type Unregister = () => void;
type ScopedRequire = (id: string, fromFile: string | URL) => any;
type ScopedResolve = (id: string, fromFile: string | URL, resolveOptions?: {
paths?: string[] | undefined;
}) => string;
type NamespacedUnregister = Unregister & {
require: ScopedRequire;
resolve: ScopedResolve;
unregister: Unregister;
};
type Register = {
(options: RegisterOptions & {
namespace: string;
}): NamespacedUnregister;
(options?: RegisterOptions): Unregister;
};
declare const register: Register;
declare const tsxRequire: {
(id: string, fromFile: string | URL): any;
resolve: {
(id: string, fromFile: string | URL, options?: {
paths?: string[] | undefined;
}): string;
paths: (request: string) => string[] | null;
};
main: NodeJS.Module | undefined;
extensions: NodeJS.RequireExtensions;
cache: NodeJS.Dict<NodeJS.Module>;
};
export { register, tsxRequire as require };
+35
View File
@@ -0,0 +1,35 @@
type RegisterOptions = {
namespace?: string;
};
type Unregister = () => void;
type ScopedRequire = (id: string, fromFile: string | URL) => any;
type ScopedResolve = (id: string, fromFile: string | URL, resolveOptions?: {
paths?: string[] | undefined;
}) => string;
type NamespacedUnregister = Unregister & {
require: ScopedRequire;
resolve: ScopedResolve;
unregister: Unregister;
};
type Register = {
(options: RegisterOptions & {
namespace: string;
}): NamespacedUnregister;
(options?: RegisterOptions): Unregister;
};
declare const register: Register;
declare const tsxRequire: {
(id: string, fromFile: string | URL): any;
resolve: {
(id: string, fromFile: string | URL, options?: {
paths?: string[] | undefined;
}): string;
paths: (request: string) => string[] | null;
};
main: NodeJS.Module | undefined;
extensions: NodeJS.RequireExtensions;
cache: NodeJS.Dict<NodeJS.Module>;
};
export { register, tsxRequire as require };
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env node
import{createRequire as r}from"node:module";const o=r(import.meta.url);import{r as _,t as b}from"../../require-CBjy4Foe.mjs";import"node:module";import"node:path";import"node:url";import"node:fs";import"fs";import"os";import"path";import"../../index-DE3OBZuV.mjs";import"esbuild";import"node:crypto";import"../../temporary-directory-Du7LpLp9.mjs";import"node:os";import"node:net";import"../../index-Bqjv9TxC.mjs";import"node:util";export{_ as register,b as require};
+1
View File
@@ -0,0 +1 @@
"use strict";var r=require("../register-B1c7OH6V.cjs");require("node:module"),require("node:path"),require("node:url"),require("node:fs"),require("fs"),require("os"),require("path"),require("esbuild"),require("node:crypto"),require("node:os"),require("../client-XItNFmsq.cjs"),require("node:net"),require("node:util"),r.register();
+55
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
"use strict";var m=Object.defineProperty;var t=(e,n)=>m(e,"name",{value:n,configurable:!0});var h=require("node:net"),p=require("node:path"),a=require("node:os");const{geteuid:f}=process,P=f?f():a.userInfo().username,u=p.join(a.tmpdir(),`tsx-${P}`),v=process.platform==="win32",B=t(e=>{const n=p.join(u,`${e}.pipe`);return v?`\\\\?\\pipe\\${n}`:n},"getPipePath");let r=[];const l=t(()=>new Promise(e=>{const n=B(process.ppid),o=h.createConnection(n,()=>{e(t(g=>{const c=Buffer.from(JSON.stringify(g)),i=Buffer.alloc(4);i.writeInt32BE(c.length,0),o.write(Buffer.concat([i,c]))},"sendToParent"))});o.on("error",()=>{e()}),o.unref()}),"connectToServer"),s={send:t(e=>{r.push(e)},"send")},d=l();d.then(e=>{if(e)for(const n of r)e(n);r=[],s.send=e},()=>{r=[],s.send=void 0}),exports.connectingToServer=d,exports.parent=s,exports.tmpdir=u;
+2
View File
File diff suppressed because one or more lines are too long
+37
View File
@@ -0,0 +1,37 @@
import { MessagePort } from 'node:worker_threads';
type ScopedImport = (specifier: string, parent: string) => Promise<any>;
type TsconfigOptions = false | string;
type InitializationOptions = {
namespace?: string;
port?: MessagePort;
tsconfig?: TsconfigOptions;
};
type RegisterOptions = {
namespace?: string;
onImport?: (url: string) => void;
tsconfig?: TsconfigOptions;
};
type Unregister = () => Promise<void>;
type NamespacedUnregister = Unregister & {
import: ScopedImport;
unregister: Unregister;
};
type Register = {
(options: RegisterOptions & {
namespace: string;
}): NamespacedUnregister;
(options?: RegisterOptions): Unregister;
};
declare const register: Register;
type Options = {
parentURL: string;
onImport?: (url: string) => void;
tsconfig?: TsconfigOptions;
};
declare const tsImport: (specifier: string, options: string | Options) => Promise<any>;
export { register, tsImport };
export type { InitializationOptions, NamespacedUnregister, Register, RegisterOptions, ScopedImport, Unregister };
+37
View File
@@ -0,0 +1,37 @@
import { MessagePort } from 'node:worker_threads';
type ScopedImport = (specifier: string, parent: string) => Promise<any>;
type TsconfigOptions = false | string;
type InitializationOptions = {
namespace?: string;
port?: MessagePort;
tsconfig?: TsconfigOptions;
};
type RegisterOptions = {
namespace?: string;
onImport?: (url: string) => void;
tsconfig?: TsconfigOptions;
};
type Unregister = () => Promise<void>;
type NamespacedUnregister = Unregister & {
import: ScopedImport;
unregister: Unregister;
};
type Register = {
(options: RegisterOptions & {
namespace: string;
}): NamespacedUnregister;
(options?: RegisterOptions): Unregister;
};
declare const register: Register;
type Options = {
parentURL: string;
onImport?: (url: string) => void;
tsconfig?: TsconfigOptions;
};
declare const tsImport: (specifier: string, options: string | Options) => Promise<any>;
export { register, tsImport };
export type { InitializationOptions, NamespacedUnregister, Register, RegisterOptions, ScopedImport, Unregister };
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env node
var s=Object.defineProperty;var i=(t,r)=>s(t,"name",{value:r,configurable:!0});import{r as p}from"../../register-nyXW-TH3.mjs";import n from"node:crypto";import{r as c,i as u,c as d}from"../../require-CBjy4Foe.mjs";import{i as f,e as g}from"../../temporary-directory-Du7LpLp9.mjs";import"node:module";import"node:worker_threads";import"node:url";import"node:fs";import"node:fs/promises";import"../../index-DE3OBZuV.mjs";import"node:path";import"esbuild";import"node:os";import"fs";import"os";import"path";import"node:net";import"../../index-Bqjv9TxC.mjs";import"node:util";const U=i((t,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 e=typeof r=="string",o=e?r:r.parentURL,m=n.randomUUID(),a=c({namespace:m});return!f(g)&&!u.test(t)&&d.test(t)?Promise.resolve(a.require(t,o)):p({namespace:m,...e?{}:r}).import(t,o)},"tsImport");export{p as register,U as tsImport};
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env node
import*as o from"node:worker_threads";import{i as t,m as e,a}from"../temporary-directory-Du7LpLp9.mjs";import{r as i,c as s,a as m,b as p,d as l,e as d}from"../register-nyXW-TH3.mjs";import"node:crypto";import"node:module";import"node:path";import"node:url";import"../require-CBjy4Foe.mjs";import"node:fs";import"esbuild";import"../index-DE3OBZuV.mjs";import"node:os";import"node:fs/promises";import"fs";import"os";import"path";import"node:net";import"../index-Bqjv9TxC.mjs";import"node:util";(t(e)&&!o.isInternalThread||t(a)&&o.isMainThread)&&i();const r=d(),c=m(r),n=s(r),f=p(r),u=l(r);export{n as globalPreload,c as initialize,f as load,u as resolve};
+1
View File
@@ -0,0 +1 @@
var u=Object.defineProperty;var p=(e,s)=>u(e,"name",{value:s,configurable:!0});import O from"node:path";import{t as b}from"./temporary-directory-Du7LpLp9.mjs";const g=process.platform==="win32",m=p(e=>{const s=O.join(b,`${e}.pipe`);return g?`\\\\?\\pipe\\${s}`:s},"getPipePath");let n=!0;const l=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let r=0;if(l.process&&l.process.env&&l.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:s,NO_COLOR:a,TERM:t,COLORTERM:i}=l.process.env;s||a||e==="0"?n=!1:e==="1"||e==="2"||e==="3"?n=!0:t==="dumb"?n=!1:"CI"in l.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(c=>c in l.process.env)?n=!0:n=process.stdout.isTTY,n&&(process.platform==="win32"||i&&(i==="truecolor"||i==="24bit")?r=3:t&&(t.endsWith("-256color")||t.endsWith("256"))?r=2:r=1)}let f={enabled:n,supportLevel:r};function o(e,s,a=1){const t=`\x1B[${e}m`,i=`\x1B[${s}m`,c=new RegExp(`\\x1b\\[${s}m`,"g");return d=>f.enabled&&f.supportLevel>=a?t+(""+d).replace(c,t)+i:""+d}p(o,"kolorist");const C=o(30,39),R=o(33,39),I=o(90,39),L=o(92,39),w=o(95,39),E=o(96,39),h=o(44,49),T=o(100,49),y=o(103,49);export{C as a,y as b,h as c,T as d,I as e,w as f,m as g,L as h,g as i,E as l,f as o,R as y};
+14
View File
File diff suppressed because one or more lines are too long
+3
View File
File diff suppressed because one or more lines are too long
+3
View File
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env node
import"#cjs-loader";import{globalPreload as k,initialize as q,load as u,resolve as w}from"./esm/index.mjs";import"node:worker_threads";import"./temporary-directory-Du7LpLp9.mjs";import"node:path";import"node:os";import"./register-nyXW-TH3.mjs";import"node:crypto";import"node:module";import"./require-CBjy4Foe.mjs";import"node:url";import"node:fs";import"fs";import"os";import"path";import"./index-DE3OBZuV.mjs";import"esbuild";import"node:net";import"./index-Bqjv9TxC.mjs";import"node:util";import"node:fs/promises";export{k as globalPreload,q as initialize,u as load,w as resolve};
+1
View File
@@ -0,0 +1 @@
var r="4.23.15";export{r as v};
+1
View File
@@ -0,0 +1 @@
"use strict";var i=Object.defineProperty;var a=(r,t)=>i(r,"name",{value:t,configurable:!0});var n=require("node:repl"),u=require("esbuild");const f=a(r=>{const{eval:t}=r,c=a(async function(e,l,s,o){try{e=(await u.transform(e,{sourcefile:s,loader:"ts",tsconfigRaw:{compilerOptions:{preserveValueImports:!0}},define:{require:"global.require"}})).code}catch{}return t.call(this,e,l,s,o)},"preEval");r.eval=c},"patchEval"),{start:p}=n;n.start=function(){const r=Reflect.apply(p,this,arguments);return f(r),r};
+1
View File
@@ -0,0 +1 @@
"use strict";var p=Object.defineProperty;var c=(r,s)=>p(r,"name",{value:s,configurable:!0});var f=require("node:os"),h=require("node:worker_threads"),q=require("./client-XItNFmsq.cjs");require("./suppress-warnings.cjs"),require("node:net"),require("node:path");const H=c((r,s)=>{const i=new Map;for(const e of r){const n=c(t=>{s(t),process.listenerCount(e)===0&&process.exit(128+f.constants.signals[e])},"hiddenHandler");process.prependListener(e,n),i.set(e,n)}const{listenerCount:l,listeners:u}=process;process.listenerCount=function(e){let n=Reflect.apply(l,this,arguments);const t=i.get(e),o=arguments[1],a=l.length===1||arguments.length<2||o===void 0||o===null;if(t&&(a||o===t)){const d=Reflect.apply(u,this,[e]).filter(g=>g===t).length;n-=d}return n},process.listeners=function(e){const n=Reflect.apply(u,this,arguments);return r.includes(e)?n.filter(t=>t!==i.get(e)):n}},"bindHiddenSignalsHandler");h.isMainThread&&(require("./cjs/index.cjs"),(async()=>{const r=await q.connectingToServer;r&&H(["SIGINT","SIGTERM"],s=>{r({type:"signal",signal:s})})})());
+23
View File
File diff suppressed because one or more lines are too long
+2
View File
File diff suppressed because one or more lines are too long
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env node
var m=Object.defineProperty;var t=(o,r)=>m(o,"name",{value:r,configurable:!0});import p from"node:repl";import{v as l}from"./package-Dj0mHsMt.mjs";import{t as c}from"./index-DE3OBZuV.mjs";import"node:path";import"node:url";import"esbuild";import"node:crypto";import"./temporary-directory-Du7LpLp9.mjs";import"node:os";import"node:fs";console.log(`Welcome to tsx v${l} (Node.js ${process.version}).
Type ".help" for more information.`);const s=p.start(),{eval:f}=s,v=t(async function(o,r,e,i){const n=await c(o,e,{loader:"ts",tsconfigRaw:{compilerOptions:{preserveValueImports:!0}},define:{require:"global.require"}}).catch(a=>(console.log(a.message),{code:`
`}));return f.call(this,n.code,r,e,i)},"preEval");s.eval=v;
+10
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
"use strict";var u=Object.defineProperty;var s=(r,t)=>u(r,"name",{value:t,configurable:!0});var n=require("./register-B1c7OH6V.cjs");let e;const i=s((r,t)=>(e||(e=n.register({namespace:Date.now().toString()})),e.require(r,t)),"tsxRequire"),a=s((r,t,o)=>(e||(e=n.register({namespace:Date.now().toString()})),e.resolve(r,t,o)),"resolve");a.paths=require.resolve.paths,i.resolve=a,i.main=require.main,i.extensions=require.extensions,i.cache=require.cache,exports.tsxRequire=i;
+1
View File
@@ -0,0 +1 @@
"use strict";const a=new Set(["Custom ESM Loaders is an experimental feature. This feature could change at any time","Custom ESM Loaders is an experimental feature and might change at any time","Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js."]),{emit:n}=process;process.emit=function(e,t){if(!(e==="warning"&&a.has(t.message)))return Reflect.apply(n,this,arguments)};
+1
View File
@@ -0,0 +1 @@
var c=Object.defineProperty;var r=(s,t)=>c(s,"name",{value:t,configurable:!0});import m from"node:path";import n from"node:os";const i=r((s,t)=>{const e=s[0]-t[0];if(e===0){const o=s[1]-t[1];return o===0?s[2]>=t[2]:o>0}return e>0},"isVersionGreaterOrEqual"),u=process.versions.node.split(".").map(Number),p=r((s,t=u)=>{for(let e=0;e<s.length;e+=1){const o=s[e];if(e===s.length-1||t[0]===o[0])return i(t,o)}return!1},"isFeatureSupported"),d=[[18,19,0],[20,6,0]],f=[[22,22,3],[24,11,1],[25,1,0],[26,0,0]],l=[[18,19,0],[20,10,0],[21,0,0]],g=[[21,0,0]],R=[[20,11,0],[21,3,0]],b=[[20,11,0],[21,2,0]],h=[[20,19,0],[22,12,0],[23,0,0]],{geteuid:a}=process,j=a?a():n.userInfo().username,q=m.join(n.tmpdir(),`tsx-${j}`);export{d as a,l as b,b as c,g as d,R as e,p as i,f as m,h as r,q as t};
+70
View File
@@ -0,0 +1,70 @@
{
"name": "tsx",
"version": "4.23.15",
"description": "TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM files",
"keywords": [
"cli",
"runtime",
"node",
"cjs",
"commonjs",
"esm",
"typescript",
"typescript runner"
],
"license": "MIT",
"repository": "privatenumber/tsx",
"author": {
"name": "Hiroki Osame",
"email": "hiroki.osame@gmail.com"
},
"files": [
"dist"
],
"type": "module",
"bin": "./dist/cli.mjs",
"exports": {
"./package.json": "./package.json",
".": "./dist/loader.mjs",
"./patch-repl": "./dist/patch-repl.cjs",
"./cjs": "./dist/cjs/index.cjs",
"./cjs/api": {
"import": {
"types": "./dist/cjs/api/index.d.mts",
"default": "./dist/cjs/api/index.mjs"
},
"require": {
"types": "./dist/cjs/api/index.d.cts",
"default": "./dist/cjs/api/index.cjs"
}
},
"./esm": "./dist/esm/index.mjs",
"./esm/api": {
"import": {
"types": "./dist/esm/api/index.d.mts",
"default": "./dist/esm/api/index.mjs"
},
"require": {
"types": "./dist/esm/api/index.d.cts",
"default": "./dist/esm/api/index.cjs"
}
},
"./cli": "./dist/cli.mjs",
"./suppress-warnings": "./dist/suppress-warnings.cjs",
"./preflight": "./dist/preflight.cjs",
"./repl": "./dist/repl.mjs"
},
"imports": {
"#cjs-loader": "./dist/cjs/index.cjs"
},
"homepage": "https://tsx.hirok.io",
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
"esbuild": "~0.28.0"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
}
}