tsx 4.7.2 → 4.8.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.
Files changed (47) hide show
  1. package/README.md +18 -387
  2. package/dist/cjs/api/index.cjs +1 -0
  3. package/dist/cjs/api/index.d.ts +16 -0
  4. package/dist/cjs/api/index.mjs +1 -0
  5. package/dist/cjs/index.cjs +1 -1
  6. package/dist/cjs/index.mjs +1 -1
  7. package/dist/cli.cjs +19 -19
  8. package/dist/cli.mjs +24 -24
  9. package/dist/client-SVJjVqAT.mjs +1 -0
  10. package/dist/client-SVUnbl6F.cjs +1 -0
  11. package/dist/esm/index.cjs +3 -3
  12. package/dist/esm/index.mjs +3 -3
  13. package/dist/get-pipe-path-BYPSsSrX.mjs +1 -0
  14. package/dist/get-pipe-path-d1K0T1_d.cjs +1 -0
  15. package/dist/global-require-patch-C2TgBHwk.mjs +1 -0
  16. package/dist/global-require-patch-DwclVG7F.cjs +1 -0
  17. package/dist/index-Y28eoCXz.mjs +17 -0
  18. package/dist/index-z1p1GHes.cjs +17 -0
  19. package/dist/is-relative-path-pattern-B4sgw8uQ.mjs +1 -0
  20. package/dist/is-relative-path-pattern-D6NaPCaG.cjs +1 -0
  21. package/dist/loader.cjs +1 -1
  22. package/dist/loader.mjs +1 -1
  23. package/dist/package-BYhp9Pt0.cjs +1 -0
  24. package/dist/package-DFsgOPTf.mjs +1 -0
  25. package/dist/preflight.cjs +1 -1
  26. package/dist/preflight.mjs +1 -1
  27. package/dist/repl.cjs +1 -1
  28. package/dist/repl.mjs +1 -1
  29. package/dist/source-map.cjs +2 -2
  30. package/dist/source-map.mjs +2 -2
  31. package/package.json +7 -3
  32. package/dist/client-2f0df4a6.cjs +0 -1
  33. package/dist/client-e665d820.mjs +0 -1
  34. package/dist/get-pipe-path-86e97fc9.cjs +0 -1
  35. package/dist/get-pipe-path-b74d9893.mjs +0 -1
  36. package/dist/index-29948669.mjs +0 -17
  37. package/dist/index-971a6964.cjs +0 -17
  38. package/dist/package-b4429ca9.cjs +0 -1
  39. package/dist/package-d30db59e.mjs +0 -1
  40. package/dist/resolve-ts-path-3fca13b7.cjs +0 -1
  41. package/dist/resolve-ts-path-eb3847f5.mjs +0 -1
  42. /package/dist/{node-features-c450ed54.cjs → node-features-CKvB621_.cjs} +0 -0
  43. /package/dist/{node-features-fb266590.mjs → node-features-Dcn4STxq.mjs} +0 -0
  44. /package/dist/{pkgroll_create-require-c530e400.cjs → pkgroll_create-require-B-Pljx_-.cjs} +0 -0
  45. /package/dist/{pkgroll_create-require-b92e8e0d.mjs → pkgroll_create-require-CddX1PP_.mjs} +0 -0
  46. /package/dist/{temporary-directory-04b36185.mjs → temporary-directory-C5UVr6xa.mjs} +0 -0
  47. /package/dist/{temporary-directory-2a027842.cjs → temporary-directory-CoGR4SrV.cjs} +0 -0
package/README.md CHANGED
@@ -1,401 +1,32 @@
1
- # tsx <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> <a href="https://packagephobia.now.sh/result?p=tsx"><img src="https://packagephobia.now.sh/badge?p=tsx"></a>
1
+ <h1 align="center">
2
+ tsx
3
+ <br>
4
+ <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>
5
+ </h1>
2
6
 
