Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
build: add --without-amaro build flag
  • Loading branch information
aduh95 committed Jul 31, 2024
commit 92cc486d89d8c84c1341f5cb2325426cf8f2415d
7 changes: 7 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,12 @@
default=None,
help='build nghttp2 with DEBUGBUILD (default is false)')

parser.add_argument('--without-amaro',
action='store_true',
dest='without_amaro',
default=None,
help='do not install the bundled Amaro (TypeScript utils)')

parser.add_argument('--without-npm',
action='store_true',
dest='without_npm',
Expand Down Expand Up @@ -1378,6 +1384,7 @@ def configure_node(o):
if options.dest_os == 'android':
o['variables']['OS'] = 'android'
o['variables']['node_prefix'] = options.prefix
o['variables']['node_install_amaro'] = b(not options.without_amaro)
o['variables']['node_install_npm'] = b(not options.without_npm)
o['variables']['node_install_corepack'] = b(not options.without_corepack)
o['variables']['debug_node'] = b(options.debug_node)
Expand Down
10 changes: 9 additions & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'force_dynamic_crt%': 0,
'ossfuzz' : 'false',
'node_module_version%': '',
'node_install_amaro%': 'true',
'node_shared_brotli%': 'false',
'node_shared_zlib%': 'false',
'node_shared_http_parser%': 'false',
Expand Down Expand Up @@ -56,7 +57,6 @@
'deps/acorn/acorn/dist/acorn.js',
'deps/acorn/acorn-walk/dist/walk.js',
'deps/minimatch/index.js',
'deps/amaro/dist/index.js',
'<@(node_builtin_shareable_builtins)',
],
'node_sources': [
Expand Down Expand Up @@ -461,6 +461,14 @@
}, {
'use_openssl_def%': 0,
}],
[ 'node_install_amaro=="true"', {
'defines': [
'HAVE_AMARO=1',
],
'deps_files': [
'deps/amaro/dist/index.js',
]
} ]
],
},

Expand Down
3 changes: 3 additions & 0 deletions src/node_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ Metadata::Versions::Versions() {
acorn = ACORN_VERSION;
cjs_module_lexer = CJS_MODULE_LEXER_VERSION;
uvwasi = UVWASI_VERSION_STRING;

#if HAVE_AMARO
amaro = AMARO_VERSION;
#endif

#if HAVE_OPENSSL
openssl = GetOpenSSLVersion();
Expand Down
8 changes: 7 additions & 1 deletion src/node_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ namespace node {
#define NODE_HAS_RELEASE_URLS
#endif

#ifndef HAVE_AMARO
#define NODE_VERSIONS_KEY_AMARO(V)
#else
#define NODE_VERSIONS_KEY_AMARO(V) V(amaro)
#endif

#ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH
#define NODE_VERSIONS_KEY_UNDICI(V) V(undici)
#else
Expand All @@ -51,7 +57,7 @@ namespace node {
V(sqlite) \
V(ada) \
V(nbytes) \
V(amaro) \
NODE_VERSIONS_KEY_AMARO(V) \
NODE_VERSIONS_KEY_UNDICI(V) \
V(cjs_module_lexer)

Expand Down
4 changes: 3 additions & 1 deletion test/es-module/test-typescript-commonjs.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { spawnPromisified } from '../common/index.mjs';
import { skip, spawnPromisified } from '../common/index.mjs';
import * as fixtures from '../common/fixtures.mjs';
import { match, strictEqual } from 'node:assert';
import { test } from 'node:test';

if (!process.config.variables.node_install_amaro) skip('Requires Amaro')

test('require a .ts file with explicit extension succeeds', async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-strip-types',
Expand Down
4 changes: 3 additions & 1 deletion test/es-module/test-typescript-eval.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { spawnPromisified } from '../common/index.mjs';
import { skip, spawnPromisified } from '../common/index.mjs';
import { match, strictEqual } from 'node:assert';
import { test } from 'node:test';

if (!process.config.variables.node_install_amaro) skip('Requires Amaro')

test('eval TypeScript ESM syntax', async () => {
const result = await spawnPromisified(process.execPath, [
'--input-type=module',
Expand Down
4 changes: 3 additions & 1 deletion test/es-module/test-typescript-module.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { spawnPromisified } from '../common/index.mjs';
import { skip, spawnPromisified } from '../common/index.mjs';
import * as fixtures from '../common/fixtures.mjs';
import { match, strictEqual } from 'node:assert';
import { test } from 'node:test';

if (!process.config.variables.node_install_amaro) skip('Requires Amaro')

test('expect failure of a .mts file with CommonJS syntax', async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-strip-types',
Expand Down
4 changes: 3 additions & 1 deletion test/es-module/test-typescript.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { spawnPromisified } from '../common/index.mjs';
import { skip, spawnPromisified } from '../common/index.mjs';
import * as fixtures from '../common/fixtures.mjs';
import { match, strictEqual } from 'node:assert';
import { test } from 'node:test';

if (!process.config.variables.node_install_amaro) skip('Requires Amaro')

test('execute a TypeScript file', async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-strip-types',
Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-process-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ const expected_keys = [
'ada',
'cjs_module_lexer',
'nbytes',
'amaro',
];

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

if (process.config.variables.node_install_amaro){
expected_keys.push('amaro');
}
if (hasUndici) {
expected_keys.push('undici');
}
Expand Down