deps: add vendor depenency crate

Add cargo config to support building a unified cargo static lib to
include multiple crate dependencies to be used by Node.js.

This also allows additional crate dependencies to be added, like amaro.

PR-URL: https://github.com/nodejs/node/pull/61072
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Chengzhong Wu
2025-12-05 18:23:47 +00:00
committed by Node.js GitHub Bot
parent 6157c81f4b
commit 493ce19486
9 changed files with 588 additions and 6 deletions

View File

@@ -16,6 +16,7 @@ on:
- deps/ada/** - deps/ada/**
- deps/brotli/** - deps/brotli/**
- deps/cares/** - deps/cares/**
- deps/crates/**
- deps/corepack/** - deps/corepack/**
- deps/icu-small/** - deps/icu-small/**
- deps/icu-tmp/** - deps/icu-tmp/**
@@ -25,7 +26,6 @@ on:
- deps/openssl/*/** - deps/openssl/*/**
- deps/simdjson/** - deps/simdjson/**
- deps/sqlite/** - deps/sqlite/**
- deps/temporal/**
- deps/uv/** - deps/uv/**
- deps/uvwasi/** - deps/uvwasi/**
- deps/zlib/** - deps/zlib/**
@@ -62,6 +62,7 @@ on:
- deps/ada/** - deps/ada/**
- deps/brotli/** - deps/brotli/**
- deps/cares/** - deps/cares/**
- deps/crates/**
- deps/corepack/** - deps/corepack/**
- deps/icu-small/** - deps/icu-small/**
- deps/icu-tmp/** - deps/icu-tmp/**
@@ -71,7 +72,6 @@ on:
- deps/openssl/*/** - deps/openssl/*/**
- deps/simdjson/** - deps/simdjson/**
- deps/sqlite/** - deps/sqlite/**
- deps/temporal/**
- deps/uv/** - deps/uv/**
- deps/uvwasi/** - deps/uvwasi/**
- deps/zlib/** - deps/zlib/**

View File

@@ -1236,6 +1236,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
$(RM) -r $(TARNAME)/deps/ada $(RM) -r $(TARNAME)/deps/ada
$(RM) -r $(TARNAME)/deps/brotli $(RM) -r $(TARNAME)/deps/brotli
$(RM) -r $(TARNAME)/deps/cares $(RM) -r $(TARNAME)/deps/cares
$(RM) -r $(TARNAME)/deps/crates
$(RM) -r $(TARNAME)/deps/icu-small $(RM) -r $(TARNAME)/deps/icu-small
$(RM) -r $(TARNAME)/deps/icu-tmp $(RM) -r $(TARNAME)/deps/icu-tmp
$(RM) -r $(TARNAME)/deps/llhttp $(RM) -r $(TARNAME)/deps/llhttp
@@ -1245,7 +1246,6 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
find $(TARNAME)/deps/openssl -mindepth 1 -maxdepth 1 -type d -exec $(RM) -r {} + find $(TARNAME)/deps/openssl -mindepth 1 -maxdepth 1 -type d -exec $(RM) -r {} +
$(RM) -r $(TARNAME)/deps/simdjson $(RM) -r $(TARNAME)/deps/simdjson
$(RM) -r $(TARNAME)/deps/sqlite $(RM) -r $(TARNAME)/deps/sqlite
$(RM) -r $(TARNAME)/deps/temporal
$(RM) -r $(TARNAME)/deps/uv $(RM) -r $(TARNAME)/deps/uv
$(RM) -r $(TARNAME)/deps/uvwasi $(RM) -r $(TARNAME)/deps/uvwasi
$(RM) -r $(TARNAME)/deps/zlib $(RM) -r $(TARNAME)/deps/zlib

5
deps/crates/.cargo/config.toml vendored Normal file
View File

@@ -0,0 +1,5 @@
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"

3
deps/crates/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
# Include everything in `vendor/` except for hidden files
!vendor/**/*
.DS_Store

481
deps/crates/Cargo.lock generated vendored Normal file
View File

