diff --git a/lib/domain.js b/lib/domain.js index 95946852db7ff4..b4d0bea6647a82 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -30,7 +30,7 @@ const util = require('util'); const EventEmitter = require('events'); const errors = require('internal/errors'); const { createHook } = require('async_hooks'); -const { internalBinding } = require('internal/bootstrap_loaders'); +const { internalBinding } = require('internal/bootstrap/loaders'); // overwrite process.domain with a getter/setter that will allow for more // effective optimizations diff --git a/lib/internal/bootstrap_loaders.js b/lib/internal/bootstrap/loaders.js similarity index 97% rename from lib/internal/bootstrap_loaders.js rename to lib/internal/bootstrap/loaders.js index 71dd574c787701..7be15238aa366f 100644 --- a/lib/internal/bootstrap_loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -2,7 +2,7 @@ // modules. In contrast, user land modules are loaded using // lib/module.js (CommonJS Modules) or lib/internal/loader/* (ES Modules). // -// This file is compiled and run by node.cc before bootstrap_node.js +// This file is compiled and run by node.cc before bootstrap/node.js // was called, therefore the loaders are bootstraped before we start to // actually bootstrap Node.js. It creates the following objects: // @@ -29,7 +29,7 @@ // so they can be loaded faster without the cost of I/O. This class makes the // lib/internal/*, deps/internal/* modules and internalBinding() available by // default to core modules, and lets the core modules require itself via -// require('internal/bootstrap_loaders') even when this file is not written in +// require('internal/bootstrap/loaders') even when this file is not written in // CommonJS style. // // Other objects: @@ -111,7 +111,7 @@ // Think of this as module.exports in this file even though it is not // written in CommonJS style. const loaderExports = { internalBinding, NativeModule }; - const loaderId = 'internal/bootstrap_loaders'; + const loaderId = 'internal/bootstrap/loaders'; NativeModule.require = function(id) { if (id === loaderId) { return loaderExports; @@ -211,6 +211,6 @@ }; // This will be passed to the bootstrapNodeJSCore function in - // bootstrap_node.js. + // bootstrap/node.js. return loaderExports; }); diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap/node.js similarity index 99% rename from lib/internal/bootstrap_node.js rename to lib/internal/bootstrap/node.js index 690eeb5a996efb..9bcafd8e9b0861 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap/node.js @@ -5,7 +5,7 @@ // to the performance of the startup process, many dependencies are invoked // lazily. // -// Before this file is run, lib/internal/bootstrap_loaders.js gets run first +// Before this file is run, lib/internal/bootstrap/loaders.js gets run first // to bootstrap the internal binding and module loaders, including // process.binding(), process._linkedBinding(), internalBinding() and // NativeModule. And then { internalBinding, NativeModule } will be passed diff --git a/lib/internal/loader/CreateDynamicModule.js b/lib/internal/loader/CreateDynamicModule.js index 8c289171386a0d..7e9777af51ee2b 100644 --- a/lib/internal/loader/CreateDynamicModule.js +++ b/lib/internal/loader/CreateDynamicModule.js @@ -1,6 +1,6 @@ 'use strict'; -const { internalBinding } = require('internal/bootstrap_loaders'); +const { internalBinding } = require('internal/bootstrap/loaders'); const { ModuleWrap } = internalBinding('module_wrap'); const debug = require('util').debuglog('esm'); const ArrayJoin = Function.call.bind(Array.prototype.join); diff --git a/lib/internal/loader/DefaultResolve.js b/lib/internal/loader/DefaultResolve.js index ce1e8737b2e5fe..fe9ccfd5db55ed 100644 --- a/lib/internal/loader/DefaultResolve.js +++ b/lib/internal/loader/DefaultResolve.js @@ -3,7 +3,7 @@ const { URL } = require('url'); const CJSmodule = require('module'); const internalFS = require('internal/fs'); -const { NativeModule, internalBinding } = require('internal/bootstrap_loaders'); +const { NativeModule, internalBinding } = require('internal/bootstrap/loaders'); const { extname } = require('path'); const { realpathSync } = require('fs'); const preserveSymlinks = !!process.binding('config').preserveSymlinks; diff --git a/lib/internal/loader/ModuleJob.js b/lib/internal/loader/ModuleJob.js index 162b0504d3d313..d948252829ddbf 100644 --- a/lib/internal/loader/ModuleJob.js +++ b/lib/internal/loader/ModuleJob.js @@ -1,6 +1,6 @@ 'use strict'; -const { internalBinding } = require('internal/bootstrap_loaders'); +const { internalBinding } = require('internal/bootstrap/loaders'); const { ModuleWrap } = internalBinding('module_wrap'); const { SafeSet, SafePromise } = require('internal/safe_globals'); const { decorateErrorStack } = require('internal/util'); diff --git a/lib/internal/loader/ModuleWrap.js b/lib/internal/loader/ModuleWrap.js index 6015e37d9aea63..e589960193c94c 100644 --- a/lib/internal/loader/ModuleWrap.js +++ b/lib/internal/loader/ModuleWrap.js @@ -2,5 +2,5 @@ // exposes ModuleWrap for testing -const { internalBinding } = require('internal/bootstrap_loaders'); +const { internalBinding } = require('internal/bootstrap/loaders'); module.exports = internalBinding('module_wrap').ModuleWrap; diff --git a/lib/internal/loader/Translators.js b/lib/internal/loader/Translators.js index 74dd4358274d3b..8796b4ddfd00e5 100644 --- a/lib/internal/loader/Translators.js +++ b/lib/internal/loader/Translators.js @@ -1,6 +1,6 @@ 'use strict'; -const { NativeModule, internalBinding } = require('internal/bootstrap_loaders'); +const { NativeModule, internalBinding } = require('internal/bootstrap/loaders'); const { ModuleWrap } = internalBinding('module_wrap'); const internalCJSModule = require('internal/module'); const CJSModule = require('module'); diff --git a/lib/internal/process/modules.js b/lib/internal/process/modules.js index c53c55a53ca48e..2cbc65a5dabd3d 100644 --- a/lib/internal/process/modules.js +++ b/lib/internal/process/modules.js @@ -1,6 +1,6 @@ 'use strict'; -const { internalBinding } = require('internal/bootstrap_loaders'); +const { internalBinding } = require('internal/bootstrap/loaders'); const { setImportModuleDynamicallyCallback } = internalBinding('module_wrap'); diff --git a/lib/internal/vm/Module.js b/lib/internal/vm/Module.js index e954babf1df5af..f0fa55f39b8103 100644 --- a/lib/internal/vm/Module.js +++ b/lib/internal/vm/Module.js @@ -1,6 +1,6 @@ 'use strict'; -const { internalBinding } = require('internal/bootstrap_loaders'); +const { internalBinding } = require('internal/bootstrap/loaders'); const { emitExperimentalWarning } = require('internal/util'); const { URL } = require('internal/url'); const { kParsingContext, isContext } = process.binding('contextify'); diff --git a/lib/module.js b/lib/module.js index ae0d44988be398..0840b9d946f8a4 100644 --- a/lib/module.js +++ b/lib/module.js @@ -21,7 +21,7 @@ 'use strict'; -const { NativeModule } = require('internal/bootstrap_loaders'); +const { NativeModule } = require('internal/bootstrap/loaders'); const util = require('util'); const { decorateErrorStack } = require('internal/util'); const { getURLFromFilePath } = require('internal/url'); diff --git a/node.gyp b/node.gyp index f6586621bbe6fa..9e6a286a0bf53b 100644 --- a/node.gyp +++ b/node.gyp @@ -25,8 +25,8 @@ 'node_lib_target_name%': 'node_lib', 'node_intermediate_lib_type%': 'static_library', 'library_files': [ - 'lib/internal/bootstrap_loaders.js', - 'lib/internal/bootstrap_node.js', + 'lib/internal/bootstrap/loaders.js', + 'lib/internal/bootstrap/node.js', 'lib/async_hooks.js', 'lib/assert.js', 'lib/buffer.js', diff --git a/src/node.cc b/src/node.cc index 7d126a97a62b96..737f589eaad01c 100644 --- a/src/node.cc +++ b/src/node.cc @@ -250,7 +250,7 @@ bool config_experimental_vm_modules = false; // Set in node.cc by ParseArgs when --loader is used. // Used in node_config.cc to set a constant on process.binding('config') -// that is used by lib/internal/bootstrap_node.js +// that is used by lib/internal/bootstrap/node.js std::string config_userland_loader; // NOLINT(runtime/string) // Set by ParseArgs when --pending-deprecation or NODE_PENDING_DEPRECATION @@ -263,7 +263,7 @@ std::string config_warning_file; // NOLINT(runtime/string) // Set in node.cc by ParseArgs when --expose-internals or --expose_internals is // used. // Used in node_config.cc to set a constant on process.binding('config') -// that is used by lib/internal/bootstrap_node.js +// that is used by lib/internal/bootstrap/node.js bool config_expose_internals = false; bool v8_initialized = false; @@ -3645,23 +3645,23 @@ static Local GetBootstrapper(Environment* env, Local source, // are not safe to ignore. try_catch.SetVerbose(false); - // Execute the factory javascript file - Local factory_v = ExecuteString(env, source, script_name); + // Execute the bootstrapper javascript file + Local bootstrapper_v = ExecuteString(env, source, script_name); if (try_catch.HasCaught()) { ReportException(env, try_catch); exit(10); } - CHECK(factory_v->IsFunction()); - Local factory = Local::Cast(factory_v); + CHECK(bootstrapper_v->IsFunction()); + Local bootstrapper = Local::Cast(bootstrapper_v); - return scope.Escape(factory); + return scope.Escape(bootstrapper); } -static bool ExecuteBootstrapper(Environment* env, Local factory, +static bool ExecuteBootstrapper(Environment* env, Local bootstrapper, int argc, Local argv[], Local* out) { - bool ret = factory->Call( + bool ret = bootstrapper->Call( env->context(), Null(env->isolate()), argc, argv).ToLocal(out); // If there was an error during bootstrap then it was either handled by the @@ -3688,16 +3688,18 @@ void LoadEnvironment(Environment* env) { // are not safe to ignore. try_catch.SetVerbose(false); - // The factory scripts are lib/internal/bootstrap_loaders.js and - // lib/internal/bootstrap_node.js, each included as a static C string + // The bootstrapper scripts are lib/internal/bootstrap/loaders.js and + // lib/internal/bootstrap/node.js, each included as a static C string // defined in node_javascript.h, generated in node_javascript.cc by // node_js2c. + Local loaders_name = + FIXED_ONE_BYTE_STRING(env->isolate(), "internal/bootstrap/loaders.js"); Local loaders_bootstrapper = - GetBootstrapper(env, LoadersBootstrapperSource(env), - FIXED_ONE_BYTE_STRING(env->isolate(), "bootstrap_loaders.js")); + GetBootstrapper(env, LoadersBootstrapperSource(env), loaders_name); + Local node_name = + FIXED_ONE_BYTE_STRING(env->isolate(), "internal/bootstrap/node.js"); Local node_bootstrapper = - GetBootstrapper(env, NodeBootstrapperSource(env), - FIXED_ONE_BYTE_STRING(env->isolate(), "bootstrap_node.js")); + GetBootstrapper(env, NodeBootstrapperSource(env), node_name); // Add a reference to the global object Local global = env->context()->Global(); diff --git a/src/node_internals.h b/src/node_internals.h index 46a1be4e19b433..27ab40a39f5998 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -180,13 +180,13 @@ extern bool config_experimental_vm_modules; // Set in node.cc by ParseArgs when --loader is used. // Used in node_config.cc to set a constant on process.binding('config') -// that is used by lib/internal/bootstrap_node.js +// that is used by lib/internal/bootstrap/node.js extern std::string config_userland_loader; // Set in node.cc by ParseArgs when --expose-internals or --expose_internals is // used. // Used in node_config.cc to set a constant on process.binding('config') -// that is used by lib/internal/bootstrap_node.js +// that is used by lib/internal/bootstrap/node.js extern bool config_expose_internals; // Set in node.cc by ParseArgs when --redirect-warnings= is used. diff --git a/src/node_url.cc b/src/node_url.cc index 3827393979d16c..09199afb141e3f 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -2311,7 +2311,7 @@ const Local URL::ToObject(Environment* env) const { // The SetURLConstructor method must have been called already to // set the constructor function used below. SetURLConstructor is // called automatically when the internal/url.js module is loaded - // during the internal/bootstrap_node.js processing. + // during the internal/bootstrap/node.js processing. ret = env->url_constructor_function() ->Call(env->context(), undef, arraysize(argv), argv); } diff --git a/test/message/core_line_numbers.out b/test/message/core_line_numbers.out index 1049fdc3e935df..5658a5a59ecbcd 100644 --- a/test/message/core_line_numbers.out +++ b/test/message/core_line_numbers.out @@ -12,4 +12,4 @@ RangeError: Invalid input at tryModuleLoad (module.js:*:*) at Function.Module._load (module.js:*:*) at Function.Module.runMain (module.js:*:*) - at startup (bootstrap_node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) diff --git a/test/message/error_exit.out b/test/message/error_exit.out index 5f4f792727bab0..f26287d57f61c0 100644 --- a/test/message/error_exit.out +++ b/test/message/error_exit.out @@ -11,5 +11,5 @@ AssertionError [ERR_ASSERTION]: 1 === 2 at tryModuleLoad (module.js:*:*) at Function.Module._load (module.js:*:*) at Function.Module.runMain (module.js:*:*) - at startup (bootstrap_node.js:*:*) - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) diff --git a/test/message/eval_messages.out b/test/message/eval_messages.out index 7dbf9e950c2c71..84772ffa48a14f 100644 --- a/test/message/eval_messages.out +++ b/test/message/eval_messages.out @@ -8,9 +8,9 @@ SyntaxError: Strict mode code may not include a with statement at Object.runInThisContext (vm.js:*:*) at Object. ([eval]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at startup (bootstrap_node.js:*:*) - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at evalScript (internal/bootstrap/node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) 42 42 [eval]:1 @@ -23,9 +23,9 @@ Error: hello at Object.runInThisContext (vm.js:*:*) at Object. ([eval]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at startup (bootstrap_node.js:*:*) - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at evalScript (internal/bootstrap/node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) [eval]:1 throw new Error("hello") @@ -37,9 +37,9 @@ Error: hello at Object.runInThisContext (vm.js:*:*) at Object. ([eval]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at startup (bootstrap_node.js:*:*) - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at evalScript (internal/bootstrap/node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) 100 [eval]:1 var x = 100; y = x; @@ -51,9 +51,9 @@ ReferenceError: y is not defined at Object.runInThisContext (vm.js:*:*) at Object. ([eval]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at startup (bootstrap_node.js:*:*) - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at evalScript (internal/bootstrap/node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) [eval]:1 var ______________________________________________; throw 10 diff --git a/test/message/events_unhandled_error_common_trace.out b/test/message/events_unhandled_error_common_trace.out index 15355734705331..003446edaa5e17 100644 --- a/test/message/events_unhandled_error_common_trace.out +++ b/test/message/events_unhandled_error_common_trace.out @@ -12,11 +12,11 @@ Error: foo:bar at tryModuleLoad (module.js:*:*) at Function.Module._load (module.js:*:*) at Function.Module.runMain (module.js:*:*) - at startup (bootstrap_node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) Emitted 'error' event at: at quux (*events_unhandled_error_common_trace.js:*:*) at Object. (*events_unhandled_error_common_trace.js:*:*) at Module._compile (module.js:*:*) [... lines matching original stack trace ...] - at startup (bootstrap_node.js:*:*) - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) diff --git a/test/message/events_unhandled_error_nexttick.out b/test/message/events_unhandled_error_nexttick.out index c578f55f90c45a..5912f9fd387b4c 100644 --- a/test/message/events_unhandled_error_nexttick.out +++ b/test/message/events_unhandled_error_nexttick.out @@ -10,11 +10,11 @@ Error at tryModuleLoad (module.js:*:*) at Function.Module._load (module.js:*:*) at Function.Module.runMain (module.js:*:*) - at startup (bootstrap_node.js:*:*) - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) Emitted 'error' event at: at process.nextTick (*events_unhandled_error_nexttick.js:*:*) at process._tickCallback (internal/process/next_tick.js:*:*) at Function.Module.runMain (module.js:*:*) - at startup (bootstrap_node.js:*:*) - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) diff --git a/test/message/events_unhandled_error_sameline.out b/test/message/events_unhandled_error_sameline.out index d8441c44d41fd5..dcbb45afbd4240 100644 --- a/test/message/events_unhandled_error_sameline.out +++ b/test/message/events_unhandled_error_sameline.out @@ -10,10 +10,10 @@ Error at tryModuleLoad (module.js:*:*) at Function.Module._load (module.js:*:*) at Function.Module.runMain (module.js:*:*) - at startup (bootstrap_node.js:*:*) - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) Emitted 'error' event at: at Object. (*events_unhandled_error_sameline.js:*:*) at Module._compile (module.js:*:*) [... lines matching original stack trace ...] - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) diff --git a/test/message/nexttick_throw.out b/test/message/nexttick_throw.out index 41412b95f6ae5a..798b208d7d9049 100644 --- a/test/message/nexttick_throw.out +++ b/test/message/nexttick_throw.out @@ -6,5 +6,5 @@ ReferenceError: undefined_reference_error_maker is not defined at *test*message*nexttick_throw.js:*:* at process._tickCallback (internal/process/next_tick.js:*:*) at Function.Module.runMain (module.js:*:*) - at startup (bootstrap_node.js:*:*) - at bootstrapNodeJSCore (bootstrap_node.js:*:*) + at startup (internal/bootstrap/node.js:*:*) + at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*) diff --git a/test/message/stdin_messages.out b/test/message/stdin_messages.out index d2192050dd4196..c6c37a5be4f397 100644 --- a/test/message/stdin_messages.out +++ b/test/message/stdin_messages.out @@ -8,8 +8,8 @@ SyntaxError: Strict mode code may not include a with statement at Object.runInThisContext (vm.js:*) at Object. ([stdin]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at Socket. (bootstrap_node.js:*:*) + at evalScript (internal/bootstrap/node.js:*:*) + at Socket. (internal/bootstrap/node.js:*:*) at Socket.emit (events.js:*:*) at endReadableNT (_stream_readable.js:*:*) at process._tickCallback (internal/process/next_tick.js:*:*) @@ -25,8 +25,8 @@ Error: hello at Object.runInThisContext (vm.js:*) at Object. ([stdin]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at Socket. (bootstrap_node.js:*:*) + at evalScript (internal/bootstrap/node.js:*:*) + at Socket. (internal/bootstrap/node.js:*:*) at Socket.emit (events.js:*:*) at endReadableNT (_stream_readable.js:*:*) at process._tickCallback (internal/process/next_tick.js:*:*) @@ -40,8 +40,8 @@ Error: hello at Object.runInThisContext (vm.js:*) at Object. ([stdin]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at Socket. (bootstrap_node.js:*:*) + at evalScript (internal/bootstrap/node.js:*:*) + at Socket. (internal/bootstrap/node.js:*:*) at Socket.emit (events.js:*:*) at endReadableNT (_stream_readable.js:*:*) at process._tickCallback (internal/process/next_tick.js:*:*) @@ -56,8 +56,8 @@ ReferenceError: y is not defined at Object.runInThisContext (vm.js:*) at Object. ([stdin]-wrapper:*:*) at Module._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at Socket. (bootstrap_node.js:*:*) + at evalScript (internal/bootstrap/node.js:*:*) + at Socket. (internal/bootstrap/node.js:*:*) at Socket.emit (events.js:*:*) at endReadableNT (_stream_readable.js:*:*) at process._tickCallback (internal/process/next_tick.js:*:*) diff --git a/test/parallel/test-loaders-hidden-from-users.js b/test/parallel/test-loaders-hidden-from-users.js index b3e6622c8c0c88..0d752f5718b729 100644 --- a/test/parallel/test-loaders-hidden-from-users.js +++ b/test/parallel/test-loaders-hidden-from-users.js @@ -6,16 +6,16 @@ const common = require('../common'); common.expectsError( () => { - require('internal/bootstrap_loaders'); + require('internal/bootstrap/loaders'); }, { code: 'MODULE_NOT_FOUND', - message: 'Cannot find module \'internal/bootstrap_loaders\'' + message: 'Cannot find module \'internal/bootstrap/loaders\'' } ); common.expectsError( () => { - const source = 'module.exports = require("internal/bootstrap_loaders")'; + const source = 'module.exports = require("internal/bootstrap/loaders")'; process.binding('natives').owo = source; require('owo'); }, { diff --git a/test/sequential/test-inspector-overwrite-config.js b/test/sequential/test-inspector-overwrite-config.js index ecb14c6638edb5..9aa3ca9d963828 100644 --- a/test/sequential/test-inspector-overwrite-config.js +++ b/test/sequential/test-inspector-overwrite-config.js @@ -2,7 +2,8 @@ 'use strict'; // This test ensures that overwriting a process configuration -// value does not affect code in bootstrap_node.js. Specifically this tests +// value does not affect code in lib/internal/bootstrap/node.js. +// Specifically this tests // that the inspector console functions are bound even though // overwrite-config-preload-module.js overwrote the process.config variable.