Commit 30ed93d
module: cache synchronous module jobs before linking
So that if there are circular dependencies in the synchronous
module graph, they could be resolved using the cached jobs.
In case linking fails and the error gets caught, reset the
cache right after linking. If it succeeds, the caller will
cache it again. Otherwise the error bubbles up to users,
and since we unset the cache for the unlinkable module
the next attempt would still fail.
PR-URL: #52868
Backport-PR-URL: #56927
Fixes: #52864
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Refs: #526971 parent a03faf2 commit 30ed93dCopy full SHA for 30ed93d
File tree
Expand file treeCollapse file tree
6 files changed
+43
-14
lines changedOpen diff view settings
Filter options
- lib/internal/modules/esm
- test
- es-module
- fixtures/es-modules/cjs-esm-esm-cycle
Expand file treeCollapse file tree
6 files changed
+43
-14
lines changedOpen diff view settings
Collapse file
lib/internal/modules/esm/module_job.js
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/module_job.js+25-14Lines changed: 25 additions & 14 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
287 | 287 | |
288 | 288 | |
289 | 289 | |
290 | | - |
291 | 290 | |
292 | | - |
293 | | - |
294 | | - |
295 | | - |
296 | | - |
297 | | - |
298 | | - |
299 | | - |
300 | | - |
301 | | - |
302 | | - |
| 291 | + |
| 292 | + |
| 293 | + |
| 294 | + |
| 295 | + |
| 296 | + |
| 297 | + |
| 298 | + |
| 299 | + |
| 300 | + |
| 301 | + |
| 302 | + |
| 303 | + |
| 304 | + |
| 305 | + |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
| 315 | + |
303 | 316 | |
304 | | - |
305 | | - |
306 | 317 | |
307 | 318 | |
308 | 319 | |
|
Collapse file
lib/internal/modules/esm/module_map.js
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/module_map.js+6Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
114 | 114 | |
115 | 115 | |
116 | 116 | |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
117 | 123 | |
118 | 124 | |
119 | 125 | |
|
Collapse file
test/es-module/test-require-module-cycle-cjs-esm-esm.js
Copy file name to clipboard+8Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
Collapse file
test/fixtures/es-modules/cjs-esm-esm-cycle/a.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/cjs-esm-esm-cycle/b.mjs
Copy file name to clipboard+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
Collapse file
test/fixtures/es-modules/cjs-esm-esm-cycle/c.cjs
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