Commit 104c3bc
esm: provide named exports for builtin libs
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.
PR-URL: #20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>1 parent ebd102e commit 104c3bcCopy full SHA for 104c3bc
File tree
Expand file treeCollapse file tree
8 files changed
+282
-16
lines changedOpen diff view settings
Filter options
- doc/api
- lib/internal
- bootstrap
- modules/esm
- test
- es-module
- fixtures/es-module-loaders
Expand file treeCollapse file tree
8 files changed
+282
-16
lines changedOpen diff view settings
Collapse file
+30-3Lines changed: 30 additions & 3 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
95 | 95 | |
96 | 96 | |
97 | 97 | |
98 | | - |
99 | | - |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
100 | 119 | |
101 | 120 | |
102 | 121 | |
103 | | - |
| 122 | + |
104 | 123 | |
105 | 124 | |
106 | 125 | |
107 | 126 | |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
108 | 135 | |
109 | 136 | |
110 | 137 | |
|
Collapse file
lib/internal/bootstrap/loaders.js
Copy file name to clipboardExpand all lines: lib/internal/bootstrap/loaders.js+81-3Lines changed: 81 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
41 | 41 | |
42 | 42 | |
43 | 43 | |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
44 | 60 | |
45 | 61 | |
46 | 62 | |
47 | | - |
| 63 | + |
48 | 64 | |
49 | 65 | |
50 | 66 | |
| ||
53 | 69 | |
54 | 70 | |
55 | 71 | |
56 | | - |
| 72 | + |
57 | 73 | |
58 | 74 | |
59 | 75 | |
| ||
77 | 93 | |
78 | 94 | |
79 | 95 | |
80 | | - |
| 96 | + |
81 | 97 | |
82 | 98 | |
83 | 99 | |
| ||
95 | 111 | |
96 | 112 | |
97 | 113 | |
| 114 | + |
| 115 | + |
98 | 116 | |
99 | 117 | |
100 | 118 | |
| ||
193 | 211 | |
194 | 212 | |
195 | 213 | |
| 214 | + |
| 215 | + |
| 216 | + |
| 217 | + |
| 218 | + |
| 219 | + |
196 | 220 | |
197 | 221 | |
198 | 222 | |
| ||
208 | 232 | |
209 | 233 | |
210 | 234 | |
| 235 | + |
| 236 | + |
| 237 | + |
| 238 | + |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | + |
| 243 | + |
| 244 | + |
| 245 | + |
| 246 | + |
| 247 | + |
| 248 | + |
| 249 | + |
| 250 | + |
| 251 | + |
| 252 | + |
| 253 | + |
| 254 | + |
| 255 | + |
| 256 | + |
| 257 | + |
| 258 | + |
| 259 | + |
| 260 | + |
| 261 | + |
| 262 | + |
| 263 | + |
| 264 | + |
| 265 | + |
| 266 | + |
| 267 | + |
| 268 | + |
| 269 | + |
| 270 | + |
| 271 | + |
| 272 | + |
| 273 | + |
| 274 | + |
| 275 | + |
| 276 | + |
| 277 | + |
| 278 | + |
| 279 | + |
| 280 | + |
| 281 | + |
| 282 | + |
| 283 | + |
| 284 | + |
| 285 | + |
| 286 | + |
| 287 | + |
| 288 | + |
211 | 289 | |
212 | 290 | |
213 | 291 | |
|
Collapse file
lib/internal/modules/esm/create_dynamic_module.js
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/create_dynamic_module.js+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
52 | 52 | |
53 | 53 | |
54 | 54 | |
| 55 | + |
55 | 56 | |
56 | 57 | |
57 | | - |
| 58 | + |
58 | 59 | |
59 | 60 | |
60 | 61 | |
|
Collapse file
lib/internal/modules/esm/translators.js
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/translators.js+12-5Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
59 | 59 | |
60 | 60 | |
61 | 61 | |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
66 | | - |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
67 | 74 | |
68 | 75 | |
69 | 76 | |
|
Collapse file
test/es-module/test-esm-dynamic-import.js
Copy file name to clipboardExpand all lines: test/es-module/test-esm-dynamic-import.js+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
52 | 52 | |
53 | 53 | |
54 | 54 | |
| 55 | + |
55 | 56 | |
56 | 57 | |
57 | 58 | |
|
Collapse file
test/es-module/test-esm-live-binding.mjs
Copy file name to clipboard+143Lines changed: 143 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 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
Collapse file
test/es-module/test-esm-namespace.mjs
Copy file name to clipboardExpand all lines: test/es-module/test-esm-namespace.mjs+9-1Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2 | 2 | |
3 | 3 | |
4 | 4 | |
| 5 | + |
5 | 6 | |
6 | | - |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
0 commit comments