ts-blank-space
loader hook that doesn't make tsc
run first #2651
Description
What is the Problem Being Solved?
With #2415 we added support for .ts
in bundle source. However people also want to use .ts
when running scripts in Node.js. Since support for native .ts support in Node.js is still experimental and not widely available, the alternative is to use the ts-blank-space/register
loader hook. However that hook runs ts-blank-space
and tsc
as first run script, open the TCB to compromise.
Description of the Design
-
Provide an alternative loader hook that loads
ts-blank-space
and itstsc
dependency in a separate worker. -
Remove the fallback resolution to lookup for
.ts
files when a.js
file fails to resolve, and potentially only resolve.ts
files if the file is not innode_modules
, aligning with the experimental Node.js behavior.
Security Considerations
Users would still have to trust ts-blank-space
and tsc
to not transform their .ts
code beyond the intended type stripping, but the import and evaluation of any .js
file would remain unaffected.
Scaling Considerations
Shuffling large strings over a worker boundary might be expensive.
Test Plan
TBD
Compatibility Considerations
This would likely be a new package of @endo
that depends on ts-blank-space
.
Upgrade Considerations
None