mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 04:52:26 -05:00
Merge branch 'main' into thread-local-permission-prompter
This commit is contained in:
commit
43728f1986
582 changed files with 31379 additions and 1050 deletions
281
Cargo.lock
generated
281
Cargo.lock
generated
|
@ -284,6 +284,17 @@ dependencies = [
|
|||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-recursion"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-stream"
|
||||
version = "0.3.5"
|
||||
|
@ -806,6 +817,7 @@ dependencies = [
|
|||
"file_test_runner",
|
||||
"flaky_test",
|
||||
"hickory-client",
|
||||
"hickory-proto",
|
||||
"hickory-server",
|
||||
"http 1.1.0",
|
||||
"http-body-util",
|
||||
|
@ -1293,7 +1305,7 @@ dependencies = [
|
|||
"test_server",
|
||||
"text-size",
|
||||
"text_lines",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tracing",
|
||||
|
@ -1380,7 +1392,7 @@ version = "0.174.0"
|
|||
dependencies = [
|
||||
"async-trait",
|
||||
"deno_core",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"uuid",
|
||||
]
|
||||
|
@ -1394,7 +1406,7 @@ dependencies = [
|
|||
"rusqlite",
|
||||
"serde",
|
||||
"sha2",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
|
@ -1426,7 +1438,7 @@ dependencies = [
|
|||
"deno_webgpu",
|
||||
"image",
|
||||
"serde",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1510,7 +1522,7 @@ dependencies = [
|
|||
"chrono",
|
||||
"deno_core",
|
||||
"saffron",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
|
@ -1545,7 +1557,7 @@ dependencies = [
|
|||
"sha2",
|
||||
"signature",
|
||||
"spki",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"uuid",
|
||||
"x25519-dalek",
|
||||
|
@ -1627,7 +1639,7 @@ dependencies = [
|
|||
"rustls-webpki",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-socks",
|
||||
|
@ -1652,7 +1664,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde-value",
|
||||
"serde_json",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"winapi",
|
||||
]
|
||||
|
@ -1675,9 +1687,9 @@ dependencies = [
|
|||
"rand",
|
||||
"rayon",
|
||||
"serde",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"winapi",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1744,7 +1756,7 @@ dependencies = [
|
|||
"scopeguard",
|
||||
"serde",
|
||||
"smallvec",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
]
|
||||
|
@ -1767,7 +1779,7 @@ dependencies = [
|
|||
"tokio",
|
||||
"uuid",
|
||||
"winapi",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1798,7 +1810,7 @@ dependencies = [
|
|||
"rand",
|
||||
"rusqlite",
|
||||
"serde",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"url",
|
||||
]
|
||||
|
||||
|
@ -1854,8 +1866,8 @@ dependencies = [
|
|||
"libuv-sys-lite",
|
||||
"log",
|
||||
"napi_sym",
|
||||
"thiserror 1.0.64",
|
||||
"windows-sys 0.52.0",
|
||||
"thiserror 2.0.3",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1884,7 +1896,7 @@ dependencies = [
|
|||
"rustls-tokio-stream",
|
||||
"serde",
|
||||
"socket2",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
|
@ -1929,7 +1941,7 @@ dependencies = [
|
|||
"http-body-util",
|
||||
"hyper 1.4.1",
|
||||
"hyper-util",
|
||||
"idna 1.0.3",
|
||||
"idna",
|
||||
"indexmap 2.3.0",
|
||||
"ipnetwork",
|
||||
"k256",
|
||||
|
@ -1968,13 +1980,13 @@ dependencies = [
|
|||
"sm3",
|
||||
"spki",
|
||||
"stable_deref_trait",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"tokio-eld",
|
||||
"url",
|
||||
"webpki-root-certs",
|
||||
"winapi",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
"x25519-dalek",
|
||||
"x509-parser",
|
||||
"yoke",
|
||||
|
@ -2024,7 +2036,7 @@ dependencies = [
|
|||
"serde_json",
|
||||
"tar",
|
||||
"tempfile",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"url",
|
||||
]
|
||||
|
||||
|
@ -2084,7 +2096,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"percent-encoding",
|
||||
"serde",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"which 4.4.2",
|
||||
"winapi",
|
||||
]
|
||||
|
@ -2104,7 +2116,7 @@ dependencies = [
|
|||
"deno_semver",
|
||||
"node_resolver",
|
||||
"test_server",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"url",
|
||||
]
|
||||
|
||||
|
@ -2167,14 +2179,14 @@ dependencies = [
|
|||
"signal-hook-registry",
|
||||
"tempfile",
|
||||
"test_server",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"tokio-metrics",
|
||||
"twox-hash",
|
||||
"uuid",
|
||||
"which 4.4.2",
|
||||
"winapi",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2193,9 +2205,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_task_shell"
|
||||
version = "0.20.1"
|
||||
version = "0.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01e09966ce29f8d26b652a43355397e1df43b85759e7824196bf0ceaeaa9a2f4"
|
||||
checksum = "fa3763bc068e17b6d488fb73ecda463c13ef792b0a5288b6018bc2119becd635"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures",
|
||||
|
@ -2206,6 +2218,7 @@ dependencies = [
|
|||
"path-dedot",
|
||||
"thiserror 1.0.64",
|
||||
"tokio",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2260,7 +2273,7 @@ dependencies = [
|
|||
"rustls-tokio-stream",
|
||||
"rustls-webpki",
|
||||
"serde",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
@ -2307,7 +2320,7 @@ dependencies = [
|
|||
"deno_console",
|
||||
"deno_core",
|
||||
"deno_webidl",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"urlpattern",
|
||||
]
|
||||
|
||||
|
@ -2328,7 +2341,7 @@ dependencies = [
|
|||
"flate2",
|
||||
"futures",
|
||||
"serde",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"uuid",
|
||||
]
|
||||
|
@ -2340,7 +2353,7 @@ dependencies = [
|
|||
"deno_core",
|
||||
"raw-window-handle",
|
||||
"serde",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"wgpu-core",
|
||||
"wgpu-types",
|
||||
|
@ -2372,7 +2385,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"rustls-tokio-stream",
|
||||
"serde",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
|
@ -2383,7 +2396,7 @@ dependencies = [
|
|||
"deno_core",
|
||||
"deno_web",
|
||||
"rusqlite",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3697,9 +3710,9 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
|||
|
||||
[[package]]
|
||||
name = "hickory-client"
|
||||
version = "0.24.1"
|
||||
version = "0.25.0-alpha.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bab9683b08d8f8957a857b0236455d80e1886eaa8c6178af556aa7871fb61b55"
|
||||
checksum = "83536dab9a159b2b5cf2c20c47ecf188cee35316f96be028e63e8e1340d2724d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
|
@ -3709,17 +3722,18 @@ dependencies = [
|
|||
"once_cell",
|
||||
"radix_trie",
|
||||
"rand",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hickory-proto"
|
||||
version = "0.24.1"
|
||||
version = "0.25.0-alpha.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512"
|
||||
checksum = "d063c0692ee669aa6d261988aa19ca5510f1cc40e4f211024f50c888499a35d7"
|
||||
dependencies = [
|
||||
"async-recursion",
|
||||
"async-trait",
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
|
@ -3727,12 +3741,12 @@ dependencies = [
|
|||
"futures-channel",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
"idna 0.4.0",
|
||||
"idna",
|
||||
"ipnet",
|
||||
"once_cell",
|
||||
"rand",
|
||||
"serde",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tinyvec",
|
||||
"tokio",
|
||||
"tracing",
|
||||
|
@ -3741,40 +3755,43 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hickory-resolver"
|
||||
version = "0.24.1"
|
||||
version = "0.25.0-alpha.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28757f23aa75c98f254cf0405e6d8c25b831b32921b050a66692427679b1f243"
|
||||
checksum = "42bc352e4412fb657e795f79b4efcf2bd60b59ee5ca0187f3554194cd1107a27"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-util",
|
||||
"hickory-proto",
|
||||
"ipconfig",
|
||||
"lru-cache",
|
||||
"moka",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"rand",
|
||||
"resolv-conf",
|
||||
"serde",
|
||||
"smallvec",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hickory-server"
|
||||
version = "0.24.1"
|
||||
version = "0.25.0-alpha.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9be0e43c556b9b3fdb6c7c71a9a32153a2275d02419e3de809e520bfcfe40c37"
|
||||
checksum = "aa7154e905d5c8a79c15427881e479b2ba749c55412804f0dc87723a531e45bd"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
"enum-as-inner",
|
||||
"futures-util",
|
||||
"hickory-proto",
|
||||
"ipnet",
|
||||
"prefix-trie",
|
||||
"serde",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"time",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
|
@ -4136,16 +4153,6 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
|
||||
dependencies = [
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "1.0.3"
|
||||
|
@ -4286,6 +4293,9 @@ name = "ipnet"
|
|||
version = "2.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipnetwork"
|
||||
|
@ -4558,7 +4568,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-targets 0.52.4",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4624,12 +4634,6 @@ dependencies = [
|
|||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.13"
|
||||
|
@ -4667,15 +4671,6 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lru-cache"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c"
|
||||
dependencies = [
|
||||
"linked-hash-map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lsp-types"
|
||||
version = "0.97.0"
|
||||
|
@ -4840,6 +4835,26 @@ dependencies = [
|
|||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "moka"
|
||||
version = "0.12.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e0d88686dc561d743b40de8269b26eaf0dc58781bde087b0984646602021d08"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"quanta",
|
||||
"rustc_version 0.4.0",
|
||||
"smallvec",
|
||||
"tagptr",
|
||||
"thiserror 1.0.64",
|
||||
"triomphe",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "monch"
|
||||
version = "0.5.0"
|
||||
|
@ -4960,7 +4975,7 @@ dependencies = [
|
|||
"path-clean",
|
||||
"regex",
|
||||
"serde_json",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"url",
|
||||
]
|
||||
|
@ -5119,9 +5134,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
version = "1.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
|
@ -5616,6 +5631,16 @@ version = "0.2.17"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "prefix-trie"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4defc8f5ac7522968431b7592a34432215d80cceb1cf7e0c06287087bca4f046"
|
||||
dependencies = [
|
||||
"ipnet",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pretty_assertions"
|
||||
version = "1.4.0"
|
||||
|
@ -5811,6 +5836,21 @@ dependencies = [
|
|||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quanta"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"raw-cpuid",
|
||||
"wasi",
|
||||
"web-sys",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.2.3"
|
||||
|
@ -5975,6 +6015,15 @@ version = "0.1.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab"
|
||||
|
||||
[[package]]
|
||||
name = "raw-cpuid"
|
||||
version = "11.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.6.1"
|
||||
|
@ -7508,6 +7557,12 @@ dependencies = [
|
|||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tagptr"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
|
||||
|
||||
[[package]]
|
||||
name = "tap"
|
||||
version = "1.0.1"
|
||||
|
@ -8082,12 +8137,6 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-id"
|
||||
version = "0.3.4"
|
||||
|
@ -8162,7 +8211,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna 1.0.3",
|
||||
"idna",
|
||||
"percent-encoding",
|
||||
"serde",
|
||||
]
|
||||
|
@ -8623,7 +8672,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
|
||||
dependencies = [
|
||||
"windows-core",
|
||||
"windows-targets 0.52.4",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -8632,7 +8681,7 @@ version = "0.52.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.4",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -8650,7 +8699,16 @@ version = "0.52.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.4",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -8670,17 +8728,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.4"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.4",
|
||||
"windows_aarch64_msvc 0.52.4",
|
||||
"windows_i686_gnu 0.52.4",
|
||||
"windows_i686_msvc 0.52.4",
|
||||
"windows_x86_64_gnu 0.52.4",
|
||||
"windows_x86_64_gnullvm 0.52.4",
|
||||
"windows_x86_64_msvc 0.52.4",
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
"windows_x86_64_msvc 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -8691,9 +8750,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.4"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
|
@ -8703,9 +8762,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.4"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
|
@ -8715,9 +8774,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
|||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.4"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
|
@ -8727,9 +8792,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
|||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.4"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
|
@ -8739,9 +8804,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.4"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
|
@ -8751,9 +8816,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.4"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
|
@ -8763,9 +8828,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.4"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
|
|
|
@ -133,7 +133,7 @@ fs3 = "0.5.0"
|
|||
futures = "0.3.21"
|
||||
glob = "0.3.1"
|
||||
h2 = "0.4.4"
|
||||
hickory-resolver = { version = "0.24", features = ["tokio-runtime", "serde-config"] }
|
||||
hickory-resolver = { version = "0.25.0-alpha.4", features = ["tokio-runtime", "serde"] }
|
||||
http = "1.0"
|
||||
http-body = "1.0"
|
||||
http-body-util = "0.1.2"
|
||||
|
@ -194,7 +194,7 @@ spki = "0.7.2"
|
|||
tar = "=0.4.40"
|
||||
tempfile = "3.4.0"
|
||||
termcolor = "1.1.3"
|
||||
thiserror = "1.0.61"
|
||||
thiserror = "2.0.3"
|
||||
tokio = { version = "1.36.0", features = ["full"] }
|
||||
tokio-metrics = { version = "0.3.0", features = ["rt"] }
|
||||
tokio-rustls = { version = "0.26.0", default-features = false, features = ["ring", "tls12"] }
|
||||
|
@ -239,7 +239,7 @@ nix = "=0.27.1"
|
|||
# windows deps
|
||||
junction = "=0.2.0"
|
||||
winapi = "=0.3.9"
|
||||
windows-sys = { version = "0.52.0", features = ["Win32_Foundation", "Win32_Media", "Win32_Storage_FileSystem", "Win32_System_IO", "Win32_System_WindowsProgramming", "Wdk", "Wdk_System", "Wdk_System_SystemInformation", "Win32_Security", "Win32_System_Pipes", "Wdk_Storage_FileSystem", "Win32_System_Registry", "Win32_System_Kernel"] }
|
||||
windows-sys = { version = "0.59.0", features = ["Win32_Foundation", "Win32_Media", "Win32_Storage_FileSystem", "Win32_System_IO", "Win32_System_WindowsProgramming", "Wdk", "Wdk_System", "Wdk_System_SystemInformation", "Win32_Security", "Win32_System_Pipes", "Wdk_Storage_FileSystem", "Win32_System_Registry", "Win32_System_Kernel", "Win32_System_Threading", "Win32_UI", "Win32_UI_Shell"] }
|
||||
winres = "=0.1.12"
|
||||
|
||||
[profile.release]
|
||||
|
|
|
@ -83,7 +83,7 @@ deno_path_util.workspace = true
|
|||
deno_resolver.workspace = true
|
||||
deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||
deno_semver.workspace = true
|
||||
deno_task_shell = "=0.20.1"
|
||||
deno_task_shell = "=0.20.2"
|
||||
deno_telemetry.workspace = true
|
||||
deno_terminal.workspace = true
|
||||
libsui = "0.5.0"
|
||||
|
|
|
@ -2664,10 +2664,10 @@ Display outdated dependencies:
|
|||
<p(245)>deno outdated</>
|
||||
<p(245)>deno outdated --compatible</>
|
||||
|
||||
Update dependencies:
|
||||
Update dependencies to latest semver compatible versions:
|
||||
<p(245)>deno outdated --update</>
|
||||
Update dependencies to latest versions, ignoring semver requirements:
|
||||
<p(245)>deno outdated --update --latest</>
|
||||
<p(245)>deno outdated --update</>
|
||||
|
||||
Filters can be used to select which packages to act on. Filters can include wildcards (*) to match multiple packages.
|
||||
<p(245)>deno outdated --update --latest \"@std/*\"</>
|
||||
|
@ -2703,7 +2703,6 @@ Specific version requirements to update to can be specified:
|
|||
.help(
|
||||
"Update to the latest version, regardless of semver constraints",
|
||||
)
|
||||
.requires("update")
|
||||
.conflicts_with("compatible"),
|
||||
)
|
||||
.arg(
|
||||
|
@ -11687,6 +11686,14 @@ Usage: deno repl [OPTIONS] [-- [ARGS]...]\n"
|
|||
recursive: false,
|
||||
},
|
||||
),
|
||||
(
|
||||
svec!["--latest"],
|
||||
OutdatedFlags {
|
||||
filters: svec![],
|
||||
kind: OutdatedKind::PrintOutdated { compatible: false },
|
||||
recursive: false,
|
||||
},
|
||||
),
|
||||
];
|
||||
for (input, expected) in cases {
|
||||
let mut args = svec!["deno", "outdated"];
|
||||
|
|
|
@ -59,8 +59,7 @@ impl FileOrRedirect {
|
|||
cache_entry: deno_cache_dir::CacheEntry,
|
||||
) -> Result<Self, AnyError> {
|
||||
if let Some(redirect_to) = cache_entry.metadata.headers.get("location") {
|
||||
let redirect =
|
||||
deno_core::resolve_import(redirect_to, specifier.as_str())?;
|
||||
let redirect = specifier.join(redirect_to)?;
|
||||
Ok(FileOrRedirect::Redirect(redirect))
|
||||
} else {
|
||||
Ok(FileOrRedirect::File(File {
|
||||
|
|
|
@ -353,7 +353,12 @@ impl<'a> TsResponseImportMapper<'a> {
|
|||
let pkg_reqs = npm_resolver.resolve_pkg_reqs_from_pkg_id(&pkg_id);
|
||||
// check if any pkg reqs match what is found in an import map
|
||||
if !pkg_reqs.is_empty() {
|
||||
let sub_path = self.resolve_package_path(specifier);
|
||||
let sub_path = npm_resolver
|
||||
.resolve_pkg_folder_from_pkg_id(&pkg_id)
|
||||
.ok()
|
||||
.and_then(|pkg_folder| {
|
||||
self.resolve_package_path(specifier, &pkg_folder)
|
||||
});
|
||||
if let Some(import_map) = self.maybe_import_map {
|
||||
let pkg_reqs = pkg_reqs.iter().collect::<HashSet<_>>();
|
||||
let mut matches = Vec::new();
|
||||
|
@ -368,8 +373,13 @@ impl<'a> TsResponseImportMapper<'a> {
|
|||
if let Some(key_sub_path) =
|
||||
sub_path.strip_prefix(value_sub_path)
|
||||
{
|
||||
matches
|
||||
.push(format!("{}{}", entry.raw_key, key_sub_path));
|
||||
// keys that don't end in a slash can't be mapped to a subpath
|
||||
if entry.raw_key.ends_with('/')
|
||||
|| key_sub_path.is_empty()
|
||||
{
|
||||
matches
|
||||
.push(format!("{}{}", entry.raw_key, key_sub_path));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -413,10 +423,16 @@ impl<'a> TsResponseImportMapper<'a> {
|
|||
fn resolve_package_path(
|
||||
&self,
|
||||
specifier: &ModuleSpecifier,
|
||||
package_root_folder: &Path,
|
||||
) -> Option<String> {
|
||||
let package_json = self
|
||||
.resolver
|
||||
.get_closest_package_json(specifier)
|
||||
.pkg_json_resolver(specifier)
|
||||
// the specifier might have a closer package.json, but we
|
||||
// want the root of the package's package.json
|
||||
.get_closest_package_json_from_file_path(
|
||||
&package_root_folder.join("package.json"),
|
||||
)
|
||||
.ok()
|
||||
.flatten()?;
|
||||
let root_folder = package_json.path.parent()?;
|
||||
|
|
|
@ -1262,7 +1262,7 @@ impl DenoDiagnostic {
|
|||
Self::NoAttributeType => (lsp::DiagnosticSeverity::ERROR, "The module is a JSON module and not being imported with an import attribute. Consider adding `with { type: \"json\" }` to the import statement.".to_string(), None),
|
||||
Self::NoCache(specifier) => (lsp::DiagnosticSeverity::ERROR, format!("Uncached or missing remote URL: {specifier}"), Some(json!({ "specifier": specifier }))),
|
||||
Self::NotInstalledJsr(pkg_req, specifier) => (lsp::DiagnosticSeverity::ERROR, format!("JSR package \"{pkg_req}\" is not installed or doesn't exist."), Some(json!({ "specifier": specifier }))),
|
||||
Self::NotInstalledNpm(pkg_req, specifier) => (lsp::DiagnosticSeverity::ERROR, format!("NPM package \"{pkg_req}\" is not installed or doesn't exist."), Some(json!({ "specifier": specifier }))),
|
||||
Self::NotInstalledNpm(pkg_req, specifier) => (lsp::DiagnosticSeverity::ERROR, format!("npm package \"{pkg_req}\" is not installed or doesn't exist."), Some(json!({ "specifier": specifier }))),
|
||||
Self::NoLocal(specifier) => {
|
||||
let maybe_sloppy_resolution = CliSloppyImportsResolver::new(
|
||||
SloppyImportsCachedFs::new(Arc::new(deno_fs::RealFs))
|
||||
|
|
|
@ -20,14 +20,12 @@ use deno_resolver::DenoResolverOptions;
|
|||
use deno_resolver::NodeAndNpmReqResolver;
|
||||
use deno_runtime::deno_fs;
|
||||
use deno_runtime::deno_node::NodeResolver;
|
||||
use deno_runtime::deno_node::PackageJson;
|
||||
use deno_runtime::deno_node::PackageJsonResolver;
|
||||
use deno_semver::jsr::JsrPackageReqReference;
|
||||
use deno_semver::npm::NpmPackageReqReference;
|
||||
use deno_semver::package::PackageNv;
|
||||
use deno_semver::package::PackageReq;
|
||||
use indexmap::IndexMap;
|
||||
use node_resolver::errors::ClosestPkgJsonError;
|
||||
use node_resolver::InNpmPackageChecker;
|
||||
use node_resolver::NodeResolutionKind;
|
||||
use node_resolver::ResolutionMode;
|
||||
|
@ -380,6 +378,14 @@ impl LspResolver {
|
|||
resolver.npm_resolver.as_ref().and_then(|r| r.as_managed())
|
||||
}
|
||||
|
||||
pub fn pkg_json_resolver(
|
||||
&self,
|
||||
referrer: &ModuleSpecifier,
|
||||
) -> &Arc<PackageJsonResolver> {
|
||||
let resolver = self.get_scope_resolver(Some(referrer));
|
||||
&resolver.pkg_json_resolver
|
||||
}
|
||||
|
||||
pub fn graph_imports_by_referrer(
|
||||
&self,
|
||||
file_referrer: &ModuleSpecifier,
|
||||
|
@ -522,16 +528,6 @@ impl LspResolver {
|
|||
.is_some()
|
||||
}
|
||||
|
||||
pub fn get_closest_package_json(
|
||||
&self,
|
||||
referrer: &ModuleSpecifier,
|
||||
) -> Result<Option<Arc<PackageJson>>, ClosestPkgJsonError> {
|
||||
let resolver = self.get_scope_resolver(Some(referrer));
|
||||
resolver
|
||||
.pkg_json_resolver
|
||||
.get_closest_package_json(referrer)
|
||||
}
|
||||
|
||||
pub fn resolve_redirects(
|
||||
&self,
|
||||
specifier: &ModuleSpecifier,
|
||||
|
@ -945,9 +941,7 @@ impl RedirectResolver {
|
|||
if chain.len() > 10 {
|
||||
break None;
|
||||
}
|
||||
let Ok(target) =
|
||||
deno_core::resolve_import(location, specifier.as_str())
|
||||
else {
|
||||
let Ok(target) = specifier.join(location) else {
|
||||
break None;
|
||||
};
|
||||
chain.push((
|
||||
|
|
|
@ -44,7 +44,6 @@ use crate::util::fs::canonicalize_path_maybe_not_exists_with_fs;
|
|||
use crate::util::progress_bar::ProgressBar;
|
||||
use crate::util::sync::AtomicFlag;
|
||||
|
||||
use self::registry::CliNpmRegistryApi;
|
||||
use self::resolution::NpmResolution;
|
||||
use self::resolvers::create_npm_fs_resolver;
|
||||
use self::resolvers::NpmPackageFsResolver;
|
||||
|
@ -57,7 +56,6 @@ use super::CliNpmTarballCache;
|
|||
use super::InnerCliNpmResolverRef;
|
||||
use super::ResolvePkgFolderFromDenoReqError;
|
||||
|
||||
mod registry;
|
||||
mod resolution;
|
||||
mod resolvers;
|
||||
|
||||
|
@ -120,13 +118,13 @@ pub async fn create_managed_npm_resolver(
|
|||
) -> Result<Arc<dyn CliNpmResolver>, AnyError> {
|
||||
let npm_cache_env = create_cache_env(&options);
|
||||
let npm_cache = create_cache(npm_cache_env.clone(), &options);
|
||||
let npm_api = create_api(npm_cache.clone(), npm_cache_env.clone(), &options);
|
||||
let snapshot = resolve_snapshot(&npm_api, options.snapshot).await?;
|
||||
let api = create_api(npm_cache.clone(), npm_cache_env.clone(), &options);
|
||||
let snapshot = resolve_snapshot(&api, options.snapshot).await?;
|
||||
Ok(create_inner(
|
||||
npm_cache_env,
|
||||
options.fs,
|
||||
options.maybe_lockfile,
|
||||
npm_api,
|
||||
api,
|
||||
npm_cache,
|
||||
options.npmrc,
|
||||
options.npm_install_deps_provider,
|
||||
|
@ -143,7 +141,7 @@ fn create_inner(
|
|||
env: Arc<CliNpmCacheEnv>,
|
||||
fs: Arc<dyn deno_runtime::deno_fs::FileSystem>,
|
||||
maybe_lockfile: Option<Arc<CliLockfile>>,
|
||||
npm_api: Arc<CliNpmRegistryApi>,
|
||||
registry_info_provider: Arc<CliNpmRegistryInfoProvider>,
|
||||
npm_cache: Arc<CliNpmCache>,
|
||||
npm_rc: Arc<ResolvedNpmRc>,
|
||||
npm_install_deps_provider: Arc<NpmInstallDepsProvider>,
|
||||
|
@ -154,7 +152,7 @@ fn create_inner(
|
|||
lifecycle_scripts: LifecycleScriptsConfig,
|
||||
) -> Arc<dyn CliNpmResolver> {
|
||||
let resolution = Arc::new(NpmResolution::from_serialized(
|
||||
npm_api.clone(),
|
||||
registry_info_provider.clone(),
|
||||
snapshot,
|
||||
maybe_lockfile.clone(),
|
||||
));
|
||||
|
@ -178,7 +176,7 @@ fn create_inner(
|
|||
fs,
|
||||
fs_resolver,
|
||||
maybe_lockfile,
|
||||
npm_api,
|
||||
registry_info_provider,
|
||||
npm_cache,
|
||||
npm_install_deps_provider,
|
||||
resolution,
|
||||
|
@ -215,29 +213,29 @@ fn create_api(
|
|||
cache: Arc<CliNpmCache>,
|
||||
env: Arc<CliNpmCacheEnv>,
|
||||
options: &CliManagedNpmResolverCreateOptions,
|
||||
) -> Arc<CliNpmRegistryApi> {
|
||||
Arc::new(CliNpmRegistryApi::new(
|
||||
cache.clone(),
|
||||
Arc::new(CliNpmRegistryInfoProvider::new(
|
||||
cache,
|
||||
env,
|
||||
options.npmrc.clone(),
|
||||
)),
|
||||
) -> Arc<CliNpmRegistryInfoProvider> {
|
||||
Arc::new(CliNpmRegistryInfoProvider::new(
|
||||
cache,
|
||||
env,
|
||||
options.npmrc.clone(),
|
||||
))
|
||||
}
|
||||
|
||||
async fn resolve_snapshot(
|
||||
api: &CliNpmRegistryApi,
|
||||
registry_info_provider: &Arc<CliNpmRegistryInfoProvider>,
|
||||
snapshot: CliNpmResolverManagedSnapshotOption,
|
||||
) -> Result<Option<ValidSerializedNpmResolutionSnapshot>, AnyError> {
|
||||
match snapshot {
|
||||
CliNpmResolverManagedSnapshotOption::ResolveFromLockfile(lockfile) => {
|
||||
if !lockfile.overwrite() {
|
||||
let snapshot = snapshot_from_lockfile(lockfile.clone(), api)
|
||||
.await
|
||||
.with_context(|| {
|
||||
format!("failed reading lockfile '{}'", lockfile.filename.display())
|
||||
})?;
|
||||
let snapshot = snapshot_from_lockfile(
|
||||
lockfile.clone(),
|
||||
®istry_info_provider.as_npm_registry_api(),
|
||||
)
|
||||
.await
|
||||
.with_context(|| {
|
||||
format!("failed reading lockfile '{}'", lockfile.filename.display())
|
||||
})?;
|
||||
Ok(Some(snapshot))
|
||||
} else {
|
||||
Ok(None)
|
||||
|
@ -304,7 +302,7 @@ pub struct ManagedCliNpmResolver {
|
|||
fs: Arc<dyn FileSystem>,
|
||||
fs_resolver: Arc<dyn NpmPackageFsResolver>,
|
||||
maybe_lockfile: Option<Arc<CliLockfile>>,
|
||||
npm_api: Arc<CliNpmRegistryApi>,
|
||||
registry_info_provider: Arc<CliNpmRegistryInfoProvider>,
|
||||
npm_cache: Arc<CliNpmCache>,
|
||||
npm_install_deps_provider: Arc<NpmInstallDepsProvider>,
|
||||
resolution: Arc<NpmResolution>,
|
||||
|
@ -329,7 +327,7 @@ impl ManagedCliNpmResolver {
|
|||
fs: Arc<dyn FileSystem>,
|
||||
fs_resolver: Arc<dyn NpmPackageFsResolver>,
|
||||
maybe_lockfile: Option<Arc<CliLockfile>>,
|
||||
npm_api: Arc<CliNpmRegistryApi>,
|
||||
registry_info_provider: Arc<CliNpmRegistryInfoProvider>,
|
||||
npm_cache: Arc<CliNpmCache>,
|
||||
npm_install_deps_provider: Arc<NpmInstallDepsProvider>,
|
||||
resolution: Arc<NpmResolution>,
|
||||
|
@ -342,7 +340,7 @@ impl ManagedCliNpmResolver {
|
|||
fs,
|
||||
fs_resolver,
|
||||
maybe_lockfile,
|
||||
npm_api,
|
||||
registry_info_provider,
|
||||
npm_cache,
|
||||
npm_install_deps_provider,
|
||||
text_only_progress_bar,
|
||||
|
@ -588,7 +586,7 @@ impl ManagedCliNpmResolver {
|
|||
) -> Result<Arc<NpmPackageInfo>, AnyError> {
|
||||
// this will internally cache the package information
|
||||
self
|
||||
.npm_api
|
||||
.registry_info_provider
|
||||
.package_info(package_name)
|
||||
.await
|
||||
.map_err(|err| err.into())
|
||||
|
@ -684,7 +682,7 @@ impl CliNpmResolver for ManagedCliNpmResolver {
|
|||
fn clone_snapshotted(&self) -> Arc<dyn CliNpmResolver> {
|
||||
// create a new snapshotted npm resolution and resolver
|
||||
let npm_resolution = Arc::new(NpmResolution::new(
|
||||
self.npm_api.clone(),
|
||||
self.registry_info_provider.clone(),
|
||||
self.resolution.snapshot(),
|
||||
self.maybe_lockfile.clone(),
|
||||
));
|
||||
|
@ -703,7 +701,7 @@ impl CliNpmResolver for ManagedCliNpmResolver {
|
|||
self.lifecycle_scripts.clone(),
|
||||
),
|
||||
self.maybe_lockfile.clone(),
|
||||
self.npm_api.clone(),
|
||||
self.registry_info_provider.clone(),
|
||||
self.npm_cache.clone(),
|
||||
self.npm_install_deps_provider.clone(),
|
||||
npm_resolution,
|
||||
|
|
|
@ -1,201 +0,0 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use deno_core::anyhow::anyhow;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::futures::future::BoxFuture;
|
||||
use deno_core::futures::future::Shared;
|
||||
use deno_core::futures::FutureExt;
|
||||
use deno_core::parking_lot::Mutex;
|
||||
use deno_npm::registry::NpmPackageInfo;
|
||||
use deno_npm::registry::NpmRegistryApi;
|
||||
use deno_npm::registry::NpmRegistryPackageInfoLoadError;
|
||||
use deno_npm_cache::NpmCacheSetting;
|
||||
|
||||
use crate::npm::CliNpmCache;
|
||||
use crate::npm::CliNpmRegistryInfoProvider;
|
||||
use crate::util::sync::AtomicFlag;
|
||||
|
||||
// todo(#27198): Remove this and move functionality down into
|
||||
// RegistryInfoProvider, which already does most of this.
|
||||
#[derive(Debug)]
|
||||
pub struct CliNpmRegistryApi(Option<Arc<CliNpmRegistryApiInner>>);
|
||||
|
||||
impl CliNpmRegistryApi {
|
||||
pub fn new(
|
||||
cache: Arc<CliNpmCache>,
|
||||
registry_info_provider: Arc<CliNpmRegistryInfoProvider>,
|
||||
) -> Self {
|
||||
Self(Some(Arc::new(CliNpmRegistryApiInner {
|
||||
cache,
|
||||
force_reload_flag: Default::default(),
|
||||
mem_cache: Default::default(),
|
||||
previously_reloaded_packages: Default::default(),
|
||||
registry_info_provider,
|
||||
})))
|
||||
}
|
||||
|
||||
/// Clears the internal memory cache.
|
||||
pub fn clear_memory_cache(&self) {
|
||||
self.inner().clear_memory_cache();
|
||||
}
|
||||
|
||||
fn inner(&self) -> &Arc<CliNpmRegistryApiInner> {
|
||||
// this panicking indicates a bug in the code where this
|
||||
// wasn't initialized
|
||||
self.0.as_ref().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
impl NpmRegistryApi for CliNpmRegistryApi {
|
||||
async fn package_info(
|
||||
&self,
|
||||
name: &str,
|
||||
) -> Result<Arc<NpmPackageInfo>, NpmRegistryPackageInfoLoadError> {
|
||||
match self.inner().maybe_package_info(name).await {
|
||||
Ok(Some(info)) => Ok(info),
|
||||
Ok(None) => Err(NpmRegistryPackageInfoLoadError::PackageNotExists {
|
||||
package_name: name.to_string(),
|
||||
}),
|
||||
Err(err) => {
|
||||
Err(NpmRegistryPackageInfoLoadError::LoadError(Arc::new(err)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn mark_force_reload(&self) -> bool {
|
||||
self.inner().mark_force_reload()
|
||||
}
|
||||
}
|
||||
|
||||
type CacheItemPendingResult =
|
||||
Result<Option<Arc<NpmPackageInfo>>, Arc<AnyError>>;
|
||||
|
||||
#[derive(Debug)]
|
||||
enum CacheItem {
|
||||
Pending(Shared<BoxFuture<'static, CacheItemPendingResult>>),
|
||||
Resolved(Option<Arc<NpmPackageInfo>>),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct CliNpmRegistryApiInner {
|
||||
cache: Arc<CliNpmCache>,
|
||||
force_reload_flag: AtomicFlag,
|
||||
mem_cache: Mutex<HashMap<String, CacheItem>>,
|
||||
previously_reloaded_packages: Mutex<HashSet<String>>,
|
||||
registry_info_provider: Arc<CliNpmRegistryInfoProvider>,
|
||||
}
|
||||
|
||||
impl CliNpmRegistryApiInner {
|
||||
pub async fn maybe_package_info(
|
||||
self: &Arc<Self>,
|
||||
name: &str,
|
||||
) -> Result<Option<Arc<NpmPackageInfo>>, AnyError> {
|
||||
let (created, future) = {
|
||||
let mut mem_cache = self.mem_cache.lock();
|
||||
match mem_cache.get(name) {
|
||||
Some(CacheItem::Resolved(maybe_info)) => {
|
||||
return Ok(maybe_info.clone());
|
||||
}
|
||||
Some(CacheItem::Pending(future)) => (false, future.clone()),
|
||||
None => {
|
||||
let future = {
|
||||
let api = self.clone();
|
||||
let name = name.to_string();
|
||||
async move {
|
||||
if (api.cache.cache_setting().should_use_for_npm_package(&name) && !api.force_reload_flag.is_raised())
|
||||
// if this has been previously reloaded, then try loading from the
|
||||
// file system cache
|
||||
|| !api.previously_reloaded_packages.lock().insert(name.to_string())
|
||||
{
|
||||
// attempt to load from the file cache
|
||||
if let Some(info) = api.load_file_cached_package_info(&name).await {
|
||||
let result = Some(Arc::new(info));
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
api.registry_info_provider
|
||||
.load_package_info(&name)
|
||||
.await
|
||||
.map_err(Arc::new)
|
||||
}
|
||||
.boxed()
|
||||
.shared()
|
||||
};
|
||||
mem_cache
|
||||
.insert(name.to_string(), CacheItem::Pending(future.clone()));
|
||||
(true, future)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if created {
|
||||
match future.await {
|
||||
Ok(maybe_info) => {
|
||||
// replace the cache item to say it's resolved now
|
||||
self
|
||||
.mem_cache
|
||||
.lock()
|
||||
.insert(name.to_string(), CacheItem::Resolved(maybe_info.clone()));
|
||||
Ok(maybe_info)
|
||||
}
|
||||
Err(err) => {
|
||||
// purge the item from the cache so it loads next time
|
||||
self.mem_cache.lock().remove(name);
|
||||
Err(anyhow!("{:#}", err))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Ok(future.await.map_err(|err| anyhow!("{:#}", err))?)
|
||||
}
|
||||
}
|
||||
|
||||
fn mark_force_reload(&self) -> bool {
|
||||
// never force reload the registry information if reloading
|
||||
// is disabled or if we're already reloading
|
||||
if matches!(
|
||||
self.cache.cache_setting(),
|
||||
NpmCacheSetting::Only | NpmCacheSetting::ReloadAll
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if self.force_reload_flag.raise() {
|
||||
self.clear_memory_cache();
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
async fn load_file_cached_package_info(
|
||||
&self,
|
||||
name: &str,
|
||||
) -> Option<NpmPackageInfo> {
|
||||
let result = deno_core::unsync::spawn_blocking({
|
||||
let cache = self.cache.clone();
|
||||
let name = name.to_string();
|
||||
move || cache.load_package_info(&name)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
match result {
|
||||
Ok(value) => value,
|
||||
Err(err) => {
|
||||
if cfg!(debug_assertions) {
|
||||
panic!("error loading cached npm package info for {name}: {err:#}");
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn clear_memory_cache(&self) {
|
||||
self.mem_cache.lock().clear();
|
||||
}
|
||||
}
|
|
@ -27,10 +27,9 @@ use deno_semver::package::PackageReq;
|
|||
use deno_semver::VersionReq;
|
||||
|
||||
use crate::args::CliLockfile;
|
||||
use crate::npm::CliNpmRegistryInfoProvider;
|
||||
use crate::util::sync::SyncReadAsyncWriteLock;
|
||||
|
||||
use super::CliNpmRegistryApi;
|
||||
|
||||
pub struct AddPkgReqsResult {
|
||||
/// Results from adding the individual packages.
|
||||
///
|
||||
|
@ -47,7 +46,7 @@ pub struct AddPkgReqsResult {
|
|||
///
|
||||
/// This does not interact with the file system.
|
||||
pub struct NpmResolution {
|
||||
api: Arc<CliNpmRegistryApi>,
|
||||
registry_info_provider: Arc<CliNpmRegistryInfoProvider>,
|
||||
snapshot: SyncReadAsyncWriteLock<NpmResolutionSnapshot>,
|
||||
maybe_lockfile: Option<Arc<CliLockfile>>,
|
||||
}
|
||||
|
@ -63,22 +62,22 @@ impl std::fmt::Debug for NpmResolution {
|
|||
|
||||
impl NpmResolution {
|
||||
pub fn from_serialized(
|
||||
api: Arc<CliNpmRegistryApi>,
|
||||
registry_info_provider: Arc<CliNpmRegistryInfoProvider>,
|
||||
initial_snapshot: Option<ValidSerializedNpmResolutionSnapshot>,
|
||||
maybe_lockfile: Option<Arc<CliLockfile>>,
|
||||
) -> Self {
|
||||
let snapshot =
|
||||
NpmResolutionSnapshot::new(initial_snapshot.unwrap_or_default());
|
||||
Self::new(api, snapshot, maybe_lockfile)
|
||||
Self::new(registry_info_provider, snapshot, maybe_lockfile)
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
api: Arc<CliNpmRegistryApi>,
|
||||
registry_info_provider: Arc<CliNpmRegistryInfoProvider>,
|
||||
initial_snapshot: NpmResolutionSnapshot,
|
||||
maybe_lockfile: Option<Arc<CliLockfile>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
api,
|
||||
registry_info_provider,
|
||||
snapshot: SyncReadAsyncWriteLock::new(initial_snapshot),
|
||||
maybe_lockfile,
|
||||
}
|
||||
|
@ -91,7 +90,7 @@ impl NpmResolution {
|
|||
// only allow one thread in here at a time
|
||||
let snapshot_lock = self.snapshot.acquire().await;
|
||||
let result = add_package_reqs_to_snapshot(
|
||||
&self.api,
|
||||
&self.registry_info_provider,
|
||||
package_reqs,
|
||||
self.maybe_lockfile.clone(),
|
||||
|| snapshot_lock.read().clone(),
|
||||
|
@ -119,7 +118,7 @@ impl NpmResolution {
|
|||
|
||||
let reqs_set = package_reqs.iter().collect::<HashSet<_>>();
|
||||
let snapshot = add_package_reqs_to_snapshot(
|
||||
&self.api,
|
||||
&self.registry_info_provider,
|
||||
package_reqs,
|
||||
self.maybe_lockfile.clone(),
|
||||
|| {
|
||||
|
@ -259,7 +258,7 @@ impl NpmResolution {
|
|||
}
|
||||
|
||||
async fn add_package_reqs_to_snapshot(
|
||||
api: &CliNpmRegistryApi,
|
||||
registry_info_provider: &Arc<CliNpmRegistryInfoProvider>,
|
||||
package_reqs: &[PackageReq],
|
||||
maybe_lockfile: Option<Arc<CliLockfile>>,
|
||||
get_new_snapshot: impl Fn() -> NpmResolutionSnapshot,
|
||||
|
@ -282,26 +281,28 @@ async fn add_package_reqs_to_snapshot(
|
|||
/* this string is used in tests */
|
||||
"Running npm resolution."
|
||||
);
|
||||
let npm_registry_api = registry_info_provider.as_npm_registry_api();
|
||||
let result = snapshot
|
||||
.add_pkg_reqs(api, get_add_pkg_reqs_options(package_reqs))
|
||||
.add_pkg_reqs(&npm_registry_api, get_add_pkg_reqs_options(package_reqs))
|
||||
.await;
|
||||
api.clear_memory_cache();
|
||||
let result = match &result.dep_graph_result {
|
||||
Err(NpmResolutionError::Resolution(err)) if api.mark_force_reload() => {
|
||||
Err(NpmResolutionError::Resolution(err))
|
||||
if npm_registry_api.mark_force_reload() =>
|
||||
{
|
||||
log::debug!("{err:#}");
|
||||
log::debug!("npm resolution failed. Trying again...");
|
||||
|
||||
// try again
|
||||
// try again with forced reloading
|
||||
let snapshot = get_new_snapshot();
|
||||
let result = snapshot
|
||||
.add_pkg_reqs(api, get_add_pkg_reqs_options(package_reqs))
|
||||
.await;
|
||||
api.clear_memory_cache();
|
||||
result
|
||||
snapshot
|
||||
.add_pkg_reqs(&npm_registry_api, get_add_pkg_reqs_options(package_reqs))
|
||||
.await
|
||||
}
|
||||
_ => result,
|
||||
};
|
||||
|
||||
registry_info_provider.clear_memory_cache();
|
||||
|
||||
if let Ok(snapshot) = &result.dep_graph_result {
|
||||
if let Some(lockfile) = maybe_lockfile {
|
||||
populate_lockfile_from_snapshot(&lockfile, snapshot);
|
||||
|
|
|
@ -236,8 +236,21 @@ impl NpmPackageFsResolver for LocalNpmPackageResolver {
|
|||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
let folder_name = folder_path.parent().unwrap().to_string_lossy();
|
||||
Ok(get_package_folder_id_from_folder_name(&folder_name))
|
||||
// ex. project/node_modules/.deno/preact@10.24.3/node_modules/preact/
|
||||
let Some(node_modules_ancestor) = folder_path
|
||||
.ancestors()
|
||||
.find(|ancestor| ancestor.ends_with("node_modules"))
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
let Some(folder_name) =
|
||||
node_modules_ancestor.parent().and_then(|p| p.file_name())
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
Ok(get_package_folder_id_from_folder_name(
|
||||
&folder_name.to_string_lossy(),
|
||||
))
|
||||
}
|
||||
|
||||
async fn cache_packages(&self) -> Result<(), AnyError> {
|
||||
|
|
|
@ -78,41 +78,24 @@ pub async fn execute_script(
|
|||
let packages_task_configs: Vec<PackageTaskInfo> = if let Some(filter) =
|
||||
&task_flags.filter
|
||||
{
|
||||
let task_name = task_flags.task.as_ref().unwrap();
|
||||
|
||||
// Filter based on package name
|
||||
let package_regex = arg_to_regex(filter)?;
|
||||
let task_regex = arg_to_regex(task_name)?;
|
||||
let workspace = cli_options.workspace();
|
||||
|
||||
let Some(task_name) = &task_flags.task else {
|
||||
print_available_tasks_workspace(
|
||||
cli_options,
|
||||
&package_regex,
|
||||
filter,
|
||||
force_use_pkg_json,
|
||||
)?;
|
||||
|
||||
return Ok(0);
|
||||
};
|
||||
|
||||
let task_regex = arg_to_regex(task_name)?;
|
||||
let mut packages_task_info: Vec<PackageTaskInfo> = vec![];
|
||||
|
||||
fn matches_package(
|
||||
config: &FolderConfigs,
|
||||
force_use_pkg_json: bool,
|
||||
regex: &Regex,
|
||||
) -> bool {
|
||||
if !force_use_pkg_json {
|
||||
if let Some(deno_json) = &config.deno_json {
|
||||
if let Some(name) = &deno_json.json.name {
|
||||
if regex.is_match(name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(package_json) = &config.pkg_json {
|
||||
if let Some(name) = &package_json.name {
|
||||
if regex.is_match(name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
let workspace = cli_options.workspace();
|
||||
for folder in workspace.config_folders() {
|
||||
if !matches_package(folder.1, force_use_pkg_json, &package_regex) {
|
||||
continue;
|
||||
|
@ -198,6 +181,7 @@ pub async fn execute_script(
|
|||
&mut std::io::stdout(),
|
||||
&cli_options.start_dir,
|
||||
&tasks_config,
|
||||
None,
|
||||
)?;
|
||||
return Ok(0);
|
||||
};
|
||||
|
@ -241,12 +225,15 @@ pub async fn execute_script(
|
|||
description: None,
|
||||
},
|
||||
kill_signal,
|
||||
cli_options.argv(),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
for task_config in &packages_task_configs {
|
||||
let exit_code = task_runner.run_tasks(task_config, &kill_signal).await?;
|
||||
let exit_code = task_runner
|
||||
.run_tasks(task_config, &kill_signal, cli_options.argv())
|
||||
.await?;
|
||||
if exit_code > 0 {
|
||||
return Ok(exit_code);
|
||||
}
|
||||
|
@ -263,6 +250,7 @@ struct RunSingleOptions<'a> {
|
|||
cwd: &'a Path,
|
||||
custom_commands: HashMap<String, Rc<dyn ShellCommand>>,
|
||||
kill_signal: KillSignal,
|
||||
argv: &'a [String],
|
||||
}
|
||||
|
||||
struct TaskRunner<'a> {
|
||||
|
@ -279,9 +267,10 @@ impl<'a> TaskRunner<'a> {
|
|||
&self,
|
||||
pkg_tasks_config: &PackageTaskInfo,
|
||||
kill_signal: &KillSignal,
|
||||
argv: &[String],
|
||||
) -> Result<i32, deno_core::anyhow::Error> {
|
||||
match sort_tasks_topo(pkg_tasks_config) {
|
||||
Ok(sorted) => self.run_tasks_in_parallel(sorted, kill_signal).await,
|
||||
Ok(sorted) => self.run_tasks_in_parallel(sorted, kill_signal, argv).await,
|
||||
Err(err) => match err {
|
||||
TaskError::NotFound(name) => {
|
||||
if self.task_flags.is_run {
|
||||
|
@ -310,6 +299,7 @@ impl<'a> TaskRunner<'a> {
|
|||
&mut std::io::stderr(),
|
||||
&self.cli_options.start_dir,
|
||||
tasks_config,
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -317,6 +307,7 @@ impl<'a> TaskRunner<'a> {
|
|||
&self,
|
||||
tasks: Vec<ResolvedTask<'a>>,
|
||||
kill_signal: &KillSignal,
|
||||
args: &[String],
|
||||
) -> Result<i32, deno_core::anyhow::Error> {
|
||||
struct PendingTasksContext<'a> {
|
||||
completed: HashSet<usize>,
|
||||
|
@ -338,13 +329,21 @@ impl<'a> TaskRunner<'a> {
|
|||
&mut self,
|
||||
runner: &'b TaskRunner<'b>,
|
||||
kill_signal: &KillSignal,
|
||||
argv: &'a [String],
|
||||
) -> Option<
|
||||
LocalBoxFuture<'b, Result<(i32, &'a ResolvedTask<'a>), AnyError>>,
|
||||
>
|
||||
where
|
||||
'a: 'b,
|
||||
{
|
||||
for task in self.tasks.iter() {
|
||||
let mut tasks_iter = self.tasks.iter().peekable();
|
||||
while let Some(task) = tasks_iter.next() {
|
||||
let args = if tasks_iter.peek().is_none() {
|
||||
argv
|
||||
} else {
|
||||
&[]
|
||||
};
|
||||
|
||||
if self.completed.contains(&task.id)
|
||||
|| self.running.contains(&task.id)
|
||||
{
|
||||
|
@ -366,7 +365,13 @@ impl<'a> TaskRunner<'a> {
|
|||
match task.task_or_script {
|
||||
TaskOrScript::Task(_, def) => {
|
||||
runner
|
||||
.run_deno_task(task.folder_url, task.name, def, kill_signal)
|
||||
.run_deno_task(
|
||||
task.folder_url,
|
||||
task.name,
|
||||
def,
|
||||
kill_signal,
|
||||
args,
|
||||
)
|
||||
.await
|
||||
}
|
||||
TaskOrScript::Script(scripts, _) => {
|
||||
|
@ -376,6 +381,7 @@ impl<'a> TaskRunner<'a> {
|
|||
task.name,
|
||||
scripts,
|
||||
kill_signal,
|
||||
args,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
@ -399,7 +405,7 @@ impl<'a> TaskRunner<'a> {
|
|||
|
||||
while context.has_remaining_tasks() {
|
||||
while queue.len() < self.concurrency {
|
||||
if let Some(task) = context.get_next_task(self, kill_signal) {
|
||||
if let Some(task) = context.get_next_task(self, kill_signal, args) {
|
||||
queue.push(task);
|
||||
} else {
|
||||
break;
|
||||
|
@ -429,6 +435,7 @@ impl<'a> TaskRunner<'a> {
|
|||
task_name: &str,
|
||||
definition: &TaskDefinition,
|
||||
kill_signal: KillSignal,
|
||||
argv: &'a [String],
|
||||
) -> Result<i32, deno_core::anyhow::Error> {
|
||||
let cwd = match &self.task_flags.cwd {
|
||||
Some(path) => canonicalize_path(&PathBuf::from(path))
|
||||
|
@ -447,6 +454,7 @@ impl<'a> TaskRunner<'a> {
|
|||
cwd: &cwd,
|
||||
custom_commands,
|
||||
kill_signal,
|
||||
argv,
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
@ -457,6 +465,7 @@ impl<'a> TaskRunner<'a> {
|
|||
task_name: &str,
|
||||
scripts: &IndexMap<String, String>,
|
||||
kill_signal: KillSignal,
|
||||
argv: &[String],
|
||||
) -> Result<i32, deno_core::anyhow::Error> {
|
||||
// ensure the npm packages are installed if using a managed resolver
|
||||
if let Some(npm_resolver) = self.npm_resolver.as_managed() {
|
||||
|
@ -489,6 +498,7 @@ impl<'a> TaskRunner<'a> {
|
|||
cwd: &cwd,
|
||||
custom_commands: custom_commands.clone(),
|
||||
kill_signal: kill_signal.clone(),
|
||||
argv,
|
||||
})
|
||||
.await?;
|
||||
if exit_code > 0 {
|
||||
|
@ -510,11 +520,12 @@ impl<'a> TaskRunner<'a> {
|
|||
cwd,
|
||||
custom_commands,
|
||||
kill_signal,
|
||||
argv,
|
||||
} = opts;
|
||||
|
||||
output_task(
|
||||
opts.task_name,
|
||||
&task_runner::get_script_with_args(script, self.cli_options.argv()),
|
||||
&task_runner::get_script_with_args(script, argv),
|
||||
);
|
||||
|
||||
Ok(
|
||||
|
@ -525,7 +536,7 @@ impl<'a> TaskRunner<'a> {
|
|||
env_vars: self.env_vars.clone(),
|
||||
custom_commands,
|
||||
init_cwd: self.cli_options.initial_cwd(),
|
||||
argv: self.cli_options.argv(),
|
||||
argv,
|
||||
root_node_modules_dir: self.npm_resolver.root_node_modules_path(),
|
||||
stdio: None,
|
||||
kill_signal,
|
||||
|
@ -649,6 +660,32 @@ fn sort_tasks_topo<'a>(
|
|||
Ok(sorted)
|
||||
}
|
||||
|
||||
fn matches_package(
|
||||
config: &FolderConfigs,
|
||||
force_use_pkg_json: bool,
|
||||
regex: &Regex,
|
||||
) -> bool {
|
||||
if !force_use_pkg_json {
|
||||
if let Some(deno_json) = &config.deno_json {
|
||||
if let Some(name) = &deno_json.json.name {
|
||||
if regex.is_match(name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(package_json) = &config.pkg_json {
|
||||
if let Some(name) = &package_json.name {
|
||||
if regex.is_match(name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
fn output_task(task_name: &str, script: &str) {
|
||||
log::info!(
|
||||
"{} {} {}",
|
||||
|
@ -658,12 +695,67 @@ fn output_task(task_name: &str, script: &str) {
|
|||
);
|
||||
}
|
||||
|
||||
fn print_available_tasks_workspace(
|
||||
cli_options: &Arc<CliOptions>,
|
||||
package_regex: &Regex,
|
||||
filter: &str,
|
||||
force_use_pkg_json: bool,
|
||||
) -> Result<(), AnyError> {
|
||||
let workspace = cli_options.workspace();
|
||||
|
||||
let mut matched = false;
|
||||
for folder in workspace.config_folders() {
|
||||
if !matches_package(folder.1, force_use_pkg_json, package_regex) {
|
||||
continue;
|
||||
}
|
||||
matched = true;
|
||||
|
||||
let member_dir = workspace.resolve_member_dir(folder.0);
|
||||
let mut tasks_config = member_dir.to_tasks_config()?;
|
||||
|
||||
let mut pkg_name = folder
|
||||
.1
|
||||
.deno_json
|
||||
.as_ref()
|
||||
.and_then(|deno| deno.json.name.clone())
|
||||
.or(folder.1.pkg_json.as_ref().and_then(|pkg| pkg.name.clone()));
|
||||
|
||||
if force_use_pkg_json {
|
||||
tasks_config = tasks_config.with_only_pkg_json();
|
||||
pkg_name = folder.1.pkg_json.as_ref().and_then(|pkg| pkg.name.clone());
|
||||
}
|
||||
|
||||
print_available_tasks(
|
||||
&mut std::io::stdout(),
|
||||
&cli_options.start_dir,
|
||||
&tasks_config,
|
||||
pkg_name,
|
||||
)?;
|
||||
}
|
||||
|
||||
if !matched {
|
||||
log::warn!(
|
||||
"{}",
|
||||
colors::red(format!("No package name matched the filter '{}' in available 'deno.json' or 'package.json' files.", filter))
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_available_tasks(
|
||||
writer: &mut dyn std::io::Write,
|
||||
workspace_dir: &Arc<WorkspaceDirectory>,
|
||||
tasks_config: &WorkspaceTasksConfig,
|
||||
pkg_name: Option<String>,
|
||||
) -> Result<(), std::io::Error> {
|
||||
writeln!(writer, "{}", colors::green("Available tasks:"))?;
|
||||
let heading = if let Some(s) = pkg_name {
|
||||
format!("Available tasks ({}):", colors::cyan(s))
|
||||
} else {
|
||||
"Available tasks:".to_string()
|
||||
};
|
||||
|
||||
writeln!(writer, "{}", colors::green(heading))?;
|
||||
let is_cwd_root_dir = tasks_config.root.is_none();
|
||||
|
||||
if tasks_config.is_empty() {
|
||||
|
|
|
@ -7,10 +7,7 @@ use std::task::Poll;
|
|||
use std::task::{self};
|
||||
use std::vec;
|
||||
|
||||
use hickory_resolver::error::ResolveError;
|
||||
use hickory_resolver::name_server::GenericConnector;
|
||||
use hickory_resolver::name_server::TokioRuntimeProvider;
|
||||
use hickory_resolver::AsyncResolver;
|
||||
use hickory_resolver::name_server::TokioConnectionProvider;
|
||||
use hyper_util::client::legacy::connect::dns::GaiResolver;
|
||||
use hyper_util::client::legacy::connect::dns::Name;
|
||||
use tokio::task::JoinHandle;
|
||||
|
@ -21,7 +18,7 @@ pub enum Resolver {
|
|||
/// A resolver using blocking `getaddrinfo` calls in a threadpool.
|
||||
Gai(GaiResolver),
|
||||
/// hickory-resolver's userspace resolver.
|
||||
Hickory(AsyncResolver<GenericConnector<TokioRuntimeProvider>>),
|
||||
Hickory(hickory_resolver::Resolver<TokioConnectionProvider>),
|
||||
}
|
||||
|
||||
impl Default for Resolver {
|
||||
|
@ -36,14 +33,14 @@ impl Resolver {
|
|||
}
|
||||
|
||||
/// Create a [`AsyncResolver`] from system conf.
|
||||
pub fn hickory() -> Result<Self, ResolveError> {
|
||||
pub fn hickory() -> Result<Self, hickory_resolver::ResolveError> {
|
||||
Ok(Self::Hickory(
|
||||
hickory_resolver::AsyncResolver::tokio_from_system_conf()?,
|
||||
hickory_resolver::Resolver::tokio_from_system_conf()?,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn hickory_from_async_resolver(
|
||||
resolver: AsyncResolver<GenericConnector<TokioRuntimeProvider>>,
|
||||
pub fn hickory_from_resolver(
|
||||
resolver: hickory_resolver::Resolver<TokioConnectionProvider>,
|
||||
) -> Self {
|
||||
Self::Hickory(resolver)
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ fn test_userspace_resolver() {
|
|||
// use `localhost` to ensure dns step happens.
|
||||
let addr = format!("localhost:{}", src_addr.port());
|
||||
|
||||
let hickory = hickory_resolver::AsyncResolver::tokio(
|
||||
let hickory = hickory_resolver::Resolver::tokio(
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
);
|
||||
|
@ -52,7 +52,7 @@ fn test_userspace_resolver() {
|
|||
addr.clone(),
|
||||
"https",
|
||||
http::Version::HTTP_2,
|
||||
dns::Resolver::hickory_from_async_resolver(hickory),
|
||||
dns::Resolver::hickory_from_resolver(hickory),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(thread_counter.load(SeqCst), 0, "userspace resolver shouldn't spawn new threads.");
|
||||
|
|
|
@ -407,7 +407,7 @@ pub fn bi_pipe_pair_raw(
|
|||
&s,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_OVERLAPPED,
|
||||
0,
|
||||
std::ptr::null_mut(),
|
||||
);
|
||||
if hd2 == INVALID_HANDLE_VALUE {
|
||||
return Err(io::Error::last_os_error());
|
||||
|
|
|
@ -17,7 +17,7 @@ path = "lib.rs"
|
|||
deno_core.workspace = true
|
||||
deno_permissions.workspace = true
|
||||
deno_tls.workspace = true
|
||||
hickory-proto = "0.24"
|
||||
hickory-proto = "0.25.0-alpha.4"
|
||||
hickory-resolver.workspace = true
|
||||
pin-project.workspace = true
|
||||
rustls-tokio-stream.workspace = true
|
||||
|
|
|
@ -21,13 +21,14 @@ use deno_core::ResourceId;
|
|||
use hickory_proto::rr::rdata::caa::Value;
|
||||
use hickory_proto::rr::record_data::RData;
|
||||
use hickory_proto::rr::record_type::RecordType;
|
||||
use hickory_proto::ProtoError;
|
||||
use hickory_proto::ProtoErrorKind;
|
||||
use hickory_resolver::config::NameServerConfigGroup;
|
||||
use hickory_resolver::config::ResolverConfig;
|
||||
use hickory_resolver::config::ResolverOpts;
|
||||
use hickory_resolver::error::ResolveError;
|
||||
use hickory_resolver::error::ResolveErrorKind;
|
||||
use hickory_resolver::system_conf;
|
||||
use hickory_resolver::AsyncResolver;
|
||||
use hickory_resolver::ResolveError;
|
||||
use hickory_resolver::ResolveErrorKind;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use socket2::Domain;
|
||||
|
@ -646,7 +647,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
let resolver = AsyncResolver::tokio(config, opts);
|
||||
let resolver = hickory_resolver::Resolver::tokio(config, opts);
|
||||
|
||||
let lookup_fut = resolver.lookup(query, record_type);
|
||||
|
||||
|
@ -674,11 +675,21 @@ where
|
|||
|
||||
lookup
|
||||
.map_err(|e| match e.kind() {
|
||||
ResolveErrorKind::NoRecordsFound { .. } => NetError::DnsNotFound(e),
|
||||
ResolveErrorKind::Message("No connections available") => {
|
||||
ResolveErrorKind::Proto(ProtoError { kind, .. })
|
||||
if matches!(**kind, ProtoErrorKind::NoRecordsFound { .. }) =>
|
||||
{
|
||||
NetError::DnsNotFound(e)
|
||||
}
|
||||
ResolveErrorKind::Proto(ProtoError { kind, .. })
|
||||
if matches!(**kind, ProtoErrorKind::NoConnections { .. }) =>
|
||||
{
|
||||
NetError::DnsNotConnected(e)
|
||||
}
|
||||
ResolveErrorKind::Timeout => NetError::DnsTimedOut(e),
|
||||
ResolveErrorKind::Proto(ProtoError { kind, .. })
|
||||
if matches!(**kind, ProtoErrorKind::Timeout { .. }) =>
|
||||
{
|
||||
NetError::DnsTimedOut(e)
|
||||
}
|
||||
_ => NetError::Dns(e),
|
||||
})?
|
||||
.iter()
|
||||
|
|
|
@ -429,7 +429,9 @@ where
|
|||
|
||||
let pkg_json_resolver = state.borrow::<PackageJsonResolverRc>();
|
||||
let pkg = pkg_json_resolver
|
||||
.get_closest_package_json_from_path(&PathBuf::from(parent_path.unwrap()))
|
||||
.get_closest_package_json_from_file_path(&PathBuf::from(
|
||||
parent_path.unwrap(),
|
||||
))
|
||||
.ok()
|
||||
.flatten();
|
||||
if pkg.is_none() {
|
||||
|
@ -620,8 +622,8 @@ where
|
|||
let referrer_path = ensure_read_permission::<P>(state, &referrer_path)
|
||||
.map_err(RequireErrorKind::Permission)?;
|
||||
let pkg_json_resolver = state.borrow::<PackageJsonResolverRc>();
|
||||
let Some(pkg) =
|
||||
pkg_json_resolver.get_closest_package_json_from_path(&referrer_path)?
|
||||
let Some(pkg) = pkg_json_resolver
|
||||
.get_closest_package_json_from_file_path(&referrer_path)?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
|
|
|
@ -42,6 +42,7 @@ const {
|
|||
SafeWeakMap,
|
||||
SafeMap,
|
||||
TypeError,
|
||||
encodeURIComponent,
|
||||
} = primordials;
|
||||
|
||||
const debugWorkerThreads = false;
|
||||
|
@ -123,7 +124,11 @@ class NodeWorker extends EventEmitter {
|
|||
);
|
||||
}
|
||||
if (options?.eval) {
|
||||
specifier = `data:text/javascript,${specifier}`;
|
||||
const code = typeof specifier === "string"
|
||||
? encodeURIComponent(specifier)
|
||||
// deno-lint-ignore prefer-primordials
|
||||
: specifier.toString();
|
||||
specifier = `data:text/javascript,${code}`;
|
||||
} else if (
|
||||
!(typeof specifier === "object" && specifier.protocol === "data:")
|
||||
) {
|
||||
|
|
|
@ -39,7 +39,6 @@ const {
|
|||
SafeWeakMap,
|
||||
Array,
|
||||
ObjectEntries,
|
||||
SafeMap,
|
||||
ReflectApply,
|
||||
SymbolFor,
|
||||
Error,
|
||||
|
@ -617,26 +616,25 @@ class SpanExporter {
|
|||
const CURRENT = new AsyncVariable();
|
||||
|
||||
class Context {
|
||||
#data = new SafeMap();
|
||||
#data: Record<symbol, unknown> = { __proto__: null };
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
constructor(data?: Iterable<readonly [any, any]> | null | undefined) {
|
||||
this.#data = data ? new SafeMap(data) : new SafeMap();
|
||||
constructor(data?: Record<symbol, unknown> | null | undefined) {
|
||||
this.#data = { __proto__: null, ...data };
|
||||
}
|
||||
|
||||
getValue(key: symbol): unknown {
|
||||
return this.#data.get(key);
|
||||
return this.#data[key];
|
||||
}
|
||||
|
||||
setValue(key: symbol, value: unknown): Context {
|
||||
const c = new Context(this.#data);
|
||||
c.#data.set(key, value);
|
||||
c.#data[key] = value;
|
||||
return c;
|
||||
}
|
||||
|
||||
deleteValue(key: symbol): Context {
|
||||
const c = new Context(this.#data);
|
||||
c.#data.delete(key);
|
||||
delete c.#data[key];
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,10 +60,10 @@ impl<TEnv: NodeResolverEnv> PackageJsonResolver<TEnv> {
|
|||
let Ok(file_path) = deno_path_util::url_to_file_path(url) else {
|
||||
return Ok(None);
|
||||
};
|
||||
self.get_closest_package_json_from_path(&file_path)
|
||||
self.get_closest_package_json_from_file_path(&file_path)
|
||||
}
|
||||
|
||||
pub fn get_closest_package_json_from_path(
|
||||
pub fn get_closest_package_json_from_file_path(
|
||||
&self,
|
||||
file_path: &Path,
|
||||
) -> Result<Option<PackageJsonRc>, ClosestPkgJsonError> {
|
||||
|
|
|
@ -42,7 +42,7 @@ pub struct DownloadError {
|
|||
|
||||
impl std::error::Error for DownloadError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
Some(self.error.as_ref())
|
||||
self.error.source()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::anyhow;
|
||||
use anyhow::bail;
|
||||
use anyhow::Context;
|
||||
use anyhow::Error as AnyError;
|
||||
use async_trait::async_trait;
|
||||
use deno_npm::npm_rc::ResolvedNpmRc;
|
||||
use deno_npm::registry::NpmPackageInfo;
|
||||
use deno_npm::registry::NpmRegistryApi;
|
||||
use deno_npm::registry::NpmRegistryPackageInfoLoadError;
|
||||
use deno_unsync::sync::AtomicFlag;
|
||||
use deno_unsync::sync::MultiRuntimeAsyncValueCreator;
|
||||
use futures::future::LocalBoxFuture;
|
||||
use futures::FutureExt;
|
||||
|
@ -43,8 +48,49 @@ enum MemoryCacheItem {
|
|||
MemoryCached(Result<Option<Arc<NpmPackageInfo>>, Arc<AnyError>>),
|
||||
}
|
||||
|
||||
// todo(#27198): refactor to store this only in the http cache and also
|
||||
// consolidate with CliNpmRegistryApi.
|
||||
#[derive(Debug, Default)]
|
||||
struct MemoryCache {
|
||||
clear_id: usize,
|
||||
items: HashMap<String, MemoryCacheItem>,
|
||||
}
|
||||
|
||||
impl MemoryCache {
|
||||
#[inline(always)]
|
||||
pub fn clear(&mut self) {
|
||||
self.clear_id += 1;
|
||||
self.items.clear();
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get(&self, key: &str) -> Option<&MemoryCacheItem> {
|
||||
self.items.get(key)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn insert(&mut self, key: String, value: MemoryCacheItem) {
|
||||
self.items.insert(key, value);
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn try_insert(
|
||||
&mut self,
|
||||
clear_id: usize,
|
||||
key: &str,
|
||||
value: MemoryCacheItem,
|
||||
) -> bool {
|
||||
if clear_id != self.clear_id {
|
||||
return false;
|
||||
}
|
||||
// if the clear_id is the same then the item should exist
|
||||
debug_assert!(self.items.contains_key(key));
|
||||
if let Some(item) = self.items.get_mut(key) {
|
||||
*item = value;
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
// todo(#27198): refactor to store this only in the http cache
|
||||
|
||||
/// Downloads packuments from the npm registry.
|
||||
///
|
||||
|
@ -55,7 +101,9 @@ pub struct RegistryInfoProvider<TEnv: NpmCacheEnv> {
|
|||
cache: Arc<NpmCache<TEnv>>,
|
||||
env: Arc<TEnv>,
|
||||
npmrc: Arc<ResolvedNpmRc>,
|
||||
memory_cache: Mutex<HashMap<String, MemoryCacheItem>>,
|
||||
force_reload_flag: AtomicFlag,
|
||||
memory_cache: Mutex<MemoryCache>,
|
||||
previously_loaded_packages: Mutex<HashSet<String>>,
|
||||
}
|
||||
|
||||
impl<TEnv: NpmCacheEnv> RegistryInfoProvider<TEnv> {
|
||||
|
@ -68,17 +116,60 @@ impl<TEnv: NpmCacheEnv> RegistryInfoProvider<TEnv> {
|
|||
cache,
|
||||
env,
|
||||
npmrc,
|
||||
force_reload_flag: AtomicFlag::lowered(),
|
||||
memory_cache: Default::default(),
|
||||
previously_loaded_packages: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn load_package_info(
|
||||
/// Clears the internal memory cache.
|
||||
pub fn clear_memory_cache(&self) {
|
||||
self.memory_cache.lock().clear();
|
||||
}
|
||||
|
||||
fn mark_force_reload(&self) -> bool {
|
||||
// never force reload the registry information if reloading
|
||||
// is disabled or if we're already reloading
|
||||
if matches!(
|
||||
self.cache.cache_setting(),
|
||||
NpmCacheSetting::Only | NpmCacheSetting::ReloadAll
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if self.force_reload_flag.raise() {
|
||||
self.clear_memory_cache();
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_npm_registry_api(self: &Arc<Self>) -> NpmRegistryApiAdapter<TEnv> {
|
||||
NpmRegistryApiAdapter(self.clone())
|
||||
}
|
||||
|
||||
pub async fn package_info(
|
||||
self: &Arc<Self>,
|
||||
name: &str,
|
||||
) -> Result<Arc<NpmPackageInfo>, NpmRegistryPackageInfoLoadError> {
|
||||
match self.maybe_package_info(name).await {
|
||||
Ok(Some(info)) => Ok(info),
|
||||
Ok(None) => Err(NpmRegistryPackageInfoLoadError::PackageNotExists {
|
||||
package_name: name.to_string(),
|
||||
}),
|
||||
Err(err) => {
|
||||
Err(NpmRegistryPackageInfoLoadError::LoadError(Arc::new(err)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn maybe_package_info(
|
||||
self: &Arc<Self>,
|
||||
name: &str,
|
||||
) -> Result<Option<Arc<NpmPackageInfo>>, AnyError> {
|
||||
self.load_package_info_inner(name).await.with_context(|| {
|
||||
format!(
|
||||
"Error getting response at {} for package \"{}\"",
|
||||
"Failed loading {} for package \"{}\"",
|
||||
get_package_url(&self.npmrc, name),
|
||||
name
|
||||
)
|
||||
|
@ -89,18 +180,9 @@ impl<TEnv: NpmCacheEnv> RegistryInfoProvider<TEnv> {
|
|||
self: &Arc<Self>,
|
||||
name: &str,
|
||||
) -> Result<Option<Arc<NpmPackageInfo>>, AnyError> {
|
||||
if *self.cache.cache_setting() == NpmCacheSetting::Only {
|
||||
return Err(deno_core::error::custom_error(
|
||||
"NotCached",
|
||||
format!(
|
||||
"An npm specifier not found in cache: \"{name}\", --cached-only is specified."
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
let cache_item = {
|
||||
let (cache_item, clear_id) = {
|
||||
let mut mem_cache = self.memory_cache.lock();
|
||||
if let Some(cache_item) = mem_cache.get(name) {
|
||||
let cache_item = if let Some(cache_item) = mem_cache.get(name) {
|
||||
cache_item.clone()
|
||||
} else {
|
||||
let value_creator = MultiRuntimeAsyncValueCreator::new({
|
||||
|
@ -111,7 +193,8 @@ impl<TEnv: NpmCacheEnv> RegistryInfoProvider<TEnv> {
|
|||
let cache_item = MemoryCacheItem::Pending(Arc::new(value_creator));
|
||||
mem_cache.insert(name.to_string(), cache_item.clone());
|
||||
cache_item
|
||||
}
|
||||
};
|
||||
(cache_item, mem_cache.clear_id)
|
||||
};
|
||||
|
||||
match cache_item {
|
||||
|
@ -130,25 +213,37 @@ impl<TEnv: NpmCacheEnv> RegistryInfoProvider<TEnv> {
|
|||
Ok(FutureResult::SavedFsCache(info)) => {
|
||||
// return back the future and mark this package as having
|
||||
// been saved in the cache for next time it's requested
|
||||
*self.memory_cache.lock().get_mut(name).unwrap() =
|
||||
MemoryCacheItem::FsCached;
|
||||
self.memory_cache.lock().try_insert(
|
||||
clear_id,
|
||||
name,
|
||||
MemoryCacheItem::FsCached,
|
||||
);
|
||||
Ok(Some(info))
|
||||
}
|
||||
Ok(FutureResult::ErroredFsCache(info)) => {
|
||||
// since saving to the fs cache failed, keep the package information in memory
|
||||
*self.memory_cache.lock().get_mut(name).unwrap() =
|
||||
MemoryCacheItem::MemoryCached(Ok(Some(info.clone())));
|
||||
self.memory_cache.lock().try_insert(
|
||||
clear_id,
|
||||
name,
|
||||
MemoryCacheItem::MemoryCached(Ok(Some(info.clone()))),
|
||||
);
|
||||
Ok(Some(info))
|
||||
}
|
||||
Ok(FutureResult::PackageNotExists) => {
|
||||
*self.memory_cache.lock().get_mut(name).unwrap() =
|
||||
MemoryCacheItem::MemoryCached(Ok(None));
|
||||
self.memory_cache.lock().try_insert(
|
||||
clear_id,
|
||||
name,
|
||||
MemoryCacheItem::MemoryCached(Ok(None)),
|
||||
);
|
||||
Ok(None)
|
||||
}
|
||||
Err(err) => {
|
||||
let return_err = anyhow!("{}", err);
|
||||
*self.memory_cache.lock().get_mut(name).unwrap() =
|
||||
MemoryCacheItem::MemoryCached(Err(err));
|
||||
let return_err = anyhow!("{:#}", err);
|
||||
self.memory_cache.lock().try_insert(
|
||||
clear_id,
|
||||
name,
|
||||
MemoryCacheItem::MemoryCached(Err(err)),
|
||||
);
|
||||
Err(return_err)
|
||||
}
|
||||
}
|
||||
|
@ -196,6 +291,29 @@ impl<TEnv: NpmCacheEnv> RegistryInfoProvider<TEnv> {
|
|||
};
|
||||
let name = name.to_string();
|
||||
async move {
|
||||
if (downloader.cache.cache_setting().should_use_for_npm_package(&name) && !downloader.force_reload_flag.is_raised())
|
||||
// if this has been previously reloaded, then try loading from the
|
||||
// file system cache
|
||||
|| downloader.previously_loaded_packages.lock().contains(&name)
|
||||
{
|
||||
// attempt to load from the file cache
|
||||
if let Some(info) = downloader.cache.load_package_info(&name)? {
|
||||
let result = Arc::new(info);
|
||||
return Ok(FutureResult::SavedFsCache(result));
|
||||
}
|
||||
}
|
||||
|
||||
if *downloader.cache.cache_setting() == NpmCacheSetting::Only {
|
||||
return Err(deno_core::error::custom_error(
|
||||
"NotCached",
|
||||
format!(
|
||||
"npm package not found in cache: \"{name}\", --cached-only is specified."
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
downloader.previously_loaded_packages.lock().insert(name.to_string());
|
||||
|
||||
let maybe_bytes = downloader
|
||||
.env
|
||||
.download_with_retries_on_any_tokio_runtime(
|
||||
|
@ -234,6 +352,24 @@ impl<TEnv: NpmCacheEnv> RegistryInfoProvider<TEnv> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct NpmRegistryApiAdapter<TEnv: NpmCacheEnv>(
|
||||
Arc<RegistryInfoProvider<TEnv>>,
|
||||
);
|
||||
|
||||
#[async_trait(?Send)]
|
||||
impl<TEnv: NpmCacheEnv> NpmRegistryApi for NpmRegistryApiAdapter<TEnv> {
|
||||
async fn package_info(
|
||||
&self,
|
||||
name: &str,
|
||||
) -> Result<Arc<NpmPackageInfo>, NpmRegistryPackageInfoLoadError> {
|
||||
self.0.package_info(name).await
|
||||
}
|
||||
|
||||
fn mark_force_reload(&self) -> bool {
|
||||
self.0.mark_force_reload()
|
||||
}
|
||||
}
|
||||
|
||||
// todo(#27198): make this private and only use RegistryInfoProvider in the rest of
|
||||
// the code
|
||||
pub fn get_package_url(npmrc: &ResolvedNpmRc, name: &str) -> Url {
|
||||
|
|
|
@ -65,13 +65,13 @@ impl<TEnv: NpmCacheEnv> TarballCache<TEnv> {
|
|||
|
||||
pub async fn ensure_package(
|
||||
self: &Arc<Self>,
|
||||
package: &PackageNv,
|
||||
package_nv: &PackageNv,
|
||||
dist: &NpmPackageVersionDistInfo,
|
||||
) -> Result<(), AnyError> {
|
||||
self
|
||||
.ensure_package_inner(package, dist)
|
||||
.ensure_package_inner(package_nv, dist)
|
||||
.await
|
||||
.with_context(|| format!("Failed caching npm package '{}'.", package))
|
||||
.with_context(|| format!("Failed caching npm package '{}'.", package_nv))
|
||||
}
|
||||
|
||||
async fn ensure_package_inner(
|
||||
|
@ -100,7 +100,7 @@ impl<TEnv: NpmCacheEnv> TarballCache<TEnv> {
|
|||
|
||||
match cache_item {
|
||||
MemoryCacheItem::Cached => Ok(()),
|
||||
MemoryCacheItem::Errored(err) => Err(anyhow!("{}", err)),
|
||||
MemoryCacheItem::Errored(err) => Err(anyhow!("{:#}", err)),
|
||||
MemoryCacheItem::Pending(creator) => {
|
||||
let result = creator.get().await;
|
||||
match result {
|
||||
|
@ -110,7 +110,7 @@ impl<TEnv: NpmCacheEnv> TarballCache<TEnv> {
|
|||
Ok(())
|
||||
}
|
||||
Err(err) => {
|
||||
let result_err = anyhow!("{}", err);
|
||||
let result_err = anyhow!("{:#}", err);
|
||||
*self.memory_cache.lock().get_mut(package_nv).unwrap() =
|
||||
MemoryCacheItem::Errored(err);
|
||||
Err(result_err)
|
||||
|
@ -138,7 +138,7 @@ impl<TEnv: NpmCacheEnv> TarballCache<TEnv> {
|
|||
return Err(deno_core::error::custom_error(
|
||||
"NotCached",
|
||||
format!(
|
||||
"An npm specifier not found in cache: \"{}\", --cached-only is specified.",
|
||||
"npm package not found in cache: \"{}\", --cached-only is specified.",
|
||||
&package_nv.name
|
||||
)
|
||||
)
|
||||
|
|
|
@ -37,6 +37,7 @@ const {
|
|||
ObjectHasOwn,
|
||||
ObjectKeys,
|
||||
ObjectGetOwnPropertyDescriptor,
|
||||
ObjectGetOwnPropertyDescriptors,
|
||||
ObjectPrototypeIsPrototypeOf,
|
||||
ObjectSetPrototypeOf,
|
||||
PromisePrototypeThen,
|
||||
|
@ -45,6 +46,7 @@ const {
|
|||
Symbol,
|
||||
SymbolIterator,
|
||||
TypeError,
|
||||
uncurryThis,
|
||||
} = primordials;
|
||||
const {
|
||||
isNativeError,
|
||||
|
@ -459,6 +461,51 @@ function exposeUnstableFeaturesForWindowOrWorkerGlobalScope(unstableFeatures) {
|
|||
}
|
||||
}
|
||||
|
||||
function shimTemporalDurationToLocaleString() {
|
||||
const DurationFormat = Intl.DurationFormat;
|
||||
if (!DurationFormat) {
|
||||
// Intl.DurationFormat can be disabled with --v8-flags=--no-harmony-intl-duration-format
|
||||
return;
|
||||
}
|
||||
const DurationFormatPrototype = DurationFormat.prototype;
|
||||
const formatDuration = uncurryThis(DurationFormatPrototype.format);
|
||||
|
||||
const Duration = Temporal.Duration;
|
||||
const DurationPrototype = Duration.prototype;
|
||||
const desc = ObjectGetOwnPropertyDescriptors(DurationPrototype);
|
||||
const assertDuration = uncurryThis(desc.toLocaleString.value);
|
||||
const getYears = uncurryThis(desc.years.get);
|
||||
const getMonths = uncurryThis(desc.months.get);
|
||||
const getWeeks = uncurryThis(desc.weeks.get);
|
||||
const getDays = uncurryThis(desc.days.get);
|
||||
const getHours = uncurryThis(desc.hours.get);
|
||||
const getMinutes = uncurryThis(desc.minutes.get);
|
||||
const getSeconds = uncurryThis(desc.seconds.get);
|
||||
const getMilliseconds = uncurryThis(desc.milliseconds.get);
|
||||
const getMicroseconds = uncurryThis(desc.microseconds.get);
|
||||
const getNanoseconds = uncurryThis(desc.nanoseconds.get);
|
||||
|
||||
ObjectAssign(DurationPrototype, {
|
||||
toLocaleString(locales = undefined, options) {
|
||||
assertDuration(this);
|
||||
const durationFormat = new DurationFormat(locales, options);
|
||||
const duration = {
|
||||
years: getYears(this),
|
||||
months: getMonths(this),
|
||||
weeks: getWeeks(this),
|
||||
days: getDays(this),
|
||||
hours: getHours(this),
|
||||
minutes: getMinutes(this),
|
||||
seconds: getSeconds(this),
|
||||
milliseconds: getMilliseconds(this),
|
||||
microseconds: getMicroseconds(this),
|
||||
nanoseconds: getNanoseconds(this),
|
||||
};
|
||||
return formatDuration(durationFormat, duration);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// NOTE(bartlomieju): remove all the ops that have already been imported using
|
||||
// "virtual op module" (`ext:core/ops`).
|
||||
const NOT_IMPORTED_OPS = [
|
||||
|
@ -821,6 +868,12 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
|
|||
});
|
||||
delete globalThis.Temporal.Now.timeZone;
|
||||
}
|
||||
|
||||
// deno-lint-ignore prefer-primordials
|
||||
if (new Temporal.Duration().toLocaleString("en-US") !== "PT0S") {
|
||||
throw "V8 supports Temporal.Duration.prototype.toLocaleString now, no need to shim it";
|
||||
}
|
||||
shimTemporalDurationToLocaleString();
|
||||
}
|
||||
|
||||
// Setup `Deno` global - we're actually overriding already existing global
|
||||
|
@ -1024,6 +1077,8 @@ function bootstrapWorkerRuntime(
|
|||
});
|
||||
delete globalThis.Temporal.Now.timeZone;
|
||||
}
|
||||
|
||||
shimTemporalDurationToLocaleString();
|
||||
}
|
||||
|
||||
// Setup `Deno` global - we're actually overriding already existing global
|
||||
|
|
|
@ -47,8 +47,9 @@ deno_tls.workspace = true
|
|||
fastwebsockets = { workspace = true, features = ["upgrade", "unstable-split"] }
|
||||
file_test_runner = "0.7.3"
|
||||
flaky_test = "=0.2.2"
|
||||
hickory-client = "=0.24"
|
||||
hickory-server = "=0.24"
|
||||
hickory-client = "0.25.0-alpha.4"
|
||||
hickory-proto = "0.25.0-alpha.4"
|
||||
hickory-server = "0.25.0-alpha.4"
|
||||
http.workspace = true
|
||||
http-body-util.workspace = true
|
||||
hyper.workspace = true
|
||||
|
|
|
@ -6009,7 +6009,7 @@ fn lsp_code_actions_deno_cache_npm() {
|
|||
"severity": 1,
|
||||
"code": "not-installed-npm",
|
||||
"source": "deno",
|
||||
"message": "NPM package \"chalk\" is not installed or doesn't exist.",
|
||||
"message": "npm package \"chalk\" is not installed or doesn't exist.",
|
||||
"data": { "specifier": "npm:chalk" }
|
||||
}],
|
||||
"version": 1
|
||||
|
@ -6036,7 +6036,7 @@ fn lsp_code_actions_deno_cache_npm() {
|
|||
"severity": 1,
|
||||
"code": "not-installed-npm",
|
||||
"source": "deno",
|
||||
"message": "NPM package \"chalk\" is not installed or doesn't exist.",
|
||||
"message": "npm package \"chalk\" is not installed or doesn't exist.",
|
||||
"data": { "specifier": "npm:chalk" }
|
||||
}],
|
||||
"only": ["quickfix"]
|
||||
|
@ -6056,7 +6056,7 @@ fn lsp_code_actions_deno_cache_npm() {
|
|||
"severity": 1,
|
||||
"code": "not-installed-npm",
|
||||
"source": "deno",
|
||||
"message": "NPM package \"chalk\" is not installed or doesn't exist.",
|
||||
"message": "npm package \"chalk\" is not installed or doesn't exist.",
|
||||
"data": { "specifier": "npm:chalk" }
|
||||
}],
|
||||
"command": {
|
||||
|
@ -6111,7 +6111,7 @@ fn lsp_code_actions_deno_cache_all() {
|
|||
"severity": 1,
|
||||
"code": "not-installed-npm",
|
||||
"source": "deno",
|
||||
"message": "NPM package \"chalk\" is not installed or doesn't exist.",
|
||||
"message": "npm package \"chalk\" is not installed or doesn't exist.",
|
||||
"data": { "specifier": "npm:chalk" },
|
||||
},
|
||||
],
|
||||
|
@ -6199,7 +6199,7 @@ fn lsp_code_actions_deno_cache_all() {
|
|||
"severity": 1,
|
||||
"code": "not-installed-npm",
|
||||
"source": "deno",
|
||||
"message": "NPM package \"chalk\" is not installed or doesn't exist.",
|
||||
"message": "npm package \"chalk\" is not installed or doesn't exist.",
|
||||
"data": { "specifier": "npm:chalk" },
|
||||
},
|
||||
],
|
||||
|
@ -9610,6 +9610,69 @@ fn lsp_completions_npm() {
|
|||
client.shutdown();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lsp_auto_imports_npm_auto() {
|
||||
let context = TestContextBuilder::for_npm().use_temp_cwd().build();
|
||||
let temp_dir_path = context.temp_dir().path();
|
||||
temp_dir_path.join("deno.json").write_json(&json!({
|
||||
"nodeModulesDir": "auto",
|
||||
"imports": {
|
||||
"preact": "npm:preact@^10.19.6",
|
||||
},
|
||||
}));
|
||||
// add a file that uses the import so that typescript knows about it
|
||||
temp_dir_path
|
||||
.join("mod.ts")
|
||||
.write("import { useEffect } from 'preact/hooks'; console.log(useEffect);");
|
||||
context.run_deno("cache mod.ts");
|
||||
let mut client = context.new_lsp_command().build();
|
||||
client.initialize_default();
|
||||
let file_uri = temp_dir_path.join("file.ts").url_file();
|
||||
let mut diagnostics = client
|
||||
.did_open(json!({
|
||||
"textDocument": {
|
||||
"uri": file_uri,
|
||||
"languageId": "typescript",
|
||||
"version": 1,
|
||||
"text": "useEffect",
|
||||
}
|
||||
}))
|
||||
.all();
|
||||
assert_eq!(diagnostics.len(), 1);
|
||||
let diagnostic = diagnostics.remove(0);
|
||||
let res = client.write_request(
|
||||
"textDocument/codeAction",
|
||||
json!({
|
||||
"textDocument": {
|
||||
"uri": file_uri,
|
||||
},
|
||||
"range": {
|
||||
"start": { "line": 0, "character": 0 },
|
||||
"end": { "line": 0, "character": 9 }
|
||||
},
|
||||
"context": {
|
||||
"diagnostics": [diagnostic],
|
||||
"only": ["quickfix"]
|
||||
}
|
||||
}),
|
||||
);
|
||||
assert_eq!(
|
||||
res
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.first()
|
||||
.unwrap()
|
||||
.as_object()
|
||||
.unwrap()
|
||||
.get("title")
|
||||
.unwrap()
|
||||
.as_str()
|
||||
.unwrap(),
|
||||
"Add import from \"preact/hooks\""
|
||||
);
|
||||
client.shutdown();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lsp_npm_specifier_unopened_file() {
|
||||
let context = TestContextBuilder::new()
|
||||
|
@ -9860,7 +9923,7 @@ fn lsp_completions_node_builtin() {
|
|||
"severity": 1,
|
||||
"code": "not-installed-npm",
|
||||
"source": "deno",
|
||||
"message": "NPM package \"@types/node\" is not installed or doesn't exist."
|
||||
"message": "npm package \"@types/node\" is not installed or doesn't exist."
|
||||
}
|
||||
])
|
||||
);
|
||||
|
|
|
@ -102,7 +102,7 @@ fn cached_only_after_first_run() {
|
|||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
assert_contains!(
|
||||
stderr,
|
||||
"An npm specifier not found in cache: \"ansi-styles\", --cached-only is specified."
|
||||
"npm package not found in cache: \"ansi-styles\", --cached-only is specified."
|
||||
);
|
||||
assert!(stdout.is_empty());
|
||||
assert!(!output.status.success());
|
||||
|
|
|
@ -16,7 +16,8 @@ use deno_tls::rustls;
|
|||
use deno_tls::rustls::ClientConnection;
|
||||
use deno_tls::rustls_pemfile;
|
||||
use deno_tls::TlsStream;
|
||||
use hickory_client::serialize::txt::Parser;
|
||||
use hickory_proto::serialize::txt::Parser;
|
||||
use hickory_server::authority::AuthorityObject;
|
||||
use pretty_assertions::assert_eq;
|
||||
use test_util as util;
|
||||
use test_util::itest;
|
||||
|
@ -2245,10 +2246,10 @@ async fn test_resolve_dns() {
|
|||
panic!("failed to parse: {:?}", records.err())
|
||||
}
|
||||
let (origin, records) = records.unwrap();
|
||||
let authority = Box::new(Arc::new(
|
||||
let authority: Vec<Arc<dyn AuthorityObject>> = vec![Arc::new(
|
||||
InMemoryAuthority::new(origin, records, ZoneType::Primary, false)
|
||||
.unwrap(),
|
||||
));
|
||||
)];
|
||||
let mut catalog: Catalog = Catalog::new();
|
||||
catalog.upsert(Name::root().into(), authority);
|
||||
|
||||
|
|
|
@ -122,6 +122,16 @@
|
|||
"sequential": ["test-child-process-exit.js"]
|
||||
},
|
||||
"tests": {
|
||||
"abort": [
|
||||
"test-addon-uv-handle-leak.js"
|
||||
],
|
||||
"benchmark": [
|
||||
"test-benchmark-async-hooks.js",
|
||||
"test-benchmark-http.js",
|
||||
"test-benchmark-http2.js",
|
||||
"test-benchmark-tls.js",
|
||||
"test-benchmark-worker.js"
|
||||
],
|
||||
"common": [
|
||||
"child_process.js",
|
||||
"countdown.js",
|
||||
|
@ -133,6 +143,13 @@
|
|||
"internet.js",
|
||||
"tmpdir.js"
|
||||
],
|
||||
"es-module": [
|
||||
"test-cjs-prototype-pollution.js",
|
||||
"test-esm-dynamic-import-mutating-fs.js",
|
||||
"test-esm-loader-cache-clearing.js",
|
||||
"test-esm-windows.js",
|
||||
"test-vm-compile-function-lineoffset.js"
|
||||
],
|
||||
"fixtures": [
|
||||
"a.js",
|
||||
"child_process_should_emit_error.js",
|
||||
|
@ -161,12 +178,29 @@
|
|||
// "test-dns.js",
|
||||
"test-http-https-default-ports.js"
|
||||
],
|
||||
"message": [
|
||||
"eval_messages.js",
|
||||
"max_tick_depth.js",
|
||||
"stdin_messages.js",
|
||||
"util_inspect_error.js"
|
||||
],
|
||||
"parallel": [
|
||||
"test-arm-math-illegal-instruction.js",
|
||||
"test-assert-async.js",
|
||||
"test-assert-fail.js",
|
||||
"test-assert-strict-exists.js",
|
||||
"test-assert.js",
|
||||
"test-async-hooks-run-in-async-scope-caught-exception.js",
|
||||
"test-async-hooks-run-in-async-scope-this-arg.js",
|
||||
"test-async-local-storage-bind.js",
|
||||
"test-async-local-storage-contexts.js",
|
||||
"test-async-local-storage-deep-stack.js",
|
||||
"test-async-local-storage-http-multiclients.js",
|
||||
"test-async-local-storage-snapshot.js",
|
||||
"test-atomics-wake.js",
|
||||
"test-bad-unicode.js",
|
||||
"test-beforeexit-event-exit.js",
|
||||
"test-blob-buffer-too-large.js",
|
||||
"test-blocklist.js",
|
||||
"test-btoa-atob.js",
|
||||
"test-buffer-alloc.js",
|
||||
|
@ -202,6 +236,7 @@
|
|||
"test-buffer-readint.js",
|
||||
"test-buffer-readuint.js",
|
||||
"test-buffer-safe-unsafe.js",
|
||||
"test-buffer-sharedarraybuffer.js",
|
||||
"test-buffer-slice.js",
|
||||
"test-buffer-slow.js",
|
||||
"test-buffer-swap.js",
|
||||
|
@ -209,6 +244,7 @@
|
|||
"test-buffer-tostring-range.js",
|
||||
"test-buffer-tostring-rangeerror.js",
|
||||
"test-buffer-tostring.js",
|
||||
"test-buffer-write.js",
|
||||
"test-buffer-writedouble.js",
|
||||
"test-buffer-writefloat.js",
|
||||
"test-buffer-writeint.js",
|
||||
|
@ -237,8 +273,10 @@
|
|||
"test-child-process-execfilesync-maxbuf.js",
|
||||
"test-child-process-execsync-maxbuf.js",
|
||||
"test-child-process-flush-stdio.js",
|
||||
"test-child-process-fork3.js",
|
||||
"test-child-process-ipc-next-tick.js",
|
||||
"test-child-process-kill.js",
|
||||
"test-child-process-send-type-error.js",
|
||||
"test-child-process-set-blocking.js",
|
||||
"test-child-process-spawn-args.js",
|
||||
"test-child-process-spawn-event.js",
|
||||
|
@ -246,49 +284,140 @@
|
|||
"test-child-process-spawnsync-maxbuf.js",
|
||||
"test-child-process-spawnsync-validation-errors.js",
|
||||
"test-child-process-spawnsync.js",
|
||||
// TODO(crowlKats): socket is not yet polyfilled
|
||||
// "test-client-request-destroy.js",
|
||||
"test-child-process-stdin-ipc.js",
|
||||
"test-child-process-stdio-overlapped.js",
|
||||
"test-client-request-destroy.js",
|
||||
"test-cluster-uncaught-exception.js",
|
||||
"test-console-assign-undefined.js",
|
||||
"test-console-async-write-error.js",
|
||||
"test-console-formatTime.js",
|
||||
"test-console-group.js",
|
||||
"test-console-log-stdio-broken-dest.js",
|
||||
"test-console-log-throw-primitive.js",
|
||||
"test-console-no-swallow-stack-overflow.js",
|
||||
"test-console-not-call-toString.js",
|
||||
"test-console-self-assign.js",
|
||||
"test-console-sync-write-error.js",
|
||||
"test-console-table.js",
|
||||
"test-console-tty-colors.js",
|
||||
"test-crypto-dh-errors.js",
|
||||
"test-crypto-dh-odd-key.js",
|
||||
"test-crypto-dh-shared.js",
|
||||
"test-crypto-dh.js",
|
||||
"test-crypto-domain.js",
|
||||
"test-crypto-from-binary.js",
|
||||
"test-crypto-hash.js",
|
||||
"test-crypto-hkdf.js",
|
||||
"test-crypto-hmac.js",
|
||||
"test-crypto-keygen-dh-classic.js",
|
||||
"test-crypto-keygen-duplicate-deprecated-option.js",
|
||||
"test-crypto-keygen-empty-passphrase-no-error.js",
|
||||
"test-crypto-keygen-key-objects.js",
|
||||
"test-crypto-keygen-missing-oid.js",
|
||||
"test-crypto-keygen-non-standard-public-exponent.js",
|
||||
"test-crypto-keygen-rfc8017-9-1.js",
|
||||
"test-crypto-keygen-rfc8017-a-2-3.js",
|
||||
"test-crypto-lazy-transform-writable.js",
|
||||
"test-crypto-no-algorithm.js",
|
||||
"test-crypto-op-during-process-exit.js",
|
||||
"test-crypto-padding-aes256.js",
|
||||
"test-crypto-pbkdf2.js",
|
||||
"test-crypto-prime.js",
|
||||
"test-crypto-psychic-signatures.js",
|
||||
"test-crypto-publicDecrypt-fails-first-time.js",
|
||||
"test-crypto-randomfillsync-regression.js",
|
||||
"test-crypto-scrypt.js",
|
||||
"test-crypto-secret-keygen.js",
|
||||
"test-crypto-stream.js",
|
||||
"test-crypto-subtle-zero-length.js",
|
||||
"test-crypto-update-encoding.js",
|
||||
"test-crypto-x509.js",
|
||||
"test-dgram-address.js",
|
||||
"test-dgram-bind-default-address.js",
|
||||
"test-dgram-bind-error-repeat.js",
|
||||
"test-dgram-bind.js",
|
||||
"test-dgram-bytes-length.js",
|
||||
"test-dgram-close-during-bind.js",
|
||||
"test-dgram-close-in-listening.js",
|
||||
"test-dgram-close-is-not-callback.js",
|
||||
"test-dgram-close-signal.js",
|
||||
"test-dgram-close.js",
|
||||
"test-dgram-connect-send-callback-buffer-length.js",
|
||||
"test-dgram-connect-send-callback-buffer.js",
|
||||
"test-dgram-connect-send-callback-multi-buffer.js",
|
||||
"test-dgram-connect-send-default-host.js",
|
||||
"test-dgram-connect-send-empty-array.js",
|
||||
"test-dgram-connect-send-empty-buffer.js",
|
||||
"test-dgram-connect-send-empty-packet.js",
|
||||
"test-dgram-connect-send-multi-buffer-copy.js",
|
||||
"test-dgram-connect-send-multi-string-array.js",
|
||||
"test-dgram-connect.js",
|
||||
"test-dgram-createSocket-type.js",
|
||||
"test-dgram-error-message-address.js",
|
||||
"test-dgram-implicit-bind.js",
|
||||
"test-dgram-listen-after-bind.js",
|
||||
"test-dgram-msgsize.js",
|
||||
"test-dgram-oob-buffer.js",
|
||||
"test-dgram-recv-error.js",
|
||||
"test-dgram-ref.js",
|
||||
"test-dgram-send-bad-arguments.js",
|
||||
"test-dgram-send-callback-buffer-empty-address.js",
|
||||
"test-dgram-send-callback-buffer-length-empty-address.js",
|
||||
"test-dgram-send-callback-buffer-length.js",
|
||||
"test-dgram-send-callback-buffer.js",
|
||||
"test-dgram-send-callback-multi-buffer-empty-address.js",
|
||||
"test-dgram-send-callback-multi-buffer.js",
|
||||
"test-dgram-send-callback-recursive.js",
|
||||
"test-dgram-send-default-host.js",
|
||||
"test-dgram-send-empty-array.js",
|
||||
"test-dgram-send-empty-buffer.js",
|
||||
"test-dgram-send-empty-packet.js",
|
||||
"test-dgram-send-error.js",
|
||||
"test-dgram-send-invalid-msg-type.js",
|
||||
"test-dgram-send-multi-buffer-copy.js",
|
||||
"test-dgram-send-multi-string-array.js",
|
||||
"test-dgram-udp4.js",
|
||||
"test-dgram-udp6-send-default-host.js",
|
||||
"test-dgram-unref.js",
|
||||
"test-diagnostics-channel-bind-store.js",
|
||||
"test-diagnostics-channel-has-subscribers.js",
|
||||
"test-diagnostics-channel-net.js",
|
||||
"test-diagnostics-channel-object-channel-pub-sub.js",
|
||||
"test-diagnostics-channel-pub-sub.js",
|
||||
"test-diagnostics-channel-safe-subscriber-errors.js",
|
||||
"test-diagnostics-channel-symbol-named.js",
|
||||
"test-diagnostics-channel-sync-unsubscribe.js",
|
||||
"test-diagnostics-channel-tracing-channel-args-types.js",
|
||||
"test-diagnostics-channel-tracing-channel-async-error.js",
|
||||
"test-diagnostics-channel-tracing-channel-async.js",
|
||||
"test-diagnostics-channel-tracing-channel-callback-run-stores.js",
|
||||
"test-diagnostics-channel-tracing-channel-promise-run-stores.js",
|
||||
"test-diagnostics-channel-tracing-channel-run-stores.js",
|
||||
"test-diagnostics-channel-tracing-channel-sync-error.js",
|
||||
"test-diagnostics-channel-tracing-channel-sync.js",
|
||||
"test-diagnostics-channel-udp.js",
|
||||
"test-dns-lookup.js",
|
||||
"test-dns-memory-error.js",
|
||||
"test-dns-multi-channel.js",
|
||||
"test-dns-promises-exists.js",
|
||||
"test-dns-resolvens-typeerror.js",
|
||||
"test-dns-setservers-type-check.js",
|
||||
"test-domain-crypto.js",
|
||||
"test-domain-ee-error-listener.js",
|
||||
"test-domain-nested-throw.js",
|
||||
"test-domain-nested.js",
|
||||
"test-domain-stack.js",
|
||||
"test-domain-top-level-error-handler-clears-stack.js",
|
||||
"test-dsa-fips-invalid-key.js",
|
||||
"test-env-newprotomethod-remove-unnecessary-prototypes.js",
|
||||
"test-error-aggregateTwoErrors.js",
|
||||
"test-error-prepare-stack-trace.js",
|
||||
"test-errors-aborterror.js",
|
||||
"test-eval-strict-referenceerror.js",
|
||||
"test-eval.js",
|
||||
"test-event-capture-rejections.js",
|
||||
"test-event-emitter-add-listeners.js",
|
||||
"test-event-emitter-check-listener-leaks.js",
|
||||
"test-event-emitter-emit-context.js",
|
||||
"test-event-emitter-error-monitor.js",
|
||||
"test-event-emitter-errors.js",
|
||||
|
@ -297,6 +426,9 @@
|
|||
"test-event-emitter-listener-count.js",
|
||||
"test-event-emitter-listeners-side-effects.js",
|
||||
"test-event-emitter-listeners.js",
|
||||
"test-event-emitter-max-listeners-warning-for-null.js",
|
||||
"test-event-emitter-max-listeners-warning-for-symbol.js",
|
||||
"test-event-emitter-max-listeners-warning.js",
|
||||
"test-event-emitter-max-listeners.js",
|
||||
"test-event-emitter-method-names.js",
|
||||
"test-event-emitter-modify-in-emit.js",
|
||||
|
@ -315,6 +447,7 @@
|
|||
"test-events-once.js",
|
||||
"test-events-uncaught-exception-stack.js",
|
||||
"test-eventtarget-brandcheck.js",
|
||||
"test-eventtarget-once-twice.js",
|
||||
"test-exception-handler.js",
|
||||
"test-exception-handler2.js",
|
||||
"test-file-read-noexist.js",
|
||||
|
@ -325,28 +458,42 @@
|
|||
"test-fs-access.js",
|
||||
"test-fs-append-file-sync.js",
|
||||
"test-fs-append-file.js",
|
||||
"test-fs-buffertype-writesync.js",
|
||||
"test-fs-chmod-mask.js",
|
||||
"test-fs-chmod.js",
|
||||
"test-fs-chown-type-check.js",
|
||||
"test-fs-close.js",
|
||||
"test-fs-constants.js",
|
||||
"test-fs-copyfile.js",
|
||||
"test-fs-empty-readStream.js",
|
||||
"test-fs-fmap.js",
|
||||
"test-fs-lchown.js",
|
||||
"test-fs-long-path.js",
|
||||
"test-fs-mkdir.js",
|
||||
"test-fs-non-number-arguments-throw.js",
|
||||
"test-fs-open-flags.js",
|
||||
"test-fs-open-mode-mask.js",
|
||||
"test-fs-open-no-close.js",
|
||||
"test-fs-open-numeric-flags.js",
|
||||
"test-fs-open.js",
|
||||
"test-fs-opendir.js",
|
||||
"test-fs-promises-exists.js",
|
||||
"test-fs-promises-file-handle-stat.js",
|
||||
"test-fs-promises-file-handle-write.js",
|
||||
"test-fs-promises-readfile-empty.js",
|
||||
"test-fs-promises-readfile-with-fd.js",
|
||||
"test-fs-promises-writefile-with-fd.js",
|
||||
"test-fs-read-file-sync-hostname.js",
|
||||
"test-fs-read-file-sync.js",
|
||||
"test-fs-read-stream-autoClose.js",
|
||||
"test-fs-read-stream-concurrent-reads.js",
|
||||
"test-fs-read-stream-double-close.js",
|
||||
"test-fs-read-stream-encoding.js",
|
||||
"test-fs-read-stream-fd-leak.js",
|
||||
"test-fs-read-stream-fd.js",
|
||||
"test-fs-read-stream-inherit.js",
|
||||
"test-fs-read-stream-patch-open.js",
|
||||
"test-fs-read-stream-pos.js",
|
||||
"test-fs-read-stream-resume.js",
|
||||
"test-fs-read-stream-throw-type-error.js",
|
||||
"test-fs-read-stream.js",
|
||||
|
@ -356,8 +503,12 @@
|
|||
"test-fs-readdir-stack-overflow.js",
|
||||
"test-fs-readdir.js",
|
||||
"test-fs-readfile-empty.js",
|
||||
"test-fs-readfile-unlink.js",
|
||||
"test-fs-readfile-zero-byte-liar.js",
|
||||
"test-fs-readfilesync-enoent.js",
|
||||
"test-fs-readv-sync.js",
|
||||
"test-fs-readv.js",
|
||||
"test-fs-ready-event-stream.js",
|
||||
"test-fs-realpath-native.js",
|
||||
"test-fs-rmdir-recursive-sync-warns-not-found.js",
|
||||
"test-fs-rmdir-recursive-sync-warns-on-file.js",
|
||||
|
@ -367,33 +518,122 @@
|
|||
"test-fs-rmdir-recursive-warns-on-file.js",
|
||||
"test-fs-rmdir-recursive.js",
|
||||
"test-fs-rmdir-type-check.js",
|
||||
"test-fs-sir-writes-alot.js",
|
||||
"test-fs-stream-construct-compat-error-read.js",
|
||||
"test-fs-stream-construct-compat-graceful-fs.js",
|
||||
"test-fs-stream-construct-compat-old-node.js",
|
||||
"test-fs-stream-destroy-emit-error.js",
|
||||
"test-fs-stream-double-close.js",
|
||||
"test-fs-stream-fs-options.js",
|
||||
"test-fs-stream-options.js",
|
||||
"test-fs-symlink-dir-junction-relative.js",
|
||||
"test-fs-timestamp-parsing-error.js",
|
||||
"test-fs-truncate-clear-file-zero.js",
|
||||
"test-fs-util-validateoffsetlength.js",
|
||||
"test-fs-utimes-y2K38.js",
|
||||
"test-fs-utimes.js",
|
||||
"test-fs-watch-file-enoent-after-deletion.js",
|
||||
"test-fs-watch-recursive-add-file-with-url.js",
|
||||
"test-fs-watch-recursive-add-file.js",
|
||||
"test-fs-watch-recursive-add-folder.js",
|
||||
"test-fs-watch-recursive-update-file.js",
|
||||
"test-fs-watchfile.js",
|
||||
"test-fs-write-buffer.js",
|
||||
"test-fs-write-file-buffer.js",
|
||||
"test-fs-write-file-invalid-path.js",
|
||||
"test-fs-write-file-sync.js",
|
||||
"test-fs-write-file.js",
|
||||
"test-fs-write-negativeoffset.js",
|
||||
"test-fs-write-no-fd.js",
|
||||
"test-fs-write-stream-autoclose-option.js",
|
||||
"test-fs-write-stream-close-without-callback.js",
|
||||
"test-fs-write-stream-double-close.js",
|
||||
"test-fs-write-stream-encoding.js",
|
||||
"test-fs-write-stream-end.js",
|
||||
"test-fs-write-stream-fs.js",
|
||||
"test-fs-write-stream-patch-open.js",
|
||||
"test-fs-write-stream-throw-type-error.js",
|
||||
"test-fs-write-stream.js",
|
||||
"test-fs-write-sync.js",
|
||||
"test-fs-write.js",
|
||||
"test-fs-writev-sync.js",
|
||||
"test-fs-writev.js",
|
||||
"test-global-domexception.js",
|
||||
"test-global-encoder.js",
|
||||
"test-global-webcrypto.js",
|
||||
"test-global-webstreams.js",
|
||||
"test-handle-wrap-close-abort.js",
|
||||
"test-http-abort-before-end.js",
|
||||
"test-http-addrequest-localaddress.js",
|
||||
"test-http-agent-false.js",
|
||||
"test-http-agent-getname.js",
|
||||
"test-http-agent-keepalive-delay.js",
|
||||
"test-http-agent-maxtotalsockets.js",
|
||||
"test-http-agent-no-protocol.js",
|
||||
"test-http-agent-null.js",
|
||||
"test-http-allow-req-after-204-res.js",
|
||||
"test-http-bind-twice.js",
|
||||
"test-http-buffer-sanity.js",
|
||||
"test-http-chunked-smuggling.js",
|
||||
"test-http-chunked.js",
|
||||
"test-http-client-abort2.js",
|
||||
"test-http-client-check-http-token.js",
|
||||
"test-http-client-close-with-default-agent.js",
|
||||
"test-http-client-default-headers-exist.js",
|
||||
"test-http-client-defaults.js",
|
||||
"test-http-client-encoding.js",
|
||||
"test-http-client-get-url.js",
|
||||
"test-http-client-headers-array.js",
|
||||
"test-http-client-invalid-path.js",
|
||||
"test-http-client-keep-alive-hint.js",
|
||||
"test-http-client-race-2.js",
|
||||
"test-http-client-race.js",
|
||||
"test-http-client-read-in-error.js",
|
||||
"test-http-client-reject-unexpected-agent.js",
|
||||
"test-http-client-timeout-connect-listener.js",
|
||||
"test-http-client-timeout-with-data.js",
|
||||
"test-http-client-unescaped-path.js",
|
||||
"test-http-client-upload-buf.js",
|
||||
"test-http-client-upload.js",
|
||||
// TODO(lev): ClientRequest.socket is not polyfilled so this test keeps
|
||||
// failing
|
||||
//"test-http-client-set-timeout.js",
|
||||
"test-http-common.js",
|
||||
"test-http-contentLength0.js",
|
||||
"test-http-correct-hostname.js",
|
||||
"test-http-date-header.js",
|
||||
"test-http-decoded-auth.js",
|
||||
"test-http-default-encoding.js",
|
||||
"test-http-dump-req-when-res-ends.js",
|
||||
"test-http-end-throw-socket-handling.js",
|
||||
"test-http-eof-on-connect.js",
|
||||
"test-http-extra-response.js",
|
||||
"test-http-flush-headers.js",
|
||||
"test-http-full-response.js",
|
||||
"test-http-head-request.js",
|
||||
"test-http-head-response-has-no-body-end-implicit-headers.js",
|
||||
"test-http-head-response-has-no-body-end.js",
|
||||
"test-http-head-response-has-no-body.js",
|
||||
"test-http-head-throw-on-response-body-write.js",
|
||||
"test-http-header-obstext.js",
|
||||
"test-http-header-owstext.js",
|
||||
"test-http-header-read.js",
|
||||
"test-http-header-validators.js",
|
||||
"test-http-hex-write.js",
|
||||
"test-http-highwatermark.js",
|
||||
"test-http-host-headers.js",
|
||||
"test-http-hostname-typechecking.js",
|
||||
"test-http-incoming-message-destroy.js",
|
||||
"test-http-invalid-path-chars.js",
|
||||
"test-http-invalidheaderfield.js",
|
||||
"test-http-invalidheaderfield2.js",
|
||||
"test-http-keep-alive-timeout-custom.js",
|
||||
"test-http-listening.js",
|
||||
"test-http-localaddress-bind-error.js",
|
||||
"test-http-localaddress.js",
|
||||
"test-http-methods.js",
|
||||
"test-http-outgoing-end-types.js",
|
||||
"test-http-outgoing-finished.js",
|
||||
// TODO(bartlomieju): temporarily disabled while we iterate on the HTTP client
|
||||
// "test-http-outgoing-buffer.js",
|
||||
"test-http-outgoing-internal-headernames-getter.js",
|
||||
|
@ -403,53 +643,186 @@
|
|||
// "test-http-outgoing-message-inheritance.js",
|
||||
"test-http-outgoing-renderHeaders.js",
|
||||
"test-http-outgoing-settimeout.js",
|
||||
"test-http-outgoing-write-types.js",
|
||||
"test-http-parser-free.js",
|
||||
"test-http-pause-no-dump.js",
|
||||
"test-http-pause-resume-one-end.js",
|
||||
"test-http-pause.js",
|
||||
"test-http-pipe-fs.js",
|
||||
"test-http-pipeline-requests-connection-leak.js",
|
||||
"test-http-proxy.js",
|
||||
"test-http-readable-data-event.js",
|
||||
"test-http-request-arguments.js",
|
||||
"test-http-request-dont-override-options.js",
|
||||
"test-http-request-end-twice.js",
|
||||
"test-http-request-end.js",
|
||||
"test-http-request-invalid-method-error.js",
|
||||
"test-http-request-large-payload.js",
|
||||
"test-http-request-methods.js",
|
||||
"test-http-res-write-end-dont-take-array.js",
|
||||
"test-http-response-multiheaders.js",
|
||||
"test-http-response-readable.js",
|
||||
"test-http-response-writehead-returns-this.js",
|
||||
"test-http-server-delete-parser.js",
|
||||
"test-http-server-write-after-end.js",
|
||||
"test-http-server-write-end-after-end.js",
|
||||
"test-http-set-cookies.js",
|
||||
"test-http-set-header-chain.js",
|
||||
"test-http-status-code.js",
|
||||
"test-http-status-reason-invalid-chars.js",
|
||||
"test-http-uncaught-from-request-callback.js",
|
||||
"test-http-url.parse-auth.js",
|
||||
"test-http-url.parse-basic.js",
|
||||
"test-http-url.parse-https.request.js",
|
||||
"test-http-url.parse-only-support-http-https-protocol.js",
|
||||
"test-http-url.parse-path.js",
|
||||
"test-http-url.parse-post.js",
|
||||
"test-http-url.parse-search.js",
|
||||
"test-http-wget.js",
|
||||
"test-http-write-empty-string.js",
|
||||
"test-http-zerolengthbuffer.js",
|
||||
"test-http2-client-request-listeners-warning.js",
|
||||
"test-http2-compat-expect-handling.js",
|
||||
"test-http2-compat-socket-set.js",
|
||||
"test-http2-connect-options.js",
|
||||
"test-http2-date-header.js",
|
||||
"test-http2-dont-override.js",
|
||||
"test-http2-endafterheaders.js",
|
||||
"test-http2-methods.js",
|
||||
"test-http2-request-response-proto.js",
|
||||
"test-http2-respond-file-204.js",
|
||||
"test-http2-respond-file-compat.js",
|
||||
"test-http2-session-timeout.js",
|
||||
"test-http2-socket-proxy.js",
|
||||
"test-http2-status-code-invalid.js",
|
||||
"test-http2-status-code.js",
|
||||
"test-http2-stream-removelisteners-after-close.js",
|
||||
"test-http2-write-empty-string.js",
|
||||
"test-https-client-renegotiation-limit.js",
|
||||
"test-https-connecting-to-http.js",
|
||||
"test-https-foafssl.js",
|
||||
"test-https-localaddress-bind-error.js",
|
||||
"test-https-localaddress.js",
|
||||
"test-icu-data-dir.js",
|
||||
"test-icu-env.js",
|
||||
"test-icu-stringwidth.js",
|
||||
"test-icu-transcode.js",
|
||||
"test-inspector-stops-no-file.js",
|
||||
"test-instanceof.js",
|
||||
"test-internal-fs.js",
|
||||
"test-internal-util-normalizeencoding.js",
|
||||
"test-kill-segfault-freebsd.js",
|
||||
"test-listen-fd-detached-inherit.js",
|
||||
"test-listen-fd-detached.js",
|
||||
"test-memory-usage-emfile.js",
|
||||
"test-memory-usage.js",
|
||||
"test-messagechannel.js",
|
||||
"test-microtask-queue-integration.js",
|
||||
"test-microtask-queue-run-immediate.js",
|
||||
"test-microtask-queue-run.js",
|
||||
"test-module-cache.js",
|
||||
"test-module-circular-symlinks.js",
|
||||
"test-module-isBuiltin.js",
|
||||
"test-module-multi-extensions.js",
|
||||
"test-module-nodemodulepaths.js",
|
||||
"test-module-readonly.js",
|
||||
"test-module-relative-lookup.js",
|
||||
"test-net-access-byteswritten.js",
|
||||
"test-net-after-close.js",
|
||||
"test-net-autoselectfamily.js",
|
||||
"test-net-better-error-messages-listen-path.js",
|
||||
"test-net-better-error-messages-listen.js",
|
||||
"test-net-better-error-messages-path.js",
|
||||
"test-net-better-error-messages-port-hostname.js",
|
||||
"test-net-bind-twice.js",
|
||||
"test-net-buffersize.js",
|
||||
"test-net-bytes-written-large.js",
|
||||
"test-net-can-reset-timeout.js",
|
||||
"test-net-connect-after-destroy.js",
|
||||
"test-net-connect-call-socket-connect.js",
|
||||
"test-net-connect-destroy.js",
|
||||
"test-net-connect-immediate-destroy.js",
|
||||
"test-net-connect-immediate-finish.js",
|
||||
"test-net-connect-no-arg.js",
|
||||
"test-net-connect-options-fd.js",
|
||||
"test-net-connect-options-ipv6.js",
|
||||
"test-net-connect-options-port.js",
|
||||
"test-net-connect-paused-connection.js",
|
||||
"test-net-dns-custom-lookup.js",
|
||||
"test-net-dns-error.js",
|
||||
"test-net-dns-lookup-skip.js",
|
||||
"test-net-dns-lookup.js",
|
||||
"test-net-during-close.js",
|
||||
"test-net-eaddrinuse.js",
|
||||
"test-net-end-close.js",
|
||||
"test-net-end-without-connect.js",
|
||||
"test-net-error-twice.js",
|
||||
"test-net-isip.js",
|
||||
"test-net-isipv4.js",
|
||||
"test-net-isipv6.js",
|
||||
"test-net-keepalive.js",
|
||||
"test-net-listen-after-destroying-stdin.js",
|
||||
"test-net-listen-close-server-callback-is-not-function.js",
|
||||
"test-net-listen-close-server.js",
|
||||
"test-net-listen-error.js",
|
||||
"test-net-listen-invalid-port.js",
|
||||
"test-net-listening.js",
|
||||
"test-net-local-address-port.js",
|
||||
"test-net-localerror.js",
|
||||
"test-net-options-lookup.js",
|
||||
"test-net-pause-resume-connecting.js",
|
||||
"test-net-persistent-keepalive.js",
|
||||
"test-net-persistent-nodelay.js",
|
||||
"test-net-persistent-ref-unref.js",
|
||||
"test-net-pipe-connect-errors.js",
|
||||
"test-net-reconnect.js",
|
||||
"test-net-remote-address-port.js",
|
||||
"test-net-remote-address.js",
|
||||
"test-net-server-capture-rejection.js",
|
||||
"test-net-server-close.js",
|
||||
"test-net-server-listen-options-signal.js",
|
||||
"test-net-server-listen-options.js",
|
||||
"test-net-server-listen-path.js",
|
||||
"test-net-server-listen-remove-callback.js",
|
||||
"test-net-server-options.js",
|
||||
"test-net-server-pause-on-connect.js",
|
||||
"test-net-server-unref-persistent.js",
|
||||
"test-net-server-unref.js",
|
||||
"test-net-settimeout.js",
|
||||
"test-net-socket-close-after-end.js",
|
||||
"test-net-socket-connect-invalid-autoselectfamily.js",
|
||||
"test-net-socket-connect-without-cb.js",
|
||||
"test-net-socket-connecting.js",
|
||||
"test-net-socket-destroy-send.js",
|
||||
"test-net-socket-destroy-twice.js",
|
||||
"test-net-socket-end-before-connect.js",
|
||||
"test-net-socket-end-callback.js",
|
||||
"test-net-socket-no-halfopen-enforcer.js",
|
||||
"test-net-socket-ready-without-cb.js",
|
||||
"test-net-socket-setnodelay.js",
|
||||
"test-net-socket-timeout-unref.js",
|
||||
"test-net-socket-write-after-close.js",
|
||||
"test-net-socket-write-error.js",
|
||||
"test-net-sync-cork.js",
|
||||
"test-net-timeout-no-handle.js",
|
||||
"test-net-writable.js",
|
||||
"test-net-write-arguments.js",
|
||||
"test-net-write-connect-write.js",
|
||||
"test-net-write-fully-async-buffer.js",
|
||||
"test-net-write-fully-async-hex-string.js",
|
||||
"test-net-write-slow.js",
|
||||
"test-next-tick-doesnt-hang.js",
|
||||
"test-next-tick-domain.js",
|
||||
"test-next-tick-errors.js",
|
||||
"test-next-tick-fixed-queue-regression.js",
|
||||
"test-next-tick-intentional-starvation.js",
|
||||
"test-next-tick-ordering.js",
|
||||
"test-next-tick-ordering2.js",
|
||||
"test-next-tick-when-exiting.js",
|
||||
"test-next-tick.js",
|
||||
"test-no-node-snapshot.js",
|
||||
"test-nodeeventtarget.js",
|
||||
"test-os-homedir-no-envvar.js",
|
||||
"test-os.js",
|
||||
"test-outgoing-message-destroy.js",
|
||||
"test-outgoing-message-pipe.js",
|
||||
|
@ -468,15 +841,35 @@
|
|||
"test-path-win32-exists.js",
|
||||
"test-path-zero-length-strings.js",
|
||||
"test-path.js",
|
||||
"test-perf-gc-crash.js",
|
||||
"test-performanceobserver-gc.js",
|
||||
"test-pipe-return-val.js",
|
||||
"test-pipe-writev.js",
|
||||
"test-process-abort.js",
|
||||
"test-process-argv-0.js",
|
||||
"test-process-beforeexit.js",
|
||||
"test-process-binding-internalbinding-allowlist.js",
|
||||
"test-process-binding.js",
|
||||
"test-process-dlopen-undefined-exports.js",
|
||||
"test-process-domain-segfault.js",
|
||||
"test-process-emitwarning.js",
|
||||
"test-process-env-allowed-flags.js",
|
||||
"test-process-env-delete.js",
|
||||
"test-process-env-windows-error-reset.js",
|
||||
"test-process-exit-from-before-exit.js",
|
||||
"test-process-exit-handler.js",
|
||||
"test-process-exit-recursive.js",
|
||||
"test-process-exit.js",
|
||||
"test-process-getgroups.js",
|
||||
"test-process-hrtime-bigint.js",
|
||||
"test-process-kill-pid.js",
|
||||
"test-process-next-tick.js",
|
||||
"test-process-no-deprecation.js",
|
||||
"test-process-ppid.js",
|
||||
"test-process-really-exit.js",
|
||||
"test-process-uptime.js",
|
||||
"test-process-warning.js",
|
||||
"test-promise-handled-rejection-no-warning.js",
|
||||
"test-promise-unhandled-silent.js",
|
||||
"test-promise-unhandled-throw-handler.js",
|
||||
"test-punycode.js",
|
||||
|
@ -484,6 +877,14 @@
|
|||
"test-querystring-maxKeys-non-finite.js",
|
||||
"test-querystring-multichar-separator.js",
|
||||
"test-querystring.js",
|
||||
"test-readable-from-iterator-closing.js",
|
||||
"test-readable-from.js",
|
||||
"test-readable-large-hwm.js",
|
||||
"test-readable-single-end.js",
|
||||
"test-readline-async-iterators-destroy.js",
|
||||
"test-readline-async-iterators.js",
|
||||
"test-readline-carriage-return-between-chunks.js",
|
||||
"test-readline-csi.js",
|
||||
"test-readline-emit-keypress-events.js",
|
||||
"test-readline-interface-escapecodetimeout.js",
|
||||
"test-readline-keys.js",
|
||||
|
@ -492,7 +893,31 @@
|
|||
"test-readline-set-raw-mode.js",
|
||||
"test-readline-undefined-columns.js",
|
||||
"test-readline.js",
|
||||
"test-ref-unref-return.js",
|
||||
"test-regression-object-prototype.js",
|
||||
"test-require-invalid-package.js",
|
||||
"test-require-long-path.js",
|
||||
"test-require-nul.js",
|
||||
"test-require-process.js",
|
||||
"test-signal-handler-remove-on-exit.js",
|
||||
"test-signal-handler.js",
|
||||
"test-socket-address.js",
|
||||
"test-socket-write-after-fin-error.js",
|
||||
"test-source-map-enable.js",
|
||||
"test-spawn-cmd-named-pipe.js",
|
||||
"test-stdin-from-file-spawn.js",
|
||||
"test-stdin-hang.js",
|
||||
"test-stdin-pipe-large.js",
|
||||
"test-stdin-pipe-resume.js",
|
||||
"test-stdin-script-child-option.js",
|
||||
"test-stdio-pipe-access.js",
|
||||
"test-stdio-pipe-redirect.js",
|
||||
"test-stdio-pipe-stderr.js",
|
||||
"test-stdio-undestroy.js",
|
||||
"test-stdout-cannot-be-closed-child-process-pipe.js",
|
||||
"test-stdout-pipeline-destroy.js",
|
||||
"test-stdout-stderr-reading.js",
|
||||
"test-stdout-stderr-write.js",
|
||||
"test-stream-add-abort-signal.js",
|
||||
"test-stream-aliases-legacy.js",
|
||||
"test-stream-auto-destroy.js",
|
||||
|
@ -500,22 +925,30 @@
|
|||
"test-stream-backpressure.js",
|
||||
"test-stream-big-packet.js",
|
||||
"test-stream-big-push.js",
|
||||
"test-stream-catch-rejections.js",
|
||||
"test-stream-construct.js",
|
||||
"test-stream-decoder-objectmode.js",
|
||||
"test-stream-destroy-event-order.js",
|
||||
"test-stream-duplex-destroy.js",
|
||||
"test-stream-duplex-end.js",
|
||||
"test-stream-duplex-from.js",
|
||||
"test-stream-duplex-props.js",
|
||||
"test-stream-duplex-readable-end.js",
|
||||
"test-stream-duplex-readable-writable.js",
|
||||
"test-stream-duplex-writable-finished.js",
|
||||
"test-stream-duplex.js",
|
||||
"test-stream-end-of-streams.js",
|
||||
"test-stream-end-paused.js",
|
||||
"test-stream-error-once.js",
|
||||
"test-stream-events-prepend.js",
|
||||
"test-stream-filter.js",
|
||||
"test-stream-flatMap.js",
|
||||
"test-stream-forEach.js",
|
||||
"test-stream-inheritance.js",
|
||||
"test-stream-ispaused.js",
|
||||
"test-stream-objectmode-undefined.js",
|
||||
"test-stream-once-readable-pipe.js",
|
||||
"test-stream-passthrough-drain.js",
|
||||
"test-stream-pipe-after-end.js",
|
||||
"test-stream-pipe-await-drain-manual-resume.js",
|
||||
"test-stream-pipe-await-drain-push-while-write.js",
|
||||
|
@ -523,6 +956,7 @@
|
|||
"test-stream-pipe-cleanup-pause.js",
|
||||
"test-stream-pipe-cleanup.js",
|
||||
"test-stream-pipe-error-handling.js",
|
||||
"test-stream-pipe-error-unhandled.js",
|
||||
"test-stream-pipe-event.js",
|
||||
"test-stream-pipe-flow-after-unpipe.js",
|
||||
"test-stream-pipe-flow.js",
|
||||
|
@ -533,8 +967,12 @@
|
|||
"test-stream-pipe-unpipe-streams.js",
|
||||
"test-stream-pipe-without-listenerCount.js",
|
||||
"test-stream-pipeline-async-iterator.js",
|
||||
"test-stream-pipeline-duplex.js",
|
||||
"test-stream-pipeline-listeners.js",
|
||||
"test-stream-pipeline-queued-end-in-destroy.js",
|
||||
"test-stream-pipeline-uncaught.js",
|
||||
"test-stream-pipeline-with-empty-string.js",
|
||||
"test-stream-push-order.js",
|
||||
"test-stream-push-strings.js",
|
||||
"test-stream-readable-aborted.js",
|
||||
"test-stream-readable-add-chunk-during-data.js",
|
||||
|
@ -566,15 +1004,21 @@
|
|||
"test-stream-readable-resumeScheduled.js",
|
||||
"test-stream-readable-setEncoding-existing-buffers.js",
|
||||
"test-stream-readable-setEncoding-null.js",
|
||||
"test-stream-readable-strategy-option.js",
|
||||
"test-stream-readable-unpipe-resume.js",
|
||||
"test-stream-readable-unshift.js",
|
||||
"test-stream-readable-with-unimplemented-_read.js",
|
||||
"test-stream-readableListening-state.js",
|
||||
"test-stream-reduce.js",
|
||||
"test-stream-toArray.js",
|
||||
"test-stream-toWeb-allows-server-response.js",
|
||||
"test-stream-transform-callback-twice.js",
|
||||
"test-stream-transform-constructor-set-methods.js",
|
||||
"test-stream-transform-destroy.js",
|
||||
"test-stream-transform-final-sync.js",
|
||||
"test-stream-transform-final.js",
|
||||
"test-stream-transform-flush-data.js",
|
||||
"test-stream-transform-hwm0.js",
|
||||
"test-stream-transform-objectmode-falsey-value.js",
|
||||
"test-stream-transform-split-highwatermark.js",
|
||||
"test-stream-transform-split-objectmode.js",
|
||||
|
@ -589,6 +1033,7 @@
|
|||
"test-stream-writable-decoded-encoding.js",
|
||||
"test-stream-writable-destroy.js",
|
||||
"test-stream-writable-end-cb-error.js",
|
||||
"test-stream-writable-end-cb-uncaught.js",
|
||||
"test-stream-writable-end-multiple.js",
|
||||
"test-stream-writable-ended-state.js",
|
||||
"test-stream-writable-final-async.js",
|
||||
|
@ -616,6 +1061,7 @@
|
|||
"test-stream2-basic.js",
|
||||
"test-stream2-compatibility.js",
|
||||
"test-stream2-decode-partial.js",
|
||||
"test-stream2-finish-pipe-error.js",
|
||||
"test-stream2-finish-pipe.js",
|
||||
"test-stream2-large-read-stall.js",
|
||||
"test-stream2-objects.js",
|
||||
|
@ -638,24 +1084,60 @@
|
|||
"test-stream3-cork-end.js",
|
||||
"test-stream3-cork-uncork.js",
|
||||
"test-stream3-pause-then-read.js",
|
||||
"test-stream3-pipeline-async-iterator.js",
|
||||
"test-streams-highwatermark.js",
|
||||
"test-string-decoder.js",
|
||||
"test-stringbytes-external.js",
|
||||
"test-sync-fileread.js",
|
||||
"test-sys.js",
|
||||
"test-tick-processor-arguments.js",
|
||||
"test-timers-api-refs.js",
|
||||
"test-timers-args.js",
|
||||
"test-timers-clear-null-does-not-throw-error.js",
|
||||
"test-timers-clear-object-does-not-throw-error.js",
|
||||
"test-timers-clear-timeout-interval-equivalent.js",
|
||||
"test-timers-clearImmediate-als.js",
|
||||
"test-timers-clearImmediate.js",
|
||||
"test-timers-immediate-queue.js",
|
||||
"test-timers-immediate.js",
|
||||
"test-timers-interval-throw.js",
|
||||
"test-timers-non-integer-delay.js",
|
||||
"test-timers-refresh-in-callback.js",
|
||||
"test-timers-refresh.js",
|
||||
"test-timers-same-timeout-wrong-list-deleted.js",
|
||||
"test-timers-setimmediate-infinite-loop.js",
|
||||
"test-timers-socket-timeout-removes-other-socket-unref-timer.js",
|
||||
"test-timers-timeout-with-non-integer.js",
|
||||
"test-timers-uncaught-exception.js",
|
||||
"test-timers-unref-throw-then-ref.js",
|
||||
"test-timers-unref.js",
|
||||
"test-timers-unrefd-interval-still-fires.js",
|
||||
"test-timers-unrefed-in-beforeexit.js",
|
||||
"test-timers-unrefed-in-callback.js",
|
||||
"test-timers-user-call.js",
|
||||
"test-timers-zero-timeout.js",
|
||||
"test-timers.js",
|
||||
"test-tls-alert-handling.js",
|
||||
"test-tls-alert.js",
|
||||
"test-tls-client-renegotiation-limit.js",
|
||||
"test-tls-dhe.js",
|
||||
"test-tls-ecdh-auto.js",
|
||||
"test-tls-ecdh-multiple.js",
|
||||
"test-tls-ecdh.js",
|
||||
"test-tls-enable-trace-cli.js",
|
||||
"test-tls-enable-trace.js",
|
||||
"test-tls-env-extra-ca-no-crypto.js",
|
||||
"test-tls-ocsp-callback.js",
|
||||
"test-tls-psk-server.js",
|
||||
"test-tls-securepair-server.js",
|
||||
"test-tls-server-verify.js",
|
||||
"test-tls-session-cache.js",
|
||||
"test-tls-set-ciphers.js",
|
||||
"test-tls-transport-destroy-after-own-gc.js",
|
||||
"test-trace-events-async-hooks-dynamic.js",
|
||||
"test-trace-events-async-hooks-worker.js",
|
||||
"test-tty-stdin-end.js",
|
||||
"test-tz-version.js",
|
||||
"test-url-domain-ascii-unicode.js",
|
||||
"test-url-fileurltopath.js",
|
||||
"test-url-format-invalid-input.js",
|
||||
|
@ -666,19 +1148,31 @@
|
|||
"test-url-pathtofileurl.js",
|
||||
"test-url-relative.js",
|
||||
"test-url-urltooptions.js",
|
||||
"test-utf8-scripts.js",
|
||||
"test-util-deprecate-invalid-code.js",
|
||||
"test-util-deprecate.js",
|
||||
"test-util-format.js",
|
||||
"test-util-inherits.js",
|
||||
"test-util-inspect-getters-accessing-this.js",
|
||||
"test-util-inspect-long-running.js",
|
||||
"test-util-inspect-namespace.js",
|
||||
"test-util-inspect-proxy.js",
|
||||
"test-util-inspect.js",
|
||||
"test-util-isDeepStrictEqual.js",
|
||||
"test-util-primordial-monkeypatching.js",
|
||||
"test-util-promisify.js",
|
||||
"test-util-types-exists.js",
|
||||
"test-util-types.js",
|
||||
"test-util.js",
|
||||
"test-uv-binding-constant.js",
|
||||
"test-uv-unmapped-exception.js",
|
||||
"test-v8-coverage.js",
|
||||
"test-v8-deserialize-buffer.js",
|
||||
"test-v8-flag-pool-size-0.js",
|
||||
"test-v8-global-setter.js",
|
||||
"test-v8-stop-coverage.js",
|
||||
"test-v8-take-coverage-noop.js",
|
||||
"test-v8-take-coverage.js",
|
||||
"test-vm-access-process-env.js",
|
||||
"test-vm-attributes-property-not-on-sandbox.js",
|
||||
"test-vm-codegen.js",
|
||||
|
@ -723,28 +1217,39 @@
|
|||
"test-vm-timeout-escape-promise-2.js",
|
||||
"test-vm-timeout-escape-promise.js",
|
||||
"test-vm-timeout.js",
|
||||
"test-weakref.js",
|
||||
"test-webcrypto-encrypt-decrypt.js",
|
||||
"test-webcrypto-sign-verify.js",
|
||||
"test-websocket.js",
|
||||
"test-webstream-string-tag.js",
|
||||
"test-whatwg-encoding-custom-api-basics.js",
|
||||
"test-whatwg-encoding-custom-textdecoder-ignorebom.js",
|
||||
"test-whatwg-encoding-custom-textdecoder-streaming.js",
|
||||
"test-whatwg-events-add-event-listener-options-passive.js",
|
||||
"test-whatwg-events-add-event-listener-options-signal.js",
|
||||
"test-whatwg-events-customevent.js",
|
||||
"test-whatwg-readablebytestreambyob.js",
|
||||
"test-whatwg-url-custom-deepequal.js",
|
||||
"test-whatwg-url-custom-global.js",
|
||||
"test-whatwg-url-custom-href-side-effect.js",
|
||||
"test-whatwg-url-custom-tostringtag.js",
|
||||
"test-whatwg-url-override-hostname.js",
|
||||
"test-whatwg-url-properties.js",
|
||||
"test-worker-cleanexit-with-js.js",
|
||||
"test-worker-message-port-infinite-message-loop.js",
|
||||
"test-worker-message-port-multiple-sharedarraybuffers.js",
|
||||
"test-worker-message-port-receive-message.js",
|
||||
"test-worker-on-process-exit.js",
|
||||
"test-worker-ref-onexit.js",
|
||||
"test-worker-terminate-unrefed.js",
|
||||
"test-zlib-close-after-error.js",
|
||||
"test-zlib-close-after-write.js",
|
||||
"test-zlib-convenience-methods.js",
|
||||
"test-zlib-create-raw.js",
|
||||
"test-zlib-deflate-raw-inherits.js",
|
||||
"test-zlib-destroy-pipe.js",
|
||||
"test-zlib-empty-buffer.js",
|
||||
"test-zlib-flush-write-sync-interleaved.js",
|
||||
"test-zlib-from-string.js",
|
||||
"test-zlib-invalid-input.js",
|
||||
"test-zlib-no-stream.js",
|
||||
|
@ -762,14 +1267,41 @@
|
|||
"console-dumb-tty.js",
|
||||
"no_dropped_stdio.js",
|
||||
"no_interleaved_stdio.js",
|
||||
"test-set-raw-mode-reset-process-exit.js",
|
||||
"test-set-raw-mode-reset.js",
|
||||
"test-tty-color-support-warning-2.js",
|
||||
"test-tty-color-support-warning.js",
|
||||
"test-tty-stdin-call-end.js",
|
||||
"test-tty-stdin-end.js",
|
||||
"test-tty-stdout-end.js"
|
||||
],
|
||||
"pummel": [],
|
||||
"pummel": [
|
||||
"test-crypto-dh-hash.js",
|
||||
"test-crypto-timing-safe-equal-benchmarks.js",
|
||||
"test-dh-regr.js",
|
||||
"test-fs-largefile.js",
|
||||
"test-fs-readfile-tostring-fail.js",
|
||||
"test-fs-watch-system-limit.js",
|
||||
"test-heapsnapshot-near-heap-limit-big.js",
|
||||
"test-net-many-clients.js",
|
||||
"test-net-pingpong-delay.js",
|
||||
"test-process-cpuUsage.js",
|
||||
"test-stream-pipe-multi.js"
|
||||
],
|
||||
"sequential": [
|
||||
"test-child-process-exit.js"
|
||||
"test-buffer-creation-regression.js",
|
||||
"test-child-process-exit.js",
|
||||
"test-http-server-keep-alive-timeout-slow-server.js",
|
||||
"test-net-better-error-messages-port.js",
|
||||
"test-net-connect-handle-econnrefused.js",
|
||||
"test-net-connect-local-error.js",
|
||||
"test-net-reconnect-error.js",
|
||||
"test-net-response-size.js",
|
||||
"test-net-server-bind.js",
|
||||
"test-tls-lookup.js",
|
||||
"test-tls-psk-client.js",
|
||||
"test-tls-securepair-client.js",
|
||||
"test-tls-session-timeout.js"
|
||||
]
|
||||
},
|
||||
"windowsIgnore": {
|
||||
|
|
File diff suppressed because it is too large
Load diff
143
tests/node_compat/test/abort/test-addon-uv-handle-leak.js
Normal file
143
tests/node_compat/test/abort/test-addon-uv-handle-leak.js
Normal file
|
@ -0,0 +1,143 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const cp = require('child_process');
|
||||
const { spawnSync } = require('child_process');
|
||||
|
||||
// This is a sibling test to test/addons/uv-handle-leak.
|
||||
|
||||
const bindingPath = path.resolve(
|
||||
__dirname, '..', 'addons', 'uv-handle-leak', 'build',
|
||||
`${common.buildType}/binding.node`);
|
||||
|
||||
if (!fs.existsSync(bindingPath))
|
||||
common.skip('binding not built yet');
|
||||
|
||||
if (process.argv[2] === 'child') {
|
||||
|
||||
const { Worker } = require('worker_threads');
|
||||
|
||||
// The worker thread loads and then unloads `bindingPath`. Because of this the
|
||||
// symbols in `bindingPath` are lost when the worker thread quits, but the
|
||||
// number of open handles in the worker thread's event loop is assessed in the
|
||||
// main thread afterwards, and the names of the callbacks associated with the
|
||||
// open handles is retrieved at that time as well. Thus, we require
|
||||
// `bindingPath` here so that the symbols and their names survive the life
|
||||
// cycle of the worker thread.
|
||||
require(bindingPath);
|
||||
|
||||
new Worker(`
|
||||
const binding = require(${JSON.stringify(bindingPath)});
|
||||
|
||||
binding.leakHandle();
|
||||
binding.leakHandle(0);
|
||||
binding.leakHandle(0x42);
|
||||
`, { eval: true });
|
||||
} else {
|
||||
const child = cp.spawnSync(process.execPath, [__filename, 'child']);
|
||||
const stderr = child.stderr.toString();
|
||||
|
||||
assert.strictEqual(child.stdout.toString(), '');
|
||||
|
||||
const lines = stderr.split('\n');
|
||||
|
||||
let state = 'initial';
|
||||
|
||||
// Parse output that is formatted like this:
|
||||
|
||||
// uv loop at [0x559b65ed5770] has open handles:
|
||||
// [0x7f2de0018430] timer (active)
|
||||
// Close callback: 0x7f2df31de220 CloseCallback(uv_handle_s*) [...]
|
||||
// Data: 0x7f2df33df140 example_instance [...]
|
||||
// (First field): 0x7f2df33dedc0 vtable for ExampleOwnerClass [...]
|
||||
// [0x7f2de000b870] timer
|
||||
// Close callback: 0x7f2df31de220 CloseCallback(uv_handle_s*) [...]
|
||||
// Data: (nil)
|
||||
// [0x7f2de000b910] timer
|
||||
// Close callback: 0x7f2df31de220 CloseCallback(uv_handle_s*) [...]
|
||||
// Data: 0x42
|
||||
// uv loop at [0x559b65ed5770] has 3 open handles in total
|
||||
|
||||
function isGlibc() {
|
||||
try {
|
||||
const lddOut = spawnSync('ldd', [process.execPath]).stdout;
|
||||
const libcInfo = lddOut.toString().split('\n').map(
|
||||
(line) => line.match(/libc\.so.+=>\s*(\S+)\s/)).filter((info) => info);
|
||||
if (libcInfo.length === 0)
|
||||
return false;
|
||||
const nmOut = spawnSync('nm', ['-D', libcInfo[0][1]]).stdout;
|
||||
if (/gnu_get_libc_version/.test(nmOut))
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!(common.isFreeBSD ||
|
||||
common.isAIX ||
|
||||
common.isIBMi ||
|
||||
(common.isLinux && !isGlibc()) ||
|
||||
common.isWindows)) {
|
||||
assert(stderr.includes('ExampleOwnerClass'), stderr);
|
||||
assert(stderr.includes('CloseCallback'), stderr);
|
||||
assert(stderr.includes('example_instance'), stderr);
|
||||
}
|
||||
|
||||
while (lines.length > 0) {
|
||||
const line = lines.shift().trim();
|
||||
if (line.length === 0) {
|
||||
continue; // Skip empty lines.
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case 'initial':
|
||||
assert.match(line, /^uv loop at \[.+\] has open handles:$/);
|
||||
state = 'handle-start';
|
||||
break;
|
||||
case 'handle-start':
|
||||
if (/^uv loop at \[.+\] has \d+ open handles in total$/.test(line)) {
|
||||
state = 'source-line';
|
||||
break;
|
||||
}
|
||||
assert.match(line, /^\[.+\] timer( \(active\))?$/);
|
||||
state = 'close-callback';
|
||||
break;
|
||||
case 'close-callback':
|
||||
assert.match(line, /^Close callback:/);
|
||||
state = 'data';
|
||||
break;
|
||||
case 'data':
|
||||
assert.match(line, /^Data: .+$/);
|
||||
state = 'maybe-first-field';
|
||||
break;
|
||||
case 'maybe-first-field':
|
||||
if (!/^\(First field\)/.test(line)) {
|
||||
lines.unshift(line);
|
||||
}
|
||||
state = 'handle-start';
|
||||
break;
|
||||
case 'source-line':
|
||||
assert.match(line, /CheckedUvLoopClose/);
|
||||
state = 'assertion-failure';
|
||||
break;
|
||||
case 'assertion-failure':
|
||||
assert.match(line, /Assertion failed:/);
|
||||
state = 'done';
|
||||
break;
|
||||
case 'done':
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assert.strictEqual(state, 'done');
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
if (!common.enoughTestMem)
|
||||
common.skip('Insufficient memory for async_hooks benchmark test');
|
||||
|
||||
const runBenchmark = require('../common/benchmark');
|
||||
|
||||
runBenchmark('async_hooks');
|
21
tests/node_compat/test/benchmark/test-benchmark-http.js
Normal file
21
tests/node_compat/test/benchmark/test-benchmark-http.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
||||
if (!common.enoughTestMem)
|
||||
common.skip('Insufficient memory for HTTP benchmark test');
|
||||
|
||||
// Because the http benchmarks use hardcoded ports, this should be in sequential
|
||||
// rather than parallel to make sure it does not conflict with tests that choose
|
||||
// random available ports.
|
||||
|
||||
const runBenchmark = require('../common/benchmark');
|
||||
|
||||
runBenchmark('http', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
|
23
tests/node_compat/test/benchmark/test-benchmark-http2.js
Normal file
23
tests/node_compat/test/benchmark/test-benchmark-http2.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
if (!common.enoughTestMem)
|
||||
common.skip('Insufficient memory for HTTP/2 benchmark test');
|
||||
|
||||
// Because the http benchmarks use hardcoded ports, this should be in sequential
|
||||
// rather than parallel to make sure it does not conflict with tests that choose
|
||||
// random available ports.
|
||||
|
||||
const runBenchmark = require('../common/benchmark');
|
||||
|
||||
runBenchmark('http2', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
|
24
tests/node_compat/test/benchmark/test-benchmark-tls.js
Normal file
24
tests/node_compat/test/benchmark/test-benchmark-tls.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
if (!common.enoughTestMem)
|
||||
common.skip('Insufficient memory for TLS benchmark test');
|
||||
|
||||
// Because the TLS benchmarks use hardcoded ports, this should be in sequential
|
||||
// rather than parallel to make sure it does not conflict with tests that choose
|
||||
// random available ports.
|
||||
|
||||
const runBenchmark = require('../common/benchmark');
|
||||
|
||||
runBenchmark('tls', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
|
21
tests/node_compat/test/benchmark/test-benchmark-worker.js
Normal file
21
tests/node_compat/test/benchmark/test-benchmark-worker.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
||||
if (!common.enoughTestMem)
|
||||
common.skip('Insufficient memory for Worker benchmark test');
|
||||
|
||||
// Because the worker benchmarks can run on different threads,
|
||||
// this should be in sequential rather than parallel to make sure
|
||||
// it does not conflict with tests that choose random available ports.
|
||||
|
||||
const runBenchmark = require('../common/benchmark');
|
||||
|
||||
runBenchmark('worker', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
|
|
@ -0,0 +1,19 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const { mustNotCall, mustCall } = require('../common');
|
||||
|
||||
Object.defineProperties(Object.prototype, {
|
||||
then: {
|
||||
set: mustNotCall('set %Object.prototype%.then'),
|
||||
get: mustNotCall('get %Object.prototype%.then'),
|
||||
},
|
||||
});
|
||||
|
||||
import('data:text/javascript,').then(mustCall());
|
|
@ -0,0 +1,29 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const tmpdir = require('../common/tmpdir');
|
||||
|
||||
const assert = require('node:assert');
|
||||
const fs = require('node:fs/promises');
|
||||
|
||||
tmpdir.refresh();
|
||||
const target = tmpdir.fileURL(`${Math.random()}.mjs`);
|
||||
|
||||
(async () => {
|
||||
|
||||
await assert.rejects(import(target), { code: 'ERR_MODULE_NOT_FOUND' });
|
||||
|
||||
await fs.writeFile(target, 'export default "actual target"\n');
|
||||
|
||||
const moduleRecord = await import(target);
|
||||
|
||||
await fs.rm(target);
|
||||
|
||||
assert.strictEqual(await import(target), moduleRecord);
|
||||
})().then(common.mustCall());
|
|
@ -0,0 +1,17 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
|
||||
const { cache } = require;
|
||||
|
||||
Object.keys(cache).forEach((key) => {
|
||||
delete cache[key];
|
||||
});
|
||||
// Require the same module again triggers the crash
|
||||
require('../common');
|
54
tests/node_compat/test/es-module/test-esm-windows.js
Normal file
54
tests/node_compat/test/es-module/test-esm-windows.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
// This test ensures that JavaScript file that includes
|
||||
// a reserved Windows word can be loaded as ESM module
|
||||
|
||||
const common = require('../common');
|
||||
const tmpdir = require('../common/tmpdir');
|
||||
const assert = require('assert');
|
||||
const fs = require('fs').promises;
|
||||
const path = require('path');
|
||||
|
||||
const imp = (file) => {
|
||||
return import(path.relative(__dirname, file).replace(/\\/g, '/'));
|
||||
};
|
||||
|
||||
(async () => {
|
||||
tmpdir.refresh();
|
||||
const rel = (file) => tmpdir.resolve(file);
|
||||
|
||||
{ // Load a single script
|
||||
const file = rel('con.mjs');
|
||||
await fs.writeFile(file, 'export default "ok"');
|
||||
assert.strictEqual((await imp(file)).default, 'ok');
|
||||
await fs.unlink(file);
|
||||
}
|
||||
|
||||
{ // Load a module
|
||||
const entry = rel('entry.mjs');
|
||||
const nmDir = rel('node_modules');
|
||||
const mDir = rel('node_modules/con');
|
||||
const pkg = rel('node_modules/con/package.json');
|
||||
const script = rel('node_modules/con/index.mjs');
|
||||
|
||||
await fs.writeFile(entry, 'export {default} from "con"');
|
||||
await fs.mkdir(nmDir);
|
||||
await fs.mkdir(mDir);
|
||||
await fs.writeFile(pkg, '{"main":"index.mjs"}');
|
||||
await fs.writeFile(script, 'export default "ok"');
|
||||
|
||||
assert.strictEqual((await imp(entry)).default, 'ok');
|
||||
await fs.unlink(script);
|
||||
await fs.unlink(pkg);
|
||||
await fs.rmdir(mDir);
|
||||
await fs.rmdir(nmDir);
|
||||
await fs.unlink(entry);
|
||||
}
|
||||
})().then(common.mustCall());
|
|
@ -0,0 +1,41 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
|
||||
const assert = require('assert');
|
||||
const { compileFunction } = require('node:vm');
|
||||
|
||||
const min = -2147483648;
|
||||
const max = 2147483647;
|
||||
|
||||
compileFunction('', [], { lineOffset: min, columnOffset: min });
|
||||
compileFunction('', [], { lineOffset: max, columnOffset: max });
|
||||
|
||||
assert.throws(
|
||||
() => {
|
||||
compileFunction('', [], { lineOffset: min - 1, columnOffset: max });
|
||||
},
|
||||
{
|
||||
code: 'ERR_OUT_OF_RANGE',
|
||||
name: 'RangeError',
|
||||
message: /The value of "options\.lineOffset" is out of range/,
|
||||
}
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
() => {
|
||||
compileFunction('', [], { lineOffset: min, columnOffset: min - 1 });
|
||||
},
|
||||
{
|
||||
code: 'ERR_OUT_OF_RANGE',
|
||||
name: 'RangeError',
|
||||
message: /The value of "options\.columnOffset" is out of range/,
|
||||
}
|
||||
);
|
60
tests/node_compat/test/message/eval_messages.js
Normal file
60
tests/node_compat/test/message/eval_messages.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
|
||||
const spawn = require('child_process').spawn;
|
||||
|
||||
function run(cmd, strict, cb) {
|
||||
const args = [];
|
||||
if (strict) args.push('--use_strict');
|
||||
args.push('-pe', cmd);
|
||||
const child = spawn(process.execPath, args);
|
||||
child.stdout.pipe(process.stdout);
|
||||
child.stderr.pipe(process.stdout);
|
||||
child.on('close', cb);
|
||||
}
|
||||
|
||||
const queue =
|
||||
[ 'with(this){__filename}',
|
||||
'42',
|
||||
'throw new Error("hello")',
|
||||
'var x = 100; y = x;',
|
||||
'var ______________________________________________; throw 10' ];
|
||||
|
||||
function go() {
|
||||
const c = queue.shift();
|
||||
if (!c) return console.log('done');
|
||||
run(c, false, function() {
|
||||
run(c, true, go);
|
||||
});
|
||||
}
|
||||
|
||||
go();
|
38
tests/node_compat/test/message/max_tick_depth.js
Normal file
38
tests/node_compat/test/message/max_tick_depth.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
|
||||
process.maxTickDepth = 10;
|
||||
let i = 20;
|
||||
process.nextTick(function f() {
|
||||
console.error(`tick ${i}`);
|
||||
if (i-- > 0)
|
||||
process.nextTick(f);
|
||||
});
|
61
tests/node_compat/test/message/stdin_messages.js
Normal file
61
tests/node_compat/test/message/stdin_messages.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
|
||||
const spawn = require('child_process').spawn;
|
||||
|
||||
function run(cmd, strict, cb) {
|
||||
const args = [];
|
||||
if (strict) args.push('--use_strict');
|
||||
args.push('-p');
|
||||
const child = spawn(process.execPath, args);
|
||||
child.stdout.pipe(process.stdout);
|
||||
child.stderr.pipe(process.stdout);
|
||||
child.stdin.end(cmd);
|
||||
child.on('close', cb);
|
||||
}
|
||||
|
||||
const queue =
|
||||
[ 'with(this){__filename}',
|
||||
'42',
|
||||
'throw new Error("hello")',
|
||||
'let x = 100; y = x;',
|
||||
'let ______________________________________________; throw 10' ];
|
||||
|
||||
function go() {
|
||||
const c = queue.shift();
|
||||
if (!c) return console.log('done');
|
||||
run(c, false, function() {
|
||||
run(c, true, go);
|
||||
});
|
||||
}
|
||||
|
||||
go();
|
19
tests/node_compat/test/message/util_inspect_error.js
Normal file
19
tests/node_compat/test/message/util_inspect_error.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const util = require('util');
|
||||
|
||||
const err = new Error('foo\nbar');
|
||||
|
||||
console.log(util.inspect({ err, nested: { err } }, { compact: true }));
|
||||
console.log(util.inspect({ err, nested: { err } }, { compact: false }));
|
||||
|
||||
err.foo = 'bar';
|
||||
console.log(util.inspect(err, { compact: true, breakLength: 5 }));
|
|
@ -0,0 +1,22 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
|
||||
// This test ensures Math functions don't fail with an "illegal instruction"
|
||||
// error on ARM devices (primarily on the Raspberry Pi 1)
|
||||
// See https://github.com/nodejs/node/issues/1376
|
||||
// and https://code.google.com/p/v8/issues/detail?id=4019
|
||||
|
||||
// Iterate over all Math functions
|
||||
Object.getOwnPropertyNames(Math).forEach((functionName) => {
|
||||
if (!/[A-Z]/.test(functionName)) {
|
||||
// The function names don't have capital letters.
|
||||
Math[functionName](-0.5);
|
||||
}
|
||||
});
|
|
@ -0,0 +1,18 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const { AsyncResource } = require('async_hooks');
|
||||
|
||||
try {
|
||||
new AsyncResource('foo').runInAsyncScope(() => { throw new Error('bar'); });
|
||||
} catch {
|
||||
// Continue regardless of error.
|
||||
}
|
||||
// Should abort (fail the case) if async id is not matching.
|
|
@ -0,0 +1,24 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
// Test that passing thisArg to runInAsyncScope() works.
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const { AsyncResource } = require('async_hooks');
|
||||
|
||||
const thisArg = {};
|
||||
|
||||
const res = new AsyncResource('fhqwhgads');
|
||||
|
||||
function callback() {
|
||||
assert.strictEqual(this, thisArg);
|
||||
}
|
||||
|
||||
res.runInAsyncScope(common.mustCall(callback), thisArg);
|
|
@ -0,0 +1,24 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const { AsyncLocalStorage } = require('async_hooks');
|
||||
|
||||
[1, false, '', {}, []].forEach((i) => {
|
||||
assert.throws(() => AsyncLocalStorage.bind(i), {
|
||||
code: 'ERR_INVALID_ARG_TYPE'
|
||||
});
|
||||
});
|
||||
|
||||
const fn = common.mustCall(AsyncLocalStorage.bind(() => 123));
|
||||
assert.strictEqual(fn(), 123);
|
||||
|
||||
const fn2 = AsyncLocalStorage.bind(common.mustCall((arg) => assert.strictEqual(arg, 'test')));
|
||||
fn2('test');
|
|
@ -0,0 +1,42 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const vm = require('vm');
|
||||
const { AsyncLocalStorage } = require('async_hooks');
|
||||
|
||||
// Regression test for https://github.com/nodejs/node/issues/38781
|
||||
|
||||
const context = vm.createContext({
|
||||
AsyncLocalStorage,
|
||||
assert
|
||||
});
|
||||
|
||||
vm.runInContext(`
|
||||
const storage = new AsyncLocalStorage()
|
||||
async function test() {
|
||||
return storage.run({ test: 'vm' }, async () => {
|
||||
assert.strictEqual(storage.getStore().test, 'vm');
|
||||
await 42;
|
||||
assert.strictEqual(storage.getStore().test, 'vm');
|
||||
});
|
||||
}
|
||||
test()
|
||||
`, context);
|
||||
|
||||
const storage = new AsyncLocalStorage();
|
||||
async function test() {
|
||||
return storage.run({ test: 'main context' }, async () => {
|
||||
assert.strictEqual(storage.getStore().test, 'main context');
|
||||
await 42;
|
||||
assert.strictEqual(storage.getStore().test, 'main context');
|
||||
});
|
||||
}
|
||||
test();
|
|
@ -0,0 +1,22 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const { AsyncLocalStorage } = require('async_hooks');
|
||||
|
||||
// Regression test for: https://github.com/nodejs/node/issues/34556
|
||||
|
||||
const als = new AsyncLocalStorage();
|
||||
|
||||
const done = common.mustCall();
|
||||
|
||||
function run(count) {
|
||||
if (count !== 0) return als.run({}, run, --count);
|
||||
done();
|
||||
}
|
||||
run(1000);
|
|
@ -0,0 +1,72 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const Countdown = require('../common/countdown');
|
||||
const assert = require('assert');
|
||||
const { AsyncLocalStorage } = require('async_hooks');
|
||||
const http = require('http');
|
||||
const cls = new AsyncLocalStorage();
|
||||
const NUM_CLIENTS = 10;
|
||||
|
||||
// Run multiple clients that receive data from a server
|
||||
// in multiple chunks, in a single non-closure function.
|
||||
// Use the AsyncLocalStorage (ALS) APIs to maintain the context
|
||||
// and data download. Make sure that individual clients
|
||||
// receive their respective data, with no conflicts.
|
||||
|
||||
// Set up a server that sends large buffers of data, filled
|
||||
// with cardinal numbers, increasing per request
|
||||
let index = 0;
|
||||
const server = http.createServer((q, r) => {
|
||||
// Send a large chunk as response, otherwise the data
|
||||
// may be sent in a single chunk, and the callback in the
|
||||
// client may be called only once, defeating the purpose of test
|
||||
r.end((index++ % 10).toString().repeat(1024 * 1024));
|
||||
});
|
||||
|
||||
const countdown = new Countdown(NUM_CLIENTS, () => {
|
||||
server.close();
|
||||
});
|
||||
|
||||
server.listen(0, common.mustCall(() => {
|
||||
for (let i = 0; i < NUM_CLIENTS; i++) {
|
||||
cls.run(new Map(), common.mustCall(() => {
|
||||
const options = { port: server.address().port };
|
||||
const req = http.get(options, common.mustCall((res) => {
|
||||
const store = cls.getStore();
|
||||
store.set('data', '');
|
||||
|
||||
// Make ondata and onend non-closure
|
||||
// functions and fully dependent on ALS
|
||||
res.setEncoding('utf8');
|
||||
res.on('data', ondata);
|
||||
res.on('end', common.mustCall(onend));
|
||||
}));
|
||||
req.end();
|
||||
}));
|
||||
}
|
||||
}));
|
||||
|
||||
// Accumulate the current data chunk with the store data
|
||||
function ondata(d) {
|
||||
const store = cls.getStore();
|
||||
assert.notStrictEqual(store, undefined);
|
||||
let chunk = store.get('data');
|
||||
chunk += d;
|
||||
store.set('data', chunk);
|
||||
}
|
||||
|
||||
// Retrieve the store data, and test for homogeneity
|
||||
function onend() {
|
||||
const store = cls.getStore();
|
||||
assert.notStrictEqual(store, undefined);
|
||||
const data = store.get('data');
|
||||
assert.strictEqual(data, data[0].repeat(data.length));
|
||||
countdown.dec();
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const { strictEqual } = require('assert');
|
||||
const { AsyncLocalStorage } = require('async_hooks');
|
||||
|
||||
const asyncLocalStorage = new AsyncLocalStorage();
|
||||
const runInAsyncScope =
|
||||
asyncLocalStorage.run(123, common.mustCall(() => AsyncLocalStorage.snapshot()));
|
||||
const result =
|
||||
asyncLocalStorage.run(321, common.mustCall(() => {
|
||||
return runInAsyncScope(() => {
|
||||
return asyncLocalStorage.getStore();
|
||||
});
|
||||
}));
|
||||
strictEqual(result, 123);
|
14
tests/node_compat/test/parallel/test-atomics-wake.js
Normal file
14
tests/node_compat/test/parallel/test-atomics-wake.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
// https://github.com/nodejs/node/issues/21219
|
||||
assert.strictEqual(Atomics.wake, undefined);
|
|
@ -0,0 +1,34 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const { mustNotCall } = require('../common');
|
||||
|
||||
process.on('beforeExit', mustNotCall('exit should not allow this to occur'));
|
||||
|
||||
process.exit();
|
|
@ -0,0 +1,31 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Flags: --no-warnings
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const { Blob, kMaxLength } = require('buffer');
|
||||
|
||||
if (common.isFreeBSD)
|
||||
common.skip('Oversized buffer make the FreeBSD CI runner crash');
|
||||
|
||||
try {
|
||||
new Blob([new Uint8Array(kMaxLength), [1]]);
|
||||
} catch (e) {
|
||||
if (
|
||||
e.message === 'Array buffer allocation failed' ||
|
||||
e.message === `Invalid typed array length: ${kMaxLength}`
|
||||
) {
|
||||
common.skip(
|
||||
'Insufficient memory on this platform for oversized buffer test.'
|
||||
);
|
||||
} else {
|
||||
assert.strictEqual(e.code, 'ERR_BUFFER_TOO_LARGE');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
const sab = new SharedArrayBuffer(24);
|
||||
const arr1 = new Uint16Array(sab);
|
||||
const arr2 = new Uint16Array(12);
|
||||
arr2[0] = 5000;
|
||||
arr1[0] = 5000;
|
||||
arr1[1] = 4000;
|
||||
arr2[1] = 4000;
|
||||
|
||||
const arr_buf = Buffer.from(arr1.buffer);
|
||||
const ar_buf = Buffer.from(arr2.buffer);
|
||||
|
||||
assert.deepStrictEqual(arr_buf, ar_buf);
|
||||
|
||||
arr1[1] = 6000;
|
||||
arr2[1] = 6000;
|
||||
|
||||
assert.deepStrictEqual(arr_buf, ar_buf);
|
||||
|
||||
// Checks for calling Buffer.byteLength on a SharedArrayBuffer.
|
||||
assert.strictEqual(Buffer.byteLength(sab), sab.byteLength);
|
||||
|
||||
Buffer.from({ buffer: sab }); // Should not throw.
|
115
tests/node_compat/test/parallel/test-buffer-write.js
Normal file
115
tests/node_compat/test/parallel/test-buffer-write.js
Normal file
|
@ -0,0 +1,115 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
[-1, 10].forEach((offset) => {
|
||||
assert.throws(
|
||||
() => Buffer.alloc(9).write('foo', offset),
|
||||
{
|
||||
code: 'ERR_OUT_OF_RANGE',
|
||||
name: 'RangeError',
|
||||
message: 'The value of "offset" is out of range. ' +
|
||||
`It must be >= 0 && <= 9. Received ${offset}`
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
const resultMap = new Map([
|
||||
['utf8', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])],
|
||||
['ucs2', Buffer.from([102, 0, 111, 0, 111, 0, 0, 0, 0])],
|
||||
['ascii', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])],
|
||||
['latin1', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])],
|
||||
['binary', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])],
|
||||
['utf16le', Buffer.from([102, 0, 111, 0, 111, 0, 0, 0, 0])],
|
||||
['base64', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])],
|
||||
['base64url', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])],
|
||||
['hex', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])],
|
||||
]);
|
||||
|
||||
// utf8, ucs2, ascii, latin1, utf16le
|
||||
const encodings = ['utf8', 'utf-8', 'ucs2', 'ucs-2', 'ascii', 'latin1',
|
||||
'binary', 'utf16le', 'utf-16le'];
|
||||
|
||||
encodings
|
||||
.reduce((es, e) => es.concat(e, e.toUpperCase()), [])
|
||||
.forEach((encoding) => {
|
||||
const buf = Buffer.alloc(9);
|
||||
const len = Buffer.byteLength('foo', encoding);
|
||||
assert.strictEqual(buf.write('foo', 0, len, encoding), len);
|
||||
|
||||
if (encoding.includes('-'))
|
||||
encoding = encoding.replace('-', '');
|
||||
|
||||
assert.deepStrictEqual(buf, resultMap.get(encoding.toLowerCase()));
|
||||
});
|
||||
|
||||
// base64
|
||||
['base64', 'BASE64', 'base64url', 'BASE64URL'].forEach((encoding) => {
|
||||
const buf = Buffer.alloc(9);
|
||||
const len = Buffer.byteLength('Zm9v', encoding);
|
||||
|
||||
assert.strictEqual(buf.write('Zm9v', 0, len, encoding), len);
|
||||
assert.deepStrictEqual(buf, resultMap.get(encoding.toLowerCase()));
|
||||
});
|
||||
|
||||
// hex
|
||||
['hex', 'HEX'].forEach((encoding) => {
|
||||
const buf = Buffer.alloc(9);
|
||||
const len = Buffer.byteLength('666f6f', encoding);
|
||||
|
||||
assert.strictEqual(buf.write('666f6f', 0, len, encoding), len);
|
||||
assert.deepStrictEqual(buf, resultMap.get(encoding.toLowerCase()));
|
||||
});
|
||||
|
||||
// Invalid encodings
|
||||
for (let i = 1; i < 10; i++) {
|
||||
const encoding = String(i).repeat(i);
|
||||
const error = common.expectsError({
|
||||
code: 'ERR_UNKNOWN_ENCODING',
|
||||
name: 'TypeError',
|
||||
message: `Unknown encoding: ${encoding}`
|
||||
});
|
||||
|
||||
assert.ok(!Buffer.isEncoding(encoding));
|
||||
assert.throws(() => Buffer.alloc(9).write('foo', encoding), error);
|
||||
}
|
||||
|
||||
// UCS-2 overflow CVE-2018-12115
|
||||
for (let i = 1; i < 4; i++) {
|
||||
// Allocate two Buffers sequentially off the pool. Run more than once in case
|
||||
// we hit the end of the pool and don't get sequential allocations
|
||||
const x = Buffer.allocUnsafe(4).fill(0);
|
||||
const y = Buffer.allocUnsafe(4).fill(1);
|
||||
// Should not write anything, pos 3 doesn't have enough room for a 16-bit char
|
||||
assert.strictEqual(x.write('ыыыыыы', 3, 'ucs2'), 0);
|
||||
// CVE-2018-12115 experienced via buffer overrun to next block in the pool
|
||||
assert.strictEqual(Buffer.compare(y, Buffer.alloc(4, 1)), 0);
|
||||
}
|
||||
|
||||
// Should not write any data when there is no space for 16-bit chars
|
||||
const z = Buffer.alloc(4, 0);
|
||||
assert.strictEqual(z.write('\u0001', 3, 'ucs2'), 0);
|
||||
assert.strictEqual(Buffer.compare(z, Buffer.alloc(4, 0)), 0);
|
||||
// Make sure longer strings are written up to the buffer end.
|
||||
assert.strictEqual(z.write('abcd', 2), 2);
|
||||
assert.deepStrictEqual([...z], [0, 0, 0x61, 0x62]);
|
||||
|
||||
// Large overrun could corrupt the process
|
||||
assert.strictEqual(Buffer.alloc(4)
|
||||
.write('ыыыыыы'.repeat(100), 3, 'utf16le'), 0);
|
||||
|
||||
{
|
||||
// .write() does not affect the byte after the written-to slice of the Buffer.
|
||||
// Refs: https://github.com/nodejs/node/issues/26422
|
||||
const buf = Buffer.alloc(8);
|
||||
assert.strictEqual(buf.write('ыы', 1, 'utf16le'), 4);
|
||||
assert.deepStrictEqual([...buf], [0, 0x4b, 0x04, 0x4b, 0x04, 0, 0, 0]);
|
||||
}
|
34
tests/node_compat/test/parallel/test-child-process-fork3.js
Normal file
34
tests/node_compat/test/parallel/test-child-process-fork3.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
const child_process = require('child_process');
|
||||
const fixtures = require('../common/fixtures');
|
||||
|
||||
child_process.fork(fixtures.path('empty.js')); // should not hang
|
|
@ -0,0 +1,36 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
|
||||
const assert = require('assert');
|
||||
const cp = require('child_process');
|
||||
|
||||
function fail(proc, args) {
|
||||
assert.throws(() => {
|
||||
proc.send.apply(proc, args);
|
||||
}, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' });
|
||||
}
|
||||
|
||||
let target = process;
|
||||
|
||||
if (process.argv[2] !== 'child') {
|
||||
target = cp.fork(__filename, ['child']);
|
||||
target.on('exit', common.mustCall((code, signal) => {
|
||||
assert.strictEqual(code, 0);
|
||||
assert.strictEqual(signal, null);
|
||||
}));
|
||||
}
|
||||
|
||||
fail(target, ['msg', null, null]);
|
||||
fail(target, ['msg', null, '']);
|
||||
fail(target, ['msg', null, 'foo']);
|
||||
fail(target, ['msg', null, 0]);
|
||||
fail(target, ['msg', null, NaN]);
|
||||
fail(target, ['msg', null, 1]);
|
||||
fail(target, ['msg', null, null, common.mustNotCall()]);
|
|
@ -0,0 +1,47 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
const spawn = require('child_process').spawn;
|
||||
|
||||
if (process.argv[2] === 'child') {
|
||||
// Just reference stdin, it should start it
|
||||
process.stdin; // eslint-disable-line no-unused-expressions
|
||||
return;
|
||||
}
|
||||
|
||||
const proc = spawn(process.execPath, [__filename, 'child'], {
|
||||
stdio: ['ipc', 'inherit', 'inherit']
|
||||
});
|
||||
|
||||
proc.on('exit', common.mustCall(function(code) {
|
||||
assert.strictEqual(code, 0);
|
||||
}));
|
|
@ -0,0 +1,86 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Test for "overlapped" stdio option. This test uses the "overlapped-checker"
|
||||
// helper program which basically a specialized echo program.
|
||||
//
|
||||
// The test has two goals:
|
||||
//
|
||||
// - Verify that overlapped I/O works on windows. The test program will deadlock
|
||||
// if stdin doesn't have the FILE_FLAG_OVERLAPPED flag set on startup (see
|
||||
// test/overlapped-checker/main_win.c for more details).
|
||||
// - Verify that "overlapped" stdio option works transparently as a pipe (on
|
||||
// unix/windows)
|
||||
//
|
||||
// This is how the test works:
|
||||
//
|
||||
// - This script assumes only numeric strings are written to the test program
|
||||
// stdout.
|
||||
// - The test program will be spawned with "overlapped" set on stdin and "pipe"
|
||||
// set on stdout/stderr and at startup writes a number to its stdout
|
||||
// - When this script receives some data, it will parse the number, add 50 and
|
||||
// write to the test program's stdin.
|
||||
// - The test program will then echo the number back to us which will repeat the
|
||||
// cycle until the number reaches 200, at which point we send the "exit"
|
||||
// string, which causes the test program to exit.
|
||||
// - Extra assertion: Every time the test program writes a string to its stdout,
|
||||
// it will write the number of bytes written to stderr.
|
||||
// - If overlapped I/O is not setup correctly, this test is going to hang.
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const path = require('path');
|
||||
const child_process = require('child_process');
|
||||
|
||||
const exeExtension = process.platform === 'win32' ? '.exe' : '';
|
||||
const exe = 'overlapped-checker' + exeExtension;
|
||||
const exePath = path.join(path.dirname(process.execPath), exe);
|
||||
|
||||
if (!require('fs').existsSync(exePath)) {
|
||||
common.skip(exe + ' binary is not available');
|
||||
}
|
||||
|
||||
const child = child_process.spawn(exePath, [], {
|
||||
stdio: ['overlapped', 'pipe', 'pipe']
|
||||
});
|
||||
|
||||
child.stdin.setEncoding('utf8');
|
||||
child.stdout.setEncoding('utf8');
|
||||
child.stderr.setEncoding('utf8');
|
||||
|
||||
function writeNext(n) {
|
||||
child.stdin.write((n + 50).toString());
|
||||
}
|
||||
|
||||
child.stdout.on('data', (s) => {
|
||||
const n = Number(s);
|
||||
if (n >= 200) {
|
||||
child.stdin.write('exit');
|
||||
return;
|
||||
}
|
||||
writeNext(n);
|
||||
});
|
||||
|
||||
let stderr = '';
|
||||
child.stderr.on('data', (s) => {
|
||||
stderr += s;
|
||||
});
|
||||
|
||||
child.stderr.on('end', common.mustCall(() => {
|
||||
// This is the sequence of numbers sent to us:
|
||||
// - 0 (1 byte written)
|
||||
// - 50 (2 bytes written)
|
||||
// - 100 (3 bytes written)
|
||||
// - 150 (3 bytes written)
|
||||
// - 200 (3 bytes written)
|
||||
assert.strictEqual(stderr, '12333');
|
||||
}));
|
||||
|
||||
child.on('exit', common.mustCall((status) => {
|
||||
// The test program will return the number of writes as status code.
|
||||
assert.strictEqual(status, 0);
|
||||
}));
|
|
@ -0,0 +1,20 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
// Test that http.ClientRequest,prototype.destroy() returns `this`.
|
||||
require('../common');
|
||||
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
const clientRequest = new http.ClientRequest({ createConnection: () => {} });
|
||||
|
||||
assert.strictEqual(clientRequest.destroyed, false);
|
||||
assert.strictEqual(clientRequest.destroy(), clientRequest);
|
||||
assert.strictEqual(clientRequest.destroyed, true);
|
||||
assert.strictEqual(clientRequest.destroy(), clientRequest);
|
|
@ -0,0 +1,56 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
// Installing a custom uncaughtException handler should override the default
|
||||
// one that the cluster module installs.
|
||||
// https://github.com/joyent/node/issues/2556
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const cluster = require('cluster');
|
||||
const fork = require('child_process').fork;
|
||||
|
||||
const MAGIC_EXIT_CODE = 42;
|
||||
|
||||
const isTestRunner = process.argv[2] !== 'child';
|
||||
|
||||
if (isTestRunner) {
|
||||
const primary = fork(__filename, ['child']);
|
||||
primary.on('exit', common.mustCall((code) => {
|
||||
assert.strictEqual(code, MAGIC_EXIT_CODE);
|
||||
}));
|
||||
} else if (cluster.isPrimary) {
|
||||
process.on('uncaughtException', common.mustCall(() => {
|
||||
process.nextTick(() => process.exit(MAGIC_EXIT_CODE));
|
||||
}));
|
||||
cluster.fork();
|
||||
throw new Error('kill primary');
|
||||
} else { // worker
|
||||
process.exit();
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
// Patch global.console before importing modules that may modify the console
|
||||
// object.
|
||||
|
||||
const tmp = global.console;
|
||||
global.console = 42;
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
// Originally the console had a getter. Test twice to verify it had no side
|
||||
// effect.
|
||||
assert.strictEqual(global.console, 42);
|
||||
assert.strictEqual(global.console, 42);
|
||||
|
||||
assert.throws(
|
||||
() => console.log('foo'),
|
||||
{ name: 'TypeError' }
|
||||
);
|
||||
|
||||
global.console = 1;
|
||||
assert.strictEqual(global.console, 1);
|
||||
assert.strictEqual(console, 1);
|
||||
|
||||
// Reset the console
|
||||
global.console = tmp;
|
||||
console.log('foo');
|
21
tests/node_compat/test/parallel/test-console-formatTime.js
Normal file
21
tests/node_compat/test/parallel/test-console-formatTime.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
// Flags: --expose-internals
|
||||
require('../common');
|
||||
const { formatTime } = require('internal/console/constructor');
|
||||
const assert = require('assert');
|
||||
|
||||
assert.strictEqual(formatTime(100.0096), '100.01ms');
|
||||
assert.strictEqual(formatTime(100.0115), '100.011ms');
|
||||
assert.strictEqual(formatTime(1500.04), '1.500s');
|
||||
assert.strictEqual(formatTime(1000.056), '1.000s');
|
||||
assert.strictEqual(formatTime(60300.3), '1:00.300 (m:ss.mmm)');
|
||||
assert.strictEqual(formatTime(4000457.4), '1:06:40.457 (h:mm:ss.mmm)');
|
||||
assert.strictEqual(formatTime(3601310.4), '1:00:01.310 (h:mm:ss.mmm)');
|
||||
assert.strictEqual(formatTime(3213601017.6), '892:40:01.018 (h:mm:ss.mmm)');
|
|
@ -0,0 +1,41 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
function func() {}
|
||||
let toStringCalled = false;
|
||||
func.toString = function() {
|
||||
toStringCalled = true;
|
||||
};
|
||||
|
||||
require('util').inspect(func);
|
||||
|
||||
assert.ok(!toStringCalled);
|
13
tests/node_compat/test/parallel/test-console-self-assign.js
Normal file
13
tests/node_compat/test/parallel/test-console-self-assign.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
|
||||
// Assigning to itself should not throw.
|
||||
global.console = global.console; // eslint-disable-line no-self-assign
|
118
tests/node_compat/test/parallel/test-crypto-dh-errors.js
Normal file
118
tests/node_compat/test/parallel/test-crypto-dh-errors.js
Normal file
|
@ -0,0 +1,118 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
|
||||
// https://github.com/nodejs/node/issues/32738
|
||||
// XXX(bnoordhuis) validateInt32() throwing ERR_OUT_OF_RANGE and RangeError
|
||||
// instead of ERR_INVALID_ARG_TYPE and TypeError is questionable, IMO.
|
||||
assert.throws(() => crypto.createDiffieHellman(13.37), {
|
||||
code: 'ERR_OUT_OF_RANGE',
|
||||
name: 'RangeError',
|
||||
message: 'The value of "sizeOrKey" is out of range. ' +
|
||||
'It must be an integer. Received 13.37',
|
||||
});
|
||||
|
||||
assert.throws(() => crypto.createDiffieHellman('abcdef', 13.37), {
|
||||
code: 'ERR_OUT_OF_RANGE',
|
||||
name: 'RangeError',
|
||||
message: 'The value of "generator" is out of range. ' +
|
||||
'It must be an integer. Received 13.37',
|
||||
});
|
||||
|
||||
for (const bits of [-1, 0, 1]) {
|
||||
if (common.hasOpenSSL3) {
|
||||
assert.throws(() => crypto.createDiffieHellman(bits), {
|
||||
code: 'ERR_OSSL_DH_MODULUS_TOO_SMALL',
|
||||
name: 'Error',
|
||||
message: /modulus too small/,
|
||||
});
|
||||
} else {
|
||||
assert.throws(() => crypto.createDiffieHellman(bits), {
|
||||
code: 'ERR_OSSL_BN_BITS_TOO_SMALL',
|
||||
name: 'Error',
|
||||
message: /bits too small/,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const g of [-1, 1]) {
|
||||
const ex = {
|
||||
code: 'ERR_OSSL_DH_BAD_GENERATOR',
|
||||
name: 'Error',
|
||||
message: /bad generator/,
|
||||
};
|
||||
assert.throws(() => crypto.createDiffieHellman('abcdef', g), ex);
|
||||
assert.throws(() => crypto.createDiffieHellman('abcdef', 'hex', g), ex);
|
||||
}
|
||||
|
||||
for (const g of [Buffer.from([]),
|
||||
Buffer.from([0]),
|
||||
Buffer.from([1])]) {
|
||||
const ex = {
|
||||
code: 'ERR_OSSL_DH_BAD_GENERATOR',
|
||||
name: 'Error',
|
||||
message: /bad generator/,
|
||||
};
|
||||
assert.throws(() => crypto.createDiffieHellman('abcdef', g), ex);
|
||||
assert.throws(() => crypto.createDiffieHellman('abcdef', 'hex', g), ex);
|
||||
}
|
||||
|
||||
[
|
||||
[0x1, 0x2],
|
||||
() => { },
|
||||
/abc/,
|
||||
{},
|
||||
].forEach((input) => {
|
||||
assert.throws(
|
||||
() => crypto.createDiffieHellman(input),
|
||||
{
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
name: 'TypeError',
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Invalid test: curve argument is undefined
|
||||
assert.throws(
|
||||
() => crypto.createECDH(),
|
||||
{
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
name: 'TypeError',
|
||||
message: 'The "curve" argument must be of type string. ' +
|
||||
'Received undefined'
|
||||
});
|
||||
|
||||
assert.throws(
|
||||
function() {
|
||||
crypto.getDiffieHellman('unknown-group');
|
||||
},
|
||||
{
|
||||
name: 'Error',
|
||||
code: 'ERR_CRYPTO_UNKNOWN_DH_GROUP',
|
||||
message: 'Unknown DH group'
|
||||
},
|
||||
'crypto.getDiffieHellman(\'unknown-group\') ' +
|
||||
'failed to throw the expected error.'
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
() => crypto.createDiffieHellman('', true),
|
||||
{
|
||||
code: 'ERR_INVALID_ARG_TYPE'
|
||||
}
|
||||
);
|
||||
[true, Symbol(), {}, () => {}, []].forEach((generator) => assert.throws(
|
||||
() => crypto.createDiffieHellman('', 'base64', generator),
|
||||
{ code: 'ERR_INVALID_ARG_TYPE' }
|
||||
));
|
50
tests/node_compat/test/parallel/test-crypto-dh-odd-key.js
Normal file
50
tests/node_compat/test/parallel/test-crypto-dh-odd-key.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
|
||||
function test() {
|
||||
const odd = Buffer.alloc(39, 'A');
|
||||
|
||||
const c = crypto.createDiffieHellman(common.hasOpenSSL3 ? 1024 : 32);
|
||||
c.setPrivateKey(odd);
|
||||
c.generateKeys();
|
||||
}
|
||||
|
||||
// FIPS requires a length of at least 1024
|
||||
if (!common.hasFipsCrypto) {
|
||||
test();
|
||||
} else {
|
||||
assert.throws(function() { test(); }, /key size too small/);
|
||||
}
|
56
tests/node_compat/test/parallel/test-crypto-domain.js
Normal file
56
tests/node_compat/test/parallel/test-crypto-domain.js
Normal file
|
@ -0,0 +1,56 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
const domain = require('domain');
|
||||
|
||||
const test = (fn) => {
|
||||
const ex = new Error('BAM');
|
||||
const d = domain.create();
|
||||
d.on('error', common.mustCall(function(err) {
|
||||
assert.strictEqual(err, ex);
|
||||
}));
|
||||
const cb = common.mustCall(function() {
|
||||
throw ex;
|
||||
});
|
||||
d.run(cb);
|
||||
};
|
||||
|
||||
test(function(cb) {
|
||||
crypto.pbkdf2('password', 'salt', 1, 8, cb);
|
||||
});
|
||||
|
||||
test(function(cb) {
|
||||
crypto.randomBytes(32, cb);
|
||||
});
|
72
tests/node_compat/test/parallel/test-crypto-from-binary.js
Normal file
72
tests/node_compat/test/parallel/test-crypto-from-binary.js
Normal file
|
@ -0,0 +1,72 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
// This is the same as test/simple/test-crypto, but from before the shift
|
||||
// to use buffers by default.
|
||||
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const EXTERN_APEX = 0xFBEE9;
|
||||
|
||||
// Manually controlled string for checking binary output
|
||||
let ucs2_control = 'a\u0000';
|
||||
|
||||
// Grow the strings to proper length
|
||||
while (ucs2_control.length <= EXTERN_APEX) {
|
||||
ucs2_control = ucs2_control.repeat(2);
|
||||
}
|
||||
|
||||
|
||||
// Check resultant buffer and output string
|
||||
const b = Buffer.from(ucs2_control + ucs2_control, 'ucs2');
|
||||
|
||||
//
|
||||
// Test updating from birant data
|
||||
//
|
||||
{
|
||||
const datum1 = b.slice(700000);
|
||||
const hash1_converted = crypto.createHash('sha1')
|
||||
.update(datum1.toString('base64'), 'base64')
|
||||
.digest('hex');
|
||||
const hash1_direct = crypto.createHash('sha1').update(datum1).digest('hex');
|
||||
assert.strictEqual(hash1_direct, hash1_converted);
|
||||
|
||||
const datum2 = b;
|
||||
const hash2_converted = crypto.createHash('sha1')
|
||||
.update(datum2.toString('base64'), 'base64')
|
||||
.digest('hex');
|
||||
const hash2_direct = crypto.createHash('sha1').update(datum2).digest('hex');
|
||||
assert.strictEqual(hash2_direct, hash2_converted);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const {
|
||||
generateKeyPair,
|
||||
} = require('crypto');
|
||||
|
||||
// Test classic Diffie-Hellman key generation.
|
||||
{
|
||||
generateKeyPair('dh', {
|
||||
primeLength: 512
|
||||
}, common.mustSucceed((publicKey, privateKey) => {
|
||||
assert.strictEqual(publicKey.type, 'public');
|
||||
assert.strictEqual(publicKey.asymmetricKeyType, 'dh');
|
||||
|
||||
assert.strictEqual(privateKey.type, 'private');
|
||||
assert.strictEqual(privateKey.asymmetricKeyType, 'dh');
|
||||
}));
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const {
|
||||
generateKeyPair,
|
||||
} = require('crypto');
|
||||
|
||||
// This test makes sure deprecated and new options may be used
|
||||
// simultaneously so long as they're identical values.
|
||||
{
|
||||
generateKeyPair('rsa-pss', {
|
||||
modulusLength: 512,
|
||||
saltLength: 16,
|
||||
hash: 'sha256',
|
||||
hashAlgorithm: 'sha256',
|
||||
mgf1Hash: 'sha256',
|
||||
mgf1HashAlgorithm: 'sha256'
|
||||
}, common.mustSucceed((publicKey, privateKey) => {
|
||||
assert.strictEqual(publicKey.type, 'public');
|
||||
assert.strictEqual(publicKey.asymmetricKeyType, 'rsa-pss');
|
||||
assert.deepStrictEqual(publicKey.asymmetricKeyDetails, {
|
||||
modulusLength: 512,
|
||||
publicExponent: 65537n,
|
||||
hashAlgorithm: 'sha256',
|
||||
mgf1HashAlgorithm: 'sha256',
|
||||
saltLength: 16
|
||||
});
|
||||
|
||||
assert.strictEqual(privateKey.type, 'private');
|
||||
assert.strictEqual(privateKey.asymmetricKeyType, 'rsa-pss');
|
||||
assert.deepStrictEqual(privateKey.asymmetricKeyDetails, {
|
||||
modulusLength: 512,
|
||||
publicExponent: 65537n,
|
||||
hashAlgorithm: 'sha256',
|
||||
mgf1HashAlgorithm: 'sha256',
|
||||
saltLength: 16
|
||||
});
|
||||
}));
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const {
|
||||
generateKeyPair,
|
||||
} = require('crypto');
|
||||
|
||||
// Passing an empty passphrase string should not throw ERR_OSSL_CRYPTO_MALLOC_FAILURE even on OpenSSL 3.
|
||||
// Regression test for https://github.com/nodejs/node/issues/41428.
|
||||
generateKeyPair('rsa', {
|
||||
modulusLength: 1024,
|
||||
publicKeyEncoding: {
|
||||
type: 'spki',
|
||||
format: 'pem'
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
type: 'pkcs8',
|
||||
format: 'pem',
|
||||
cipher: 'aes-256-cbc',
|
||||
passphrase: ''
|
||||
}
|
||||
}, common.mustSucceed((publicKey, privateKey) => {
|
||||
assert.strictEqual(typeof publicKey, 'string');
|
||||
assert.strictEqual(typeof privateKey, 'string');
|
||||
}));
|
|
@ -0,0 +1,40 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const {
|
||||
generateKeyPairSync,
|
||||
} = require('crypto');
|
||||
|
||||
// Test sync key generation with key objects.
|
||||
{
|
||||
const { publicKey, privateKey } = generateKeyPairSync('rsa', {
|
||||
modulusLength: 512
|
||||
});
|
||||
|
||||
assert.strictEqual(typeof publicKey, 'object');
|
||||
assert.strictEqual(publicKey.type, 'public');
|
||||
assert.strictEqual(publicKey.asymmetricKeyType, 'rsa');
|
||||
assert.deepStrictEqual(publicKey.asymmetricKeyDetails, {
|
||||
modulusLength: 512,
|
||||
publicExponent: 65537n
|
||||
});
|
||||
|
||||
assert.strictEqual(typeof privateKey, 'object');
|
||||
assert.strictEqual(privateKey.type, 'private');
|
||||
assert.strictEqual(privateKey.asymmetricKeyType, 'rsa');
|
||||
assert.deepStrictEqual(privateKey.asymmetricKeyDetails, {
|
||||
modulusLength: 512,
|
||||
publicExponent: 65537n
|
||||
});
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const {
|
||||
generateKeyPair,
|
||||
generateKeyPairSync,
|
||||
getCurves,
|
||||
} = require('crypto');
|
||||
|
||||
// This test creates EC key pairs on curves without associated OIDs.
|
||||
// Specifying a key encoding should not crash.
|
||||
{
|
||||
if (process.versions.openssl >= '1.1.1i') {
|
||||
for (const namedCurve of ['Oakley-EC2N-3', 'Oakley-EC2N-4']) {
|
||||
if (!getCurves().includes(namedCurve))
|
||||
continue;
|
||||
|
||||
const expectedErrorCode =
|
||||
common.hasOpenSSL3 ? 'ERR_OSSL_MISSING_OID' : 'ERR_OSSL_EC_MISSING_OID';
|
||||
const params = {
|
||||
namedCurve,
|
||||
publicKeyEncoding: {
|
||||
format: 'der',
|
||||
type: 'spki'
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(() => {
|
||||
generateKeyPairSync('ec', params);
|
||||
}, {
|
||||
code: expectedErrorCode
|
||||
});
|
||||
|
||||
generateKeyPair('ec', params, common.mustCall((err) => {
|
||||
assert.strictEqual(err.code, expectedErrorCode);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const {
|
||||
generateKeyPairSync,
|
||||
} = require('crypto');
|
||||
|
||||
// Test sync key generation with key objects with a non-standard
|
||||
// publicExponent
|
||||
{
|
||||
const { publicKey, privateKey } = generateKeyPairSync('rsa', {
|
||||
publicExponent: 3,
|
||||
modulusLength: 512
|
||||
});
|
||||
|
||||
assert.strictEqual(typeof publicKey, 'object');
|
||||
assert.strictEqual(publicKey.type, 'public');
|
||||
assert.strictEqual(publicKey.asymmetricKeyType, 'rsa');
|
||||
assert.deepStrictEqual(publicKey.asymmetricKeyDetails, {
|
||||
modulusLength: 512,
|
||||
publicExponent: 3n
|
||||
});
|
||||
|
||||
assert.strictEqual(typeof privateKey, 'object');
|
||||
assert.strictEqual(privateKey.type, 'private');
|
||||
assert.strictEqual(privateKey.asymmetricKeyType, 'rsa');
|
||||
assert.deepStrictEqual(privateKey.asymmetricKeyDetails, {
|
||||
modulusLength: 512,
|
||||
publicExponent: 3n
|
||||
});
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const {
|
||||
generateKeyPair,
|
||||
} = require('crypto');
|
||||
|
||||
// RFC 8017, 9.1.: "Assuming that the mask generation function is based on a
|
||||
// hash function, it is RECOMMENDED that the hash function be the same as the
|
||||
// one that is applied to the message."
|
||||
{
|
||||
|
||||
generateKeyPair('rsa-pss', {
|
||||
modulusLength: 512,
|
||||
hashAlgorithm: 'sha256',
|
||||
saltLength: 16
|
||||
}, common.mustSucceed((publicKey, privateKey) => {
|
||||
const expectedKeyDetails = {
|
||||
modulusLength: 512,
|
||||
publicExponent: 65537n,
|
||||
hashAlgorithm: 'sha256',
|
||||
mgf1HashAlgorithm: 'sha256',
|
||||
saltLength: 16
|
||||
};
|
||||
assert.deepStrictEqual(publicKey.asymmetricKeyDetails, expectedKeyDetails);
|
||||
assert.deepStrictEqual(privateKey.asymmetricKeyDetails, expectedKeyDetails);
|
||||
}));
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const {
|
||||
generateKeyPair,
|
||||
} = require('crypto');
|
||||
|
||||
// RFC 8017, A.2.3.: "For a given hashAlgorithm, the default value of
|
||||
// saltLength is the octet length of the hash value."
|
||||
{
|
||||
generateKeyPair('rsa-pss', {
|
||||
modulusLength: 512,
|
||||
hashAlgorithm: 'sha512'
|
||||
}, common.mustSucceed((publicKey, privateKey) => {
|
||||
const expectedKeyDetails = {
|
||||
modulusLength: 512,
|
||||
publicExponent: 65537n,
|
||||
hashAlgorithm: 'sha512',
|
||||
mgf1HashAlgorithm: 'sha512',
|
||||
saltLength: 64
|
||||
};
|
||||
assert.deepStrictEqual(publicKey.asymmetricKeyDetails, expectedKeyDetails);
|
||||
assert.deepStrictEqual(privateKey.asymmetricKeyDetails, expectedKeyDetails);
|
||||
}));
|
||||
|
||||
// It is still possible to explicitly set saltLength to 0.
|
||||
generateKeyPair('rsa-pss', {
|
||||
modulusLength: 512,
|
||||
hashAlgorithm: 'sha512',
|
||||
saltLength: 0
|
||||
}, common.mustSucceed((publicKey, privateKey) => {
|
||||
const expectedKeyDetails = {
|
||||
modulusLength: 512,
|
||||
publicExponent: 65537n,
|
||||
hashAlgorithm: 'sha512',
|
||||
mgf1HashAlgorithm: 'sha512',
|
||||
saltLength: 0
|
||||
};
|
||||
assert.deepStrictEqual(publicKey.asymmetricKeyDetails, expectedKeyDetails);
|
||||
assert.deepStrictEqual(privateKey.asymmetricKeyDetails, expectedKeyDetails);
|
||||
}));
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
const Stream = require('stream');
|
||||
|
||||
const hasher1 = crypto.createHash('sha256');
|
||||
const hasher2 = crypto.createHash('sha256');
|
||||
|
||||
// Calculate the expected result.
|
||||
hasher1.write(Buffer.from('hello world'));
|
||||
hasher1.end();
|
||||
|
||||
const expected = hasher1.read().toString('hex');
|
||||
|
||||
class OldStream extends Stream {
|
||||
constructor() {
|
||||
super();
|
||||
this.readable = true;
|
||||
}
|
||||
}
|
||||
|
||||
const stream = new OldStream();
|
||||
|
||||
stream.pipe(hasher2).on('finish', common.mustCall(function() {
|
||||
const hash = hasher2.read().toString('hex');
|
||||
assert.strictEqual(hash, expected);
|
||||
}));
|
||||
|
||||
stream.emit('data', Buffer.from('hello'));
|
||||
stream.emit('data', Buffer.from(' world'));
|
||||
stream.emit('end');
|
45
tests/node_compat/test/parallel/test-crypto-no-algorithm.js
Normal file
45
tests/node_compat/test/parallel/test-crypto-no-algorithm.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
if (!common.hasOpenSSL3)
|
||||
common.skip('this test requires OpenSSL 3.x');
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const crypto = require('node:crypto');
|
||||
|
||||
if (common.isMainThread) {
|
||||
// TODO(richardlau): Decide if `crypto.setFips` should error if the
|
||||
// provider named "fips" is not available.
|
||||
crypto.setFips(1);
|
||||
crypto.randomBytes(20, common.mustCall((err) => {
|
||||
// crypto.randomBytes should either succeed or fail but not hang.
|
||||
if (err) {
|
||||
assert.match(err.message, /digital envelope routines::unsupported/);
|
||||
const expected = /random number generator::unable to fetch drbg/;
|
||||
assert(err.opensslErrorStack.some((msg) => expected.test(msg)),
|
||||
`did not find ${expected} in ${err.opensslErrorStack}`);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
{
|
||||
// Startup test. Should not hang.
|
||||
const { path } = require('../common/fixtures');
|
||||
const { spawnSync } = require('node:child_process');
|
||||
const baseConf = path('openssl3-conf', 'base_only.cnf');
|
||||
const cp = spawnSync(process.execPath,
|
||||
[ `--openssl-config=${baseConf}`, '-p', '"hello"' ],
|
||||
{ encoding: 'utf8' });
|
||||
assert(common.nodeProcessAborted(cp.status, cp.signal),
|
||||
`process did not abort, code:${cp.status} signal:${cp.signal}`);
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto) { common.skip('missing crypto'); }
|
||||
const assert = require('assert');
|
||||
const { generateKeyPair } = require('crypto');
|
||||
|
||||
if (common.isWindows) {
|
||||
// Remove this conditional once the libuv change is in Node.js.
|
||||
common.skip('crashing due to https://github.com/libuv/libuv/pull/2983');
|
||||
}
|
||||
|
||||
// Regression test for a race condition: process.exit() might lead to OpenSSL
|
||||
// cleaning up state from the exit() call via calling its destructor, but
|
||||
// running OpenSSL operations on another thread might lead to them attempting
|
||||
// to initialize OpenSSL, leading to a crash.
|
||||
// This test crashed consistently on x64 Linux on Node v14.9.0.
|
||||
|
||||
generateKeyPair('rsa', {
|
||||
modulusLength: 2048,
|
||||
privateKeyEncoding: {
|
||||
type: 'pkcs1',
|
||||
format: 'pem'
|
||||
}
|
||||
}, (err/* , publicKey, privateKey */) => {
|
||||
assert.ifError(err);
|
||||
});
|
||||
|
||||
setTimeout(() => process.exit(), common.platformTimeout(10));
|
|
@ -0,0 +1,67 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const iv = Buffer.from('00000000000000000000000000000000', 'hex');
|
||||
const key = Buffer.from('0123456789abcdef0123456789abcdef' +
|
||||
'0123456789abcdef0123456789abcdef', 'hex');
|
||||
|
||||
function encrypt(val, pad) {
|
||||
const c = crypto.createCipheriv('aes256', key, iv);
|
||||
c.setAutoPadding(pad);
|
||||
return c.update(val, 'utf8', 'latin1') + c.final('latin1');
|
||||
}
|
||||
|
||||
function decrypt(val, pad) {
|
||||
const c = crypto.createDecipheriv('aes256', key, iv);
|
||||
c.setAutoPadding(pad);
|
||||
return c.update(val, 'latin1', 'utf8') + c.final('utf8');
|
||||
}
|
||||
|
||||
// echo 0123456789abcdef0123456789abcdef \
|
||||
// | openssl enc -e -aes256 -nopad -K <key> -iv <iv> \
|
||||
// | openssl enc -d -aes256 -nopad -K <key> -iv <iv>
|
||||
let plaintext = '0123456789abcdef0123456789abcdef'; // Multiple of block size
|
||||
let encrypted = encrypt(plaintext, false);
|
||||
let decrypted = decrypt(encrypted, false);
|
||||
assert.strictEqual(decrypted, plaintext);
|
||||
|
||||
// echo 0123456789abcdef0123456789abcde \
|
||||
// | openssl enc -e -aes256 -K <key> -iv <iv> \
|
||||
// | openssl enc -d -aes256 -K <key> -iv <iv>
|
||||
plaintext = '0123456789abcdef0123456789abcde'; // not a multiple
|
||||
encrypted = encrypt(plaintext, true);
|
||||
decrypted = decrypt(encrypted, true);
|
||||
assert.strictEqual(decrypted, plaintext);
|
|
@ -0,0 +1,107 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
const crypto = require('crypto');
|
||||
|
||||
// Tests for CVE-2022-21449
|
||||
// https://neilmadden.blog/2022/04/19/psychic-signatures-in-java/
|
||||
// Dubbed "Psychic Signatures", these signatures bypassed the ECDSA signature
|
||||
// verification implementation in Java in 15, 16, 17, and 18. OpenSSL is not
|
||||
// (and was not) vulnerable so these are a precaution.
|
||||
|
||||
const vectors = {
|
||||
'ieee-p1363': [
|
||||
Buffer.from('0000000000000000000000000000000000000000000000000000000000000000' +
|
||||
'0000000000000000000000000000000000000000000000000000000000000000', 'hex'),
|
||||
Buffer.from('ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551' +
|
||||
'ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551', 'hex'),
|
||||
],
|
||||
'der': [
|
||||
Buffer.from('3046022100' +
|
||||
'0000000000000000000000000000000000000000000000000000000000000000' +
|
||||
'022100' +
|
||||
'0000000000000000000000000000000000000000000000000000000000000000', 'hex'),
|
||||
Buffer.from('3046022100' +
|
||||
'ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551' +
|
||||
'022100' +
|
||||
'ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551', 'hex'),
|
||||
],
|
||||
};
|
||||
|
||||
const keyPair = crypto.generateKeyPairSync('ec', {
|
||||
namedCurve: 'P-256',
|
||||
publicKeyEncoding: {
|
||||
format: 'der',
|
||||
type: 'spki'
|
||||
},
|
||||
});
|
||||
|
||||
const data = Buffer.from('Hello!');
|
||||
|
||||
for (const [encoding, signatures] of Object.entries(vectors)) {
|
||||
for (const signature of signatures) {
|
||||
const key = {
|
||||
key: keyPair.publicKey,
|
||||
format: 'der',
|
||||
type: 'spki',
|
||||
dsaEncoding: encoding,
|
||||
};
|
||||
|
||||
// one-shot sync
|
||||
assert.strictEqual(
|
||||
crypto.verify(
|
||||
'sha256',
|
||||
data,
|
||||
key,
|
||||
signature,
|
||||
),
|
||||
false,
|
||||
);
|
||||
|
||||
// one-shot async
|
||||
crypto.verify(
|
||||
'sha256',
|
||||
data,
|
||||
key,
|
||||
signature,
|
||||
common.mustSucceed((verified) => assert.strictEqual(verified, false)),
|
||||
);
|
||||
|
||||
// stream
|
||||
assert.strictEqual(
|
||||
crypto.createVerify('sha256')
|
||||
.update(data)
|
||||
.verify(key, signature),
|
||||
false,
|
||||
);
|
||||
|
||||
// webcrypto
|
||||
globalThis.crypto.subtle.importKey(
|
||||
'spki',
|
||||
keyPair.publicKey,
|
||||
{ name: 'ECDSA', namedCurve: 'P-256' },
|
||||
false,
|
||||
['verify'],
|
||||
).then((publicKey) => {
|
||||
return globalThis.crypto.subtle.verify(
|
||||
{ name: 'ECDSA', hash: 'SHA-256' },
|
||||
publicKey,
|
||||
signature,
|
||||
data,
|
||||
);
|
||||
}).then(common.mustCall((verified) => {
|
||||
assert.strictEqual(verified, false);
|
||||
}));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
|
||||
// Test for https://github.com/nodejs/node/issues/40814
|
||||
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
if (!common.hasOpenSSL3)
|
||||
common.skip('only openssl3'); // https://github.com/nodejs/node/pull/42793#issuecomment-1107491901
|
||||
|
||||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', {
|
||||
modulusLength: 2048,
|
||||
publicKeyEncoding: {
|
||||
type: 'spki',
|
||||
format: 'pem'
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
type: 'pkcs8',
|
||||
format: 'pem',
|
||||
cipher: 'aes-128-ecb',
|
||||
passphrase: 'abcdef'
|
||||
}
|
||||
});
|
||||
assert.notStrictEqual(privateKey.toString(), '');
|
||||
|
||||
const msg = 'The quick brown fox jumps over the lazy dog';
|
||||
|
||||
const encryptedString = crypto.privateEncrypt({
|
||||
key: privateKey,
|
||||
passphrase: 'abcdef'
|
||||
}, Buffer.from(msg)).toString('base64');
|
||||
const decryptedString = crypto.publicDecrypt(publicKey, Buffer.from(encryptedString, 'base64')).toString();
|
||||
console.log(`Encrypted: ${encryptedString}`);
|
||||
console.log(`Decrypted: ${decryptedString}`);
|
||||
|
||||
assert.notStrictEqual(encryptedString, '');
|
||||
assert.strictEqual(decryptedString, msg);
|
|
@ -0,0 +1,25 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const { randomFillSync } = require('crypto');
|
||||
const { notStrictEqual } = require('assert');
|
||||
|
||||
const ab = new ArrayBuffer(20);
|
||||
const buf = Buffer.from(ab, 10);
|
||||
|
||||
const before = buf.toString('hex');
|
||||
|
||||
randomFillSync(buf);
|
||||
|
||||
const after = buf.toString('hex');
|
||||
|
||||
notStrictEqual(before, after);
|
266
tests/node_compat/test/parallel/test-crypto-scrypt.js
Normal file
266
tests/node_compat/test/parallel/test-crypto-scrypt.js
Normal file
|
@ -0,0 +1,266 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Flags: --expose-internals
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
if (typeof internalBinding('crypto').ScryptJob !== 'function')
|
||||
common.skip('no scrypt support');
|
||||
|
||||
const good = [
|
||||
// Zero-length key is legal, functions as a parameter validation check.
|
||||
{
|
||||
pass: '',
|
||||
salt: '',
|
||||
keylen: 0,
|
||||
N: 16,
|
||||
p: 1,
|
||||
r: 1,
|
||||
expected: '',
|
||||
},
|
||||
// Test vectors from https://tools.ietf.org/html/rfc7914#page-13 that
|
||||
// should pass. Note that the test vector with N=1048576 is omitted
|
||||
// because it takes too long to complete and uses over 1 GiB of memory.
|
||||
{
|
||||
pass: '',
|
||||
salt: '',
|
||||
keylen: 64,
|
||||
N: 16,
|
||||
p: 1,
|
||||
r: 1,
|
||||
expected:
|
||||
'77d6576238657b203b19ca42c18a0497f16b4844e3074ae8dfdffa3fede21442' +
|
||||
'fcd0069ded0948f8326a753a0fc81f17e8d3e0fb2e0d3628cf35e20c38d18906',
|
||||
},
|
||||
{
|
||||
pass: 'password',
|
||||
salt: 'NaCl',
|
||||
keylen: 64,
|
||||
N: 1024,
|
||||
p: 16,
|
||||
r: 8,
|
||||
expected:
|
||||
'fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b373162' +
|
||||
'2eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640',
|
||||
},
|
||||
{
|
||||
pass: 'pleaseletmein',
|
||||
salt: 'SodiumChloride',
|
||||
keylen: 64,
|
||||
N: 16384,
|
||||
p: 1,
|
||||
r: 8,
|
||||
expected:
|
||||
'7023bdcb3afd7348461c06cd81fd38ebfda8fbba904f8e3ea9b543f6545da1f2' +
|
||||
'd5432955613f0fcf62d49705242a9af9e61e85dc0d651e40dfcf017b45575887',
|
||||
},
|
||||
{
|
||||
pass: '',
|
||||
salt: '',
|
||||
keylen: 64,
|
||||
cost: 16,
|
||||
parallelization: 1,
|
||||
blockSize: 1,
|
||||
expected:
|
||||
'77d6576238657b203b19ca42c18a0497f16b4844e3074ae8dfdffa3fede21442' +
|
||||
'fcd0069ded0948f8326a753a0fc81f17e8d3e0fb2e0d3628cf35e20c38d18906',
|
||||
},
|
||||
{
|
||||
pass: 'password',
|
||||
salt: 'NaCl',
|
||||
keylen: 64,
|
||||
cost: 1024,
|
||||
parallelization: 16,
|
||||
blockSize: 8,
|
||||
expected:
|
||||
'fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b373162' +
|
||||
'2eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640',
|
||||
},
|
||||
{
|
||||
pass: 'pleaseletmein',
|
||||
salt: 'SodiumChloride',
|
||||
keylen: 64,
|
||||
cost: 16384,
|
||||
parallelization: 1,
|
||||
blockSize: 8,
|
||||
expected:
|
||||
'7023bdcb3afd7348461c06cd81fd38ebfda8fbba904f8e3ea9b543f6545da1f2' +
|
||||
'd5432955613f0fcf62d49705242a9af9e61e85dc0d651e40dfcf017b45575887',
|
||||
},
|
||||
];
|
||||
|
||||
// Test vectors that should fail.
|
||||
const bad = [
|
||||
{ N: 1, p: 1, r: 1 }, // N < 2
|
||||
{ N: 3, p: 1, r: 1 }, // Not power of 2.
|
||||
{ N: 1, cost: 1 }, // Both N and cost
|
||||
{ p: 1, parallelization: 1 }, // Both p and parallelization
|
||||
{ r: 1, blockSize: 1 }, // Both r and blocksize
|
||||
];
|
||||
|
||||
// Test vectors where 128*N*r exceeds maxmem.
|
||||
const toobig = [
|
||||
{ N: 2 ** 16, p: 1, r: 1 }, // N >= 2**(r*16)
|
||||
{ N: 2, p: 2 ** 30, r: 1 }, // p > (2**30-1)/r
|
||||
{ N: 2 ** 20, p: 1, r: 8 },
|
||||
{ N: 2 ** 10, p: 1, r: 8, maxmem: 2 ** 20 },
|
||||
];
|
||||
|
||||
const badargs = [
|
||||
{
|
||||
args: [],
|
||||
expected: { code: 'ERR_INVALID_ARG_TYPE', message: /"password"/ },
|
||||
},
|
||||
{
|
||||
args: [null],
|
||||
expected: { code: 'ERR_INVALID_ARG_TYPE', message: /"password"/ },
|
||||
},
|
||||
{
|
||||
args: [''],
|
||||
expected: { code: 'ERR_INVALID_ARG_TYPE', message: /"salt"/ },
|
||||
},
|
||||
{
|
||||
args: ['', null],
|
||||
expected: { code: 'ERR_INVALID_ARG_TYPE', message: /"salt"/ },
|
||||
},
|
||||
{
|
||||
args: ['', ''],
|
||||
expected: { code: 'ERR_INVALID_ARG_TYPE', message: /"keylen"/ },
|
||||
},
|
||||
{
|
||||
args: ['', '', null],
|
||||
expected: { code: 'ERR_INVALID_ARG_TYPE', message: /"keylen"/ },
|
||||
},
|
||||
{
|
||||
args: ['', '', .42],
|
||||
expected: { code: 'ERR_OUT_OF_RANGE', message: /"keylen"/ },
|
||||
},
|
||||
{
|
||||
args: ['', '', -42],
|
||||
expected: { code: 'ERR_OUT_OF_RANGE', message: /"keylen"/ },
|
||||
},
|
||||
{
|
||||
args: ['', '', 2 ** 31],
|
||||
expected: { code: 'ERR_OUT_OF_RANGE', message: /"keylen"/ },
|
||||
},
|
||||
{
|
||||
args: ['', '', 2147485780],
|
||||
expected: { code: 'ERR_OUT_OF_RANGE', message: /"keylen"/ },
|
||||
},
|
||||
{
|
||||
args: ['', '', 2 ** 32],
|
||||
expected: { code: 'ERR_OUT_OF_RANGE', message: /"keylen"/ },
|
||||
},
|
||||
];
|
||||
|
||||
for (const options of good) {
|
||||
const { pass, salt, keylen, expected } = options;
|
||||
const actual = crypto.scryptSync(pass, salt, keylen, options);
|
||||
assert.strictEqual(actual.toString('hex'), expected);
|
||||
crypto.scrypt(pass, salt, keylen, options, common.mustSucceed((actual) => {
|
||||
assert.strictEqual(actual.toString('hex'), expected);
|
||||
}));
|
||||
}
|
||||
|
||||
for (const options of bad) {
|
||||
const expected = {
|
||||
message: /Invalid scrypt param/,
|
||||
};
|
||||
assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}),
|
||||
expected);
|
||||
assert.throws(() => crypto.scryptSync('pass', 'salt', 1, options),
|
||||
expected);
|
||||
}
|
||||
|
||||
for (const options of toobig) {
|
||||
const expected = {
|
||||
message: /Invalid scrypt param/
|
||||
};
|
||||
assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}),
|
||||
expected);
|
||||
assert.throws(() => crypto.scryptSync('pass', 'salt', 1, options),
|
||||
expected);
|
||||
}
|
||||
|
||||
{
|
||||
const defaults = { N: 16384, p: 1, r: 8 };
|
||||
const expected = crypto.scryptSync('pass', 'salt', 1, defaults);
|
||||
const actual = crypto.scryptSync('pass', 'salt', 1);
|
||||
assert.deepStrictEqual(actual.toString('hex'), expected.toString('hex'));
|
||||
crypto.scrypt('pass', 'salt', 1, common.mustSucceed((actual) => {
|
||||
assert.deepStrictEqual(actual.toString('hex'), expected.toString('hex'));
|
||||
}));
|
||||
}
|
||||
|
||||
for (const { args, expected } of badargs) {
|
||||
assert.throws(() => crypto.scrypt(...args), expected);
|
||||
assert.throws(() => crypto.scryptSync(...args), expected);
|
||||
}
|
||||
|
||||
{
|
||||
const expected = { code: 'ERR_INVALID_ARG_TYPE' };
|
||||
assert.throws(() => crypto.scrypt('', '', 42, null), expected);
|
||||
assert.throws(() => crypto.scrypt('', '', 42, {}, null), expected);
|
||||
assert.throws(() => crypto.scrypt('', '', 42, {}), expected);
|
||||
assert.throws(() => crypto.scrypt('', '', 42, {}, {}), expected);
|
||||
}
|
||||
|
||||
{
|
||||
// Values for maxmem that do not fit in 32 bits but that are still safe
|
||||
// integers should be allowed.
|
||||
crypto.scrypt('', '', 4, { maxmem: 2 ** 52 },
|
||||
common.mustSucceed((actual) => {
|
||||
assert.strictEqual(actual.toString('hex'), 'd72c87d0');
|
||||
}));
|
||||
|
||||
// Values that exceed Number.isSafeInteger should not be allowed.
|
||||
assert.throws(() => crypto.scryptSync('', '', 0, { maxmem: 2 ** 53 }), {
|
||||
code: 'ERR_OUT_OF_RANGE'
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
// Regression test for https://github.com/nodejs/node/issues/28836.
|
||||
|
||||
function testParameter(name, value) {
|
||||
let accessCount = 0;
|
||||
|
||||
// Find out how often the value is accessed.
|
||||
crypto.scryptSync('', '', 1, {
|
||||
get [name]() {
|
||||
accessCount++;
|
||||
return value;
|
||||
}
|
||||
});
|
||||
|
||||
// Try to crash the process on the last access.
|
||||
assert.throws(() => {
|
||||
crypto.scryptSync('', '', 1, {
|
||||
get [name]() {
|
||||
if (--accessCount === 0)
|
||||
return '';
|
||||
return value;
|
||||
}
|
||||
});
|
||||
}, {
|
||||
code: 'ERR_INVALID_ARG_TYPE'
|
||||
});
|
||||
}
|
||||
|
||||
[
|
||||
['N', 16384], ['cost', 16384],
|
||||
['r', 8], ['blockSize', 8],
|
||||
['p', 1], ['parallelization', 1],
|
||||
].forEach((arg) => testParameter(...arg));
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const { subtle } = globalThis.crypto;
|
||||
|
||||
(async () => {
|
||||
const k = await subtle.importKey(
|
||||
'raw',
|
||||
new Uint8Array(32),
|
||||
{ name: 'AES-GCM' },
|
||||
false,
|
||||
[ 'encrypt', 'decrypt' ]);
|
||||
assert(k instanceof CryptoKey);
|
||||
|
||||
const e = await subtle.encrypt({
|
||||
name: 'AES-GCM',
|
||||
iv: new Uint8Array(12),
|
||||
}, k, new Uint8Array(0));
|
||||
assert(e instanceof ArrayBuffer);
|
||||
assert.deepStrictEqual(
|
||||
Buffer.from(e),
|
||||
Buffer.from([
|
||||
0x53, 0x0f, 0x8a, 0xfb, 0xc7, 0x45, 0x36, 0xb9,
|
||||
0xa9, 0x63, 0xb4, 0xf1, 0xc4, 0xcb, 0x73, 0x8b ]));
|
||||
|
||||
const v = await subtle.decrypt({
|
||||
name: 'AES-GCM',
|
||||
iv: new Uint8Array(12),
|
||||
}, k, e);
|
||||
assert(v instanceof ArrayBuffer);
|
||||
assert.strictEqual(v.byteLength, 0);
|
||||
})().then(common.mustCall()).catch((e) => {
|
||||
assert.ifError(e);
|
||||
});
|
88
tests/node_compat/test/parallel/test-dgram-address.js
Normal file
88
tests/node_compat/test/parallel/test-dgram-address.js
Normal file
|
@ -0,0 +1,88 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const dgram = require('dgram');
|
||||
|
||||
{
|
||||
// IPv4 Test
|
||||
const socket = dgram.createSocket('udp4');
|
||||
|
||||
socket.on('listening', common.mustCall(() => {
|
||||
const address = socket.address();
|
||||
|
||||
assert.strictEqual(address.address, common.localhostIPv4);
|
||||
assert.strictEqual(typeof address.port, 'number');
|
||||
assert.ok(isFinite(address.port));
|
||||
assert.ok(address.port > 0);
|
||||
assert.strictEqual(address.family, 'IPv4');
|
||||
socket.close();
|
||||
}));
|
||||
|
||||
socket.on('error', (err) => {
|
||||
socket.close();
|
||||
assert.fail(`Unexpected error on udp4 socket. ${err.toString()}`);
|
||||
});
|
||||
|
||||
socket.bind(0, common.localhostIPv4);
|
||||
}
|
||||
|
||||
if (common.hasIPv6) {
|
||||
// IPv6 Test
|
||||
const socket = dgram.createSocket('udp6');
|
||||
const localhost = '::1';
|
||||
|
||||
socket.on('listening', common.mustCall(() => {
|
||||
const address = socket.address();
|
||||
|
||||
assert.strictEqual(address.address, localhost);
|
||||
assert.strictEqual(typeof address.port, 'number');
|
||||
assert.ok(isFinite(address.port));
|
||||
assert.ok(address.port > 0);
|
||||
assert.strictEqual(address.family, 'IPv6');
|
||||
socket.close();
|
||||
}));
|
||||
|
||||
socket.on('error', (err) => {
|
||||
socket.close();
|
||||
assert.fail(`Unexpected error on udp6 socket. ${err.toString()}`);
|
||||
});
|
||||
|
||||
socket.bind(0, localhost);
|
||||
}
|
||||
|
||||
{
|
||||
// Verify that address() throws if the socket is not bound.
|
||||
const socket = dgram.createSocket('udp4');
|
||||
|
||||
assert.throws(() => {
|
||||
socket.address();
|
||||
}, /^Error: getsockname EBADF$/);
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
// Skip test in FreeBSD jails since 0.0.0.0 will resolve to default interface
|
||||
if (common.inFreeBSDJail)
|
||||
common.skip('In a FreeBSD jail');
|
||||
|
||||
const assert = require('assert');
|
||||
const dgram = require('dgram');
|
||||
|
||||
dgram.createSocket('udp4').bind(0, common.mustCall(function() {
|
||||
assert.strictEqual(typeof this.address().port, 'number');
|
||||
assert.ok(isFinite(this.address().port));
|
||||
assert.ok(this.address().port > 0);
|
||||
assert.strictEqual(this.address().address, '0.0.0.0');
|
||||
this.close();
|
||||
}));
|
||||
|
||||
if (!common.hasIPv6) {
|
||||
common.printSkipMessage('udp6 part of test, because no IPv6 support');
|
||||
return;
|
||||
}
|
||||
|
||||
dgram.createSocket('udp6').bind(0, common.mustCall(function() {
|
||||
assert.strictEqual(typeof this.address().port, 'number');
|
||||
assert.ok(isFinite(this.address().port));
|
||||
assert.ok(this.address().port > 0);
|
||||
let address = this.address().address;
|
||||
if (address === '::ffff:0.0.0.0')
|
||||
address = '::';
|
||||
assert.strictEqual(address, '::');
|
||||
this.close();
|
||||
}));
|
|
@ -0,0 +1,34 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const dgram = require('dgram');
|
||||
|
||||
// Regression test for https://github.com/nodejs/node/issues/30209
|
||||
// No warning should be emitted when re-trying `.bind()` on UDP sockets
|
||||
// repeatedly.
|
||||
|
||||
process.on('warning', common.mustNotCall());
|
||||
|
||||
const reservePortSocket = dgram.createSocket('udp4');
|
||||
reservePortSocket.bind(() => {
|
||||
const { port } = reservePortSocket.address();
|
||||
|
||||
const newSocket = dgram.createSocket('udp4');
|
||||
|
||||
let errors = 0;
|
||||
newSocket.on('error', common.mustCall(() => {
|
||||
if (++errors < 20) {
|
||||
newSocket.bind(port, common.mustNotCall());
|
||||
} else {
|
||||
newSocket.close();
|
||||
reservePortSocket.close();
|
||||
}
|
||||
}, 20));
|
||||
newSocket.bind(port, common.mustNotCall());
|
||||
});
|
50
tests/node_compat/test/parallel/test-dgram-bind.js
Normal file
50
tests/node_compat/test/parallel/test-dgram-bind.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const dgram = require('dgram');
|
||||
|
||||
const socket = dgram.createSocket('udp4');
|
||||
|
||||
socket.on('listening', common.mustCall(() => {
|
||||
assert.throws(() => {
|
||||
socket.bind();
|
||||
}, {
|
||||
code: 'ERR_SOCKET_ALREADY_BOUND',
|
||||
name: 'Error',
|
||||
message: /^Socket is already bound$/
|
||||
});
|
||||
|
||||
socket.close();
|
||||
}));
|
||||
|
||||
const result = socket.bind(); // Should not throw.
|
||||
|
||||
assert.strictEqual(result, socket); // Should have returned itself.
|
46
tests/node_compat/test/parallel/test-dgram-bytes-length.js
Normal file
46
tests/node_compat/test/parallel/test-dgram-bytes-length.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const dgram = require('dgram');
|
||||
|
||||
const message = Buffer.from('Some bytes');
|
||||
const client = dgram.createSocket('udp4');
|
||||
client.send(
|
||||
message,
|
||||
0,
|
||||
message.length,
|
||||
41234,
|
||||
'localhost',
|
||||
function(err, bytes) {
|
||||
assert.strictEqual(bytes, message.length);
|
||||
client.close();
|
||||
}
|
||||
);
|
|
@ -0,0 +1,33 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
// Ensure that if a dgram socket is closed before the sendQueue is drained
|
||||
// will not crash
|
||||
|
||||
const common = require('../common');
|
||||
const dgram = require('dgram');
|
||||
|
||||
const buf = Buffer.alloc(1024, 42);
|
||||
|
||||
const socket = dgram.createSocket('udp4');
|
||||
|
||||
socket.on('listening', function() {
|
||||
socket.close();
|
||||
});
|
||||
|
||||
// Get a random port for send
|
||||
const portGetter = dgram.createSocket('udp4')
|
||||
.bind(0, 'localhost', common.mustCall(() => {
|
||||
// Adds a listener to 'listening' to send the data when
|
||||
// the socket is available
|
||||
socket.send(buf, 0, buf.length,
|
||||
portGetter.address().port,
|
||||
portGetter.address().address);
|
||||
|
||||
portGetter.close();
|
||||
}));
|
|
@ -0,0 +1,28 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const dgram = require('dgram');
|
||||
|
||||
const buf = Buffer.alloc(1024, 42);
|
||||
|
||||
const socket = dgram.createSocket('udp4');
|
||||
|
||||
// Get a random port for send
|
||||
const portGetter = dgram.createSocket('udp4')
|
||||
.bind(0, 'localhost', common.mustCall(() => {
|
||||
socket.send(buf, 0, buf.length,
|
||||
portGetter.address().port,
|
||||
portGetter.address().address);
|
||||
|
||||
// If close callback is not function, ignore the argument.
|
||||
socket.close('bad argument');
|
||||
portGetter.close();
|
||||
|
||||
socket.on('close', common.mustCall());
|
||||
}));
|
63
tests/node_compat/test/parallel/test-dgram-close.js
Normal file
63
tests/node_compat/test/parallel/test-dgram-close.js
Normal file
|
@ -0,0 +1,63 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// Flags: --expose-internals
|
||||
'use strict';
|
||||
// Ensure that if a dgram socket is closed before the DNS lookup completes, it
|
||||
// won't crash.
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const dgram = require('dgram');
|
||||
const { kStateSymbol } = require('internal/dgram');
|
||||
|
||||
const buf = Buffer.alloc(1024, 42);
|
||||
|
||||
let socket = dgram.createSocket('udp4');
|
||||
const { handle } = socket[kStateSymbol];
|
||||
|
||||
// Get a random port for send
|
||||
const portGetter = dgram.createSocket('udp4')
|
||||
.bind(0, 'localhost', common.mustCall(() => {
|
||||
socket.send(buf, 0, buf.length,
|
||||
portGetter.address().port,
|
||||
portGetter.address().address);
|
||||
|
||||
assert.strictEqual(socket.close(common.mustCall()), socket);
|
||||
socket.on('close', common.mustCall());
|
||||
socket = null;
|
||||
|
||||
// Verify that accessing handle after closure doesn't throw
|
||||
setImmediate(function() {
|
||||
setImmediate(function() {
|
||||
console.log('Handle fd is: ', handle.fd);
|
||||
});
|
||||
});
|
||||
|
||||
portGetter.close();
|
||||
}));
|
|
@ -0,0 +1,30 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
const dgram = require('dgram');
|
||||
const client = dgram.createSocket('udp4');
|
||||
|
||||
const buf = Buffer.allocUnsafe(256);
|
||||
const offset = 20;
|
||||
const len = buf.length - offset;
|
||||
|
||||
const messageSent = common.mustSucceed(function messageSent(bytes) {
|
||||
assert.notStrictEqual(bytes, buf.length);
|
||||
assert.strictEqual(bytes, buf.length - offset);
|
||||
client.close();
|
||||
});
|
||||
|
||||
client.bind(0, common.mustCall(() => {
|
||||
client.connect(client.address().port, common.mustCall(() => {
|
||||
client.send(buf, offset, len, messageSent);
|
||||
}));
|
||||
}));
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue