diff --git a/configure.py b/configure.py index 870c89a1c7e..8b78eb006ec 100755 --- a/configure.py +++ b/configure.py @@ -58,9 +58,11 @@ valid_intl_modes = ('none', 'small-icu', 'full-icu', 'system-icu') icu_versions = json.loads((tools_path / 'icu' / 'icu_versions.json').read_text(encoding='utf-8')) maglev_enabled_architectures = ('x64', 'arm', 'arm64') +# builtins may be removed later if they have been disabled by options shareable_builtins = {'cjs_module_lexer/lexer': 'deps/cjs-module-lexer/lexer.js', 'cjs_module_lexer/dist/lexer': 'deps/cjs-module-lexer/dist/lexer.js', - 'undici/undici': 'deps/undici/undici.js' + 'undici/undici': 'deps/undici/undici.js', + 'amaro/dist/index': 'deps/amaro/dist/index.js' } # create option groups @@ -2202,6 +2204,10 @@ configure_static(output) configure_inspector(output) configure_section_file(output) +# remove builtins that have been disabled +if options.without_amaro: + del shareable_builtins['amaro/dist/index'] + # configure shareable builtins output['variables']['node_builtin_shareable_builtins'] = [] for builtin, value in shareable_builtins.items(): diff --git a/node.gni b/node.gni index f7d896f0ef1..9dca810dece 100644 --- a/node.gni +++ b/node.gni @@ -20,6 +20,7 @@ declare_args() { "deps/cjs-module-lexer/lexer.js", "deps/cjs-module-lexer/dist/lexer.js", "deps/undici/undici.js", + "deps/amaro/dist/index.js", ] } diff --git a/node.gyp b/node.gyp index c64e2768198..ac128c95d9c 100644 --- a/node.gyp +++ b/node.gyp @@ -466,11 +466,6 @@ }, { 'use_openssl_def%': 0, }], - [ 'node_use_amaro=="true"', { - 'deps_files': [ - 'deps/amaro/dist/index.js', - ] - } ] ], }, diff --git a/src/node_builtins.cc b/src/node_builtins.cc index 97dde02295c..2bc7155f7c0 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -50,6 +50,13 @@ BuiltinLoader::BuiltinLoader() AddExternalizedBuiltin("internal/deps/undici/undici", STRINGIFY(NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH)); #endif // NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH + +#if HAVE_AMARO +#ifdef NODE_SHARED_BUILTIN_AMARO_DIST_INDEX_PATH + AddExternalizedBuiltin("internal/deps/amaro/dist/index", + STRINGIFY(NODE_SHARED_BUILTIN_AMARO_DIST_INDEX_PATH)); +#endif // NODE_SHARED_BUILTIN_AMARO_DIST_INDEX_PATH +#endif // HAVE_AMARO } bool BuiltinLoader::Exists(const char* id) { diff --git a/src/node_metadata.cc b/src/node_metadata.cc index 4ab98d91d84..db30578fb30 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -127,9 +127,11 @@ Metadata::Versions::Versions() { cjs_module_lexer = CJS_MODULE_LEXER_VERSION; uvwasi = UVWASI_VERSION_STRING; +#ifndef NODE_SHARED_BUILTIN_AMARO_DIST_INDEX_PATH #if HAVE_AMARO amaro = AMARO_VERSION; #endif +#endif #if HAVE_OPENSSL openssl = GetOpenSSLVersion(); diff --git a/src/node_metadata.h b/src/node_metadata.h index 76ec862fda1..c59e65ad1fe 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h @@ -27,7 +27,7 @@ namespace node { #define NODE_HAS_RELEASE_URLS #endif -#if HAVE_AMARO +#if HAVE_AMARO && !defined(NODE_SHARED_BUILTIN_AMARO_DIST_INDEX_PATH) #define NODE_VERSIONS_KEY_AMARO(V) V(amaro) #else #define NODE_VERSIONS_KEY_AMARO(V) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 7475b275940..3b8af4b5b52 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -27,9 +27,12 @@ const expected_keys = [ ]; const hasUndici = process.config.variables.node_builtin_shareable_builtins.includes('deps/undici/undici.js'); +const hasAmaro = process.config.variables.node_builtin_shareable_builtins.includes('deps/amaro/dist/index.js'); if (process.config.variables.node_use_amaro) { - expected_keys.push('amaro'); + if (hasAmaro) { + expected_keys.push('amaro'); + } } if (hasUndici) { expected_keys.push('undici');