Files
ts-node/development-docs/rootDirOutDirMapping.md
f76bdf0954 Support .mts, .cts, nodenext, and node16 (#1694)
* feat: support .mts .cts

* stuff

* WIP with TODOs

* WIP

* lint-fix

* WIP

* WIP

* WIP

* fixes

* flatten resolver tests by splitting into more  functions

* address extension-handling code

* lint-fix

* Fix; update resolver tests to test more things

* fix

* fix

* test against TS rc on nodes 14, 16, 18 (good sanity-checking with these new nodenext features)

* Teach ts.transpileModule to handle NodeNext correctly

* tweak tests

* fix test typos; update pluggable dep tests; update ignore() tests for new file extensions

* fix tests

* fix

* fix build against stable ts, no need for 4.7.0 just yet

* Gate nodenext/node16 tests behind a TS version check; fix TSCommon types

* Fix nyc require.extensions issues

* lint-fix

* tricky types

* skip nodenext tests on older TS

* fix tests

* fix bug and tests

* fix windows

* turn off another test on ancient TS versions

* fix windows

* fix allowing `moduleTypeOverrides` to override cts/cjs

* Update moduleTypes docs

* add mts and cts awareness to internal/external classifier; add .d.cts/.d.mts extensions to tests

* cleanup misc markdown files

* more markdown cleanup

Co-authored-by: bluelovers <[email protected]>
2022-05-18 00:16:56 -04:00

790 B

Musings about resolving between rootDir and outDir

When /dist and /src are understood to be overlaid because of src -> dist compiling /dist/ /src/

Loop over require.extensions /src/foo.js /src/foo.mjs /src/foo.cjs /src/foo.ts /src/foo.mts /src/foo.cts /src/foo/index.js /src/foo/index.mjs /src/foo/index.ts // Where do we check package.json main??

/dist/foo.js /dist/foo.ts

_resolveLookupPaths _findPath _resolveFilename

_findPath calls resolveExports calls packageExportsResolve, which is in the ESM loader

Is anything within packageExportsResolve hooked/modified by us? File extension swapping?

When resolver calls statSync('./dist/foo.js') and we intercept and discover './src/foo.ts' How to redirect? We need to rewrite whatever local variable is storing ./dist/foo.js