Closed iuroc closed 2 months ago
How is this PR going ? I'm interested in using tsx in my CLI development process
This is a breaking change so it can't be released until the next major. But also, this work is already queued for v5. This PR was made without a heads up. The timeline for v5 is not known yet.
If you use tsx, the best way to get more development on it is to fund it. Currently, it barely gets funding so I struggle to justify investing more time into it.
I understand your point, and this is indeed a breaking change that needs to wait for the next major release. However, this change is currently causing issues when used alongside concurrently
, so I'll have to find an alternative workaround until v5 is released.
@privatenumber thank you for your answer, I totally understand your point.
Add --on-return-key flag to conditionally enable Return key listener
--on-return-key
flag to thewatch
command for optional Return key press handling.process.stdin.on('data')
listener based on the flag.--on-return-key
may cause issues withconcurrently "tsx watch some.ts"
whensome.ts
imports/requireprocess
. Specifically, ifsome.ts
includesimport mysql from "mysql2"
andconsole.log(mysql)
, it may block execution at theimport
statement and not correctly print the content.concurrently -r
.This change allows users to control whether the script should trigger a re-run on Return key press, providing more flexibility in how the
watch
command operates.Below is an example demonstrating why the
onReturnKey
parameter is needed.Create
1.js
:Create
2.js
:Create
3.js
:Here are the execution results:
Running
1.js
:Running
2.js
:Running
3.js
:Analysis
1.js
and2.js
both output correctly.process.stdin.on('data',)
event causes2.js
to enter a waiting input blocking state after printing.node 3.js
, the terminal only outputs1
and not2
, indicating that execution is stuck atrequire('process')
in1.js
, and the subsequent code does not execute.process.stdin.on('data',)
from2.js
require("process")
from1.js
stdio
in3.js
to['inherit', 'inherit', 'inherit']
and removeprocess.stdin.on('data',)
tsx watch
also usesprocess.stdin.on('data',)
(src/watch/index.ts#L219), which is whyconcurrently "tsx watch xxx.ts"
will causexxx.ts
and all its imported modules to be stuck at therequire("process")
line, with subsequent code not executing.