diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts
index d18ec6e1a8..98272abe4e 100755
--- a/.github/workflows/ci.generate.ts
+++ b/.github/workflows/ci.generate.ts
@@ -5,7 +5,7 @@ import { stringify } from "jsr:@std/yaml@^0.221/stringify";
// Bump this number when you want to purge the cache.
// Note: the tools/release/01_bump_crate_versions.ts script will update this version
// automatically via regex, so ensure that this line maintains this format.
-const cacheVersion = 20;
+const cacheVersion = 21;
const ubuntuX86Runner = "ubuntu-22.04";
const ubuntuX86XlRunner = "ubuntu-22.04-xl";
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1353bf4a6f..161b8719c8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -361,8 +361,8 @@ jobs:
path: |-
~/.cargo/registry/index
~/.cargo/registry/cache
- key: '20-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}'
- restore-keys: '20-cargo-home-${{ matrix.os }}-${{ matrix.arch }}'
+ key: '21-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}'
+ restore-keys: '21-cargo-home-${{ matrix.os }}-${{ matrix.arch }}'
if: '!(matrix.skip)'
- name: Restore cache build output (PR)
uses: actions/cache/restore@v4
@@ -375,7 +375,7 @@ jobs:
!./target/*/*.zip
!./target/*/*.tar.gz
key: never_saved
- restore-keys: '20-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-'
+ restore-keys: '21-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-'
- name: Apply and update mtime cache
if: '!(matrix.skip) && (!startsWith(github.ref, ''refs/tags/''))'
uses: ./.github/mtime_cache
@@ -685,7 +685,7 @@ jobs:
!./target/*/*.zip
!./target/*/*.sha256sum
!./target/*/*.tar.gz
- key: '20-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}'
+ key: '21-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}'
publish-canary:
name: publish canary
runs-on: ubuntu-22.04
diff --git a/Cargo.lock b/Cargo.lock
index c8807b65d5..bcbbaaae03 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1154,7 +1154,7 @@ dependencies = [
[[package]]
name = "deno"
-version = "2.0.1"
+version = "2.0.2"
dependencies = [
"anstream",
"async-trait",
@@ -1328,7 +1328,7 @@ dependencies = [
[[package]]
name = "deno_bench_util"
-version = "0.166.0"
+version = "0.167.0"
dependencies = [
"bencher",
"deno_core",
@@ -1337,7 +1337,7 @@ dependencies = [
[[package]]
name = "deno_broadcast_channel"
-version = "0.166.0"
+version = "0.167.0"
dependencies = [
"async-trait",
"deno_core",
@@ -1348,7 +1348,7 @@ dependencies = [
[[package]]
name = "deno_cache"
-version = "0.104.0"
+version = "0.105.0"
dependencies = [
"async-trait",
"deno_core",
@@ -1381,7 +1381,7 @@ dependencies = [
[[package]]
name = "deno_canvas"
-version = "0.41.0"
+version = "0.42.0"
dependencies = [
"deno_core",
"deno_webgpu",
@@ -1416,16 +1416,16 @@ dependencies = [
[[package]]
name = "deno_console"
-version = "0.172.0"
+version = "0.173.0"
dependencies = [
"deno_core",
]
[[package]]
name = "deno_core"
-version = "0.313.0"
+version = "0.314.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29f36be738d78e39b6603a6b07f1cf91e28baf3681f87205f07482999e0d0bc2"
+checksum = "1fcd11ab87426c611b7170138a768dad7170c8fb66d8095b773d25e58fd254ea"
dependencies = [
"anyhow",
"bincode",
@@ -1461,7 +1461,7 @@ checksum = "a13951ea98c0a4c372f162d669193b4c9d991512de9f2381dd161027f34b26b1"
[[package]]
name = "deno_cron"
-version = "0.52.0"
+version = "0.53.0"
dependencies = [
"anyhow",
"async-trait",
@@ -1474,7 +1474,7 @@ dependencies = [
[[package]]
name = "deno_crypto"
-version = "0.186.0"
+version = "0.187.0"
dependencies = [
"aes",
"aes-gcm",
@@ -1534,7 +1534,7 @@ dependencies = [
[[package]]
name = "deno_fetch"
-version = "0.196.0"
+version = "0.197.0"
dependencies = [
"base64 0.21.7",
"bytes",
@@ -1566,7 +1566,7 @@ dependencies = [
[[package]]
name = "deno_ffi"
-version = "0.159.0"
+version = "0.160.0"
dependencies = [
"deno_core",
"deno_permissions",
@@ -1585,7 +1585,7 @@ dependencies = [
[[package]]
name = "deno_fs"
-version = "0.82.0"
+version = "0.83.0"
dependencies = [
"async-trait",
"base32",
@@ -1635,7 +1635,7 @@ dependencies = [
[[package]]
name = "deno_http"
-version = "0.170.0"
+version = "0.171.0"
dependencies = [
"async-compression",
"async-trait",
@@ -1674,7 +1674,7 @@ dependencies = [
[[package]]
name = "deno_io"
-version = "0.82.0"
+version = "0.83.0"
dependencies = [
"async-trait",
"deno_core",
@@ -1695,7 +1695,7 @@ dependencies = [
[[package]]
name = "deno_kv"
-version = "0.80.0"
+version = "0.81.0"
dependencies = [
"anyhow",
"async-trait",
@@ -1720,6 +1720,7 @@ dependencies = [
"rand",
"rusqlite",
"serde",
+ "thiserror",
"url",
]
@@ -1766,11 +1767,12 @@ dependencies = [
[[package]]
name = "deno_napi"
-version = "0.103.0"
+version = "0.104.0"
dependencies = [
"deno_core",
"deno_permissions",
"libloading 0.7.4",
+ "thiserror",
]
[[package]]
@@ -1788,7 +1790,7 @@ dependencies = [
[[package]]
name = "deno_net"
-version = "0.164.0"
+version = "0.165.0"
dependencies = [
"deno_core",
"deno_permissions",
@@ -1797,6 +1799,7 @@ dependencies = [
"rustls-tokio-stream",
"serde",
"socket2",
+ "thiserror",
"tokio",
"trust-dns-proto",
"trust-dns-resolver",
@@ -1804,7 +1807,7 @@ dependencies = [
[[package]]
name = "deno_node"
-version = "0.109.0"
+version = "0.110.0"
dependencies = [
"aead-gcm-stream",
"aes",
@@ -1913,9 +1916,9 @@ dependencies = [
[[package]]
name = "deno_ops"
-version = "0.189.0"
+version = "0.190.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8f998ad1d5b36064109367ffe67b1088385eb3d8025efc95e445bc013a147a2"
+checksum = "a48a3e06cace18a2c49e148da067678c6af80e70757a8c3991301397cf6b9919"
dependencies = [
"proc-macro-rules",
"proc-macro2",
@@ -1953,7 +1956,7 @@ dependencies = [
[[package]]
name = "deno_permissions"
-version = "0.32.0"
+version = "0.33.0"
dependencies = [
"deno_core",
"deno_path_util",
@@ -1970,7 +1973,7 @@ dependencies = [
[[package]]
name = "deno_resolver"
-version = "0.4.0"
+version = "0.5.0"
dependencies = [
"anyhow",
"base32",
@@ -1986,7 +1989,7 @@ dependencies = [
[[package]]
name = "deno_runtime"
-version = "0.181.0"
+version = "0.182.0"
dependencies = [
"color-print",
"deno_ast",
@@ -2102,7 +2105,7 @@ dependencies = [
[[package]]
name = "deno_tls"
-version = "0.159.0"
+version = "0.160.0"
dependencies = [
"deno_core",
"deno_native_certs",
@@ -2151,7 +2154,7 @@ dependencies = [
[[package]]
name = "deno_url"
-version = "0.172.0"
+version = "0.173.0"
dependencies = [
"deno_bench_util",
"deno_console",
@@ -2163,7 +2166,7 @@ dependencies = [
[[package]]
name = "deno_web"
-version = "0.203.0"
+version = "0.204.0"
dependencies = [
"async-trait",
"base64-simd 0.8.0",
@@ -2178,13 +2181,14 @@ dependencies = [
"flate2",
"futures",
"serde",
+ "thiserror",
"tokio",
"uuid",
]
[[package]]
name = "deno_webgpu"
-version = "0.139.0"
+version = "0.140.0"
dependencies = [
"deno_core",
"raw-window-handle",
@@ -2196,7 +2200,7 @@ dependencies = [
[[package]]
name = "deno_webidl"
-version = "0.172.0"
+version = "0.173.0"
dependencies = [
"deno_bench_util",
"deno_core",
@@ -2204,7 +2208,7 @@ dependencies = [
[[package]]
name = "deno_websocket"
-version = "0.177.0"
+version = "0.178.0"
dependencies = [
"bytes",
"deno_core",
@@ -2225,7 +2229,7 @@ dependencies = [
[[package]]
name = "deno_webstorage"
-version = "0.167.0"
+version = "0.168.0"
dependencies = [
"deno_core",
"deno_web",
@@ -4511,7 +4515,7 @@ dependencies = [
[[package]]
name = "napi_sym"
-version = "0.102.0"
+version = "0.103.0"
dependencies = [
"quote",
"serde",
@@ -4580,7 +4584,7 @@ dependencies = [
[[package]]
name = "node_resolver"
-version = "0.11.0"
+version = "0.12.0"
dependencies = [
"anyhow",
"async-trait",
@@ -6211,9 +6215,9 @@ dependencies = [
[[package]]
name = "serde_v8"
-version = "0.222.0"
+version = "0.223.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "27130b5cd87f6f06228940a1f3a7ecc988ea13d1bede1398a48d74cb59dabc9a"
+checksum = "c127bb9f2024433d06789b242477c808fd7f7dc4c3278576dd5bc99c4e5c75ff"
dependencies = [
"num-bigint",
"serde",
diff --git a/Cargo.toml b/Cargo.toml
index e8919eade7..3bf5342b8e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -46,18 +46,18 @@ repository = "https://github.com/denoland/deno"
[workspace.dependencies]
deno_ast = { version = "=0.42.2", features = ["transpiling"] }
-deno_core = { version = "0.313.0" }
+deno_core = { version = "0.314.1" }
-deno_bench_util = { version = "0.166.0", path = "./bench_util" }
+deno_bench_util = { version = "0.167.0", path = "./bench_util" }
deno_lockfile = "=0.23.1"
deno_media_type = { version = "0.1.4", features = ["module_specifier"] }
deno_npm = "=0.25.4"
deno_path_util = "=0.2.1"
-deno_permissions = { version = "0.32.0", path = "./runtime/permissions" }
-deno_runtime = { version = "0.181.0", path = "./runtime" }
+deno_permissions = { version = "0.33.0", path = "./runtime/permissions" }
+deno_runtime = { version = "0.182.0", path = "./runtime" }
deno_semver = "=0.5.14"
deno_terminal = "0.2.0"
-napi_sym = { version = "0.102.0", path = "./cli/napi/sym" }
+napi_sym = { version = "0.103.0", path = "./cli/napi/sym" }
test_util = { package = "test_server", path = "./tests/util/server" }
denokv_proto = "0.8.1"
@@ -66,32 +66,32 @@ denokv_remote = "0.8.1"
denokv_sqlite = { default-features = false, version = "0.8.2" }
# exts
-deno_broadcast_channel = { version = "0.166.0", path = "./ext/broadcast_channel" }
-deno_cache = { version = "0.104.0", path = "./ext/cache" }
-deno_canvas = { version = "0.41.0", path = "./ext/canvas" }
-deno_console = { version = "0.172.0", path = "./ext/console" }
-deno_cron = { version = "0.52.0", path = "./ext/cron" }
-deno_crypto = { version = "0.186.0", path = "./ext/crypto" }
-deno_fetch = { version = "0.196.0", path = "./ext/fetch" }
-deno_ffi = { version = "0.159.0", path = "./ext/ffi" }
-deno_fs = { version = "0.82.0", path = "./ext/fs" }
-deno_http = { version = "0.170.0", path = "./ext/http" }
-deno_io = { version = "0.82.0", path = "./ext/io" }
-deno_kv = { version = "0.80.0", path = "./ext/kv" }
-deno_napi = { version = "0.103.0", path = "./ext/napi" }
-deno_net = { version = "0.164.0", path = "./ext/net" }
-deno_node = { version = "0.109.0", path = "./ext/node" }
-deno_tls = { version = "0.159.0", path = "./ext/tls" }
-deno_url = { version = "0.172.0", path = "./ext/url" }
-deno_web = { version = "0.203.0", path = "./ext/web" }
-deno_webgpu = { version = "0.139.0", path = "./ext/webgpu" }
-deno_webidl = { version = "0.172.0", path = "./ext/webidl" }
-deno_websocket = { version = "0.177.0", path = "./ext/websocket" }
-deno_webstorage = { version = "0.167.0", path = "./ext/webstorage" }
+deno_broadcast_channel = { version = "0.167.0", path = "./ext/broadcast_channel" }
+deno_cache = { version = "0.105.0", path = "./ext/cache" }
+deno_canvas = { version = "0.42.0", path = "./ext/canvas" }
+deno_console = { version = "0.173.0", path = "./ext/console" }
+deno_cron = { version = "0.53.0", path = "./ext/cron" }
+deno_crypto = { version = "0.187.0", path = "./ext/crypto" }
+deno_fetch = { version = "0.197.0", path = "./ext/fetch" }
+deno_ffi = { version = "0.160.0", path = "./ext/ffi" }
+deno_fs = { version = "0.83.0", path = "./ext/fs" }
+deno_http = { version = "0.171.0", path = "./ext/http" }
+deno_io = { version = "0.83.0", path = "./ext/io" }
+deno_kv = { version = "0.81.0", path = "./ext/kv" }
+deno_napi = { version = "0.104.0", path = "./ext/napi" }
+deno_net = { version = "0.165.0", path = "./ext/net" }
+deno_node = { version = "0.110.0", path = "./ext/node" }
+deno_tls = { version = "0.160.0", path = "./ext/tls" }
+deno_url = { version = "0.173.0", path = "./ext/url" }
+deno_web = { version = "0.204.0", path = "./ext/web" }
+deno_webgpu = { version = "0.140.0", path = "./ext/webgpu" }
+deno_webidl = { version = "0.173.0", path = "./ext/webidl" }
+deno_websocket = { version = "0.178.0", path = "./ext/websocket" }
+deno_webstorage = { version = "0.168.0", path = "./ext/webstorage" }
# resolvers
-deno_resolver = { version = "0.4.0", path = "./resolvers/deno" }
-node_resolver = { version = "0.11.0", path = "./resolvers/node" }
+deno_resolver = { version = "0.5.0", path = "./resolvers/deno" }
+node_resolver = { version = "0.12.0", path = "./resolvers/node" }
aes = "=0.8.3"
anyhow = "1.0.57"
diff --git a/Releases.md b/Releases.md
index 207e18e26d..08562134a1 100644
--- a/Releases.md
+++ b/Releases.md
@@ -6,6 +6,21 @@ https://github.com/denoland/deno/releases
We also have one-line install commands at:
https://github.com/denoland/deno_install
+### 2.0.2 / 2024.10.17
+
+- fix(cli): set napi object property properly (#26344)
+- fix(ext/node): add null check for kStreamBaseField (#26368)
+- fix(install): don't attempt to cache specifiers that point to directories
+ (#26369)
+- fix(jupyter): fix panics for overslow subtraction (#26371)
+- fix(jupyter): update to the new logo (#26353)
+- fix(net): don't try to set nodelay on upgrade streams (#26342)
+- fix(node/fs): copyFile with `COPYFILE_EXCL` should not throw if the
+ destination doesn't exist (#26360)
+- fix(node/http): normalize header names in `ServerResponse` (#26339)
+- fix(runtime): send ws ping frames from inspector server (#26352)
+- fix: don't warn on ignored signals on windows (#26332)
+
### 2.0.1 / 2024.10.16
- feat(lsp): "deno/didRefreshDenoConfigurationTree" notifications (#26215)
diff --git a/bench_util/Cargo.toml b/bench_util/Cargo.toml
index a233e42118..fbf30b9fcf 100644
--- a/bench_util/Cargo.toml
+++ b/bench_util/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_bench_util"
-version = "0.166.0"
+version = "0.167.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index 04546cc9f1..7d6fc71622 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno"
-version = "2.0.1"
+version = "2.0.2"
authors.workspace = true
default-run = "deno"
edition.workspace = true
diff --git a/cli/file_fetcher.rs b/cli/file_fetcher.rs
index 69daf14954..e92aca5420 100644
--- a/cli/file_fetcher.rs
+++ b/cli/file_fetcher.rs
@@ -333,7 +333,7 @@ impl FileFetcher {
)
})?;
- let bytes = blob.read_all().await?;
+ let bytes = blob.read_all().await;
let headers =
HashMap::from([("content-type".to_string(), blob.media_type.clone())]);
diff --git a/cli/napi/sym/Cargo.toml b/cli/napi/sym/Cargo.toml
index 287688e44f..7c9bf208c7 100644
--- a/cli/napi/sym/Cargo.toml
+++ b/cli/napi/sym/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "napi_sym"
-version = "0.102.0"
+version = "0.103.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/cli/tools/jupyter/resources/deno-logo-32x32.png b/cli/tools/jupyter/resources/deno-logo-32x32.png
index 97871a02ee..d59f251a24 100644
Binary files a/cli/tools/jupyter/resources/deno-logo-32x32.png and b/cli/tools/jupyter/resources/deno-logo-32x32.png differ
diff --git a/cli/tools/jupyter/resources/deno-logo-64x64.png b/cli/tools/jupyter/resources/deno-logo-64x64.png
index 1b9444ef63..37e98abafd 100644
Binary files a/cli/tools/jupyter/resources/deno-logo-64x64.png and b/cli/tools/jupyter/resources/deno-logo-64x64.png differ
diff --git a/cli/tools/jupyter/resources/deno-logo-svg.svg b/cli/tools/jupyter/resources/deno-logo-svg.svg
index d7bb9ef804..fbc22cd910 100644
--- a/cli/tools/jupyter/resources/deno-logo-svg.svg
+++ b/cli/tools/jupyter/resources/deno-logo-svg.svg
@@ -1 +1,17 @@
-
+
diff --git a/cli/tools/jupyter/server.rs b/cli/tools/jupyter/server.rs
index 0cd80f7ddd..5680ed4c13 100644
--- a/cli/tools/jupyter/server.rs
+++ b/cli/tools/jupyter/server.rs
@@ -329,7 +329,12 @@ impl JupyterServer {
})
.collect();
- (candidates, cursor_pos - prop_name.len())
+ if prop_name.len() > cursor_pos {
+ // TODO(bartlomieju): most likely not correct, but better than panicking because of sub with overflow
+ (candidates, cursor_pos)
+ } else {
+ (candidates, cursor_pos - prop_name.len())
+ }
} else {
// combine results of declarations and globalThis properties
let mut candidates = get_expression_property_names(
@@ -349,7 +354,12 @@ impl JupyterServer {
candidates.sort();
candidates.dedup(); // make sure to sort first
- (candidates, cursor_pos - expr.len())
+ if expr.len() > cursor_pos {
+ // TODO(bartlomieju): most likely not correct, but better than panicking because of sub with overflow
+ (candidates, cursor_pos)
+ } else {
+ (candidates, cursor_pos - expr.len())
+ }
};
connection
diff --git a/cli/tools/registry/pm/cache_deps.rs b/cli/tools/registry/pm/cache_deps.rs
index c8258e6009..b4cd1c2532 100644
--- a/cli/tools/registry/pm/cache_deps.rs
+++ b/cli/tools/registry/pm/cache_deps.rs
@@ -75,6 +75,13 @@ pub async fn cache_top_level_deps(
if entry.key.ends_with('/') && specifier.as_str().ends_with('/') {
continue;
}
+ if specifier.scheme() == "file" {
+ if let Ok(path) = specifier.to_file_path() {
+ if !path.is_file() {
+ continue;
+ }
+ }
+ }
roots.push(specifier.clone());
}
}
diff --git a/ext/broadcast_channel/Cargo.toml b/ext/broadcast_channel/Cargo.toml
index 95d480d248..7ca058a44a 100644
--- a/ext/broadcast_channel/Cargo.toml
+++ b/ext/broadcast_channel/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_broadcast_channel"
-version = "0.166.0"
+version = "0.167.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/cache/Cargo.toml b/ext/cache/Cargo.toml
index d0f260d9c3..dee4d7274d 100644
--- a/ext/cache/Cargo.toml
+++ b/ext/cache/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_cache"
-version = "0.104.0"
+version = "0.105.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/cache/lib.rs b/ext/cache/lib.rs
index 08661c3493..b9cc5427c2 100644
--- a/ext/cache/lib.rs
+++ b/ext/cache/lib.rs
@@ -28,7 +28,7 @@ pub enum CacheError {
Resource(deno_core::error::AnyError),
#[error(transparent)]
Other(deno_core::error::AnyError),
- #[error(transparent)]
+ #[error("{0}")]
Io(#[from] std::io::Error),
}
diff --git a/ext/canvas/Cargo.toml b/ext/canvas/Cargo.toml
index e88567ef13..6ca3d76c05 100644
--- a/ext/canvas/Cargo.toml
+++ b/ext/canvas/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_canvas"
-version = "0.41.0"
+version = "0.42.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/console/Cargo.toml b/ext/console/Cargo.toml
index d83afb1786..f83f7138d8 100644
--- a/ext/console/Cargo.toml
+++ b/ext/console/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_console"
-version = "0.172.0"
+version = "0.173.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/cron/Cargo.toml b/ext/cron/Cargo.toml
index 9aafa0b48c..ccd81de0cc 100644
--- a/ext/cron/Cargo.toml
+++ b/ext/cron/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_cron"
-version = "0.52.0"
+version = "0.53.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/crypto/Cargo.toml b/ext/crypto/Cargo.toml
index 143f4b0098..e3b59ed469 100644
--- a/ext/crypto/Cargo.toml
+++ b/ext/crypto/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_crypto"
-version = "0.186.0"
+version = "0.187.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/crypto/lib.rs b/ext/crypto/lib.rs
index c96029bf4a..b5bafc580b 100644
--- a/ext/crypto/lib.rs
+++ b/ext/crypto/lib.rs
@@ -149,10 +149,7 @@ pub fn op_crypto_get_random_values(
#[buffer] out: &mut [u8],
) -> Result<(), AnyError> {
if out.len() > 65536 {
- return Err(
- deno_web::DomExceptionQuotaExceededError::new(&format!("The ArrayBufferView's byte length ({}) exceeds the number of bytes of entropy available via this API (65536)", out.len()))
- .into(),
- );
+ return Err(custom_error("DOMExceptionQuotaExceededError", format!("The ArrayBufferView's byte length ({}) exceeds the number of bytes of entropy available via this API (65536)", out.len())));
}
let maybe_seeded_rng = state.try_borrow_mut::();
diff --git a/ext/fetch/Cargo.toml b/ext/fetch/Cargo.toml
index c8e2c858b6..ddb58a3f3f 100644
--- a/ext/fetch/Cargo.toml
+++ b/ext/fetch/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_fetch"
-version = "0.196.0"
+version = "0.197.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/ffi/Cargo.toml b/ext/ffi/Cargo.toml
index 9bca9d98f2..80b0180d0b 100644
--- a/ext/ffi/Cargo.toml
+++ b/ext/ffi/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_ffi"
-version = "0.159.0"
+version = "0.160.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/fs/Cargo.toml b/ext/fs/Cargo.toml
index 904483c798..a33347f9c7 100644
--- a/ext/fs/Cargo.toml
+++ b/ext/fs/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_fs"
-version = "0.82.0"
+version = "0.83.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/http/Cargo.toml b/ext/http/Cargo.toml
index f8e3bb38a2..6fa7598cb5 100644
--- a/ext/http/Cargo.toml
+++ b/ext/http/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_http"
-version = "0.170.0"
+version = "0.171.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/io/Cargo.toml b/ext/io/Cargo.toml
index 5a87977e05..8f407c820c 100644
--- a/ext/io/Cargo.toml
+++ b/ext/io/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_io"
-version = "0.82.0"
+version = "0.83.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/ext/kv/Cargo.toml b/ext/kv/Cargo.toml
index 8aee80c575..f7b28af675 100644
--- a/ext/kv/Cargo.toml
+++ b/ext/kv/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "deno_kv"
-version = "0.80.0"
+version = "0.81.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
@@ -36,6 +36,7 @@ prost.workspace = true
rand.workspace = true
rusqlite.workspace = true
serde.workspace = true
+thiserror.workspace = true
url.workspace = true
[build-dependencies]
diff --git a/ext/kv/lib.rs b/ext/kv/lib.rs
index 13e4f1662f..a4ccfe3d63 100644
--- a/ext/kv/lib.rs
+++ b/ext/kv/lib.rs
@@ -12,15 +12,11 @@ use std::num::NonZeroU32;
use std::rc::Rc;
use std::time::Duration;
-use anyhow::bail;
use base64::prelude::BASE64_URL_SAFE;
use base64::Engine;
use chrono::DateTime;
use chrono::Utc;
-use deno_core::anyhow::Context;
use deno_core::error::get_custom_error_class;
-use deno_core::error::type_error;
-use deno_core::error::AnyError;
use deno_core::futures::StreamExt;
use deno_core::op2;
use deno_core::serde_v8::AnyValue;
@@ -118,12 +114,72 @@ impl Resource for DatabaseWatcherResource {
}
}
+#[derive(Debug, thiserror::Error)]
+pub enum KvError {
+ #[error(transparent)]
+ DatabaseHandler(deno_core::error::AnyError),
+ #[error(transparent)]
+ Resource(deno_core::error::AnyError),
+ #[error("Too many ranges (max {0})")]
+ TooManyRanges(usize),
+ #[error("Too many entries (max {0})")]
+ TooManyEntries(usize),
+ #[error("Too many checks (max {0})")]
+ TooManyChecks(usize),
+ #[error("Too many mutations (max {0})")]
+ TooManyMutations(usize),
+ #[error("Too many keys (max {0})")]
+ TooManyKeys(usize),
+ #[error("limit must be greater than 0")]
+ InvalidLimit,
+ #[error("Invalid boundary key")]
+ InvalidBoundaryKey,
+ #[error("Key too large for read (max {0} bytes)")]
+ KeyTooLargeToRead(usize),
+ #[error("Key too large for write (max {0} bytes)")]
+ KeyTooLargeToWrite(usize),
+ #[error("Total mutation size too large (max {0} bytes)")]
+ TotalMutationTooLarge(usize),
+ #[error("Total key size too large (max {0} bytes)")]
+ TotalKeyTooLarge(usize),
+ #[error(transparent)]
+ Kv(deno_core::error::AnyError),
+ #[error(transparent)]
+ Io(#[from] std::io::Error),
+ #[error("Queue message not found")]
+ QueueMessageNotFound,
+ #[error("Start key is not in the keyspace defined by prefix")]
+ StartKeyNotInKeyspace,
+ #[error("End key is not in the keyspace defined by prefix")]
+ EndKeyNotInKeyspace,
+ #[error("Start key is greater than end key")]
+ StartKeyGreaterThanEndKey,
+ #[error("Invalid check")]
+ InvalidCheck(#[source] KvCheckError),
+ #[error("Invalid mutation")]
+ InvalidMutation(#[source] KvMutationError),
+ #[error("Invalid enqueue")]
+ InvalidEnqueue(#[source] std::io::Error),
+ #[error("key cannot be empty")]
+ EmptyKey, // TypeError
+ #[error("Value too large (max {0} bytes)")]
+ ValueTooLarge(usize), // TypeError
+ #[error("enqueue payload too large (max {0} bytes)")]
+ EnqueuePayloadTooLarge(usize), // TypeError
+ #[error("invalid cursor")]
+ InvalidCursor,
+ #[error("cursor out of bounds")]
+ CursorOutOfBounds,
+ #[error("Invalid range")]
+ InvalidRange,
+}
+
#[op2(async)]
#[smi]
async fn op_kv_database_open(
state: Rc>,
#[string] path: Option,
-) -> Result
+) -> Result
where
DBH: DatabaseHandler + 'static,
{
@@ -134,7 +190,10 @@ where
.check_or_exit(UNSTABLE_FEATURE_NAME, "Deno.openKv");
state.borrow::>().clone()
};
- let db = handler.open(state.clone(), path).await?;
+ let db = handler
+ .open(state.clone(), path)
+ .await
+ .map_err(KvError::DatabaseHandler)?;
let rid = state.borrow_mut().resource_table.add(DatabaseResource {
db,
cancel_handle: CancelHandle::new_rc(),
@@ -184,8 +243,8 @@ enum ToV8Value {
}
impl TryFrom for KvValue {
- type Error = AnyError;
- fn try_from(value: FromV8Value) -> Result {
+ type Error = num_bigint::TryFromBigIntError;
+ fn try_from(value: FromV8Value) -> Result {
Ok(match value {
FromV8Value::V8(buf) => KvValue::V8(buf.to_vec()),
FromV8Value::Bytes(buf) => KvValue::Bytes(buf.to_vec()),
@@ -214,8 +273,8 @@ struct ToV8KvEntry {
}
impl TryFrom for ToV8KvEntry {
- type Error = AnyError;
- fn try_from(entry: KvEntry) -> Result {
+ type Error = std::io::Error;
+ fn try_from(entry: KvEntry) -> Result {
Ok(ToV8KvEntry {
key: decode_key(&entry.key)?
.0
@@ -261,14 +320,16 @@ async fn op_kv_snapshot_read(
#[smi] rid: ResourceId,
#[serde] ranges: Vec,
#[serde] consistency: V8Consistency,
-) -> Result>, AnyError>
+) -> Result>, KvError>
where
DBH: DatabaseHandler + 'static,
{
let db = {
let state = state.borrow();
- let resource =
- state.resource_table.get::>(rid)?;
+ let resource = state
+ .resource_table
+ .get::>(rid)
+ .map_err(KvError::Resource)?;
resource.db.clone()
};
@@ -278,10 +339,7 @@ where
};
if ranges.len() > config.max_read_ranges {
- return Err(type_error(format!(
- "Too many ranges (max {})",
- config.max_read_ranges
- )));
+ return Err(KvError::TooManyRanges(config.max_read_ranges));
}
let mut total_entries = 0usize;
@@ -300,33 +358,32 @@ where
Ok(ReadRange {
start,
end,
- limit: NonZeroU32::new(limit)
- .with_context(|| "limit must be greater than 0")?,
+ limit: NonZeroU32::new(limit).ok_or(KvError::InvalidLimit)?,
reverse,
})
})
- .collect::, AnyError>>()?;
+ .collect::, KvError>>()?;
if total_entries > config.max_read_entries {
- return Err(type_error(format!(
- "Too many entries (max {})",
- config.max_read_entries
- )));
+ return Err(KvError::TooManyEntries(config.max_read_entries));
}
let opts = SnapshotReadOptions {
consistency: consistency.into(),
};
- let output_ranges = db.snapshot_read(read_ranges, opts).await?;
+ let output_ranges = db
+ .snapshot_read(read_ranges, opts)
+ .await
+ .map_err(KvError::Kv)?;
let output_ranges = output_ranges
.into_iter()
.map(|x| {
x.entries
.into_iter()
.map(TryInto::try_into)
- .collect::, AnyError>>()
+ .collect::, std::io::Error>>()
})
- .collect::, AnyError>>()?;
+ .collect::, std::io::Error>>()?;
Ok(output_ranges)
}
@@ -345,7 +402,7 @@ impl Resource for QueueMessageResource {
async fn op_kv_dequeue_next_message(
state: Rc>,
#[smi] rid: ResourceId,
-) -> Result