diff --git a/configure.py b/configure.py index a51288a1590e45..31e0aa65cb7018 100755 --- a/configure.py +++ b/configure.py @@ -57,9 +57,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')) +# 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 @@ -2199,6 +2201,10 @@ def make_bin_override(): 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 f7d896f0ef1c13..9dca810decebd7 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 1c78addcd47cb1..11474953b186c7 100644 --- a/node.gyp +++ b/node.gyp @@ -465,11 +465,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 97dde02295c975..2bc7155f7c075e 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 d6e812df8161e6..f31b07490c6bf5 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 76ec862fda187b..c59e65ad1fe3fa 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 7475b2759407c3..3b8af4b5b52526 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');