From 72dd74d83a89d3db17e6ed5d0b8c7f4ba3f3d233 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Wed, 16 Oct 2024 22:43:26 +0100 Subject: [PATCH 1/4] Reland feat(lsp): deno/didRefreshDenoConfigurationTree notifications (#26325) --- cli/bench/lsp.rs | 16 +++ cli/bench/lsp_bench_standalone.rs | 4 + cli/lsp/capabilities.rs | 4 +- cli/lsp/client.rs | 35 ++++++ cli/lsp/config.rs | 48 +++++++- cli/lsp/language_server.rs | 5 + cli/lsp/lsp_custom.rs | 30 ++++- tests/integration/lsp_tests.rs | 195 +++++++++++++++++++++++++++++- 8 files changed, 324 insertions(+), 13 deletions(-) diff --git a/cli/bench/lsp.rs b/cli/bench/lsp.rs index b088865c6b..7baaffca7e 100644 --- a/cli/bench/lsp.rs +++ b/cli/bench/lsp.rs @@ -150,7 +150,11 @@ fn bench_big_file_edits(deno_exe: &Path) -> Duration { .deno_exe(deno_exe) .build(); client.initialize_default(); + let (method, _): (String, Option) = client.read_notification(); + assert_eq!(method, "deno/didRefreshDenoConfigurationTree"); client.change_configuration(json!({ "deno": { "enable": true } })); + let (method, _): (String, Option) = client.read_notification(); + assert_eq!(method, "deno/didRefreshDenoConfigurationTree"); client.write_notification( "textDocument/didOpen", @@ -206,6 +210,8 @@ fn bench_code_lens(deno_exe: &Path) -> Duration { .deno_exe(deno_exe) .build(); client.initialize_default(); + let (method, _): (String, Option) = client.read_notification(); + assert_eq!(method, "deno/didRefreshDenoConfigurationTree"); client.change_configuration(json!({ "deno": { "enable": true, "codeLens": { @@ -214,6 +220,8 @@ fn bench_code_lens(deno_exe: &Path) -> Duration { "test": true, }, } })); + let (method, _): (String, Option) = client.read_notification(); + assert_eq!(method, "deno/didRefreshDenoConfigurationTree"); client.write_notification( "textDocument/didOpen", @@ -257,7 +265,11 @@ fn bench_find_replace(deno_exe: &Path) -> Duration { .deno_exe(deno_exe) .build(); client.initialize_default(); + let (method, _): (String, Option) = client.read_notification(); + assert_eq!(method, "deno/didRefreshDenoConfigurationTree"); client.change_configuration(json!({ "deno": { "enable": true } })); + let (method, _): (String, Option) = client.read_notification(); + assert_eq!(method, "deno/didRefreshDenoConfigurationTree"); for i in 0..10 { client.write_notification( @@ -341,7 +353,11 @@ fn bench_startup_shutdown(deno_exe: &Path) -> Duration { .deno_exe(deno_exe) .build(); client.initialize_default(); + let (method, _): (String, Option) = client.read_notification(); + assert_eq!(method, "deno/didRefreshDenoConfigurationTree"); client.change_configuration(json!({ "deno": { "enable": true } })); + let (method, _): (String, Option) = client.read_notification(); + assert_eq!(method, "deno/didRefreshDenoConfigurationTree"); client.write_notification( "textDocument/didOpen", diff --git a/cli/bench/lsp_bench_standalone.rs b/cli/bench/lsp_bench_standalone.rs index 9c4f264ec9..3c946cfbe3 100644 --- a/cli/bench/lsp_bench_standalone.rs +++ b/cli/bench/lsp_bench_standalone.rs @@ -13,7 +13,11 @@ use test_util::lsp::LspClientBuilder; fn incremental_change_wait(bench: &mut Bencher) { let mut client = LspClientBuilder::new().use_diagnostic_sync(false).build(); client.initialize_default(); + let (method, _): (String, Option) = client.read_notification(); + assert_eq!(method, "deno/didRefreshDenoConfigurationTree"); client.change_configuration(json!({ "deno": { "enable": true } })); + let (method, _): (String, Option) = client.read_notification(); + assert_eq!(method, "deno/didRefreshDenoConfigurationTree"); client.write_notification( "textDocument/didOpen", diff --git a/cli/lsp/capabilities.rs b/cli/lsp/capabilities.rs index e93d3b7c20..5cdb1224d8 100644 --- a/cli/lsp/capabilities.rs +++ b/cli/lsp/capabilities.rs @@ -147,11 +147,11 @@ pub fn server_capabilities( moniker_provider: None, experimental: Some(json!({ "denoConfigTasks": true, - "testingApi":true, + "testingApi": true, + "didRefreshDenoConfigurationTreeNotifications": true, })), inlay_hint_provider: Some(OneOf::Left(true)), position_encoding: None, - // TODO(nayeemrmn): Support pull-based diagnostics. diagnostic_provider: None, inline_value_provider: None, inline_completion_provider: None, diff --git a/cli/lsp/client.rs b/cli/lsp/client.rs index b3f0d64fa6..65865d5b32 100644 --- a/cli/lsp/client.rs +++ b/cli/lsp/client.rs @@ -92,6 +92,19 @@ impl Client { }); } + pub fn send_did_refresh_deno_configuration_tree_notification( + &self, + params: lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams, + ) { + // do on a task in case the caller currently is in the lsp lock + let client = self.0.clone(); + spawn(async move { + client + .send_did_refresh_deno_configuration_tree_notification(params) + .await; + }); + } + pub fn send_did_change_deno_configuration_notification( &self, params: lsp_custom::DidChangeDenoConfigurationNotificationParams, @@ -169,6 +182,10 @@ trait ClientTrait: Send + Sync { params: lsp_custom::DiagnosticBatchNotificationParams, ); async fn send_test_notification(&self, params: TestingNotification); + async fn send_did_refresh_deno_configuration_tree_notification( + &self, + params: lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams, + ); async fn send_did_change_deno_configuration_notification( &self, params: lsp_custom::DidChangeDenoConfigurationNotificationParams, @@ -249,6 +266,18 @@ impl ClientTrait for TowerClient { } } + async fn send_did_refresh_deno_configuration_tree_notification( + &self, + params: lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams, + ) { + self + .0 + .send_notification::( + params, + ) + .await + } + async fn send_did_change_deno_configuration_notification( &self, params: lsp_custom::DidChangeDenoConfigurationNotificationParams, @@ -366,6 +395,12 @@ impl ClientTrait for ReplClient { async fn send_test_notification(&self, _params: TestingNotification) {} + async fn send_did_refresh_deno_configuration_tree_notification( + &self, + _params: lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams, + ) { + } + async fn send_did_change_deno_configuration_notification( &self, _params: lsp_custom::DidChangeDenoConfigurationNotificationParams, diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index 07fdd3c65a..74f3583d68 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -50,6 +50,8 @@ use std::sync::Arc; use tower_lsp::lsp_types as lsp; use super::logging::lsp_log; +use super::lsp_custom; +use super::urls::url_to_uri; use crate::args::discover_npmrc_from_workspace; use crate::args::has_flag_env_var; use crate::args::CliLockfile; @@ -1716,14 +1718,14 @@ impl ConfigTree { .unwrap_or_else(|| Arc::new(FmtConfig::new_with_base(PathBuf::from("/")))) } - /// Returns (scope_uri, type). + /// Returns (scope_url, type). pub fn watched_file_type( &self, specifier: &ModuleSpecifier, ) -> Option<(&ModuleSpecifier, ConfigWatchedFileType)> { - for (scope_uri, data) in self.scopes.iter() { + for (scope_url, data) in self.scopes.iter() { if let Some(typ) = data.watched_files.get(specifier) { - return Some((scope_uri, *typ)); + return Some((scope_url, *typ)); } } None @@ -1747,6 +1749,46 @@ impl ConfigTree { .any(|data| data.watched_files.contains_key(specifier)) } + pub fn to_did_refresh_params( + &self, + ) -> lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams { + let data = self + .scopes + .values() + .filter_map(|data| { + let workspace_root_scope_uri = + Some(data.member_dir.workspace.root_dir()) + .filter(|s| *s != data.member_dir.dir_url()) + .and_then(|s| url_to_uri(s).ok()); + Some(lsp_custom::DenoConfigurationData { + scope_uri: url_to_uri(&data.scope).ok()?, + deno_json: data.maybe_deno_json().and_then(|c| { + if workspace_root_scope_uri.is_some() + && Some(&c.specifier) + == data + .member_dir + .workspace + .root_deno_json() + .map(|c| &c.specifier) + { + return None; + } + Some(lsp::TextDocumentIdentifier { + uri: url_to_uri(&c.specifier).ok()?, + }) + }), + package_json: data.maybe_pkg_json().and_then(|p| { + Some(lsp::TextDocumentIdentifier { + uri: url_to_uri(&p.specifier()).ok()?, + }) + }), + workspace_root_scope_uri, + }) + }) + .collect(); + lsp_custom::DidRefreshDenoConfigurationTreeNotificationParams { data } + } + pub async fn refresh( &mut self, settings: &Settings, diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 8269dc8515..908afa1657 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -963,6 +963,11 @@ impl Inner { .tree .refresh(&self.config.settings, &self.workspace_files, &file_fetcher) .await; + self + .client + .send_did_refresh_deno_configuration_tree_notification( + self.config.tree.to_did_refresh_params(), + ); for config_file in self.config.tree.config_files() { (|| { let compiler_options = config_file.to_compiler_options().ok()?.options; diff --git a/cli/lsp/lsp_custom.rs b/cli/lsp/lsp_custom.rs index 5f485db7ac..b570b6d0e2 100644 --- a/cli/lsp/lsp_custom.rs +++ b/cli/lsp/lsp_custom.rs @@ -46,6 +46,30 @@ pub struct DiagnosticBatchNotificationParams { pub messages_len: usize, } +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DenoConfigurationData { + pub scope_uri: lsp::Uri, + pub workspace_root_scope_uri: Option, + pub deno_json: Option, + pub package_json: Option, +} + +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DidRefreshDenoConfigurationTreeNotificationParams { + pub data: Vec, +} + +pub enum DidRefreshDenoConfigurationTreeNotification {} + +impl lsp::notification::Notification + for DidRefreshDenoConfigurationTreeNotification +{ + type Params = DidRefreshDenoConfigurationTreeNotificationParams; + const METHOD: &'static str = "deno/didRefreshDenoConfigurationTree"; +} + #[derive(Debug, Eq, Hash, PartialEq, Copy, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub enum DenoConfigurationChangeType { @@ -88,13 +112,15 @@ pub struct DidChangeDenoConfigurationNotificationParams { pub changes: Vec, } +// TODO(nayeemrmn): This is being replaced by +// `DidRefreshDenoConfigurationTreeNotification` for Deno > v2.0.0. Remove it +// soon. pub enum DidChangeDenoConfigurationNotification {} impl lsp::notification::Notification for DidChangeDenoConfigurationNotification { type Params = DidChangeDenoConfigurationNotificationParams; - const METHOD: &'static str = "deno/didChangeDenoConfiguration"; } @@ -102,7 +128,6 @@ pub enum DidUpgradeCheckNotification {} impl lsp::notification::Notification for DidUpgradeCheckNotification { type Params = DidUpgradeCheckNotificationParams; - const METHOD: &'static str = "deno/didUpgradeCheck"; } @@ -125,6 +150,5 @@ pub enum DiagnosticBatchNotification {} impl lsp::notification::Notification for DiagnosticBatchNotification { type Params = DiagnosticBatchNotificationParams; - const METHOD: &'static str = "deno/internalTestDiagnosticBatch"; } diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 0f2d437558..85e02041ed 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -1049,6 +1049,191 @@ fn lsp_workspace_enable_paths_no_workspace_configuration() { client.shutdown(); } +#[test] +fn lsp_did_refresh_deno_configuration_tree_notification() { + let context = TestContextBuilder::new().use_temp_cwd().build(); + let temp_dir = context.temp_dir(); + temp_dir.create_dir_all("workspace/member1"); + temp_dir.create_dir_all("workspace/member2"); + temp_dir.create_dir_all("non_workspace1"); + temp_dir.create_dir_all("non_workspace2"); + temp_dir.write( + "workspace/deno.json", + json!({ + "workspace": [ + "member1", + "member2", + ], + }) + .to_string(), + ); + temp_dir.write("workspace/member1/deno.json", json!({}).to_string()); + temp_dir.write("workspace/member1/package.json", json!({}).to_string()); + temp_dir.write("workspace/member2/package.json", json!({}).to_string()); + temp_dir.write("non_workspace1/deno.json", json!({}).to_string()); + let mut client = context.new_lsp_command().build(); + client.initialize_default(); + let res = client + .read_notification_with_method::( + "deno/didRefreshDenoConfigurationTree", + ) + .unwrap(); + assert_eq!( + res, + json!({ + "data": [ + { + "scopeUri": temp_dir.url().join("non_workspace1/").unwrap(), + "workspaceRootScopeUri": null, + "denoJson": { + "uri": temp_dir.url().join("non_workspace1/deno.json").unwrap(), + }, + "packageJson": null, + }, + { + "scopeUri": temp_dir.url().join("workspace/").unwrap(), + "workspaceRootScopeUri": null, + "denoJson": { + "uri": temp_dir.url().join("workspace/deno.json").unwrap(), + }, + "packageJson": null, + }, + { + "scopeUri": temp_dir.url().join("workspace/member1/").unwrap(), + "workspaceRootScopeUri": temp_dir.url().join("workspace/").unwrap(), + "denoJson": { + "uri": temp_dir.url().join("workspace/member1/deno.json").unwrap(), + }, + "packageJson": { + "uri": temp_dir.url().join("workspace/member1/package.json").unwrap(), + }, + }, + { + "scopeUri": temp_dir.url().join("workspace/member2/").unwrap(), + "workspaceRootScopeUri": temp_dir.url().join("workspace/").unwrap(), + "denoJson": null, + "packageJson": { + "uri": temp_dir.url().join("workspace/member2/package.json").unwrap(), + }, + }, + ], + }), + ); + temp_dir.write("non_workspace2/deno.json", json!({}).to_string()); + client.did_change_watched_files(json!({ + "changes": [{ + "uri": temp_dir.url().join("non_workspace2/deno.json").unwrap(), + "type": 1, + }], + })); + let res = client + .read_notification_with_method::( + "deno/didRefreshDenoConfigurationTree", + ) + .unwrap(); + assert_eq!( + res, + json!({ + "data": [ + { + "scopeUri": temp_dir.url().join("non_workspace1/").unwrap(), + "workspaceRootScopeUri": null, + "denoJson": { + "uri": temp_dir.url().join("non_workspace1/deno.json").unwrap(), + }, + "packageJson": null, + }, + { + "scopeUri": temp_dir.url().join("non_workspace2/").unwrap(), + "workspaceRootScopeUri": null, + "denoJson": { + "uri": temp_dir.url().join("non_workspace2/deno.json").unwrap(), + }, + "packageJson": null, + }, + { + "scopeUri": temp_dir.url().join("workspace/").unwrap(), + "workspaceRootScopeUri": null, + "denoJson": { + "uri": temp_dir.url().join("workspace/deno.json").unwrap(), + }, + "packageJson": null, + }, + { + "scopeUri": temp_dir.url().join("workspace/member1/").unwrap(), + "workspaceRootScopeUri": temp_dir.url().join("workspace/").unwrap(), + "denoJson": { + "uri": temp_dir.url().join("workspace/member1/deno.json").unwrap(), + }, + "packageJson": { + "uri": temp_dir.url().join("workspace/member1/package.json").unwrap(), + }, + }, + { + "scopeUri": temp_dir.url().join("workspace/member2/").unwrap(), + "workspaceRootScopeUri": temp_dir.url().join("workspace/").unwrap(), + "denoJson": null, + "packageJson": { + "uri": temp_dir.url().join("workspace/member2/package.json").unwrap(), + }, + }, + ], + }), + ); + client.change_configuration(json!({ + "deno": { + "disablePaths": ["non_workspace1"], + }, + })); + let res = client + .read_notification_with_method::( + "deno/didRefreshDenoConfigurationTree", + ) + .unwrap(); + assert_eq!( + res, + json!({ + "data": [ + { + "scopeUri": temp_dir.url().join("non_workspace2/").unwrap(), + "workspaceRootScopeUri": null, + "denoJson": { + "uri": temp_dir.url().join("non_workspace2/deno.json").unwrap(), + }, + "packageJson": null, + }, + { + "scopeUri": temp_dir.url().join("workspace/").unwrap(), + "workspaceRootScopeUri": null, + "denoJson": { + "uri": temp_dir.url().join("workspace/deno.json").unwrap(), + }, + "packageJson": null, + }, + { + "scopeUri": temp_dir.url().join("workspace/member1/").unwrap(), + "workspaceRootScopeUri": temp_dir.url().join("workspace/").unwrap(), + "denoJson": { + "uri": temp_dir.url().join("workspace/member1/deno.json").unwrap(), + }, + "packageJson": { + "uri": temp_dir.url().join("workspace/member1/package.json").unwrap(), + }, + }, + { + "scopeUri": temp_dir.url().join("workspace/member2/").unwrap(), + "workspaceRootScopeUri": temp_dir.url().join("workspace/").unwrap(), + "denoJson": null, + "packageJson": { + "uri": temp_dir.url().join("workspace/member2/package.json").unwrap(), + }, + }, + ], + }), + ); + client.shutdown(); +} + #[test] fn lsp_did_change_deno_configuration_notification() { let context = TestContextBuilder::new().use_temp_cwd().build(); @@ -9403,14 +9588,15 @@ fn lsp_auto_discover_registry() { "triggerCharacter": "@" }), ); - let (method, res) = client.read_notification(); - assert_eq!(method, "deno/registryState"); + let res = client + .read_notification_with_method::("deno/registryState") + .unwrap(); assert_eq!( res, - Some(json!({ + json!({ "origin": "http://localhost:4545", "suggestions": true, - })) + }), ); client.shutdown(); } @@ -10117,7 +10303,6 @@ fn lsp_diagnostics_refresh_dependents() { assert_eq!(json!(diagnostics.all()), json!([])); // no diagnostics now client.shutdown(); - assert_eq!(client.queue_len(), 0); } // Regression test for https://github.com/denoland/deno/issues/10897. From 3385d1252e4eae093234d0a075f4a564308ba48e Mon Sep 17 00:00:00 2001 From: denobot <33910674+denobot@users.noreply.github.com> Date: Wed, 16 Oct 2024 19:48:42 -0400 Subject: [PATCH 2/4] chore: forward v2.0.1 release commit to main (#26338) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the release commit being forwarded back to main for 2.0.1 Co-authored-by: bartlomieju Co-authored-by: Bartek IwaƄczuk --- .github/workflows/ci.generate.ts | 2 +- .github/workflows/ci.yml | 8 ++--- Cargo.lock | 58 ++++++++++++++++---------------- Cargo.toml | 56 +++++++++++++++--------------- Releases.md | 56 ++++++++++++++++++++++++++++++ bench_util/Cargo.toml | 2 +- cli/Cargo.toml | 2 +- cli/napi/sym/Cargo.toml | 2 +- ext/broadcast_channel/Cargo.toml | 2 +- ext/cache/Cargo.toml | 2 +- ext/canvas/Cargo.toml | 2 +- ext/console/Cargo.toml | 2 +- ext/cron/Cargo.toml | 2 +- ext/crypto/Cargo.toml | 2 +- ext/fetch/Cargo.toml | 2 +- ext/ffi/Cargo.toml | 2 +- ext/fs/Cargo.toml | 2 +- ext/http/Cargo.toml | 2 +- ext/io/Cargo.toml | 2 +- ext/kv/Cargo.toml | 2 +- ext/napi/Cargo.toml | 2 +- ext/net/Cargo.toml | 2 +- ext/node/Cargo.toml | 2 +- ext/tls/Cargo.toml | 2 +- ext/url/Cargo.toml | 2 +- ext/web/Cargo.toml | 2 +- ext/webgpu/Cargo.toml | 2 +- ext/webidl/Cargo.toml | 2 +- ext/websocket/Cargo.toml | 2 +- ext/webstorage/Cargo.toml | 2 +- resolvers/deno/Cargo.toml | 2 +- resolvers/node/Cargo.toml | 2 +- runtime/Cargo.toml | 2 +- runtime/permissions/Cargo.toml | 2 +- 34 files changed, 147 insertions(+), 91 deletions(-) diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index a487f11f93..d18ec6e1a8 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 = 19; +const cacheVersion = 20; const ubuntuX86Runner = "ubuntu-22.04"; const ubuntuX86XlRunner = "ubuntu-22.04-xl"; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57bbf6a5e5..1353bf4a6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -361,8 +361,8 @@ jobs: path: |- ~/.cargo/registry/index ~/.cargo/registry/cache - key: '19-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' - restore-keys: '19-cargo-home-${{ matrix.os }}-${{ matrix.arch }}' + key: '20-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' + restore-keys: '20-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: '19-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-' + restore-keys: '20-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: '19-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' + key: '20-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 e3a6556904..c8807b65d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1154,7 +1154,7 @@ dependencies = [ [[package]] name = "deno" -version = "2.0.0" +version = "2.0.1" dependencies = [ "anstream", "async-trait", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "deno_bench_util" -version = "0.165.0" +version = "0.166.0" dependencies = [ "bencher", "deno_core", @@ -1337,7 +1337,7 @@ dependencies = [ [[package]] name = "deno_broadcast_channel" -version = "0.165.0" +version = "0.166.0" dependencies = [ "async-trait", "deno_core", @@ -1348,7 +1348,7 @@ dependencies = [ [[package]] name = "deno_cache" -version = "0.103.0" +version = "0.104.0" dependencies = [ "async-trait", "deno_core", @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "deno_canvas" -version = "0.40.0" +version = "0.41.0" dependencies = [ "deno_core", "deno_webgpu", @@ -1416,7 +1416,7 @@ dependencies = [ [[package]] name = "deno_console" -version = "0.171.0" +version = "0.172.0" dependencies = [ "deno_core", ] @@ -1461,7 +1461,7 @@ checksum = "a13951ea98c0a4c372f162d669193b4c9d991512de9f2381dd161027f34b26b1" [[package]] name = "deno_cron" -version = "0.51.0" +version = "0.52.0" dependencies = [ "anyhow", "async-trait", @@ -1474,7 +1474,7 @@ dependencies = [ [[package]] name = "deno_crypto" -version = "0.185.0" +version = "0.186.0" dependencies = [ "aes", "aes-gcm", @@ -1534,7 +1534,7 @@ dependencies = [ [[package]] name = "deno_fetch" -version = "0.195.0" +version = "0.196.0" dependencies = [ "base64 0.21.7", "bytes", @@ -1566,7 +1566,7 @@ dependencies = [ [[package]] name = "deno_ffi" -version = "0.158.0" +version = "0.159.0" dependencies = [ "deno_core", "deno_permissions", @@ -1585,7 +1585,7 @@ dependencies = [ [[package]] name = "deno_fs" -version = "0.81.0" +version = "0.82.0" dependencies = [ "async-trait", "base32", @@ -1635,7 +1635,7 @@ dependencies = [ [[package]] name = "deno_http" -version = "0.169.0" +version = "0.170.0" dependencies = [ "async-compression", "async-trait", @@ -1674,7 +1674,7 @@ dependencies = [ [[package]] name = "deno_io" -version = "0.81.0" +version = "0.82.0" dependencies = [ "async-trait", "deno_core", @@ -1695,7 +1695,7 @@ dependencies = [ [[package]] name = "deno_kv" -version = "0.79.0" +version = "0.80.0" dependencies = [ "anyhow", "async-trait", @@ -1766,7 +1766,7 @@ dependencies = [ [[package]] name = "deno_napi" -version = "0.102.0" +version = "0.103.0" dependencies = [ "deno_core", "deno_permissions", @@ -1788,7 +1788,7 @@ dependencies = [ [[package]] name = "deno_net" -version = "0.163.0" +version = "0.164.0" dependencies = [ "deno_core", "deno_permissions", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "deno_node" -version = "0.108.0" +version = "0.109.0" dependencies = [ "aead-gcm-stream", "aes", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "deno_permissions" -version = "0.31.0" +version = "0.32.0" dependencies = [ "deno_core", "deno_path_util", @@ -1970,7 +1970,7 @@ dependencies = [ [[package]] name = "deno_resolver" -version = "0.3.0" +version = "0.4.0" dependencies = [ "anyhow", "base32", @@ -1986,7 +1986,7 @@ dependencies = [ [[package]] name = "deno_runtime" -version = "0.180.0" +version = "0.181.0" dependencies = [ "color-print", "deno_ast", @@ -2102,7 +2102,7 @@ dependencies = [ [[package]] name = "deno_tls" -version = "0.158.0" +version = "0.159.0" dependencies = [ "deno_core", "deno_native_certs", @@ -2151,7 +2151,7 @@ dependencies = [ [[package]] name = "deno_url" -version = "0.171.0" +version = "0.172.0" dependencies = [ "deno_bench_util", "deno_console", @@ -2163,7 +2163,7 @@ dependencies = [ [[package]] name = "deno_web" -version = "0.202.0" +version = "0.203.0" dependencies = [ "async-trait", "base64-simd 0.8.0", @@ -2184,7 +2184,7 @@ dependencies = [ [[package]] name = "deno_webgpu" -version = "0.138.0" +version = "0.139.0" dependencies = [ "deno_core", "raw-window-handle", @@ -2196,7 +2196,7 @@ dependencies = [ [[package]] name = "deno_webidl" -version = "0.171.0" +version = "0.172.0" dependencies = [ "deno_bench_util", "deno_core", @@ -2204,7 +2204,7 @@ dependencies = [ [[package]] name = "deno_websocket" -version = "0.176.0" +version = "0.177.0" dependencies = [ "bytes", "deno_core", @@ -2225,7 +2225,7 @@ dependencies = [ [[package]] name = "deno_webstorage" -version = "0.166.0" +version = "0.167.0" dependencies = [ "deno_core", "deno_web", @@ -4511,7 +4511,7 @@ dependencies = [ [[package]] name = "napi_sym" -version = "0.101.0" +version = "0.102.0" dependencies = [ "quote", "serde", @@ -4580,7 +4580,7 @@ dependencies = [ [[package]] name = "node_resolver" -version = "0.10.0" +version = "0.11.0" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 25842134a7..e8919eade7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,16 +48,16 @@ repository = "https://github.com/denoland/deno" deno_ast = { version = "=0.42.2", features = ["transpiling"] } deno_core = { version = "0.313.0" } -deno_bench_util = { version = "0.165.0", path = "./bench_util" } +deno_bench_util = { version = "0.166.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.31.0", path = "./runtime/permissions" } -deno_runtime = { version = "0.180.0", path = "./runtime" } +deno_permissions = { version = "0.32.0", path = "./runtime/permissions" } +deno_runtime = { version = "0.181.0", path = "./runtime" } deno_semver = "=0.5.14" deno_terminal = "0.2.0" -napi_sym = { version = "0.101.0", path = "./cli/napi/sym" } +napi_sym = { version = "0.102.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.165.0", path = "./ext/broadcast_channel" } -deno_cache = { version = "0.103.0", path = "./ext/cache" } -deno_canvas = { version = "0.40.0", path = "./ext/canvas" } -deno_console = { version = "0.171.0", path = "./ext/console" } -deno_cron = { version = "0.51.0", path = "./ext/cron" } -deno_crypto = { version = "0.185.0", path = "./ext/crypto" } -deno_fetch = { version = "0.195.0", path = "./ext/fetch" } -deno_ffi = { version = "0.158.0", path = "./ext/ffi" } -deno_fs = { version = "0.81.0", path = "./ext/fs" } -deno_http = { version = "0.169.0", path = "./ext/http" } -deno_io = { version = "0.81.0", path = "./ext/io" } -deno_kv = { version = "0.79.0", path = "./ext/kv" } -deno_napi = { version = "0.102.0", path = "./ext/napi" } -deno_net = { version = "0.163.0", path = "./ext/net" } -deno_node = { version = "0.108.0", path = "./ext/node" } -deno_tls = { version = "0.158.0", path = "./ext/tls" } -deno_url = { version = "0.171.0", path = "./ext/url" } -deno_web = { version = "0.202.0", path = "./ext/web" } -deno_webgpu = { version = "0.138.0", path = "./ext/webgpu" } -deno_webidl = { version = "0.171.0", path = "./ext/webidl" } -deno_websocket = { version = "0.176.0", path = "./ext/websocket" } -deno_webstorage = { version = "0.166.0", path = "./ext/webstorage" } +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" } # resolvers -deno_resolver = { version = "0.3.0", path = "./resolvers/deno" } -node_resolver = { version = "0.10.0", path = "./resolvers/node" } +deno_resolver = { version = "0.4.0", path = "./resolvers/deno" } +node_resolver = { version = "0.11.0", path = "./resolvers/node" } aes = "=0.8.3" anyhow = "1.0.57" diff --git a/Releases.md b/Releases.md index 80fdc7fb8d..207e18e26d 100644 --- a/Releases.md +++ b/Releases.md @@ -6,6 +6,62 @@ https://github.com/denoland/deno/releases We also have one-line install commands at: https://github.com/denoland/deno_install +### 2.0.1 / 2024.10.16 + +- feat(lsp): "deno/didRefreshDenoConfigurationTree" notifications (#26215) +- feat(unstable): `--unstable-detect-cjs` for respecting explicit + `"type": "commonjs"` (#26149) +- fix(add): create deno.json when running `deno add jsr:` (#26275) +- fix(add): exact version should not have range `^` specifier (#26302) +- fix(child_process): map node `--no-warnings` flag to `--quiet` (#26288) +- fix(cli): add prefix to install commands in help (#26318) +- fix(cli): consolidate pkg parser for install & remove (#26298) +- fix(cli): named export takes precedence over default export in doc testing + (#26112) +- fix(cli): improve deno info output for npm packages (#25906) +- fix(console/ext/repl): support using parseFloat() (#25900) +- fix(ext/console): apply coloring for console.table (#26280) +- fix(ext/napi): pass user context to napi_threadsafe_fn finalizers (#26229) +- fix(ext/node): allow writing to tty columns (#26201) +- fix(ext/node): compute pem length (upper bound) for key exports (#26231) +- fix(ext/node): fix dns.lookup result ordering (#26264) +- fix(ext/node): handle http2 server ending stream (#26235) +- fix(ext/node): implement TCP.setNoDelay (#26263) +- fix(ext/node): timingSafeEqual account for AB byteOffset (#26292) +- fix(ext/node): use primordials in `ext/node/polyfills/internal/buffer.mjs` + (#24993) +- fix(ext/webgpu): allow GL backend on Windows (#26206) +- fix(install): duplicate dependencies in `package.json` (#26128) +- fix(install): handle pkg with dep on self when pkg part of peer dep resolution + (#26277) +- fix(install): retry downloads of registry info / tarballs (#26278) +- fix(install): support installing npm package with alias (#26246) +- fix(jupyter): copy kernels icons to the kernel directory (#26084) +- fix(jupyter): keep running event loop when waiting for messages (#26049) +- fix(lsp): relative completions for bare import-mapped specifiers (#26137) +- fix(node): make `process.stdout.isTTY` writable (#26130) +- fix(node/util): export `styleText` from `node:util` (#26194) +- fix(npm): support `--allow-scripts` on `deno run` (and `deno add`, + `deno test`, etc) (#26075) +- fix(repl): importing json files (#26053) +- fix(repl): remove check flags (#26140) +- fix(unstable/worker): ensure import permissions are passed (#26101) +- fix: add hint for missing `document` global in terminal error (#26218) +- fix: do not panic on wsl share file paths on windows (#26081) +- fix: do not panic running remote cjs module (#26259) +- fix: do not panic when using methods on classes and interfaces in deno doc + html output (#26100) +- fix: improve suggestions and hints when using CommonJS modules (#26287) +- fix: node-api function call should use preamble (#26297) +- fix: panic in `prepare_stack_trace_callback` when global interceptor throws + (#26241) +- fix: use syntect for deno doc html generation (#26322) +- perf(http): avoid clone getting request method and url (#26250) +- perf(http): cache webidl.converters lookups in ext/fetch/23_response.js + (#26256) +- perf(http): make heap allocation for path conditional (#26289) +- perf: use fast calls for microtask ops (#26236) + ### 2.0.0 / 2024.10.09 Read announcement blog post at: https://deno.com/blog/v2 diff --git a/bench_util/Cargo.toml b/bench_util/Cargo.toml index 4b886a2907..a233e42118 100644 --- a/bench_util/Cargo.toml +++ b/bench_util/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_bench_util" -version = "0.165.0" +version = "0.166.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 8f733fc796..04546cc9f1 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno" -version = "2.0.0" +version = "2.0.1" authors.workspace = true default-run = "deno" edition.workspace = true diff --git a/cli/napi/sym/Cargo.toml b/cli/napi/sym/Cargo.toml index fef749fc46..287688e44f 100644 --- a/cli/napi/sym/Cargo.toml +++ b/cli/napi/sym/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "napi_sym" -version = "0.101.0" +version = "0.102.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/broadcast_channel/Cargo.toml b/ext/broadcast_channel/Cargo.toml index b19c4ce151..95d480d248 100644 --- a/ext/broadcast_channel/Cargo.toml +++ b/ext/broadcast_channel/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_broadcast_channel" -version = "0.165.0" +version = "0.166.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/cache/Cargo.toml b/ext/cache/Cargo.toml index 9d876fcb71..d0f260d9c3 100644 --- a/ext/cache/Cargo.toml +++ b/ext/cache/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_cache" -version = "0.103.0" +version = "0.104.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/canvas/Cargo.toml b/ext/canvas/Cargo.toml index 78c674348b..e88567ef13 100644 --- a/ext/canvas/Cargo.toml +++ b/ext/canvas/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_canvas" -version = "0.40.0" +version = "0.41.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/console/Cargo.toml b/ext/console/Cargo.toml index 5c143ca18c..d83afb1786 100644 --- a/ext/console/Cargo.toml +++ b/ext/console/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_console" -version = "0.171.0" +version = "0.172.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/cron/Cargo.toml b/ext/cron/Cargo.toml index 10f09b57cf..9aafa0b48c 100644 --- a/ext/cron/Cargo.toml +++ b/ext/cron/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_cron" -version = "0.51.0" +version = "0.52.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/crypto/Cargo.toml b/ext/crypto/Cargo.toml index c81c8f6a70..143f4b0098 100644 --- a/ext/crypto/Cargo.toml +++ b/ext/crypto/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_crypto" -version = "0.185.0" +version = "0.186.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/fetch/Cargo.toml b/ext/fetch/Cargo.toml index cc9e4f03d3..c8e2c858b6 100644 --- a/ext/fetch/Cargo.toml +++ b/ext/fetch/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_fetch" -version = "0.195.0" +version = "0.196.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/ffi/Cargo.toml b/ext/ffi/Cargo.toml index 496e8634ec..9bca9d98f2 100644 --- a/ext/ffi/Cargo.toml +++ b/ext/ffi/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_ffi" -version = "0.158.0" +version = "0.159.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/fs/Cargo.toml b/ext/fs/Cargo.toml index 606c00ad8c..904483c798 100644 --- a/ext/fs/Cargo.toml +++ b/ext/fs/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_fs" -version = "0.81.0" +version = "0.82.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/http/Cargo.toml b/ext/http/Cargo.toml index b7637bec33..f8e3bb38a2 100644 --- a/ext/http/Cargo.toml +++ b/ext/http/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_http" -version = "0.169.0" +version = "0.170.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/io/Cargo.toml b/ext/io/Cargo.toml index d45834a8fe..5a87977e05 100644 --- a/ext/io/Cargo.toml +++ b/ext/io/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_io" -version = "0.81.0" +version = "0.82.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/kv/Cargo.toml b/ext/kv/Cargo.toml index 14c3514ffd..8aee80c575 100644 --- a/ext/kv/Cargo.toml +++ b/ext/kv/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_kv" -version = "0.79.0" +version = "0.80.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/napi/Cargo.toml b/ext/napi/Cargo.toml index ade789ff80..5405d6280c 100644 --- a/ext/napi/Cargo.toml +++ b/ext/napi/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_napi" -version = "0.102.0" +version = "0.103.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/net/Cargo.toml b/ext/net/Cargo.toml index 9f72456b90..4ba4fb315e 100644 --- a/ext/net/Cargo.toml +++ b/ext/net/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_net" -version = "0.163.0" +version = "0.164.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/node/Cargo.toml b/ext/node/Cargo.toml index c5f07210b2..a6b778c1ae 100644 --- a/ext/node/Cargo.toml +++ b/ext/node/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_node" -version = "0.108.0" +version = "0.109.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/tls/Cargo.toml b/ext/tls/Cargo.toml index 9f7bffe67c..9c3d5b8047 100644 --- a/ext/tls/Cargo.toml +++ b/ext/tls/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_tls" -version = "0.158.0" +version = "0.159.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/url/Cargo.toml b/ext/url/Cargo.toml index ca4fa444da..f2e81becf0 100644 --- a/ext/url/Cargo.toml +++ b/ext/url/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_url" -version = "0.171.0" +version = "0.172.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/web/Cargo.toml b/ext/web/Cargo.toml index 4120e978e0..3d01e573d5 100644 --- a/ext/web/Cargo.toml +++ b/ext/web/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_web" -version = "0.202.0" +version = "0.203.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/webgpu/Cargo.toml b/ext/webgpu/Cargo.toml index 4c709b9c30..262351b817 100644 --- a/ext/webgpu/Cargo.toml +++ b/ext/webgpu/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_webgpu" -version = "0.138.0" +version = "0.139.0" authors = ["the Deno authors"] edition.workspace = true license = "MIT" diff --git a/ext/webidl/Cargo.toml b/ext/webidl/Cargo.toml index 8a25be3662..d5d4d9278b 100644 --- a/ext/webidl/Cargo.toml +++ b/ext/webidl/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_webidl" -version = "0.171.0" +version = "0.172.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/websocket/Cargo.toml b/ext/websocket/Cargo.toml index 6bef387b44..5bf217f13b 100644 --- a/ext/websocket/Cargo.toml +++ b/ext/websocket/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_websocket" -version = "0.176.0" +version = "0.177.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/webstorage/Cargo.toml b/ext/webstorage/Cargo.toml index bf9bbf23be..2707ccfe91 100644 --- a/ext/webstorage/Cargo.toml +++ b/ext/webstorage/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_webstorage" -version = "0.166.0" +version = "0.167.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/resolvers/deno/Cargo.toml b/resolvers/deno/Cargo.toml index 62504c8303..8cc93e79b3 100644 --- a/resolvers/deno/Cargo.toml +++ b/resolvers/deno/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_resolver" -version = "0.3.0" +version = "0.4.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/resolvers/node/Cargo.toml b/resolvers/node/Cargo.toml index f05b209fdb..5395253a4b 100644 --- a/resolvers/node/Cargo.toml +++ b/resolvers/node/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "node_resolver" -version = "0.10.0" +version = "0.11.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 6cb00a97e0..71b0c84c0f 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_runtime" -version = "0.180.0" +version = "0.181.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/runtime/permissions/Cargo.toml b/runtime/permissions/Cargo.toml index 8f0b0dd3de..16d4896c4c 100644 --- a/runtime/permissions/Cargo.toml +++ b/runtime/permissions/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_permissions" -version = "0.31.0" +version = "0.32.0" authors.workspace = true edition.workspace = true license.workspace = true From 458d6278d2835896018086da773fd72b7af8ed66 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:42:15 -0700 Subject: [PATCH 3/4] fix(node/http): normalize header names in `ServerResponse` (#26339) Fixes https://github.com/denoland/deno/issues/26115. We weren't normalizing the headers to lower case, so code that attempted to delete the `Content-Length` header (but used a different case) wasn't actually removing the header. --- ext/node/polyfills/http.ts | 19 ++++++++++--------- tests/unit_node/http_test.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index 349caeea69..e117a0ec24 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -72,7 +72,7 @@ import { STATUS_CODES } from "node:_http_server"; import { methods as METHODS } from "node:_http_common"; const { internalRidSymbol } = core; -const { ArrayIsArray } = primordials; +const { ArrayIsArray, StringPrototypeToLowerCase } = primordials; type Chunk = string | Buffer | Uint8Array; @@ -1270,20 +1270,21 @@ export class ServerResponse extends NodeWritable { if (Array.isArray(value)) { this.#hasNonStringHeaders = true; } - this.#headers[name] = value; + this.#headers[StringPrototypeToLowerCase(name)] = value; return this; } appendHeader(name: string, value: string | string[]) { - if (this.#headers[name] === undefined) { + const key = StringPrototypeToLowerCase(name); + if (this.#headers[key] === undefined) { if (Array.isArray(value)) this.#hasNonStringHeaders = true; - this.#headers[name] = value; + this.#headers[key] = value; } else { this.#hasNonStringHeaders = true; - if (!Array.isArray(this.#headers[name])) { - this.#headers[name] = [this.#headers[name]]; + if (!Array.isArray(this.#headers[key])) { + this.#headers[key] = [this.#headers[key]]; } - const header = this.#headers[name]; + const header = this.#headers[key]; if (Array.isArray(value)) { header.push(...value); } else { @@ -1294,10 +1295,10 @@ export class ServerResponse extends NodeWritable { } getHeader(name: string) { - return this.#headers[name]; + return this.#headers[StringPrototypeToLowerCase(name)]; } removeHeader(name: string) { - delete this.#headers[name]; + delete this.#headers[StringPrototypeToLowerCase(name)]; } getHeaderNames() { return Object.keys(this.#headers); diff --git a/tests/unit_node/http_test.ts b/tests/unit_node/http_test.ts index f1ff77bb34..0faf7fb345 100644 --- a/tests/unit_node/http_test.ts +++ b/tests/unit_node/http_test.ts @@ -1147,6 +1147,34 @@ Deno.test("[node/http] ServerResponse appendHeader set-cookie", async () => { await promise; }); +Deno.test("[node/http] ServerResponse header names case insensitive", async () => { + const { promise, resolve } = Promise.withResolvers(); + const server = http.createServer((_req, res) => { + res.setHeader("Content-Length", "12345"); + res.removeHeader("content-length"); + assertEquals(res.getHeader("Content-Length"), undefined); + assert(!res.hasHeader("Content-Length")); + res.appendHeader("content-length", "12345"); + res.removeHeader("Content-Length"); + assertEquals(res.getHeader("content-length"), undefined); + assert(!res.hasHeader("content-length")); + res.end("Hello World"); + }); + + server.listen(async () => { + const { port } = server.address() as { port: number }; + const res = await fetch(`http://localhost:${port}`); + assertEquals(res.headers.get("Content-Length"), null); + assertEquals(res.headers.get("content-length"), null); + assertEquals(await res.text(), "Hello World"); + server.close(() => { + resolve(); + }); + }); + + await promise; +}); + Deno.test("[node/http] IncomingMessage override", () => { const req = new http.IncomingMessage(new net.Socket()); // https://github.com/dougmoscrop/serverless-http/blob/3aaa6d0fe241109a8752efb011c242d249f32368/lib/request.js#L20-L30 From 167f674c7cbb9632000c1feb0b747ba098b01c12 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Wed, 16 Oct 2024 19:58:11 -0700 Subject: [PATCH 4/4] fix: don't warn on ignored signals on windows (#26332) Closes #26183. The warnings are super noisy and not actionable for the user --- ext/node/polyfills/process.ts | 4 +--- tests/unit_node/process_test.ts | 28 ---------------------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts index 3dc6ce61aa..2605fa6d1a 100644 --- a/ext/node/polyfills/process.ts +++ b/ext/node/polyfills/process.ts @@ -520,9 +520,7 @@ Process.prototype.on = function ( } else if ( event !== "SIGBREAK" && event !== "SIGINT" && Deno.build.os === "windows" ) { - // Ignores all signals except SIGBREAK and SIGINT on windows. - // deno-lint-ignore no-console - console.warn(`Ignoring signal "${event}" on Windows`); + // TODO(#26331): Ignores all signals except SIGBREAK and SIGINT on windows. } else { EventEmitter.prototype.on.call(this, event, listener); Deno.addSignalListener(event as Deno.Signal, listener); diff --git a/tests/unit_node/process_test.ts b/tests/unit_node/process_test.ts index 9506fb6091..f9138c8f08 100644 --- a/tests/unit_node/process_test.ts +++ b/tests/unit_node/process_test.ts @@ -25,7 +25,6 @@ import { assertThrows, fail, } from "@std/assert"; -import { assertSpyCall, assertSpyCalls, spy } from "@std/testing/mock"; import { stripAnsiCode } from "@std/fmt/colors"; import * as path from "@std/path"; import { delay } from "@std/async/delay"; @@ -239,33 +238,6 @@ Deno.test({ }, }); -Deno.test({ - name: "process.on - ignored signals on windows", - ignore: Deno.build.os !== "windows", - fn() { - const ignoredSignals = ["SIGHUP", "SIGUSR1", "SIGUSR2"]; - - for (const signal of ignoredSignals) { - using consoleSpy = spy(console, "warn"); - const handler = () => {}; - process.on(signal, handler); - process.off(signal, handler); - assertSpyCall(consoleSpy, 0, { - args: [`Ignoring signal "${signal}" on Windows`], - }); - } - - { - using consoleSpy = spy(console, "warn"); - const handler = () => {}; - process.on("SIGTERM", handler); - process.off("SIGTERM", handler); - // No warning is made for SIGTERM - assertSpyCalls(consoleSpy, 0); - } - }, -}); - Deno.test( { permissions: { run: true, read: true } }, async function processKill() {