mirror of
https://github.com/nodejs/node.git
synced 2025-05-11 06:49:53 +00:00

Currently, when configured --without-ssl there are two failures like the following: internal/util.js:101 throw new ERR_NO_CRYPTO(); ^ Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support at assertCrypto (internal/util.js:101:11) at crypto.js:31:1 at NativeModule.compile (internal/bootstrap/loaders.js:316:5) at NativeModule.require (internal/bootstrap/loaders.js:219:7) at internal/policy/manifest.js:10:16 at NativeModule.compile (internal/bootstrap/loaders.js:316:5) at NativeModule.require (internal/bootstrap/loaders.js:219:7) at internal/process/policy.js:6:22 at NativeModule.compile (internal/bootstrap/loaders.js:316:5) at Function.NativeModule.require (internal/bootstrap/loaders.js:219:7) This commit adds policy/manifest and process/policy to cannotUseCache. PR-URL: https://github.com/nodejs/node/pull/25606 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
'use strict';
|
|
|
|
// This is only exposed for internal build steps and testing purposes.
|
|
// We create new copies of the source and the code cache
|
|
// so the resources eventually used to compile builtin modules
|
|
// cannot be tampered with even with --expose-internals.
|
|
|
|
const { NativeModule } = require('internal/bootstrap/loaders');
|
|
const {
|
|
getCodeCache, compileFunction
|
|
} = internalBinding('native_module');
|
|
const { hasTracing, hasInspector } = process.binding('config');
|
|
|
|
// Modules with source code compiled in js2c that
|
|
// cannot be compiled with the code cache.
|
|
const cannotUseCache = [
|
|
'sys', // Deprecated.
|
|
'internal/v8_prof_polyfill',
|
|
'internal/v8_prof_processor',
|
|
|
|
'internal/per_context',
|
|
|
|
'internal/test/binding',
|
|
// TODO(joyeecheung): update the C++ side so that
|
|
// the code cache is also used when compiling these two files.
|
|
'internal/bootstrap/loaders',
|
|
'internal/bootstrap/node'
|
|
];
|
|
|
|
// Skip modules that cannot be required when they are not
|
|
// built into the binary.
|
|
if (!hasInspector) {
|
|
cannotUseCache.push(
|
|
'inspector',
|
|
'internal/util/inspector',
|
|
);
|
|
}
|
|
if (!hasTracing) {
|
|
cannotUseCache.push('trace_events');
|
|
}
|
|
if (!process.versions.openssl) {
|
|
cannotUseCache.push(
|
|
'crypto',
|
|
'https',
|
|
'http2',
|
|
'tls',
|
|
'_tls_common',
|
|
'_tls_wrap',
|
|
'internal/crypto/certificate',
|
|
'internal/crypto/cipher',
|
|
'internal/crypto/diffiehellman',
|
|
'internal/crypto/hash',
|
|
'internal/crypto/keygen',
|
|
'internal/crypto/keys',
|
|
'internal/crypto/pbkdf2',
|
|
'internal/crypto/random',
|
|
'internal/crypto/scrypt',
|
|
'internal/crypto/sig',
|
|
'internal/crypto/util',
|
|
'internal/http2/core',
|
|
'internal/http2/compat',
|
|
'internal/policy/manifest',
|
|
'internal/process/policy',
|
|
'internal/streams/lazy_transform',
|
|
);
|
|
}
|
|
|
|
const cachableBuiltins = [];
|
|
for (const id of NativeModule.map.keys()) {
|
|
if (id.startsWith('internal/deps')) {
|
|
cannotUseCache.push(id);
|
|
}
|
|
if (!cannotUseCache.includes(id)) {
|
|
cachableBuiltins.push(id);
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
cachableBuiltins,
|
|
getCodeCache,
|
|
compileFunction,
|
|
cannotUseCache
|
|
};
|