1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-01 16:51:13 -05:00

Merge branch 'main' into support_create_connection

Signed-off-by: Yoshiya Hinosawa <stibium121@gmail.com>
This commit is contained in:
Yoshiya Hinosawa 2024-10-17 12:00:57 +09:00 committed by GitHub
commit 16be0202ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 510 additions and 144 deletions

View file

@ -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";

View file

@ -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

58
Cargo.lock generated
View file

@ -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",

View file

@ -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"

View file

@ -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:<pkg>` (#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

View file

@ -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

View file

@ -2,7 +2,7 @@
[package]
name = "deno"
version = "2.0.0"
version = "2.0.1"
authors.workspace = true
default-run = "deno"
edition.workspace = true

View file

@ -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<Value>) = client.read_notification();
assert_eq!(method, "deno/didRefreshDenoConfigurationTree");
client.change_configuration(json!({ "deno": { "enable": true } }));
let (method, _): (String, Option<Value>) = 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<Value>) = 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<Value>) = 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<Value>) = client.read_notification();
assert_eq!(method, "deno/didRefreshDenoConfigurationTree");
client.change_configuration(json!({ "deno": { "enable": true } }));
let (method, _): (String, Option<Value>) = 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<Value>) = client.read_notification();
assert_eq!(method, "deno/didRefreshDenoConfigurationTree");
client.change_configuration(json!({ "deno": { "enable": true } }));
let (method, _): (String, Option<Value>) = client.read_notification();
assert_eq!(method, "deno/didRefreshDenoConfigurationTree");
client.write_notification(
"textDocument/didOpen",

View file

@ -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<Value>) = client.read_notification();
assert_eq!(method, "deno/didRefreshDenoConfigurationTree");
client.change_configuration(json!({ "deno": { "enable": true } }));
let (method, _): (String, Option<Value>) = client.read_notification();
assert_eq!(method, "deno/didRefreshDenoConfigurationTree");
client.write_notification(
"textDocument/didOpen",

View file

@ -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,

View file

@ -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::<lsp_custom::DidRefreshDenoConfigurationTreeNotification>(
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,

View file

@ -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,

View file

@ -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;

View file

@ -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<lsp::Uri>,
pub deno_json: Option<lsp::TextDocumentIdentifier>,
pub package_json: Option<lsp::TextDocumentIdentifier>,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DidRefreshDenoConfigurationTreeNotificationParams {
pub data: Vec<DenoConfigurationData>,
}
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<DenoConfigurationChangeEvent>,
}
// 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";
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -70,7 +70,7 @@ import { TcpConn } from "ext:deno_net/01_net.js";
import { STATUS_CODES } from "node:_http_server";
import { methods as METHODS } from "node:_http_common";
const { ArrayIsArray } = primordials;
const { ArrayIsArray, StringPrototypeToLowerCase } = primordials;
type Chunk = string | Buffer | Uint8Array;
@ -1360,20 +1360,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 {
@ -1384,10 +1385,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);

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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::<Value>(
"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::<Value>(
"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::<Value>(
"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::<Value>("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.

View file

@ -1159,6 +1159,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<void>();
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

View file

@ -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() {