| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 953072d commit fbc52e5
48 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -108,7 +108,7 @@ | |||
| 108 | 108 | /benchmark/misc/startup.js @nodejs/startup | |
| 109 | 109 | /src/node.cc @nodejs/startup | |
| 110 | 110 | /src/node_code_cache_stub.cc @nodejs/startup | |
| 111 | - /src/node_native_module* @nodejs/startup | ||
| 111 | + /src/node_builtins* @nodejs/startup | ||
| 112 | 112 | /src/node_snapshot* @nodejs/startup | |
| 113 | 113 | /lib/internal/bootstrap/* @nodejs/startup | |
| 114 | 114 | /tools/code_cache/* @nodejs/startup | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2003,7 +2003,7 @@ changes: | |||
| 2003 | 2003 | ||
| 2004 | 2004 | Type: Compile-time | |
| 2005 | 2005 | ||
| 2006 | - Certain versions of `node::MakeCallback` APIs available to native modules are | ||
| 2006 | + Certain versions of `node::MakeCallback` APIs available to native addons are | ||
| 2007 | 2007 | deprecated. Please use the versions of the API that accept an `async_context` | |
| 2008 | 2008 | parameter. | |
| 2009 | 2009 | ||
@@ -2751,7 +2751,7 @@ changes: | |||
| 2751 | 2751 | Type: Documentation-only | |
| 2752 | 2752 | ||
| 2753 | 2753 | The `node:repl` module exports a `_builtinLibs` property that contains an array | |
| 2754 | - with native modules. It was incomplete so far and instead it's better to rely | ||
| 2754 | + of built-in modules. It was incomplete so far and instead it's better to rely | ||
| 2755 | 2755 | upon `require('node:module').builtinModules`. | |
| 2756 | 2756 | ||
| 2757 | 2757 | ### DEP0143: `Transform._transformState` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -705,8 +705,8 @@ This does not apply to [native addons][], for which reloading will result in an | |||
| 705 | 705 | error. | |
| 706 | 706 | ||
| 707 | 707 | Adding or replacing entries is also possible. This cache is checked before | |
| 708 | - native modules and if a name matching a native module is added to the cache, | ||
| 709 | - only `node:`-prefixed require calls are going to receive the native module. | ||
| 708 | + built-in modules and if a name matching a built-in module is added to the cache, | ||
| 709 | + only `node:`-prefixed require calls are going to receive the built-in module. | ||
| 710 | 710 | Use with care! | |
| 711 | 711 | ||
| 712 | 712 | <!-- eslint-disable node-core/no-duplicate-requires --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -201,9 +201,9 @@ GitHub projects using CMake.js. | |||
| 201 | 201 | #### prebuildify | |
| 202 | 202 | ||
| 203 | 203 | [prebuildify][] is a tool based on node-gyp. The advantage of prebuildify is | |
| 204 | - that the built binaries are bundled with the native module when it's | ||
| 204 | + that the built binaries are bundled with the native addon when it's | ||
| 205 | 205 | uploaded to npm. The binaries are downloaded from npm and are immediately | |
| 206 | - available to the module user when the native module is installed. | ||
| 206 | + available to the module user when the native addon is installed. | ||
| 207 | 207 | ||
| 208 | 208 | ## Usage | |
| 209 | 209 | ||
@@ -1381,7 +1381,7 @@ callback throws an exception with no way to recover. | |||
| 1381 | 1381 | ||
| 1382 | 1382 | ### Fatal errors | |
| 1383 | 1383 | ||
| 1384 | - In the event of an unrecoverable error in a native module, a fatal error can be | ||
| 1384 | + In the event of an unrecoverable error in a native addon, a fatal error can be | ||
| 1385 | 1385 | thrown to immediately terminate the process. | |
| 1386 | 1386 | ||
| 1387 | 1387 | #### `napi_fatal_error` | |
@@ -5745,7 +5745,7 @@ Returns `napi_ok` if the API succeeded. | |||
| 5745 | 5745 | ||
| 5746 | 5746 | This function gives V8 an indication of the amount of externally allocated | |
| 5747 | 5747 | memory that is kept alive by JavaScript objects (i.e. a JavaScript object | |
| 5748 | - that points to its own memory allocated by a native module). Registering | ||
| 5748 | + that points to its own memory allocated by a native addon). Registering | ||
| 5749 | 5749 | externally allocated memory will trigger global garbage collections more | |
| 5750 | 5750 | often than it would otherwise. | |
| 5751 | 5751 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | # Contributing a new API to Node-API | |
| 2 | 2 | ||
| 3 | - Node-API is the next-generation ABI-stable API for native modules. | ||
| 3 | + Node-API is the next-generation ABI-stable API for native addons. | ||
| 4 | 4 | While improving the API surface is encouraged and welcomed, the following are | |
| 5 | 5 | a set of principles and guidelines to keep in mind while adding a new | |
| 6 | 6 | Node-API. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -65,7 +65,7 @@ const { openSync, closeSync, readSync } = require('fs'); | |||
| 65 | 65 | const { inspect } = require('internal/util/inspect'); | |
| 66 | 66 | const { isPromise, isRegExp } = require('internal/util/types'); | |
| 67 | 67 | const { EOL } = require('internal/constants'); | |
| 68 | - const { NativeModule } = require('internal/bootstrap/loaders'); | ||
| 68 | + const { BuiltinModule } = require('internal/bootstrap/loaders'); | ||
| 69 | 69 | const { isError } = require('internal/util'); | |
| 70 | 70 | ||
| 71 | 71 | const errorCache = new SafeMap(); | |
@@ -303,7 +303,7 @@ function getErrMessage(message, fn) { | |||
| 303 | 303 | ||
| 304 | 304 | // Skip Node.js modules! | |
| 305 | 305 | if (StringPrototypeStartsWith(filename, 'node:') && | |
| 306 | - NativeModule.exists(StringPrototypeSlice(filename, 5))) { | ||
| 306 | + BuiltinModule.exists(StringPrototypeSlice(filename, 5))) { | ||
| 307 | 307 | errorCache.set(identifier, undefined); | |
| 308 | 308 | return; | |
| 309 | 309 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,7 @@ | |||
| 24 | 24 | // and have their nm_flags set to NM_F_INTERNAL. | |
| 25 | 25 | // | |
| 26 | 26 | // Internal JavaScript module loader: | |
| 27 | - // - NativeModule: a minimal module system used to load the JavaScript core | ||
| 27 | + // - BuiltinModule: a minimal module system used to load the JavaScript core | ||
| 28 | 28 | // modules found in lib/**/*.js and deps/**/*.js. All core modules are | |
| 29 | 29 | // compiled into the node binary via node_javascript.cc generated by js2c.py, | |
| 30 | 30 | // so they can be loaded faster without the cost of I/O. This class makes the | |
@@ -180,9 +180,9 @@ let internalBinding; | |||
| 180 | 180 | ||
| 181 | 181 | const loaderId = 'internal/bootstrap/loaders'; | |
| 182 | 182 | const { | |
| 183 | - moduleIds, | ||
| 183 | + builtinIds, | ||
| 184 | 184 | compileFunction | |
| 185 | - } = internalBinding('native_module'); | ||
| 185 | + } = internalBinding('builtins'); | ||
| 186 | 186 | ||
| 187 | 187 | const getOwn = (target, property, receiver) => { | |
| 188 | 188 | return ObjectPrototypeHasOwnProperty(target, property) ? | |
@@ -195,13 +195,13 @@ const getOwn = (target, property, receiver) => { | |||
| 195 | 195 | * Be careful not to expose this to user land unless --expose-internals is | |
| 196 | 196 | * used, in which case there is no compatibility guarantee about this class. | |
| 197 | 197 | */ | |
| 198 | - class NativeModule { | ||
| 198 | + class BuiltinModule { | ||
| 199 | 199 | /** | |
| 200 | 200 | * A map from the module IDs to the module instances. | |
| 201 | - * @type {Map<string, NativeModule>} | ||
| 201 | + * @type {Map<string, BuiltinModule>} | ||
| 202 | 202 | */ | |
| 203 | 203 | static map = new SafeMap( | |
| 204 | - ArrayPrototypeMap(moduleIds, (id) => [id, new NativeModule(id)]) | ||
| 204 | + ArrayPrototypeMap(builtinIds, (id) => [id, new BuiltinModule(id)]) | ||
| 205 | 205 | ); | |
| 206 | 206 | ||
| 207 | 207 | constructor(id) { | |
@@ -216,7 +216,7 @@ class NativeModule { | |||
| 216 | 216 | this.loading = false; | |
| 217 | 217 | ||
| 218 | 218 | // The following properties are used by the ESM implementation and only | |
| 219 | - // initialized when the native module is loaded by users. | ||
| 219 | + // initialized when the built-in module is loaded by users. | ||
| 220 | 220 | /** | |
| 221 | 221 | * The C++ ModuleWrap binding used to interface with the ESM implementation. | |
| 222 | 222 | * @type {ModuleWrap|undefined} | |
@@ -232,7 +232,7 @@ class NativeModule { | |||
| 232 | 232 | // To be called during pre-execution when --expose-internals is on. | |
| 233 | 233 | // Enables the user-land module loader to access internal modules. | |
| 234 | 234 | static exposeInternals() { | |
| 235 | - for (const { 0: id, 1: mod } of NativeModule.map) { | ||
| 235 | + for (const { 0: id, 1: mod } of BuiltinModule.map) { | ||
| 236 | 236 | // Do not expose this to user land even with --expose-internals. | |
| 237 | 237 | if (id !== loaderId) { | |
| 238 | 238 | mod.canBeRequiredByUsers = true; | |
@@ -241,11 +241,11 @@ class NativeModule { | |||
| 241 | 241 | } | |
| 242 | 242 | ||
| 243 | 243 | static exists(id) { | |
| 244 | - return NativeModule.map.has(id); | ||
| 244 | + return BuiltinModule.map.has(id); | ||
| 245 | 245 | } | |
| 246 | 246 | ||
| 247 | 247 | static canBeRequiredByUsers(id) { | |
| 248 | - const mod = NativeModule.map.get(id); | ||
| 248 | + const mod = BuiltinModule.map.get(id); | ||
| 249 | 249 | return mod && mod.canBeRequiredByUsers; | |
| 250 | 250 | } | |
| 251 | 251 | ||
@@ -326,13 +326,17 @@ class NativeModule { | |||
| 326 | 326 | requireWithFallbackInDeps : nativeModuleRequire; | |
| 327 | 327 | ||
| 328 | 328 | const fn = compileFunction(id); | |
| 329 | + // Arguments must match the parameters specified in | ||
| 330 | + // BuiltinLoader::LookupAndCompile(). | ||
| 329 | 331 | fn(this.exports, requireFn, this, process, internalBinding, primordials); | |
| 330 | 332 | ||
| 331 | 333 | this.loaded = true; | |
| 332 | 334 | } finally { | |
| 333 | 335 | this.loading = false; | |
| 334 | 336 | } | |
| 335 | 337 | ||
| 338 | + // "NativeModule" is a legacy name of "BuiltinModule". We keep it | ||
| 339 | + // here to avoid breaking users who parse process.moduleLoadList. | ||
| 336 | 340 | ArrayPrototypePush(moduleLoadList, `NativeModule ${id}`); | |
| 337 | 341 | return this.exports; | |
| 338 | 342 | } | |
@@ -342,7 +346,7 @@ class NativeModule { | |||
| 342 | 346 | // written in CommonJS style. | |
| 343 | 347 | const loaderExports = { | |
| 344 | 348 | internalBinding, | |
| 345 | - NativeModule, | ||
| 349 | + BuiltinModule, | ||
| 346 | 350 | require: nativeModuleRequire | |
| 347 | 351 | }; | |
| 348 | 352 | ||
@@ -351,7 +355,7 @@ function nativeModuleRequire(id) { | |||
| 351 | 355 | return loaderExports; | |
| 352 | 356 | } | |
| 353 | 357 | ||
| 354 | - const mod = NativeModule.map.get(id); | ||
| 358 | + const mod = BuiltinModule.map.get(id); | ||
| 355 | 359 | // Can't load the internal errors module from here, have to use a raw error. | |
| 356 | 360 | // eslint-disable-next-line no-restricted-syntax | |
| 357 | 361 | if (!mod) throw new TypeError(`Missing internal module '${id}'`); | |
@@ -361,7 +365,7 @@ function nativeModuleRequire(id) { | |||
| 361 | 365 | // Allow internal modules from dependencies to require | |
| 362 | 366 | // other modules from dependencies by providing fallbacks. | |
| 363 | 367 | function requireWithFallbackInDeps(request) { | |
| 364 | - if (!NativeModule.map.has(request)) { | ||
| 368 | + if (!BuiltinModule.map.has(request)) { | ||
| 365 | 369 | request = `internal/deps/${request}`; | |
| 366 | 370 | } | |
| 367 | 371 | return nativeModuleRequire(request); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ | |||
| 34 | 34 | // `MessagePort` implementation. | |
| 35 | 35 | // - `lib/internal/bootstrap/loaders.js`: this sets up internal binding and | |
| 36 | 36 | // module loaders, including `process.binding()`, `process._linkedBinding()`, | |
| 37 | - // `internalBinding()` and `NativeModule`. | ||
| 37 | + // `internalBinding()` and `BuiltinModule`. | ||
| 38 | 38 | // | |
| 39 | 39 | // The initialization done in this script is included in both the main thread | |
| 40 | 40 | // and the worker threads. After this, further initialization is done based | |
@@ -102,7 +102,7 @@ process.domain = null; | |||
| 102 | 102 | process._exiting = false; | |
| 103 | 103 | ||
| 104 | 104 | // process.config is serialized config.gypi | |
| 105 | - const nativeModule = internalBinding('native_module'); | ||
| 105 | + const nativeModule = internalBinding('builtins'); | ||
| 106 | 106 | ||
| 107 | 107 | // TODO(@jasnell): Once this has gone through one full major | |
| 108 | 108 | // release cycle, remove the Proxy and setter and update the | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -290,7 +290,7 @@ function initializeReport() { | |||
| 290 | 290 | function setupDebugEnv() { | |
| 291 | 291 | require('internal/util/debuglog').initializeDebugEnv(process.env.NODE_DEBUG); | |
| 292 | 292 | if (getOptionValue('--expose-internals')) { | |
| 293 | - require('internal/bootstrap/loaders').NativeModule.exposeInternals(); | ||
| 293 | + require('internal/bootstrap/loaders').BuiltinModule.exposeInternals(); | ||
| 294 | 294 | } | |
| 295 | 295 | } | |
| 296 | 296 | ||
@@ -512,8 +512,8 @@ function initializePolicy() { | |||
| 512 | 512 | } | |
| 513 | 513 | ||
| 514 | 514 | function initializeWASI() { | |
| 515 | - const { NativeModule } = require('internal/bootstrap/loaders'); | ||
| 516 | - const mod = NativeModule.map.get('wasi'); | ||
| 515 | + const { BuiltinModule } = require('internal/bootstrap/loaders'); | ||
| 516 | + const mod = BuiltinModule.map.get('wasi'); | ||
| 517 | 517 | mod.canBeRequiredByUsers = | |
| 518 | 518 | getOptionValue('--experimental-wasi-unstable-preview1'); | |
| 519 | 519 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -117,8 +117,8 @@ function extractFunctionName(description) { | |||
| 117 | 117 | } | |
| 118 | 118 | ||
| 119 | 119 | const { | |
| 120 | - moduleIds: PUBLIC_BUILTINS, | ||
| 121 | - } = internalBinding('native_module'); | ||
| 120 | + builtinIds: PUBLIC_BUILTINS, | ||
| 121 | + } = internalBinding('builtins'); | ||
| 122 | 122 | const NATIVES = internalBinding('natives'); | |
| 123 | 123 | function isNativeUrl(url) { | |
| 124 | 124 | url = RegExpPrototypeSymbolReplace(/\.js$/, url, ''); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments