Commit b95bb38
esm: empty ext from pkg type/main doesnt affect format
This ensures files with unknown extensions like foo.bar are not
loaded as CJS/ESM when imported as a main entry point and makes
sure that those files would maintain the same format even if loaded
after the main entrypoint.
PR-URL: #31021
Reviewed-By: Guy Bedford <guybedford@gmail.com>1 parent a91b735 commit b95bb38Copy full SHA for b95bb38
File tree
Expand file treeCollapse file tree
6 files changed
+95
-10
lines changedOpen diff view settings
Filter options
- doc/api
- lib/internal/modules/esm
- test
- es-module
- fixtures/es-modules/package-type-module
Expand file treeCollapse file tree
6 files changed
+95
-10
lines changedOpen diff view settings
Collapse file
+6-8Lines changed: 6 additions & 8 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1160 | 1160 | |
1161 | 1161 | |
1162 | 1162 | |
1163 | | - |
1164 | | - |
1165 | 1163 | |
1166 | 1164 | |
1167 | 1165 | |
1168 | 1166 | |
1169 | 1167 | |
1170 | 1168 | |
1171 | | - |
| 1169 | + |
1172 | 1170 | |
1173 | 1171 | |
1174 | 1172 | |
| ||
1189 | 1187 | |
1190 | 1188 | |
1191 | 1189 | |
1192 | | - |
| 1190 | + |
1193 | 1191 | |
1194 | 1192 | |
1195 | 1193 | |
| ||
1340 | 1338 | |
1341 | 1339 | |
1342 | 1340 | |
1343 | | - |
| 1341 | + |
1344 | 1342 | |
1345 | | - |
| 1343 | + |
1346 | 1344 | |
1347 | 1345 | |
1348 | 1346 | |
1349 | 1347 | |
1350 | 1348 | |
1351 | 1349 | |
1352 | | - |
| 1350 | + |
1353 | 1351 | |
1354 | 1352 | |
1355 | 1353 | |
1356 | | - |
| 1354 | + |
1357 | 1355 | |
1358 | 1356 | |
1359 | 1357 | |
|
Collapse file
lib/internal/modules/esm/default_resolve.js
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/default_resolve.js+5-2Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
104 | 104 | |
105 | 105 | |
106 | 106 | |
107 | | - |
108 | | - |
| 107 | + |
| 108 | + |
109 | 109 | |
| 110 | + |
| 111 | + |
| 112 | + |
110 | 113 | |
111 | 114 | |
112 | 115 | |
|
Collapse file
test/es-module/test-esm-unknown-main.js
Copy file name to clipboard+81Lines changed: 81 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
Collapse file
test/fixtures/es-modules/package-type-module/extension.unknown
Copy file name to clipboard+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
Collapse file
test/fixtures/es-modules/package-type-module/imports-noext.mjs
Copy file name to clipboard+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
Collapse file
test/fixtures/es-modules/package-type-module/imports-unknownext.mjs
Copy file name to clipboard+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
0 commit comments