Skip to content

Commit 98fed76

Browse files
aduh95targos
authored andcommitted
build: add --without-amaro build flag
PR-URL: #54136 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 7772b46 commit 98fed76

10 files changed

+43
-7
lines changed

configure.py

+7
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,12 @@
765765
default=None,
766766
help='build nghttp2 with DEBUGBUILD (default is false)')
767767

768+
parser.add_argument('--without-amaro',
769+
action='store_true',
770+
dest='without_amaro',
771+
default=None,
772+
help='do not install the bundled Amaro (TypeScript utils)')
773+
768774
parser.add_argument('--without-npm',
769775
action='store_true',
770776
dest='without_npm',
@@ -1381,6 +1387,7 @@ def configure_node(o):
13811387
o['variables']['node_prefix'] = options.prefix
13821388
o['variables']['node_install_npm'] = b(not options.without_npm)
13831389
o['variables']['node_install_corepack'] = b(not options.without_corepack)
1390+
o['variables']['node_use_amaro'] = b(not options.without_amaro)
13841391
o['variables']['debug_node'] = b(options.debug_node)
13851392
o['default_configuration'] = 'Debug' if options.debug else 'Release'
13861393
o['variables']['error_on_warn'] = b(options.error_on_warn)

node.gyp

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
'force_dynamic_crt%': 0,
1515
'ossfuzz' : 'false',
1616
'node_module_version%': '',
17+
'node_use_amaro%': 'true',
1718
'node_shared_brotli%': 'false',
1819
'node_shared_zlib%': 'false',
1920
'node_shared_http_parser%': 'false',
@@ -56,7 +57,6 @@
5657
'deps/acorn/acorn/dist/acorn.js',
5758
'deps/acorn/acorn-walk/dist/walk.js',
5859
'deps/minimatch/index.js',
59-
'deps/amaro/dist/index.js',
6060
'<@(node_builtin_shareable_builtins)',
6161
],
6262
'node_sources': [
@@ -461,6 +461,11 @@
461461
}, {
462462
'use_openssl_def%': 0,
463463
}],
464+
[ 'node_use_amaro=="true"', {
465+
'deps_files': [
466+
'deps/amaro/dist/index.js',
467+
]
468+
} ]
464469
],
465470
},
466471

node.gypi

+5
Original file line numberDiff line numberDiff line change
@@ -412,5 +412,10 @@
412412
}, {
413413
'defines': [ 'HAVE_OPENSSL=0' ]
414414
}],
415+
[ 'node_use_amaro=="true"', {
416+
'defines': [ 'HAVE_AMARO=1' ],
417+
}, {
418+
'defines': [ 'HAVE_AMARO=0' ]
419+
}],
415420
],
416421
}

src/node_metadata.cc

+3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ Metadata::Versions::Versions() {
126126
acorn = ACORN_VERSION;
127127
cjs_module_lexer = CJS_MODULE_LEXER_VERSION;
128128
uvwasi = UVWASI_VERSION_STRING;
129+
130+
#if HAVE_AMARO
129131
amaro = AMARO_VERSION;
132+
#endif
130133

131134
#if HAVE_OPENSSL
132135
openssl = GetOpenSSLVersion();

src/node_metadata.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ namespace node {
2727
#define NODE_HAS_RELEASE_URLS
2828
#endif
2929

30+
#if HAVE_AMARO
31+
#define NODE_VERSIONS_KEY_AMARO(V) V(amaro)
32+
#else
33+
#define NODE_VERSIONS_KEY_AMARO(V)
34+
#endif
35+
3036
#ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH
3137
#define NODE_VERSIONS_KEY_UNDICI(V) V(undici)
3238
#else
@@ -51,7 +57,7 @@ namespace node {
5157
V(sqlite) \
5258
V(ada) \
5359
V(nbytes) \
54-
V(amaro) \
60+
NODE_VERSIONS_KEY_AMARO(V) \
5561
NODE_VERSIONS_KEY_UNDICI(V) \
5662
V(cjs_module_lexer)
5763

test/es-module/test-typescript-commonjs.mjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { spawnPromisified } from '../common/index.mjs';
1+
import { skip, spawnPromisified } from '../common/index.mjs';
22
import * as fixtures from '../common/fixtures.mjs';
33
import { match, strictEqual } from 'node:assert';
44
import { test } from 'node:test';
55

6+
if (!process.config.variables.node_use_amaro) skip('Requires Amaro');
7+
68
test('require a .ts file with explicit extension succeeds', async () => {
79
const result = await spawnPromisified(process.execPath, [
810
'--experimental-strip-types',

test/es-module/test-typescript-eval.mjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { spawnPromisified } from '../common/index.mjs';
1+
import { skip, spawnPromisified } from '../common/index.mjs';
22
import { match, strictEqual } from 'node:assert';
33
import { test } from 'node:test';
44

5+
if (!process.config.variables.node_use_amaro) skip('Requires Amaro');
6+
57
test('eval TypeScript ESM syntax', async () => {
68
const result = await spawnPromisified(process.execPath, [
79
'--experimental-strip-types',

test/es-module/test-typescript-module.mjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { spawnPromisified } from '../common/index.mjs';
1+
import { skip, spawnPromisified } from '../common/index.mjs';
22
import * as fixtures from '../common/fixtures.mjs';
33
import { match, strictEqual } from 'node:assert';
44
import { test } from 'node:test';
55

6+
if (!process.config.variables.node_use_amaro) skip('Requires Amaro');
7+
68
test('expect failure of a .mts file with CommonJS syntax', async () => {
79
const result = await spawnPromisified(process.execPath, [
810
'--experimental-strip-types',

test/es-module/test-typescript.mjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { spawnPromisified } from '../common/index.mjs';
1+
import { skip, spawnPromisified } from '../common/index.mjs';
22
import * as fixtures from '../common/fixtures.mjs';
33
import { match, strictEqual } from 'node:assert';
44
import { test } from 'node:test';
55

6+
if (!process.config.variables.node_use_amaro) skip('Requires Amaro');
7+
68
test('execute a TypeScript file', async () => {
79
const result = await spawnPromisified(process.execPath, [
810
'--experimental-strip-types',

test/parallel/test-process-versions.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ const expected_keys = [
2424
'ada',
2525
'cjs_module_lexer',
2626
'nbytes',
27-
'amaro',
2827
];
2928

3029
const hasUndici = process.config.variables.node_builtin_shareable_builtins.includes('deps/undici/undici.js');
3130

31+
if (process.config.variables.node_use_amaro) {
32+
expected_keys.push('amaro');
33+
}
3234
if (hasUndici) {
3335
expected_keys.push('undici');
3436
}

0 commit comments

Comments
 (0)