@@ -0,0 +1,481 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "autocfg"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "calendrical_calculations"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a0b39595c6ee54a8d0900204ba4c401d0ab4eb45adaf07178e8d017541529e7"
dependencies = [
"core_maths",
"displaydoc",
]
[[package]]
name = "core_maths"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30"
dependencies = [
"libm",
]
[[package]]
name = "diplomat"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ece782ffeb426ef0d3074c5623e8f6552cc912e4bbeecfda9583cb01b02b8ba1"
dependencies = [
"diplomat_core",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "diplomat-runtime"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c270cf75c6ba9d974a7a670d96c7bf8007cd0d03e1fbe128d62bd47d9fe25aef"
[[package]]
name = "diplomat_core"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb0f9322e2c506400ac3f374abfcaf9fd841fcdb729bbf008a135b600f99ede7"
dependencies = [
"proc-macro2",
"quote",
"serde",
"smallvec",
"strck",
"syn",
]
[[package]]
name = "displaydoc"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "icu_calendar"
version = "2.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "362941891d17750e05cd8fdfca4a89a86552825d625a937020ee1a65580da1f9"
dependencies = [
"calendrical_calculations",
"displaydoc",
"icu_calendar_data",
"icu_locale",
"icu_locale_core",
"icu_provider",
"ixdtf 0.5.0",
"tinystr",
"writeable",
"zerovec",
]
[[package]]
name = "icu_calendar_data"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7219c8639ab936713a87b571eed2bc2615aa9137e8af6eb221446ee5644acc18"
[[package]]
name = "icu_collections"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47"
dependencies = [
"displaydoc",
"potential_utf",
"yoke",
"zerofrom",
"zerovec",
]
[[package]]
name = "icu_locale"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ae5921528335e91da1b6c695dbf1ec37df5ac13faa3f91e5640be93aa2fbefd"
dependencies = [
"displaydoc",
"icu_collections",
"icu_locale_core",
"icu_locale_data",
"icu_provider",
"potential_utf",
"tinystr",
"zerovec",
]
[[package]]
name = "icu_locale_core"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93cca704c2d63cf8a91f5c2c5f88e027940dede132319b85a52939db9758f7e5"
dependencies = [
"displaydoc",
"litemap",
"tinystr",
"writeable",
"zerovec",
]
[[package]]
name = "icu_locale_data"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fdef0c124749d06a743c69e938350816554eb63ac979166590e2b4ee4252765"
[[package]]
name = "icu_provider"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af"
dependencies = [
"displaydoc",
"icu_locale_core",
"stable_deref_trait",
"tinystr",
"writeable",
"yoke",
"zerofrom",
"zerotrie",
"zerovec",
]
[[package]]
name = "ixdtf"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8289f7f711a1a51f80e2e368355d023042ca55d8d554fd5e953f01464c15842d"
dependencies = [
"displaydoc",
]
[[package]]
name = "ixdtf"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84de9d95a6d2547d9b77ee3f25fa0ee32e3c3a6484d47a55adebc0439c077992"
[[package]]
name = "libm"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
[[package]]
name = "litemap"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
[[package]]
name = "node_crates"
version = "0.1.0"
dependencies = [
"icu_calendar",
"icu_calendar_data",
"icu_collections",
"icu_locale",
"icu_locale_core",
"icu_locale_data",
"icu_provider",
"temporal_capi",
"temporal_rs",
"timezone_provider",
]
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]]
name = "potential_utf"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"
dependencies = [
"serde_core",
"writeable",
"zerovec",
]
[[package]]
name = "proc-macro2"
version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
dependencies = [
"proc-macro2",
]
[[package]]
name = "resb"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a067ab3b5ca3b4dc307d0de9cf75f9f5e6ca9717b192b2f28a36c83e5de9e76"
dependencies = [
"potential_utf",
"serde_core",
]
[[package]]
name = "serde"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
name = "serde_core"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "smallvec"
version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "stable_deref_trait"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "strck"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42316e70da376f3d113a68d138a60d8a9883c604fe97942721ec2068dab13a9f"
dependencies = [
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "synstructure"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "temporal_capi"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcf286aa4f5e07b9e46eeab2e1a55f8a752635f2fa92c88bf8287404e190c6cb"
dependencies = [
"diplomat",
"diplomat-runtime",
"icu_calendar",
"icu_locale",
"num-traits",
"temporal_rs",
"timezone_provider",
"writeable",
"zoneinfo64",
]
[[package]]
name = "temporal_rs"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7305090e19b67670330fde1365b7c2c8a3b5a5ef6c92efc238b3b964a8c395fd"
dependencies = [
"core_maths",
"icu_calendar",
"icu_locale",
"ixdtf 0.6.4",
"num-traits",
"timezone_provider",
"tinystr",
"writeable",
]
[[package]]
name = "timezone_provider"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071d5533454ed925a1f4841f7128d1d248f3465d6a18e9afe298212916cc3269"
dependencies = [
"tinystr",
"zerotrie",
"zerovec",
"zoneinfo64",
]
[[package]]
name = "tinystr"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"
dependencies = [
"displaydoc",
"serde_core",
"zerovec",
]
[[package]]
name = "unicode-ident"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
[[package]]
name = "writeable"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
[[package]]
name = "yoke"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"
dependencies = [
"stable_deref_trait",
"yoke-derive",
"zerofrom",
]
[[package]]
name = "yoke-derive"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
dependencies = [
"proc-macro2",
"quote",
"syn",
"synstructure",
]
[[package]]
name = "zerofrom"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
dependencies = [
"proc-macro2",
"quote",
"syn",
"synstructure",
]
[[package]]
name = "zerotrie"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"
dependencies = [
"displaydoc",
]
[[package]]
name = "zerovec"
version = "0.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"
dependencies = [
"serde",
"yoke",
"zerofrom",
"zerovec-derive",
]
[[package]]
name = "zerovec-derive"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "zoneinfo64"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6916519e4a1cff59d49e0b902caed549d85dbbbf623a95af5c8320d5c08c6e13"
dependencies = [
"calendrical_calculations",
"icu_locale_core",
"potential_utf",
"resb",
"serde",
]

32
deps/crates/Cargo.toml vendored Normal file
View File

@@ -0,0 +1,32 @@
# This file defines all third-party Rust dependencies approved for use
# in Node.js.
[package]
edition = "2021"
name = "node_crates"
version = "0.1.0"
rust-version = "1.82"
[lib]
crate-type = ["staticlib"]
[dependencies]
# Pin all temporal dependencies to the last version support rustc 1.82
icu_calendar = "~2.0.0"
icu_calendar_data = "~2.0.0"
icu_collections = "~2.0.0"
icu_locale = "~2.0.0"
icu_locale_core = "~2.0.0"
icu_locale_data = "~2.0.0"
icu_provider = "~2.0.0"
timezone_provider = "=0.1.0"
[dependencies.temporal_capi]
version = "=0.1.0"
features = ["zoneinfo64"]
[dependencies.temporal_rs]
version = "=0.1.0"
default-features = false
# This is necessary to enable a spec-compliance quirk when upgrading to v0.1.2
# features = ["float64_representable_durations"]

54
deps/crates/crates.gyp vendored Normal file
View File

@@ -0,0 +1,54 @@
{
'variables': {
'cargo_vendor_dir': './vendor',
},
'targets': [
{
'target_name': 'node_crates',
'type': 'none',
'hard_dependency': 1,
'sources': [
'Cargo.toml',
'Cargo.lock',
'src/lib.rs',
],
'link_settings': {
'libraries': [
'<(SHARED_INTERMEDIATE_DIR)/>(cargo_build_mode)/libnode_crates.a',
],
},
'actions': [
{
'action_name': 'cargo_build',
'inputs': [
'<@(_sources)'
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/>(cargo_build_mode)/libnode_crates.a'
],
'action': [
'cargo',
'rustc',
'>@(cargo_build_flags)',
'--frozen',
'--target-dir',
'<(SHARED_INTERMEDIATE_DIR)'
],
}
],
},
{
'target_name': 'temporal_capi',
'type': 'none',
'sources': [],
'dependencies': [
'node_crates',
],
'direct_dependent_settings': {
'include_dirs': [
'<(cargo_vendor_dir)/temporal_capi/bindings/cpp',
],
},
},
]
}

7
deps/crates/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,7 @@
// The root of an empty crate that is used for running Cargo against the
// dependencies used by Node.js.
// Suppress warnings about re-exported dependencies.
#[allow(unused_imports)]
use temporal_capi;

View File

@@ -321,7 +321,7 @@
}], }],
['v8_enable_temporal_support==1 and node_shared_temporal_capi=="false"', { ['v8_enable_temporal_support==1 and node_shared_temporal_capi=="false"', {
'dependencies': [ 'dependencies': [
'../../deps/temporal/temporal_capi/temporal_capi.gyp:temporal_capi', '../../deps/crates/crates.gyp:temporal_capi',
], ],
}], }],
], ],
@@ -363,7 +363,7 @@
}], }],
['v8_enable_temporal_support==1 and node_shared_temporal_capi=="false"', { ['v8_enable_temporal_support==1 and node_shared_temporal_capi=="false"', {
'dependencies': [ 'dependencies': [
'../../deps/temporal/temporal_capi/temporal_capi.gyp:temporal_capi', '../../deps/crates/crates.gyp:temporal_capi',
], ],
}], }],
['v8_target_arch=="ia32"', { ['v8_target_arch=="ia32"', {
@@ -1141,7 +1141,7 @@
'conditions': [ 'conditions': [
['node_shared_temporal_capi=="false"', { ['node_shared_temporal_capi=="false"', {
'dependencies': [ 'dependencies': [
'../../deps/temporal/temporal_capi/temporal_capi.gyp:temporal_capi', '../../deps/crates/crates.gyp:temporal_capi',
], ],
}], }],
], ],