Skip to content

Commit 696c2a0

Browse files
build: add type ts support in core
1 parent 3725bd2 commit 696c2a0

15 files changed

Lines changed: 1693 additions & 152 deletions

File tree

.github/workflows/test-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ env:
3838
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19
3939
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
4040
SCCACHE_IDLE_TIMEOUT: '0'
41-
RUSTC_VERSION: '1.82'
41+
RUSTC_VERSION: '1.85'
4242

4343
permissions:
4444
contents: read

.github/workflows/test-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ env:
6666
PYTHON_VERSION: '3.14'
6767
XCODE_VERSION: '16.4'
6868
FLAKY_TESTS: keep_retrying
69-
RUSTC_VERSION: '1.82'
69+
RUSTC_VERSION: '1.85'
7070

7171
permissions:
7272
contents: read

.github/workflows/test-shared.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ concurrency:
104104

105105
env:
106106
FLAKY_TESTS: keep_retrying
107+
RUSTC_VERSION: '1.85'
107108

108109
permissions:
109110
contents: read
@@ -119,6 +120,12 @@ jobs:
119120
with:
120121
persist-credentials: false
121122

123+
- name: Install Rust ${{ env.RUSTC_VERSION }}
124+
if: ${{ github.event_name != 'workflow_dispatch' }}
125+
run: |
126+
rustup override set "$RUSTC_VERSION"
127+
rustup --version
128+
122129
- name: Make tarball
123130
if: ${{ github.event_name != 'workflow_dispatch' }}
124131
run: |

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,6 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
12171217
$(RM) -r $(TARNAME)/deps/ada
12181218
$(RM) -r $(TARNAME)/deps/brotli
12191219
$(RM) -r $(TARNAME)/deps/cares
1220-
$(RM) -r $(TARNAME)/deps/crates
12211220
$(RM) -r $(TARNAME)/deps/googletest
12221221
$(RM) -r $(TARNAME)/deps/histogram
12231222
$(RM) -r $(TARNAME)/deps/icu-small

configure.py

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,12 @@
11691169
default=False,
11701170
help='node will load builtin modules from disk instead of from binary')
11711171

1172+
parser.add_argument('--output-transpiled-ts',
1173+
action='store',
1174+
dest='output_transpiled_ts',
1175+
default='',
1176+
help='write transpiled TypeScript output to the given directory for debugging')
1177+
11721178
parser.add_argument('--node-snapshot-main',
11731179
action='store',
11741180
dest='node_snapshot_main',
@@ -1535,23 +1541,24 @@ def check_compiler(o):
15351541

15361542
o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else '0.0'
15371543

1538-
# cargo and rustc are needed for Temporal.
1539-
if options.v8_enable_temporal_support and not options.shared_temporal_capi:
1540-
# Minimum cargo and rustc versions should match values in BUILDING.md.
1541-
min_cargo_ver_tuple = (1, 82)
1542-
min_rustc_ver_tuple = (1, 82)
1543-
cargo_ver = get_cargo_version('cargo')
1544-
print_verbose(f'Detected cargo: {cargo_ver}')
1545-
cargo_ver_tuple = tuple(map(int, cargo_ver.split('.')))
1546-
if cargo_ver_tuple < min_cargo_ver_tuple:
1547-
warn(f'cargo {cargo_ver} too old, need cargo {".".join(map(str, min_cargo_ver_tuple))}')
1548-
# cargo supports RUSTC environment variable to override "rustc".
1549-
rustc = os.environ.get('RUSTC', 'rustc')
1550-
rustc_ver = get_rustc_version(rustc)
1551-
print_verbose(f'Detected rustc (RUSTC={rustc}): {rustc_ver}')
1552-
rust_ver_tuple = tuple(map(int, rustc_ver.split('.')))
1553-
if rust_ver_tuple < min_rustc_ver_tuple:
1554-
warn(f'rustc {rustc_ver} too old, need rustc {".".join(map(str, min_rustc_ver_tuple))}')
1544+
# cargo and rustc are always required:
1545+
# - SWC (deps/crates) is used by js2c to transpile TypeScript builtins.
1546+
# - Temporal (when enabled) also builds from deps/crates.
1547+
# Minimum cargo and rustc versions should match values in BUILDING.md.
1548+
min_cargo_ver_tuple = (1, 85)
1549+
min_rustc_ver_tuple = (1, 85)
1550+
cargo_ver = get_cargo_version('cargo')
1551+
print_verbose(f'Detected cargo: {cargo_ver}')
1552+
cargo_ver_tuple = tuple(map(int, cargo_ver.split('.')))
1553+
if cargo_ver_tuple < min_cargo_ver_tuple:
1554+
warn(f'cargo {cargo_ver} too old, need cargo {".".join(map(str, min_cargo_ver_tuple))}')
1555+
# cargo supports RUSTC environment variable to override "rustc".
1556+
rustc = os.environ.get('RUSTC', 'rustc')
1557+
rustc_ver = get_rustc_version(rustc)
1558+
print_verbose(f'Detected rustc (RUSTC={rustc}): {rustc_ver}')
1559+
rust_ver_tuple = tuple(map(int, rustc_ver.split('.')))
1560+
if rust_ver_tuple < min_rustc_ver_tuple:
1561+
warn(f'rustc {rustc_ver} too old, need rustc {".".join(map(str, min_rustc_ver_tuple))}')
15551562

15561563
# Need xcode_version or gas_version when openssl asm files are compiled.
15571564
if options.without_ssl or options.openssl_no_asm or options.shared_openssl:
@@ -1737,7 +1744,7 @@ def gcc_version_ge(version_checked):
17371744
return True
17381745

17391746
def configure_node_lib_files(o):
1740-
o['variables']['node_library_files'] = SearchFiles('lib', 'js')
1747+
o['variables']['node_library_files'] = SearchFiles('lib', 'js') + SearchFiles('lib', 'ts')
17411748

17421749
def configure_node_cctest_sources(o):
17431750
o['variables']['node_cctest_sources'] = [ 'src/node_snapshot_stub.cc' ] + \
@@ -1976,6 +1983,11 @@ def configure_node(o):
19761983
print('Warning! Loading builtin modules from disk is for development')
19771984
o['variables']['node_builtin_modules_path'] = options.node_builtin_modules_path
19781985

1986+
if options.output_transpiled_ts:
1987+
o['variables']['output_transpiled_ts'] = os.path.abspath(options.output_transpiled_ts)
1988+
else:
1989+
o['variables']['output_transpiled_ts'] = ''
1990+
19791991
def configure_napi(output):
19801992
version = getnapibuildversion.get_napi_version()
19811993
output['variables']['napi_build_version'] = version

0 commit comments

Comments
 (0)