lib: fix nits in lib/internal/bootstrap/cache.js
* Unwrap short lines. * Unify comments. * Decrease function calls. PR-URL: https://github.com/nodejs/node/pull/24581 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
afab340e67
commit
14707b681d
@ -3,15 +3,10 @@
|
|||||||
// This is only exposed for internal build steps and testing purposes.
|
// This is only exposed for internal build steps and testing purposes.
|
||||||
// We create new copies of the source and the code cache
|
// We create new copies of the source and the code cache
|
||||||
// so the resources eventually used to compile builtin modules
|
// so the resources eventually used to compile builtin modules
|
||||||
// cannot be tampered with even with --expose-internals
|
// cannot be tampered with even with --expose-internals.
|
||||||
|
|
||||||
const {
|
const { NativeModule } = require('internal/bootstrap/loaders');
|
||||||
NativeModule
|
const { getSource, compileCodeCache } = internalBinding('native_module');
|
||||||
} = require('internal/bootstrap/loaders');
|
|
||||||
const {
|
|
||||||
getSource,
|
|
||||||
compileCodeCache
|
|
||||||
} = internalBinding('native_module');
|
|
||||||
const { hasTracing } = process.binding('config');
|
const { hasTracing } = process.binding('config');
|
||||||
|
|
||||||
const source = getSource();
|
const source = getSource();
|
||||||
@ -20,10 +15,10 @@ const depsModule = Object.keys(source).filter(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Modules with source code compiled in js2c that
|
// Modules with source code compiled in js2c that
|
||||||
// cannot be compiled with the code cache
|
// cannot be compiled with the code cache.
|
||||||
const cannotUseCache = [
|
const cannotUseCache = [
|
||||||
'config',
|
'config',
|
||||||
'sys', // deprecated
|
'sys', // Deprecated.
|
||||||
'internal/v8_prof_polyfill',
|
'internal/v8_prof_polyfill',
|
||||||
'internal/v8_prof_processor',
|
'internal/v8_prof_processor',
|
||||||
|
|
||||||
@ -31,8 +26,7 @@ const cannotUseCache = [
|
|||||||
|
|
||||||
'internal/test/binding',
|
'internal/test/binding',
|
||||||
// TODO(joyeecheung): update the C++ side so that
|
// TODO(joyeecheung): update the C++ side so that
|
||||||
// the code cache is also used when compiling these
|
// the code cache is also used when compiling these two files.
|
||||||
// two files.
|
|
||||||
'internal/bootstrap/loaders',
|
'internal/bootstrap/loaders',
|
||||||
'internal/bootstrap/node'
|
'internal/bootstrap/node'
|
||||||
].concat(depsModule);
|
].concat(depsModule);
|
||||||
@ -40,32 +34,36 @@ const cannotUseCache = [
|
|||||||
// Skip modules that cannot be required when they are not
|
// Skip modules that cannot be required when they are not
|
||||||
// built into the binary.
|
// built into the binary.
|
||||||
if (process.config.variables.v8_enable_inspector !== 1) {
|
if (process.config.variables.v8_enable_inspector !== 1) {
|
||||||
cannotUseCache.push('inspector');
|
cannotUseCache.push(
|
||||||
cannotUseCache.push('internal/util/inspector');
|
'inspector',
|
||||||
|
'internal/util/inspector',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!hasTracing) {
|
if (!hasTracing) {
|
||||||
cannotUseCache.push('trace_events');
|
cannotUseCache.push('trace_events');
|
||||||
}
|
}
|
||||||
if (!process.versions.openssl) {
|
if (!process.versions.openssl) {
|
||||||
cannotUseCache.push('crypto');
|
cannotUseCache.push(
|
||||||
cannotUseCache.push('https');
|
'crypto',
|
||||||
cannotUseCache.push('http2');
|
'https',
|
||||||
cannotUseCache.push('tls');
|
'http2',
|
||||||
cannotUseCache.push('_tls_common');
|
'tls',
|
||||||
cannotUseCache.push('_tls_wrap');
|
'_tls_common',
|
||||||
cannotUseCache.push('internal/crypto/certificate');
|
'_tls_wrap',
|
||||||
cannotUseCache.push('internal/crypto/cipher');
|
'internal/crypto/certificate',
|
||||||
cannotUseCache.push('internal/crypto/diffiehellman');
|
'internal/crypto/cipher',
|
||||||
cannotUseCache.push('internal/crypto/hash');
|
'internal/crypto/diffiehellman',
|
||||||
cannotUseCache.push('internal/crypto/keygen');
|
'internal/crypto/hash',
|
||||||
cannotUseCache.push('internal/crypto/pbkdf2');
|
'internal/crypto/keygen',
|
||||||
cannotUseCache.push('internal/crypto/random');
|
'internal/crypto/pbkdf2',
|
||||||
cannotUseCache.push('internal/crypto/scrypt');
|
'internal/crypto/random',
|
||||||
cannotUseCache.push('internal/crypto/sig');
|
'internal/crypto/scrypt',
|
||||||
cannotUseCache.push('internal/crypto/util');
|
'internal/crypto/sig',
|
||||||
cannotUseCache.push('internal/http2/core');
|
'internal/crypto/util',
|
||||||
cannotUseCache.push('internal/http2/compat');
|
'internal/http2/core',
|
||||||
cannotUseCache.push('internal/streams/lazy_transform');
|
'internal/http2/compat',
|
||||||
|
'internal/streams/lazy_transform',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user