3
- _TypeScript Execute (tsx)_: The easiest way to run TypeScript in Node.js
7
+ <p align="center">
8
+ TypeScript Execute (tsx): The easiest way to run TypeScript in Node.js
9
+ <br><br>
10
+ <a href="https://tsx.is">Documentation</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://tsx.is/getting-started">Getting started →</a>
11
+ </p>
4
12
 
5
- ### Features
6
- - Super fast!
7
- - TypeScript REPL
8
- - Supports `tsconfig.json` [`paths`](https://www.typescriptlang.org/tsconfig#paths)
9
- - Works in both [CommonJS and ESM packages](https://nodejs.org/api/packages.html#type)
13
+ <br>
14
+
15
+ <p align="center">
16
+ <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>
17
+ <a href="https://github.com/sponsors/privatenumber/sponsorships?tier_id=397608"><img width="412" src="https://raw.githubusercontent.com/privatenumber/sponsors/master/banners/assets/sponsor.webp"></a>
18
+ </p>
19
+ <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>
10
20
 
11
21
  > [!TIP]
12
22
  > **Build your TypeScript projects?**
13
23
  >
14
- > Try [<img width="20" valign="middle" src="https://github.com/privatenumber/pkgroll/raw/develop/.github/logo.webp"> pkgroll](https://github.com/privatenumber/pkgroll)—the zero-config package bundler used by _tsx_!
24
+ > Try [<img width="20" valign="middle" src="https://raw.githubusercontent.com/privatenumber/pkgroll/master/.github/logo.webp"> pkgroll](https://github.com/privatenumber/pkgroll)—the zero-config package bundler used by _tsx_!
15
25
  >
16
26
  > _pkgroll_ is a thin Rollup wrapper that makes it so simple for your package to support CommonJS, ESM, & TypeScript.
17
27
  >
18
28
  > If you love tsx, you'll love pkgroll too!
19
29
 
20
- <br>
21
-
22
- <p align="center">
23
- <a href="https://privatenumber-sponsors.vercel.app/api/sponsor?tier=platinum">
24
- <picture>
25
- <source width="830" media="(prefers-color-scheme: dark)" srcset="https://privatenumber-sponsors.vercel.app/api/sponsor?tier=platinum&image=dark">
26
- <source width="830" media="(prefers-color-scheme: light)" srcset="https://privatenumber-sponsors.vercel.app/api/sponsor?tier=platinum&image">
27
- <img width="830" src="https://privatenumber-sponsors.vercel.app/api/sponsor?tier=platinum&image" alt="Premium sponsor banner">
28
- </picture>
29
- </a>
30
- </p>
31
-
32
- ## About
33
- `tsx` is a CLI command you can use just like you would use `node`:
34
-
35
- <table>
36
- <tr>
37
- <th>Before</th>
38
- <th>After</th>
39
- </tr>
40
- <tr>
41
- <td>
42
-
43
- ```sh
44
- node file.js
45
- ```
46
-
47
- </td>
48
- <td>
49
-
50
- ```sh
51
- tsx file.js
52
- ```
53
-
54
- </td>
55
- </tr>
56
- </table>
57
-
58
-
59
- Use it to enhance your Node.js experience:
60
- - _Just run_ TypeScript code without configuration
61
- - Seamless integration between CommonJS and ES Modules
62
-
63
- You'll never get the following error again:
64
-
65
- ```
66
- Error [ERR_REQUIRE_ESM]: require() of ES Module <ESM package> from ./file.js not supported.
67
- Instead change the require of <ESM package> in ./file.js to a dynamic import() which is available in all CommonJS modules.
68
- ```
69
-
70
- ### ⚡️ Quick start
71
- Try it out without setup using [npx](https://docs.npmjs.com/cli/v8/commands/npx)! Just pass in a TypeScript file:
72
-
73
- ```sh
74
- npx tsx ./script.ts
75
- ```
76
-
77
- ## Installation
78
-
79
- ### Local installation
80
-
81
- To add tsx to an npm project as a development dependency:
82
- ```sh
83
- npm install --save-dev tsx
84
- ```
85
-
86
- You can reference it directly in the `package.json#scripts` object (you don't need `npx` here):
87
- ```json5
88
- {
89
- "scripts": {
90
- "dev": "tsx ./file.ts"
91
- }
92
- }
93
- ```
94
-
95
- To use the binary, you can call it with [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) while in the project directory:
96
-
97
- ```sh
98
- npx tsx ...
99
- ```
100
-
101
- ### Global installation
102
-
103
- If you want to use tsx anywhere on your computer without [`npx`](https://docs.npmjs.com/cli/v8/commands/npx), install it globally:
104
-
105
- ```sh
106
- npm install --global tsx
107
- ```
108
-
109
- Then, you can call `tsx` directly:
110
-
111
- ```sh
112
- tsx file.ts
113
- ```
114
-
115
- Now you can replace `node ...` with `tsx ...` in all your commands!
116
-
117
- ## Usage
118
-
119
- ### Swap `node` out for `tsx`
120
-
121
- _tsx_ is an enhanced version of Node.js. If you have a `node ...` command, you can replace the `node` with `tsx` and it will just work.
122
-
123
- Because it's a drop-in replacement for `node`, it supports all [Node.js command-line flags](https://nodejs.org/docs/latest-v20.x/api/cli.html).
124
-
125
- ```sh
126
- # Old command
127
- node --no-warnings --env-file=.env ./file.js
128
-
129
- # New command
130
- tsx --no-warnings --env-file=.env ./file.js
131
- ```
132
-
133
- #### Custom `tsconfig.json` path
134
- By default, `tsconfig.json` will be detected from the current working directory.
135
-
136
- To set a custom path, use the `--tsconfig` flag:
137
-
138
- ```sh
139
- tsx --tsconfig ./path/to/tsconfig.custom.json ./file.ts
140
- ```
141
-
142
- Alternatively, use the `TSX_TSCONFIG_PATH` environment variable:
143
-
144
- ```sh
145
- TSX_TSCONFIG_PATH=./path/to/tsconfig.custom.json tsx ./file.ts
146
- ```
147
-
148
- ### Watch mode
149
- Run file and automatically rerun on changes:
150
-
151
- ```sh
152
- tsx watch ./file.ts
153
- ```
154
-
155
- All imported files are watched except from the following directories:
156
- `node_modules`, `bower_components`, `vendor`, `dist`, and `.*` (hidden directories).
157
-
158
- #### Ignore files from watch
159
-
160
- To exclude files from being watched, pass in a path or glob to the `--ignore` flag:
161
- ```sh
162
- tsx watch --ignore ./ignore-me.js --ignore ./ignore-me-too.js ./file.ts
163
- ```
164
-
165
- #### Tips
166
- - Press <kbd>Return</kbd> to manually rerun
167
- - Pass in `--clear-screen=false` to disable clearing the screen on rerun
168
-
169
- ### REPL
170
- Start a TypeScript REPL by running with no arguments:
171
-
172
- ```sh
173
- tsx
174
- ```
175
-
176
- ### Cache
177
- Modules transformations are cached in the system cache directory ([`TMPDIR`](https://en.wikipedia.org/wiki/TMPDIR)). Transforms are cached by content hash, so duplicate dependencies are not re-transformed.
178
-
179
- Set the `--no-cache` flag to disable the cache:
180
-
181
- ```sh
182
- tsx --no-cache ./file.ts
183
- ```
184
-
185
- Alternatively, use the `TSX_DISABLE_CACHE` environment variable:
186
-
187
- ```sh
188
- TSX_DISABLE_CACHE=1 tsx ./file.ts
189
- ```
190
-
191
- ### Node.js Loader
192
-
193
- `tsx` is a standalone binary designed to be used in place of `node`, but sometimes you'll want to use `node` directly. For example, when adding TypeScript & ESM support to npm-installed binaries.
194
-
195
- To use `tsx` as a Node.js loader, pass it in to the [`--import`](https://nodejs.org/api/module.html#enabling) flag. This will add TypeScript & ESM support for both Module and CommonJS contexts.
196
-
197
- ```sh
198
- node --import tsx ./file.ts
199
- ```
200
-
201
- Or as an environment variable:
202
- ```sh
203
- NODE_OPTIONS='--import tsx' node ./file.ts
204
- ```
205
-
206
- > **Note:** The loader is limited to adding support for loading TypeScript/ESM files. CLI features such as _watch mode_ or suppressing "experimental feature" warnings will not be available.
207
-
208
- #### ESM only loader
209
-
210
- If you only need to add TypeScript support in a Module context, you can use the ESM loader:
211
-
212
- ##### Node.js v20.6.0 and above
213
- ```sh
214
- node --import tsx/esm ./file.ts
215
- ```
216
-
217
- ##### Node.js v20.5.1 and below
218
-
219
- ```sh
220
- node --loader tsx/esm ./file.ts
221
- ```
222
-
223
- #### CommonJS only loader
224
- If you only need to add TypeScript & ESM support in a CommonJS context, you can use the CJS loader:
225
-
226
- ```sh
227
- node --require tsx/cjs ./file.ts
228
- ```
229
-
230
- ### Hashbang
231
-
232
- If you prefer to write scripts that doesn't need to be passed into tsx, you can declare it in the [hashbang](https://bash.cyberciti.biz/guide/Shebang).
233
-
234
- Simply add `#!/usr/bin/env tsx` at the top of your file:
235
-
236
- _file.ts_
237
- ```ts
238
- #!/usr/bin/env tsx
239
-
240
- console.log('argv:', process.argv.slice(2))
241
- ```
242
-
243
- And make the file executable:
244
- ```sh
245
- chmod +x ./file.ts
246
- ```
247
-
248
- Now, you can run the file without passing it into tsx:
249
- ```sh
250
- $ ./file.ts hello
251
- argv: [ 'hello' ]
252
- ```
253
-
254
- ### VS Code debugging
255
-
256
- #### Setup
257
-
258
- Create the following configuration file in your project to setup debugging in VS Code:
259
-
260
- `.vscode/launch.json`
261
- ```json5
262
- {
263
- "version": "0.2.0",
264
-
265
- "configurations": [
266
- /*
267
- Each config in this array is an option in the debug drop-down
268
- See below for configurations to add...
269
- */
270
- ],
271
- }
272
- ```
273
-
274
- #### Debugging method 1: Run tsx directly from VSCode
275
-
276
- 1. Add the following configuration to the `configurations` array in `.vscode/launch.json`:
277
- ```json5
278
- {
279
- "name": "tsx",
280
- "type": "node",
281
- "request": "launch",
282
-
283
- // Debug current file in VSCode
284
- "program": "${file}",
285
-
286
- /*
287
- Path to tsx binary
288
- Assuming locally installed
289
- */
290
- "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/tsx",
291
-
292
- /*
293
- Open terminal when debugging starts (Optional)
294
- Useful to see console.logs
295
- */
296
- "console": "integratedTerminal",
297
- "internalConsoleOptions": "neverOpen",
298
-
299
- // Files to exclude from debugger (e.g. call stack)
300
- "skipFiles": [
301
- // Node.js internal core modules
302
- "<node_internals>/**",
303
-
304
- // Ignore all dependencies (optional)
305
- "${workspaceFolder}/node_modules/**",
306
- ],
307
- }
308
- ```
309
-
310
- 2. In VSCode, open the file you want to run
311
-
312
- 3. Go to VSCode's debug panel, select "tsx" in the drop down, and hit the play button (<kbd>F5</kbd>).
313
-
314
- #### Debugging method 2: Attach to a running Node.js process
315
-
316
- > This method works for any Node.js process and it's not specific to tsx
317
-
318
- 1. Add the following configuration to the `configurations` array in `.vscode/launch.json`:
319
- ```json
320
- {
321
- "name": "Attach to process",
322
- "type": "node",
323
- "request": "attach",
324
- "port": 9229,
325
- "skipFiles": [
326
- // Node.js internal core modules
327
- "<node_internals>/**",
328
-
329
- // Ignore all dependencies (optional)
330
- "${workspaceFolder}/node_modules/**",
331
- ],
332
- }
333
- ```
334
- 2. Run tsx with `--inspect-brk` in a terminal window:
335
-
336
- ```sh
337
- tsx --inspect-brk ./your-file.ts
338
- ```
339
-
340
- 3. Go to VSCode's debug panel, select "Attach to process" in the drop down, and hit the play button (<kbd>F5</kbd>).
341
-
342
- See the [VSCode documentation on _Launch Configuration_](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_launch-configuration) for more information.
343
-
344
- ## Contributing & Support
345
-
346
- If you're interested in contributing, please check out the [Contribution Guide](/CONTRIBUTING.md). Your collaboration will be greatly appreciated!
347
-
348
- If you're encountering a problem, take advantage of my [_Priority Support_ service](https://github.com/sponsors/privatenumber) for as little as $25. I'd be happy to help you out! 🙂
349
-
350
- ## FAQ
351
-
352
- ### Why is it named _tsx_?
353
-
354
- `tsx` stands for "TypeScript execute". Mirroring [`npx`](https://docs.npmjs.com/cli/v8/commands/npx), which stands for "Node.js package execute".
355
-
356
- The 3-character package name offers an elegant developer experience, allowing usage like: `npx tsx ...`.
357
-
358
- Unfortunately, it overlaps with React's [TSX/JSX](https://www.typescriptlang.org/docs/handbook/jsx.html), which stands for "TypeScript XML".
359
-
360
- ### Does it type check the code it runs?
361
-
362
- No. tsx is designed to be a simple TypeScript runner.
363
-
364
- If you need type-checking, you can use an IDE like [VS Code](https://code.visualstudio.com) and it will type-check as you code via [IntelliSense](https://code.visualstudio.com/docs/languages/typescript). Alternatively, you can run the TypeScript Compiler only for type-checking (e.g. `tsc --noEmit`) as a linting step.
365
-
366
- ### How is `tsx` different from [`ts-node`](https://github.com/TypeStrong/ts-node)?
367
-
368
- `tsx` and `ts-node` are both designed for executing TypeScript files in Node.js, but offer different approaches to suit user preferences.
369
-
370
- - **Simple installation** tsx is offered as a single binary without peer dependencies, and can be used without installation: `npx tsx ./script.ts`. In comparison, `ts-node` requires installing TypeScript or SWC as peer dependencies.
371
-
372
- - **Zero configuration** tsx _just works_. It doesn't require initial setup or a `tsconfig.json` file, and doesn't get in the way of running your code.
373
-
374
- - **Sensible defaults** tsx employs sensible defaults based on file imports and Node.js version, removing the need for certain `tsconfig.json` settings (that are designed for compilation rather than runtime). In comparison, ts-node relies on TypeScript's defaults (e.g. [`ES3` target](https://www.typescriptlang.org/tsconfig#target)), which may be outdated.
375
-
376
- - **Module adaptability** tsx automatically adapts between CommonJS and ESM modules, even supporting `require()` of ESM modules, facilitating a smoother transition as the Node.js ecosystem evolves.
377
-
378
- - **Enhancements** tsx gracefully handles [new JS & TS syntax](https://esbuild.github.io/content-types/) and features based on the Node.js version. It also supports [`tsconfig.json` paths](https://www.typescriptlang.org/tsconfig#paths) out of the box.
379
-
380
- - **Speed** tsx utilizes [esbuild](https://esbuild.github.io/faq/#:~:text=typescript%20benchmark) to achieve rapid TypeScript compilation. In comparison, ts-node uses the TypeScript compiler by default. Because tsx doesn't type check, it's similar to `ts-node --esm --swc` (which uses the [SWC compiler](https://github.com/TypeStrong/ts-node#swc-1)).
381
-
382
- - **Watcher** As a DX bonus, tsx also comes with watch mode to help you iterate faster!
383
-
384
- For a detailed technical comparison, you can refer to this [exhaustive comparison](https://github.com/privatenumber/ts-runtime-comparison) between `tsx`, `ts-node`, and other runtimes.
385
-
386
- ### Does it have a configuration file?
387
-
388
- No. tsx's integration with Node.js is designed to be simple & seamless. However, it supports a few properties from `tsconfig.json` to determine how to compile TypeScript files.
389
-
390
- ### Does it have any limitations?
391
-
392
- TypeScript & ESM transformations are handled by [esbuild](https://esbuild.github.io/), so it shares the same limitations such as:
393
-
394
- - Compatibility with code executed via `eval()` is not preserved
395
- - Only [certain `tsconfig.json` properties](https://esbuild.github.io/content-types/#tsconfig-json) are supported
396
- - [`emitDecoratorMetadata`](https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata) is not supported
397
-
398
- For details, refer to esbuild's [JavaScript caveats](https://esbuild.github.io/content-types/#javascript-caveats) and [TypeScript caveats](https://esbuild.github.io/content-types/#typescript-caveats) documentation.
399
30
 
400
31
  ## Sponsors
401
32
 
@@ -0,0 +1 @@
1
+ "use strict";var t=require("../../pkgroll_create-require-B-Pljx_-.cjs"),n=require("../../global-require-patch-DwclVG7F.cjs"),q=require("path"),c=require("url");require("module"),require("fs"),require("get-tsconfig"),require("../../index-z1p1GHes.cjs"),require("esbuild"),require("crypto"),require("os"),require("../../temporary-directory-CoGR4SrV.cjs"),require("../../source-map.cjs"),require("../../client-SVUnbl6F.cjs"),require("net"),require("../../get-pipe-path-d1K0T1_d.cjs"),require("../../is-relative-path-pattern-D6NaPCaG.cjs");const a=(r,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(typeof e=="string"&&e.startsWith("file://")||e instanceof URL)&&(e=c.fileURLToPath(e)),q.resolve(q.dirname(e),r)},i=(r,e)=>{const u=a(r,e),s=n.register();try{return t.require(u)}finally{s()}},o=(r,e,u)=>{const s=a(r,e);return n.resolveFilename(s,module,!1,u)};o.paths=t.require.resolve.paths,i.resolve=o,i.main=t.require.main,i.extensions=t.require.extensions,i.cache=t.require.cache,exports.register=n.register,exports.require=i;
@@ -0,0 +1,16 @@
1
+ declare const register: () => () => void;
2
+
3
+ declare const tsxRequire: {
4
+ (id: string, fromFile: string | URL): any;
5
+ resolve: {
6
+ (id: string, fromFile: string | URL, options?: {
7
+ paths?: string[] | undefined;
8
+ }): string;
9
+ paths: (request: string) => string[] | null;
10
+ };
11
+ main: NodeJS.Module | undefined;
12
+ extensions: NodeJS.RequireExtensions;
13
+ cache: NodeJS.Dict<NodeModule>;
14
+ };
15
+
16
+ export { register, tsxRequire as require };
@@ -0,0 +1 @@
1
+ import{r as e}from"../../pkgroll_create-require-CddX1PP_.mjs";import{r as n,a as c}from"../../global-require-patch-C2TgBHwk.mjs";import m from"path";import{fileURLToPath as u}from"url";import"module";import"fs";import"get-tsconfig";import"../../index-Y28eoCXz.mjs";import"esbuild";import"crypto";import"os";import"../../temporary-directory-C5UVr6xa.mjs";import"../../source-map.mjs";import"../../client-SVJjVqAT.mjs";import"net";import"../../get-pipe-path-BYPSsSrX.mjs";import"../../is-relative-path-pattern-B4sgw8uQ.mjs";const p=(r,t)=>{if(!t)throw new Error("The current file path (__filename or import.meta.url) must be provided in the second argument of tsx.require()");return(typeof t=="string"&&t.startsWith("file://")||t instanceof URL)&&(t=u(t)),m.resolve(m.dirname(t),r)},o=(r,t)=>{const i=p(r,t),s=n();try{return e(i)}finally{s()}},a=(r,t,i)=>{const s=p(r,t);return c(s,module,!1,i)};a.paths=e.resolve.paths,o.resolve=a,o.main=e.main,o.extensions=e.extensions,o.cache=e.cache;export{n as register,o as require};
@@ -1 +1 @@
1
- "use strict";var f=require("path"),P=require("fs"),a=require("module"),l=require("get-tsconfig"),g=require("../source-map.cjs"),d=require("../index-971a6964.cjs"),j=require("../resolve-ts-path-3fca13b7.cjs"),q=require("../client-2f0df4a6.cjs");require("url"),require("esbuild"),require("crypto"),require("os"),require("../temporary-directory-2a027842.cjs"),require("net"),require("../get-pipe-path-86e97fc9.cjs");const E=s=>{if(s.includes("import")||s.includes("export"))try{return d.parseEsm(s)[3]}catch{return!0}return!1},M=/^\.{1,2}\//,O=/\.[cm]?tsx?$/,A=`${f.sep}node_modules${f.sep}`,u=process.env.TSX_TSCONFIG_PATH?{path:f.resolve(process.env.TSX_TSCONFIG_PATH),config:l.parseTsconfig(process.env.TSX_TSCONFIG_PATH)}:l.getTsconfig(),p=u&&l.createFilesMatcher(u),x=u&&l.createPathsMatcher(u),y=g.installSourceMapSupport(),m=a._extensions,N=m[".js"],R=[".cts",".mts",".ts",".tsx",".jsx"],b=[".js",".cjs",".mjs"];let v;q.connectingToServer.then(s=>{v=s},()=>{});const S=(s,e)=>{v&&v({type:"dependency",path:e});const n=R.some(r=>e.endsWith(r)),o=b.some(r=>e.endsWith(r));if(!n&&!o)return N(s,e);let t=P.readFileSync(e,"utf8");if(e.endsWith(".cjs")){const r=d.transformDynamicImport(e,t);r&&(t=y(r))}else if(n||E(t)){const r=d.transformSync(t,e,{tsconfigRaw:p==null?void 0:p(e)});t=y(r)}s._compile(t,e)};[".js",".ts",".tsx",".jsx"].forEach(s=>{m[s]=S}),Object.defineProperty(m,".mjs",{value:S,enumerable:!1});const T=a._resolveFilename.bind(a);a._resolveFilename=(s,e,n,o)=>{var t;const r=s.indexOf("?");if(r!==-1&&(s=s.slice(0,r)),x&&!M.test(s)&&!((t=e==null?void 0:e.filename)!=null&&t.includes(A))){const i=x(s);for(const h of i){const _=F(h,e,n,o);if(_)return _;try{return T(h,e,n,o)}catch{}}}const c=F(s,e,n,o);return c||T(s,e,n,o)};const F=(s,e,n,o)=>{const t=j.resolveTsPath(s);if(e!=null&&e.filename&&O.test(e.filename)&&t)for(const r of t)try{return T(r,e,n,o)}catch(c){const{code:i}=c;if(i!=="MODULE_NOT_FOUND"&&i!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw c}};
1
+ "use strict";var e=require("../global-require-patch-DwclVG7F.cjs");require("module"),require("fs"),require("get-tsconfig"),require("../index-z1p1GHes.cjs"),require("url"),require("esbuild"),require("crypto"),require("path"),require("os"),require("../temporary-directory-CoGR4SrV.cjs"),require("../source-map.cjs"),require("../client-SVUnbl6F.cjs"),require("net"),require("../get-pipe-path-d1K0T1_d.cjs"),require("../is-relative-path-pattern-D6NaPCaG.cjs"),e.register();
@@ -1 +1 @@
1
- import f from"path";import x from"fs";import m from"module";import{parseTsconfig as F,getTsconfig as j,createFilesMatcher as E,createPathsMatcher as O}from"get-tsconfig";import{installSourceMapSupport as P}from"../source-map.mjs";import{p as M,t as g,a as A}from"../index-29948669.mjs";import{r as N}from"../resolve-ts-path-eb3847f5.mjs";import{c as R}from"../client-e665d820.mjs";import"url";import"esbuild";import"crypto";import"os";import"../temporary-directory-04b36185.mjs";import"net";import"../get-pipe-path-b74d9893.mjs";const b=t=>{if(t.includes("import")||t.includes("export"))try{return M(t)[3]}catch{return!0}return!1},I=/^\.{1,2}\//,C=/\.[cm]?tsx?$/,D=`${f.sep}node_modules${f.sep}`,a=process.env.TSX_TSCONFIG_PATH?{path:f.resolve(process.env.TSX_TSCONFIG_PATH),config:F(process.env.TSX_TSCONFIG_PATH)}:j(),h=a&&E(a),_=a&&O(a),v=P(),l=m._extensions,G=l[".js"],H=[".cts",".mts",".ts",".tsx",".jsx"],X=[".js",".cjs",".mjs"];let p;R.then(t=>{p=t},()=>{});const y=(t,s)=>{p&&p({type:"dependency",path:s});const r=H.some(o=>s.endsWith(o)),n=X.some(o=>s.endsWith(o));if(!r&&!n)return G(t,s);let e=x.readFileSync(s,"utf8");if(s.endsWith(".cjs")){const o=g(s,e);o&&(e=v(o))}else if(r||b(e)){const o=A(e,s,{tsconfigRaw:h==null?void 0:h(s)});e=v(o)}t._compile(e,s)};[".js",".ts",".tsx",".jsx"].forEach(t=>{l[t]=y}),Object.defineProperty(l,".mjs",{value:y,enumerable:!1});const d=m._resolveFilename.bind(m);m._resolveFilename=(t,s,r,n)=>{var e;const o=t.indexOf("?");if(o!==-1&&(t=t.slice(0,o)),_&&!I.test(t)&&!((e=s==null?void 0:s.filename)!=null&&e.includes(D))){const i=_(t);for(const u of i){const T=S(u,s,r,n);if(T)return T;try{return d(u,s,r,n)}catch{}}}const c=S(t,s,r,n);return c||d(t,s,r,n)};const S=(t,s,r,n)=>{const e=N(t);if(s!=null&&s.filename&&C.test(s.filename)&&e)for(const o of e)try{return d(o,s,r,n)}catch(c){const{code:i}=c;if(i!=="MODULE_NOT_FOUND"&&i!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw c}};
1
+ import{r}from"../global-require-patch-C2TgBHwk.mjs";import"module";import"fs";import"get-tsconfig";import"../index-Y28eoCXz.mjs";import"url";import"esbuild";import"crypto";import"path";import"os";import"../temporary-directory-C5UVr6xa.mjs";import"../source-map.mjs";import"../client-SVJjVqAT.mjs";import"net";import"../get-pipe-path-BYPSsSrX.mjs";import"../is-relative-path-pattern-B4sgw8uQ.mjs";r();