Commit 1bc470d
Add moduleType option to override module type on certain files. (#1371)
* Add moduleType option to override module type on certain files. Also
refactor resolverFunctions into their own file; should break this into
2x PRs later.
* lint fix
* add test
* remove unnecessary exports from ts-internals; mark exports as @internal
* add docs
* strip optionBasePaths from showConfig output
* proper path normalization to support windows
* lint-fix
* use es2015 instead of es2020 in test tsconfig to support ts2.7
* add missing path normalization when calling classifyModule
* Test coverage: moduleType overrides during ts-node loader usage (#1376)
* Test coverage: add test case to confirm that moduleType overrides are applied for ts-node in loader mode
* Ensure that a default export exists for the esm-exception module
* Re-order tsconfig.json glob rules, and use implicit globbing
* lint fixup: apply prettier
* Add 'experimental-specifier-resolution' flag to NPM options in ESM module override test
* Ensure that a default export exists for the cjs-subdir module
* Revert "Ensure that a default export exists for the cjs-subdir module"
This reverts commit c64cf92.
* Revert "Add 'experimental-specifier-resolution' flag to NPM options in ESM module override test"
This reverts commit 1093df8.
* Specify tsconfig project using TS_NODE_PROJECT environment variable
* Use full file paths in preference to directory-default module imports
This avoids ERR_UNSUPPORTED_DIR_IMPORT, without having to provide the 'experimental-specifier-resolution' flag to ts-node
* Update index.ts
* Update index.ts
* Update tsconfig.json
* Extract execModuleTypeOverride function
* Add expected failure cases for Node 12.15, 14.13
Co-authored-by: Andrew Bradley <cspotcode@gmail.com>
* Update tests
* fix
* fix
* fix for TS2.7
* fix
* fix
* reword
* update docs
* address todos
* fix
Co-authored-by: James Addison <jay@jp-hosting.net>1 parent 4e7fcb7 commit 1bc470d
File tree
28 files changed
+980
-223
lines changed- dist-raw
- src
- test
- tests/module-types
- override-to-cjs
- src
- cjs-subdir
- override-to-esm
- src
- esm-subdir
- website
- docs
28 files changed
+980
-223
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
15 | 26 | | |
16 | | - | |
| 27 | + | |
17 | 28 | | |
18 | | - | |
| 29 | + | |
19 | 30 | | |
20 | 31 | | |
21 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
4 | 10 | | |
5 | 11 | | |
6 | 12 | | |
| |||
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
| 79 | + | |
73 | 80 | | |
74 | 81 | | |
75 | 82 | | |
| |||
110 | 117 | | |
111 | 118 | | |
112 | 119 | | |
| 120 | + | |
113 | 121 | | |
114 | 122 | | |
115 | 123 | | |
| |||
140 | 148 | | |
141 | 149 | | |
142 | 150 | | |
| 151 | + | |
143 | 152 | | |
144 | 153 | | |
145 | 154 | | |
| |||
152 | 161 | | |
153 | 162 | | |
154 | 163 | | |
| 164 | + | |
155 | 165 | | |
156 | 166 | | |
157 | 167 | | |
| |||
169 | 179 | | |
170 | 180 | | |
171 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
172 | 187 | | |
173 | 188 | | |
174 | 189 | | |
| |||
222 | 237 | | |
223 | 238 | | |
224 | 239 | | |
225 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
226 | 246 | | |
227 | 247 | | |
228 | 248 | | |
| |||
251 | 271 | | |
252 | 272 | | |
253 | 273 | | |
| 274 | + | |
254 | 275 | | |
255 | 276 | | |
256 | 277 | | |
| |||
271 | 292 | | |
272 | 293 | | |
273 | 294 | | |
| 295 | + | |
274 | 296 | | |
275 | 297 | | |
276 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| 100 | + | |
99 | 101 | | |
100 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
101 | 105 | | |
102 | | - | |
103 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
104 | 121 | | |
105 | 122 | | |
106 | 123 | | |
| |||
0 commit comments