Uh oh!
There was an error while loading. Please reload this page.
lib: explicitly initialize debuglog during bootstrap - #26468
Conversation
So these can be required without requiring the whole `util.js`.
This patch splits the implementation of util.debuglog into a separate file and explicitly initialize it during pre-execution since the initialization depends on environment variables. Also delays the call to `debuglog` in modules that are loaded during bootstrap to make sure we only access the environment variable during pre-execution.
joyeecheung
commented
Mar 6, 2019
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
joyeecheung
commented
Mar 8, 2019
Landed in f617a73...b05fd4b |
So these can be required without requiring the whole `util.js`. PR-URL: nodejs#26468 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: nodejs#26468 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This patch splits the implementation of util.debuglog into a separate file and explicitly initialize it during pre-execution since the initialization depends on environment variables. Also delays the call to `debuglog` in modules that are loaded during bootstrap to make sure we only access the environment variable during pre-execution. PR-URL: nodejs#26468 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins
commented
Mar 8, 2019
It looks like this may have broken our downstream modules fork More to come as I dig in and figure out exactly what is going on |
@MylesBorins My guess is there's something in the fork that loads // Don't do this in the top scope if it's loaded during bootstrapconstdebug=require('util').debuglog('stream');// Do thisletdebuglog;functiondebug(...args){if(!debuglog){debuglog=require('internal/util/debuglog').debuglog('stream');}debuglog(...args);} |
MylesBorins
commented
Mar 10, 2019
thanks @joyeecheung. it looks like the file being required uses the above pattern... and I had a bit of an issue tracking down where the call to debug was happening in the wrong order. I opted instead to lazyload the instantiation of the CJSLoader see nodejs/ecmascript-modules@02bcd09 for attempted fix. Have a feeling this requires more attention, but appears good enough to move things forward for now |
BridgeAR
commented
Mar 13, 2019
This does land land cleanly on v11.x. It relies on #26466. As soon as that is backported, this should also land cleanly. |
So these can be required without requiring the whole `util.js`. PR-URL: nodejs#26468 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: nodejs#26468 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This patch splits the implementation of util.debuglog into a separate file and explicitly initialize it during pre-execution since the initialization depends on environment variables. Also delays the call to `debuglog` in modules that are loaded during bootstrap to make sure we only access the environment variable during pre-execution. PR-URL: nodejs#26468 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
lib: move format and formatWithOptions into internal/util/inspect.js
So these can be required without requiring the whole
util.js.process: call prepareMainThreadExecution in all main thread scripts
lib: explicitly initialize debuglog during bootstrap
This patch splits the implementation of util.debuglog into a
separate file and explicitly initialize it during pre-execution
since the initialization depends on environment variables.
Also delays the call to
debuglogin modules that are loaded duringbootstrap to make sure we only access the environment variable
during pre-execution.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes