Support npm:tsx (esbuild)
tsx - GitHub
This compiler is used many places in peoples package.json scripts, so it would be great if deno is able to execute it, until it's replaced with i.e. deno everywhere.
Platform
Darwin 22.6.0 arm64 arm
Version
deno 1.37.0
Repro
// index.ts
console.log("Print this");
deno run npm:tsx index.ts
It actually breaks even without a file provided, so just deno run npm:tsx;
Expected
> Print this
Actual
➜ deno run npm:tsx index.
error: Uncaught TypeError: ws.WriteStream.prototype.hasColors is not a function
at file:///Users/admin/repos/compile-with-tsx/node_modules/.deno/[email protected]/node_modules/tsx/dist/cli.js:18:332
https://github.com/privatenumber/tsx/blob/2c829258a6ca238b7a22c85cc8a09a531267d472/src/run.ts#L39-L40
tsx depends on --require with a preflight CJS.
The missing hasColors method error is resolved in main and it fails now with this error:
error: unexpected argument '--require' found
tip: a similar argument exists: '--quiet'
Usage: deno run --allow-all --quiet [SCRIPT_ARG]...
For more information, try '--help'.
deno 2.0.0-rc.2+aaf2bf4
> deno run -A npm:tsx index.ts
error: unexpected argument '--require' found
tip: to pass '--require' as a value, use '-- --require'
Usage: deno run [OPTIONS] [SCRIPT_ARG]...
@marvinhagemeister , is this likely to be upsteam issue with the flag similar to the tauri issue here?
- https://github.com/denoland/deno/issues/25904
I am experiencing similar issue with latest vitest (v4) on deno: https://github.com/h3js/srvx/pull/138 (reported to https://github.com/vitest-dev/vitest/issues/8896)