You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ts-node-esm binary which spawns a subprocess with --loader ts-node/esm #1258
Should state that this feature exists solely to support esm use-cases. If spawning a child process is no longer necessary in the future because node adds an API for setting loaders, then this flag will stop spawning a child process.
Implementation ideas:
Parent process loads config, going only as far as is necessary to see that you specified "esm"
skip loading typescript & tsconfig.json if --esm already specified via CLI
Then it spawns a child process, setting env var TS_NODE_CHILD_ARGS=<base64encodedJSON> and NODE_OPTIONS="--loader ts-node/esm"
Child process detects TS_NODE_CHILD_ARGS, parses it, and immediately unsets it
Child continues config loading where parent left off
Child establishes both ESM and CJS hooks
Will entrypoint need to be resolved to absolute path before spawning child?
Is this resolution affected by config at all? hopefully not
Can we hack it since we're installed as a resolver? Replace it with ts-node-child:129365798 and detect that ID in our resolver?
Had an idea for suppressing the "experimental" warning from node. node's default warning logger is an event handler on the process 'warning' event.
When we launch the subprocess, we can pass -r ./suppress-warnings.cjs
It can do:
// Not shown here: Additional logic to correctly interact with process's events, either using this direct manipulation, or via the APIconstwarningEvent=process._events.warning;// TODO validate that this looks like node's built-in warning handler// TODO validate that this is not undefined, which might be caused by `--no-warnings`constmessageMatch=/--(?:experimental-)?loader\b/;process._events.warning=function(warning, ...rest){if(warning.name==='ExperimentalWarning'&&messageMatch.test(warning.message))return;returnwarningEvent.call(this,warning, ...rest);});
Activity
cspotcode commentedon May 23, 2021
Documentation:
Should state that this feature exists solely to support esm use-cases. If spawning a child process is no longer necessary in the future because node adds an API for setting loaders, then this flag will stop spawning a child process.
Implementation ideas:
Parent process loads config, going only as far as is necessary to see that you specified "esm"
typescript&tsconfig.jsonif--esmalready specified via CLIThen it spawns a child process, setting env var
TS_NODE_CHILD_ARGS=<base64encodedJSON>andNODE_OPTIONS="--loader ts-node/esm"Child process detects
TS_NODE_CHILD_ARGS, parses it, and immediately unsets itChild continues config loading where parent left off
Child establishes both ESM and CJS hooks
ts-node-child:129365798and detect that ID in our resolver?cspotcode commentedon Jan 27, 2022
Had an idea for suppressing the "experimental" warning from node. node's default warning logger is an event handler on the process 'warning' event.
When we launch the subprocess, we can pass
-r ./suppress-warnings.cjsIt can do:
Update dependency ts-node to v10.7.0 (#1200)