Commit 981b324
* fix(runtime): #5437 Next.js W6 wall — CJS-interop probe on module-default wrapper must not auto-call it
The W6 wrapper-resolve fallback in js_object_get_field_by_name auto-calls a
registered module-default wrapper closure on a property miss to obtain
module.exports. For a CJS module whose module.exports IS a plain function
(next/dist/compiled/debug -> createDebug), the registered wrapper is that
function itself. _interop_require_default(require('debug')) reads .__esModule
off it: the auto-call ran createDebug() with no args -> enabled(undefined) ->
undefined.length -> 'Cannot read properties of undefined (reading length)',
crashing the Next.js server at boot.
Short-circuit the two CJS-interop probe keys on a registered wrapper:
- .__esModule -> undefined (a function-export CJS module is not an ES module)
- .default -> the wrapper closure itself (interop default of a non-ESM
module is module.exports)
Both also excluded from the auto-call exclusion list. The genuine W6
SharedCacheControls path (non-default member reads) is unaffected.
Bundle: .length-on-undefined throw gone; Next.js server now BINDS (was
HTTP 000 boot-exit) and serves; next wall = request-time uS_constructor
new uw.SharedCacheControls captured mis-box (separate, pre-documented).
Regression test: module_default_wrapper_interop_probe_does_not_call_wrapper.
* chore: bump 0.5.1200 → 0.5.1201 + CHANGELOG for #5546 boot-crash fix
---------
Co-authored-by: Ralph Küpper <ralph2@skelpo.com>
1 parent 0f90fc3 commit 981b324
6 files changed
Lines changed: 171 additions & 81 deletions
File tree
- crates/perry-runtime/src
- closure
- object
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
1 | 7 | | |
2 | 8 | | |
3 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
0 commit comments