-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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]>
- Loading branch information
1 parent
cf93584
commit f34d874
Showing
35 changed files
with
1,894 additions
and
742 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
This directory contains a variety of documents: | ||
|
||
- notes | ||
- old to-do lists | ||
- design ideas from when I implemented various features | ||
- templates for drafting release notes | ||
- etc | ||
|
||
It is useful to me to keep these notes. If you find their presence | ||
confusing, you can safely ignore this directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Adding support for NodeNext, Node16, `.cts`, `.mts`, `.cjs`, `.mjs` | ||
|
||
*This feature has already been implemented. Here are my notes from when | ||
I was doing the work* | ||
|
||
## TODOs | ||
|
||
Implement node module type classifier: | ||
- if NodeNext or Node12: ask classifier for CJS or ESM determination | ||
Add `ForceNodeNextCJSEmit` | ||
|
||
Does our code check for .d.ts extensions anywhere? | ||
- if so, teach it about .d.cts and .d.mts | ||
|
||
For nodenext and node12, support supplemental "flavor" information: | ||
- | ||
|
||
Think about splitting out index.ts further: | ||
- register.ts - hooking stuff | ||
- types.ts | ||
- env.ts - env vars and global registration types (process.symbol) | ||
- service.ts | ||
|
||
# TESTS | ||
|
||
Matrix: | ||
|
||
- package.json type absent, commonjs, and module | ||
- import and require | ||
- from cjs and esm | ||
- .cts, .cjs | ||
- .mts, .mjs | ||
- typechecking, transpileOnly, and swc | ||
- dynamic import | ||
- import = require | ||
- static import | ||
- allowJs on and off | ||
|
||
Notes about specific matrix entries: | ||
- require mjs, mts from cjs throws error | ||
|
||
Rethink: | ||
`getOutput`: null in transpile-only mode. Also may return emitskipped | ||
`getOutputTranspileOnly`: configured module option | ||
`getOutputForceCommonJS`: `commonjs` module option | ||
`getOutputForceNodeCommonJS`: `nodenext` cjs module option | ||
`getOutputForceESM`: `esnext` module option | ||
|
||
Add second layer of classification to classifier: | ||
if classifier returns `auto` (no `moduleType` override) | ||
- if `getOutput` emits, done | ||
- else call `nodeModuleTypeClassifier` | ||
- delegate to appropriate `getOutput` based on its response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.