mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
This relaxes the validation in sync hooks so that it accepts the quirky nullish source returned by the default step of the async loader when the module being loaded is CommonJS. When there are no customization hooks registered, a saner synchronous default load step is used to use a property instead of a reset nullish source to signify that the module should go through the CJS monkey patching routes and reduce excessive reloading from disk. PR-URL: https://github.com/nodejs/node/pull/59929 Fixes: https://github.com/nodejs/node/issues/59384 Fixes: https://github.com/nodejs/node/issues/57327 Refs: https://github.com/nodejs/node/issues/59666 Refs: https://github.com/dygabo/load_module_test Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Jacob Smith <jacob@frende.me>
8 lines
139 B
JavaScript
8 lines
139 B
JavaScript
import { registerHooks } from 'node:module';
|
|
|
|
registerHooks({
|
|
load(url, context, nextLoad) {
|
|
return nextLoad(url, context);
|
|
},
|
|
});
|