diff --git a/.dprint.json b/.dprint.json index b9c2d1ebc1..bd1279fd4a 100644 --- a/.dprint.json +++ b/.dprint.json @@ -13,7 +13,7 @@ }, "exec": { "commands": [{ - "command": "rustfmt --config imports_granularity=item", + "command": "rustfmt --config imports_granularity=item --config group_imports=StdExternalCrate", "exts": ["rs"] }] }, diff --git a/.github/mtime_cache/action.js b/.github/mtime_cache/action.js index 72821749e3..1bf5b492fc 100644 --- a/.github/mtime_cache/action.js +++ b/.github/mtime_cache/action.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This file contains the implementation of a Github Action. Github uses // Node.js v20.x to run actions, so this is Node code and not Deno code. diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index bc3f15380b..cf023a6feb 100755 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --allow-write=. --lock=./tools/deno.lock.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { stringify } from "jsr:@std/yaml@^0.221/stringify"; // Bump this number when you want to purge the cache. @@ -716,6 +716,19 @@ const ci = { "df -h", ].join("\n"), }, + { + name: "Build denort release", + if: [ + "matrix.job == 'test' &&", + "matrix.profile == 'release' &&", + "github.repository == 'denoland/deno'", + ].join("\n"), + run: [ + "df -h", + "cargo build --profile=release-slim --locked --bin denort", + "df -h", + ].join("\n"), + }, { // Run a minimal check to ensure that binary is not corrupted, regardless // of our build mode @@ -762,10 +775,11 @@ const ci = { "cd target/release", "zip -r deno-${{ matrix.arch }}-unknown-linux-gnu.zip deno", "shasum -a 256 deno-${{ matrix.arch }}-unknown-linux-gnu.zip > deno-${{ matrix.arch }}-unknown-linux-gnu.zip.sha256sum", - "strip denort", - "zip -r denort-${{ matrix.arch }}-unknown-linux-gnu.zip denort", - "shasum -a 256 denort-${{ matrix.arch }}-unknown-linux-gnu.zip > denort-${{ matrix.arch }}-unknown-linux-gnu.zip.sha256sum", "./deno types > lib.deno.d.ts", + "cd ../release-slim", + "zip -r ../release/denort-${{ matrix.arch }}-unknown-linux-gnu.zip denort", + "cd ../release", + "shasum -a 256 denort-${{ matrix.arch }}-unknown-linux-gnu.zip > denort-${{ matrix.arch }}-unknown-linux-gnu.zip.sha256sum", ].join("\n"), }, { @@ -790,8 +804,9 @@ const ci = { "cd target/release", "zip -r deno-${{ matrix.arch }}-apple-darwin.zip deno", "shasum -a 256 deno-${{ matrix.arch }}-apple-darwin.zip > deno-${{ matrix.arch }}-apple-darwin.zip.sha256sum", - "strip denort", - "zip -r denort-${{ matrix.arch }}-apple-darwin.zip denort", + "cd ../release-slim", + "zip -r ../release/denort-${{ matrix.arch }}-apple-darwin.zip denort", + "cd ../release", "shasum -a 256 denort-${{ matrix.arch }}-apple-darwin.zip > denort-${{ matrix.arch }}-apple-darwin.zip.sha256sum", ] .join("\n"), @@ -808,7 +823,8 @@ const ci = { run: [ "Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-${{ matrix.arch }}-pc-windows-msvc.zip", "Get-FileHash target/release/deno-${{ matrix.arch }}-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/deno-${{ matrix.arch }}-pc-windows-msvc.zip.sha256sum", - "Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.exe -DestinationPath target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip", + + "Compress-Archive -CompressionLevel Optimal -Force -Path target/release-slim/denort.exe -DestinationPath target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip", "Get-FileHash target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip.sha256sum", ].join("\n"), }, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc1aa89669..bcf83f0f13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -419,6 +419,15 @@ jobs: df -h cargo build --release --locked --all-targets df -h + - name: Build denort release + if: |- + !(matrix.skip) && (matrix.job == 'test' && + matrix.profile == 'release' && + github.repository == 'denoland/deno') + run: |- + df -h + cargo build --profile=release-slim --locked --bin denort + df -h - name: Check deno binary if: '!(matrix.skip) && (matrix.job == ''test'')' run: 'target/${{ matrix.profile }}/deno eval "console.log(1+2)" | grep 3' @@ -448,10 +457,11 @@ jobs: cd target/release zip -r deno-${{ matrix.arch }}-unknown-linux-gnu.zip deno shasum -a 256 deno-${{ matrix.arch }}-unknown-linux-gnu.zip > deno-${{ matrix.arch }}-unknown-linux-gnu.zip.sha256sum - strip denort - zip -r denort-${{ matrix.arch }}-unknown-linux-gnu.zip denort - shasum -a 256 denort-${{ matrix.arch }}-unknown-linux-gnu.zip > denort-${{ matrix.arch }}-unknown-linux-gnu.zip.sha256sum ./deno types > lib.deno.d.ts + cd ../release-slim + zip -r ../release/denort-${{ matrix.arch }}-unknown-linux-gnu.zip denort + cd ../release + shasum -a 256 denort-${{ matrix.arch }}-unknown-linux-gnu.zip > denort-${{ matrix.arch }}-unknown-linux-gnu.zip.sha256sum - name: Pre-release (mac) if: |- !(matrix.skip) && (matrix.os == 'macos' && @@ -467,8 +477,9 @@ jobs: cd target/release zip -r deno-${{ matrix.arch }}-apple-darwin.zip deno shasum -a 256 deno-${{ matrix.arch }}-apple-darwin.zip > deno-${{ matrix.arch }}-apple-darwin.zip.sha256sum - strip denort - zip -r denort-${{ matrix.arch }}-apple-darwin.zip denort + cd ../release-slim + zip -r ../release/denort-${{ matrix.arch }}-apple-darwin.zip denort + cd ../release shasum -a 256 denort-${{ matrix.arch }}-apple-darwin.zip > denort-${{ matrix.arch }}-apple-darwin.zip.sha256sum - name: Pre-release (windows) if: |- @@ -480,7 +491,7 @@ jobs: run: |- Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-${{ matrix.arch }}-pc-windows-msvc.zip Get-FileHash target/release/deno-${{ matrix.arch }}-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/deno-${{ matrix.arch }}-pc-windows-msvc.zip.sha256sum - Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.exe -DestinationPath target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip + Compress-Archive -CompressionLevel Optimal -Force -Path target/release-slim/denort.exe -DestinationPath target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip Get-FileHash target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip.sha256sum - name: Upload canary to dl.deno.land if: |- diff --git a/Cargo.lock b/Cargo.lock index 26b84f9ce5..9f78066013 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1736,14 +1736,12 @@ dependencies = [ "deno_path_util 0.3.0", "deno_permissions", "filetime", - "getrandom", "junction", "libc", "nix", "rand", "rayon", "serde", - "sys_traits", "thiserror 2.0.3", "winapi", "windows-sys 0.59.0", @@ -2041,6 +2039,7 @@ dependencies = [ "sm3", "spki", "stable_deref_trait", + "sys_traits", "thiserror 2.0.3", "tokio", "tokio-eld", @@ -2260,6 +2259,7 @@ dependencies = [ "serde", "signal-hook", "signal-hook-registry", + "sys_traits", "tempfile", "test_server", "thiserror 2.0.3", @@ -7679,12 +7679,14 @@ dependencies = [ [[package]] name = "sys_traits" -version = "0.1.1" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5a12729b699487bb50163466e87be7197871d83d04cc6815d430cf7c893bbd7" +checksum = "6683465f4e1d8fd75069cbc36c646258c05b7d8d6676bcb5d71968b99b7d5ae2" dependencies = [ + "filetime", "getrandom", "libc", + "parking_lot", "windows-sys 0.59.0", ] diff --git a/Cargo.toml b/Cargo.toml index a41ff4c775..83bc3ec37b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [workspace] resolver = "2" @@ -194,7 +194,7 @@ slab = "0.4" smallvec = "1.8" socket2 = { version = "0.5.3", features = ["all"] } spki = "0.7.2" -sys_traits = "=0.1.1" +sys_traits = "=0.1.4" tar = "=0.4.40" tempfile = "3.4.0" termcolor = "1.1.3" @@ -252,6 +252,11 @@ incremental = true lto = true opt-level = 'z' # Optimize for size +[profile.release-slim] +inherits = "release" +panic = "abort" +strip = "symbols" + # Build release with debug symbols: cargo build --profile=release-with-debug [profile.release-with-debug] inherits = "release" diff --git a/LICENSE.md b/LICENSE.md index 56753af367..406ae09364 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright 2018-2024 the Deno authors +Copyright 2018-2025 the Deno authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/bench_util/Cargo.toml b/bench_util/Cargo.toml index 014b74f264..3172426c27 100644 --- a/bench_util/Cargo.toml +++ b/bench_util/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_bench_util" diff --git a/bench_util/README.md b/bench_util/README.md index 12474a86b6..30616a08fd 100644 --- a/bench_util/README.md +++ b/bench_util/README.md @@ -7,7 +7,6 @@ use deno_bench_util::bench_js_sync; use deno_bench_util::bench_or_profile; use deno_bench_util::bencher::benchmark_group; use deno_bench_util::bencher::Bencher; - use deno_core::Extension; #[op2] diff --git a/bench_util/benches/utf8.rs b/bench_util/benches/utf8.rs index 48af4dba7e..88afce86c3 100644 --- a/bench_util/benches/utf8.rs +++ b/bench_util/benches/utf8.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_bench_util::bench_js_sync_with; use deno_bench_util::bench_or_profile; diff --git a/bench_util/js_runtime.rs b/bench_util/js_runtime.rs index a97d8ae501..402c9a4b00 100644 --- a/bench_util/js_runtime.rs +++ b/bench_util/js_runtime.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use bencher::Bencher; use deno_core::v8; use deno_core::Extension; diff --git a/bench_util/lib.rs b/bench_util/lib.rs index 39183be7fc..22587a5f7e 100644 --- a/bench_util/lib.rs +++ b/bench_util/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod js_runtime; mod profiling; diff --git a/bench_util/profiling.rs b/bench_util/profiling.rs index 151a29e599..1d2bfb51d2 100644 --- a/bench_util/profiling.rs +++ b/bench_util/profiling.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use bencher::DynBenchFn; use bencher::StaticBenchFn; use bencher::TestDescAndFn; diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 2cf12f14d4..3ca1afc872 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno" @@ -158,7 +158,7 @@ shell-escape = "=0.1.5" spki = { version = "0.7", features = ["pem"] } sqlformat = "=0.3.2" strsim = "0.11.1" -sys_traits = { workspace = true, features = ["libc", "real", "winapi"] } +sys_traits = { workspace = true, features = ["getrandom", "filetime", "libc", "real", "strip_unc", "winapi"] } tar.workspace = true tempfile.workspace = true text-size = "=1.1.0" @@ -187,6 +187,7 @@ nix.workspace = true [dev-dependencies] deno_bench_util.workspace = true pretty_assertions.workspace = true +sys_traits = { workspace = true, features = ["memory"] } test_util.workspace = true [package.metadata.winres] diff --git a/cli/args/deno_json.rs b/cli/args/deno_json.rs index 47dcbb91ea..c27b1d3924 100644 --- a/cli/args/deno_json.rs +++ b/cli/args/deno_json.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashSet; diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 1058dcea94..4676c9e349 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::collections::HashSet; @@ -43,11 +43,10 @@ use log::Level; use serde::Deserialize; use serde::Serialize; -use crate::args::resolve_no_prompt; -use crate::util::fs::canonicalize_path; - use super::flags_net; use super::jsr_url; +use crate::args::resolve_no_prompt; +use crate::util::fs::canonicalize_path; #[derive(Clone, Debug, Default, Eq, PartialEq)] pub enum ConfigFlag { @@ -6067,9 +6066,10 @@ pub fn resolve_urls(urls: Vec) -> Vec { #[cfg(test)] mod tests { - use super::*; use pretty_assertions::assert_eq; + use super::*; + /// Creates vector of strings, Vec macro_rules! svec { ($($x:expr),* $(,)?) => (vec![$($x.to_string().into()),*]); diff --git a/cli/args/flags_net.rs b/cli/args/flags_net.rs index abfcf28382..c39e377e10 100644 --- a/cli/args/flags_net.rs +++ b/cli/args/flags_net.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::net::IpAddr; +use std::str::FromStr; use deno_core::url::Url; use deno_runtime::deno_permissions::NetDescriptor; -use std::net::IpAddr; -use std::str::FromStr; #[derive(Debug, PartialEq, Eq)] pub struct ParsePortError(String); diff --git a/cli/args/import_map.rs b/cli/args/import_map.rs index d6434ed46a..ff7e42ef20 100644 --- a/cli/args/import_map.rs +++ b/cli/args/import_map.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::error::AnyError; use deno_core::serde_json; diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs index 0648b6e5ed..bc4c92638a 100644 --- a/cli/args/lockfile.rs +++ b/cli/args/lockfile.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashSet; use std::path::PathBuf; @@ -10,21 +10,19 @@ use deno_core::error::AnyError; use deno_core::parking_lot::Mutex; use deno_core::parking_lot::MutexGuard; use deno_core::serde_json; +use deno_lockfile::Lockfile; use deno_lockfile::WorkspaceMemberConfig; use deno_package_json::PackageJsonDepValue; use deno_path_util::fs::atomic_write_file_with_retries; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::PackageJson; use deno_semver::jsr::JsrDepPackageReq; use crate::args::deno_json::import_map_deps; -use crate::cache; -use crate::Flags; - use crate::args::DenoSubcommand; use crate::args::InstallFlags; - -use deno_lockfile::Lockfile; +use crate::cache; +use crate::sys::CliSys; +use crate::Flags; #[derive(Debug)] pub struct CliLockfileReadFromPathOptions { @@ -36,6 +34,7 @@ pub struct CliLockfileReadFromPathOptions { #[derive(Debug)] pub struct CliLockfile { + sys: CliSys, lockfile: Mutex, pub filename: PathBuf, frozen: bool, @@ -92,7 +91,7 @@ impl CliLockfile { // do an atomic write to reduce the chance of multiple deno // processes corrupting the file atomic_write_file_with_retries( - &FsSysTraitsAdapter::new_real(), + &self.sys, &lockfile.filename, &bytes, cache::CACHE_PERM, @@ -103,6 +102,7 @@ impl CliLockfile { } pub fn discover( + sys: &CliSys, flags: &Flags, workspace: &Workspace, maybe_external_import_map: Option<&serde_json::Value>, @@ -165,11 +165,14 @@ impl CliLockfile { .unwrap_or(false) }); - let lockfile = Self::read_from_path(CliLockfileReadFromPathOptions { - file_path, - frozen, - skip_write: flags.internal.lockfile_skip_write, - })?; + let lockfile = Self::read_from_path( + sys, + CliLockfileReadFromPathOptions { + file_path, + frozen, + skip_write: flags.internal.lockfile_skip_write, + }, + )?; // initialize the lockfile with the workspace's configuration let root_url = workspace.root_dir(); @@ -225,6 +228,7 @@ impl CliLockfile { } pub fn read_from_path( + sys: &CliSys, opts: CliLockfileReadFromPathOptions, ) -> Result { let lockfile = match std::fs::read_to_string(&opts.file_path) { @@ -243,6 +247,7 @@ impl CliLockfile { } }; Ok(CliLockfile { + sys: sys.clone(), filename: lockfile.filename.clone(), lockfile: Mutex::new(lockfile), frozen: opts.frozen, diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 1354068ebc..90891c11e7 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub mod deno_json; mod flags; @@ -7,71 +7,6 @@ mod import_map; mod lockfile; mod package_json; -use deno_ast::MediaType; -use deno_ast::SourceMapOption; -use deno_cache_dir::file_fetcher::CacheSetting; -use deno_config::deno_json::NodeModulesDirMode; -use deno_config::workspace::CreateResolverOptions; -use deno_config::workspace::FolderConfigs; -use deno_config::workspace::PackageJsonDepResolution; -use deno_config::workspace::VendorEnablement; -use deno_config::workspace::Workspace; -use deno_config::workspace::WorkspaceDirectory; -use deno_config::workspace::WorkspaceDirectoryEmptyOptions; -use deno_config::workspace::WorkspaceDiscoverOptions; -use deno_config::workspace::WorkspaceDiscoverStart; -use deno_config::workspace::WorkspaceLintConfig; -use deno_config::workspace::WorkspaceResolver; -use deno_core::resolve_url_or_path; -use deno_graph::GraphKind; -use deno_lint::linter::LintConfig as DenoLintConfig; -use deno_npm::npm_rc::NpmRc; -use deno_npm::npm_rc::ResolvedNpmRc; -use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot; -use deno_npm::NpmSystemInfo; -use deno_path_util::normalize_path; -use deno_runtime::deno_fs::FsSysTraitsAdapter; -use deno_semver::npm::NpmPackageReqReference; -use deno_semver::StackString; -use deno_telemetry::OtelConfig; -use deno_telemetry::OtelRuntimeConfig; -use import_map::resolve_import_map_value_from_specifier; - -pub use deno_config::deno_json::BenchConfig; -pub use deno_config::deno_json::ConfigFile; -pub use deno_config::deno_json::FmtOptionsConfig; -pub use deno_config::deno_json::LintRulesConfig; -pub use deno_config::deno_json::ProseWrap; -pub use deno_config::deno_json::TsConfig; -pub use deno_config::deno_json::TsConfigForEmit; -pub use deno_config::deno_json::TsConfigType; -pub use deno_config::deno_json::TsTypeLib; -pub use deno_config::glob::FilePatterns; -pub use deno_json::check_warn_tsconfig; -pub use flags::*; -pub use lockfile::CliLockfile; -pub use lockfile::CliLockfileReadFromPathOptions; -pub use package_json::NpmInstallDepsProvider; -pub use package_json::PackageJsonDepValueParseWithLocationError; - -use deno_ast::ModuleSpecifier; -use deno_core::anyhow::bail; -use deno_core::anyhow::Context; -use deno_core::error::AnyError; -use deno_core::serde_json; -use deno_core::url::Url; -use deno_runtime::deno_permissions::PermissionsOptions; -use deno_runtime::deno_tls::deno_native_certs::load_native_certs; -use deno_runtime::deno_tls::rustls; -use deno_runtime::deno_tls::rustls::RootCertStore; -use deno_runtime::deno_tls::rustls_pemfile; -use deno_runtime::deno_tls::webpki_roots; -use deno_runtime::inspector_server::InspectorServer; -use deno_terminal::colors; -use dotenvy::from_filename; -use once_cell::sync::Lazy; -use serde::Deserialize; -use serde::Serialize; use std::borrow::Cow; use std::collections::BTreeSet; use std::collections::HashMap; @@ -84,18 +19,81 @@ use std::net::SocketAddr; use std::path::Path; use std::path::PathBuf; use std::sync::Arc; + +use deno_ast::MediaType; +use deno_ast::ModuleSpecifier; +use deno_ast::SourceMapOption; +use deno_cache_dir::file_fetcher::CacheSetting; +pub use deno_config::deno_json::BenchConfig; +pub use deno_config::deno_json::ConfigFile; +use deno_config::deno_json::FmtConfig; +pub use deno_config::deno_json::FmtOptionsConfig; +use deno_config::deno_json::LintConfig; +pub use deno_config::deno_json::LintRulesConfig; +use deno_config::deno_json::NodeModulesDirMode; +pub use deno_config::deno_json::ProseWrap; +use deno_config::deno_json::TestConfig; +pub use deno_config::deno_json::TsConfig; +pub use deno_config::deno_json::TsConfigForEmit; +pub use deno_config::deno_json::TsConfigType; +pub use deno_config::deno_json::TsTypeLib; +pub use deno_config::glob::FilePatterns; +use deno_config::workspace::CreateResolverOptions; +use deno_config::workspace::FolderConfigs; +use deno_config::workspace::PackageJsonDepResolution; +use deno_config::workspace::VendorEnablement; +use deno_config::workspace::Workspace; +use deno_config::workspace::WorkspaceDirectory; +use deno_config::workspace::WorkspaceDirectoryEmptyOptions; +use deno_config::workspace::WorkspaceDiscoverOptions; +use deno_config::workspace::WorkspaceDiscoverStart; +use deno_config::workspace::WorkspaceLintConfig; +use deno_config::workspace::WorkspaceResolver; +use deno_core::anyhow::bail; +use deno_core::anyhow::Context; +use deno_core::error::AnyError; +use deno_core::resolve_url_or_path; +use deno_core::serde_json; +use deno_core::url::Url; +use deno_graph::GraphKind; +pub use deno_json::check_warn_tsconfig; +use deno_lint::linter::LintConfig as DenoLintConfig; +use deno_npm::npm_rc::NpmRc; +use deno_npm::npm_rc::ResolvedNpmRc; +use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot; +use deno_npm::NpmSystemInfo; +use deno_path_util::normalize_path; +use deno_runtime::deno_permissions::PermissionsOptions; +use deno_runtime::deno_tls::deno_native_certs::load_native_certs; +use deno_runtime::deno_tls::rustls; +use deno_runtime::deno_tls::rustls::RootCertStore; +use deno_runtime::deno_tls::rustls_pemfile; +use deno_runtime::deno_tls::webpki_roots; +use deno_runtime::inspector_server::InspectorServer; +use deno_semver::npm::NpmPackageReqReference; +use deno_semver::StackString; +use deno_telemetry::OtelConfig; +use deno_telemetry::OtelRuntimeConfig; +use deno_terminal::colors; +use dotenvy::from_filename; +pub use flags::*; +use import_map::resolve_import_map_value_from_specifier; +pub use lockfile::CliLockfile; +pub use lockfile::CliLockfileReadFromPathOptions; +use once_cell::sync::Lazy; +pub use package_json::NpmInstallDepsProvider; +pub use package_json::PackageJsonDepValueParseWithLocationError; +use serde::Deserialize; +use serde::Serialize; use sys_traits::EnvHomeDir; use thiserror::Error; use crate::cache::DenoDirProvider; use crate::file_fetcher::CliFileFetcher; +use crate::sys::CliSys; use crate::util::fs::canonicalize_path_maybe_not_exists; use crate::version; -use deno_config::deno_json::FmtConfig; -use deno_config::deno_json::LintConfig; -use deno_config::deno_json::TestConfig; - pub fn npm_registry_url() -> &'static Url { static NPM_REGISTRY_DEFAULT_URL: Lazy = Lazy::new(|| { let env_var_name = "NPM_CONFIG_REGISTRY"; @@ -522,7 +520,7 @@ fn discover_npmrc( // TODO(bartlomieju): update to read both files - one in the project root and one and // home dir and then merge them. // 3. Try `.npmrc` in the user's home directory - if let Some(home_dir) = sys_traits::impls::RealSys.env_home_dir() { + if let Some(home_dir) = crate::sys::CliSys::default().env_home_dir() { match try_to_read_npmrc(&home_dir) { Ok(Some((source, path))) => { return try_to_parse_npmrc(source, &path).map(|r| (r, Some(path))); @@ -739,6 +737,7 @@ pub struct CliOptions { npmrc: Arc, maybe_lockfile: Option>, maybe_external_import_map: Option<(PathBuf, serde_json::Value)>, + sys: CliSys, overrides: CliOptionOverrides, pub start_dir: Arc, pub deno_dir_provider: Arc, @@ -748,6 +747,7 @@ pub struct CliOptions { impl CliOptions { #[allow(clippy::too_many_arguments)] pub fn new( + sys: &CliSys, flags: Arc, initial_cwd: PathBuf, maybe_lockfile: Option>, @@ -773,8 +773,10 @@ impl CliOptions { } let maybe_lockfile = maybe_lockfile.filter(|_| !force_global_cache); - let deno_dir_provider = - Arc::new(DenoDirProvider::new(flags.internal.cache_path.clone())); + let deno_dir_provider = Arc::new(DenoDirProvider::new( + sys.clone(), + flags.internal.cache_path.clone(), + )); let maybe_node_modules_folder = resolve_node_modules_folder( &initial_cwd, &flags, @@ -796,11 +798,12 @@ impl CliOptions { maybe_external_import_map, start_dir, deno_dir_provider, + sys: sys.clone(), scope_options, }) } - pub fn from_flags(flags: Arc) -> Result { + pub fn from_flags(sys: &CliSys, flags: Arc) -> Result { let initial_cwd = std::env::current_dir().with_context(|| "Failed getting cwd.")?; let maybe_vendor_override = flags.vendor.map(|v| match v { @@ -844,7 +847,7 @@ impl CliOptions { ConfigFlag::Discover => { if let Some(start_paths) = flags.config_path_args(&initial_cwd) { WorkspaceDirectory::discover( - &FsSysTraitsAdapter::new_real(), + sys, WorkspaceDiscoverStart::Paths(&start_paths), &resolve_workspace_discover_options(), )? @@ -855,7 +858,7 @@ impl CliOptions { ConfigFlag::Path(path) => { let config_path = normalize_path(initial_cwd.join(path)); WorkspaceDirectory::discover( - &FsSysTraitsAdapter::new_real(), + sys, WorkspaceDiscoverStart::ConfigFile(&config_path), &resolve_workspace_discover_options(), )? @@ -879,6 +882,7 @@ impl CliOptions { }; let maybe_lock_file = CliLockfile::discover( + sys, &flags, &start_dir.workspace, external_import_map.as_ref().map(|(_, v)| v), @@ -887,6 +891,7 @@ impl CliOptions { log::debug!("Finished config loading."); Self::new( + sys, flags, initial_cwd, maybe_lock_file.map(Arc::new), @@ -911,11 +916,13 @@ impl CliOptions { None }; let lockfile = CliLockfile::discover( + &self.sys, &self.flags, &start_dir.workspace, external_import_map.as_ref().map(|(_, v)| v), )?; Self::new( + &self.sys, self.flags.clone(), self.initial_cwd().to_path_buf(), lockfile.map(Arc::new), diff --git a/cli/args/package_json.rs b/cli/args/package_json.rs index 50d1c04799..efa5d46966 100644 --- a/cli/args/package_json.rs +++ b/cli/args/package_json.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::path::PathBuf; use std::sync::Arc; diff --git a/cli/bench/cache_api.js b/cli/bench/cache_api.js index af55fc132e..4b092ab627 100644 --- a/cli/bench/cache_api.js +++ b/cli/bench/cache_api.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. const cacheName = "cache-v1"; const cache = await caches.open(cacheName); diff --git a/cli/bench/command.js b/cli/bench/command.js index 5b7c300d26..5916dcfee2 100644 --- a/cli/bench/command.js +++ b/cli/bench/command.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. Deno.bench("echo deno", async () => { await new Deno.Command("echo", { args: ["deno"] }).output(); diff --git a/cli/bench/console.js b/cli/bench/console.js index 1d336fbbde..c1704549c6 100644 --- a/cli/bench/console.js +++ b/cli/bench/console.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/cli/bench/deno_common.js b/cli/bench/deno_common.js index 3693333915..011a1244aa 100644 --- a/cli/bench/deno_common.js +++ b/cli/bench/deno_common.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // v8 builtin that's close to the upper bound non-NOPs Deno.bench("date_now", { n: 5e5 }, () => { diff --git a/cli/bench/encode_into.js b/cli/bench/encode_into.js index ab5e11b04d..57313ca04a 100644 --- a/cli/bench/encode_into.js +++ b/cli/bench/encode_into.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console no-process-globals let [total, count] = typeof Deno !== "undefined" diff --git a/cli/bench/fs/run.mjs b/cli/bench/fs/run.mjs index 94240f20d4..7f080daf6a 100644 --- a/cli/bench/fs/run.mjs +++ b/cli/bench/fs/run.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. let total = 5; let current = ""; diff --git a/cli/bench/fs/serve.jsx b/cli/bench/fs/serve.jsx index 51125235fe..8b3328617a 100644 --- a/cli/bench/fs/serve.jsx +++ b/cli/bench/fs/serve.jsx @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /** @jsx h */ import results from "./deno.json" assert { type: "json" }; diff --git a/cli/bench/getrandom.js b/cli/bench/getrandom.js index fe99bbcbdf..775d02fc75 100644 --- a/cli/bench/getrandom.js +++ b/cli/bench/getrandom.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console no-process-globals let [total, count] = typeof Deno !== "undefined" diff --git a/cli/bench/lsp.rs b/cli/bench/lsp.rs index 7baaffca7e..7a93dcae1e 100644 --- a/cli/bench/lsp.rs +++ b/cli/bench/lsp.rs @@ -1,14 +1,15 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::HashMap; +use std::path::Path; +use std::str::FromStr; +use std::time::Duration; use deno_core::serde::Deserialize; use deno_core::serde_json; use deno_core::serde_json::json; use deno_core::serde_json::Value; use lsp_types::Uri; -use std::collections::HashMap; -use std::path::Path; -use std::str::FromStr; -use std::time::Duration; use test_util::lsp::LspClientBuilder; use test_util::PathRef; use tower_lsp::lsp_types as lsp; diff --git a/cli/bench/lsp_bench_standalone.rs b/cli/bench/lsp_bench_standalone.rs index 3c946cfbe3..45d8788256 100644 --- a/cli/bench/lsp_bench_standalone.rs +++ b/cli/bench/lsp_bench_standalone.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_bench_util::bencher::benchmark_group; use deno_bench_util::bencher::benchmark_main; diff --git a/cli/bench/main.rs b/cli/bench/main.rs index c3c42d2488..e7f71f8cfa 100644 --- a/cli/bench/main.rs +++ b/cli/bench/main.rs @@ -1,11 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(clippy::print_stdout)] #![allow(clippy::print_stderr)] -use deno_core::error::AnyError; -use deno_core::serde_json; -use deno_core::serde_json::Value; use std::collections::HashMap; use std::convert::From; use std::env; @@ -15,6 +12,10 @@ use std::path::PathBuf; use std::process::Command; use std::process::Stdio; use std::time::SystemTime; + +use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::Value; use test_util::PathRef; mod lsp; diff --git a/cli/bench/napi/bench.js b/cli/bench/napi/bench.js index c12c7aacbc..f40611e7a8 100644 --- a/cli/bench/napi/bench.js +++ b/cli/bench/napi/bench.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { loadTestLibrary } from "../../../tests/napi/common.js"; diff --git a/cli/bench/napi/bench_node.mjs b/cli/bench/napi/bench_node.mjs index a772eeafa1..557c4daefd 100644 --- a/cli/bench/napi/bench_node.mjs +++ b/cli/bench/napi/bench_node.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { bench, run } from "mitata"; import { createRequire } from "module"; diff --git a/cli/bench/op_now.js b/cli/bench/op_now.js index 7c1427c809..26c4958fe0 100644 --- a/cli/bench/op_now.js +++ b/cli/bench/op_now.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console no-process-globals const queueMicrotask = globalThis.queueMicrotask || process.nextTick; diff --git a/cli/bench/secure_curves.js b/cli/bench/secure_curves.js index 912b75cccd..a3fb4ebc41 100644 --- a/cli/bench/secure_curves.js +++ b/cli/bench/secure_curves.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console no-process-globals let [total, count] = typeof Deno !== "undefined" diff --git a/cli/bench/stdio/stdio.c b/cli/bench/stdio/stdio.c index acce207995..15df422405 100644 --- a/cli/bench/stdio/stdio.c +++ b/cli/bench/stdio/stdio.c @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // From https://github.com/just-js/benchmarks/tree/main/01-stdio #include diff --git a/cli/bench/stdio/stdio.js b/cli/bench/stdio/stdio.js index 81bea835a6..1ca947809a 100644 --- a/cli/bench/stdio/stdio.js +++ b/cli/bench/stdio/stdio.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // // From https://github.com/just-js/benchmarks/tree/main/01-stdio diff --git a/cli/bench/tcp.js b/cli/bench/tcp.js index b9f05e3a7e..6681eeeb52 100644 --- a/cli/bench/tcp.js +++ b/cli/bench/tcp.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. const listener = Deno.listen({ port: 4500 }); const response = new TextEncoder().encode( diff --git a/cli/bench/tty.js b/cli/bench/tty.js index e494e76af7..c61541ffa6 100644 --- a/cli/bench/tty.js +++ b/cli/bench/tty.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console no-process-globals const queueMicrotask = globalThis.queueMicrotask || process.nextTick; diff --git a/cli/bench/url_parse.js b/cli/bench/url_parse.js index 9cb0045f64..80579d6f6b 100644 --- a/cli/bench/url_parse.js +++ b/cli/bench/url_parse.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console no-process-globals const queueMicrotask = globalThis.queueMicrotask || process.nextTick; diff --git a/cli/bench/webstorage.js b/cli/bench/webstorage.js index d19f024c63..d284378d60 100644 --- a/cli/bench/webstorage.js +++ b/cli/bench/webstorage.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/cli/bench/write_file.js b/cli/bench/write_file.js index 747503ce2a..c7200a6f5b 100644 --- a/cli/bench/write_file.js +++ b/cli/bench/write_file.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console no-process-globals const queueMicrotask = globalThis.queueMicrotask || process.nextTick; diff --git a/cli/build.rs b/cli/build.rs index 3d98661284..83290599e6 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::env; use std::path::PathBuf; @@ -8,16 +8,18 @@ use deno_runtime::*; mod shared; mod ts { - use super::*; + use std::collections::HashMap; + use std::io::Write; + use std::path::Path; + use std::path::PathBuf; + use deno_core::error::custom_error; use deno_core::error::AnyError; use deno_core::op2; use deno_core::OpState; use serde::Serialize; - use std::collections::HashMap; - use std::io::Write; - use std::path::Path; - use std::path::PathBuf; + + use super::*; #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] diff --git a/cli/cache/cache_db.rs b/cli/cache/cache_db.rs index 329ed2d970..02394d4cfd 100644 --- a/cli/cache/cache_db.rs +++ b/cli/cache/cache_db.rs @@ -1,4 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::io::IsTerminal; +use std::path::Path; +use std::path::PathBuf; +use std::sync::Arc; use deno_core::error::AnyError; use deno_core::parking_lot::Mutex; @@ -9,10 +14,6 @@ use deno_runtime::deno_webstorage::rusqlite::Connection; use deno_runtime::deno_webstorage::rusqlite::OptionalExtension; use deno_runtime::deno_webstorage::rusqlite::Params; use once_cell::sync::OnceCell; -use std::io::IsTerminal; -use std::path::Path; -use std::path::PathBuf; -use std::sync::Arc; use super::FastInsecureHasher; diff --git a/cli/cache/caches.rs b/cli/cache/caches.rs index 54371cee48..b83364c61b 100644 --- a/cli/cache/caches.rs +++ b/cli/cache/caches.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::path::PathBuf; use std::sync::Arc; diff --git a/cli/cache/check.rs b/cli/cache/check.rs index ca4e938533..a886f9fe0f 100644 --- a/cli/cache/check.rs +++ b/cli/cache/check.rs @@ -1,12 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use deno_ast::ModuleSpecifier; +use deno_core::error::AnyError; +use deno_runtime::deno_webstorage::rusqlite::params; use super::cache_db::CacheDB; use super::cache_db::CacheDBConfiguration; use super::cache_db::CacheDBHash; use super::cache_db::CacheFailure; -use deno_ast::ModuleSpecifier; -use deno_core::error::AnyError; -use deno_runtime::deno_webstorage::rusqlite::params; pub static TYPE_CHECK_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration { table_initializer: concat!( diff --git a/cli/cache/code_cache.rs b/cli/cache/code_cache.rs index b1d9ae757b..27ec544b5f 100644 --- a/cli/cache/code_cache.rs +++ b/cli/cache/code_cache.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::Arc; @@ -7,12 +7,11 @@ use deno_core::error::AnyError; use deno_runtime::code_cache; use deno_runtime::deno_webstorage::rusqlite::params; -use crate::worker::CliCodeCache; - use super::cache_db::CacheDB; use super::cache_db::CacheDBConfiguration; use super::cache_db::CacheDBHash; use super::cache_db::CacheFailure; +use crate::worker::CliCodeCache; pub static CODE_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration { table_initializer: concat!( diff --git a/cli/cache/common.rs b/cli/cache/common.rs index 0a68e95159..da607a27f2 100644 --- a/cli/cache/common.rs +++ b/cli/cache/common.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::hash::Hasher; diff --git a/cli/cache/deno_dir.rs b/cli/cache/deno_dir.rs index d83ea8ebd5..1b35f53071 100644 --- a/cli/cache/deno_dir.rs +++ b/cli/cache/deno_dir.rs @@ -1,23 +1,26 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::env; +use std::path::PathBuf; use deno_cache_dir::DenoDirResolutionError; use once_cell::sync::OnceCell; use super::DiskCache; - -use std::env; -use std::path::PathBuf; +use crate::sys::CliSys; /// Lazily creates the deno dir which might be useful in scenarios /// where functionality wants to continue if the DENO_DIR can't be created. pub struct DenoDirProvider { + sys: CliSys, maybe_custom_root: Option, deno_dir: OnceCell>, } impl DenoDirProvider { - pub fn new(maybe_custom_root: Option) -> Self { + pub fn new(sys: CliSys, maybe_custom_root: Option) -> Self { Self { + sys, maybe_custom_root, deno_dir: Default::default(), } @@ -26,7 +29,9 @@ impl DenoDirProvider { pub fn get_or_create(&self) -> Result<&DenoDir, DenoDirResolutionError> { self .deno_dir - .get_or_init(|| DenoDir::new(self.maybe_custom_root.clone())) + .get_or_init(|| { + DenoDir::new(self.sys.clone(), self.maybe_custom_root.clone()) + }) .as_ref() .map_err(|err| match err { DenoDirResolutionError::NoCacheOrHomeDir => { @@ -53,6 +58,7 @@ pub struct DenoDir { impl DenoDir { pub fn new( + sys: CliSys, maybe_custom_root: Option, ) -> Result { let root = deno_cache_dir::resolve_deno_dir( @@ -64,7 +70,7 @@ impl DenoDir { let deno_dir = Self { root, - gen_cache: DiskCache::new(&gen_path), + gen_cache: DiskCache::new(sys, &gen_path), }; Ok(deno_dir) diff --git a/cli/cache/disk_cache.rs b/cli/cache/disk_cache.rs index b22b2e3cc7..f03b60854f 100644 --- a/cli/cache/disk_cache.rs +++ b/cli/cache/disk_cache.rs @@ -1,12 +1,5 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::CACHE_PERM; - -use deno_cache_dir::url_to_filename; -use deno_core::url::Host; -use deno_core::url::Url; -use deno_path_util::fs::atomic_write_file_with_retries; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use std::ffi::OsStr; use std::fs; use std::path::Component; @@ -15,16 +8,26 @@ use std::path::PathBuf; use std::path::Prefix; use std::str; +use deno_cache_dir::url_to_filename; +use deno_core::url::Host; +use deno_core::url::Url; +use deno_path_util::fs::atomic_write_file_with_retries; + +use super::CACHE_PERM; +use crate::sys::CliSys; + #[derive(Debug, Clone)] pub struct DiskCache { + sys: CliSys, pub location: PathBuf, } impl DiskCache { /// `location` must be an absolute path. - pub fn new(location: &Path) -> Self { + pub fn new(sys: CliSys, location: &Path) -> Self { assert!(location.is_absolute()); Self { + sys, location: location.to_owned(), } } @@ -121,25 +124,21 @@ impl DiskCache { pub fn set(&self, filename: &Path, data: &[u8]) -> std::io::Result<()> { let path = self.location.join(filename); - atomic_write_file_with_retries( - &FsSysTraitsAdapter::new_real(), - &path, - data, - CACHE_PERM, - ) + atomic_write_file_with_retries(&self.sys, &path, data, CACHE_PERM) } } #[cfg(test)] mod tests { - use super::*; use test_util::TempDir; + use super::*; + #[test] fn test_set_get_cache_file() { let temp_dir = TempDir::new(); let sub_dir = temp_dir.path().join("sub_dir"); - let cache = DiskCache::new(&sub_dir.to_path_buf()); + let cache = DiskCache::new(CliSys::default(), &sub_dir.to_path_buf()); let path = PathBuf::from("foo/bar.txt"); cache.set(&path, b"hello").unwrap(); assert_eq!(cache.get(&path).unwrap(), b"hello"); @@ -153,7 +152,7 @@ mod tests { PathBuf::from("/deno_dir/") }; - let cache = DiskCache::new(&cache_location); + let cache = DiskCache::new(CliSys::default(), &cache_location); let mut test_cases = vec![ ( @@ -209,7 +208,7 @@ mod tests { } else { "/foo" }; - let cache = DiskCache::new(&PathBuf::from(p)); + let cache = DiskCache::new(CliSys::default(), &PathBuf::from(p)); let mut test_cases = vec![ ( @@ -257,7 +256,7 @@ mod tests { PathBuf::from("/deno_dir/") }; - let cache = DiskCache::new(&cache_location); + let cache = DiskCache::new(CliSys::default(), &cache_location); let mut test_cases = vec!["unknown://localhost/test.ts"]; diff --git a/cli/cache/emit.rs b/cli/cache/emit.rs index 3c9eecfcbd..2ba43d58b9 100644 --- a/cli/cache/emit.rs +++ b/cli/cache/emit.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::path::PathBuf; @@ -160,11 +160,13 @@ mod test { use test_util::TempDir; use super::*; + use crate::sys::CliSys; #[test] pub fn emit_cache_general_use() { let temp_dir = TempDir::new(); - let disk_cache = DiskCache::new(temp_dir.path().as_path()); + let disk_cache = + DiskCache::new(CliSys::default(), temp_dir.path().as_path()); let cache = EmitCache { disk_cache: disk_cache.clone(), file_serializer: EmitFileSerializer { diff --git a/cli/cache/fast_check.rs b/cli/cache/fast_check.rs index 43be1b7186..323312d057 100644 --- a/cli/cache/fast_check.rs +++ b/cli/cache/fast_check.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::error::AnyError; use deno_graph::FastCheckCacheItem; diff --git a/cli/cache/incremental.rs b/cli/cache/incremental.rs index 2d31b4125e..9ba343f273 100644 --- a/cli/cache/incremental.rs +++ b/cli/cache/incremental.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::path::Path; diff --git a/cli/cache/mod.rs b/cli/cache/mod.rs index c8b0eacaa4..868811c587 100644 --- a/cli/cache/mod.rs +++ b/cli/cache/mod.rs @@ -1,10 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::args::jsr_url; -use crate::file_fetcher::CliFetchNoFollowErrorKind; -use crate::file_fetcher::CliFileFetcher; -use crate::file_fetcher::FetchNoFollowOptions; -use crate::file_fetcher::FetchPermissionsOptionRef; +use std::collections::HashMap; +use std::path::PathBuf; +use std::sync::Arc; use deno_ast::MediaType; use deno_cache_dir::file_fetcher::CacheSetting; @@ -18,12 +16,15 @@ use deno_graph::source::CacheInfo; use deno_graph::source::LoadFuture; use deno_graph::source::LoadResponse; use deno_graph::source::Loader; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_permissions::PermissionsContainer; use node_resolver::InNpmPackageChecker; -use std::collections::HashMap; -use std::path::PathBuf; -use std::sync::Arc; + +use crate::args::jsr_url; +use crate::file_fetcher::CliFetchNoFollowErrorKind; +use crate::file_fetcher::CliFileFetcher; +use crate::file_fetcher::FetchNoFollowOptions; +use crate::file_fetcher::FetchPermissionsOptionRef; +use crate::sys::CliSys; mod cache_db; mod caches; @@ -44,6 +45,8 @@ pub use caches::Caches; pub use check::TypeCheckCache; pub use code_cache::CodeCache; pub use common::FastInsecureHasher; +/// Permissions used to save a file in the disk caches. +pub use deno_cache_dir::CACHE_PERM; pub use deno_dir::DenoDir; pub use deno_dir::DenoDirProvider; pub use disk_cache::DiskCache; @@ -55,13 +58,9 @@ pub use node::NodeAnalysisCache; pub use parsed_source::LazyGraphSourceParser; pub use parsed_source::ParsedSourceCache; -/// Permissions used to save a file in the disk caches. -pub use deno_cache_dir::CACHE_PERM; - -pub type GlobalHttpCache = deno_cache_dir::GlobalHttpCache; -pub type LocalHttpCache = deno_cache_dir::LocalHttpCache; -pub type LocalLspHttpCache = - deno_cache_dir::LocalLspHttpCache; +pub type GlobalHttpCache = deno_cache_dir::GlobalHttpCache; +pub type LocalHttpCache = deno_cache_dir::LocalHttpCache; +pub type LocalLspHttpCache = deno_cache_dir::LocalLspHttpCache; pub use deno_cache_dir::HttpCache; pub struct FetchCacherOptions { @@ -80,7 +79,7 @@ pub struct FetchCacher { in_npm_pkg_checker: Arc, module_info_cache: Arc, permissions: PermissionsContainer, - sys: FsSysTraitsAdapter, + sys: CliSys, is_deno_publish: bool, cache_info_enabled: bool, } @@ -91,7 +90,7 @@ impl FetchCacher { global_http_cache: Arc, in_npm_pkg_checker: Arc, module_info_cache: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, options: FetchCacherOptions, ) -> Self { Self { diff --git a/cli/cache/module_info.rs b/cli/cache/module_info.rs index 469e2fafac..671e7e3dc8 100644 --- a/cli/cache/module_info.rs +++ b/cli/cache/module_info.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::Arc; diff --git a/cli/cache/node.rs b/cli/cache/node.rs index e80342e5c0..89e372de43 100644 --- a/cli/cache/node.rs +++ b/cli/cache/node.rs @@ -1,15 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::error::AnyError; use deno_core::serde_json; use deno_runtime::deno_webstorage::rusqlite::params; -use crate::node::CliCjsAnalysis; - use super::cache_db::CacheDB; use super::cache_db::CacheDBConfiguration; use super::cache_db::CacheFailure; use super::CacheDBHash; +use crate::node::CliCjsAnalysis; pub static NODE_ANALYSIS_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration { diff --git a/cli/cache/parsed_source.rs b/cli/cache/parsed_source.rs index 4d031f8bf2..15207f4ba7 100644 --- a/cli/cache/parsed_source.rs +++ b/cli/cache/parsed_source.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::sync::Arc; diff --git a/cli/cdp.rs b/cli/cdp.rs index c5ff587dde..df82d58d9f 100644 --- a/cli/cdp.rs +++ b/cli/cdp.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// use deno_core::serde_json::Value; diff --git a/cli/clippy.toml b/cli/clippy.toml index f1c25acfb8..21a544aebd 100644 --- a/cli/clippy.toml +++ b/cli/clippy.toml @@ -4,6 +4,7 @@ disallowed-methods = [ ] disallowed-types = [ { path = "reqwest::Client", reason = "use crate::http_util::HttpClient instead" }, + { path = "sys_traits::impls::RealSys", reason = "use crate::sys::CliSys instead" }, ] ignore-interior-mutability = [ "lsp_types::Uri", diff --git a/cli/emit.rs b/cli/emit.rs index 733a89d832..32a636de36 100644 --- a/cli/emit.rs +++ b/cli/emit.rs @@ -1,9 +1,6 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::cache::EmitCache; -use crate::cache::FastInsecureHasher; -use crate::cache::ParsedSourceCache; -use crate::resolver::CjsTracker; +use std::sync::Arc; use deno_ast::EmittedSourceText; use deno_ast::ModuleKind; @@ -21,7 +18,11 @@ use deno_core::ModuleSpecifier; use deno_graph::MediaType; use deno_graph::Module; use deno_graph::ModuleGraph; -use std::sync::Arc; + +use crate::cache::EmitCache; +use crate::cache::FastInsecureHasher; +use crate::cache::ParsedSourceCache; +use crate::resolver::CjsTracker; #[derive(Debug)] pub struct Emitter { diff --git a/cli/errors.rs b/cli/errors.rs index 38dc8259e3..ead1ccf127 100644 --- a/cli/errors.rs +++ b/cli/errors.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! There are many types of errors in Deno: //! - AnyError: a generic wrapper that can encapsulate any type of error. diff --git a/cli/factory.rs b/cli/factory.rs index 5d2aeaa582..bf5fe3cb73 100644 --- a/cli/factory.rs +++ b/cli/factory.rs @@ -1,4 +1,42 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::BTreeSet; +use std::collections::HashSet; +use std::future::Future; +use std::path::PathBuf; +use std::sync::Arc; + +use deno_ast::ModuleSpecifier; +use deno_cache_dir::file_fetcher::File; +use deno_cache_dir::npm::NpmCacheDir; +use deno_config::glob::FilePatterns; +use deno_config::workspace::PackageJsonDepResolution; +use deno_config::workspace::WorkspaceDirectory; +use deno_config::workspace::WorkspaceResolver; +use deno_core::anyhow::anyhow; +use deno_core::error::AnyError; +use deno_core::futures::FutureExt; +use deno_core::FeatureChecker; +use deno_path_util::url_to_file_path; +use deno_resolver::cjs::IsCjsResolutionMode; +use deno_resolver::npm::NpmReqResolverOptions; +use deno_resolver::DenoResolverOptions; +use deno_resolver::NodeAndNpmReqResolver; +use deno_runtime::deno_fs; +use deno_runtime::deno_fs::RealFs; +use deno_runtime::deno_node::RealIsBuiltInNodeModuleChecker; +use deno_runtime::deno_permissions::Permissions; +use deno_runtime::deno_permissions::PermissionsContainer; +use deno_runtime::deno_permissions::PermissionsOptions; +use deno_runtime::deno_tls::rustls::RootCertStore; +use deno_runtime::deno_tls::RootCertStoreProvider; +use deno_runtime::deno_web::BlobStore; +use deno_runtime::inspector_server::InspectorServer; +use deno_runtime::permissions::RuntimePermissionDescriptorParser; +use log::warn; +use node_resolver::analyze::NodeCodeTranslator; +use node_resolver::InNpmPackageChecker; +use once_cell::sync::OnceCell; use crate::args::check_warn_tsconfig; use crate::args::get_root_cert_store; @@ -32,6 +70,8 @@ use crate::module_loader::CliModuleLoaderFactory; use crate::module_loader::ModuleLoadPreparer; use crate::node::CliCjsCodeAnalyzer; use crate::node::CliNodeCodeTranslator; +use crate::node::CliNodeResolver; +use crate::node::CliPackageJsonResolver; use crate::npm::create_cli_npm_resolver; use crate::npm::create_in_npm_pkg_checker; use crate::npm::CliByonmNpmResolverCreateOptions; @@ -49,7 +89,8 @@ use crate::resolver::CliResolverOptions; use crate::resolver::CliSloppyImportsResolver; use crate::resolver::NpmModuleLoader; use crate::resolver::SloppyImportsCachedFs; -use crate::standalone::DenoCompileBinaryWriter; +use crate::standalone::binary::DenoCompileBinaryWriter; +use crate::sys::CliSys; use crate::tools::check::MaybeDiagnostics; use crate::tools::check::TypeChecker; use crate::tools::coverage::CoverageCollector; @@ -64,46 +105,6 @@ use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; use crate::worker::CliMainWorkerFactory; use crate::worker::CliMainWorkerOptions; -use std::collections::BTreeSet; -use std::collections::HashSet; -use std::path::PathBuf; - -use deno_ast::ModuleSpecifier; -use deno_cache_dir::file_fetcher::File; -use deno_cache_dir::npm::NpmCacheDir; -use deno_config::glob::FilePatterns; -use deno_config::workspace::PackageJsonDepResolution; -use deno_config::workspace::WorkspaceDirectory; -use deno_config::workspace::WorkspaceResolver; -use deno_core::anyhow::anyhow; -use deno_core::error::AnyError; -use deno_core::futures::FutureExt; -use deno_core::FeatureChecker; - -use deno_path_util::url_to_file_path; -use deno_resolver::cjs::IsCjsResolutionMode; -use deno_resolver::npm::NpmReqResolverOptions; -use deno_resolver::DenoResolverOptions; -use deno_resolver::NodeAndNpmReqResolver; -use deno_runtime::deno_fs; -use deno_runtime::deno_fs::FsSysTraitsAdapter; -use deno_runtime::deno_node::NodeResolver; -use deno_runtime::deno_node::PackageJsonResolver; -use deno_runtime::deno_node::RealIsBuiltInNodeModuleChecker; -use deno_runtime::deno_permissions::Permissions; -use deno_runtime::deno_permissions::PermissionsContainer; -use deno_runtime::deno_permissions::PermissionsOptions; -use deno_runtime::deno_tls::rustls::RootCertStore; -use deno_runtime::deno_tls::RootCertStoreProvider; -use deno_runtime::deno_web::BlobStore; -use deno_runtime::inspector_server::InspectorServer; -use deno_runtime::permissions::RuntimePermissionDescriptorParser; -use log::warn; -use node_resolver::analyze::NodeCodeTranslator; -use node_resolver::InNpmPackageChecker; -use once_cell::sync::OnceCell; -use std::future::Future; -use std::sync::Arc; struct CliRootCertStoreProvider { cell: OnceCell, @@ -211,13 +212,14 @@ struct CliFactoryServices { module_info_cache: Deferred>, module_load_preparer: Deferred>, node_code_translator: Deferred>, - node_resolver: Deferred>, + node_resolver: Deferred>, npm_cache_dir: Deferred>, npm_req_resolver: Deferred>, npm_resolver: Deferred>, parsed_source_cache: Deferred>, - permission_desc_parser: Deferred>, - pkg_json_resolver: Deferred>, + permission_desc_parser: + Deferred>>, + pkg_json_resolver: Deferred>, resolver: Deferred>, root_cert_store_provider: Deferred>, root_permissions_container: Deferred, @@ -267,7 +269,7 @@ impl CliFactory { pub fn cli_options(&self) -> Result<&Arc, AnyError> { self.services.cli_options.get_or_try_init(|| { - CliOptions::from_flags(self.flags.clone()).map(Arc::new) + CliOptions::from_flags(&self.sys(), self.flags.clone()).map(Arc::new) }) } @@ -330,7 +332,7 @@ impl CliFactory { pub fn global_http_cache(&self) -> Result<&Arc, AnyError> { self.services.global_http_cache.get_or_try_init(|| { Ok(Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter(self.fs().clone()), + self.sys(), self.deno_dir()?.remote_folder_path(), ))) }) @@ -368,6 +370,7 @@ impl CliFactory { Ok(Arc::new(CliFileFetcher::new( self.http_cache()?.clone(), self.http_client_provider().clone(), + self.sys(), self.blob_store().clone(), Some(self.text_only_progress_bar().clone()), !cli_options.no_remote(), @@ -378,7 +381,11 @@ impl CliFactory { } pub fn fs(&self) -> &Arc { - self.services.fs.get_or_init(|| Arc::new(deno_fs::RealFs)) + self.services.fs.get_or_init(|| Arc::new(RealFs)) + } + + pub fn sys(&self) -> CliSys { + CliSys::default() // very cheap to make } pub fn in_npm_pkg_checker( @@ -404,11 +411,10 @@ impl CliFactory { pub fn npm_cache_dir(&self) -> Result<&Arc, AnyError> { self.services.npm_cache_dir.get_or_try_init(|| { - let fs = self.fs(); let global_path = self.deno_dir()?.npm_folder_path(); let cli_options = self.cli_options()?; Ok(Arc::new(NpmCacheDir::new( - &FsSysTraitsAdapter(fs.clone()), + &self.sys(), global_path, cli_options.npmrc().get_all_known_registries_urls(), ))) @@ -423,12 +429,11 @@ impl CliFactory { .npm_resolver .get_or_try_init_async( async { - let fs = self.fs(); let cli_options = self.cli_options()?; create_cli_npm_resolver(if cli_options.use_byonm() { CliNpmResolverCreateOptions::Byonm( CliByonmNpmResolverCreateOptions { - sys: FsSysTraitsAdapter(fs.clone()), + sys: self.sys(), pkg_json_resolver: self.pkg_json_resolver().clone(), root_node_modules_dir: Some( match cli_options.node_modules_dir_path() { @@ -452,7 +457,7 @@ impl CliFactory { cli_options.workspace(), ), ), - sys: FsSysTraitsAdapter(self.fs().clone()), + sys: self.sys(), snapshot: match cli_options.resolve_npm_resolution_snapshot()? { Some(snapshot) => { CliNpmResolverManagedSnapshotOption::Specified(Some( @@ -499,7 +504,7 @@ impl CliFactory { .get_or_try_init(|| { Ok(self.cli_options()?.unstable_sloppy_imports().then(|| { Arc::new(CliSloppyImportsResolver::new(SloppyImportsCachedFs::new( - FsSysTraitsAdapter(self.fs().clone()), + self.sys(), ))) })) }) @@ -660,13 +665,13 @@ impl CliFactory { )) } - pub async fn node_resolver(&self) -> Result<&Arc, AnyError> { + pub async fn node_resolver(&self) -> Result<&Arc, AnyError> { self .services .node_resolver .get_or_try_init_async( async { - Ok(Arc::new(NodeResolver::new( + Ok(Arc::new(CliNodeResolver::new( self.in_npm_pkg_checker()?.clone(), RealIsBuiltInNodeModuleChecker, self @@ -675,7 +680,7 @@ impl CliFactory { .clone() .into_npm_pkg_folder_resolver(), self.pkg_json_resolver().clone(), - FsSysTraitsAdapter(self.fs().clone()), + self.sys(), ))) } .boxed_local(), @@ -711,7 +716,7 @@ impl CliFactory { .clone() .into_npm_pkg_folder_resolver(), self.pkg_json_resolver().clone(), - FsSysTraitsAdapter(self.fs().clone()), + self.sys(), ))) }) .await @@ -727,7 +732,7 @@ impl CliFactory { let npm_resolver = self.npm_resolver().await?; Ok(Arc::new(CliNpmReqResolver::new(NpmReqResolverOptions { byonm_resolver: (npm_resolver.clone()).into_maybe_byonm(), - sys: FsSysTraitsAdapter(self.fs().clone()), + sys: self.sys(), in_npm_pkg_checker: self.in_npm_pkg_checker()?.clone(), node_resolver: self.node_resolver().await?.clone(), npm_req_resolver: npm_resolver.clone().into_npm_req_resolver(), @@ -736,12 +741,11 @@ impl CliFactory { .await } - pub fn pkg_json_resolver(&self) -> &Arc { - self.services.pkg_json_resolver.get_or_init(|| { - Arc::new(PackageJsonResolver::new(FsSysTraitsAdapter( - self.fs().clone(), - ))) - }) + pub fn pkg_json_resolver(&self) -> &Arc { + self + .services + .pkg_json_resolver + .get_or_init(|| Arc::new(CliPackageJsonResolver::new(self.sys()))) } pub async fn type_checker(&self) -> Result<&Arc, AnyError> { @@ -787,7 +791,7 @@ impl CliFactory { self.parsed_source_cache().clone(), self.resolver().await?.clone(), self.root_permissions_container()?.clone(), - FsSysTraitsAdapter(self.fs().clone()), + self.sys(), ))) }) .await @@ -877,10 +881,9 @@ impl CliFactory { pub fn permission_desc_parser( &self, - ) -> Result<&Arc, AnyError> { + ) -> Result<&Arc>, AnyError> { self.services.permission_desc_parser.get_or_try_init(|| { - let fs = self.fs().clone(); - Ok(Arc::new(RuntimePermissionDescriptorParser::new(fs))) + Ok(Arc::new(RuntimePermissionDescriptorParser::new(self.sys()))) }) } @@ -987,7 +990,7 @@ impl CliFactory { ), self.parsed_source_cache().clone(), self.resolver().await?.clone(), - FsSysTraitsAdapter(self.fs().clone()), + self.sys(), )), node_resolver.clone(), npm_resolver.clone(), @@ -995,6 +998,7 @@ impl CliFactory { self.root_cert_store_provider().clone(), self.root_permissions_container()?.clone(), StorageKeyResolver::from_options(cli_options), + self.sys(), cli_options.sub_command().clone(), self.create_cli_main_worker_options()?, self.cli_options()?.otel_config(), @@ -1151,7 +1155,7 @@ impl WorkspaceDirFilesFactory { pub fn permission_desc_parser( &self, - ) -> Result<&Arc, AnyError> { + ) -> Result<&Arc>, AnyError> { self.cli_factory.permission_desc_parser() } diff --git a/cli/file_fetcher.rs b/cli/file_fetcher.rs index 38f3dd1847..cfc26d7e69 100644 --- a/cli/file_fetcher.rs +++ b/cli/file_fetcher.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::collections::HashMap; @@ -24,7 +24,6 @@ use deno_core::url::Url; use deno_core::ModuleSpecifier; use deno_error::JsError; use deno_graph::source::LoaderChecksum; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_permissions::CheckSpecifierKind; use deno_runtime::deno_permissions::PermissionCheckError; use deno_runtime::deno_permissions::PermissionsContainer; @@ -38,6 +37,7 @@ use crate::cache::HttpCache; use crate::colors; use crate::http_util::get_response_body_with_progress; use crate::http_util::HttpClientProvider; +use crate::sys::CliSys; use crate::util::progress_bar::ProgressBar; #[derive(Debug, Clone, Eq, PartialEq)] @@ -267,7 +267,7 @@ pub struct FetchNoFollowOptions<'a> { type DenoCacheDirFileFetcher = deno_cache_dir::file_fetcher::FileFetcher< BlobStoreAdapter, - FsSysTraitsAdapter, + CliSys, HttpClientAdapter, >; @@ -279,9 +279,11 @@ pub struct CliFileFetcher { } impl CliFileFetcher { + #[allow(clippy::too_many_arguments)] pub fn new( http_cache: Arc, http_client_provider: Arc, + sys: CliSys, blob_store: Arc, progress_bar: Option, allow_remote: bool, @@ -289,7 +291,6 @@ impl CliFileFetcher { download_log_level: log::Level, ) -> Self { let memory_files = Arc::new(MemoryFiles::default()); - let sys = FsSysTraitsAdapter::new_real(); let auth_tokens = AuthTokens::new_from_sys(&sys); let file_fetcher = DenoCacheDirFileFetcher::new( BlobStoreAdapter(blob_store), @@ -497,10 +498,6 @@ fn validate_scheme(specifier: &Url) -> Result<(), UnsupportedSchemeError> { #[cfg(test)] mod tests { - use crate::cache::GlobalHttpCache; - use crate::http_util::HttpClientProvider; - - use super::*; use deno_cache_dir::file_fetcher::FetchNoFollowErrorKind; use deno_cache_dir::file_fetcher::HttpClient; use deno_core::resolve_url; @@ -508,6 +505,10 @@ mod tests { use deno_runtime::deno_web::InMemoryBlobPart; use test_util::TempDir; + use super::*; + use crate::cache::GlobalHttpCache; + use crate::http_util::HttpClientProvider; + fn setup( cache_setting: CacheSetting, maybe_temp_dir: Option, @@ -538,13 +539,11 @@ mod tests { let temp_dir = maybe_temp_dir.unwrap_or_default(); let location = temp_dir.path().join("remote").to_path_buf(); let blob_store: Arc = Default::default(); - let cache = Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter::new_real(), - location, - )); + let cache = Arc::new(GlobalHttpCache::new(CliSys::default(), location)); let file_fetcher = CliFileFetcher::new( cache.clone(), Arc::new(HttpClientProvider::new(None, None)), + CliSys::default(), blob_store.clone(), None, true, @@ -754,11 +753,9 @@ mod tests { // invocation and indicates to "cache bust". let location = temp_dir.path().join("remote").to_path_buf(); let file_fetcher = CliFileFetcher::new( - Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter::new_real(), - location, - )), + Arc::new(GlobalHttpCache::new(CliSys::default(), location)), Arc::new(HttpClientProvider::new(None, None)), + CliSys::default(), Default::default(), None, true, @@ -783,14 +780,13 @@ mod tests { let specifier = resolve_url("http://localhost:4545/subdir/mismatch_ext.ts").unwrap(); - let http_cache = Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter::new_real(), - location.clone(), - )); + let http_cache = + Arc::new(GlobalHttpCache::new(CliSys::default(), location.clone())); let file_modified_01 = { let file_fetcher = CliFileFetcher::new( http_cache.clone(), Arc::new(HttpClientProvider::new(None, None)), + CliSys::default(), Default::default(), None, true, @@ -810,11 +806,9 @@ mod tests { let file_modified_02 = { let file_fetcher = CliFileFetcher::new( - Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter::new_real(), - location, - )), + Arc::new(GlobalHttpCache::new(CliSys::default(), location)), Arc::new(HttpClientProvider::new(None, None)), + CliSys::default(), Default::default(), None, true, @@ -940,15 +934,14 @@ mod tests { resolve_url("http://localhost:4548/subdir/mismatch_ext.ts").unwrap(); let redirected_specifier = resolve_url("http://localhost:4546/subdir/mismatch_ext.ts").unwrap(); - let http_cache = Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter::new_real(), - location.clone(), - )); + let http_cache = + Arc::new(GlobalHttpCache::new(CliSys::default(), location.clone())); let metadata_file_modified_01 = { let file_fetcher = CliFileFetcher::new( http_cache.clone(), Arc::new(HttpClientProvider::new(None, None)), + CliSys::default(), Default::default(), None, true, @@ -971,6 +964,7 @@ mod tests { let file_fetcher = CliFileFetcher::new( http_cache.clone(), Arc::new(HttpClientProvider::new(None, None)), + CliSys::default(), Default::default(), None, true, @@ -1075,11 +1069,9 @@ mod tests { let temp_dir = TempDir::new(); let location = temp_dir.path().join("remote").to_path_buf(); let file_fetcher = CliFileFetcher::new( - Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter::new_real(), - location, - )), + Arc::new(GlobalHttpCache::new(CliSys::default(), location)), Arc::new(HttpClientProvider::new(None, None)), + CliSys::default(), Default::default(), None, false, @@ -1113,11 +1105,9 @@ mod tests { let temp_dir = TempDir::new(); let location = temp_dir.path().join("remote").to_path_buf(); let file_fetcher_01 = CliFileFetcher::new( - Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter::new_real(), - location.clone(), - )), + Arc::new(GlobalHttpCache::new(CliSys::default(), location.clone())), Arc::new(HttpClientProvider::new(None, None)), + CliSys::default(), Default::default(), None, true, @@ -1125,11 +1115,9 @@ mod tests { log::Level::Info, ); let file_fetcher_02 = CliFileFetcher::new( - Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter::new_real(), - location, - )), + Arc::new(GlobalHttpCache::new(CliSys::default(), location)), Arc::new(HttpClientProvider::new(None, None)), + CliSys::default(), Default::default(), None, true, diff --git a/cli/graph_container.rs b/cli/graph_container.rs index ba8b649698..564bd72ecf 100644 --- a/cli/graph_container.rs +++ b/cli/graph_container.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::Arc; diff --git a/cli/graph_util.rs b/cli/graph_util.rs index b64fce9e5f..d2f629d2d6 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::error::Error; use std::ops::Deref; @@ -27,7 +27,6 @@ use deno_graph::ResolutionError; use deno_graph::SpecifierError; use deno_graph::WorkspaceFastCheckOption; use deno_resolver::sloppy_imports::SloppyImportsResolutionKind; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node; use deno_runtime::deno_permissions::PermissionsContainer; use deno_semver::jsr::JsrDepPackageReq; @@ -55,6 +54,7 @@ use crate::resolver::CjsTracker; use crate::resolver::CliResolver; use crate::resolver::CliSloppyImportsResolver; use crate::resolver::SloppyImportsCachedFs; +use crate::sys::CliSys; use crate::tools::check; use crate::tools::check::TypeChecker; use crate::util::file_watcher::WatcherCommunicator; @@ -78,7 +78,7 @@ pub struct GraphValidOptions { /// for the CLI. pub fn graph_valid( graph: &ModuleGraph, - sys: &FsSysTraitsAdapter, + sys: &CliSys, roots: &[ModuleSpecifier], options: GraphValidOptions, ) -> Result<(), AnyError> { @@ -138,7 +138,7 @@ pub struct GraphWalkErrorsOptions { /// and enhances them with CLI information. pub fn graph_walk_errors<'a>( graph: &'a ModuleGraph, - sys: &'a FsSysTraitsAdapter, + sys: &'a CliSys, roots: &'a [ModuleSpecifier], options: GraphWalkErrorsOptions, ) -> impl Iterator + 'a { @@ -441,7 +441,7 @@ pub struct ModuleGraphBuilder { parsed_source_cache: Arc, resolver: Arc, root_permissions_container: PermissionsContainer, - sys: FsSysTraitsAdapter, + sys: CliSys, } impl ModuleGraphBuilder { @@ -460,7 +460,7 @@ impl ModuleGraphBuilder { parsed_source_cache: Arc, resolver: Arc, root_permissions_container: PermissionsContainer, - sys: FsSysTraitsAdapter, + sys: CliSys, ) -> Self { Self { caches, @@ -834,7 +834,7 @@ pub fn enhanced_resolution_error_message(error: &ResolutionError) -> String { } fn enhanced_sloppy_imports_error_message( - sys: &FsSysTraitsAdapter, + sys: &CliSys, error: &ModuleError, ) -> Option { match error { diff --git a/cli/http_util.rs b/cli/http_util.rs index b24dd7bc0c..af6709c5d0 100644 --- a/cli/http_util.rs +++ b/cli/http_util.rs @@ -1,7 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::util::progress_bar::UpdateGuard; -use crate::version; +use std::collections::HashMap; +use std::sync::Arc; +use std::thread::ThreadId; use boxed_error::Boxed; use deno_cache_dir::file_fetcher::RedirectHeaderParseError; @@ -23,12 +24,11 @@ use http::header::CONTENT_LENGTH; use http::HeaderMap; use http::StatusCode; use http_body_util::BodyExt; - -use std::collections::HashMap; -use std::sync::Arc; -use std::thread::ThreadId; use thiserror::Error; +use crate::util::progress_bar::UpdateGuard; +use crate::version; + #[derive(Debug, Error)] pub enum SendError { #[error(transparent)] diff --git a/cli/integration_tests_runner.rs b/cli/integration_tests_runner.rs index 12e83a0194..7342e62fa0 100644 --- a/cli/integration_tests_runner.rs +++ b/cli/integration_tests_runner.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub fn main() { let mut args = vec!["cargo", "test", "-p", "cli_tests", "--features", "run"]; diff --git a/cli/js.rs b/cli/js.rs index 2c93f004ca..5337c53f76 100644 --- a/cli/js.rs +++ b/cli/js.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use log::debug; diff --git a/cli/js/40_bench.js b/cli/js/40_bench.js index b07df3993c..0ad05c5197 100644 --- a/cli/js/40_bench.js +++ b/cli/js/40_bench.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file import { core, primordials } from "ext:core/mod.js"; diff --git a/cli/js/40_jupyter.js b/cli/js/40_jupyter.js index 198b6a3502..f392af1d43 100644 --- a/cli/js/40_jupyter.js +++ b/cli/js/40_jupyter.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file /* diff --git a/cli/js/40_lint.js b/cli/js/40_lint.js index d29dc3e850..4adbc1baa1 100644 --- a/cli/js/40_lint.js +++ b/cli/js/40_lint.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check diff --git a/cli/js/40_lint_selector.js b/cli/js/40_lint_selector.js index b78f7a5d0e..7b94c4f960 100644 --- a/cli/js/40_lint_selector.js +++ b/cli/js/40_lint_selector.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check diff --git a/cli/js/40_lint_types.d.ts b/cli/js/40_lint_types.d.ts index 7b06e36098..db2202981a 100644 --- a/cli/js/40_lint_types.d.ts +++ b/cli/js/40_lint_types.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. export interface NodeFacade { type: string; diff --git a/cli/js/40_test.js b/cli/js/40_test.js index ea526a17d4..34d9ec6550 100644 --- a/cli/js/40_test.js +++ b/cli/js/40_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { escapeName, withPermissions } from "ext:cli/40_test_common.js"; diff --git a/cli/js/40_test_common.js b/cli/js/40_test_common.js index 7711148f1e..6b7828cd2d 100644 --- a/cli/js/40_test_common.js +++ b/cli/js/40_test_common.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { serializePermissions } from "ext:runtime/10_permissions.js"; const ops = core.ops; diff --git a/cli/jsr.rs b/cli/jsr.rs index acfbb1c8e2..34a2ec04e4 100644 --- a/cli/jsr.rs +++ b/cli/jsr.rs @@ -1,14 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::sync::Arc; -use crate::args::jsr_url; -use crate::file_fetcher::CliFileFetcher; use dashmap::DashMap; use deno_core::serde_json; use deno_graph::packages::JsrPackageInfo; use deno_graph::packages::JsrPackageVersionInfo; use deno_semver::package::PackageNv; use deno_semver::package::PackageReq; -use std::sync::Arc; + +use crate::args::jsr_url; +use crate::file_fetcher::CliFileFetcher; /// This is similar to a subset of `JsrCacheResolver` which fetches rather than /// just reads the cache. Keep in sync! diff --git a/cli/lsp/analysis.rs b/cli/lsp/analysis.rs index 8fb3454bc8..968875e48a 100644 --- a/cli/lsp/analysis.rs +++ b/cli/lsp/analysis.rs @@ -1,25 +1,15 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::diagnostics::DenoDiagnostic; -use super::diagnostics::DiagnosticSource; -use super::documents::Document; -use super::documents::Documents; -use super::language_server; -use super::resolver::LspResolver; -use super::tsc; -use super::urls::url_to_uri; - -use crate::args::jsr_url; -use crate::lsp::logging::lsp_warn; -use crate::lsp::search::PackageSearchApi; -use crate::tools::lint::CliLinter; -use crate::util::path::relative_specifier; -use deno_config::workspace::MappedResolution; -use deno_lint::diagnostic::LintDiagnosticRange; +use std::borrow::Cow; +use std::cmp::Ordering; +use std::collections::HashMap; +use std::collections::HashSet; +use std::path::Path; use deno_ast::SourceRange; use deno_ast::SourceRangedForSpanned; use deno_ast::SourceTextInfo; +use deno_config::workspace::MappedResolution; use deno_core::error::custom_error; use deno_core::error::AnyError; use deno_core::serde::Deserialize; @@ -27,6 +17,7 @@ use deno_core::serde::Serialize; use deno_core::serde_json; use deno_core::serde_json::json; use deno_core::ModuleSpecifier; +use deno_lint::diagnostic::LintDiagnosticRange; use deno_path_util::url_to_file_path; use deno_runtime::deno_node::PathClean; use deno_semver::jsr::JsrPackageNvReference; @@ -44,16 +35,25 @@ use node_resolver::NodeResolutionKind; use node_resolver::ResolutionMode; use once_cell::sync::Lazy; use regex::Regex; -use std::borrow::Cow; -use std::cmp::Ordering; -use std::collections::HashMap; -use std::collections::HashSet; -use std::path::Path; use text_lines::LineAndColumnIndex; use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types::Position; use tower_lsp::lsp_types::Range; +use super::diagnostics::DenoDiagnostic; +use super::diagnostics::DiagnosticSource; +use super::documents::Document; +use super::documents::Documents; +use super::language_server; +use super::resolver::LspResolver; +use super::tsc; +use super::urls::url_to_uri; +use crate::args::jsr_url; +use crate::lsp::logging::lsp_warn; +use crate::lsp::search::PackageSearchApi; +use crate::tools::lint::CliLinter; +use crate::util::path::relative_specifier; + /// Diagnostic error codes which actually are the same, and so when grouping /// fixes we treat them the same. static FIX_ALL_ERROR_CODES: Lazy> = diff --git a/cli/lsp/cache.rs b/cli/lsp/cache.rs index c6d1b39ef4..97fbbaff14 100644 --- a/cli/lsp/cache.rs +++ b/cli/lsp/cache.rs @@ -1,4 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::BTreeMap; +use std::fs; +use std::path::Path; +use std::sync::Arc; +use std::time::SystemTime; + +use deno_core::url::Url; +use deno_core::ModuleSpecifier; +use deno_path_util::url_to_file_path; use crate::cache::DenoDir; use crate::cache::GlobalHttpCache; @@ -7,16 +17,7 @@ use crate::cache::LocalLspHttpCache; use crate::lsp::config::Config; use crate::lsp::logging::lsp_log; use crate::lsp::logging::lsp_warn; - -use deno_core::url::Url; -use deno_core::ModuleSpecifier; -use deno_path_util::url_to_file_path; -use deno_runtime::deno_fs::FsSysTraitsAdapter; -use std::collections::BTreeMap; -use std::fs; -use std::path::Path; -use std::sync::Arc; -use std::time::SystemTime; +use crate::sys::CliSys; pub fn calculate_fs_version( cache: &LspCache, @@ -92,12 +93,11 @@ impl LspCache { }) .ok() }); - let deno_dir = DenoDir::new(global_cache_path) + let sys = CliSys::default(); + let deno_dir = DenoDir::new(sys.clone(), global_cache_path) .expect("should be infallible with absolute custom root"); - let global = Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter::new_real(), - deno_dir.remote_folder_path(), - )); + let global = + Arc::new(GlobalHttpCache::new(sys, deno_dir.remote_folder_path())); Self { deno_dir, global, diff --git a/cli/lsp/capabilities.rs b/cli/lsp/capabilities.rs index 5cdb1224d8..4c81edeea2 100644 --- a/cli/lsp/capabilities.rs +++ b/cli/lsp/capabilities.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! //! Provides information about what capabilities that are supported by the diff --git a/cli/lsp/client.rs b/cli/lsp/client.rs index 65865d5b32..85ea1bb4e5 100644 --- a/cli/lsp/client.rs +++ b/cli/lsp/client.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::Arc; @@ -12,12 +12,11 @@ use lsp_types::Uri; use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types::ConfigurationItem; -use crate::lsp::repl::get_repl_workspace_settings; - use super::config::WorkspaceSettings; use super::config::SETTINGS_SECTION; use super::lsp_custom; use super::testing::lsp_custom as testing_lsp_custom; +use crate::lsp::repl::get_repl_workspace_settings; #[derive(Debug)] pub enum TestingNotification { diff --git a/cli/lsp/code_lens.rs b/cli/lsp/code_lens.rs index a57ca3ac9f..bb72d0db77 100644 --- a/cli/lsp/code_lens.rs +++ b/cli/lsp/code_lens.rs @@ -1,13 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::lsp::logging::lsp_warn; - -use super::analysis::source_range_to_lsp_range; -use super::config::CodeLensSettings; -use super::language_server; -use super::text::LineIndex; -use super::tsc; -use super::tsc::NavigationTree; +use std::cell::RefCell; +use std::collections::HashSet; +use std::rc::Rc; +use std::sync::Arc; use deno_ast::swc::ast; use deno_ast::swc::visit::Visit; @@ -25,13 +21,17 @@ use deno_core::ModuleSpecifier; use lazy_regex::lazy_regex; use once_cell::sync::Lazy; use regex::Regex; -use std::cell::RefCell; -use std::collections::HashSet; -use std::rc::Rc; -use std::sync::Arc; use tower_lsp::jsonrpc::Error as LspError; use tower_lsp::lsp_types as lsp; +use super::analysis::source_range_to_lsp_range; +use super::config::CodeLensSettings; +use super::language_server; +use super::text::LineIndex; +use super::tsc; +use super::tsc::NavigationTree; +use crate::lsp::logging::lsp_warn; + static ABSTRACT_MODIFIER: Lazy = lazy_regex!(r"\babstract\b"); static EXPORT_MODIFIER: Lazy = lazy_regex!(r"\bexport\b"); diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs index 31f0b066ed..7309d984b4 100644 --- a/cli/lsp/completions.rs +++ b/cli/lsp/completions.rs @@ -1,4 +1,26 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use deno_ast::LineAndColumnIndex; +use deno_ast::SourceTextInfo; +use deno_core::resolve_path; +use deno_core::resolve_url; +use deno_core::serde::Deserialize; +use deno_core::serde::Serialize; +use deno_core::serde_json::json; +use deno_core::url::Position; +use deno_core::ModuleSpecifier; +use deno_path_util::url_to_file_path; +use deno_runtime::deno_node::SUPPORTED_BUILTIN_NODE_MODULES; +use deno_semver::jsr::JsrPackageReqReference; +use deno_semver::package::PackageNv; +use import_map::ImportMap; +use indexmap::IndexSet; +use lsp_types::CompletionList; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; +use once_cell::sync::Lazy; +use regex::Regex; +use tower_lsp::lsp_types as lsp; use super::client::Client; use super::config::Config; @@ -12,33 +34,10 @@ use super::registries::ModuleRegistry; use super::resolver::LspResolver; use super::search::PackageSearchApi; use super::tsc; - use crate::graph_util::to_node_resolution_mode; use crate::jsr::JsrFetchResolver; use crate::util::path::is_importable_ext; use crate::util::path::relative_specifier; -use deno_runtime::deno_node::SUPPORTED_BUILTIN_NODE_MODULES; - -use deno_ast::LineAndColumnIndex; -use deno_ast::SourceTextInfo; -use deno_core::resolve_path; -use deno_core::resolve_url; -use deno_core::serde::Deserialize; -use deno_core::serde::Serialize; -use deno_core::serde_json::json; -use deno_core::url::Position; -use deno_core::ModuleSpecifier; -use deno_path_util::url_to_file_path; -use deno_semver::jsr::JsrPackageReqReference; -use deno_semver::package::PackageNv; -use import_map::ImportMap; -use indexmap::IndexSet; -use lsp_types::CompletionList; -use node_resolver::NodeResolutionKind; -use node_resolver::ResolutionMode; -use once_cell::sync::Lazy; -use regex::Regex; -use tower_lsp::lsp_types as lsp; static FILE_PROTO_RE: Lazy = lazy_regex::lazy_regex!(r#"^file:/{2}(?:/[A-Za-z]:)?"#); @@ -822,16 +821,18 @@ fn get_workspace_completions( #[cfg(test)] mod tests { + use std::collections::HashMap; + + use deno_core::resolve_url; + use pretty_assertions::assert_eq; + use test_util::TempDir; + use super::*; use crate::cache::HttpCache; use crate::lsp::cache::LspCache; use crate::lsp::documents::Documents; use crate::lsp::documents::LanguageId; use crate::lsp::search::tests::TestPackageSearchApi; - use deno_core::resolve_url; - use pretty_assertions::assert_eq; - use std::collections::HashMap; - use test_util::TempDir; fn setup( open_sources: &[(&str, &str, i32, LanguageId)], diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index 27ca6638a9..7c63a259a7 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -1,4 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::BTreeMap; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::ops::Deref; +use std::ops::DerefMut; +use std::path::Path; +use std::path::PathBuf; +use std::sync::Arc; use deno_ast::MediaType; use deno_config::deno_json::DenoJsonCache; @@ -36,18 +45,9 @@ use deno_lint::linter::LintConfig as DenoLintConfig; use deno_npm::npm_rc::ResolvedNpmRc; use deno_package_json::PackageJsonCache; use deno_path_util::url_to_file_path; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::PackageJson; use indexmap::IndexSet; use lsp_types::ClientCapabilities; -use std::collections::BTreeMap; -use std::collections::BTreeSet; -use std::collections::HashMap; -use std::ops::Deref; -use std::ops::DerefMut; -use std::path::Path; -use std::path::PathBuf; -use std::sync::Arc; use tower_lsp::lsp_types as lsp; use super::logging::lsp_log; @@ -65,6 +65,7 @@ use crate::file_fetcher::CliFileFetcher; use crate::lsp::logging::lsp_warn; use crate::resolver::CliSloppyImportsResolver; use crate::resolver::SloppyImportsCachedFs; +use crate::sys::CliSys; use crate::tools::lint::CliLinter; use crate::tools::lint::CliLinterOptions; use crate::tools::lint::LintRuleProvider; @@ -1227,7 +1228,7 @@ impl ConfigData { Ok(scope_dir_path) => { let paths = [scope_dir_path]; WorkspaceDirectory::discover( - &FsSysTraitsAdapter::new_real(), + &CliSys::default(), match specified_config { Some(config_path) => { deno_config::workspace::WorkspaceDiscoverStart::ConfigFile( @@ -1617,9 +1618,7 @@ impl ConfigData { || unstable.contains("sloppy-imports"); let sloppy_imports_resolver = unstable_sloppy_imports.then(|| { Arc::new(CliSloppyImportsResolver::new( - SloppyImportsCachedFs::new_without_stat_cache( - FsSysTraitsAdapter::new_real(), - ), + SloppyImportsCachedFs::new_without_stat_cache(CliSys::default()), )) }); let resolver = Arc::new(resolver); @@ -1922,17 +1921,20 @@ impl ConfigTree { #[cfg(test)] pub async fn inject_config_file(&mut self, config_file: ConfigFile) { + use sys_traits::FsCreateDirAll; + use sys_traits::FsWrite; + let scope = config_file.specifier.join(".").unwrap(); let json_text = serde_json::to_string(&config_file.json).unwrap(); - let test_fs = Arc::new(deno_runtime::deno_fs::InMemoryFs::default()); + let memory_sys = sys_traits::impls::InMemorySys::default(); let config_path = url_to_file_path(&config_file.specifier).unwrap(); - test_fs.setup_text_files(vec![( - config_path.to_string_lossy().to_string(), - json_text, - )]); + memory_sys + .fs_create_dir_all(config_path.parent().unwrap()) + .unwrap(); + memory_sys.fs_write(&config_path, json_text).unwrap(); let workspace_dir = Arc::new( WorkspaceDirectory::discover( - &FsSysTraitsAdapter(test_fs.clone()), + &memory_sys, deno_config::workspace::WorkspaceDiscoverStart::ConfigFile( &config_path, ), @@ -2009,11 +2011,14 @@ fn resolve_lockfile_from_path( lockfile_path: PathBuf, frozen: bool, ) -> Option { - match CliLockfile::read_from_path(CliLockfileReadFromPathOptions { - file_path: lockfile_path, - frozen, - skip_write: false, - }) { + match CliLockfile::read_from_path( + &CliSys::default(), + CliLockfileReadFromPathOptions { + file_path: lockfile_path, + frozen, + skip_write: false, + }, + ) { Ok(value) => { if value.filename.exists() { if let Ok(specifier) = ModuleSpecifier::from_file_path(&value.filename) diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs index 33fd4897c4..cc9cca7f23 100644 --- a/cli/lsp/diagnostics.rs +++ b/cli/lsp/diagnostics.rs @@ -1,31 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::analysis; -use super::client::Client; -use super::config::Config; -use super::documents; -use super::documents::Document; -use super::documents::Documents; -use super::documents::DocumentsFilter; -use super::language_server; -use super::language_server::StateSnapshot; -use super::performance::Performance; -use super::tsc; -use super::tsc::TsServer; -use super::urls::uri_parse_unencoded; -use super::urls::url_to_uri; -use super::urls::LspUrlMap; - -use crate::graph_util; -use crate::graph_util::enhanced_resolution_error_message; -use crate::lsp::lsp_custom::DiagnosticBatchNotificationParams; -use crate::resolver::CliSloppyImportsResolver; -use crate::resolver::SloppyImportsCachedFs; -use crate::tools::lint::CliLinter; -use crate::tools::lint::CliLinterOptions; -use crate::tools::lint::LintRuleProvider; -use crate::tsc::DiagnosticCategory; -use crate::util::path::to_percent_decoded_str; +use std::collections::HashMap; +use std::collections::HashSet; +use std::path::PathBuf; +use std::sync::atomic::AtomicUsize; +use std::sync::Arc; +use std::thread; use deno_ast::MediaType; use deno_config::deno_json::LintConfig; @@ -48,7 +28,6 @@ use deno_graph::SpecifierError; use deno_lint::linter::LintConfig as DenoLintConfig; use deno_resolver::sloppy_imports::SloppyImportsResolution; use deno_resolver::sloppy_imports::SloppyImportsResolutionKind; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node; use deno_runtime::tokio_util::create_basic_runtime; use deno_semver::jsr::JsrPackageReqReference; @@ -57,18 +36,39 @@ use deno_semver::package::PackageReq; use import_map::ImportMap; use import_map::ImportMapError; use log::error; -use std::collections::HashMap; -use std::collections::HashSet; -use std::path::PathBuf; -use std::sync::atomic::AtomicUsize; -use std::sync::Arc; -use std::thread; use tokio::sync::mpsc; use tokio::sync::Mutex; use tokio::time::Duration; use tokio_util::sync::CancellationToken; use tower_lsp::lsp_types as lsp; +use super::analysis; +use super::client::Client; +use super::config::Config; +use super::documents; +use super::documents::Document; +use super::documents::Documents; +use super::documents::DocumentsFilter; +use super::language_server; +use super::language_server::StateSnapshot; +use super::performance::Performance; +use super::tsc; +use super::tsc::TsServer; +use super::urls::uri_parse_unencoded; +use super::urls::url_to_uri; +use super::urls::LspUrlMap; +use crate::graph_util; +use crate::graph_util::enhanced_resolution_error_message; +use crate::lsp::lsp_custom::DiagnosticBatchNotificationParams; +use crate::resolver::CliSloppyImportsResolver; +use crate::resolver::SloppyImportsCachedFs; +use crate::sys::CliSys; +use crate::tools::lint::CliLinter; +use crate::tools::lint::CliLinterOptions; +use crate::tools::lint::LintRuleProvider; +use crate::tsc::DiagnosticCategory; +use crate::util::path::to_percent_decoded_str; + #[derive(Debug)] pub struct DiagnosticServerUpdateMessage { pub snapshot: Arc, @@ -1281,7 +1281,7 @@ impl DenoDiagnostic { Self::NotInstalledNpm(pkg_req, specifier) => (lsp::DiagnosticSeverity::ERROR, format!("npm package \"{pkg_req}\" is not installed or doesn't exist."), Some(json!({ "specifier": specifier }))), Self::NoLocal(specifier) => { let maybe_sloppy_resolution = CliSloppyImportsResolver::new( - SloppyImportsCachedFs::new(FsSysTraitsAdapter::new_real()) + SloppyImportsCachedFs::new(CliSys::default()) ).resolve(specifier, SloppyImportsResolutionKind::Execution); let data = maybe_sloppy_resolution.as_ref().map(|res| { json!({ @@ -1646,6 +1646,12 @@ fn generate_deno_diagnostics( #[cfg(test)] mod tests { + use std::sync::Arc; + + use deno_config::deno_json::ConfigFile; + use pretty_assertions::assert_eq; + use test_util::TempDir; + use super::*; use crate::lsp::cache::LspCache; use crate::lsp::config::Config; @@ -1656,11 +1662,6 @@ mod tests { use crate::lsp::language_server::StateSnapshot; use crate::lsp::resolver::LspResolver; - use deno_config::deno_json::ConfigFile; - use pretty_assertions::assert_eq; - use std::sync::Arc; - use test_util::TempDir; - fn mock_config() -> Config { let root_url = resolve_url("file:///").unwrap(); let root_uri = url_to_uri(&root_url).unwrap(); diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index d15cfe5a6c..a8398b4f2f 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -1,18 +1,17 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::cache::calculate_fs_version; -use super::cache::LspCache; -use super::config::Config; -use super::resolver::LspResolver; -use super::resolver::ScopeDepInfo; -use super::resolver::SingleReferrerGraphResolver; -use super::testing::TestCollector; -use super::testing::TestModule; -use super::text::LineIndex; -use super::tsc; -use super::tsc::AssetDocument; - -use crate::graph_util::CliJsrUrlProvider; +use std::borrow::Cow; +use std::collections::BTreeMap; +use std::collections::HashMap; +use std::collections::HashSet; +use std::fs; +use std::future::Future; +use std::ops::Range; +use std::pin::Pin; +use std::str::FromStr; +use std::sync::atomic::AtomicBool; +use std::sync::atomic::Ordering; +use std::sync::Arc; use dashmap::DashMap; use deno_ast::swc::visit::VisitWith; @@ -36,20 +35,21 @@ use indexmap::IndexMap; use indexmap::IndexSet; use node_resolver::NodeResolutionKind; use node_resolver::ResolutionMode; -use std::borrow::Cow; -use std::collections::BTreeMap; -use std::collections::HashMap; -use std::collections::HashSet; -use std::fs; -use std::future::Future; -use std::ops::Range; -use std::pin::Pin; -use std::str::FromStr; -use std::sync::atomic::AtomicBool; -use std::sync::atomic::Ordering; -use std::sync::Arc; use tower_lsp::lsp_types as lsp; +use super::cache::calculate_fs_version; +use super::cache::LspCache; +use super::config::Config; +use super::resolver::LspResolver; +use super::resolver::ScopeDepInfo; +use super::resolver::SingleReferrerGraphResolver; +use super::testing::TestCollector; +use super::testing::TestModule; +use super::text::LineIndex; +use super::tsc; +use super::tsc::AssetDocument; +use crate::graph_util::CliJsrUrlProvider; + pub const DOCUMENT_SCHEMES: [&str; 5] = ["data", "blob", "file", "http", "https"]; @@ -1754,9 +1754,6 @@ fn bytes_to_content( #[cfg(test)] mod tests { - use super::*; - use crate::lsp::cache::LspCache; - use deno_config::deno_json::ConfigFile; use deno_config::deno_json::ConfigParseOptions; use deno_core::serde_json; @@ -1764,6 +1761,9 @@ mod tests { use pretty_assertions::assert_eq; use test_util::TempDir; + use super::*; + use crate::lsp::cache::LspCache; + async fn setup() -> (Documents, LspCache, TempDir) { let temp_dir = TempDir::new(); temp_dir.create_dir_all(".deno_dir"); diff --git a/cli/lsp/jsr.rs b/cli/lsp/jsr.rs index fc30de2ae0..1bcd6f3930 100644 --- a/cli/lsp/jsr.rs +++ b/cli/lsp/jsr.rs @@ -1,11 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::HashMap; +use std::sync::Arc; -use crate::args::jsr_api_url; -use crate::args::jsr_url; -use crate::file_fetcher::CliFileFetcher; -use crate::file_fetcher::TextDecodedFile; -use crate::jsr::partial_jsr_package_version_info_from_slice; -use crate::jsr::JsrFetchResolver; use dashmap::DashMap; use deno_cache_dir::HttpCache; use deno_core::anyhow::anyhow; @@ -21,11 +18,15 @@ use deno_semver::package::PackageReq; use deno_semver::StackString; use deno_semver::Version; use serde::Deserialize; -use std::collections::HashMap; -use std::sync::Arc; use super::config::ConfigData; use super::search::PackageSearchApi; +use crate::args::jsr_api_url; +use crate::args::jsr_url; +use crate::file_fetcher::CliFileFetcher; +use crate::file_fetcher::TextDecodedFile; +use crate::jsr::partial_jsr_package_version_info_from_slice; +use crate::jsr::JsrFetchResolver; /// Keep in sync with `JsrFetchResolver`! #[derive(Debug)] diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 372ad98e2f..104597c6a2 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -1,4 +1,15 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::BTreeMap; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::collections::HashSet; +use std::collections::VecDeque; +use std::env; +use std::fmt::Write as _; +use std::path::PathBuf; +use std::str::FromStr; +use std::sync::Arc; use deno_ast::MediaType; use deno_cache_dir::file_fetcher::CacheSetting; @@ -17,7 +28,6 @@ use deno_core::ModuleSpecifier; use deno_graph::GraphKind; use deno_graph::Resolution; use deno_path_util::url_to_file_path; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_tls::rustls::RootCertStore; use deno_runtime::deno_tls::RootCertStoreProvider; use deno_semver::jsr::JsrPackageReqReference; @@ -28,16 +38,6 @@ use node_resolver::NodeResolutionKind; use node_resolver::ResolutionMode; use serde::Deserialize; use serde_json::from_value; -use std::collections::BTreeMap; -use std::collections::BTreeSet; -use std::collections::HashMap; -use std::collections::HashSet; -use std::collections::VecDeque; -use std::env; -use std::fmt::Write as _; -use std::path::PathBuf; -use std::str::FromStr; -use std::sync::Arc; use tokio::sync::mpsc::unbounded_channel; use tokio::sync::mpsc::UnboundedReceiver; use tokio::sync::mpsc::UnboundedSender; @@ -109,6 +109,7 @@ use crate::lsp::config::ConfigWatchedFileType; use crate::lsp::logging::init_log_file; use crate::lsp::tsc::file_text_changes_to_workspace_edit; use crate::lsp::urls::LspUrlKind; +use crate::sys::CliSys; use crate::tools::fmt::format_file; use crate::tools::fmt::format_parsed_source; use crate::tools::upgrade::check_for_upgrades_for_lsp; @@ -280,7 +281,7 @@ impl LanguageServer { .await?; graph_util::graph_valid( &graph, - &FsSysTraitsAdapter(factory.fs().clone()), + &CliSys::default(), &roots, graph_util::GraphValidOptions { kind: GraphKind::All, @@ -962,6 +963,7 @@ impl Inner { let file_fetcher = CliFileFetcher::new( self.cache.global().clone(), self.http_client_provider.clone(), + CliSys::default(), Default::default(), None, true, @@ -3613,7 +3615,7 @@ impl Inner { let workspace = match config_data { Some(d) => d.member_dir.clone(), None => Arc::new(WorkspaceDirectory::discover( - &FsSysTraitsAdapter::new_real(), + &CliSys::default(), deno_config::workspace::WorkspaceDiscoverStart::Paths(&[ initial_cwd.clone() ]), @@ -3634,6 +3636,7 @@ impl Inner { )?), }; let cli_options = CliOptions::new( + &CliSys::default(), Arc::new(Flags { internal: InternalFlags { cache_path: Some(self.cache.deno_dir().root.clone()), @@ -3962,10 +3965,11 @@ impl Inner { #[cfg(test)] mod tests { - use super::*; use pretty_assertions::assert_eq; use test_util::TempDir; + use super::*; + #[test] fn test_walk_workspace() { let temp_dir = TempDir::new(); diff --git a/cli/lsp/logging.rs b/cli/lsp/logging.rs index 2b85d77ec1..efb49b2d48 100644 --- a/cli/lsp/logging.rs +++ b/cli/lsp/logging.rs @@ -1,8 +1,5 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use chrono::DateTime; -use chrono::Utc; -use deno_core::parking_lot::Mutex; use std::fs; use std::io::prelude::*; use std::path::Path; @@ -12,6 +9,10 @@ use std::sync::atomic::Ordering; use std::thread; use std::time::SystemTime; +use chrono::DateTime; +use chrono::Utc; +use deno_core::parking_lot::Mutex; + static LSP_DEBUG_FLAG: AtomicBool = AtomicBool::new(false); static LSP_LOG_LEVEL: AtomicUsize = AtomicUsize::new(log::Level::Info as usize); static LSP_WARN_LEVEL: AtomicUsize = diff --git a/cli/lsp/lsp_custom.rs b/cli/lsp/lsp_custom.rs index 8df4ba1d07..050fcf3184 100644 --- a/cli/lsp/lsp_custom.rs +++ b/cli/lsp/lsp_custom.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::serde::Deserialize; use deno_core::serde::Serialize; diff --git a/cli/lsp/mod.rs b/cli/lsp/mod.rs index afb949f68d..6b5d17798b 100644 --- a/cli/lsp/mod.rs +++ b/cli/lsp/mod.rs @@ -1,16 +1,15 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::error::AnyError; use deno_core::unsync::spawn; +pub use repl::ReplCompletionItem; +pub use repl::ReplLanguageServer; use tower_lsp::LspService; use tower_lsp::Server; +use self::diagnostics::should_send_diagnostic_batch_index_notifications; use crate::lsp::language_server::LanguageServer; use crate::util::sync::AsyncFlag; -pub use repl::ReplCompletionItem; -pub use repl::ReplLanguageServer; - -use self::diagnostics::should_send_diagnostic_batch_index_notifications; mod analysis; mod cache; diff --git a/cli/lsp/npm.rs b/cli/lsp/npm.rs index 18c7e2fccf..d53c8cb2ab 100644 --- a/cli/lsp/npm.rs +++ b/cli/lsp/npm.rs @@ -1,4 +1,6 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::sync::Arc; use dashmap::DashMap; use deno_core::anyhow::anyhow; @@ -8,15 +10,13 @@ use deno_npm::npm_rc::NpmRc; use deno_semver::package::PackageNv; use deno_semver::Version; use serde::Deserialize; -use std::sync::Arc; +use super::search::PackageSearchApi; use crate::args::npm_registry_url; use crate::file_fetcher::CliFileFetcher; use crate::file_fetcher::TextDecodedFile; use crate::npm::NpmFetchResolver; -use super::search::PackageSearchApi; - #[derive(Debug)] pub struct CliNpmSearchApi { file_fetcher: Arc, diff --git a/cli/lsp/parent_process_checker.rs b/cli/lsp/parent_process_checker.rs index b8a42cd1a4..b8ab60922b 100644 --- a/cli/lsp/parent_process_checker.rs +++ b/cli/lsp/parent_process_checker.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::time::Duration; @@ -52,10 +52,12 @@ fn is_process_active(process_id: u32) -> bool { #[cfg(test)] mod test { - use super::is_process_active; use std::process::Command; + use test_util::deno_exe_path; + use super::is_process_active; + #[test] fn process_active() { // launch a long running process diff --git a/cli/lsp/path_to_regex.rs b/cli/lsp/path_to_regex.rs index 88d8a2ec68..65322da6d0 100644 --- a/cli/lsp/path_to_regex.rs +++ b/cli/lsp/path_to_regex.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // The logic of this module is heavily influenced by path-to-regexp at: // https://github.com/pillarjs/path-to-regexp/ which is licensed as follows: @@ -26,15 +26,16 @@ // THE SOFTWARE. // +use std::collections::HashMap; +use std::fmt; +use std::fmt::Write as _; +use std::iter::Peekable; + use deno_core::anyhow::anyhow; use deno_core::error::AnyError; use fancy_regex::Regex as FancyRegex; use once_cell::sync::Lazy; use regex::Regex; -use std::collections::HashMap; -use std::fmt; -use std::fmt::Write as _; -use std::iter::Peekable; static ESCAPE_STRING_RE: Lazy = lazy_regex::lazy_regex!(r"([.+*?=^!:${}()\[\]|/\\])"); diff --git a/cli/lsp/performance.rs b/cli/lsp/performance.rs index b3dc53b283..8d836c7adf 100644 --- a/cli/lsp/performance.rs +++ b/cli/lsp/performance.rs @@ -1,9 +1,5 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use deno_core::parking_lot::Mutex; -use deno_core::serde::Deserialize; -use deno_core::serde::Serialize; -use deno_core::serde_json::json; use std::cmp; use std::collections::HashMap; use std::collections::VecDeque; @@ -12,6 +8,11 @@ use std::sync::Arc; use std::time::Duration; use std::time::Instant; +use deno_core::parking_lot::Mutex; +use deno_core::serde::Deserialize; +use deno_core::serde::Serialize; +use deno_core::serde_json::json; + use super::logging::lsp_debug; #[derive(Debug, Deserialize, Serialize, PartialEq, Eq)] diff --git a/cli/lsp/refactor.rs b/cli/lsp/refactor.rs index 82751d3b12..e1abd963a2 100644 --- a/cli/lsp/refactor.rs +++ b/cli/lsp/refactor.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // The logic of this module is heavily influenced by // https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/src/languageFeatures/refactor.ts diff --git a/cli/lsp/registries.rs b/cli/lsp/registries.rs index 488e333e9d..f8c38d97ea 100644 --- a/cli/lsp/registries.rs +++ b/cli/lsp/registries.rs @@ -1,24 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::completions::IMPORT_COMMIT_CHARS; -use super::logging::lsp_log; -use super::path_to_regex::parse; -use super::path_to_regex::string_to_regex; -use super::path_to_regex::Compiler; -use super::path_to_regex::Key; -use super::path_to_regex::MatchResult; -use super::path_to_regex::Matcher; -use super::path_to_regex::StringOrNumber; -use super::path_to_regex::StringOrVec; -use super::path_to_regex::Token; - -use crate::cache::GlobalHttpCache; -use crate::cache::HttpCache; -use crate::file_fetcher::CliFileFetcher; -use crate::file_fetcher::FetchOptions; -use crate::file_fetcher::FetchPermissionsOptionRef; -use crate::file_fetcher::TextDecodedFile; -use crate::http_util::HttpClientProvider; +use std::borrow::Cow; +use std::collections::HashMap; +use std::path::PathBuf; +use std::sync::Arc; use deno_cache_dir::file_fetcher::CacheSetting; use deno_core::anyhow::anyhow; @@ -32,15 +17,30 @@ use deno_core::url::Position; use deno_core::url::Url; use deno_core::ModuleSpecifier; use deno_graph::Dependency; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use log::error; use once_cell::sync::Lazy; -use std::borrow::Cow; -use std::collections::HashMap; -use std::path::PathBuf; -use std::sync::Arc; use tower_lsp::lsp_types as lsp; +use super::completions::IMPORT_COMMIT_CHARS; +use super::logging::lsp_log; +use super::path_to_regex::parse; +use super::path_to_regex::string_to_regex; +use super::path_to_regex::Compiler; +use super::path_to_regex::Key; +use super::path_to_regex::MatchResult; +use super::path_to_regex::Matcher; +use super::path_to_regex::StringOrNumber; +use super::path_to_regex::StringOrVec; +use super::path_to_regex::Token; +use crate::cache::GlobalHttpCache; +use crate::cache::HttpCache; +use crate::file_fetcher::CliFileFetcher; +use crate::file_fetcher::FetchOptions; +use crate::file_fetcher::FetchPermissionsOptionRef; +use crate::file_fetcher::TextDecodedFile; +use crate::http_util::HttpClientProvider; +use crate::sys::CliSys; + const CONFIG_PATH: &str = "/.well-known/deno-import-intellisense.json"; const COMPONENT: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS .add(b' ') @@ -430,13 +430,12 @@ impl ModuleRegistry { http_client_provider: Arc, ) -> Self { // the http cache should always be the global one for registry completions - let http_cache = Arc::new(GlobalHttpCache::new( - FsSysTraitsAdapter::new_real(), - location.clone(), - )); + let http_cache = + Arc::new(GlobalHttpCache::new(CliSys::default(), location.clone())); let file_fetcher = CliFileFetcher::new( http_cache.clone(), http_client_provider, + CliSys::default(), Default::default(), None, true, @@ -1129,9 +1128,10 @@ FetchPermissionsOptionRef::AllowAll, #[cfg(test)] mod tests { - use super::*; use test_util::TempDir; + use super::*; + #[test] fn test_validate_registry_configuration() { assert!(validate_config(&RegistryConfigurationJson { diff --git a/cli/lsp/repl.rs b/cli/lsp/repl.rs index b4aaa8cd0d..a30427312d 100644 --- a/cli/lsp/repl.rs +++ b/cli/lsp/repl.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; diff --git a/cli/lsp/resolver.rs b/cli/lsp/resolver.rs index 5295b2d41c..7d8f209a7b 100644 --- a/cli/lsp/resolver.rs +++ b/cli/lsp/resolver.rs @@ -1,4 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::collections::BTreeMap; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::collections::HashSet; +use std::sync::Arc; use dashmap::DashMap; use deno_ast::MediaType; @@ -19,9 +26,6 @@ use deno_resolver::cjs::IsCjsResolutionMode; use deno_resolver::npm::NpmReqResolverOptions; use deno_resolver::DenoResolverOptions; use deno_resolver::NodeAndNpmReqResolver; -use deno_runtime::deno_fs::FsSysTraitsAdapter; -use deno_runtime::deno_node::NodeResolver; -use deno_runtime::deno_node::PackageJsonResolver; use deno_runtime::deno_node::RealIsBuiltInNodeModuleChecker; use deno_semver::jsr::JsrPackageReqReference; use deno_semver::npm::NpmPackageReqReference; @@ -31,12 +35,6 @@ use indexmap::IndexMap; use node_resolver::InNpmPackageChecker; use node_resolver::NodeResolutionKind; use node_resolver::ResolutionMode; -use std::borrow::Cow; -use std::collections::BTreeMap; -use std::collections::BTreeSet; -use std::collections::HashMap; -use std::collections::HashSet; -use std::sync::Arc; use super::cache::LspCache; use super::jsr::JsrCacheResolver; @@ -51,6 +49,8 @@ use crate::http_util::HttpClientProvider; use crate::lsp::config::Config; use crate::lsp::config::ConfigData; use crate::lsp::logging::lsp_warn; +use crate::node::CliNodeResolver; +use crate::node::CliPackageJsonResolver; use crate::npm::create_cli_npm_resolver_for_lsp; use crate::npm::CliByonmNpmResolverCreateOptions; use crate::npm::CliManagedInNpmPkgCheckerCreateOptions; @@ -66,6 +66,7 @@ use crate::resolver::CliResolver; use crate::resolver::CliResolverOptions; use crate::resolver::IsCjsResolver; use crate::resolver::WorkerCliNpmGraphResolver; +use crate::sys::CliSys; use crate::tsc::into_specifier_and_media_type; use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; @@ -77,9 +78,9 @@ struct LspScopeResolver { is_cjs_resolver: Arc, jsr_resolver: Option>, npm_resolver: Option>, - node_resolver: Option>, + node_resolver: Option>, npm_pkg_req_resolver: Option>, - pkg_json_resolver: Arc, + pkg_json_resolver: Arc, redirect_resolver: Option>, graph_imports: Arc>, dep_info: Arc>>, @@ -383,7 +384,7 @@ impl LspResolver { pub fn pkg_json_resolver( &self, referrer: &ModuleSpecifier, - ) -> &Arc { + ) -> &Arc { let resolver = self.get_scope_resolver(Some(referrer)); &resolver.pkg_json_resolver } @@ -591,22 +592,22 @@ struct ResolverFactoryServices { cli_resolver: Deferred>, in_npm_pkg_checker: Deferred>, is_cjs_resolver: Deferred>, - node_resolver: Deferred>>, + node_resolver: Deferred>>, npm_pkg_req_resolver: Deferred>>, npm_resolver: Option>, } struct ResolverFactory<'a> { config_data: Option<&'a Arc>, - pkg_json_resolver: Arc, - sys: FsSysTraitsAdapter, + pkg_json_resolver: Arc, + sys: CliSys, services: ResolverFactoryServices, } impl<'a> ResolverFactory<'a> { pub fn new(config_data: Option<&'a Arc>) -> Self { - let sys = FsSysTraitsAdapter::new_real(); - let pkg_json_resolver = Arc::new(PackageJsonResolver::new(sys.clone())); + let sys = CliSys::default(); + let pkg_json_resolver = Arc::new(CliPackageJsonResolver::new(sys.clone())); Self { config_data, pkg_json_resolver, @@ -621,7 +622,7 @@ impl<'a> ResolverFactory<'a> { cache: &LspCache, ) { let enable_byonm = self.config_data.map(|d| d.byonm).unwrap_or(false); - let sys = FsSysTraitsAdapter::new_real(); + let sys = CliSys::default(); let options = if enable_byonm { CliNpmResolverCreateOptions::Byonm(CliByonmNpmResolverCreateOptions { sys, @@ -656,7 +657,7 @@ impl<'a> ResolverFactory<'a> { } None => CliNpmResolverManagedSnapshotOption::Specified(None), }, - sys: FsSysTraitsAdapter::new_real(), + sys: CliSys::default(), npm_cache_dir, // Use an "only" cache setting in order to make the // user do an explicit "cache" command and prevent @@ -729,7 +730,7 @@ impl<'a> ResolverFactory<'a> { }) } - pub fn pkg_json_resolver(&self) -> &Arc { + pub fn pkg_json_resolver(&self) -> &Arc { &self.pkg_json_resolver } @@ -770,13 +771,13 @@ impl<'a> ResolverFactory<'a> { }) } - pub fn node_resolver(&self) -> Option<&Arc> { + pub fn node_resolver(&self) -> Option<&Arc> { self .services .node_resolver .get_or_init(|| { let npm_resolver = self.services.npm_resolver.as_ref()?; - Some(Arc::new(NodeResolver::new( + Some(Arc::new(CliNodeResolver::new( self.in_npm_pkg_checker().clone(), RealIsBuiltInNodeModuleChecker, npm_resolver.clone().into_npm_pkg_folder_resolver(), diff --git a/cli/lsp/search.rs b/cli/lsp/search.rs index c98acde6f1..281542742d 100644 --- a/cli/lsp/search.rs +++ b/cli/lsp/search.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::sync::Arc; use deno_core::error::AnyError; use deno_semver::package::PackageNv; use deno_semver::Version; -use std::sync::Arc; #[async_trait::async_trait] pub trait PackageSearchApi { @@ -15,10 +16,12 @@ pub trait PackageSearchApi { #[cfg(test)] pub mod tests { - use super::*; - use deno_core::anyhow::anyhow; use std::collections::BTreeMap; + use deno_core::anyhow::anyhow; + + use super::*; + #[derive(Debug, Default)] pub struct TestPackageSearchApi { /// [(name -> [(version -> [export])])] diff --git a/cli/lsp/semantic_tokens.rs b/cli/lsp/semantic_tokens.rs index 0cf154d0ff..d2466f4c14 100644 --- a/cli/lsp/semantic_tokens.rs +++ b/cli/lsp/semantic_tokens.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // The logic of this module is heavily influenced by // https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/src/languageFeatures/semanticTokens.ts @@ -7,6 +7,7 @@ use std::ops::Index; use std::ops::IndexMut; + use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types::SemanticToken; use tower_lsp::lsp_types::SemanticTokenModifier; diff --git a/cli/lsp/testing/collectors.rs b/cli/lsp/testing/collectors.rs index 2dd7ec0d96..8a36ca1f25 100644 --- a/cli/lsp/testing/collectors.rs +++ b/cli/lsp/testing/collectors.rs @@ -1,8 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::lsp::analysis::source_range_to_lsp_range; - -use super::definitions::TestModule; +use std::collections::HashMap; +use std::collections::HashSet; use deno_ast::swc::ast; use deno_ast::swc::visit::Visit; @@ -11,10 +10,11 @@ use deno_ast::SourceRangedForSpanned; use deno_ast::SourceTextInfo; use deno_core::ModuleSpecifier; use lsp::Range; -use std::collections::HashMap; -use std::collections::HashSet; use tower_lsp::lsp_types as lsp; +use super::definitions::TestModule; +use crate::lsp::analysis::source_range_to_lsp_range; + /// Parse an arrow expression for any test steps and return them. fn visit_arrow( arrow_expr: &ast::ArrowExpr, @@ -626,12 +626,12 @@ impl Visit for TestCollector { #[cfg(test)] pub mod tests { - use crate::lsp::testing::definitions::TestDefinition; - - use super::*; use deno_core::resolve_url; use lsp::Position; + use super::*; + use crate::lsp::testing::definitions::TestDefinition; + pub fn new_range(l1: u32, c1: u32, l2: u32, c2: u32) -> Range { Range::new(Position::new(l1, c1), Position::new(l2, c2)) } diff --git a/cli/lsp/testing/definitions.rs b/cli/lsp/testing/definitions.rs index f23411852f..8277dcbf00 100644 --- a/cli/lsp/testing/definitions.rs +++ b/cli/lsp/testing/definitions.rs @@ -1,8 +1,15 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::HashMap; +use std::collections::HashSet; + +use deno_core::error::AnyError; +use deno_core::ModuleSpecifier; +use lsp::Range; +use tower_lsp::lsp_types as lsp; use super::lsp_custom; use super::lsp_custom::TestData; - use crate::lsp::client::TestingNotification; use crate::lsp::logging::lsp_warn; use crate::lsp::urls::url_to_uri; @@ -10,13 +17,6 @@ use crate::tools::test::TestDescription; use crate::tools::test::TestStepDescription; use crate::util::checksum; -use deno_core::error::AnyError; -use deno_core::ModuleSpecifier; -use lsp::Range; -use std::collections::HashMap; -use std::collections::HashSet; -use tower_lsp::lsp_types as lsp; - #[derive(Debug, Clone, PartialEq)] pub struct TestDefinition { pub id: String, diff --git a/cli/lsp/testing/execution.rs b/cli/lsp/testing/execution.rs index 88fb496e4e..3d6d6f6b73 100644 --- a/cli/lsp/testing/execution.rs +++ b/cli/lsp/testing/execution.rs @@ -1,24 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::definitions::TestDefinition; -use super::definitions::TestModule; -use super::lsp_custom; -use super::server::TestServerTests; - -use crate::args::flags_from_vec; -use crate::args::DenoSubcommand; -use crate::factory::CliFactory; -use crate::lsp::client::Client; -use crate::lsp::client::TestingNotification; -use crate::lsp::config; -use crate::lsp::logging::lsp_log; -use crate::lsp::urls::uri_parse_unencoded; -use crate::lsp::urls::uri_to_url; -use crate::lsp::urls::url_to_uri; -use crate::tools::test; -use crate::tools::test::create_test_event_channel; -use crate::tools::test::FailFastTracker; -use crate::tools::test::TestFailureFormatOptions; +use std::borrow::Cow; +use std::collections::HashMap; +use std::collections::HashSet; +use std::num::NonZeroUsize; +use std::sync::Arc; +use std::time::Duration; +use std::time::Instant; use deno_core::anyhow::anyhow; use deno_core::error::AnyError; @@ -34,16 +22,28 @@ use deno_runtime::deno_permissions::Permissions; use deno_runtime::deno_permissions::PermissionsContainer; use deno_runtime::tokio_util::create_and_run_current_thread; use indexmap::IndexMap; -use std::borrow::Cow; -use std::collections::HashMap; -use std::collections::HashSet; -use std::num::NonZeroUsize; -use std::sync::Arc; -use std::time::Duration; -use std::time::Instant; use tokio_util::sync::CancellationToken; use tower_lsp::lsp_types as lsp; +use super::definitions::TestDefinition; +use super::definitions::TestModule; +use super::lsp_custom; +use super::server::TestServerTests; +use crate::args::flags_from_vec; +use crate::args::DenoSubcommand; +use crate::factory::CliFactory; +use crate::lsp::client::Client; +use crate::lsp::client::TestingNotification; +use crate::lsp::config; +use crate::lsp::logging::lsp_log; +use crate::lsp::urls::uri_parse_unencoded; +use crate::lsp::urls::uri_to_url; +use crate::lsp::urls::url_to_uri; +use crate::tools::test; +use crate::tools::test::create_test_event_channel; +use crate::tools::test::FailFastTracker; +use crate::tools::test::TestFailureFormatOptions; + /// Logic to convert a test request into a set of test modules to be tested and /// any filters to be applied to those tests fn as_queue_and_filters( @@ -794,9 +794,10 @@ impl LspTestReporter { #[cfg(test)] mod tests { + use deno_core::serde_json::json; + use super::*; use crate::lsp::testing::collectors::tests::new_range; - use deno_core::serde_json::json; #[test] fn test_as_queue_and_filters() { diff --git a/cli/lsp/testing/lsp_custom.rs b/cli/lsp/testing/lsp_custom.rs index 84ac30de57..5ee6e84f52 100644 --- a/cli/lsp/testing/lsp_custom.rs +++ b/cli/lsp/testing/lsp_custom.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::serde::Deserialize; use deno_core::serde::Serialize; diff --git a/cli/lsp/testing/mod.rs b/cli/lsp/testing/mod.rs index d285481f06..1398ba1eca 100644 --- a/cli/lsp/testing/mod.rs +++ b/cli/lsp/testing/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod collectors; mod definitions; diff --git a/cli/lsp/testing/server.rs b/cli/lsp/testing/server.rs index c9c39d9ffc..e0570fcada 100644 --- a/cli/lsp/testing/server.rs +++ b/cli/lsp/testing/server.rs @@ -1,16 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::definitions::TestModule; -use super::execution::TestRun; -use super::lsp_custom; - -use crate::lsp::client::Client; -use crate::lsp::client::TestingNotification; -use crate::lsp::config; -use crate::lsp::documents::DocumentsFilter; -use crate::lsp::language_server::StateSnapshot; -use crate::lsp::performance::Performance; -use crate::lsp::urls::url_to_uri; +use std::collections::HashMap; +use std::collections::HashSet; +use std::sync::Arc; +use std::thread; use deno_core::error::AnyError; use deno_core::parking_lot::Mutex; @@ -18,15 +11,22 @@ use deno_core::serde_json::json; use deno_core::serde_json::Value; use deno_core::ModuleSpecifier; use deno_runtime::tokio_util::create_basic_runtime; -use std::collections::HashMap; -use std::collections::HashSet; -use std::sync::Arc; -use std::thread; use tokio::sync::mpsc; use tower_lsp::jsonrpc::Error as LspError; use tower_lsp::jsonrpc::Result as LspResult; use tower_lsp::lsp_types as lsp; +use super::definitions::TestModule; +use super::execution::TestRun; +use super::lsp_custom; +use crate::lsp::client::Client; +use crate::lsp::client::TestingNotification; +use crate::lsp::config; +use crate::lsp::documents::DocumentsFilter; +use crate::lsp::language_server::StateSnapshot; +use crate::lsp::performance::Performance; +use crate::lsp::urls::url_to_uri; + fn as_delete_notification( url: &ModuleSpecifier, ) -> Result { diff --git a/cli/lsp/text.rs b/cli/lsp/text.rs index 88f27915bb..a9a5f0753a 100644 --- a/cli/lsp/text.rs +++ b/cli/lsp/text.rs @@ -1,10 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::HashMap; use deno_core::error::custom_error; use deno_core::error::AnyError; use dissimilar::diff; use dissimilar::Chunk; -use std::collections::HashMap; use text_size::TextRange; use text_size::TextSize; use tower_lsp::jsonrpc; diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index f8b972511f..d2b501a539 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -1,52 +1,29 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::analysis::CodeActionData; -use super::code_lens; -use super::config; -use super::config::LspTsConfig; -use super::documents::AssetOrDocument; -use super::documents::Document; -use super::documents::DocumentsFilter; -use super::language_server; -use super::language_server::StateSnapshot; -use super::performance::Performance; -use super::performance::PerformanceMark; -use super::refactor::RefactorCodeActionData; -use super::refactor::ALL_KNOWN_REFACTOR_ACTION_KINDS; -use super::refactor::EXTRACT_CONSTANT; -use super::refactor::EXTRACT_INTERFACE; -use super::refactor::EXTRACT_TYPE; -use super::semantic_tokens; -use super::semantic_tokens::SemanticTokensBuilder; -use super::text::LineIndex; -use super::urls::uri_to_url; -use super::urls::url_to_uri; -use super::urls::INVALID_SPECIFIER; -use super::urls::INVALID_URI; - -use crate::args::jsr_url; -use crate::args::FmtOptionsConfig; -use crate::lsp::logging::lsp_warn; -use crate::tsc; -use crate::tsc::ResolveArgs; -use crate::tsc::MISSING_DEPENDENCY_SPECIFIER; -use crate::util::path::relative_specifier; -use crate::util::path::to_percent_decoded_str; -use crate::util::result::InfallibleResultExt; -use crate::util::v8::convert; -use crate::worker::create_isolate_create_params; -use deno_core::convert::Smi; -use deno_core::convert::ToV8; -use deno_core::error::StdAnyError; -use deno_core::futures::stream::FuturesOrdered; -use deno_core::futures::StreamExt; +use std::cell::RefCell; +use std::cmp; +use std::collections::BTreeMap; +use std::collections::HashMap; +use std::collections::HashSet; +use std::convert::Infallible; +use std::net::SocketAddr; +use std::ops::Range; +use std::path::Path; +use std::rc::Rc; +use std::sync::Arc; +use std::thread; use dashmap::DashMap; use deno_ast::MediaType; use deno_core::anyhow::anyhow; use deno_core::anyhow::Context as _; +use deno_core::convert::Smi; +use deno_core::convert::ToV8; use deno_core::error::AnyError; +use deno_core::error::StdAnyError; +use deno_core::futures::stream::FuturesOrdered; use deno_core::futures::FutureExt; +use deno_core::futures::StreamExt; use deno_core::op2; use deno_core::parking_lot::Mutex; use deno_core::resolve_url; @@ -77,18 +54,6 @@ use regex::Captures; use regex::Regex; use serde_repr::Deserialize_repr; use serde_repr::Serialize_repr; -use std::cell::RefCell; -use std::cmp; -use std::collections::BTreeMap; -use std::collections::HashMap; -use std::collections::HashSet; -use std::convert::Infallible; -use std::net::SocketAddr; -use std::ops::Range; -use std::path::Path; -use std::rc::Rc; -use std::sync::Arc; -use std::thread; use text_size::TextRange; use text_size::TextSize; use tokio::sync::mpsc; @@ -99,6 +64,41 @@ use tower_lsp::jsonrpc::Error as LspError; use tower_lsp::jsonrpc::Result as LspResult; use tower_lsp::lsp_types as lsp; +use super::analysis::CodeActionData; +use super::code_lens; +use super::config; +use super::config::LspTsConfig; +use super::documents::AssetOrDocument; +use super::documents::Document; +use super::documents::DocumentsFilter; +use super::language_server; +use super::language_server::StateSnapshot; +use super::performance::Performance; +use super::performance::PerformanceMark; +use super::refactor::RefactorCodeActionData; +use super::refactor::ALL_KNOWN_REFACTOR_ACTION_KINDS; +use super::refactor::EXTRACT_CONSTANT; +use super::refactor::EXTRACT_INTERFACE; +use super::refactor::EXTRACT_TYPE; +use super::semantic_tokens; +use super::semantic_tokens::SemanticTokensBuilder; +use super::text::LineIndex; +use super::urls::uri_to_url; +use super::urls::url_to_uri; +use super::urls::INVALID_SPECIFIER; +use super::urls::INVALID_URI; +use crate::args::jsr_url; +use crate::args::FmtOptionsConfig; +use crate::lsp::logging::lsp_warn; +use crate::tsc; +use crate::tsc::ResolveArgs; +use crate::tsc::MISSING_DEPENDENCY_SPECIFIER; +use crate::util::path::relative_specifier; +use crate::util::path::to_percent_decoded_str; +use crate::util::result::InfallibleResultExt; +use crate::util::v8::convert; +use crate::worker::create_isolate_create_params; + static BRACKET_ACCESSOR_RE: Lazy = lazy_regex!(r#"^\[['"](.+)[\['"]\]$"#); static CAPTION_RE: Lazy = @@ -5541,6 +5541,9 @@ impl TscRequest { #[cfg(test)] mod tests { + use pretty_assertions::assert_eq; + use test_util::TempDir; + use super::*; use crate::cache::HttpCache; use crate::lsp::cache::LspCache; @@ -5550,8 +5553,6 @@ mod tests { use crate::lsp::documents::LanguageId; use crate::lsp::resolver::LspResolver; use crate::lsp::text::LineIndex; - use pretty_assertions::assert_eq; - use test_util::TempDir; async fn setup( ts_config: Value, diff --git a/cli/lsp/urls.rs b/cli/lsp/urls.rs index 6c7da4f134..91c04f11c0 100644 --- a/cli/lsp/urls.rs +++ b/cli/lsp/urls.rs @@ -1,4 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::HashMap; +use std::str::FromStr; +use std::sync::Arc; use deno_ast::MediaType; use deno_core::error::AnyError; @@ -8,9 +12,6 @@ use deno_core::url::Url; use deno_core::ModuleSpecifier; use lsp_types::Uri; use once_cell::sync::Lazy; -use std::collections::HashMap; -use std::str::FromStr; -use std::sync::Arc; use super::cache::LspCache; use super::logging::lsp_warn; @@ -307,9 +308,10 @@ fn file_like_to_file_specifier(specifier: &Url) -> Option { #[cfg(test)] mod tests { - use super::*; use deno_core::resolve_url; + use super::*; + #[test] fn test_hash_data_specifier() { let fixture = resolve_url("data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=").unwrap(); diff --git a/cli/main.rs b/cli/main.rs index d68f27146b..2e55d9d286 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod args; mod cache; @@ -20,6 +20,7 @@ mod ops; mod resolver; mod shared; mod standalone; +mod sys; mod task_runner; mod tools; mod tsc; @@ -27,31 +28,6 @@ mod util; mod version; mod worker; -use crate::args::flags_from_vec; -use crate::args::DenoSubcommand; -use crate::args::Flags; -use crate::util::display; -use crate::util::v8::get_v8_flags_from_env; -use crate::util::v8::init_v8_flags; - -use args::TaskFlags; -use deno_resolver::npm::ByonmResolvePkgFolderFromDenoReqError; -use deno_resolver::npm::ResolvePkgFolderFromDenoReqError; -use deno_runtime::WorkerExecutionMode; -pub use deno_runtime::UNSTABLE_GRANULAR_FLAGS; - -use deno_core::anyhow::Context; -use deno_core::error::AnyError; -use deno_core::error::JsError; -use deno_core::futures::FutureExt; -use deno_core::unsync::JoinHandle; -use deno_npm::resolution::SnapshotFromLockfileError; -use deno_runtime::fmt_errors::format_js_error; -use deno_runtime::tokio_util::create_and_run_current_thread_with_maybe_metrics; -use deno_terminal::colors; -use factory::CliFactory; -use standalone::MODULE_NOT_FOUND; -use standalone::UNSUPPORTED_SCHEME; use std::env; use std::future::Future; use std::io::IsTerminal; @@ -59,6 +35,31 @@ use std::ops::Deref; use std::path::PathBuf; use std::sync::Arc; +use args::TaskFlags; +use deno_core::anyhow::Context; +use deno_core::error::AnyError; +use deno_core::error::JsError; +use deno_core::futures::FutureExt; +use deno_core::unsync::JoinHandle; +use deno_npm::resolution::SnapshotFromLockfileError; +use deno_resolver::npm::ByonmResolvePkgFolderFromDenoReqError; +use deno_resolver::npm::ResolvePkgFolderFromDenoReqError; +use deno_runtime::fmt_errors::format_js_error; +use deno_runtime::tokio_util::create_and_run_current_thread_with_maybe_metrics; +use deno_runtime::WorkerExecutionMode; +pub use deno_runtime::UNSTABLE_GRANULAR_FLAGS; +use deno_terminal::colors; +use factory::CliFactory; +use standalone::MODULE_NOT_FOUND; +use standalone::UNSUPPORTED_SCHEME; + +use crate::args::flags_from_vec; +use crate::args::DenoSubcommand; +use crate::args::Flags; +use crate::util::display; +use crate::util::v8::get_v8_flags_from_env; +use crate::util::v8::init_v8_flags; + #[cfg(feature = "dhat-heap")] #[global_allocator] static ALLOC: dhat::Alloc = dhat::Alloc; diff --git a/cli/mainrt.rs b/cli/mainrt.rs index cba54b044c..ce6fddaee9 100644 --- a/cli/mainrt.rs +++ b/cli/mainrt.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Allow unused code warnings because we share // code between the two bin targets. @@ -18,11 +18,18 @@ mod node; mod npm; mod resolver; mod shared; +mod sys; mod task_runner; mod util; mod version; mod worker; +use std::borrow::Cow; +use std::collections::HashMap; +use std::env; +use std::env::current_exe; +use std::sync::Arc; + use deno_core::error::generic_error; use deno_core::error::AnyError; use deno_core::error::JsError; @@ -31,11 +38,7 @@ use deno_runtime::tokio_util::create_and_run_current_thread_with_maybe_metrics; pub use deno_runtime::UNSTABLE_GRANULAR_FLAGS; use deno_terminal::colors; use indexmap::IndexMap; - -use std::borrow::Cow; -use std::collections::HashMap; -use std::env; -use std::env::current_exe; +use standalone::DenoCompileFileSystem; use crate::args::Flags; @@ -92,7 +95,9 @@ fn main() { Some(data.metadata.otel_config.clone()), ); load_env_vars(&data.metadata.env_vars_from_env_file); - let exit_code = standalone::run(data).await?; + let fs = DenoCompileFileSystem::new(data.vfs.clone()); + let sys = crate::sys::CliSys::DenoCompile(fs.clone()); + let exit_code = standalone::run(Arc::new(fs), sys, data).await?; deno_runtime::exit(exit_code); } Ok(None) => Ok(()), diff --git a/cli/module_loader.rs b/cli/module_loader.rs index 1c7f20d11e..1ac27d2dba 100644 --- a/cli/module_loader.rs +++ b/cli/module_loader.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::RefCell; @@ -39,10 +39,8 @@ use deno_graph::ModuleGraph; use deno_graph::Resolution; use deno_graph::WasmModule; use deno_runtime::code_cache; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::create_host_defined_options; use deno_runtime::deno_node::NodeRequireLoader; -use deno_runtime::deno_node::NodeResolver; use deno_runtime::deno_permissions::PermissionsContainer; use deno_semver::npm::NpmPackageReqReference; use node_resolver::errors::ClosestPkgJsonError; @@ -66,6 +64,7 @@ use crate::graph_container::ModuleGraphUpdatePermit; use crate::graph_util::CreateGraphOptions; use crate::graph_util::ModuleGraphBuilder; use crate::node::CliNodeCodeTranslator; +use crate::node::CliNodeResolver; use crate::npm::CliNpmResolver; use crate::resolver::CjsTracker; use crate::resolver::CliNpmReqResolver; @@ -73,6 +72,7 @@ use crate::resolver::CliResolver; use crate::resolver::ModuleCodeStringSource; use crate::resolver::NotSupportedKindInNpmError; use crate::resolver::NpmModuleLoader; +use crate::sys::CliSys; use crate::tools::check; use crate::tools::check::MaybeDiagnostics; use crate::tools::check::TypeChecker; @@ -221,13 +221,13 @@ struct SharedCliModuleLoaderState { main_module_graph_container: Arc, module_load_preparer: Arc, node_code_translator: Arc, - node_resolver: Arc, + node_resolver: Arc, npm_req_resolver: Arc, npm_resolver: Arc, npm_module_loader: NpmModuleLoader, parsed_source_cache: Arc, resolver: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, in_flight_loads_tracker: InFlightModuleLoadsTracker, } @@ -281,13 +281,13 @@ impl CliModuleLoaderFactory { main_module_graph_container: Arc, module_load_preparer: Arc, node_code_translator: Arc, - node_resolver: Arc, + node_resolver: Arc, npm_req_resolver: Arc, npm_resolver: Arc, npm_module_loader: NpmModuleLoader, parsed_source_cache: Arc, resolver: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, ) -> Self { Self { shared: Arc::new(SharedCliModuleLoaderState { @@ -1093,7 +1093,7 @@ impl ModuleGraphUpdatePermit for WorkerModuleGraphUpdatePermit { struct CliNodeRequireLoader { cjs_tracker: Arc, emitter: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, graph_container: TGraphContainer, in_npm_pkg_checker: Arc, npm_resolver: Arc, @@ -1162,9 +1162,10 @@ impl NodeRequireLoader #[cfg(test)] mod tests { - use super::*; use deno_graph::ParsedSourceStore; + use super::*; + #[tokio::test] async fn test_inflight_module_loads_tracker() { let tracker = InFlightModuleLoadsTracker { diff --git a/cli/node.rs b/cli/node.rs index 480da506c8..e0feb557a7 100644 --- a/cli/node.rs +++ b/cli/node.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::sync::Arc; @@ -8,7 +8,6 @@ use deno_ast::ModuleSpecifier; use deno_core::error::AnyError; use deno_graph::ParsedSourceStore; use deno_runtime::deno_fs; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::RealIsBuiltInNodeModuleChecker; use node_resolver::analyze::CjsAnalysis as ExtNodeCjsAnalysis; use node_resolver::analyze::CjsAnalysisExports; @@ -21,12 +20,15 @@ use crate::cache::CacheDBHash; use crate::cache::NodeAnalysisCache; use crate::cache::ParsedSourceCache; use crate::resolver::CjsTracker; +use crate::sys::CliSys; pub type CliNodeCodeTranslator = NodeCodeTranslator< CliCjsCodeAnalyzer, RealIsBuiltInNodeModuleChecker, - FsSysTraitsAdapter, + CliSys, >; +pub type CliNodeResolver = deno_runtime::deno_node::NodeResolver; +pub type CliPackageJsonResolver = node_resolver::PackageJsonResolver; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum CliCjsAnalysis { diff --git a/cli/npm/byonm.rs b/cli/npm/byonm.rs index 218f33989d..7a0a450c11 100644 --- a/cli/npm/byonm.rs +++ b/cli/npm/byonm.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::path::Path; @@ -9,20 +9,19 @@ use deno_core::serde_json; use deno_resolver::npm::ByonmNpmResolver; use deno_resolver::npm::ByonmNpmResolverCreateOptions; use deno_resolver::npm::CliNpmReqResolver; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::NodePermissions; use deno_runtime::ops::process::NpmProcessStateProvider; use node_resolver::NpmPackageFolderResolver; -use crate::args::NpmProcessState; -use crate::args::NpmProcessStateKind; - use super::CliNpmResolver; use super::InnerCliNpmResolverRef; +use crate::args::NpmProcessState; +use crate::args::NpmProcessStateKind; +use crate::sys::CliSys; pub type CliByonmNpmResolverCreateOptions = - ByonmNpmResolverCreateOptions; -pub type CliByonmNpmResolver = ByonmNpmResolver; + ByonmNpmResolverCreateOptions; +pub type CliByonmNpmResolver = ByonmNpmResolver; // todo(dsherret): the services hanging off `CliNpmResolver` doesn't seem ideal. We should probably decouple. #[derive(Debug)] diff --git a/cli/npm/managed/mod.rs b/cli/npm/managed/mod.rs index 5b0a304de8..4a4d593bbf 100644 --- a/cli/npm/managed/mod.rs +++ b/cli/npm/managed/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::path::Path; @@ -24,7 +24,6 @@ use deno_npm_cache::NpmCacheSetting; use deno_path_util::fs::canonicalize_path_maybe_not_exists; use deno_resolver::npm::CliNpmReqResolver; use deno_runtime::colors; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::NodePermissions; use deno_runtime::ops::process::NpmProcessStateProvider; use deno_semver::package::PackageNv; @@ -35,20 +34,9 @@ use node_resolver::InNpmPackageChecker; use node_resolver::NpmPackageFolderResolver; use resolution::AddPkgReqsResult; -use crate::args::CliLockfile; -use crate::args::LifecycleScriptsConfig; -use crate::args::NpmInstallDepsProvider; -use crate::args::NpmProcessState; -use crate::args::NpmProcessStateKind; -use crate::args::PackageJsonDepValueParseWithLocationError; -use crate::cache::FastInsecureHasher; -use crate::util::progress_bar::ProgressBar; -use crate::util::sync::AtomicFlag; - use self::resolution::NpmResolution; use self::resolvers::create_npm_fs_resolver; use self::resolvers::NpmPackageFsResolver; - use super::CliNpmCache; use super::CliNpmCacheHttpClient; use super::CliNpmRegistryInfoProvider; @@ -56,6 +44,16 @@ use super::CliNpmResolver; use super::CliNpmTarballCache; use super::InnerCliNpmResolverRef; use super::ResolvePkgFolderFromDenoReqError; +use crate::args::CliLockfile; +use crate::args::LifecycleScriptsConfig; +use crate::args::NpmInstallDepsProvider; +use crate::args::NpmProcessState; +use crate::args::NpmProcessStateKind; +use crate::args::PackageJsonDepValueParseWithLocationError; +use crate::cache::FastInsecureHasher; +use crate::sys::CliSys; +use crate::util::progress_bar::ProgressBar; +use crate::util::sync::AtomicFlag; mod resolution; mod resolvers; @@ -70,7 +68,7 @@ pub struct CliManagedNpmResolverCreateOptions { pub maybe_lockfile: Option>, pub http_client_provider: Arc, pub npm_cache_dir: Arc, - pub sys: FsSysTraitsAdapter, + pub sys: CliSys, pub cache_setting: deno_cache_dir::file_fetcher::CacheSetting, pub text_only_progress_bar: crate::util::progress_bar::ProgressBar, pub maybe_node_modules_path: Option, @@ -149,7 +147,7 @@ fn create_inner( npm_cache: Arc, npm_install_deps_provider: Arc, registry_info_provider: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, text_only_progress_bar: crate::util::progress_bar::ProgressBar, maybe_lockfile: Option>, npm_rc: Arc, @@ -307,7 +305,7 @@ pub struct ManagedCliNpmResolver { registry_info_provider: Arc, npm_cache: Arc, npm_install_deps_provider: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, resolution: Arc, tarball_cache: Arc, text_only_progress_bar: ProgressBar, @@ -333,7 +331,7 @@ impl ManagedCliNpmResolver { npm_cache: Arc, npm_install_deps_provider: Arc, resolution: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, tarball_cache: Arc, text_only_progress_bar: ProgressBar, npm_system_info: NpmSystemInfo, diff --git a/cli/npm/managed/resolution.rs b/cli/npm/managed/resolution.rs index 5d9fcf4646..12f7b17565 100644 --- a/cli/npm/managed/resolution.rs +++ b/cli/npm/managed/resolution.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::collections::HashSet; diff --git a/cli/npm/managed/resolvers/common.rs b/cli/npm/managed/resolvers/common.rs index 83081d3b8e..6a859ea9fd 100644 --- a/cli/npm/managed/resolvers/common.rs +++ b/cli/npm/managed/resolvers/common.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub mod bin_entries; pub mod lifecycle_scripts; @@ -20,13 +20,13 @@ use deno_core::futures::StreamExt; use deno_npm::NpmPackageCacheFolderId; use deno_npm::NpmPackageId; use deno_npm::NpmResolutionPackage; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::NodePermissions; use node_resolver::errors::PackageFolderResolveError; use sys_traits::FsCanonicalize; use super::super::PackageCaching; use crate::npm::CliNpmTarballCache; +use crate::sys::CliSys; /// Part of the resolution that interacts with the file system. #[async_trait(?Send)] @@ -74,15 +74,15 @@ pub trait NpmPackageFsResolver: Send + Sync { #[derive(Debug)] pub struct RegistryReadPermissionChecker { - sys: FsSysTraitsAdapter, + sys: CliSys, cache: Mutex>, registry_path: PathBuf, } impl RegistryReadPermissionChecker { - pub fn new(fs: FsSysTraitsAdapter, registry_path: PathBuf) -> Self { + pub fn new(sys: CliSys, registry_path: PathBuf) -> Self { Self { - sys: fs, + sys, registry_path, cache: Default::default(), } diff --git a/cli/npm/managed/resolvers/common/bin_entries.rs b/cli/npm/managed/resolvers/common/bin_entries.rs index ca47b9a086..32ebd68746 100644 --- a/cli/npm/managed/resolvers/common/bin_entries.rs +++ b/cli/npm/managed/resolvers/common/bin_entries.rs @@ -1,16 +1,18 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::npm::managed::NpmResolutionPackage; -use deno_core::anyhow::Context; -use deno_core::error::AnyError; -use deno_npm::resolution::NpmResolutionSnapshot; -use deno_npm::NpmPackageId; use std::collections::HashMap; use std::collections::HashSet; use std::collections::VecDeque; use std::path::Path; use std::path::PathBuf; +use deno_core::anyhow::Context; +use deno_core::error::AnyError; +use deno_npm::resolution::NpmResolutionSnapshot; +use deno_npm::NpmPackageId; + +use crate::npm::managed::NpmResolutionPackage; + #[derive(Default)] pub struct BinEntries<'a> { /// Packages that have colliding bin names diff --git a/cli/npm/managed/resolvers/common/lifecycle_scripts.rs b/cli/npm/managed/resolvers/common/lifecycle_scripts.rs index 958c4bcd19..738326ad22 100644 --- a/cli/npm/managed/resolvers/common/lifecycle_scripts.rs +++ b/cli/npm/managed/resolvers/common/lifecycle_scripts.rs @@ -1,24 +1,24 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::collections::HashSet; +use std::path::Path; +use std::path::PathBuf; +use std::rc::Rc; + +use deno_core::anyhow::Context; +use deno_core::error::AnyError; +use deno_npm::resolution::NpmResolutionSnapshot; +use deno_npm::NpmResolutionPackage; +use deno_runtime::deno_io::FromRawIoHandle; +use deno_semver::package::PackageNv; +use deno_semver::Version; +use deno_task_shell::KillSignal; use super::bin_entries::BinEntries; use crate::args::LifecycleScriptsConfig; use crate::task_runner::TaskStdio; use crate::util::progress_bar::ProgressBar; -use deno_core::anyhow::Context; -use deno_npm::resolution::NpmResolutionSnapshot; -use deno_runtime::deno_io::FromRawIoHandle; -use deno_semver::package::PackageNv; -use deno_semver::Version; -use deno_task_shell::KillSignal; -use std::borrow::Cow; -use std::collections::HashSet; -use std::rc::Rc; - -use std::path::Path; -use std::path::PathBuf; - -use deno_core::error::AnyError; -use deno_npm::NpmResolutionPackage; pub trait LifecycleScriptsStrategy { fn can_run_scripts(&self) -> bool { diff --git a/cli/npm/managed/resolvers/global.rs b/cli/npm/managed/resolvers/global.rs index f56f012407..18b7911c2f 100644 --- a/cli/npm/managed/resolvers/global.rs +++ b/cli/npm/managed/resolvers/global.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! Code for global npm cache resolution. @@ -7,10 +7,6 @@ use std::path::Path; use std::path::PathBuf; use std::sync::Arc; -use crate::colors; -use crate::npm::managed::PackageCaching; -use crate::npm::CliNpmCache; -use crate::npm::CliNpmTarballCache; use async_trait::async_trait; use deno_ast::ModuleSpecifier; use deno_core::error::AnyError; @@ -18,20 +14,23 @@ use deno_npm::NpmPackageCacheFolderId; use deno_npm::NpmPackageId; use deno_npm::NpmResolutionPackage; use deno_npm::NpmSystemInfo; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::NodePermissions; use node_resolver::errors::PackageFolderResolveError; use node_resolver::errors::PackageNotFoundError; use node_resolver::errors::ReferrerNotFoundError; -use crate::args::LifecycleScriptsConfig; -use crate::cache::FastInsecureHasher; - use super::super::resolution::NpmResolution; use super::common::cache_packages; use super::common::lifecycle_scripts::LifecycleScriptsStrategy; use super::common::NpmPackageFsResolver; use super::common::RegistryReadPermissionChecker; +use crate::args::LifecycleScriptsConfig; +use crate::cache::FastInsecureHasher; +use crate::colors; +use crate::npm::managed::PackageCaching; +use crate::npm::CliNpmCache; +use crate::npm::CliNpmTarballCache; +use crate::sys::CliSys; /// Resolves packages from the global npm cache. #[derive(Debug)] @@ -49,7 +48,7 @@ impl GlobalNpmPackageResolver { cache: Arc, tarball_cache: Arc, resolution: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, system_info: NpmSystemInfo, lifecycle_scripts: LifecycleScriptsConfig, ) -> Self { diff --git a/cli/npm/managed/resolvers/local.rs b/cli/npm/managed/resolvers/local.rs index 8bbaf6c51c..eb806ad02c 100644 --- a/cli/npm/managed/resolvers/local.rs +++ b/cli/npm/managed/resolvers/local.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! Code for local node_modules resolution. @@ -7,6 +7,7 @@ use std::cell::RefCell; use std::cmp::Ordering; use std::collections::hash_map::Entry; use std::collections::BTreeMap; +use std::collections::BTreeSet; use std::collections::HashMap; use std::collections::HashSet; use std::fs; @@ -32,7 +33,6 @@ use deno_npm::NpmSystemInfo; use deno_path_util::fs::atomic_write_file_with_retries; use deno_path_util::fs::canonicalize_path_maybe_not_exists; use deno_resolver::npm::normalize_pkg_name_for_node_modules_deno_folder; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::NodePermissions; use deno_semver::package::PackageNv; use deno_semver::StackString; @@ -44,6 +44,10 @@ use serde::Deserialize; use serde::Serialize; use sys_traits::FsMetadata; +use super::super::resolution::NpmResolution; +use super::common::bin_entries; +use super::common::NpmPackageFsResolver; +use super::common::RegistryReadPermissionChecker; use crate::args::LifecycleScriptsConfig; use crate::args::NpmInstallDepsProvider; use crate::cache::CACHE_PERM; @@ -51,17 +55,13 @@ use crate::colors; use crate::npm::managed::PackageCaching; use crate::npm::CliNpmCache; use crate::npm::CliNpmTarballCache; +use crate::sys::CliSys; use crate::util::fs::clone_dir_recursive; use crate::util::fs::symlink_dir; use crate::util::fs::LaxSingleProcessFsFlag; use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressMessagePrompt; -use super::super::resolution::NpmResolution; -use super::common::bin_entries; -use super::common::NpmPackageFsResolver; -use super::common::RegistryReadPermissionChecker; - /// Resolver that creates a local node_modules directory /// and resolves packages from it. #[derive(Debug)] @@ -70,7 +70,7 @@ pub struct LocalNpmPackageResolver { npm_install_deps_provider: Arc, progress_bar: ProgressBar, resolution: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, tarball_cache: Arc, root_node_modules_path: PathBuf, root_node_modules_url: Url, @@ -86,7 +86,7 @@ impl LocalNpmPackageResolver { npm_install_deps_provider: Arc, progress_bar: ProgressBar, resolution: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, tarball_cache: Arc, node_modules_folder: PathBuf, system_info: NpmSystemInfo, @@ -370,10 +370,10 @@ async fn sync_resolution_with_fs( ); let packages_with_deprecation_warnings = Arc::new(Mutex::new(Vec::new())); - let mut package_tags: HashMap<&PackageNv, Vec<&str>> = HashMap::new(); + let mut package_tags: HashMap<&PackageNv, BTreeSet<&str>> = HashMap::new(); for (package_req, package_nv) in snapshot.package_reqs() { if let Some(tag) = package_req.version_req.tag() { - package_tags.entry(package_nv).or_default().push(tag); + package_tags.entry(package_nv).or_default().insert(tag); } } @@ -393,7 +393,17 @@ async fn sync_resolution_with_fs( let folder_path = deno_local_registry_dir.join(&package_folder_name); let tags = package_tags .get(&package.id.nv) - .map(|tags| tags.join(",")) + .map(|tags| { + capacity_builder::StringBuilder::::build(|builder| { + for (i, tag) in tags.iter().enumerate() { + if i > 0 { + builder.append(',') + } + builder.append(*tag); + } + }) + .unwrap() + }) .unwrap_or_default(); enum PackageFolderState { UpToDate, @@ -926,7 +936,7 @@ impl SetupCache { bincode::serialize(&self.current).ok().and_then(|data| { atomic_write_file_with_retries( - &FsSysTraitsAdapter::new_real(), + &CliSys::default(), &self.file_path, &data, CACHE_PERM, diff --git a/cli/npm/managed/resolvers/mod.rs b/cli/npm/managed/resolvers/mod.rs index 2d6d37798f..b52a7e0e39 100644 --- a/cli/npm/managed/resolvers/mod.rs +++ b/cli/npm/managed/resolvers/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod common; mod global; @@ -8,28 +8,25 @@ use std::path::PathBuf; use std::sync::Arc; use deno_npm::NpmSystemInfo; -use deno_runtime::deno_fs::FsSysTraitsAdapter; +pub use self::common::NpmPackageFsResolver; +use self::global::GlobalNpmPackageResolver; +use self::local::LocalNpmPackageResolver; +use super::resolution::NpmResolution; use crate::args::LifecycleScriptsConfig; use crate::args::NpmInstallDepsProvider; use crate::npm::CliNpmCache; use crate::npm::CliNpmTarballCache; +use crate::sys::CliSys; use crate::util::progress_bar::ProgressBar; -pub use self::common::NpmPackageFsResolver; - -use self::global::GlobalNpmPackageResolver; -use self::local::LocalNpmPackageResolver; - -use super::resolution::NpmResolution; - #[allow(clippy::too_many_arguments)] pub fn create_npm_fs_resolver( npm_cache: Arc, npm_install_deps_provider: &Arc, progress_bar: &ProgressBar, resolution: Arc, - sys: FsSysTraitsAdapter, + sys: CliSys, tarball_cache: Arc, maybe_node_modules_path: Option, system_info: NpmSystemInfo, diff --git a/cli/npm/mod.rs b/cli/npm/mod.rs index 6f686c3553..e0c10fa7a7 100644 --- a/cli/npm/mod.rs +++ b/cli/npm/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod byonm; mod managed; @@ -17,7 +17,6 @@ use deno_resolver::npm::ByonmInNpmPackageChecker; use deno_resolver::npm::ByonmNpmResolver; use deno_resolver::npm::CliNpmReqResolver; use deno_resolver::npm::ResolvePkgFolderFromDenoReqError; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::NodePermissions; use deno_runtime::ops::process::NpmProcessStateProvider; use deno_semver::package::PackageNv; @@ -28,10 +27,6 @@ use managed::create_managed_in_npm_pkg_checker; use node_resolver::InNpmPackageChecker; use node_resolver::NpmPackageFolderResolver; -use crate::file_fetcher::CliFileFetcher; -use crate::http_util::HttpClientProvider; -use crate::util::progress_bar::ProgressBar; - pub use self::byonm::CliByonmNpmResolver; pub use self::byonm::CliByonmNpmResolverCreateOptions; pub use self::managed::CliManagedInNpmPkgCheckerCreateOptions; @@ -39,14 +34,16 @@ pub use self::managed::CliManagedNpmResolverCreateOptions; pub use self::managed::CliNpmResolverManagedSnapshotOption; pub use self::managed::ManagedCliNpmResolver; pub use self::managed::PackageCaching; +use crate::file_fetcher::CliFileFetcher; +use crate::http_util::HttpClientProvider; +use crate::sys::CliSys; +use crate::util::progress_bar::ProgressBar; pub type CliNpmTarballCache = - deno_npm_cache::TarballCache; -pub type CliNpmCache = deno_npm_cache::NpmCache; -pub type CliNpmRegistryInfoProvider = deno_npm_cache::RegistryInfoProvider< - CliNpmCacheHttpClient, - FsSysTraitsAdapter, ->; + deno_npm_cache::TarballCache; +pub type CliNpmCache = deno_npm_cache::NpmCache; +pub type CliNpmRegistryInfoProvider = + deno_npm_cache::RegistryInfoProvider; #[derive(Debug)] pub struct CliNpmCacheHttpClient { diff --git a/cli/ops/bench.rs b/cli/ops/bench.rs index a7c788a189..c6eca9216f 100644 --- a/cli/ops/bench.rs +++ b/cli/ops/bench.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; diff --git a/cli/ops/jupyter.rs b/cli/ops/jupyter.rs index 5bdf97e60f..6a9252c35a 100644 --- a/cli/ops/jupyter.rs +++ b/cli/ops/jupyter.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // NOTE(bartlomieju): unfortunately it appears that clippy is broken // and can't allow a single line ignore for `await_holding_lock`. @@ -8,17 +8,16 @@ use std::cell::RefCell; use std::rc::Rc; use std::sync::Arc; -use jupyter_runtime::InputRequest; -use jupyter_runtime::JupyterMessage; -use jupyter_runtime::JupyterMessageContent; -use jupyter_runtime::KernelIoPubConnection; -use jupyter_runtime::StreamContent; - use deno_core::error::AnyError; use deno_core::op2; use deno_core::parking_lot::Mutex; use deno_core::serde_json; use deno_core::OpState; +use jupyter_runtime::InputRequest; +use jupyter_runtime::JupyterMessage; +use jupyter_runtime::JupyterMessageContent; +use jupyter_runtime::KernelIoPubConnection; +use jupyter_runtime::StreamContent; use tokio::sync::mpsc; use crate::tools::jupyter::server::StdinConnectionProxy; diff --git a/cli/ops/lint.rs b/cli/ops/lint.rs index c38ac0c8a2..0a444e942c 100644 --- a/cli/ops/lint.rs +++ b/cli/ops/lint.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_ast::MediaType; use deno_ast::ModuleSpecifier; diff --git a/cli/ops/mod.rs b/cli/ops/mod.rs index 4ac1618816..7cee5bcfa1 100644 --- a/cli/ops/mod.rs +++ b/cli/ops/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub mod bench; pub mod jupyter; diff --git a/cli/ops/testing.rs b/cli/ops/testing.rs index 3c6936971a..84e9aff83b 100644 --- a/cli/ops/testing.rs +++ b/cli/ops/testing.rs @@ -1,13 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::tools::test::TestContainer; -use crate::tools::test::TestDescription; -use crate::tools::test::TestEvent; -use crate::tools::test::TestEventSender; -use crate::tools::test::TestFailure; -use crate::tools::test::TestLocation; -use crate::tools::test::TestStepDescription; -use crate::tools::test::TestStepResult; +use std::sync::atomic::AtomicUsize; +use std::sync::atomic::Ordering; use deno_core::error::generic_error; use deno_core::error::type_error; @@ -18,10 +12,17 @@ use deno_core::ModuleSpecifier; use deno_core::OpState; use deno_runtime::deno_permissions::ChildPermissionsArg; use deno_runtime::deno_permissions::PermissionsContainer; -use std::sync::atomic::AtomicUsize; -use std::sync::atomic::Ordering; use uuid::Uuid; +use crate::tools::test::TestContainer; +use crate::tools::test::TestDescription; +use crate::tools::test::TestEvent; +use crate::tools::test::TestEventSender; +use crate::tools::test::TestFailure; +use crate::tools::test::TestLocation; +use crate::tools::test::TestStepDescription; +use crate::tools::test::TestStepResult; + deno_core::extension!(deno_test, ops = [ op_pledge_test_permissions, diff --git a/cli/resolver.rs b/cli/resolver.rs index 0a4fd78686..661685c081 100644 --- a/cli/resolver.rs +++ b/cli/resolver.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::path::Path; @@ -25,7 +25,6 @@ use deno_npm::resolution::NpmResolutionError; use deno_resolver::sloppy_imports::SloppyImportsResolver; use deno_runtime::colors; use deno_runtime::deno_fs; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use deno_runtime::deno_node::is_builtin_node_module; use deno_runtime::deno_node::RealIsBuiltInNodeModuleChecker; use deno_semver::package::PackageReq; @@ -40,22 +39,21 @@ use crate::args::DENO_DISABLE_PEDANTIC_NODE_WARNINGS; use crate::node::CliNodeCodeTranslator; use crate::npm::CliNpmResolver; use crate::npm::InnerCliNpmResolverRef; +use crate::sys::CliSys; use crate::util::sync::AtomicFlag; use crate::util::text_encoding::from_utf8_lossy_cow; -pub type CjsTracker = deno_resolver::cjs::CjsTracker; -pub type IsCjsResolver = deno_resolver::cjs::IsCjsResolver; +pub type CjsTracker = deno_resolver::cjs::CjsTracker; +pub type IsCjsResolver = deno_resolver::cjs::IsCjsResolver; pub type CliSloppyImportsResolver = SloppyImportsResolver; pub type CliDenoResolver = deno_resolver::DenoResolver< RealIsBuiltInNodeModuleChecker, SloppyImportsCachedFs, - FsSysTraitsAdapter, ->; -pub type CliNpmReqResolver = deno_resolver::npm::NpmReqResolver< - RealIsBuiltInNodeModuleChecker, - FsSysTraitsAdapter, + CliSys, >; +pub type CliNpmReqResolver = + deno_resolver::npm::NpmReqResolver; pub struct ModuleCodeStringSource { pub code: ModuleSourceCode, @@ -397,7 +395,7 @@ impl<'a> deno_graph::source::NpmResolver for WorkerCliNpmGraphResolver<'a> { #[derive(Debug)] pub struct SloppyImportsCachedFs { - sys: FsSysTraitsAdapter, + sys: CliSys, cache: Option< DashMap< PathBuf, @@ -407,14 +405,14 @@ pub struct SloppyImportsCachedFs { } impl SloppyImportsCachedFs { - pub fn new(sys: FsSysTraitsAdapter) -> Self { + pub fn new(sys: CliSys) -> Self { Self { sys, cache: Some(Default::default()), } } - pub fn new_without_stat_cache(fs: FsSysTraitsAdapter) -> Self { + pub fn new_without_stat_cache(fs: CliSys) -> Self { Self { sys: fs, cache: None, diff --git a/cli/shared.rs b/cli/shared.rs index 808aff707b..6a28473edd 100644 --- a/cli/shared.rs +++ b/cli/shared.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// This module is shared between build script and the binaries. Use it sparsely. use deno_core::anyhow::bail; diff --git a/cli/standalone/binary.rs b/cli/standalone/binary.rs index 91187c48d1..7ca25fca51 100644 --- a/cli/standalone/binary.rs +++ b/cli/standalone/binary.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::collections::BTreeMap; @@ -61,6 +61,23 @@ use log::Level; use serde::Deserialize; use serde::Serialize; +use super::file_system::DenoCompileFileSystem; +use super::serialization::deserialize_binary_data_section; +use super::serialization::serialize_binary_data_section; +use super::serialization::DenoCompileModuleData; +use super::serialization::DeserializedDataSection; +use super::serialization::RemoteModulesStore; +use super::serialization::RemoteModulesStoreBuilder; +use super::serialization::SourceMapStore; +use super::virtual_fs::output_vfs; +use super::virtual_fs::BuiltVfs; +use super::virtual_fs::FileBackedVfs; +use super::virtual_fs::VfsBuilder; +use super::virtual_fs::VfsFileSubDataKind; +use super::virtual_fs::VfsRoot; +use super::virtual_fs::VirtualDirectory; +use super::virtual_fs::VirtualDirectoryEntries; +use super::virtual_fs::WindowsSystemRootablePath; use crate::args::CaData; use crate::args::CliOptions; use crate::args::CompileFlags; @@ -83,24 +100,6 @@ use crate::util::fs::canonicalize_path_maybe_not_exists; use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; -use super::file_system::DenoCompileFileSystem; -use super::serialization::deserialize_binary_data_section; -use super::serialization::serialize_binary_data_section; -use super::serialization::DenoCompileModuleData; -use super::serialization::DeserializedDataSection; -use super::serialization::RemoteModulesStore; -use super::serialization::RemoteModulesStoreBuilder; -use super::serialization::SourceMapStore; -use super::virtual_fs::output_vfs; -use super::virtual_fs::BuiltVfs; -use super::virtual_fs::FileBackedVfs; -use super::virtual_fs::VfsBuilder; -use super::virtual_fs::VfsFileSubDataKind; -use super::virtual_fs::VfsRoot; -use super::virtual_fs::VirtualDirectory; -use super::virtual_fs::VirtualDirectoryEntries; -use super::virtual_fs::WindowsSystemRootablePath; - pub static DENO_COMPILE_GLOBAL_NODE_MODULES_DIR_NAME: &str = ".deno_compile_node_modules"; @@ -259,7 +258,6 @@ pub fn is_standalone_binary(exe_path: &Path) -> bool { } pub struct StandaloneData { - pub fs: Arc, pub metadata: Metadata, pub modules: StandaloneModules, pub npm_snapshot: Option, @@ -382,10 +380,7 @@ pub fn extract_standalone( }; Arc::new(FileBackedVfs::new(Cow::Borrowed(vfs_files_data), fs_root)) }; - let fs: Arc = - Arc::new(DenoCompileFileSystem::new(vfs.clone())); Ok(Some(StandaloneData { - fs, metadata, modules: StandaloneModules { remote_modules, diff --git a/cli/standalone/code_cache.rs b/cli/standalone/code_cache.rs index a44c920328..de9ff2a141 100644 --- a/cli/standalone/code_cache.rs +++ b/cli/standalone/code_cache.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::BTreeMap; use std::collections::HashMap; @@ -18,7 +18,6 @@ use deno_core::unsync::sync::AtomicFlag; use deno_path_util::get_atomic_path; use deno_runtime::code_cache::CodeCache; use deno_runtime::code_cache::CodeCacheType; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use crate::cache::FastInsecureHasher; use crate::worker::CliCodeCache; @@ -191,7 +190,7 @@ impl FirstRunCodeCacheStrategy { ) { let count = cache_data.len(); let temp_file = - get_atomic_path(&FsSysTraitsAdapter::new_real(), &self.file_path); + get_atomic_path(&sys_traits::impls::RealSys, &self.file_path); match serialize(&temp_file, self.cache_key, cache_data) { Ok(()) => { if let Err(err) = std::fs::rename(&temp_file, &self.file_path) { @@ -396,10 +395,11 @@ fn deserialize_with_reader( #[cfg(test)] mod test { + use std::fs::File; + use test_util::TempDir; use super::*; - use std::fs::File; #[test] fn serialize_deserialize() { diff --git a/cli/standalone/file_system.rs b/cli/standalone/file_system.rs index 4b1024db6a..f218277bef 100644 --- a/cli/standalone/file_system.rs +++ b/cli/standalone/file_system.rs @@ -1,23 +1,34 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::borrow::Cow; +use std::io::ErrorKind; use std::path::Path; use std::path::PathBuf; use std::rc::Rc; use std::sync::Arc; +use std::time::Duration; +use std::time::SystemTime; use deno_runtime::deno_fs::AccessCheckCb; use deno_runtime::deno_fs::FileSystem; use deno_runtime::deno_fs::FsDirEntry; use deno_runtime::deno_fs::FsFileType; -use deno_runtime::deno_fs::FsStatSlim; use deno_runtime::deno_fs::OpenOptions; use deno_runtime::deno_fs::RealFs; use deno_runtime::deno_io::fs::File; use deno_runtime::deno_io::fs::FsError; use deno_runtime::deno_io::fs::FsResult; use deno_runtime::deno_io::fs::FsStat; +use sys_traits::boxed::BoxedFsDirEntry; +use sys_traits::boxed::BoxedFsMetadataValue; +use sys_traits::boxed::FsMetadataBoxed; +use sys_traits::boxed::FsReadDirBoxed; +use sys_traits::FsMetadata; use super::virtual_fs::FileBackedVfs; +use super::virtual_fs::FileBackedVfsDirEntry; +use super::virtual_fs::FileBackedVfsFile; +use super::virtual_fs::FileBackedVfsMetadata; use super::virtual_fs::VfsFileSubDataKind; #[derive(Debug, Clone)] @@ -83,7 +94,7 @@ impl FileSystem for DenoCompileFileSystem { access_check: Option, ) -> FsResult> { if self.0.is_path_within(path) { - Ok(self.0.open_file(path)?) + Ok(Rc::new(self.0.open_file(path)?)) } else { RealFs.open_sync(path, options, access_check) } @@ -95,7 +106,7 @@ impl FileSystem for DenoCompileFileSystem { access_check: Option>, ) -> FsResult> { if self.0.is_path_within(&path) { - Ok(self.0.open_file(&path)?) + Ok(Rc::new(self.0.open_file(&path)?)) } else { RealFs.open_async(path, options, access_check).await } @@ -215,14 +226,14 @@ impl FileSystem for DenoCompileFileSystem { fn stat_sync(&self, path: &Path) -> FsResult { if self.0.is_path_within(path) { - Ok(self.0.stat(path)?) + Ok(self.0.stat(path)?.as_fs_stat()) } else { RealFs.stat_sync(path) } } async fn stat_async(&self, path: PathBuf) -> FsResult { if self.0.is_path_within(&path) { - Ok(self.0.stat(&path)?) + Ok(self.0.stat(&path)?.as_fs_stat()) } else { RealFs.stat_async(path).await } @@ -230,14 +241,14 @@ impl FileSystem for DenoCompileFileSystem { fn lstat_sync(&self, path: &Path) -> FsResult { if self.0.is_path_within(path) { - Ok(self.0.lstat(path)?) + Ok(self.0.lstat(path)?.as_fs_stat()) } else { RealFs.lstat_sync(path) } } async fn lstat_async(&self, path: PathBuf) -> FsResult { if self.0.is_path_within(&path) { - Ok(self.0.lstat(&path)?) + Ok(self.0.lstat(&path)?.as_fs_stat()) } else { RealFs.lstat_async(path).await } @@ -398,3 +409,428 @@ impl FileSystem for DenoCompileFileSystem { .await } } + +impl sys_traits::BaseFsHardLink for DenoCompileFileSystem { + #[inline] + fn base_fs_hard_link(&self, src: &Path, dst: &Path) -> std::io::Result<()> { + self.link_sync(src, dst).map_err(|err| err.into_io_error()) + } +} + +impl sys_traits::BaseFsRead for DenoCompileFileSystem { + #[inline] + fn base_fs_read(&self, path: &Path) -> std::io::Result> { + self + .read_file_sync(path, None) + .map_err(|err| err.into_io_error()) + } +} + +impl sys_traits::FsMetadataValue for FileBackedVfsMetadata { + fn file_type(&self) -> sys_traits::FileType { + self.file_type + } + + fn len(&self) -> u64 { + self.len + } + + fn accessed(&self) -> std::io::Result { + Err(not_supported("accessed time")) + } + + fn created(&self) -> std::io::Result { + Err(not_supported("created time")) + } + + fn changed(&self) -> std::io::Result { + Err(not_supported("changed time")) + } + + fn modified(&self) -> std::io::Result { + Err(not_supported("modified time")) + } + + fn dev(&self) -> std::io::Result { + Ok(0) + } + + fn ino(&self) -> std::io::Result { + Ok(0) + } + + fn mode(&self) -> std::io::Result { + Ok(0) + } + + fn nlink(&self) -> std::io::Result { + Ok(0) + } + + fn uid(&self) -> std::io::Result { + Ok(0) + } + + fn gid(&self) -> std::io::Result { + Ok(0) + } + + fn rdev(&self) -> std::io::Result { + Ok(0) + } + + fn blksize(&self) -> std::io::Result { + Ok(0) + } + + fn blocks(&self) -> std::io::Result { + Ok(0) + } + + fn is_block_device(&self) -> std::io::Result { + Ok(false) + } + + fn is_char_device(&self) -> std::io::Result { + Ok(false) + } + + fn is_fifo(&self) -> std::io::Result { + Ok(false) + } + + fn is_socket(&self) -> std::io::Result { + Ok(false) + } + + fn file_attributes(&self) -> std::io::Result { + Ok(0) + } +} + +fn not_supported(name: &str) -> std::io::Error { + std::io::Error::new( + ErrorKind::Unsupported, + format!( + "{} is not supported for an embedded deno compile file", + name + ), + ) +} + +impl sys_traits::FsDirEntry for FileBackedVfsDirEntry { + type Metadata = BoxedFsMetadataValue; + + fn file_name(&self) -> Cow { + Cow::Borrowed(self.metadata.name.as_ref()) + } + + fn file_type(&self) -> std::io::Result { + Ok(self.metadata.file_type) + } + + fn metadata(&self) -> std::io::Result { + Ok(BoxedFsMetadataValue(Box::new(self.metadata.clone()))) + } + + fn path(&self) -> Cow { + Cow::Owned(self.parent_path.join(&self.metadata.name)) + } +} + +impl sys_traits::BaseFsReadDir for DenoCompileFileSystem { + type ReadDirEntry = BoxedFsDirEntry; + + fn base_fs_read_dir( + &self, + path: &Path, + ) -> std::io::Result< + Box> + '_>, + > { + if self.0.is_path_within(path) { + let entries = self.0.read_dir_with_metadata(path)?; + Ok(Box::new( + entries.map(|entry| Ok(BoxedFsDirEntry::new(entry))), + )) + } else { + #[allow(clippy::disallowed_types)] // ok because we're implementing the fs + sys_traits::impls::RealSys.fs_read_dir_boxed(path) + } + } +} + +impl sys_traits::BaseFsCanonicalize for DenoCompileFileSystem { + #[inline] + fn base_fs_canonicalize(&self, path: &Path) -> std::io::Result { + self.realpath_sync(path).map_err(|err| err.into_io_error()) + } +} + +impl sys_traits::BaseFsMetadata for DenoCompileFileSystem { + type Metadata = BoxedFsMetadataValue; + + #[inline] + fn base_fs_metadata(&self, path: &Path) -> std::io::Result { + if self.0.is_path_within(path) { + Ok(BoxedFsMetadataValue::new(self.0.stat(path)?)) + } else { + #[allow(clippy::disallowed_types)] // ok because we're implementing the fs + sys_traits::impls::RealSys.fs_metadata_boxed(path) + } + } + + #[inline] + fn base_fs_symlink_metadata( + &self, + path: &Path, + ) -> std::io::Result { + if self.0.is_path_within(path) { + Ok(BoxedFsMetadataValue::new(self.0.lstat(path)?)) + } else { + #[allow(clippy::disallowed_types)] // ok because we're implementing the fs + sys_traits::impls::RealSys.fs_symlink_metadata_boxed(path) + } + } +} + +impl sys_traits::BaseFsCreateDir for DenoCompileFileSystem { + #[inline] + fn base_fs_create_dir( + &self, + path: &Path, + options: &sys_traits::CreateDirOptions, + ) -> std::io::Result<()> { + self + .mkdir_sync(path, options.recursive, options.mode) + .map_err(|err| err.into_io_error()) + } +} + +impl sys_traits::BaseFsRemoveFile for DenoCompileFileSystem { + #[inline] + fn base_fs_remove_file(&self, path: &Path) -> std::io::Result<()> { + self + .remove_sync(path, false) + .map_err(|err| err.into_io_error()) + } +} + +impl sys_traits::BaseFsRename for DenoCompileFileSystem { + #[inline] + fn base_fs_rename(&self, from: &Path, to: &Path) -> std::io::Result<()> { + self + .rename_sync(from, to) + .map_err(|err| err.into_io_error()) + } +} + +pub enum FsFileAdapter { + Real(sys_traits::impls::RealFsFile), + Vfs(FileBackedVfsFile), +} + +impl sys_traits::FsFile for FsFileAdapter {} + +impl sys_traits::FsFileAsRaw for FsFileAdapter { + #[cfg(windows)] + fn fs_file_as_raw_handle(&self) -> Option { + match self { + Self::Real(file) => file.fs_file_as_raw_handle(), + Self::Vfs(_) => None, + } + } + + #[cfg(unix)] + fn fs_file_as_raw_fd(&self) -> Option { + match self { + Self::Real(file) => file.fs_file_as_raw_fd(), + Self::Vfs(_) => None, + } + } +} + +impl sys_traits::FsFileSyncData for FsFileAdapter { + fn fs_file_sync_data(&mut self) -> std::io::Result<()> { + match self { + Self::Real(file) => file.fs_file_sync_data(), + Self::Vfs(_) => Ok(()), + } + } +} + +impl sys_traits::FsFileSyncAll for FsFileAdapter { + fn fs_file_sync_all(&mut self) -> std::io::Result<()> { + match self { + Self::Real(file) => file.fs_file_sync_all(), + Self::Vfs(_) => Ok(()), + } + } +} + +impl sys_traits::FsFileSetPermissions for FsFileAdapter { + #[inline] + fn fs_file_set_permissions(&mut self, mode: u32) -> std::io::Result<()> { + match self { + Self::Real(file) => file.fs_file_set_permissions(mode), + Self::Vfs(_) => Ok(()), + } + } +} + +impl std::io::Read for FsFileAdapter { + #[inline] + fn read(&mut self, buf: &mut [u8]) -> std::io::Result { + match self { + Self::Real(file) => file.read(buf), + Self::Vfs(file) => file.read_to_buf(buf), + } + } +} + +impl std::io::Seek for FsFileAdapter { + fn seek(&mut self, pos: std::io::SeekFrom) -> std::io::Result { + match self { + Self::Real(file) => file.seek(pos), + Self::Vfs(file) => file.seek(pos), + } + } +} + +impl std::io::Write for FsFileAdapter { + #[inline] + fn write(&mut self, buf: &[u8]) -> std::io::Result { + match self { + Self::Real(file) => file.write(buf), + Self::Vfs(_) => Err(not_supported("writing files")), + } + } + + #[inline] + fn flush(&mut self) -> std::io::Result<()> { + match self { + Self::Real(file) => file.flush(), + Self::Vfs(_) => Err(not_supported("writing files")), + } + } +} + +impl sys_traits::FsFileSetLen for FsFileAdapter { + #[inline] + fn fs_file_set_len(&mut self, len: u64) -> std::io::Result<()> { + match self { + Self::Real(file) => file.fs_file_set_len(len), + Self::Vfs(_) => Err(not_supported("setting file length")), + } + } +} + +impl sys_traits::FsFileSetTimes for FsFileAdapter { + fn fs_file_set_times( + &mut self, + times: sys_traits::FsFileTimes, + ) -> std::io::Result<()> { + match self { + Self::Real(file) => file.fs_file_set_times(times), + Self::Vfs(_) => Err(not_supported("setting file times")), + } + } +} + +impl sys_traits::FsFileLock for FsFileAdapter { + fn fs_file_lock( + &mut self, + mode: sys_traits::FsFileLockMode, + ) -> std::io::Result<()> { + match self { + Self::Real(file) => file.fs_file_lock(mode), + Self::Vfs(_) => Err(not_supported("locking files")), + } + } + + fn fs_file_try_lock( + &mut self, + mode: sys_traits::FsFileLockMode, + ) -> std::io::Result<()> { + match self { + Self::Real(file) => file.fs_file_try_lock(mode), + Self::Vfs(_) => Err(not_supported("locking files")), + } + } + + fn fs_file_unlock(&mut self) -> std::io::Result<()> { + match self { + Self::Real(file) => file.fs_file_unlock(), + Self::Vfs(_) => Err(not_supported("unlocking files")), + } + } +} + +impl sys_traits::FsFileIsTerminal for FsFileAdapter { + #[inline] + fn fs_file_is_terminal(&self) -> bool { + match self { + Self::Real(file) => file.fs_file_is_terminal(), + Self::Vfs(_) => false, + } + } +} + +impl sys_traits::BaseFsOpen for DenoCompileFileSystem { + type File = FsFileAdapter; + + fn base_fs_open( + &self, + path: &Path, + options: &sys_traits::OpenOptions, + ) -> std::io::Result { + if self.0.is_path_within(path) { + Ok(FsFileAdapter::Vfs(self.0.open_file(path)?)) + } else { + #[allow(clippy::disallowed_types)] // ok because we're implementing the fs + Ok(FsFileAdapter::Real( + sys_traits::impls::RealSys.base_fs_open(path, options)?, + )) + } + } +} + +impl sys_traits::SystemRandom for DenoCompileFileSystem { + #[inline] + fn sys_random(&self, buf: &mut [u8]) -> std::io::Result<()> { + #[allow(clippy::disallowed_types)] // ok because we're implementing the fs + sys_traits::impls::RealSys.sys_random(buf) + } +} + +impl sys_traits::SystemTimeNow for DenoCompileFileSystem { + #[inline] + fn sys_time_now(&self) -> SystemTime { + #[allow(clippy::disallowed_types)] // ok because we're implementing the fs + sys_traits::impls::RealSys.sys_time_now() + } +} + +impl sys_traits::ThreadSleep for DenoCompileFileSystem { + #[inline] + fn thread_sleep(&self, dur: Duration) { + #[allow(clippy::disallowed_types)] // ok because we're implementing the fs + sys_traits::impls::RealSys.thread_sleep(dur) + } +} + +impl sys_traits::EnvCurrentDir for DenoCompileFileSystem { + fn env_current_dir(&self) -> std::io::Result { + #[allow(clippy::disallowed_types)] // ok because we're implementing the fs + sys_traits::impls::RealSys.env_current_dir() + } +} + +impl sys_traits::BaseEnvVar for DenoCompileFileSystem { + fn base_env_var_os( + &self, + key: &std::ffi::OsStr, + ) -> Option { + #[allow(clippy::disallowed_types)] // ok because we're implementing the fs + sys_traits::impls::RealSys.base_env_var_os(key) + } +} diff --git a/cli/standalone/mod.rs b/cli/standalone/mod.rs index 0ce25ff62f..4768c742f1 100644 --- a/cli/standalone/mod.rs +++ b/cli/standalone/mod.rs @@ -1,10 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Allow unused code warnings because we share // code between the two bin targets. #![allow(dead_code)] #![allow(unused_imports)] +use std::borrow::Cow; +use std::rc::Rc; +use std::sync::Arc; + use binary::StandaloneData; use binary::StandaloneModules; use code_cache::DenoCompileCodeCache; @@ -36,11 +40,10 @@ use deno_package_json::PackageJsonDepValue; use deno_resolver::cjs::IsCjsResolutionMode; use deno_resolver::npm::NpmReqResolverOptions; use deno_runtime::deno_fs; -use deno_runtime::deno_fs::FsSysTraitsAdapter; +use deno_runtime::deno_fs::FileSystem; use deno_runtime::deno_node::create_host_defined_options; use deno_runtime::deno_node::NodeRequireLoader; use deno_runtime::deno_node::NodeResolver; -use deno_runtime::deno_node::PackageJsonResolver; use deno_runtime::deno_node::RealIsBuiltInNodeModuleChecker; use deno_runtime::deno_permissions::Permissions; use deno_runtime::deno_permissions::PermissionsContainer; @@ -58,9 +61,6 @@ use node_resolver::NodeResolutionKind; use node_resolver::ResolutionMode; use serialization::DenoCompileModuleSource; use serialization::SourceMapStore; -use std::borrow::Cow; -use std::rc::Rc; -use std::sync::Arc; use virtual_fs::FileBackedVfs; use virtual_fs::VfsFileSubDataKind; @@ -77,6 +77,8 @@ use crate::cache::NodeAnalysisCache; use crate::http_util::HttpClientProvider; use crate::node::CliCjsCodeAnalyzer; use crate::node::CliNodeCodeTranslator; +use crate::node::CliNodeResolver; +use crate::node::CliPackageJsonResolver; use crate::npm::create_cli_npm_resolver; use crate::npm::create_in_npm_pkg_checker; use crate::npm::CliByonmNpmResolverCreateOptions; @@ -89,6 +91,7 @@ use crate::npm::CreateInNpmPkgCheckerOptions; use crate::resolver::CjsTracker; use crate::resolver::CliNpmReqResolver; use crate::resolver::NpmModuleLoader; +use crate::sys::CliSys; use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; use crate::util::text_encoding::from_utf8_lossy_cow; @@ -110,7 +113,7 @@ pub use binary::is_standalone_binary; pub use binary::DenoCompileBinaryWriter; use self::binary::Metadata; -use self::file_system::DenoCompileFileSystem; +pub use self::file_system::DenoCompileFileSystem; struct SharedModuleLoaderState { cjs_tracker: Arc, @@ -118,7 +121,7 @@ struct SharedModuleLoaderState { fs: Arc, modules: StandaloneModules, node_code_translator: Arc, - node_resolver: Arc, + node_resolver: Arc, npm_module_loader: Arc, npm_req_resolver: Arc, npm_resolver: Arc, @@ -627,9 +630,12 @@ impl RootCertStoreProvider for StandaloneRootCertStoreProvider { } } -pub async fn run(data: StandaloneData) -> Result { +pub async fn run( + fs: Arc, + sys: CliSys, + data: StandaloneData, +) -> Result { let StandaloneData { - fs, metadata, modules, npm_snapshot, @@ -637,7 +643,7 @@ pub async fn run(data: StandaloneData) -> Result { source_maps, vfs, } = data; - let deno_dir_provider = Arc::new(DenoDirProvider::new(None)); + let deno_dir_provider = Arc::new(DenoDirProvider::new(sys.clone(), None)); let root_cert_store_provider = Arc::new(StandaloneRootCertStoreProvider { ca_stores: metadata.ca_stores, ca_data: metadata.ca_data.map(CaData::Bytes), @@ -655,8 +661,7 @@ pub async fn run(data: StandaloneData) -> Result { let main_module = root_dir_url.join(&metadata.entrypoint_key).unwrap(); let npm_global_cache_dir = root_path.join(".deno_compile_node_modules"); let cache_setting = CacheSetting::Only; - let sys = FsSysTraitsAdapter(fs.clone()); - let pkg_json_resolver = Arc::new(PackageJsonResolver::new(sys.clone())); + let pkg_json_resolver = Arc::new(CliPackageJsonResolver::new(sys.clone())); let (in_npm_pkg_checker, npm_resolver) = match metadata.node_modules { Some(binary::NodeModules::Managed { node_modules_dir }) => { // create an npmrc that uses the fake npm_registry_url to resolve packages @@ -807,7 +812,7 @@ pub async fn run(data: StandaloneData) -> Result { node_resolver.clone(), npm_resolver.clone().into_npm_pkg_folder_resolver(), pkg_json_resolver.clone(), - sys, + sys.clone(), )); let workspace_resolver = { let import_map = match metadata.workspace_resolver.import_map { @@ -910,7 +915,7 @@ pub async fn run(data: StandaloneData) -> Result { } let desc_parser = - Arc::new(RuntimePermissionDescriptorParser::new(fs.clone())); + Arc::new(RuntimePermissionDescriptorParser::new(sys.clone())); let permissions = Permissions::from_options(desc_parser.as_ref(), &permissions)?; PermissionsContainer::new(desc_parser, permissions) @@ -940,6 +945,7 @@ pub async fn run(data: StandaloneData) -> Result { root_cert_store_provider, permissions, StorageKeyResolver::empty(), + sys, crate::args::DenoSubcommand::Run(Default::default()), CliMainWorkerOptions { argv: metadata.argv, diff --git a/cli/standalone/serialization.rs b/cli/standalone/serialization.rs index 30802aa081..238ef44fd0 100644 --- a/cli/standalone/serialization.rs +++ b/cli/standalone/serialization.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::Cell; @@ -25,12 +25,11 @@ use deno_semver::package::PackageReq; use deno_semver::StackString; use indexmap::IndexMap; -use crate::standalone::virtual_fs::VirtualDirectory; - use super::binary::Metadata; use super::virtual_fs::BuiltVfs; use super::virtual_fs::VfsBuilder; use super::virtual_fs::VirtualDirectoryEntries; +use crate::standalone::virtual_fs::VirtualDirectory; const MAGIC_BYTES: &[u8; 8] = b"d3n0l4nd"; diff --git a/cli/standalone/virtual_fs.rs b/cli/standalone/virtual_fs.rs index 522fe47dd9..fab4fad83c 100644 --- a/cli/standalone/virtual_fs.rs +++ b/cli/standalone/virtual_fs.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::RefCell; @@ -34,13 +34,12 @@ use serde::Deserialize; use serde::Serialize; use thiserror::Error; +use super::binary::DENO_COMPILE_GLOBAL_NODE_MODULES_DIR_NAME; use crate::util; use crate::util::display::human_size; use crate::util::display::DisplayTreeNode; use crate::util::fs::canonicalize_path; -use super::binary::DENO_COMPILE_GLOBAL_NODE_MODULES_DIR_NAME; - #[derive(Debug, PartialEq, Eq)] pub enum WindowsSystemRootablePath { /// The root of the system above any drive letters. @@ -51,8 +50,16 @@ pub enum WindowsSystemRootablePath { impl WindowsSystemRootablePath { pub fn join(&self, name_component: &str) -> PathBuf { // this method doesn't handle multiple components - debug_assert!(!name_component.contains('\\')); - debug_assert!(!name_component.contains('/')); + debug_assert!( + !name_component.contains('\\'), + "Invalid component: {}", + name_component + ); + debug_assert!( + !name_component.contains('/'), + "Invalid component: {}", + name_component + ); match self { WindowsSystemRootablePath::WindowSystemRoot => { @@ -847,78 +854,28 @@ enum VfsEntryRef<'a> { Symlink(&'a VirtualSymlink), } -impl<'a> VfsEntryRef<'a> { - pub fn as_fs_stat(&self) -> FsStat { +impl VfsEntryRef<'_> { + pub fn as_metadata(&self) -> FileBackedVfsMetadata { + FileBackedVfsMetadata { + file_type: match self { + Self::Dir(_) => sys_traits::FileType::Dir, + Self::File(_) => sys_traits::FileType::File, + Self::Symlink(_) => sys_traits::FileType::Symlink, + }, + name: self.name().to_string(), + len: match self { + Self::Dir(_) => 0, + Self::File(file) => file.offset.len, + Self::Symlink(_) => 0, + }, + } + } + + pub fn name(&self) -> &str { match self { - VfsEntryRef::Dir(_) => FsStat { - is_directory: true, - is_file: false, - is_symlink: false, - atime: None, - birthtime: None, - mtime: None, - ctime: None, - blksize: 0, - size: 0, - dev: 0, - ino: 0, - mode: 0, - nlink: 0, - uid: 0, - gid: 0, - rdev: 0, - blocks: 0, - is_block_device: false, - is_char_device: false, - is_fifo: false, - is_socket: false, - }, - VfsEntryRef::File(file) => FsStat { - is_directory: false, - is_file: true, - is_symlink: false, - atime: None, - birthtime: None, - mtime: None, - ctime: None, - blksize: 0, - size: file.offset.len, - dev: 0, - ino: 0, - mode: 0, - nlink: 0, - uid: 0, - gid: 0, - rdev: 0, - blocks: 0, - is_block_device: false, - is_char_device: false, - is_fifo: false, - is_socket: false, - }, - VfsEntryRef::Symlink(_) => FsStat { - is_directory: false, - is_file: false, - is_symlink: true, - atime: None, - birthtime: None, - mtime: None, - ctime: None, - blksize: 0, - size: 0, - dev: 0, - ino: 0, - mode: 0, - nlink: 0, - uid: 0, - gid: 0, - rdev: 0, - blocks: 0, - is_block_device: false, - is_char_device: false, - is_fifo: false, - is_socket: false, - }, + Self::Dir(dir) => &dir.name, + Self::File(file) => &file.name, + Self::Symlink(symlink) => &symlink.name, } } } @@ -934,9 +891,9 @@ pub enum VfsEntry { impl VfsEntry { pub fn name(&self) -> &str { match self { - VfsEntry::Dir(dir) => &dir.name, - VfsEntry::File(file) => &file.name, - VfsEntry::Symlink(symlink) => &symlink.name, + Self::Dir(dir) => &dir.name, + Self::File(file) => &file.name, + Self::Symlink(symlink) => &symlink.name, } } @@ -1180,14 +1137,14 @@ impl VfsRoot { } } -struct FileBackedVfsFile { +pub struct FileBackedVfsFile { file: VirtualFile, pos: RefCell, vfs: Arc, } impl FileBackedVfsFile { - fn seek(&self, pos: SeekFrom) -> FsResult { + pub fn seek(&self, pos: SeekFrom) -> std::io::Result { match pos { SeekFrom::Start(pos) => { *self.pos.borrow_mut() = pos; @@ -1196,10 +1153,10 @@ impl FileBackedVfsFile { SeekFrom::End(offset) => { if offset < 0 && -offset as u64 > self.file.offset.len { let msg = "An attempt was made to move the file pointer before the beginning of the file."; - Err( - std::io::Error::new(std::io::ErrorKind::PermissionDenied, msg) - .into(), - ) + Err(std::io::Error::new( + std::io::ErrorKind::PermissionDenied, + msg, + )) } else { let mut current_pos = self.pos.borrow_mut(); *current_pos = if offset >= 0 { @@ -1215,7 +1172,7 @@ impl FileBackedVfsFile { if offset >= 0 { *current_pos += offset as u64; } else if -offset as u64 > *current_pos { - return Err(std::io::Error::new(std::io::ErrorKind::PermissionDenied, "An attempt was made to move the file pointer before the beginning of the file.").into()); + return Err(std::io::Error::new(std::io::ErrorKind::PermissionDenied, "An attempt was made to move the file pointer before the beginning of the file.")); } else { *current_pos -= -offset as u64; } @@ -1224,7 +1181,7 @@ impl FileBackedVfsFile { } } - fn read_to_buf(&self, buf: &mut [u8]) -> FsResult { + pub fn read_to_buf(&self, buf: &mut [u8]) -> std::io::Result { let read_pos = { let mut pos = self.pos.borrow_mut(); let read_pos = *pos; @@ -1232,10 +1189,7 @@ impl FileBackedVfsFile { *pos = std::cmp::min(self.file.offset.len, *pos + buf.len() as u64); read_pos }; - self - .vfs - .read_file(&self.file, read_pos, buf) - .map_err(|err| err.into()) + self.vfs.read_file(&self.file, read_pos, buf) } fn read_to_end(&self) -> FsResult> { @@ -1270,7 +1224,7 @@ impl FileBackedVfsFile { #[async_trait::async_trait(?Send)] impl deno_io::fs::File for FileBackedVfsFile { fn read_sync(self: Rc, buf: &mut [u8]) -> FsResult { - self.read_to_buf(buf) + self.read_to_buf(buf).map_err(Into::into) } async fn read_byob( self: Rc, @@ -1314,10 +1268,10 @@ impl deno_io::fs::File for FileBackedVfsFile { } fn seek_sync(self: Rc, pos: SeekFrom) -> FsResult { - self.seek(pos) + self.seek(pos).map_err(|err| err.into()) } async fn seek_async(self: Rc, pos: SeekFrom) -> FsResult { - self.seek(pos) + self.seek(pos).map_err(|err| err.into()) } fn datasync_sync(self: Rc) -> FsResult<()> { @@ -1393,6 +1347,47 @@ impl deno_io::fs::File for FileBackedVfsFile { } } +#[derive(Debug, Clone)] +pub struct FileBackedVfsDirEntry { + pub parent_path: PathBuf, + pub metadata: FileBackedVfsMetadata, +} + +#[derive(Debug, Clone)] +pub struct FileBackedVfsMetadata { + pub name: String, + pub file_type: sys_traits::FileType, + pub len: u64, +} + +impl FileBackedVfsMetadata { + pub fn as_fs_stat(&self) -> FsStat { + FsStat { + is_directory: self.file_type == sys_traits::FileType::Dir, + is_file: self.file_type == sys_traits::FileType::File, + is_symlink: self.file_type == sys_traits::FileType::Symlink, + atime: None, + birthtime: None, + mtime: None, + ctime: None, + blksize: 0, + size: self.len, + dev: 0, + ino: 0, + mode: 0, + nlink: 0, + uid: 0, + gid: 0, + rdev: 0, + blocks: 0, + is_block_device: false, + is_char_device: false, + is_fifo: false, + is_socket: false, + } + } +} + #[derive(Debug)] pub struct FileBackedVfs { vfs_data: Cow<'static, [u8]>, @@ -1418,13 +1413,13 @@ impl FileBackedVfs { pub fn open_file( self: &Arc, path: &Path, - ) -> std::io::Result> { + ) -> std::io::Result { let file = self.file_entry(path)?; - Ok(Rc::new(FileBackedVfsFile { + Ok(FileBackedVfsFile { file: file.clone(), vfs: self.clone(), pos: Default::default(), - })) + }) } pub fn read_dir(&self, path: &Path) -> std::io::Result> { @@ -1443,6 +1438,18 @@ impl FileBackedVfs { ) } + pub fn read_dir_with_metadata<'a>( + &'a self, + path: &Path, + ) -> std::io::Result + 'a> { + let dir = self.dir_entry(path)?; + let path = path.to_path_buf(); + Ok(dir.entries.iter().map(move |entry| FileBackedVfsDirEntry { + parent_path: path.to_path_buf(), + metadata: entry.as_ref().as_metadata(), + })) + } + pub fn read_link(&self, path: &Path) -> std::io::Result { let (_, entry) = self.fs_root.find_entry_no_follow(path)?; match entry { @@ -1456,14 +1463,14 @@ impl FileBackedVfs { } } - pub fn lstat(&self, path: &Path) -> std::io::Result { + pub fn lstat(&self, path: &Path) -> std::io::Result { let (_, entry) = self.fs_root.find_entry_no_follow(path)?; - Ok(entry.as_fs_stat()) + Ok(entry.as_metadata()) } - pub fn stat(&self, path: &Path) -> std::io::Result { + pub fn stat(&self, path: &Path) -> std::io::Result { let (_, entry) = self.fs_root.find_entry(path)?; - Ok(entry.as_fs_stat()) + Ok(entry.as_metadata()) } pub fn canonicalize(&self, path: &Path) -> std::io::Result { @@ -1555,8 +1562,10 @@ impl FileBackedVfs { #[cfg(test)] mod test { - use console_static_text::ansi::strip_ansi_codes; use std::io::Write; + + use console_static_text::ansi::strip_ansi_codes; + use deno_io::fs::File; use test_util::assert_contains; use test_util::TempDir; @@ -1641,25 +1650,31 @@ mod test { ); // metadata - assert!( + assert_eq!( virtual_fs .lstat(&dest_path.join("sub_dir").join("e.txt")) .unwrap() - .is_symlink + .file_type, + sys_traits::FileType::Symlink, ); - assert!( + assert_eq!( virtual_fs .stat(&dest_path.join("sub_dir").join("e.txt")) .unwrap() - .is_file + .file_type, + sys_traits::FileType::File, ); - assert!( + assert_eq!( virtual_fs .stat(&dest_path.join("sub_dir")) .unwrap() - .is_directory, + .file_type, + sys_traits::FileType::Dir, + ); + assert_eq!( + virtual_fs.stat(&dest_path.join("e.txt")).unwrap().file_type, + sys_traits::FileType::File ); - assert!(virtual_fs.stat(&dest_path.join("e.txt")).unwrap().is_file,); } #[test] @@ -1696,11 +1711,12 @@ mod test { read_file(&virtual_fs, &dest_path.join("sub_dir_link").join("c.txt")), "c", ); - assert!( + assert_eq!( virtual_fs .lstat(&dest_path.join("sub_dir_link")) .unwrap() - .is_symlink + .file_type, + sys_traits::FileType::Symlink, ); assert_eq!( @@ -1772,37 +1788,35 @@ mod test { let (dest_path, virtual_fs) = into_virtual_fs(builder, &temp_dir); let virtual_fs = Arc::new(virtual_fs); let file = virtual_fs.open_file(&dest_path.join("a.txt")).unwrap(); - file.clone().seek_sync(SeekFrom::Current(2)).unwrap(); + file.seek(SeekFrom::Current(2)).unwrap(); let mut buf = vec![0; 2]; - file.clone().read_sync(&mut buf).unwrap(); + file.read_to_buf(&mut buf).unwrap(); assert_eq!(buf, b"23"); - file.clone().read_sync(&mut buf).unwrap(); + file.read_to_buf(&mut buf).unwrap(); assert_eq!(buf, b"45"); - file.clone().seek_sync(SeekFrom::Current(-4)).unwrap(); - file.clone().read_sync(&mut buf).unwrap(); + file.seek(SeekFrom::Current(-4)).unwrap(); + file.read_to_buf(&mut buf).unwrap(); assert_eq!(buf, b"23"); - file.clone().seek_sync(SeekFrom::Start(2)).unwrap(); - file.clone().read_sync(&mut buf).unwrap(); + file.seek(SeekFrom::Start(2)).unwrap(); + file.read_to_buf(&mut buf).unwrap(); assert_eq!(buf, b"23"); - file.clone().seek_sync(SeekFrom::End(2)).unwrap(); - file.clone().read_sync(&mut buf).unwrap(); + file.seek(SeekFrom::End(2)).unwrap(); + file.read_to_buf(&mut buf).unwrap(); assert_eq!(buf, b"89"); - file.clone().seek_sync(SeekFrom::Current(-8)).unwrap(); - file.clone().read_sync(&mut buf).unwrap(); + file.seek(SeekFrom::Current(-8)).unwrap(); + file.read_to_buf(&mut buf).unwrap(); assert_eq!(buf, b"23"); assert_eq!( file - .clone() - .seek_sync(SeekFrom::Current(-5)) - .err() - .unwrap() - .into_io_error() + .seek(SeekFrom::Current(-5)) + .unwrap_err() .to_string(), "An attempt was made to move the file pointer before the beginning of the file." ); // go beyond the file length, then back - file.clone().seek_sync(SeekFrom::Current(40)).unwrap(); - file.clone().seek_sync(SeekFrom::Current(-38)).unwrap(); + file.seek(SeekFrom::Current(40)).unwrap(); + file.seek(SeekFrom::Current(-38)).unwrap(); + let file = Rc::new(file); let read_buf = file.clone().read(2).await.unwrap(); assert_eq!(read_buf.to_vec(), b"67"); file.clone().seek_sync(SeekFrom::Current(-2)).unwrap(); diff --git a/cli/sys.rs b/cli/sys.rs new file mode 100644 index 0000000000..f23bbc9dc8 --- /dev/null +++ b/cli/sys.rs @@ -0,0 +1,218 @@ +// Copyright 2018-2025 the Deno authors. MIT license. + +// todo(dsherret): this should instead use conditional compilation and directly +// surface the underlying implementation. +// +// The problem atm is that there's no way to have conditional compilation for +// denort or the deno binary. We should extract out denort to a separate binary. + +use std::borrow::Cow; + +use sys_traits::boxed::BoxedFsDirEntry; +use sys_traits::boxed::BoxedFsFile; +use sys_traits::boxed::BoxedFsMetadataValue; +use sys_traits::boxed::FsMetadataBoxed; +use sys_traits::boxed::FsOpenBoxed; +use sys_traits::boxed::FsReadDirBoxed; +use sys_traits::CreateDirOptions; + +use crate::standalone::DenoCompileFileSystem; + +#[derive(Debug, Clone)] +pub enum CliSys { + #[allow(dead_code)] // will be dead code for denort + #[allow(clippy::disallowed_types)] // ok because sys impl + Real(sys_traits::impls::RealSys), + #[allow(dead_code)] // will be dead code for deno + DenoCompile(DenoCompileFileSystem), +} + +impl Default for CliSys { + fn default() -> Self { + Self::Real(sys_traits::impls::RealSys) + } +} + +impl deno_runtime::deno_node::ExtNodeSys for CliSys {} + +impl sys_traits::BaseFsHardLink for CliSys { + fn base_fs_hard_link( + &self, + src: &std::path::Path, + dst: &std::path::Path, + ) -> std::io::Result<()> { + match self { + Self::Real(sys) => sys.base_fs_hard_link(src, dst), + Self::DenoCompile(sys) => sys.base_fs_hard_link(src, dst), + } + } +} + +impl sys_traits::BaseFsRead for CliSys { + fn base_fs_read( + &self, + p: &std::path::Path, + ) -> std::io::Result> { + match self { + Self::Real(sys) => sys.base_fs_read(p), + Self::DenoCompile(sys) => sys.base_fs_read(p), + } + } +} + +impl sys_traits::BaseFsReadDir for CliSys { + type ReadDirEntry = BoxedFsDirEntry; + + fn base_fs_read_dir( + &self, + p: &std::path::Path, + ) -> std::io::Result< + Box> + '_>, + > { + match self { + Self::Real(sys) => sys.fs_read_dir_boxed(p), + Self::DenoCompile(sys) => sys.fs_read_dir_boxed(p), + } + } +} + +impl sys_traits::BaseFsCanonicalize for CliSys { + fn base_fs_canonicalize( + &self, + p: &std::path::Path, + ) -> std::io::Result { + match self { + Self::Real(sys) => sys.base_fs_canonicalize(p), + Self::DenoCompile(sys) => sys.base_fs_canonicalize(p), + } + } +} + +impl sys_traits::BaseFsMetadata for CliSys { + type Metadata = BoxedFsMetadataValue; + + fn base_fs_metadata( + &self, + path: &std::path::Path, + ) -> std::io::Result { + match self { + Self::Real(sys) => sys.fs_metadata_boxed(path), + Self::DenoCompile(sys) => sys.fs_metadata_boxed(path), + } + } + + fn base_fs_symlink_metadata( + &self, + path: &std::path::Path, + ) -> std::io::Result { + match self { + Self::Real(sys) => sys.fs_symlink_metadata_boxed(path), + Self::DenoCompile(sys) => sys.fs_symlink_metadata_boxed(path), + } + } +} + +impl sys_traits::BaseFsCreateDir for CliSys { + fn base_fs_create_dir( + &self, + p: &std::path::Path, + options: &CreateDirOptions, + ) -> std::io::Result<()> { + match self { + Self::Real(sys) => sys.base_fs_create_dir(p, options), + Self::DenoCompile(sys) => sys.base_fs_create_dir(p, options), + } + } +} + +impl sys_traits::BaseFsOpen for CliSys { + type File = BoxedFsFile; + + fn base_fs_open( + &self, + path: &std::path::Path, + options: &sys_traits::OpenOptions, + ) -> std::io::Result { + match self { + Self::Real(sys) => sys.fs_open_boxed(path, options), + Self::DenoCompile(sys) => sys.fs_open_boxed(path, options), + } + } +} + +impl sys_traits::BaseFsRemoveFile for CliSys { + fn base_fs_remove_file(&self, p: &std::path::Path) -> std::io::Result<()> { + match self { + Self::Real(sys) => sys.base_fs_remove_file(p), + Self::DenoCompile(sys) => sys.base_fs_remove_file(p), + } + } +} + +impl sys_traits::BaseFsRename for CliSys { + fn base_fs_rename( + &self, + old: &std::path::Path, + new: &std::path::Path, + ) -> std::io::Result<()> { + match self { + Self::Real(sys) => sys.base_fs_rename(old, new), + Self::DenoCompile(sys) => sys.base_fs_rename(old, new), + } + } +} + +impl sys_traits::SystemRandom for CliSys { + fn sys_random(&self, buf: &mut [u8]) -> std::io::Result<()> { + match self { + Self::Real(sys) => sys.sys_random(buf), + Self::DenoCompile(sys) => sys.sys_random(buf), + } + } +} + +impl sys_traits::SystemTimeNow for CliSys { + fn sys_time_now(&self) -> std::time::SystemTime { + match self { + Self::Real(sys) => sys.sys_time_now(), + Self::DenoCompile(sys) => sys.sys_time_now(), + } + } +} + +impl sys_traits::ThreadSleep for CliSys { + fn thread_sleep(&self, dur: std::time::Duration) { + match self { + Self::Real(sys) => sys.thread_sleep(dur), + Self::DenoCompile(sys) => sys.thread_sleep(dur), + } + } +} + +impl sys_traits::EnvCurrentDir for CliSys { + fn env_current_dir(&self) -> std::io::Result { + match self { + Self::Real(sys) => sys.env_current_dir(), + Self::DenoCompile(sys) => sys.env_current_dir(), + } + } +} + +impl sys_traits::BaseEnvVar for CliSys { + fn base_env_var_os( + &self, + key: &std::ffi::OsStr, + ) -> Option { + match self { + Self::Real(sys) => sys.base_env_var_os(key), + Self::DenoCompile(sys) => sys.base_env_var_os(key), + } + } +} + +impl sys_traits::EnvHomeDir for CliSys { + fn env_home_dir(&self) -> Option { + #[allow(clippy::disallowed_types)] // ok because sys impl + sys_traits::impls::RealSys.env_home_dir() + } +} diff --git a/cli/task_runner.rs b/cli/task_runner.rs index d6589a1832..8510a650e7 100644 --- a/cli/task_runner.rs +++ b/cli/task_runner.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::path::Path; @@ -10,7 +10,6 @@ use deno_core::anyhow::Context; use deno_core::error::AnyError; use deno_core::futures; use deno_core::futures::future::LocalBoxFuture; -use deno_runtime::deno_node::NodeResolver; use deno_semver::package::PackageNv; use deno_task_shell::ExecutableCommand; use deno_task_shell::ExecuteResult; @@ -25,6 +24,7 @@ use tokio::task::JoinHandle; use tokio::task::LocalSet; use tokio_util::sync::CancellationToken; +use crate::node::CliNodeResolver; use crate::npm::CliNpmResolver; use crate::npm::InnerCliNpmResolverRef; use crate::npm::ManagedCliNpmResolver; @@ -415,7 +415,7 @@ impl ShellCommand for NodeModulesFileRunCommand { pub fn resolve_custom_commands( npm_resolver: &dyn CliNpmResolver, - node_resolver: &NodeResolver, + node_resolver: &CliNodeResolver, ) -> Result>, AnyError> { let mut commands = match npm_resolver.as_inner() { InnerCliNpmResolverRef::Byonm(npm_resolver) => { @@ -522,7 +522,7 @@ fn resolve_execution_path_from_npx_shim( fn resolve_managed_npm_commands( npm_resolver: &ManagedCliNpmResolver, - node_resolver: &NodeResolver, + node_resolver: &CliNodeResolver, ) -> Result>, AnyError> { let mut result = HashMap::new(); let snapshot = npm_resolver.snapshot(); diff --git a/cli/tools/bench/mod.rs b/cli/tools/bench/mod.rs index 314f9675ac..20eee1c729 100644 --- a/cli/tools/bench/mod.rs +++ b/cli/tools/bench/mod.rs @@ -1,20 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::args::BenchFlags; -use crate::args::CliOptions; -use crate::args::Flags; -use crate::colors; -use crate::display::write_json_to_stdout; -use crate::factory::SpecifierInfo; -use crate::factory::WorkspaceFilesFactory; -use crate::ops; -use crate::tools::test::format_test_error; -use crate::tools::test::TestFilter; -use crate::util::file_watcher; -use crate::util::fs::collect_specifiers; -use crate::util::path::is_script_ext; -use crate::util::path::matches_pattern_or_exact_path; use crate::worker::CliMainWorkerFactory; +use std::collections::HashSet; +use std::path::Path; +use std::path::PathBuf; +use std::sync::Arc; +use std::time::Duration; use deno_config::glob::WalkEntry; use deno_core::error::generic_error; @@ -39,14 +30,25 @@ use indexmap::IndexSet; use log::Level; use serde::Deserialize; use serde::Serialize; -use std::collections::HashSet; -use std::path::Path; -use std::path::PathBuf; -use std::sync::Arc; -use std::time::Duration; use tokio::sync::mpsc::unbounded_channel; use tokio::sync::mpsc::UnboundedSender; +use crate::args::BenchFlags; +use crate::args::CliOptions; +use crate::args::Flags; +use crate::colors; +use crate::display::write_json_to_stdout; +use crate::factory::SpecifierInfo; +use crate::factory::WorkspaceFilesFactory; +use crate::ops; +use crate::sys::CliSys; +use crate::tools::test::format_test_error; +use crate::tools::test::TestFilter; +use crate::util::file_watcher; +use crate::util::fs::collect_specifiers; +use crate::util::path::is_script_ext; +use crate::util::path::matches_pattern_or_exact_path; + mod mitata; mod reporters; @@ -433,7 +435,7 @@ pub async fn run_benchmarks( bench_flags: BenchFlags, ) -> Result<(), AnyError> { let log_level = flags.log_level; - let cli_options = CliOptions::from_flags(flags)?; + let cli_options = CliOptions::from_flags(&CliSys::default(), flags)?; let workspace_dirs_with_files = cli_options .resolve_bench_options_for_members(&bench_flags)? .into_iter() @@ -506,7 +508,7 @@ pub async fn run_benchmarks_with_watch( watcher_communicator.show_path_changed(changed_paths.clone()); Ok(async move { let log_level: Option = flags.log_level; - let cli_options = CliOptions::from_flags(flags)?; + let cli_options = CliOptions::from_flags(&CliSys::default(), flags)?; let workspace_dirs_with_files = cli_options .resolve_bench_options_for_members(&bench_flags)? .into_iter() diff --git a/cli/tools/bench/reporters.rs b/cli/tools/bench/reporters.rs index 9aabd760b3..68a0c56bce 100644 --- a/cli/tools/bench/reporters.rs +++ b/cli/tools/bench/reporters.rs @@ -1,12 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use serde::Serialize; +use super::*; use crate::tools::test::TestFailureFormatOptions; use crate::version; -use super::*; - pub trait BenchReporter { fn report_group_summary(&mut self); fn report_plan(&mut self, plan: &BenchPlan); diff --git a/cli/tools/check.rs b/cli/tools/check.rs index c05b5f0d01..6259a8e865 100644 --- a/cli/tools/check.rs +++ b/cli/tools/check.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashSet; use std::collections::VecDeque; @@ -12,7 +12,6 @@ use deno_core::error::AnyError; use deno_core::futures::FutureExt; use deno_graph::Module; use deno_graph::ModuleGraph; -use deno_runtime::deno_node::NodeResolver; use deno_terminal::colors; use once_cell::sync::Lazy; use regex::Regex; @@ -34,7 +33,9 @@ use crate::factory::SpecifierInfo; use crate::factory::WorkspaceFilesFactory; use crate::graph_util::BuildFastCheckGraphOptions; use crate::graph_util::ModuleGraphBuilder; +use crate::node::CliNodeResolver; use crate::npm::CliNpmResolver; +use crate::sys::CliSys; use crate::tsc; use crate::tsc::Diagnostics; use crate::tsc::TypeCheckingCjsTracker; @@ -47,7 +48,7 @@ pub async fn check( flags: Arc, check_flags: CheckFlags, ) -> Result<(), AnyError> { - let cli_options = CliOptions::from_flags(flags)?; + let cli_options = CliOptions::from_flags(&CliSys::default(), flags)?; let workspace_dirs_with_files = cli_options.resolve_file_flags_for_members(&FileFlags { ignore: Default::default(), @@ -130,7 +131,7 @@ pub struct TypeChecker { cjs_tracker: Arc, cli_options: Arc, module_graph_builder: Arc, - node_resolver: Arc, + node_resolver: Arc, npm_resolver: Arc, } @@ -140,7 +141,7 @@ impl TypeChecker { cjs_tracker: Arc, cli_options: Arc, module_graph_builder: Arc, - node_resolver: Arc, + node_resolver: Arc, npm_resolver: Arc, ) -> Self { Self { diff --git a/cli/tools/clean.rs b/cli/tools/clean.rs index 2a77434f88..e6f8c1e52b 100644 --- a/cli/tools/clean.rs +++ b/cli/tools/clean.rs @@ -1,12 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::path::Path; use deno_core::anyhow::Context; use deno_core::error::AnyError; -use std::path::Path; use crate::cache::DenoDir; use crate::colors; use crate::display; +use crate::sys::CliSys; use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; use crate::util::progress_bar::ProgressMessagePrompt; @@ -28,7 +30,7 @@ impl CleanState { } pub fn clean() -> Result<(), AnyError> { - let deno_dir = DenoDir::new(None)?; + let deno_dir = DenoDir::new(CliSys::default(), None)?; if deno_dir.root.exists() { let no_of_files = walkdir::WalkDir::new(&deno_dir.root).into_iter().count(); let progress_bar = ProgressBar::new(ProgressBarStyle::ProgressBars); diff --git a/cli/tools/compile.rs b/cli/tools/compile.rs index 7a463a7b09..b148c9a0b1 100644 --- a/cli/tools/compile.rs +++ b/cli/tools/compile.rs @@ -1,12 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::HashSet; +use std::collections::VecDeque; +use std::path::Path; +use std::path::PathBuf; +use std::sync::Arc; -use crate::args::check_warn_tsconfig; -use crate::args::CompileFlags; -use crate::args::Flags; -use crate::factory::CliFactory; -use crate::http_util::HttpClientProvider; -use crate::standalone::binary::WriteBinOptions; -use crate::standalone::is_standalone_binary; use deno_ast::MediaType; use deno_ast::ModuleSpecifier; use deno_core::anyhow::bail; @@ -19,13 +18,15 @@ use deno_path_util::url_from_file_path; use deno_path_util::url_to_file_path; use deno_terminal::colors; use rand::Rng; -use std::collections::HashSet; -use std::collections::VecDeque; -use std::path::Path; -use std::path::PathBuf; -use std::sync::Arc; use super::installer::infer_name_from_url; +use crate::args::check_warn_tsconfig; +use crate::args::CompileFlags; +use crate::args::Flags; +use crate::factory::CliFactory; +use crate::http_util::HttpClientProvider; +use crate::standalone::binary::is_standalone_binary; +use crate::standalone::binary::WriteBinOptions; pub async fn compile( flags: Arc, diff --git a/cli/tools/coverage/merge.rs b/cli/tools/coverage/merge.rs index 81317df559..9c898e78d3 100644 --- a/cli/tools/coverage/merge.rs +++ b/cli/tools/coverage/merge.rs @@ -1,16 +1,17 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // // Forked from https://github.com/demurgos/v8-coverage/tree/d0ca18da8740198681e0bc68971b0a6cdb11db3e/rust // Copyright 2021 Charles Samborski. All rights reserved. MIT license. -use super::range_tree::RangeTree; -use super::range_tree::RangeTreeArena; -use crate::cdp; use std::collections::BTreeMap; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::Peekable; +use super::range_tree::RangeTree; +use super::range_tree::RangeTreeArena; +use crate::cdp; + #[derive(Eq, PartialEq, Clone, Debug)] pub struct ProcessCoverage { pub result: Vec, diff --git a/cli/tools/coverage/mod.rs b/cli/tools/coverage/mod.rs index 4736bdab41..522d7d75be 100644 --- a/cli/tools/coverage/mod.rs +++ b/cli/tools/coverage/mod.rs @@ -1,15 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::args::CliOptions; -use crate::args::CoverageFlags; -use crate::args::FileFlags; -use crate::args::Flags; -use crate::cdp; -use crate::factory::CliFactory; -use crate::file_fetcher::TextDecodedFile; -use crate::tools::fmt::format_json; -use crate::tools::test::is_supported_test_path; -use crate::util::text_encoding::source_map_from_code; +use std::fs; +use std::fs::File; +use std::io::BufWriter; +use std::io::Write; +use std::path::Path; +use std::path::PathBuf; +use std::sync::Arc; use deno_ast::MediaType; use deno_ast::ModuleKind; @@ -26,19 +23,23 @@ use deno_core::serde_json; use deno_core::sourcemap::SourceMap; use deno_core::url::Url; use deno_core::LocalInspectorSession; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use node_resolver::InNpmPackageChecker; use regex::Regex; -use std::fs; -use std::fs::File; -use std::io::BufWriter; -use std::io::Write; -use std::path::Path; -use std::path::PathBuf; -use std::sync::Arc; use text_lines::TextLines; use uuid::Uuid; +use crate::args::CliOptions; +use crate::args::CoverageFlags; +use crate::args::FileFlags; +use crate::args::Flags; +use crate::cdp; +use crate::factory::CliFactory; +use crate::file_fetcher::TextDecodedFile; +use crate::sys::CliSys; +use crate::tools::fmt::format_json; +use crate::tools::test::is_supported_test_path; +use crate::util::text_encoding::source_map_from_code; + mod merge; mod range_tree; mod reporter; @@ -429,7 +430,7 @@ fn collect_coverages( .ignore_git_folder() .ignore_node_modules() .set_vendor_folder(cli_options.vendor_dir_path().map(ToOwned::to_owned)) - .collect_file_patterns(&FsSysTraitsAdapter::new_real(), file_patterns)?; + .collect_file_patterns(&CliSys::default(), file_patterns)?; let coverage_patterns = FilePatterns { base: initial_cwd.to_path_buf(), diff --git a/cli/tools/coverage/range_tree.rs b/cli/tools/coverage/range_tree.rs index bca52844c0..08ac914cd2 100644 --- a/cli/tools/coverage/range_tree.rs +++ b/cli/tools/coverage/range_tree.rs @@ -1,12 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // // Forked from https://github.com/demurgos/v8-coverage/tree/d0ca18da8740198681e0bc68971b0a6cdb11db3e/rust // Copyright 2021 Charles Samborski. All rights reserved. MIT license. -use crate::cdp; use std::iter::Peekable; + use typed_arena::Arena; +use crate::cdp; + pub struct RangeTreeArena<'a>(Arena>); impl<'a> RangeTreeArena<'a> { diff --git a/cli/tools/coverage/reporter.rs b/cli/tools/coverage/reporter.rs index 6b0e5c885e..bc6e85b47e 100644 --- a/cli/tools/coverage/reporter.rs +++ b/cli/tools/coverage/reporter.rs @@ -1,11 +1,5 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::util; -use super::CoverageReport; -use crate::args::CoverageType; -use crate::colors; -use deno_core::error::AnyError; -use deno_core::url::Url; use std::collections::HashMap; use std::fs; use std::fs::File; @@ -15,6 +9,14 @@ use std::io::{self}; use std::path::Path; use std::path::PathBuf; +use deno_core::error::AnyError; +use deno_core::url::Url; + +use super::util; +use super::CoverageReport; +use crate::args::CoverageType; +use crate::colors; + #[derive(Default)] pub struct CoverageStats<'a> { pub line_hit: usize, diff --git a/cli/tools/coverage/util.rs b/cli/tools/coverage/util.rs index e9518e1f78..e61830b7fe 100644 --- a/cli/tools/coverage/util.rs +++ b/cli/tools/coverage/util.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::url::Url; diff --git a/cli/tools/doc.rs b/cli/tools/doc.rs index c33b988de0..2fa944b362 100644 --- a/cli/tools/doc.rs +++ b/cli/tools/doc.rs @@ -1,17 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::BTreeMap; +use std::rc::Rc; +use std::sync::Arc; -use crate::args::DocFlags; -use crate::args::DocHtmlFlag; -use crate::args::DocSourceFileFlag; -use crate::args::Flags; -use crate::colors; -use crate::display; -use crate::factory::CliFactory; -use crate::graph_util::graph_exit_integrity_errors; -use crate::graph_util::graph_walk_errors; -use crate::graph_util::GraphWalkErrorsOptions; -use crate::tsc::get_types_declaration_file_text; -use crate::util::fs::collect_specifiers; use deno_ast::diagnostics::Diagnostic; use deno_config::glob::FilePatterns; use deno_config::glob::PathOrPatternSet; @@ -28,13 +20,23 @@ use deno_graph::EsParser; use deno_graph::GraphKind; use deno_graph::ModuleAnalyzer; use deno_graph::ModuleSpecifier; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use doc::html::ShortPath; use doc::DocDiagnostic; use indexmap::IndexMap; -use std::collections::BTreeMap; -use std::rc::Rc; -use std::sync::Arc; + +use crate::args::DocFlags; +use crate::args::DocHtmlFlag; +use crate::args::DocSourceFileFlag; +use crate::args::Flags; +use crate::colors; +use crate::display; +use crate::factory::CliFactory; +use crate::graph_util::graph_exit_integrity_errors; +use crate::graph_util::graph_walk_errors; +use crate::graph_util::GraphWalkErrorsOptions; +use crate::sys::CliSys; +use crate::tsc::get_types_declaration_file_text; +use crate::util::fs::collect_specifiers; const JSON_SCHEMA_VERSION: u8 = 1; @@ -115,7 +117,7 @@ pub async fn doc( } DocSourceFileFlag::Paths(ref source_files) => { let module_graph_creator = factory.module_graph_creator().await?; - let fs = FsSysTraitsAdapter(factory.fs().clone()); + let sys = CliSys::default(); let module_specifiers = collect_specifiers( FilePatterns { @@ -142,7 +144,7 @@ pub async fn doc( graph_exit_integrity_errors(&graph); let errors = graph_walk_errors( &graph, - &fs, + &sys, &module_specifiers, GraphWalkErrorsOptions { check_js: false, diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs index 55046155c0..29db06e97f 100644 --- a/cli/tools/fmt.rs +++ b/cli/tools/fmt.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! This module provides file formatting utilities using //! [`dprint-plugin-typescript`](https://github.com/dprint/dprint-plugin-typescript). @@ -7,20 +7,18 @@ //! the future it can be easily extended to provide //! the same functions as ops available in JS runtime. -use crate::args::CliOptions; -use crate::args::Flags; -use crate::args::FmtFlags; -use crate::args::FmtOptions; -use crate::args::FmtOptionsConfig; -use crate::args::ProseWrap; -use crate::args::UnstableFmtOptions; -use crate::cache::Caches; -use crate::colors; -use crate::factory::CliFactory; -use crate::util::diff::diff; -use crate::util::file_watcher; -use crate::util::fs::canonicalize_path; -use crate::util::path::get_extension; +use std::borrow::Cow; +use std::fs; +use std::io::stdin; +use std::io::stdout; +use std::io::Read; +use std::io::Write; +use std::path::Path; +use std::path::PathBuf; +use std::sync::atomic::AtomicUsize; +use std::sync::atomic::Ordering; +use std::sync::Arc; + use async_trait::async_trait; use deno_ast::ParsedSource; use deno_config::glob::FileCollector; @@ -34,23 +32,26 @@ use deno_core::futures; use deno_core::parking_lot::Mutex; use deno_core::unsync::spawn_blocking; use deno_core::url::Url; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use log::debug; use log::info; use log::warn; -use std::borrow::Cow; -use std::fs; -use std::io::stdin; -use std::io::stdout; -use std::io::Read; -use std::io::Write; -use std::path::Path; -use std::path::PathBuf; -use std::sync::atomic::AtomicUsize; -use std::sync::atomic::Ordering; -use std::sync::Arc; +use crate::args::CliOptions; +use crate::args::Flags; +use crate::args::FmtFlags; +use crate::args::FmtOptions; +use crate::args::FmtOptionsConfig; +use crate::args::ProseWrap; +use crate::args::UnstableFmtOptions; +use crate::cache::Caches; use crate::cache::IncrementalCache; +use crate::colors; +use crate::factory::CliFactory; +use crate::sys::CliSys; +use crate::util::diff::diff; +use crate::util::file_watcher; +use crate::util::fs::canonicalize_path; +use crate::util::path::get_extension; /// Format JavaScript/TypeScript files. pub async fn format( @@ -58,7 +59,7 @@ pub async fn format( fmt_flags: FmtFlags, ) -> Result<(), AnyError> { if fmt_flags.is_stdin() { - let cli_options = CliOptions::from_flags(flags)?; + let cli_options = CliOptions::from_flags(&CliSys::default(), flags)?; let start_dir = &cli_options.start_dir; let fmt_config = start_dir .to_fmt_config(FilePatterns::new_with_base(start_dir.dir_path()))?; @@ -231,7 +232,7 @@ fn collect_fmt_files( .ignore_node_modules() .use_gitignore() .set_vendor_folder(cli_options.vendor_dir_path().map(ToOwned::to_owned)) - .collect_file_patterns(&FsSysTraitsAdapter::new_real(), files) + .collect_file_patterns(&CliSys::default(), files) } /// Formats markdown (using ) and its code blocks diff --git a/cli/tools/info.rs b/cli/tools/info.rs index 39a7a912bf..74d6591124 100644 --- a/cli/tools/info.rs +++ b/cli/tools/info.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::collections::HashSet; diff --git a/cli/tools/init/mod.rs b/cli/tools/init/mod.rs index 36bdbac2bc..d077de44ce 100644 --- a/cli/tools/init/mod.rs +++ b/cli/tools/init/mod.rs @@ -1,12 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::io::IsTerminal; +use std::io::Write; +use std::path::Path; -use crate::args::DenoSubcommand; -use crate::args::Flags; -use crate::args::InitFlags; -use crate::args::PackagesAllowedScripts; -use crate::args::PermissionFlags; -use crate::args::RunFlags; -use crate::colors; use color_print::cformat; use color_print::cstr; use deno_config::deno_json::NodeModulesDirMode; @@ -15,9 +12,14 @@ use deno_core::error::AnyError; use deno_core::serde_json::json; use deno_runtime::WorkerExecutionMode; use log::info; -use std::io::IsTerminal; -use std::io::Write; -use std::path::Path; + +use crate::args::DenoSubcommand; +use crate::args::Flags; +use crate::args::InitFlags; +use crate::args::PackagesAllowedScripts; +use crate::args::PermissionFlags; +use crate::args::RunFlags; +use crate::colors; pub async fn init_project(init_flags: InitFlags) -> Result { if let Some(package) = &init_flags.package { diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index ec538ecb0a..6dc065171a 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -1,4 +1,28 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::env; +use std::fs; +use std::fs::File; +use std::io; +use std::io::Write; +#[cfg(not(windows))] +use std::os::unix::fs::PermissionsExt; +use std::path::Path; +use std::path::PathBuf; +use std::sync::Arc; + +use deno_cache_dir::file_fetcher::CacheSetting; +use deno_core::anyhow::bail; +use deno_core::anyhow::Context; +use deno_core::error::generic_error; +use deno_core::error::AnyError; +use deno_core::resolve_url_or_path; +use deno_core::url::Url; +use deno_semver::npm::NpmPackageReqReference; +use log::Level; +use once_cell::sync::Lazy; +use regex::Regex; +use regex::RegexBuilder; use crate::args::resolve_no_prompt; use crate::args::AddFlags; @@ -19,30 +43,6 @@ use crate::jsr::JsrFetchResolver; use crate::npm::NpmFetchResolver; use crate::util::fs::canonicalize_path_maybe_not_exists; -use deno_cache_dir::file_fetcher::CacheSetting; -use deno_core::anyhow::bail; -use deno_core::anyhow::Context; -use deno_core::error::generic_error; -use deno_core::error::AnyError; -use deno_core::resolve_url_or_path; -use deno_core::url::Url; -use deno_semver::npm::NpmPackageReqReference; -use log::Level; -use once_cell::sync::Lazy; -use regex::Regex; -use regex::RegexBuilder; -use std::env; -use std::fs; -use std::fs::File; -use std::io; -use std::io::Write; -use std::path::Path; -use std::path::PathBuf; - -#[cfg(not(windows))] -use std::os::unix::fs::PermissionsExt; -use std::sync::Arc; - static EXEC_NAME_RE: Lazy = Lazy::new(|| { RegexBuilder::new(r"^[a-z0-9][\w-]*$") .case_insensitive(true) @@ -364,6 +364,7 @@ async fn install_global( let deps_file_fetcher = CliFileFetcher::new( deps_http_cache.clone(), http_client.clone(), + factory.sys(), Default::default(), None, true, @@ -658,16 +659,17 @@ fn is_in_path(dir: &Path) -> bool { #[cfg(test)] mod tests { - use super::*; + use std::process::Command; + use test_util::testdata_path; + use test_util::TempDir; + + use super::*; use crate::args::ConfigFlag; use crate::args::PermissionFlags; use crate::args::UninstallFlagsGlobal; use crate::args::UnstableConfig; use crate::util::fs::canonicalize_path; - use std::process::Command; - use test_util::testdata_path; - use test_util::TempDir; #[tokio::test] async fn install_infer_name_from_url() { diff --git a/cli/tools/jupyter/install.rs b/cli/tools/jupyter/install.rs index aeff89ccf4..d76c59343b 100644 --- a/cli/tools/jupyter/install.rs +++ b/cli/tools/jupyter/install.rs @@ -1,12 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use deno_core::error::AnyError; -use deno_core::serde_json; -use deno_core::serde_json::json; use std::env::current_exe; use std::io::Write; use std::path::Path; +use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::json; use jupyter_runtime::dirs::user_data_dir; const DENO_ICON_32: &[u8] = include_bytes!("./resources/deno-logo-32x32.png"); diff --git a/cli/tools/jupyter/mod.rs b/cli/tools/jupyter/mod.rs index 732f95c49f..bb39528f3e 100644 --- a/cli/tools/jupyter/mod.rs +++ b/cli/tools/jupyter/mod.rs @@ -1,18 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::Arc; -use crate::args::Flags; -use crate::args::JupyterFlags; -use crate::cdp; -use crate::lsp::ReplCompletionItem; -use crate::ops; -use crate::tools::repl; -use crate::tools::test::create_single_test_event_channel; -use crate::tools::test::reporters::PrettyTestReporter; -use crate::tools::test::TestEventWorkerSender; -use crate::tools::test::TestFailureFormatOptions; -use crate::CliFactory; use deno_core::anyhow::bail; use deno_core::anyhow::Context; use deno_core::error::generic_error; @@ -34,6 +23,18 @@ use tokio::sync::mpsc; use tokio::sync::mpsc::UnboundedSender; use tokio::sync::oneshot; +use crate::args::Flags; +use crate::args::JupyterFlags; +use crate::cdp; +use crate::lsp::ReplCompletionItem; +use crate::ops; +use crate::tools::repl; +use crate::tools::test::create_single_test_event_channel; +use crate::tools::test::reporters::PrettyTestReporter; +use crate::tools::test::TestEventWorkerSender; +use crate::tools::test::TestFailureFormatOptions; +use crate::CliFactory; + mod install; pub mod server; diff --git a/cli/tools/jupyter/server.rs b/cli/tools/jupyter/server.rs index 5680ed4c13..bc045d9d9b 100644 --- a/cli/tools/jupyter/server.rs +++ b/cli/tools/jupyter/server.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This file is forked/ported from // Copyright 2020 The Evcxr Authors. MIT license. @@ -11,8 +11,6 @@ use std::collections::HashMap; use std::rc::Rc; use std::sync::Arc; -use crate::cdp; -use crate::tools::repl; use deno_core::anyhow::bail; use deno_core::error::AnyError; use deno_core::futures; @@ -20,12 +18,9 @@ use deno_core::parking_lot::Mutex; use deno_core::serde_json; use deno_core::CancelFuture; use deno_core::CancelHandle; -use jupyter_runtime::ExecutionCount; -use tokio::sync::mpsc; -use tokio::sync::oneshot; - use jupyter_runtime::messaging; use jupyter_runtime::ConnectionInfo; +use jupyter_runtime::ExecutionCount; use jupyter_runtime::JupyterMessage; use jupyter_runtime::JupyterMessageContent; use jupyter_runtime::KernelControlConnection; @@ -34,9 +29,13 @@ use jupyter_runtime::KernelShellConnection; use jupyter_runtime::ReplyError; use jupyter_runtime::ReplyStatus; use jupyter_runtime::StreamContent; +use tokio::sync::mpsc; +use tokio::sync::oneshot; use uuid::Uuid; use super::JupyterReplProxy; +use crate::cdp; +use crate::tools::repl; pub struct JupyterServer { execution_count: ExecutionCount, diff --git a/cli/tools/lint/ast_buffer/buffer.rs b/cli/tools/lint/ast_buffer/buffer.rs index d162ee3de1..517c3b14dc 100644 --- a/cli/tools/lint/ast_buffer/buffer.rs +++ b/cli/tools/lint/ast_buffer/buffer.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::fmt::Display; @@ -121,6 +121,10 @@ impl StringTable { #[derive(Debug, Clone, Copy, PartialEq)] pub struct NodeRef(pub usize); +/// Represents an offset to a node whose schema hasn't been committed yet +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct PendingNodeRef(pub NodeRef); + #[derive(Debug)] pub struct BoolPos(pub usize); #[derive(Debug)] @@ -152,13 +156,8 @@ where K: Into + Display, P: Into + Display, { - fn header( - &mut self, - kind: K, - parent: NodeRef, - span: &Span, - prop_count: usize, - ) -> NodeRef; + fn header(&mut self, kind: K, parent: NodeRef, span: &Span) + -> PendingNodeRef; fn ref_field(&mut self, prop: P) -> FieldPos; fn ref_vec_field(&mut self, prop: P, len: usize) -> FieldArrPos; fn str_field(&mut self, prop: P) -> StrPos; @@ -166,6 +165,7 @@ where fn undefined_field(&mut self, prop: P) -> UndefPos; #[allow(dead_code)] fn null_field(&mut self, prop: P) -> NullPos; + fn commit_schema(&mut self, offset: PendingNodeRef) -> NodeRef; fn write_ref(&mut self, pos: FieldPos, value: NodeRef); fn write_maybe_ref(&mut self, pos: FieldPos, value: Option); @@ -183,6 +183,7 @@ pub struct SerializeCtx { str_table: StringTable, kind_map: Vec, prop_map: Vec, + field_count: u8, } /// This is the internal context used to allocate and fill the buffer. The point @@ -200,8 +201,9 @@ impl SerializeCtx { start_buf: NodeRef(0), buf: vec![], str_table: StringTable::new(), - kind_map: vec![0; kind_size + 1], - prop_map: vec![0; prop_size + 1], + kind_map: vec![0; kind_size], + prop_map: vec![0; prop_size], + field_count: 0, }; let empty_str = ctx.str_table.insert(""); @@ -232,6 +234,8 @@ impl SerializeCtx { where P: Into + Display + Clone, { + self.field_count += 1; + let offset = self.buf.len(); let n: u8 = prop.clone().into(); @@ -268,7 +272,7 @@ impl SerializeCtx { parent: NodeRef, span: &Span, prop_count: usize, - ) -> NodeRef { + ) -> PendingNodeRef { let offset = self.buf.len(); // Node type fits in a u8 @@ -285,7 +289,19 @@ impl SerializeCtx { debug_assert!(prop_count < 10); self.buf.push(prop_count as u8); - NodeRef(offset) + PendingNodeRef(NodeRef(offset)) + } + + pub fn commit_schema(&mut self, node_ref: PendingNodeRef) -> NodeRef { + let mut offset = node_ref.0 .0; + + // type + parentId + span lo + span hi + offset += 1 + 4 + 4 + 4; + + self.buf[offset] = self.field_count; + self.field_count = 0; + + node_ref.0 } /// Allocate the node header. It's always the same for every node. @@ -299,8 +315,7 @@ impl SerializeCtx { kind: N, parent: NodeRef, span: &Span, - prop_count: usize, - ) -> NodeRef + ) -> PendingNodeRef where N: Into + Display + Clone, { @@ -313,7 +328,9 @@ impl SerializeCtx { } } - self.append_node(n, parent, span, prop_count) + // Prop count will be filled with the actual value when the + // schema is committed. + self.append_node(n, parent, span, 0) } /// Allocate a reference property that will hold the offset of diff --git a/cli/tools/lint/ast_buffer/mod.rs b/cli/tools/lint/ast_buffer/mod.rs index 8838bcc5f2..fc4045fb60 100644 --- a/cli/tools/lint/ast_buffer/mod.rs +++ b/cli/tools/lint/ast_buffer/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_ast::ParsedSource; use swc::serialize_swc_to_buffer; diff --git a/cli/tools/lint/ast_buffer/swc.rs b/cli/tools/lint/ast_buffer/swc.rs index 785a38a7d8..7652756c9b 100644 --- a/cli/tools/lint/ast_buffer/swc.rs +++ b/cli/tools/lint/ast_buffer/swc.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_ast::swc::ast::AssignTarget; use deno_ast::swc::ast::AssignTargetPat; @@ -93,12 +93,13 @@ pub fn serialize_swc_to_buffer(parsed_source: &ParsedSource) -> Vec { let program = &parsed_source.program(); - let pos = ctx.header(AstNode::Program, NodeRef(0), &program.span(), 2); + let raw = ctx.header(AstNode::Program, NodeRef(0), &program.span()); let source_type_pos = ctx.str_field(AstProp::SourceType); match program.as_ref() { Program::Module(module) => { let body_pos = ctx.ref_vec_field(AstProp::Body, module.body.len()); + let pos = ctx.commit_schema(raw); let children = module .body @@ -116,6 +117,8 @@ pub fn serialize_swc_to_buffer(parsed_source: &ParsedSource) -> Vec { } Program::Script(script) => { let body_pos = ctx.ref_vec_field(AstProp::Body, script.body.len()); + let pos = ctx.commit_schema(raw); + let children = script .body .iter() @@ -137,12 +140,13 @@ fn serialize_module_decl( ) -> NodeRef { match module_decl { ModuleDecl::Import(node) => { - ctx.header(AstNode::ImportExpression, parent, &node.span, 0) + let raw = ctx.header(AstNode::ImportExpression, parent, &node.span); + ctx.commit_schema(raw) } ModuleDecl::ExportDecl(node) => { - let pos = - ctx.header(AstNode::ExportNamedDeclaration, parent, &node.span, 1); + let raw = ctx.header(AstNode::ExportNamedDeclaration, parent, &node.span); let decl_pos = ctx.ref_field(AstProp::Declarations); + let pos = ctx.commit_schema(raw); let decl = serialize_decl(ctx, &node.decl, pos); @@ -151,11 +155,11 @@ fn serialize_module_decl( pos } ModuleDecl::ExportNamed(node) => { - let id = - ctx.header(AstNode::ExportNamedDeclaration, parent, &node.span, 2); + let raw = ctx.header(AstNode::ExportNamedDeclaration, parent, &node.span); let src_pos = ctx.ref_field(AstProp::Source); let spec_pos = ctx.ref_vec_field(AstProp::Specifiers, node.specifiers.len()); + let id = ctx.commit_schema(raw); // FIXME: Flags // let mut flags = FlagValue::new(); @@ -172,10 +176,10 @@ fn serialize_module_decl( .map(|spec| { match spec { ExportSpecifier::Named(child) => { - let spec_pos = - ctx.header(AstNode::ExportSpecifier, id, &child.span, 2); + let raw = ctx.header(AstNode::ExportSpecifier, id, &child.span); let local_pos = ctx.ref_field(AstProp::Local); let exp_pos = ctx.ref_field(AstProp::Exported); + let spec_pos = ctx.commit_schema(raw); // let mut flags = FlagValue::new(); // flags.set(Flag::ExportType); @@ -208,22 +212,30 @@ fn serialize_module_decl( id } ModuleDecl::ExportDefaultDecl(node) => { - ctx.header(AstNode::ExportDefaultDeclaration, parent, &node.span, 0) + let raw = + ctx.header(AstNode::ExportDefaultDeclaration, parent, &node.span); + ctx.commit_schema(raw) } ModuleDecl::ExportDefaultExpr(node) => { - ctx.header(AstNode::ExportDefaultDeclaration, parent, &node.span, 0) + let raw = + ctx.header(AstNode::ExportDefaultDeclaration, parent, &node.span); + ctx.commit_schema(raw) } ModuleDecl::ExportAll(node) => { - ctx.header(AstNode::ExportAllDeclaration, parent, &node.span, 0) + let raw = ctx.header(AstNode::ExportAllDeclaration, parent, &node.span); + ctx.commit_schema(raw) } ModuleDecl::TsImportEquals(node) => { - ctx.header(AstNode::TsImportEquals, parent, &node.span, 0) + let raw = ctx.header(AstNode::TsImportEquals, parent, &node.span); + ctx.commit_schema(raw) } ModuleDecl::TsExportAssignment(node) => { - ctx.header(AstNode::TsExportAssignment, parent, &node.span, 0) + let raw = ctx.header(AstNode::TsExportAssignment, parent, &node.span); + ctx.commit_schema(raw) } ModuleDecl::TsNamespaceExport(node) => { - ctx.header(AstNode::TsNamespaceExport, parent, &node.span, 0) + let raw = ctx.header(AstNode::TsNamespaceExport, parent, &node.span); + ctx.commit_schema(raw) } } } @@ -235,8 +247,9 @@ fn serialize_stmt( ) -> NodeRef { match stmt { Stmt::Block(node) => { - let pos = ctx.header(AstNode::BlockStatement, parent, &node.span, 1); + let raw = ctx.header(AstNode::BlockStatement, parent, &node.span); let body_pos = ctx.ref_vec_field(AstProp::Body, node.stmts.len()); + let pos = ctx.commit_schema(raw); let children = node .stmts @@ -250,12 +263,14 @@ fn serialize_stmt( } Stmt::Empty(_) => NodeRef(0), Stmt::Debugger(node) => { - ctx.header(AstNode::DebuggerStatement, parent, &node.span, 0) + let raw = ctx.header(AstNode::DebuggerStatement, parent, &node.span); + ctx.commit_schema(raw) } Stmt::With(_) => todo!(), Stmt::Return(node) => { - let pos = ctx.header(AstNode::ReturnStatement, parent, &node.span, 1); + let raw = ctx.header(AstNode::ReturnStatement, parent, &node.span); let arg_pos = ctx.ref_field(AstProp::Argument); + let pos = ctx.commit_schema(raw); let arg = node.arg.as_ref().map(|arg| serialize_expr(ctx, arg, pos)); ctx.write_maybe_ref(arg_pos, arg); @@ -263,9 +278,10 @@ fn serialize_stmt( pos } Stmt::Labeled(node) => { - let pos = ctx.header(AstNode::LabeledStatement, parent, &node.span, 2); + let raw = ctx.header(AstNode::LabeledStatement, parent, &node.span); let label_pos = ctx.ref_field(AstProp::Label); let body_pos = ctx.ref_field(AstProp::Body); + let pos = ctx.commit_schema(raw); let ident = serialize_ident(ctx, &node.label, pos); let stmt = serialize_stmt(ctx, &node.body, pos); @@ -276,8 +292,9 @@ fn serialize_stmt( pos } Stmt::Break(node) => { - let pos = ctx.header(AstNode::BreakStatement, parent, &node.span, 1); + let raw = ctx.header(AstNode::BreakStatement, parent, &node.span); let label_pos = ctx.ref_field(AstProp::Label); + let pos = ctx.commit_schema(raw); let arg = node .label @@ -289,8 +306,9 @@ fn serialize_stmt( pos } Stmt::Continue(node) => { - let pos = ctx.header(AstNode::ContinueStatement, parent, &node.span, 1); + let raw = ctx.header(AstNode::ContinueStatement, parent, &node.span); let label_pos = ctx.ref_field(AstProp::Label); + let pos = ctx.commit_schema(raw); let arg = node .label @@ -302,10 +320,11 @@ fn serialize_stmt( pos } Stmt::If(node) => { - let pos = ctx.header(AstNode::IfStatement, parent, &node.span, 3); + let raw = ctx.header(AstNode::IfStatement, parent, &node.span); let test_pos = ctx.ref_field(AstProp::Test); let cons_pos = ctx.ref_field(AstProp::Consequent); let alt_pos = ctx.ref_field(AstProp::Alternate); + let pos = ctx.commit_schema(raw); let test = serialize_expr(ctx, node.test.as_ref(), pos); let cons = serialize_stmt(ctx, node.cons.as_ref(), pos); @@ -318,20 +337,22 @@ fn serialize_stmt( pos } Stmt::Switch(node) => { - let id = ctx.header(AstNode::SwitchStatement, parent, &node.span, 2); + let raw = ctx.header(AstNode::SwitchStatement, parent, &node.span); let disc_pos = ctx.ref_field(AstProp::Discriminant); let cases_pos = ctx.ref_vec_field(AstProp::Cases, node.cases.len()); + let pos = ctx.commit_schema(raw); - let disc = serialize_expr(ctx, &node.discriminant, id); + let disc = serialize_expr(ctx, &node.discriminant, pos); let cases = node .cases .iter() .map(|case| { - let case_pos = ctx.header(AstNode::SwitchCase, id, &case.span, 2); + let raw = ctx.header(AstNode::SwitchCase, pos, &case.span); let test_pos = ctx.ref_field(AstProp::Test); let cons_pos = ctx.ref_vec_field(AstProp::Consequent, case.cons.len()); + let case_pos = ctx.commit_schema(raw); let test = case .test @@ -354,11 +375,12 @@ fn serialize_stmt( ctx.write_ref(disc_pos, disc); ctx.write_refs(cases_pos, cases); - id + pos } Stmt::Throw(node) => { - let pos = ctx.header(AstNode::ThrowStatement, parent, &node.span, 1); + let raw = ctx.header(AstNode::ThrowStatement, parent, &node.span); let arg_pos = ctx.ref_field(AstProp::Argument); + let pos = ctx.commit_schema(raw); let arg = serialize_expr(ctx, &node.arg, pos); ctx.write_ref(arg_pos, arg); @@ -366,17 +388,19 @@ fn serialize_stmt( pos } Stmt::Try(node) => { - let pos = ctx.header(AstNode::TryStatement, parent, &node.span, 3); + let raw = ctx.header(AstNode::TryStatement, parent, &node.span); let block_pos = ctx.ref_field(AstProp::Block); let handler_pos = ctx.ref_field(AstProp::Handler); let finalizer_pos = ctx.ref_field(AstProp::Finalizer); + let pos = ctx.commit_schema(raw); let block = serialize_stmt(ctx, &Stmt::Block(node.block.clone()), pos); let handler = node.handler.as_ref().map(|catch| { - let clause_pos = ctx.header(AstNode::CatchClause, pos, &catch.span, 2); + let raw = ctx.header(AstNode::CatchClause, pos, &catch.span); let param_pos = ctx.ref_field(AstProp::Param); let body_pos = ctx.ref_field(AstProp::Body); + let clause_pos = ctx.commit_schema(raw); let param = catch .param @@ -403,9 +427,10 @@ fn serialize_stmt( pos } Stmt::While(node) => { - let pos = ctx.header(AstNode::WhileStatement, parent, &node.span, 2); + let raw = ctx.header(AstNode::WhileStatement, parent, &node.span); let test_pos = ctx.ref_field(AstProp::Test); let body_pos = ctx.ref_field(AstProp::Body); + let pos = ctx.commit_schema(raw); let test = serialize_expr(ctx, node.test.as_ref(), pos); let stmt = serialize_stmt(ctx, node.body.as_ref(), pos); @@ -416,9 +441,10 @@ fn serialize_stmt( pos } Stmt::DoWhile(node) => { - let pos = ctx.header(AstNode::DoWhileStatement, parent, &node.span, 2); + let raw = ctx.header(AstNode::DoWhileStatement, parent, &node.span); let test_pos = ctx.ref_field(AstProp::Test); let body_pos = ctx.ref_field(AstProp::Body); + let pos = ctx.commit_schema(raw); let expr = serialize_expr(ctx, node.test.as_ref(), pos); let stmt = serialize_stmt(ctx, node.body.as_ref(), pos); @@ -429,11 +455,12 @@ fn serialize_stmt( pos } Stmt::For(node) => { - let pos = ctx.header(AstNode::ForStatement, parent, &node.span, 4); + let raw = ctx.header(AstNode::ForStatement, parent, &node.span); let init_pos = ctx.ref_field(AstProp::Init); let test_pos = ctx.ref_field(AstProp::Test); let update_pos = ctx.ref_field(AstProp::Update); let body_pos = ctx.ref_field(AstProp::Body); + let pos = ctx.commit_schema(raw); let init = node.init.as_ref().map(|init| match init { VarDeclOrExpr::VarDecl(var_decl) => { @@ -460,10 +487,11 @@ fn serialize_stmt( pos } Stmt::ForIn(node) => { - let pos = ctx.header(AstNode::ForInStatement, parent, &node.span, 3); + let raw = ctx.header(AstNode::ForInStatement, parent, &node.span); let left_pos = ctx.ref_field(AstProp::Left); let right_pos = ctx.ref_field(AstProp::Right); let body_pos = ctx.ref_field(AstProp::Body); + let pos = ctx.commit_schema(raw); let left = serialize_for_head(ctx, &node.left, pos); let right = serialize_expr(ctx, node.right.as_ref(), pos); @@ -476,11 +504,12 @@ fn serialize_stmt( pos } Stmt::ForOf(node) => { - let pos = ctx.header(AstNode::ForOfStatement, parent, &node.span, 4); + let raw = ctx.header(AstNode::ForOfStatement, parent, &node.span); let await_pos = ctx.bool_field(AstProp::Await); let left_pos = ctx.ref_field(AstProp::Left); let right_pos = ctx.ref_field(AstProp::Right); let body_pos = ctx.ref_field(AstProp::Body); + let pos = ctx.commit_schema(raw); let left = serialize_for_head(ctx, &node.left, pos); let right = serialize_expr(ctx, node.right.as_ref(), pos); @@ -495,8 +524,9 @@ fn serialize_stmt( } Stmt::Decl(node) => serialize_decl(ctx, node, parent), Stmt::Expr(node) => { - let pos = ctx.header(AstNode::ExpressionStatement, parent, &node.span, 1); + let raw = ctx.header(AstNode::ExpressionStatement, parent, &node.span); let expr_pos = ctx.ref_field(AstProp::Expression); + let pos = ctx.commit_schema(raw); let expr = serialize_expr(ctx, node.expr.as_ref(), pos); ctx.write_ref(expr_pos, expr); @@ -513,11 +543,13 @@ fn serialize_expr( ) -> NodeRef { match expr { Expr::This(node) => { - ctx.header(AstNode::ThisExpression, parent, &node.span, 0) + let raw = ctx.header(AstNode::ThisExpression, parent, &node.span); + ctx.commit_schema(raw) } Expr::Array(node) => { - let pos = ctx.header(AstNode::ArrayExpression, parent, &node.span, 1); + let raw = ctx.header(AstNode::ArrayExpression, parent, &node.span); let elems_pos = ctx.ref_vec_field(AstProp::Elements, node.elems.len()); + let pos = ctx.commit_schema(raw); let elems = node .elems @@ -534,8 +566,9 @@ fn serialize_expr( pos } Expr::Object(node) => { - let pos = ctx.header(AstNode::ObjectExpression, parent, &node.span, 1); + let raw = ctx.header(AstNode::ObjectExpression, parent, &node.span); let props_pos = ctx.ref_vec_field(AstProp::Properties, node.props.len()); + let pos = ctx.commit_schema(raw); let prop_ids = node .props @@ -550,8 +583,7 @@ fn serialize_expr( Expr::Fn(node) => { let fn_obj = node.function.as_ref(); - let pos = - ctx.header(AstNode::FunctionExpression, parent, &fn_obj.span, 7); + let raw = ctx.header(AstNode::FunctionExpression, parent, &fn_obj.span); let async_pos = ctx.bool_field(AstProp::Async); let gen_pos = ctx.bool_field(AstProp::Generator); @@ -560,6 +592,7 @@ fn serialize_expr( let params_pos = ctx.ref_vec_field(AstProp::Params, fn_obj.params.len()); let return_pos = ctx.ref_field(AstProp::ReturnType); let body_pos = ctx.ref_field(AstProp::Body); + let pos = ctx.commit_schema(raw); let ident = node .ident @@ -593,9 +626,10 @@ fn serialize_expr( pos } Expr::Unary(node) => { - let pos = ctx.header(AstNode::UnaryExpression, parent, &node.span, 2); + let raw = ctx.header(AstNode::UnaryExpression, parent, &node.span); let flag_pos = ctx.str_field(AstProp::Operator); let arg_pos = ctx.ref_field(AstProp::Argument); + let pos = ctx.commit_schema(raw); let arg = serialize_expr(ctx, &node.arg, pos); @@ -616,10 +650,11 @@ fn serialize_expr( pos } Expr::Update(node) => { - let pos = ctx.header(AstNode::UpdateExpression, parent, &node.span, 3); + let raw = ctx.header(AstNode::UpdateExpression, parent, &node.span); let prefix_pos = ctx.bool_field(AstProp::Prefix); let arg_pos = ctx.ref_field(AstProp::Argument); let op_ops = ctx.str_field(AstProp::Operator); + let pos = ctx.commit_schema(raw); let arg = serialize_expr(ctx, node.arg.as_ref(), pos); @@ -664,10 +699,11 @@ fn serialize_expr( BinaryOp::Exp => (AstNode::BinaryExpression, "**"), }; - let pos = ctx.header(node_type, parent, &node.span, 3); + let raw = ctx.header(node_type, parent, &node.span); let op_pos = ctx.str_field(AstProp::Operator); let left_pos = ctx.ref_field(AstProp::Left); let right_pos = ctx.ref_field(AstProp::Right); + let pos = ctx.commit_schema(raw); let left_id = serialize_expr(ctx, node.left.as_ref(), pos); let right_id = serialize_expr(ctx, node.right.as_ref(), pos); @@ -679,11 +715,11 @@ fn serialize_expr( pos } Expr::Assign(node) => { - let pos = - ctx.header(AstNode::AssignmentExpression, parent, &node.span, 3); + let raw = ctx.header(AstNode::AssignmentExpression, parent, &node.span); let op_pos = ctx.str_field(AstProp::Operator); let left_pos = ctx.ref_field(AstProp::Left); let right_pos = ctx.ref_field(AstProp::Right); + let pos = ctx.commit_schema(raw); let left = match &node.left { AssignTarget::Simple(simple_assign_target) => { @@ -762,12 +798,14 @@ fn serialize_expr( } Expr::Member(node) => serialize_member_expr(ctx, node, parent, false), Expr::SuperProp(node) => { - let pos = ctx.header(AstNode::MemberExpression, parent, &node.span, 3); + let raw = ctx.header(AstNode::MemberExpression, parent, &node.span); let computed_pos = ctx.bool_field(AstProp::Computed); let obj_pos = ctx.ref_field(AstProp::Object); let prop_pos = ctx.ref_field(AstProp::Property); + let pos = ctx.commit_schema(raw); - let obj = ctx.header(AstNode::Super, pos, &node.obj.span, 0); + let raw = ctx.header(AstNode::Super, pos, &node.obj.span); + let obj = ctx.commit_schema(raw); let mut computed = false; let prop = match &node.prop { @@ -787,11 +825,11 @@ fn serialize_expr( pos } Expr::Cond(node) => { - let pos = - ctx.header(AstNode::ConditionalExpression, parent, &node.span, 3); + let raw = ctx.header(AstNode::ConditionalExpression, parent, &node.span); let test_pos = ctx.ref_field(AstProp::Test); let cons_pos = ctx.ref_field(AstProp::Consequent); let alt_pos = ctx.ref_field(AstProp::Alternate); + let pos = ctx.commit_schema(raw); let test = serialize_expr(ctx, node.test.as_ref(), pos); let cons = serialize_expr(ctx, node.cons.as_ref(), pos); @@ -804,15 +842,17 @@ fn serialize_expr( pos } Expr::Call(node) => { - let pos = ctx.header(AstNode::CallExpression, parent, &node.span, 4); + let raw = ctx.header(AstNode::CallExpression, parent, &node.span); let opt_pos = ctx.bool_field(AstProp::Optional); let callee_pos = ctx.ref_field(AstProp::Callee); let type_args_pos = ctx.ref_field(AstProp::TypeArguments); let args_pos = ctx.ref_vec_field(AstProp::Arguments, node.args.len()); + let pos = ctx.commit_schema(raw); let callee = match &node.callee { Callee::Super(super_node) => { - ctx.header(AstNode::Super, pos, &super_node.span, 0) + let raw = ctx.header(AstNode::Super, pos, &super_node.span); + ctx.commit_schema(raw) } Callee::Import(_) => todo!(), Callee::Expr(expr) => serialize_expr(ctx, expr, pos), @@ -836,13 +876,14 @@ fn serialize_expr( pos } Expr::New(node) => { - let pos = ctx.header(AstNode::NewExpression, parent, &node.span, 3); + let raw = ctx.header(AstNode::NewExpression, parent, &node.span); let callee_pos = ctx.ref_field(AstProp::Callee); let type_args_pos = ctx.ref_field(AstProp::TypeArguments); let args_pos = ctx.ref_vec_field( AstProp::Arguments, node.args.as_ref().map_or(0, |v| v.len()), ); + let pos = ctx.commit_schema(raw); let callee = serialize_expr(ctx, node.callee.as_ref(), pos); @@ -864,8 +905,9 @@ fn serialize_expr( pos } Expr::Seq(node) => { - let pos = ctx.header(AstNode::SequenceExpression, parent, &node.span, 1); + let raw = ctx.header(AstNode::SequenceExpression, parent, &node.span); let exprs_pos = ctx.ref_vec_field(AstProp::Expressions, node.exprs.len()); + let pos = ctx.commit_schema(raw); let children = node .exprs @@ -880,19 +922,20 @@ fn serialize_expr( Expr::Ident(node) => serialize_ident(ctx, node, parent), Expr::Lit(node) => serialize_lit(ctx, node, parent), Expr::Tpl(node) => { - let pos = ctx.header(AstNode::TemplateLiteral, parent, &node.span, 2); + let raw = ctx.header(AstNode::TemplateLiteral, parent, &node.span); let quasis_pos = ctx.ref_vec_field(AstProp::Quasis, node.quasis.len()); let exprs_pos = ctx.ref_vec_field(AstProp::Expressions, node.exprs.len()); + let pos = ctx.commit_schema(raw); let quasis = node .quasis .iter() .map(|quasi| { - let tpl_pos = - ctx.header(AstNode::TemplateElement, pos, &quasi.span, 3); + let raw = ctx.header(AstNode::TemplateElement, pos, &quasi.span); let tail_pos = ctx.bool_field(AstProp::Tail); let raw_pos = ctx.str_field(AstProp::Raw); let cooked_pos = ctx.str_field(AstProp::Cooked); + let tpl_pos = ctx.commit_schema(raw); ctx.write_bool(tail_pos, quasi.tail); ctx.write_str(raw_pos, &quasi.raw); @@ -920,11 +963,12 @@ fn serialize_expr( pos } Expr::TaggedTpl(node) => { - let pos = - ctx.header(AstNode::TaggedTemplateExpression, parent, &node.span, 3); + let raw = + ctx.header(AstNode::TaggedTemplateExpression, parent, &node.span); let tag_pos = ctx.ref_field(AstProp::Tag); let type_arg_pos = ctx.ref_field(AstProp::TypeArguments); let quasi_pos = ctx.ref_field(AstProp::Quasi); + let pos = ctx.commit_schema(raw); let tag = serialize_expr(ctx, &node.tag, pos); @@ -941,14 +985,15 @@ fn serialize_expr( pos } Expr::Arrow(node) => { - let pos = - ctx.header(AstNode::ArrowFunctionExpression, parent, &node.span, 6); + let raw = + ctx.header(AstNode::ArrowFunctionExpression, parent, &node.span); let async_pos = ctx.bool_field(AstProp::Async); let gen_pos = ctx.bool_field(AstProp::Generator); let type_param_pos = ctx.ref_field(AstProp::TypeParameters); let params_pos = ctx.ref_vec_field(AstProp::Params, node.params.len()); let body_pos = ctx.ref_field(AstProp::Body); let return_type_pos = ctx.ref_field(AstProp::ReturnType); + let pos = ctx.commit_schema(raw); let type_param = maybe_serialize_ts_type_param(ctx, &node.type_params, pos); @@ -980,12 +1025,14 @@ fn serialize_expr( } Expr::Class(node) => { // FIXME - ctx.header(AstNode::ClassExpression, parent, &node.class.span, 0) + let raw = ctx.header(AstNode::ClassExpression, parent, &node.class.span); + ctx.commit_schema(raw) } Expr::Yield(node) => { - let pos = ctx.header(AstNode::YieldExpression, parent, &node.span, 2); + let raw = ctx.header(AstNode::YieldExpression, parent, &node.span); let delegate_pos = ctx.bool_field(AstProp::Delegate); let arg_pos = ctx.ref_field(AstProp::Argument); + let pos = ctx.commit_schema(raw); let arg = node .arg @@ -998,11 +1045,13 @@ fn serialize_expr( pos } Expr::MetaProp(node) => { - ctx.header(AstNode::MetaProp, parent, &node.span, 0) + let raw = ctx.header(AstNode::MetaProp, parent, &node.span); + ctx.commit_schema(raw) } Expr::Await(node) => { - let pos = ctx.header(AstNode::AwaitExpression, parent, &node.span, 1); + let raw = ctx.header(AstNode::AwaitExpression, parent, &node.span); let arg_pos = ctx.ref_field(AstProp::Argument); + let pos = ctx.commit_schema(raw); let arg = serialize_expr(ctx, node.arg.as_ref(), pos); @@ -1023,9 +1072,10 @@ fn serialize_expr( Expr::JSXElement(node) => serialize_jsx_element(ctx, node, parent), Expr::JSXFragment(node) => serialize_jsx_fragment(ctx, node, parent), Expr::TsTypeAssertion(node) => { - let pos = ctx.header(AstNode::TSTypeAssertion, parent, &node.span, 2); + let raw = ctx.header(AstNode::TSTypeAssertion, parent, &node.span); let expr_pos = ctx.ref_field(AstProp::Expression); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); + let pos = ctx.commit_schema(raw); let expr = serialize_expr(ctx, &node.expr, parent); let type_ann = serialize_ts_type(ctx, &node.type_ann, pos); @@ -1036,8 +1086,10 @@ fn serialize_expr( pos } Expr::TsConstAssertion(node) => { - let pos = ctx.header(AstNode::TsConstAssertion, parent, &node.span, 1); + let raw = ctx.header(AstNode::TsConstAssertion, parent, &node.span); let arg_pos = ctx.ref_field(AstProp::Argument); + let pos = ctx.commit_schema(raw); + let arg = serialize_expr(ctx, node.expr.as_ref(), pos); // FIXME @@ -1046,8 +1098,9 @@ fn serialize_expr( pos } Expr::TsNonNull(node) => { - let pos = ctx.header(AstNode::TSNonNullExpression, parent, &node.span, 1); + let raw = ctx.header(AstNode::TSNonNullExpression, parent, &node.span); let expr_pos = ctx.ref_field(AstProp::Expression); + let pos = ctx.commit_schema(raw); let expr_id = serialize_expr(ctx, node.expr.as_ref(), pos); @@ -1056,22 +1109,24 @@ fn serialize_expr( pos } Expr::TsAs(node) => { - let id = ctx.header(AstNode::TSAsExpression, parent, &node.span, 2); + let raw = ctx.header(AstNode::TSAsExpression, parent, &node.span); let expr_pos = ctx.ref_field(AstProp::Expression); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); + let pos = ctx.commit_schema(raw); - let expr = serialize_expr(ctx, node.expr.as_ref(), id); - let type_ann = serialize_ts_type(ctx, node.type_ann.as_ref(), id); + let expr = serialize_expr(ctx, node.expr.as_ref(), pos); + let type_ann = serialize_ts_type(ctx, node.type_ann.as_ref(), pos); ctx.write_ref(expr_pos, expr); ctx.write_ref(type_ann_pos, type_ann); - id + pos } Expr::TsInstantiation(node) => { - let pos = ctx.header(AstNode::TsInstantiation, parent, &node.span, 1); + let raw = ctx.header(AstNode::TsInstantiation, parent, &node.span); let expr_pos = ctx.ref_field(AstProp::Expression); let type_args_pos = ctx.ref_field(AstProp::TypeArguments); + let pos = ctx.commit_schema(raw); let expr = serialize_expr(ctx, node.expr.as_ref(), pos); @@ -1083,10 +1138,10 @@ fn serialize_expr( pos } Expr::TsSatisfies(node) => { - let pos = - ctx.header(AstNode::TSSatisfiesExpression, parent, &node.span, 2); + let raw = ctx.header(AstNode::TSSatisfiesExpression, parent, &node.span); let expr_pos = ctx.ref_field(AstProp::Expression); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); + let pos = ctx.commit_schema(raw); let epxr = serialize_expr(ctx, node.expr.as_ref(), pos); let type_ann = serialize_ts_type(ctx, node.type_ann.as_ref(), pos); @@ -1098,21 +1153,22 @@ fn serialize_expr( } Expr::PrivateName(node) => serialize_private_name(ctx, node, parent), Expr::OptChain(node) => { - let pos = ctx.header(AstNode::ChainExpression, parent, &node.span, 1); + let raw = ctx.header(AstNode::ChainExpression, parent, &node.span); let arg_pos = ctx.ref_field(AstProp::Argument); + let pos = ctx.commit_schema(raw); let arg = match node.base.as_ref() { OptChainBase::Member(member_expr) => { serialize_member_expr(ctx, member_expr, pos, true) } OptChainBase::Call(opt_call) => { - let call_pos = - ctx.header(AstNode::CallExpression, pos, &opt_call.span, 4); + let raw = ctx.header(AstNode::CallExpression, pos, &opt_call.span); let opt_pos = ctx.bool_field(AstProp::Optional); let callee_pos = ctx.ref_field(AstProp::Callee); let type_args_pos = ctx.ref_field(AstProp::TypeArguments); let args_pos = ctx.ref_vec_field(AstProp::Arguments, opt_call.args.len()); + let call_pos = ctx.commit_schema(raw); let callee = serialize_expr(ctx, &opt_call.callee, pos); @@ -1158,7 +1214,7 @@ fn serialize_prop_or_spread( parent, ), PropOrSpread::Prop(prop) => { - let pos = ctx.header(AstNode::Property, parent, &prop.span(), 6); + let raw = ctx.header(AstNode::Property, parent, &prop.span()); let shorthand_pos = ctx.bool_field(AstProp::Shorthand); let computed_pos = ctx.bool_field(AstProp::Computed); @@ -1166,6 +1222,7 @@ fn serialize_prop_or_spread( let kind_pos = ctx.str_field(AstProp::Kind); let key_pos = ctx.ref_field(AstProp::Key); let value_pos = ctx.ref_field(AstProp::Value); + let pos = ctx.commit_schema(raw); let mut shorthand = false; let mut computed = false; @@ -1191,18 +1248,20 @@ fn serialize_prop_or_spread( (key, value) } Prop::Assign(assign_prop) => { - let child_id = - ctx.header(AstNode::AssignmentPattern, pos, &assign_prop.span, 2); + let raw = + ctx.header(AstNode::AssignmentPattern, pos, &assign_prop.span); let left_pos = ctx.ref_field(AstProp::Left); let right_pos = ctx.ref_field(AstProp::Right); + let child_pos = ctx.commit_schema(raw); - let left = serialize_ident(ctx, &assign_prop.key, child_id); - let right = serialize_expr(ctx, assign_prop.value.as_ref(), child_id); + let left = serialize_ident(ctx, &assign_prop.key, child_pos); + let right = + serialize_expr(ctx, assign_prop.value.as_ref(), child_pos); ctx.write_ref(left_pos, left); ctx.write_ref(right_pos, right); - (left, child_id) + (left, child_pos) } Prop::Getter(getter_prop) => { kind = "get"; @@ -1294,11 +1353,12 @@ fn serialize_member_expr( parent: NodeRef, optional: bool, ) -> NodeRef { - let pos = ctx.header(AstNode::MemberExpression, parent, &node.span, 4); + let raw = ctx.header(AstNode::MemberExpression, parent, &node.span); let opt_pos = ctx.bool_field(AstProp::Optional); let computed_pos = ctx.bool_field(AstProp::Computed); let obj_pos = ctx.ref_field(AstProp::Object); let prop_pos = ctx.ref_field(AstProp::Property); + let pos = ctx.commit_schema(raw); let obj = serialize_expr(ctx, node.obj.as_ref(), pos); @@ -1330,8 +1390,8 @@ fn serialize_class_member( ) -> NodeRef { match member { ClassMember::Constructor(constructor) => { - let member_id = - ctx.header(AstNode::MethodDefinition, parent, &constructor.span, 3); + let raw = + ctx.header(AstNode::MethodDefinition, parent, &constructor.span); let key_pos = ctx.ref_field(AstProp::Key); let body_pos = ctx.ref_field(AstProp::Body); let args_pos = @@ -1341,6 +1401,7 @@ fn serialize_class_member( } else { NodePos::Undef(ctx.undefined_field(AstProp::Accessibility)) }; + let member_id = ctx.commit_schema(raw); // FIXME flags @@ -1377,8 +1438,9 @@ fn serialize_class_member( member_id } ClassMember::Method(method) => { - let member_id = - ctx.header(AstNode::MethodDefinition, parent, &method.span, 0); + let raw = ctx.header(AstNode::MethodDefinition, parent, &method.span); + + let member_id = ctx.commit_schema(raw); // let mut flags = FlagValue::new(); // flags.set(Flag::ClassMethod); @@ -1439,8 +1501,10 @@ fn serialize_ident( ident: &Ident, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::Identifier, parent, &ident.span, 1); + let raw = ctx.header(AstNode::Identifier, parent, &ident.span); let name_pos = ctx.str_field(AstProp::Name); + let pos = ctx.commit_schema(raw); + ctx.write_str(name_pos, ident.sym.as_str()); pos @@ -1466,8 +1530,7 @@ fn serialize_decl( ) -> NodeRef { match decl { Decl::Class(node) => { - let id = - ctx.header(AstNode::ClassDeclaration, parent, &node.class.span, 8); + let raw = ctx.header(AstNode::ClassDeclaration, parent, &node.class.span); let declare_pos = ctx.bool_field(AstProp::Declare); let abstract_pos = ctx.bool_field(AstProp::Abstract); let id_pos = ctx.ref_field(AstProp::Id); @@ -1477,10 +1540,12 @@ fn serialize_decl( let super_type_pos = ctx.ref_field(AstProp::SuperTypeArguments); let impl_pos = ctx.ref_vec_field(AstProp::Implements, node.class.implements.len()); + let id = ctx.commit_schema(raw); - let body_id = ctx.header(AstNode::ClassBody, id, &node.class.span, 1); + let body_raw = ctx.header(AstNode::ClassBody, id, &node.class.span); let body_body_pos = ctx.ref_vec_field(AstProp::Body, node.class.body.len()); + let body_id = ctx.commit_schema(body_raw); let ident = serialize_ident(ctx, &node.ident, id); let type_params = @@ -1503,11 +1568,12 @@ fn serialize_decl( .implements .iter() .map(|implements| { - let child_pos = - ctx.header(AstNode::TSClassImplements, id, &implements.span, 2); + let raw = + ctx.header(AstNode::TSClassImplements, id, &implements.span); let expr_pos = ctx.ref_field(AstProp::Expression); let type_args_pos = ctx.ref_field(AstProp::TypeArguments); + let child_pos = ctx.commit_schema(raw); let type_args = implements .type_args @@ -1546,12 +1612,8 @@ fn serialize_decl( id } Decl::Fn(node) => { - let pos = ctx.header( - AstNode::FunctionDeclaration, - parent, - &node.function.span, - 8, - ); + let raw = + ctx.header(AstNode::FunctionDeclaration, parent, &node.function.span); let declare_pos = ctx.bool_field(AstProp::Declare); let async_pos = ctx.bool_field(AstProp::Async); let gen_pos = ctx.bool_field(AstProp::Generator); @@ -1561,6 +1623,7 @@ fn serialize_decl( let body_pos = ctx.ref_field(AstProp::Body); let params_pos = ctx.ref_vec_field(AstProp::Params, node.function.params.len()); + let pos = ctx.commit_schema(raw); let ident_id = serialize_ident(ctx, &node.ident, parent); let type_param_id = @@ -1593,20 +1656,21 @@ fn serialize_decl( pos } Decl::Var(node) => { - let id = ctx.header(AstNode::VariableDeclaration, parent, &node.span, 3); + let raw = ctx.header(AstNode::VariableDeclaration, parent, &node.span); let declare_pos = ctx.bool_field(AstProp::Declare); let kind_pos = ctx.str_field(AstProp::Kind); let decls_pos = ctx.ref_vec_field(AstProp::Declarations, node.decls.len()); + let id = ctx.commit_schema(raw); let children = node .decls .iter() .map(|decl| { - let child_id = - ctx.header(AstNode::VariableDeclarator, id, &decl.span, 2); + let raw = ctx.header(AstNode::VariableDeclarator, id, &decl.span); let id_pos = ctx.ref_field(AstProp::Id); let init_pos = ctx.ref_field(AstProp::Init); + let child_id = ctx.commit_schema(raw); // FIXME: Definite? @@ -1641,17 +1705,18 @@ fn serialize_decl( todo!(); } Decl::TsInterface(node) => { - let pos = ctx.header(AstNode::TSInterface, parent, &node.span, 0); + let raw = ctx.header(AstNode::TSInterface, parent, &node.span); let declare_pos = ctx.bool_field(AstProp::Declare); let id_pos = ctx.ref_field(AstProp::Id); let extends_pos = ctx.ref_vec_field(AstProp::Extends, node.extends.len()); let type_param_pos = ctx.ref_field(AstProp::TypeParameters); let body_pos = ctx.ref_field(AstProp::Body); + let pos = ctx.commit_schema(raw); - let body_id = - ctx.header(AstNode::TSInterfaceBody, pos, &node.body.span, 0); + let body_raw = ctx.header(AstNode::TSInterfaceBody, pos, &node.body.span); let body_body_pos = ctx.ref_vec_field(AstProp::Body, node.body.body.len()); + let body_id = ctx.commit_schema(body_raw); let ident_id = serialize_ident(ctx, &node.id, pos); let type_param = @@ -1661,10 +1726,10 @@ fn serialize_decl( .extends .iter() .map(|item| { - let child_pos = - ctx.header(AstNode::TSInterfaceHeritage, pos, &item.span, 1); + let raw = ctx.header(AstNode::TSInterfaceHeritage, pos, &item.span); let type_args_pos = ctx.ref_field(AstProp::TypeArguments); let expr_pos = ctx.ref_field(AstProp::Expression); + let child_pos = ctx.commit_schema(raw); let expr = serialize_expr(ctx, &item.expr, child_pos); let type_args = item.type_args.clone().map(|params| { @@ -1684,16 +1749,16 @@ fn serialize_decl( .iter() .map(|item| match item { TsTypeElement::TsCallSignatureDecl(ts_call) => { - let item_id = ctx.header( + let raw = ctx.header( AstNode::TsCallSignatureDeclaration, pos, &ts_call.span, - 3, ); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); let params_pos = ctx.ref_vec_field(AstProp::Params, ts_call.params.len()); let return_pos = ctx.ref_field(AstProp::ReturnType); + let item_id = ctx.commit_schema(raw); let type_param = maybe_serialize_ts_type_param(ctx, &ts_call.type_params, pos); @@ -1713,8 +1778,7 @@ fn serialize_decl( } TsTypeElement::TsConstructSignatureDecl(_) => todo!(), TsTypeElement::TsPropertySignature(sig) => { - let item_pos = - ctx.header(AstNode::TSPropertySignature, pos, &sig.span, 6); + let raw = ctx.header(AstNode::TSPropertySignature, pos, &sig.span); let computed_pos = ctx.bool_field(AstProp::Computed); let optional_pos = ctx.bool_field(AstProp::Optional); @@ -1723,6 +1787,7 @@ fn serialize_decl( let _static_bos = ctx.bool_field(AstProp::Static); let key_pos = ctx.ref_field(AstProp::Key); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); + let item_pos = ctx.commit_schema(raw); let key = serialize_expr(ctx, &sig.key, item_pos); let type_ann = @@ -1737,8 +1802,7 @@ fn serialize_decl( item_pos } TsTypeElement::TsGetterSignature(sig) => { - let item_pos = - ctx.header(AstNode::TSMethodSignature, pos, &sig.span, 6); + let raw = ctx.header(AstNode::TSMethodSignature, pos, &sig.span); let computed_pos = ctx.bool_field(AstProp::Computed); let optional_pos = ctx.bool_field(AstProp::Optional); let readonly_pos = ctx.bool_field(AstProp::Readonly); @@ -1747,6 +1811,7 @@ fn serialize_decl( let kind_pos = ctx.str_field(AstProp::Kind); let key_pos = ctx.ref_field(AstProp::Key); let return_type_pos = ctx.ref_field(AstProp::ReturnType); + let item_pos = ctx.commit_schema(raw); let key = serialize_expr(ctx, sig.key.as_ref(), item_pos); let return_type = @@ -1762,8 +1827,7 @@ fn serialize_decl( item_pos } TsTypeElement::TsSetterSignature(sig) => { - let item_pos = - ctx.header(AstNode::TSMethodSignature, pos, &sig.span, 6); + let raw = ctx.header(AstNode::TSMethodSignature, pos, &sig.span); let computed_pos = ctx.bool_field(AstProp::Computed); let optional_pos = ctx.bool_field(AstProp::Optional); let readonly_pos = ctx.bool_field(AstProp::Readonly); @@ -1772,6 +1836,7 @@ fn serialize_decl( let kind_pos = ctx.str_field(AstProp::Kind); let key_pos = ctx.ref_field(AstProp::Key); let params_pos = ctx.ref_vec_field(AstProp::Params, 1); + let item_pos = ctx.commit_schema(raw); let key = serialize_expr(ctx, sig.key.as_ref(), item_pos); let params = serialize_ts_fn_param(ctx, &sig.param, item_pos); @@ -1786,8 +1851,7 @@ fn serialize_decl( item_pos } TsTypeElement::TsMethodSignature(sig) => { - let item_pos = - ctx.header(AstNode::TSMethodSignature, pos, &sig.span, 8); + let raw = ctx.header(AstNode::TSMethodSignature, pos, &sig.span); let computed_pos = ctx.bool_field(AstProp::Computed); let optional_pos = ctx.bool_field(AstProp::Optional); let readonly_pos = ctx.bool_field(AstProp::Readonly); @@ -1798,6 +1862,7 @@ fn serialize_decl( let params_pos = ctx.ref_vec_field(AstProp::Params, sig.params.len()); let return_type_pos = ctx.ref_field(AstProp::ReturnType); + let item_pos = ctx.commit_schema(raw); let key = serialize_expr(ctx, sig.key.as_ref(), item_pos); let params = sig @@ -1836,11 +1901,12 @@ fn serialize_decl( pos } Decl::TsTypeAlias(node) => { - let pos = ctx.header(AstNode::TsTypeAlias, parent, &node.span, 4); + let raw = ctx.header(AstNode::TsTypeAlias, parent, &node.span); let declare_pos = ctx.bool_field(AstProp::Declare); let id_pos = ctx.ref_field(AstProp::Id); let type_params_pos = ctx.ref_field(AstProp::TypeParameters); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); + let pos = ctx.commit_schema(raw); let ident = serialize_ident(ctx, &node.id, pos); let type_ann = serialize_ts_type(ctx, &node.type_ann, pos); @@ -1855,14 +1921,16 @@ fn serialize_decl( pos } Decl::TsEnum(node) => { - let pos = ctx.header(AstNode::TSEnumDeclaration, parent, &node.span, 3); + let raw = ctx.header(AstNode::TSEnumDeclaration, parent, &node.span); let declare_pos = ctx.bool_field(AstProp::Declare); let const_pos = ctx.bool_field(AstProp::Const); let id_pos = ctx.ref_field(AstProp::Id); let body_pos = ctx.ref_field(AstProp::Body); + let pos = ctx.commit_schema(raw); - let body = ctx.header(AstNode::TSEnumBody, pos, &node.span, 1); + let body_raw = ctx.header(AstNode::TSEnumBody, pos, &node.span); let members_pos = ctx.ref_vec_field(AstProp::Members, node.members.len()); + let body = ctx.commit_schema(body_raw); let ident_id = serialize_ident(ctx, &node.id, parent); @@ -1870,10 +1938,10 @@ fn serialize_decl( .members .iter() .map(|member| { - let member_id = - ctx.header(AstNode::TSEnumMember, body, &member.span, 2); + let raw = ctx.header(AstNode::TSEnumMember, body, &member.span); let id_pos = ctx.ref_field(AstProp::Id); let init_pos = ctx.ref_field(AstProp::Initializer); + let member_id = ctx.commit_schema(raw); let ident = match &member.id { TsEnumMemberId::Ident(ident) => { @@ -1906,7 +1974,8 @@ fn serialize_decl( pos } Decl::TsModule(ts_module_decl) => { - ctx.header(AstNode::TsModule, parent, &ts_module_decl.span, 0) + let raw = ctx.header(AstNode::TsModule, parent, &ts_module_decl.span); + ctx.commit_schema(raw) } } } @@ -1916,12 +1985,13 @@ fn serialize_ts_index_sig( node: &TsIndexSignature, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::TSMethodSignature, parent, &node.span, 4); + let raw = ctx.header(AstNode::TSMethodSignature, parent, &node.span); let readonly_pos = ctx.bool_field(AstProp::Readonly); // TODO: where is this coming from? let static_pos = ctx.bool_field(AstProp::Static); let params_pos = ctx.ref_vec_field(AstProp::Params, node.params.len()); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); + let pos = ctx.commit_schema(raw); let type_ann = maybe_serialize_ts_type_ann(ctx, &node.type_ann, pos); @@ -1952,8 +2022,9 @@ fn serialize_private_name( node: &PrivateName, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::PrivateIdentifier, parent, &node.span, 1); + let raw = ctx.header(AstNode::PrivateIdentifier, parent, &node.span); let name_pos = ctx.str_field(AstProp::Name); + let pos = ctx.commit_schema(raw); ctx.write_str(name_pos, node.name.as_str()); @@ -1965,17 +2036,18 @@ fn serialize_jsx_element( node: &JSXElement, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::JSXElement, parent, &node.span, 3); + let raw = ctx.header(AstNode::JSXElement, parent, &node.span); let open_pos = ctx.ref_field(AstProp::OpeningElement); let close_pos = ctx.ref_field(AstProp::ClosingElement); let children_pos = ctx.ref_vec_field(AstProp::Children, node.children.len()); + let pos = ctx.commit_schema(raw); let open = serialize_jsx_opening_element(ctx, &node.opening, pos); let close = node.closing.as_ref().map(|closing| { - let closing_pos = - ctx.header(AstNode::JSXClosingElement, pos, &closing.span, 1); + let raw = ctx.header(AstNode::JSXClosingElement, pos, &closing.span); let name_pos = ctx.ref_field(AstProp::Name); + let closing_pos = ctx.commit_schema(raw); let name = serialize_jsx_element_name(ctx, &closing.name, closing_pos); ctx.write_ref(name_pos, name); @@ -1997,16 +2069,18 @@ fn serialize_jsx_fragment( node: &JSXFragment, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::JSXFragment, parent, &node.span, 3); + let raw = ctx.header(AstNode::JSXFragment, parent, &node.span); let opening_pos = ctx.ref_field(AstProp::OpeningFragment); let closing_pos = ctx.ref_field(AstProp::ClosingFragment); let children_pos = ctx.ref_vec_field(AstProp::Children, node.children.len()); + let pos = ctx.commit_schema(raw); - let opening_id = - ctx.header(AstNode::JSXOpeningFragment, pos, &node.opening.span, 0); - let closing_id = - ctx.header(AstNode::JSXClosingFragment, pos, &node.closing.span, 0); + let raw = ctx.header(AstNode::JSXOpeningFragment, pos, &node.opening.span); + let opening_id = ctx.commit_schema(raw); + + let raw = ctx.header(AstNode::JSXClosingFragment, pos, &node.closing.span); + let closing_id = ctx.commit_schema(raw); let children = serialize_jsx_children(ctx, &node.children, pos); @@ -2027,9 +2101,10 @@ fn serialize_jsx_children( .map(|child| { match child { JSXElementChild::JSXText(text) => { - let pos = ctx.header(AstNode::JSXText, parent, &text.span, 2); + let raw = ctx.header(AstNode::JSXText, parent, &text.span); let raw_pos = ctx.str_field(AstProp::Raw); let value_pos = ctx.str_field(AstProp::Value); + let pos = ctx.commit_schema(raw); ctx.write_str(raw_pos, &text.raw); ctx.write_str(value_pos, &text.value); @@ -2057,9 +2132,10 @@ fn serialize_jsx_member_expr( node: &JSXMemberExpr, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::JSXMemberExpression, parent, &node.span, 2); + let raw = ctx.header(AstNode::JSXMemberExpression, parent, &node.span); let obj_ref = ctx.ref_field(AstProp::Object); let prop_ref = ctx.ref_field(AstProp::Property); + let pos = ctx.commit_schema(raw); let obj = match &node.obj { JSXObject::JSXMemberExpr(member) => { @@ -2099,10 +2175,11 @@ fn serialize_jsx_opening_element( node: &JSXOpeningElement, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::JSXOpeningElement, parent, &node.span, 3); + let raw = ctx.header(AstNode::JSXOpeningElement, parent, &node.span); let sclose_pos = ctx.bool_field(AstProp::SelfClosing); let name_pos = ctx.ref_field(AstProp::Name); let attrs_pos = ctx.ref_vec_field(AstProp::Attributes, node.attrs.len()); + let pos = ctx.commit_schema(raw); let name = serialize_jsx_element_name(ctx, &node.name, pos); @@ -2113,9 +2190,10 @@ fn serialize_jsx_opening_element( .iter() .map(|attr| match attr { JSXAttrOrSpread::JSXAttr(attr) => { - let attr_pos = ctx.header(AstNode::JSXAttribute, pos, &attr.span, 2); + let raw = ctx.header(AstNode::JSXAttribute, pos, &attr.span); let name_pos = ctx.ref_field(AstProp::Name); let value_pos = ctx.ref_field(AstProp::Value); + let attr_pos = ctx.commit_schema(raw); let name = match &attr.name { JSXAttrName::Ident(name) => { @@ -2145,9 +2223,9 @@ fn serialize_jsx_opening_element( attr_pos } JSXAttrOrSpread::SpreadElement(spread) => { - let attr_pos = - ctx.header(AstNode::JSXAttribute, pos, &spread.dot3_token, 1); + let raw = ctx.header(AstNode::JSXAttribute, pos, &spread.dot3_token); let arg_pos = ctx.ref_field(AstProp::Argument); + let attr_pos = ctx.commit_schema(raw); let arg = serialize_expr(ctx, &spread.expr, attr_pos); @@ -2170,8 +2248,9 @@ fn serialize_jsx_container_expr( node: &JSXExprContainer, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::JSXExpressionContainer, parent, &node.span, 1); + let raw = ctx.header(AstNode::JSXExpressionContainer, parent, &node.span); let expr_pos = ctx.ref_field(AstProp::Expression); + let pos = ctx.commit_schema(raw); let expr = match &node.expr { JSXExpr::JSXEmptyExpr(expr) => serialize_jsx_empty_expr(ctx, expr, pos), @@ -2188,7 +2267,8 @@ fn serialize_jsx_empty_expr( node: &JSXEmptyExpr, parent: NodeRef, ) -> NodeRef { - ctx.header(AstNode::JSXEmptyExpression, parent, &node.span, 0) + let raw = ctx.header(AstNode::JSXEmptyExpression, parent, &node.span); + ctx.commit_schema(raw) } fn serialize_jsx_namespaced_name( @@ -2196,9 +2276,10 @@ fn serialize_jsx_namespaced_name( node: &JSXNamespacedName, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::JSXNamespacedName, parent, &node.span, 2); + let raw = ctx.header(AstNode::JSXNamespacedName, parent, &node.span); let ns_pos = ctx.ref_field(AstProp::Namespace); let name_pos = ctx.ref_field(AstProp::Name); + let pos = ctx.commit_schema(raw); let ns_id = serialize_ident_name_as_jsx_identifier(ctx, &node.ns, pos); let name_id = serialize_ident_name_as_jsx_identifier(ctx, &node.name, pos); @@ -2214,8 +2295,9 @@ fn serialize_ident_name_as_jsx_identifier( node: &IdentName, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::JSXIdentifier, parent, &node.span, 1); + let raw = ctx.header(AstNode::JSXIdentifier, parent, &node.span); let name_pos = ctx.str_field(AstProp::Name); + let pos = ctx.commit_schema(raw); ctx.write_str(name_pos, &node.sym); @@ -2227,8 +2309,9 @@ fn serialize_jsx_identifier( node: &Ident, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::JSXIdentifier, parent, &node.span, 1); + let raw = ctx.header(AstNode::JSXIdentifier, parent, &node.span); let name_pos = ctx.str_field(AstProp::Name); + let pos = ctx.commit_schema(raw); ctx.write_str(name_pos, &node.sym); @@ -2243,10 +2326,11 @@ fn serialize_pat( match pat { Pat::Ident(node) => serialize_ident(ctx, &node.id, parent), Pat::Array(node) => { - let pos = ctx.header(AstNode::ArrayPattern, parent, &node.span, 3); + let raw = ctx.header(AstNode::ArrayPattern, parent, &node.span); let opt_pos = ctx.bool_field(AstProp::Optional); let type_pos = ctx.ref_field(AstProp::TypeAnnotation); let elems_pos = ctx.ref_vec_field(AstProp::Elements, node.elems.len()); + let pos = ctx.commit_schema(raw); let type_ann = maybe_serialize_ts_type_ann(ctx, &node.type_ann, pos); @@ -2267,9 +2351,10 @@ fn serialize_pat( pos } Pat::Rest(node) => { - let pos = ctx.header(AstNode::RestElement, parent, &node.span, 2); + let raw = ctx.header(AstNode::RestElement, parent, &node.span); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); let arg_pos = ctx.ref_field(AstProp::Argument); + let pos = ctx.commit_schema(raw); let type_ann = maybe_serialize_ts_type_ann(ctx, &node.type_ann, pos); let arg = serialize_pat(ctx, &node.arg, parent); @@ -2280,10 +2365,11 @@ fn serialize_pat( pos } Pat::Object(node) => { - let pos = ctx.header(AstNode::ObjectPattern, parent, &node.span, 3); + let raw = ctx.header(AstNode::ObjectPattern, parent, &node.span); let opt_pos = ctx.bool_field(AstProp::Optional); let props_pos = ctx.ref_vec_field(AstProp::Properties, node.props.len()); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); + let pos = ctx.commit_schema(raw); let type_ann = maybe_serialize_ts_type_ann(ctx, &node.type_ann, pos); @@ -2292,11 +2378,12 @@ fn serialize_pat( .iter() .map(|prop| match prop { ObjectPatProp::KeyValue(key_value_prop) => { - let child_pos = - ctx.header(AstNode::Property, pos, &key_value_prop.span(), 3); + let raw = + ctx.header(AstNode::Property, pos, &key_value_prop.span()); let computed_pos = ctx.bool_field(AstProp::Computed); let key_pos = ctx.ref_field(AstProp::Key); let value_pos = ctx.ref_field(AstProp::Value); + let child_pos = ctx.commit_schema(raw); let computed = matches!(key_value_prop.key, PropName::Computed(_)); @@ -2311,12 +2398,12 @@ fn serialize_pat( child_pos } ObjectPatProp::Assign(assign_pat_prop) => { - let child_pos = - ctx.header(AstNode::Property, pos, &assign_pat_prop.span, 3); + let raw = ctx.header(AstNode::Property, pos, &assign_pat_prop.span); // TOOD: Doesn't seem to be present in SWC ast let _computed_pos = ctx.bool_field(AstProp::Computed); let key_pos = ctx.ref_field(AstProp::Key); let value_pos = ctx.ref_field(AstProp::Value); + let child_pos = ctx.commit_schema(raw); let ident = serialize_ident(ctx, &assign_pat_prop.key.id, parent); @@ -2343,9 +2430,10 @@ fn serialize_pat( pos } Pat::Assign(node) => { - let pos = ctx.header(AstNode::AssignmentPattern, parent, &node.span, 2); + let raw = ctx.header(AstNode::AssignmentPattern, parent, &node.span); let left_pos = ctx.ref_field(AstProp::Left); let right_pos = ctx.ref_field(AstProp::Right); + let pos = ctx.commit_schema(raw); let left = serialize_pat(ctx, &node.left, pos); let right = serialize_expr(ctx, &node.right, pos); @@ -2382,8 +2470,9 @@ fn serialize_spread( span: &Span, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::SpreadElement, parent, span, 1); + let raw = ctx.header(AstNode::SpreadElement, parent, span); let arg_pos = ctx.ref_field(AstProp::Argument); + let pos = ctx.commit_schema(raw); let expr_pos = serialize_expr(ctx, expr, parent); ctx.write_ref(arg_pos, expr_pos); @@ -2396,8 +2485,10 @@ fn serialize_ident_name( ident_name: &IdentName, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::Identifier, parent, &ident_name.span, 1); + let raw = ctx.header(AstNode::Identifier, parent, &ident_name.span); let name_pos = ctx.str_field(AstProp::Name); + let pos = ctx.commit_schema(raw); + ctx.write_str(name_pos, ident_name.sym.as_str()); pos @@ -2413,12 +2504,10 @@ fn serialize_prop_name( serialize_ident_name(ctx, ident_name, parent) } PropName::Str(str_prop) => { - let child_pos = - ctx.header(AstNode::StringLiteral, parent, &str_prop.span, 1); + let raw = ctx.header(AstNode::StringLiteral, parent, &str_prop.span); let value_pos = ctx.str_field(AstProp::Value); ctx.write_str(value_pos, &str_prop.value); - - child_pos + ctx.commit_schema(raw) } PropName::Num(number) => { serialize_lit(ctx, &Lit::Num(number.clone()), parent) @@ -2437,25 +2526,31 @@ fn serialize_lit( ) -> NodeRef { match lit { Lit::Str(node) => { - let pos = ctx.header(AstNode::StringLiteral, parent, &node.span, 1); + let raw = ctx.header(AstNode::StringLiteral, parent, &node.span); let value_pos = ctx.str_field(AstProp::Value); + let pos = ctx.commit_schema(raw); ctx.write_str(value_pos, &node.value); pos } Lit::Bool(lit_bool) => { - let pos = ctx.header(AstNode::Bool, parent, &lit_bool.span, 1); + let raw = ctx.header(AstNode::Bool, parent, &lit_bool.span); let value_pos = ctx.bool_field(AstProp::Value); + let pos = ctx.commit_schema(raw); ctx.write_bool(value_pos, lit_bool.value); pos } - Lit::Null(node) => ctx.header(AstNode::Null, parent, &node.span, 0), + Lit::Null(node) => { + let raw = ctx.header(AstNode::Null, parent, &node.span); + ctx.commit_schema(raw) + } Lit::Num(node) => { - let pos = ctx.header(AstNode::NumericLiteral, parent, &node.span, 1); + let raw = ctx.header(AstNode::NumericLiteral, parent, &node.span); let value_pos = ctx.str_field(AstProp::Value); + let pos = ctx.commit_schema(raw); let value = node.raw.as_ref().unwrap(); ctx.write_str(value_pos, value); @@ -2463,17 +2558,19 @@ fn serialize_lit( pos } Lit::BigInt(node) => { - let pos = ctx.header(AstNode::BigIntLiteral, parent, &node.span, 1); + let raw = ctx.header(AstNode::BigIntLiteral, parent, &node.span); let value_pos = ctx.str_field(AstProp::Value); + let pos = ctx.commit_schema(raw); ctx.write_str(value_pos, &node.value.to_string()); pos } Lit::Regex(node) => { - let pos = ctx.header(AstNode::RegExpLiteral, parent, &node.span, 2); + let raw = ctx.header(AstNode::RegExpLiteral, parent, &node.span); let pattern_pos = ctx.str_field(AstProp::Pattern); let flags_pos = ctx.str_field(AstProp::Flags); + let pos = ctx.commit_schema(raw); ctx.write_str(pattern_pos, node.exp.as_str()); ctx.write_str(flags_pos, node.flags.as_str()); @@ -2481,7 +2578,8 @@ fn serialize_lit( pos } Lit::JSXText(jsxtext) => { - ctx.header(AstNode::JSXText, parent, &jsxtext.span, 0) + let raw = ctx.header(AstNode::JSXText, parent, &jsxtext.span); + ctx.commit_schema(raw) } } } @@ -2491,9 +2589,10 @@ fn serialize_ts_param_inst( node: &TsTypeParamInstantiation, parent: NodeRef, ) -> NodeRef { - let pos = - ctx.header(AstNode::TSTypeParameterInstantiation, parent, &node.span, 1); + let raw = + ctx.header(AstNode::TSTypeParameterInstantiation, parent, &node.span); let params_pos = ctx.ref_vec_field(AstProp::Params, node.params.len()); + let pos = ctx.commit_schema(raw); let params = node .params @@ -2529,15 +2628,18 @@ fn serialize_ts_type( TsKeywordTypeKind::TsIntrinsicKeyword => AstNode::TSIntrinsicKeyword, }; - ctx.header(kind, parent, &node.span, 0) + let raw = ctx.header(kind, parent, &node.span); + ctx.commit_schema(raw) } TsType::TsThisType(node) => { - ctx.header(AstNode::TSThisType, parent, &node.span, 0) + let raw = ctx.header(AstNode::TSThisType, parent, &node.span); + ctx.commit_schema(raw) } TsType::TsFnOrConstructorType(node) => match node { TsFnOrConstructorType::TsFnType(node) => { - let pos = ctx.header(AstNode::TSFunctionType, parent, &node.span, 1); + let raw = ctx.header(AstNode::TSFunctionType, parent, &node.span); let params_pos = ctx.ref_vec_field(AstProp::Params, node.params.len()); + let pos = ctx.commit_schema(raw); let param_ids = node .params @@ -2554,9 +2656,10 @@ fn serialize_ts_type( } }, TsType::TsTypeRef(node) => { - let pos = ctx.header(AstNode::TSTypeReference, parent, &node.span, 2); + let raw = ctx.header(AstNode::TSTypeReference, parent, &node.span); let name_pos = ctx.ref_field(AstProp::TypeName); let type_args_pos = ctx.ref_field(AstProp::TypeArguments); + let pos = ctx.commit_schema(raw); let name = serialize_ts_entity_name(ctx, &node.type_name, pos); @@ -2571,9 +2674,10 @@ fn serialize_ts_type( pos } TsType::TsTypeQuery(node) => { - let pos = ctx.header(AstNode::TSTypeQuery, parent, &node.span, 2); + let raw = ctx.header(AstNode::TSTypeQuery, parent, &node.span); let name_pos = ctx.ref_field(AstProp::ExprName); let type_args_pos = ctx.ref_field(AstProp::TypeArguments); + let pos = ctx.commit_schema(raw); let expr_name = match &node.expr_name { TsTypeQueryExpr::TsEntityName(entity) => { @@ -2599,8 +2703,9 @@ fn serialize_ts_type( todo!() } TsType::TsArrayType(node) => { - let pos = ctx.header(AstNode::TSArrayType, parent, &node.span, 1); + let raw = ctx.header(AstNode::TSArrayType, parent, &node.span); let elem_pos = ctx.ref_field(AstProp::ElementType); + let pos = ctx.commit_schema(raw); let elem = serialize_ts_type(ctx, &node.elem_type, pos); @@ -2609,19 +2714,20 @@ fn serialize_ts_type( pos } TsType::TsTupleType(node) => { - let pos = ctx.header(AstNode::TSTupleType, parent, &node.span, 1); + let raw = ctx.header(AstNode::TSTupleType, parent, &node.span); let children_pos = ctx.ref_vec_field(AstProp::ElementTypes, node.elem_types.len()); + let pos = ctx.commit_schema(raw); let children = node .elem_types .iter() .map(|elem| { if let Some(label) = &elem.label { - let child_pos = - ctx.header(AstNode::TSNamedTupleMember, pos, &elem.span, 1); + let raw = ctx.header(AstNode::TSNamedTupleMember, pos, &elem.span); let label_pos = ctx.ref_field(AstProp::Label); let type_pos = ctx.ref_field(AstProp::ElementType); + let child_pos = ctx.commit_schema(raw); let label_id = serialize_pat(ctx, label, child_pos); let type_id = serialize_ts_type(ctx, elem.ty.as_ref(), child_pos); @@ -2642,8 +2748,9 @@ fn serialize_ts_type( } TsType::TsOptionalType(_) => todo!(), TsType::TsRestType(node) => { - let pos = ctx.header(AstNode::TSRestType, parent, &node.span, 1); + let raw = ctx.header(AstNode::TSRestType, parent, &node.span); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); + let pos = ctx.commit_schema(raw); let type_ann = serialize_ts_type(ctx, &node.type_ann, pos); @@ -2653,8 +2760,9 @@ fn serialize_ts_type( } TsType::TsUnionOrIntersectionType(node) => match node { TsUnionOrIntersectionType::TsUnionType(node) => { - let pos = ctx.header(AstNode::TSUnionType, parent, &node.span, 1); + let raw = ctx.header(AstNode::TSUnionType, parent, &node.span); let types_pos = ctx.ref_vec_field(AstProp::Types, node.types.len()); + let pos = ctx.commit_schema(raw); let children = node .types @@ -2667,9 +2775,9 @@ fn serialize_ts_type( pos } TsUnionOrIntersectionType::TsIntersectionType(node) => { - let pos = - ctx.header(AstNode::TSIntersectionType, parent, &node.span, 1); + let raw = ctx.header(AstNode::TSIntersectionType, parent, &node.span); let types_pos = ctx.ref_vec_field(AstProp::Types, node.types.len()); + let pos = ctx.commit_schema(raw); let children = node .types @@ -2683,11 +2791,12 @@ fn serialize_ts_type( } }, TsType::TsConditionalType(node) => { - let pos = ctx.header(AstNode::TSConditionalType, parent, &node.span, 4); + let raw = ctx.header(AstNode::TSConditionalType, parent, &node.span); let check_pos = ctx.ref_field(AstProp::CheckType); let extends_pos = ctx.ref_field(AstProp::ExtendsType); let true_pos = ctx.ref_field(AstProp::TrueType); let false_pos = ctx.ref_field(AstProp::FalseType); + let pos = ctx.commit_schema(raw); let check = serialize_ts_type(ctx, &node.check_type, pos); let extends = serialize_ts_type(ctx, &node.extends_type, pos); @@ -2702,8 +2811,9 @@ fn serialize_ts_type( pos } TsType::TsInferType(node) => { - let pos = ctx.header(AstNode::TSInferType, parent, &node.span, 1); + let raw = ctx.header(AstNode::TSInferType, parent, &node.span); let param_pos = ctx.ref_field(AstProp::TypeParameter); + let pos = ctx.commit_schema(raw); let param = serialize_ts_type_param(ctx, &node.type_param, parent); @@ -2713,10 +2823,10 @@ fn serialize_ts_type( } TsType::TsParenthesizedType(_) => todo!(), TsType::TsTypeOperator(node) => { - let pos = ctx.header(AstNode::TSTypeOperator, parent, &node.span, 2); - + let raw = ctx.header(AstNode::TSTypeOperator, parent, &node.span); let operator_pos = ctx.str_field(AstProp::Operator); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); + let pos = ctx.commit_schema(raw); let type_ann = serialize_ts_type(ctx, &node.type_ann, pos); @@ -2733,10 +2843,10 @@ fn serialize_ts_type( pos } TsType::TsIndexedAccessType(node) => { - let pos = ctx.header(AstNode::TSIndexedAccessType, parent, &node.span, 2); - + let raw = ctx.header(AstNode::TSIndexedAccessType, parent, &node.span); let index_type_pos = ctx.ref_field(AstProp::IndexType); let obj_type_pos = ctx.ref_field(AstProp::ObjectType); + let pos = ctx.commit_schema(raw); let index = serialize_ts_type(ctx, &node.index_type, pos); let obj = serialize_ts_type(ctx, &node.obj_type, pos); @@ -2747,11 +2857,11 @@ fn serialize_ts_type( pos } TsType::TsMappedType(node) => { - let pos = ctx.header(AstNode::TSMappedType, parent, &node.span, 5); - + let raw = ctx.header(AstNode::TSMappedType, parent, &node.span); let name_pos = ctx.ref_field(AstProp::NameType); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); let type_param_pos = ctx.ref_field(AstProp::TypeParameter); + let pos = ctx.commit_schema(raw); let opt_pos = create_true_plus_minus_field(ctx, AstProp::Optional, node.optional); @@ -2772,15 +2882,16 @@ fn serialize_ts_type( } TsType::TsLitType(node) => serialize_ts_lit_type(ctx, node, parent), TsType::TsTypePredicate(node) => { - let pos = ctx.header(AstNode::TSTypePredicate, parent, &node.span, 3); - + let raw = ctx.header(AstNode::TSTypePredicate, parent, &node.span); let asserts_pos = ctx.bool_field(AstProp::Asserts); let param_name_pos = ctx.ref_field(AstProp::ParameterName); let type_ann_pos = ctx.ref_field(AstProp::TypeAnnotation); + let pos = ctx.commit_schema(raw); let param_name = match &node.param_name { TsThisTypeOrIdent::TsThisType(ts_this_type) => { - ctx.header(AstNode::TSThisType, pos, &ts_this_type.span, 0) + let raw = ctx.header(AstNode::TSThisType, pos, &ts_this_type.span); + ctx.commit_schema(raw) } TsThisTypeOrIdent::Ident(ident) => serialize_ident(ctx, ident, pos), }; @@ -2794,10 +2905,11 @@ fn serialize_ts_type( pos } TsType::TsImportType(node) => { - let pos = ctx.header(AstNode::TSTypePredicate, parent, &node.span, 3); + let raw = ctx.header(AstNode::TSTypePredicate, parent, &node.span); let arg_pos = ctx.ref_field(AstProp::Argument); let type_args_pos = ctx.ref_field(AstProp::TypeArguments); let qualifier_pos = ctx.ref_field(AstProp::Qualifier); + let pos = ctx.commit_schema(raw); let arg = serialize_ts_lit_type( ctx, @@ -2830,8 +2942,9 @@ fn serialize_ts_lit_type( node: &TsLitType, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::TSLiteralType, parent, &node.span, 1); + let raw = ctx.header(AstNode::TSLiteralType, parent, &node.span); let lit_pos = ctx.ref_field(AstProp::Literal); + let pos = ctx.commit_schema(raw); let lit = match &node.lit { TsLit::Number(lit) => serialize_lit(ctx, &Lit::Num(lit.clone()), pos), @@ -2931,8 +3044,9 @@ fn serialize_ts_type_ann( node: &TsTypeAnn, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::TSTypeAnnotation, parent, &node.span, 1); + let raw = ctx.header(AstNode::TSTypeAnnotation, parent, &node.span); let type_pos = ctx.ref_field(AstProp::TypeAnnotation); + let pos = ctx.commit_schema(raw); let v_type = serialize_ts_type(ctx, &node.type_ann, pos); @@ -2956,13 +3070,14 @@ fn serialize_ts_type_param( node: &TsTypeParam, parent: NodeRef, ) -> NodeRef { - let pos = ctx.header(AstNode::TSTypeParameter, parent, &node.span, 6); + let raw = ctx.header(AstNode::TSTypeParameter, parent, &node.span); let name_pos = ctx.ref_field(AstProp::Name); let constraint_pos = ctx.ref_field(AstProp::Constraint); let default_pos = ctx.ref_field(AstProp::Default); let const_pos = ctx.bool_field(AstProp::Const); let in_pos = ctx.bool_field(AstProp::In); let out_pos = ctx.bool_field(AstProp::Out); + let pos = ctx.commit_schema(raw); let name = serialize_ident(ctx, &node.name, pos); let constraint = maybe_serialize_ts_type(ctx, &node.constraint, pos); @@ -2984,9 +3099,10 @@ fn maybe_serialize_ts_type_param( parent: NodeRef, ) -> Option { node.as_ref().map(|node| { - let pos = - ctx.header(AstNode::TSTypeParameterDeclaration, parent, &node.span, 1); + let raw = + ctx.header(AstNode::TSTypeParameterDeclaration, parent, &node.span); let params_pos = ctx.ref_vec_field(AstProp::Params, node.params.len()); + let pos = ctx.commit_schema(raw); let params = node .params diff --git a/cli/tools/lint/ast_buffer/ts_estree.rs b/cli/tools/lint/ast_buffer/ts_estree.rs index 64dbd82cde..967bbef32a 100644 --- a/cli/tools/lint/ast_buffer/ts_estree.rs +++ b/cli/tools/lint/ast_buffer/ts_estree.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::fmt; use std::fmt::Debug; @@ -12,6 +12,7 @@ use super::buffer::FieldArrPos; use super::buffer::FieldPos; use super::buffer::NodeRef; use super::buffer::NullPos; +use super::buffer::PendingNodeRef; use super::buffer::SerializeCtx; use super::buffer::StrPos; use super::buffer::UndefPos; @@ -447,10 +448,10 @@ impl TsEsTreeBuilder { pub fn new() -> Self { // Max values // TODO: Maybe there is a rust macro to grab the last enum value? - let kind_count: u8 = AstNode::TSEnumBody.into(); - let prop_count: u8 = AstProp::Value.into(); + let kind_max_count: u8 = u8::from(AstNode::TSEnumBody) + 1; + let prop_max_count: u8 = u8::from(AstProp::Value) + 1; Self { - ctx: SerializeCtx::new(kind_count, prop_count), + ctx: SerializeCtx::new(kind_max_count, prop_max_count), } } } @@ -461,9 +462,12 @@ impl AstBufSerializer for TsEsTreeBuilder { kind: AstNode, parent: NodeRef, span: &Span, - prop_count: usize, - ) -> NodeRef { - self.ctx.header(kind, parent, span, prop_count) + ) -> PendingNodeRef { + self.ctx.header(kind, parent, span) + } + + fn commit_schema(&mut self, offset: PendingNodeRef) -> NodeRef { + self.ctx.commit_schema(offset) } fn ref_field(&mut self, prop: AstProp) -> FieldPos { diff --git a/cli/tools/lint/linter.rs b/cli/tools/lint/linter.rs index a10ad6479e..5d6f845274 100644 --- a/cli/tools/lint/linter.rs +++ b/cli/tools/lint/linter.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashSet; use std::path::Path; @@ -16,13 +16,12 @@ use deno_lint::linter::LintFileOptions; use deno_lint::linter::Linter as DenoLintLinter; use deno_lint::linter::LinterOptions; use deno_path_util::fs::atomic_write_file_with_retries; -use deno_runtime::deno_fs::FsSysTraitsAdapter; - -use crate::util::fs::specifier_from_file_path; use super::rules::FileOrPackageLintRule; use super::rules::PackageLintRule; use super::ConfiguredRules; +use crate::sys::CliSys; +use crate::util::fs::specifier_from_file_path; pub struct CliLinterOptions { pub configured_rules: ConfiguredRules, @@ -177,7 +176,7 @@ impl CliLinter { if fix_iterations > 0 { // everything looks good and the file still parses, so write it out atomic_write_file_with_retries( - &FsSysTraitsAdapter::new_real(), + &CliSys::default(), file_path, source.text().as_bytes(), crate::cache::CACHE_PERM, diff --git a/cli/tools/lint/mod.rs b/cli/tools/lint/mod.rs index cc7423c637..9f4489cede 100644 --- a/cli/tools/lint/mod.rs +++ b/cli/tools/lint/mod.rs @@ -1,8 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! This module provides file linting utilities using //! [`deno_lint`](https://github.com/denoland/deno_lint). +use std::collections::HashSet; +use std::fs; +use std::io::stdin; +use std::io::Read; +use std::path::PathBuf; +use std::rc::Rc; +use std::sync::Arc; + use deno_ast::ModuleSpecifier; use deno_ast::ParsedSource; use deno_config::deno_json::LintRulesConfig; @@ -21,18 +29,10 @@ use deno_core::unsync::future::SharedLocal; use deno_graph::ModuleGraph; use deno_lint::diagnostic::LintDiagnostic; use deno_lint::linter::LintConfig as DenoLintConfig; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use log::debug; use reporters::create_reporter; use reporters::LintReporter; use serde::Serialize; -use std::collections::HashSet; -use std::fs; -use std::io::stdin; -use std::io::Read; -use std::path::PathBuf; -use std::rc::Rc; -use std::sync::Arc; use crate::args::CliOptions; use crate::args::Flags; @@ -44,6 +44,7 @@ use crate::cache::IncrementalCache; use crate::colors; use crate::factory::CliFactory; use crate::graph_util::ModuleGraphCreator; +use crate::sys::CliSys; use crate::tools::fmt::run_parallelized; use crate::util::display; use crate::util::file_watcher; @@ -453,7 +454,7 @@ fn collect_lint_files( .ignore_node_modules() .use_gitignore() .set_vendor_folder(cli_options.vendor_dir_path().map(ToOwned::to_owned)) - .collect_file_patterns(&FsSysTraitsAdapter::new_real(), files) + .collect_file_patterns(&CliSys::default(), files) } #[allow(clippy::print_stdout)] @@ -596,11 +597,12 @@ struct LintError { #[cfg(test)] mod tests { - use super::*; use pretty_assertions::assert_eq; use serde::Deserialize; use test_util as util; + use super::*; + #[derive(Serialize, Deserialize)] struct RulesSchema { #[serde(rename = "$schema")] diff --git a/cli/tools/lint/reporters.rs b/cli/tools/lint/reporters.rs index 18bc1216a6..24e04e840f 100644 --- a/cli/tools/lint/reporters.rs +++ b/cli/tools/lint/reporters.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_ast::diagnostics::Diagnostic; use deno_core::error::AnyError; @@ -8,9 +8,8 @@ use deno_runtime::colors; use log::info; use serde::Serialize; -use crate::args::LintReporterKind; - use super::LintError; +use crate::args::LintReporterKind; const JSON_SCHEMA_VERSION: u8 = 1; diff --git a/cli/tools/lint/rules/mod.rs b/cli/tools/lint/rules/mod.rs index dd723ad159..e7be12d56d 100644 --- a/cli/tools/lint/rules/mod.rs +++ b/cli/tools/lint/rules/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::collections::HashSet; diff --git a/cli/tools/lint/rules/no_sloppy_imports.rs b/cli/tools/lint/rules/no_sloppy_imports.rs index 1bf7eddf6e..33d3090fe3 100644 --- a/cli/tools/lint/rules/no_sloppy_imports.rs +++ b/cli/tools/lint/rules/no_sloppy_imports.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::RefCell; @@ -20,11 +20,10 @@ use deno_resolver::sloppy_imports::SloppyImportsResolution; use deno_resolver::sloppy_imports::SloppyImportsResolutionKind; use text_lines::LineAndColumnIndex; +use super::ExtendedLintRule; use crate::graph_util::CliJsrUrlProvider; use crate::resolver::CliSloppyImportsResolver; -use super::ExtendedLintRule; - #[derive(Debug)] pub struct NoSloppyImportsRule { sloppy_imports_resolver: Option>, diff --git a/cli/tools/lint/rules/no_slow_types.rs b/cli/tools/lint/rules/no_slow_types.rs index bc3f835b17..a792c38612 100644 --- a/cli/tools/lint/rules/no_slow_types.rs +++ b/cli/tools/lint/rules/no_slow_types.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; diff --git a/cli/tools/mod.rs b/cli/tools/mod.rs index a458da9f1b..35de8ab9fa 100644 --- a/cli/tools/mod.rs +++ b/cli/tools/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub mod bench; pub mod check; diff --git a/cli/tools/registry/api.rs b/cli/tools/registry/api.rs index 2f27cb2fea..c2d34442a1 100644 --- a/cli/tools/registry/api.rs +++ b/cli/tools/registry/api.rs @@ -1,12 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::http_util; use deno_core::error::AnyError; use deno_core::serde_json; use deno_core::url::Url; use deno_runtime::deno_fetch; use serde::de::DeserializeOwned; +use crate::http_util; use crate::http_util::HttpClient; #[derive(serde::Deserialize)] diff --git a/cli/tools/registry/auth.rs b/cli/tools/registry/auth.rs index 820d3b6b60..3665990905 100644 --- a/cli/tools/registry/auth.rs +++ b/cli/tools/registry/auth.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::io::IsTerminal; diff --git a/cli/tools/registry/diagnostics.rs b/cli/tools/registry/diagnostics.rs index 9c32b8e36d..27753167f3 100644 --- a/cli/tools/registry/diagnostics.rs +++ b/cli/tools/registry/diagnostics.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::path::PathBuf; diff --git a/cli/tools/registry/graph.rs b/cli/tools/registry/graph.rs index 21962d009e..7152675ff8 100644 --- a/cli/tools/registry/graph.rs +++ b/cli/tools/registry/graph.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashSet; use std::sync::Arc; @@ -16,10 +16,9 @@ use deno_graph::WalkOptions; use deno_semver::jsr::JsrPackageReqReference; use deno_semver::npm::NpmPackageReqReference; -use crate::cache::ParsedSourceCache; - use super::diagnostics::PublishDiagnostic; use super::diagnostics::PublishDiagnosticsCollector; +use crate::cache::ParsedSourceCache; pub struct GraphDiagnosticsCollector { parsed_source_cache: Arc, diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs index 45a040d236..ea457f8a71 100644 --- a/cli/tools/registry/mod.rs +++ b/cli/tools/registry/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::collections::HashSet; @@ -73,11 +73,10 @@ pub use pm::AddRmPackageReq; use publish_order::PublishOrderGraph; use unfurl::SpecifierUnfurler; -use super::check::TypeChecker; - use self::graph::GraphDiagnosticsCollector; use self::paths::CollectedPublishPath; use self::tar::PublishableTarball; +use super::check::TypeChecker; pub async fn publish( flags: Arc, @@ -1281,14 +1280,14 @@ fn ring_bell() { #[cfg(test)] mod tests { - use deno_ast::ModuleSpecifier; + use std::collections::HashMap; - use crate::tools::registry::has_license_file; + use deno_ast::ModuleSpecifier; use super::tar::PublishableTarball; use super::tar::PublishableTarballFile; use super::verify_version_manifest; - use std::collections::HashMap; + use crate::tools::registry::has_license_file; #[test] fn test_verify_version_manifest() { diff --git a/cli/tools/registry/paths.rs b/cli/tools/registry/paths.rs index b607c0924c..ef98838913 100644 --- a/cli/tools/registry/paths.rs +++ b/cli/tools/registry/paths.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Validation logic in this file is shared with registry/api/src/ids.rs @@ -11,13 +11,12 @@ use deno_ast::ModuleSpecifier; use deno_config::glob::FileCollector; use deno_config::glob::FilePatterns; use deno_core::error::AnyError; -use deno_runtime::deno_fs::FsSysTraitsAdapter; use thiserror::Error; -use crate::args::CliOptions; - use super::diagnostics::PublishDiagnostic; use super::diagnostics::PublishDiagnosticsCollector; +use crate::args::CliOptions; +use crate::sys::CliSys; /// A package path, like '/foo' or '/foo/bar'. The path is prefixed with a slash /// and does not end with a slash. @@ -346,5 +345,5 @@ fn collect_paths( .ignore_node_modules() .set_vendor_folder(cli_options.vendor_dir_path().map(ToOwned::to_owned)) .use_gitignore() - .collect_file_patterns(&FsSysTraitsAdapter::new_real(), file_patterns) + .collect_file_patterns(&CliSys::default(), file_patterns) } diff --git a/cli/tools/registry/pm.rs b/cli/tools/registry/pm.rs index afa9b0222c..2b1266bafb 100644 --- a/cli/tools/registry/pm.rs +++ b/cli/tools/registry/pm.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::path::Path; use std::path::PathBuf; @@ -415,6 +415,7 @@ pub async fn add( let deps_file_fetcher = CliFileFetcher::new( deps_http_cache.clone(), http_client.clone(), + cli_factory.sys(), Default::default(), None, true, diff --git a/cli/tools/registry/pm/cache_deps.rs b/cli/tools/registry/pm/cache_deps.rs index 814c76cb27..3137939cea 100644 --- a/cli/tools/registry/pm/cache_deps.rs +++ b/cli/tools/registry/pm/cache_deps.rs @@ -1,16 +1,17 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::sync::Arc; +use deno_core::error::AnyError; +use deno_core::futures::stream::FuturesUnordered; +use deno_core::futures::StreamExt; +use deno_semver::jsr::JsrPackageReqReference; + use crate::factory::CliFactory; use crate::graph_container::ModuleGraphContainer; use crate::graph_container::ModuleGraphUpdatePermit; use crate::graph_util::CreateGraphOptions; -use deno_core::error::AnyError; -use deno_core::futures::stream::FuturesUnordered; -use deno_core::futures::StreamExt; -use deno_semver::jsr::JsrPackageReqReference; pub async fn cache_top_level_deps( // todo(dsherret): don't pass the factory into this function. Instead use ctor deps diff --git a/cli/tools/registry/pm/deps.rs b/cli/tools/registry/pm/deps.rs index ffa53417e9..708f95f987 100644 --- a/cli/tools/registry/pm/deps.rs +++ b/cli/tools/registry/pm/deps.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::collections::HashMap; @@ -35,6 +35,7 @@ use import_map::ImportMapWithDiagnostics; use import_map::SpecifierMapEntry; use tokio::sync::Semaphore; +use super::ConfigUpdater; use crate::args::CliLockfile; use crate::graph_container::MainModuleGraphContainer; use crate::graph_container::ModuleGraphContainer; @@ -45,8 +46,6 @@ use crate::npm::CliNpmResolver; use crate::npm::NpmFetchResolver; use crate::util::sync::AtomicFlag; -use super::ConfigUpdater; - #[derive(Clone, Debug, PartialEq, Eq)] pub enum ImportMapKind { Inline, diff --git a/cli/tools/registry/pm/outdated.rs b/cli/tools/registry/pm/outdated.rs index 20a6043f26..e7fc88c31f 100644 --- a/cli/tools/registry/pm/outdated.rs +++ b/cli/tools/registry/pm/outdated.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashSet; use std::sync::Arc; @@ -12,6 +12,10 @@ use deno_semver::StackString; use deno_semver::VersionReq; use deno_terminal::colors; +use super::deps::Dep; +use super::deps::DepManager; +use super::deps::DepManagerArgs; +use super::deps::PackageLatestVersion; use crate::args::CliOptions; use crate::args::Flags; use crate::args::OutdatedFlags; @@ -21,11 +25,6 @@ use crate::jsr::JsrFetchResolver; use crate::npm::NpmFetchResolver; use crate::tools::registry::pm::deps::DepKind; -use super::deps::Dep; -use super::deps::DepManager; -use super::deps::DepManagerArgs; -use super::deps::PackageLatestVersion; - #[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] struct OutdatedPackage { kind: DepKind, @@ -185,6 +184,7 @@ pub async fn outdated( let file_fetcher = CliFileFetcher::new( deps_http_cache.clone(), http_client.clone(), + factory.sys(), Default::default(), None, true, diff --git a/cli/tools/registry/provenance.rs b/cli/tools/registry/provenance.rs index 47169f2132..bd5249b5cd 100644 --- a/cli/tools/registry/provenance.rs +++ b/cli/tools/registry/provenance.rs @@ -1,11 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::http_util; -use crate::http_util::HttpClient; +use std::collections::HashMap; +use std::env; -use super::api::OidcTokenResponse; -use super::auth::gha_oidc_token; -use super::auth::is_gha; use base64::engine::general_purpose::STANDARD_NO_PAD; use base64::prelude::BASE64_STANDARD; use base64::Engine as _; @@ -27,8 +24,12 @@ use sha2::Digest; use spki::der::asn1; use spki::der::pem::LineEnding; use spki::der::EncodePem; -use std::collections::HashMap; -use std::env; + +use super::api::OidcTokenResponse; +use super::auth::gha_oidc_token; +use super::auth::is_gha; +use crate::http_util; +use crate::http_util::HttpClient; const PAE_PREFIX: &str = "DSSEv1"; @@ -706,10 +707,11 @@ async fn testify( #[cfg(test)] mod tests { + use std::env; + use super::ProvenanceAttestation; use super::Subject; use super::SubjectDigest; - use std::env; #[test] fn slsa_github_actions() { diff --git a/cli/tools/registry/publish_order.rs b/cli/tools/registry/publish_order.rs index ad77a56bb1..577627f348 100644 --- a/cli/tools/registry/publish_order.rs +++ b/cli/tools/registry/publish_order.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::collections::HashSet; diff --git a/cli/tools/registry/tar.rs b/cli/tools/registry/tar.rs index 6d1801ce69..2d6f53b5af 100644 --- a/cli/tools/registry/tar.rs +++ b/cli/tools/registry/tar.rs @@ -1,4 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::fmt::Write as FmtWrite; +use std::io::Write; +use std::path::Path; use bytes::Bytes; use deno_ast::MediaType; @@ -6,17 +10,13 @@ use deno_core::anyhow::Context; use deno_core::error::AnyError; use deno_core::url::Url; use sha2::Digest; -use std::fmt::Write as FmtWrite; -use std::io::Write; -use std::path::Path; use tar::Header; -use crate::cache::LazyGraphSourceParser; - use super::diagnostics::PublishDiagnostic; use super::diagnostics::PublishDiagnosticsCollector; use super::paths::CollectedPublishPath; use super::unfurl::SpecifierUnfurler; +use crate::cache::LazyGraphSourceParser; #[derive(Debug, Clone, PartialEq)] pub struct PublishableTarballFile { diff --git a/cli/tools/registry/unfurl.rs b/cli/tools/registry/unfurl.rs index ca50775717..e3501c348b 100644 --- a/cli/tools/registry/unfurl.rs +++ b/cli/tools/registry/unfurl.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::sync::Arc; @@ -655,16 +655,11 @@ fn to_range( mod tests { use std::sync::Arc; - use crate::resolver::SloppyImportsCachedFs; - - use super::*; use deno_ast::MediaType; use deno_ast::ModuleSpecifier; use deno_config::workspace::ResolverWorkspaceJsrPackage; use deno_core::serde_json::json; use deno_core::url::Url; - use deno_runtime::deno_fs::FsSysTraitsAdapter; - use deno_runtime::deno_fs::RealFs; use deno_runtime::deno_node::PackageJson; use deno_semver::Version; use import_map::ImportMapWithDiagnostics; @@ -672,6 +667,10 @@ mod tests { use pretty_assertions::assert_eq; use test_util::testdata_path; + use super::*; + use crate::resolver::SloppyImportsCachedFs; + use crate::sys::CliSys; + fn parse_ast(specifier: &Url, source_code: &str) -> ParsedSource { let media_type = MediaType::from_specifier(specifier); deno_ast::parse_module(deno_ast::ParseParams { @@ -725,7 +724,7 @@ mod tests { ); let unfurler = SpecifierUnfurler::new( Some(Arc::new(CliSloppyImportsResolver::new( - SloppyImportsCachedFs::new(FsSysTraitsAdapter::new_real()), + SloppyImportsCachedFs::new(CliSys::default()), ))), Arc::new(workspace_resolver), true, @@ -863,10 +862,10 @@ const warn2 = await import(`${expr}`); ], deno_config::workspace::PackageJsonDepResolution::Enabled, ); - let fs = FsSysTraitsAdapter(Arc::new(RealFs)); + let sys = CliSys::default(); let unfurler = SpecifierUnfurler::new( Some(Arc::new(CliSloppyImportsResolver::new( - SloppyImportsCachedFs::new(fs), + SloppyImportsCachedFs::new(sys), ))), Arc::new(workspace_resolver), true, diff --git a/cli/tools/repl/channel.rs b/cli/tools/repl/channel.rs index 823a13d288..4ac28b9d52 100644 --- a/cli/tools/repl/channel.rs +++ b/cli/tools/repl/channel.rs @@ -1,10 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::cell::RefCell; use deno_core::anyhow::anyhow; use deno_core::error::AnyError; use deno_core::serde_json; use deno_core::serde_json::Value; -use std::cell::RefCell; use tokio::sync::mpsc::channel; use tokio::sync::mpsc::unbounded_channel; use tokio::sync::mpsc::Receiver; diff --git a/cli/tools/repl/editor.rs b/cli/tools/repl/editor.rs index dbc9bce703..27d726255c 100644 --- a/cli/tools/repl/editor.rs +++ b/cli/tools/repl/editor.rs @@ -1,7 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::path::PathBuf; +use std::sync::atomic::AtomicBool; +use std::sync::atomic::Ordering::Relaxed; +use std::sync::Arc; -use crate::cdp; -use crate::colors; use deno_ast::swc::parser::error::SyntaxError; use deno_ast::swc::parser::token::BinOpToken; use deno_ast::swc::parser::token::Token; @@ -32,14 +36,11 @@ use rustyline::Modifiers; use rustyline::RepeatCount; use rustyline_derive::Helper; use rustyline_derive::Hinter; -use std::borrow::Cow; -use std::path::PathBuf; -use std::sync::atomic::AtomicBool; -use std::sync::atomic::Ordering::Relaxed; -use std::sync::Arc; use super::channel::RustylineSyncMessageSender; use super::session::REPL_INTERNALS_NAME; +use crate::cdp; +use crate::colors; // Provides helpers to the editor like validation for multi-line edits, completion candidates for // tab completion. diff --git a/cli/tools/repl/mod.rs b/cli/tools/repl/mod.rs index 9fb4624fa4..1bc6a2f9ea 100644 --- a/cli/tools/repl/mod.rs +++ b/cli/tools/repl/mod.rs @@ -1,10 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::io; use std::io::Write; - use std::sync::Arc; +use deno_core::error::AnyError; +use deno_core::futures::StreamExt; +use deno_core::serde_json; +use deno_core::unsync::spawn_blocking; +use deno_runtime::WorkerExecutionMode; +use rustyline::error::ReadlineError; + use crate::args::CliOptions; use crate::args::Flags; use crate::args::ReplFlags; @@ -13,12 +19,6 @@ use crate::colors; use crate::factory::CliFactory; use crate::file_fetcher::CliFileFetcher; use crate::file_fetcher::TextDecodedFile; -use deno_core::error::AnyError; -use deno_core::futures::StreamExt; -use deno_core::serde_json; -use deno_core::unsync::spawn_blocking; -use deno_runtime::WorkerExecutionMode; -use rustyline::error::ReadlineError; mod channel; mod editor; diff --git a/cli/tools/repl/session.rs b/cli/tools/repl/session.rs index 02594f1519..7b20717649 100644 --- a/cli/tools/repl/session.rs +++ b/cli/tools/repl/session.rs @@ -1,23 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::Arc; -use crate::args::CliOptions; -use crate::cdp; -use crate::colors; -use crate::lsp::ReplLanguageServer; -use crate::npm::CliNpmResolver; -use crate::resolver::CliResolver; -use crate::tools::test::report_tests; -use crate::tools::test::reporters::PrettyTestReporter; -use crate::tools::test::reporters::TestReporter; -use crate::tools::test::run_tests_for_worker; -use crate::tools::test::send_test_event; -use crate::tools::test::worker_has_tests; -use crate::tools::test::TestEvent; -use crate::tools::test::TestEventReceiver; -use crate::tools::test::TestFailureFormatOptions; - use deno_ast::diagnostics::Diagnostic; use deno_ast::swc::ast as swc_ast; use deno_ast::swc::common::comments::CommentKind; @@ -55,6 +39,22 @@ use regex::Match; use regex::Regex; use tokio::sync::Mutex; +use crate::args::CliOptions; +use crate::cdp; +use crate::colors; +use crate::lsp::ReplLanguageServer; +use crate::npm::CliNpmResolver; +use crate::resolver::CliResolver; +use crate::tools::test::report_tests; +use crate::tools::test::reporters::PrettyTestReporter; +use crate::tools::test::reporters::TestReporter; +use crate::tools::test::run_tests_for_worker; +use crate::tools::test::send_test_event; +use crate::tools::test::worker_has_tests; +use crate::tools::test::TestEvent; +use crate::tools::test::TestEventReceiver; +use crate::tools::test::TestFailureFormatOptions; + fn comment_source_to_position_range( comment_start: SourcePos, m: &Match, diff --git a/cli/tools/run/hmr.rs b/cli/tools/run/hmr.rs index 373c207d69..9f19aea015 100644 --- a/cli/tools/run/hmr.rs +++ b/cli/tools/run/hmr.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::path::PathBuf; diff --git a/cli/tools/run/mod.rs b/cli/tools/run/mod.rs index cd7d1dd6c4..a10ce32947 100644 --- a/cli/tools/run/mod.rs +++ b/cli/tools/run/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::io::Read; use std::sync::Arc; diff --git a/cli/tools/serve.rs b/cli/tools/serve.rs index d7989140ae..18eac1b3e1 100644 --- a/cli/tools/serve.rs +++ b/cli/tools/serve.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::Arc; diff --git a/cli/tools/task.rs b/cli/tools/task.rs index 740b0ce843..85834a0bfc 100644 --- a/cli/tools/task.rs +++ b/cli/tools/task.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::collections::HashSet; @@ -25,7 +25,6 @@ use deno_core::futures::FutureExt; use deno_core::futures::StreamExt; use deno_core::url::Url; use deno_path_util::normalize_path; -use deno_runtime::deno_node::NodeResolver; use deno_task_shell::KillSignal; use deno_task_shell::ShellCommand; use indexmap::IndexMap; @@ -36,6 +35,7 @@ use crate::args::Flags; use crate::args::TaskFlags; use crate::colors; use crate::factory::CliFactory; +use crate::node::CliNodeResolver; use crate::npm::CliNpmResolver; use crate::task_runner; use crate::task_runner::run_future_forwarding_signals; @@ -267,7 +267,7 @@ struct RunSingleOptions<'a> { struct TaskRunner<'a> { task_flags: &'a TaskFlags, npm_resolver: &'a dyn CliNpmResolver, - node_resolver: &'a NodeResolver, + node_resolver: &'a CliNodeResolver, env_vars: HashMap, cli_options: &'a CliOptions, concurrency: usize, diff --git a/cli/tools/test/channel.rs b/cli/tools/test/channel.rs index 9a003f2d5d..29f24d65f1 100644 --- a/cli/tools/test/channel.rs +++ b/cli/tools/test/channel.rs @@ -1,15 +1,5 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::TestEvent; -use deno_core::futures::future::poll_fn; -use deno_core::parking_lot; -use deno_core::parking_lot::lock_api::RawMutex; -use deno_core::parking_lot::lock_api::RawMutexTimed; -use deno_runtime::deno_io::pipe; -use deno_runtime::deno_io::AsyncPipeRead; -use deno_runtime::deno_io::PipeRead; -use deno_runtime::deno_io::PipeWrite; -use memmem::Searcher; use std::fmt::Display; use std::future::Future; use std::io::Write; @@ -19,6 +9,16 @@ use std::sync::atomic::Ordering; use std::task::ready; use std::task::Poll; use std::time::Duration; + +use deno_core::futures::future::poll_fn; +use deno_core::parking_lot; +use deno_core::parking_lot::lock_api::RawMutex; +use deno_core::parking_lot::lock_api::RawMutexTimed; +use deno_runtime::deno_io::pipe; +use deno_runtime::deno_io::AsyncPipeRead; +use deno_runtime::deno_io::PipeRead; +use deno_runtime::deno_io::PipeWrite; +use memmem::Searcher; use tokio::io::AsyncRead; use tokio::io::AsyncReadExt; use tokio::io::ReadBuf; @@ -27,6 +27,8 @@ use tokio::sync::mpsc::UnboundedReceiver; use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::WeakUnboundedSender; +use super::TestEvent; + /// 8-byte sync marker that is unlikely to appear in normal output. Equivalent /// to the string `"\u{200B}\0\u{200B}\0"`. const SYNC_MARKER: &[u8; 8] = &[226, 128, 139, 0, 226, 128, 139, 0]; @@ -437,11 +439,12 @@ impl TestEventSender { #[allow(clippy::print_stderr)] #[cfg(test)] mod tests { - use super::*; - use crate::tools::test::TestResult; use deno_core::unsync::spawn; use deno_core::unsync::spawn_blocking; + use super::*; + use crate::tools::test::TestResult; + /// Test that output is correctly interleaved with messages. #[tokio::test] async fn spawn_worker() { diff --git a/cli/tools/test/fmt.rs b/cli/tools/test/fmt.rs index 0f6a9ed2b4..e5b40b874b 100644 --- a/cli/tools/test/fmt.rs +++ b/cli/tools/test/fmt.rs @@ -1,16 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::ops::AddAssign; use deno_core::stats::RuntimeActivity; use deno_core::stats::RuntimeActivityDiff; use deno_core::stats::RuntimeActivityTrace; use deno_core::stats::RuntimeActivityType; use phf::phf_map; -use std::borrow::Cow; -use std::ops::AddAssign; - -use crate::util::path::to_percent_decoded_str; use super::*; +use crate::util::path::to_percent_decoded_str; pub fn to_relative_path_or_remote_url(cwd: &Url, path_or_url: &str) -> String { let Ok(url) = Url::parse(path_or_url) else { diff --git a/cli/tools/test/mod.rs b/cli/tools/test/mod.rs index 8d8aaa659b..f6e335904e 100644 --- a/cli/tools/test/mod.rs +++ b/cli/tools/test/mod.rs @@ -1,23 +1,25 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::args::CliOptions; -use crate::args::Flags; -use crate::args::TestFlags; -use crate::args::TestReporterConfig; -use crate::colors; -use crate::display; -use crate::factory::SpecifierInfo; -use crate::factory::WorkspaceFilesFactory; -use crate::file_fetcher::CliFileFetcher; -use crate::ops; -use crate::util::extract::extract_doc_tests; -use crate::util::file_watcher; -use crate::util::fs::collect_specifiers; -use crate::util::path::get_extension; -use crate::util::path::is_script_ext; -use crate::util::path::matches_pattern_or_exact_path; -use crate::worker::CliMainWorkerFactory; -use crate::worker::CoverageCollector; +use std::borrow::Cow; +use std::cell::RefCell; +use std::collections::BTreeMap; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::collections::HashSet; +use std::env; +use std::fmt::Write as _; +use std::future::poll_fn; +use std::io::Write; +use std::num::NonZeroUsize; +use std::path::Path; +use std::path::PathBuf; +use std::sync::atomic::AtomicBool; +use std::sync::atomic::AtomicUsize; +use std::sync::atomic::Ordering; +use std::sync::Arc; +use std::task::Poll; +use std::time::Duration; +use std::time::Instant; use deno_ast::MediaType; use deno_config::glob::FilePatterns; @@ -63,28 +65,28 @@ use rand::seq::SliceRandom; use rand::SeedableRng; use regex::Regex; use serde::Deserialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::collections::BTreeMap; -use std::collections::BTreeSet; -use std::collections::HashMap; -use std::collections::HashSet; -use std::env; -use std::fmt::Write as _; -use std::future::poll_fn; -use std::io::Write; -use std::num::NonZeroUsize; -use std::path::Path; -use std::path::PathBuf; -use std::sync::atomic::AtomicBool; -use std::sync::atomic::AtomicUsize; -use std::sync::atomic::Ordering; -use std::sync::Arc; -use std::task::Poll; -use std::time::Duration; -use std::time::Instant; use tokio::signal; +use crate::args::CliOptions; +use crate::args::Flags; +use crate::args::TestFlags; +use crate::args::TestReporterConfig; +use crate::colors; +use crate::display; +use crate::factory::SpecifierInfo; +use crate::factory::WorkspaceFilesFactory; +use crate::file_fetcher::CliFileFetcher; +use crate::ops; +use crate::sys::CliSys; +use crate::util::extract::extract_doc_tests; +use crate::util::file_watcher; +use crate::util::fs::collect_specifiers; +use crate::util::path::get_extension; +use crate::util::path::is_script_ext; +use crate::util::path::matches_pattern_or_exact_path; +use crate::worker::CliMainWorkerFactory; +use crate::worker::CoverageCollector; + mod channel; pub mod fmt; pub mod reporters; @@ -1501,7 +1503,7 @@ pub async fn run_tests( test_flags: TestFlags, ) -> Result<(), AnyError> { let log_level = flags.log_level; - let cli_options = CliOptions::from_flags(flags)?; + let cli_options = CliOptions::from_flags(&CliSys::default(), flags)?; let workspace_dirs_with_files = cli_options .resolve_test_options_for_members(&test_flags)? .into_iter() @@ -1596,7 +1598,7 @@ pub async fn run_tests_with_watch( watcher_communicator.show_path_changed(changed_paths.clone()); Ok(async move { let log_level = flags.log_level; - let cli_options = CliOptions::from_flags(flags)?; + let cli_options = CliOptions::from_flags(&CliSys::default(), flags)?; let workspace_dirs_with_files = cli_options .resolve_test_options_for_members(&test_flags)? .into_iter() diff --git a/cli/tools/test/reporters/common.rs b/cli/tools/test/reporters/common.rs index 7ca83db809..2db6a36464 100644 --- a/cli/tools/test/reporters/common.rs +++ b/cli/tools/test/reporters/common.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use super::fmt::format_test_error; use super::fmt::to_relative_path_or_remote_url; diff --git a/cli/tools/test/reporters/compound.rs b/cli/tools/test/reporters/compound.rs index 3ab7297db5..e381dd0977 100644 --- a/cli/tools/test/reporters/compound.rs +++ b/cli/tools/test/reporters/compound.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use super::*; diff --git a/cli/tools/test/reporters/dot.rs b/cli/tools/test/reporters/dot.rs index 169c4b0e72..0912858431 100644 --- a/cli/tools/test/reporters/dot.rs +++ b/cli/tools/test/reporters/dot.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use super::common; use super::fmt::to_relative_path_or_remote_url; diff --git a/cli/tools/test/reporters/junit.rs b/cli/tools/test/reporters/junit.rs index 3998bee40d..42ced07600 100644 --- a/cli/tools/test/reporters/junit.rs +++ b/cli/tools/test/reporters/junit.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::VecDeque; use std::path::PathBuf; diff --git a/cli/tools/test/reporters/mod.rs b/cli/tools/test/reporters/mod.rs index 07351e9c3b..ef2b00b776 100644 --- a/cli/tools/test/reporters/mod.rs +++ b/cli/tools/test/reporters/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use super::*; diff --git a/cli/tools/test/reporters/pretty.rs b/cli/tools/test/reporters/pretty.rs index 4120bbfb54..3419fdea59 100644 --- a/cli/tools/test/reporters/pretty.rs +++ b/cli/tools/test/reporters/pretty.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use super::common; use super::fmt::to_relative_path_or_remote_url; diff --git a/cli/tools/test/reporters/tap.rs b/cli/tools/test/reporters/tap.rs index ea68ddd43a..c36df25756 100644 --- a/cli/tools/test/reporters/tap.rs +++ b/cli/tools/test/reporters/tap.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::serde_json::json; use deno_core::serde_json::{self}; diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index b3d7618be9..521c3217fe 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -1,7 +1,28 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! This module provides feature to upgrade deno executable +use std::borrow::Cow; +use std::env; +use std::fs; +use std::io::IsTerminal; +use std::ops::Sub; +use std::path::Path; +use std::path::PathBuf; +use std::process::Command; +use std::sync::Arc; +use std::time::Duration; + +use async_trait::async_trait; +use deno_core::anyhow::bail; +use deno_core::anyhow::Context; +use deno_core::error::AnyError; +use deno_core::unsync::spawn; +use deno_core::url::Url; +use deno_semver::SmallStackString; +use deno_semver::Version; +use once_cell::sync::Lazy; + use crate::args::Flags; use crate::args::UpgradeFlags; use crate::args::UPGRADE_USAGE; @@ -15,26 +36,6 @@ use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; use crate::version; -use async_trait::async_trait; -use deno_core::anyhow::bail; -use deno_core::anyhow::Context; -use deno_core::error::AnyError; -use deno_core::unsync::spawn; -use deno_core::url::Url; -use deno_semver::SmallStackString; -use deno_semver::Version; -use once_cell::sync::Lazy; -use std::borrow::Cow; -use std::env; -use std::fs; -use std::io::IsTerminal; -use std::ops::Sub; -use std::path::Path; -use std::path::PathBuf; -use std::process::Command; -use std::sync::Arc; -use std::time::Duration; - const RELEASE_URL: &str = "https://github.com/denoland/deno/releases"; const CANARY_URL: &str = "https://dl.deno.land/canary"; const DL_RELEASE_URL: &str = "https://dl.deno.land/release"; diff --git a/cli/tsc/00_typescript.js b/cli/tsc/00_typescript.js index 7d20f92367..b7626fe082 100644 --- a/cli/tsc/00_typescript.js +++ b/cli/tsc/00_typescript.js @@ -136063,6 +136063,7 @@ var unprefixedNodeCoreModuleList = [ "https", "http2", "inspector", + "inspector/promises", "module", "net", "os", diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index f7862c95e4..d532de265f 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/cli/tsc/_analyze_types_node.ts b/cli/tsc/_analyze_types_node.ts index 10af00ee83..1a77b6c547 100755 --- a/cli/tsc/_analyze_types_node.ts +++ b/cli/tsc/_analyze_types_node.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --allow-env --allow-read --allow-write=. -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { ModuleDeclarationKind, Node, diff --git a/cli/tsc/compiler.d.ts b/cli/tsc/compiler.d.ts index 428e4d1ed8..0389527f5b 100644 --- a/cli/tsc/compiler.d.ts +++ b/cli/tsc/compiler.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Contains types that can be used to validate and check `99_main_compiler.js` diff --git a/cli/tsc/diagnostics.rs b/cli/tsc/diagnostics.rs index d9d396c7ba..3e97c53956 100644 --- a/cli/tsc/diagnostics.rs +++ b/cli/tsc/diagnostics.rs @@ -1,16 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::error::Error; +use std::fmt; use deno_ast::ModuleSpecifier; -use deno_graph::ModuleGraph; -use deno_terminal::colors; - use deno_core::serde::Deserialize; use deno_core::serde::Deserializer; use deno_core::serde::Serialize; use deno_core::serde::Serializer; use deno_core::sourcemap::SourceMap; -use std::error::Error; -use std::fmt; +use deno_graph::ModuleGraph; +use deno_terminal::colors; const MAX_SOURCE_LINE_LENGTH: usize = 150; @@ -401,11 +401,12 @@ impl Error for Diagnostics {} #[cfg(test)] mod tests { - use super::*; use deno_core::serde_json; use deno_core::serde_json::json; use test_util::strip_ansi_codes; + use super::*; + #[test] fn test_de_diagnostics() { let value = json!([ diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index d9f66f11a7..e98f68ea38 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// /// diff --git a/cli/tsc/dts/lib.deno.shared_globals.d.ts b/cli/tsc/dts/lib.deno.shared_globals.d.ts index 96790fb665..a469525270 100644 --- a/cli/tsc/dts/lib.deno.shared_globals.d.ts +++ b/cli/tsc/dts/lib.deno.shared_globals.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Documentation partially adapted from [MDN](https://developer.mozilla.org/), // by Mozilla Contributors, which is licensed under CC-BY-SA 2.5. diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts index 6759856e6a..d207a92041 100644 --- a/cli/tsc/dts/lib.deno.unstable.d.ts +++ b/cli/tsc/dts/lib.deno.unstable.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// /// diff --git a/cli/tsc/dts/lib.deno.window.d.ts b/cli/tsc/dts/lib.deno.window.d.ts index 636e2b0fd0..8a516beaf6 100644 --- a/cli/tsc/dts/lib.deno.window.d.ts +++ b/cli/tsc/dts/lib.deno.window.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// /// diff --git a/cli/tsc/dts/lib.deno.worker.d.ts b/cli/tsc/dts/lib.deno.worker.d.ts index fa69cc57d6..c309417031 100644 --- a/cli/tsc/dts/lib.deno.worker.d.ts +++ b/cli/tsc/dts/lib.deno.worker.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// /// diff --git a/cli/tsc/dts/lib.deno_webgpu.d.ts b/cli/tsc/dts/lib.deno_webgpu.d.ts index 2deb63abc7..6dbfc57768 100644 --- a/cli/tsc/dts/lib.deno_webgpu.d.ts +++ b/cli/tsc/dts/lib.deno_webgpu.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any no-empty-interface diff --git a/cli/tsc/dts/lib.dom.extras.d.ts b/cli/tsc/dts/lib.dom.extras.d.ts index a6de789f56..3a1667a99c 100644 --- a/cli/tsc/dts/lib.dom.extras.d.ts +++ b/cli/tsc/dts/lib.dom.extras.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /* * This library contains DOM standards that are not currently included in the diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index 26cf385734..9f1dc3653a 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -1,14 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::args::TsConfig; -use crate::args::TypeCheckMode; -use crate::cache::FastInsecureHasher; -use crate::cache::ModuleInfoCache; -use crate::npm::CliNpmResolver; -use crate::resolver::CjsTracker; -use crate::util::checksum; -use crate::util::path::mapped_specifier_for_tsc; -use crate::worker::create_isolate_create_params; +use std::borrow::Cow; +use std::collections::HashMap; +use std::fmt; +use std::path::Path; +use std::path::PathBuf; +use std::sync::Arc; use deno_ast::MediaType; use deno_core::anyhow::anyhow; @@ -34,8 +31,6 @@ use deno_graph::Module; use deno_graph::ModuleGraph; use deno_graph::ResolutionResolved; use deno_resolver::npm::ResolvePkgFolderFromDenoReqError; -use deno_runtime::deno_fs::FsSysTraitsAdapter; -use deno_runtime::deno_node::NodeResolver; use deno_semver::npm::NpmPackageReqReference; use node_resolver::errors::NodeJsErrorCode; use node_resolver::errors::NodeJsErrorCoded; @@ -44,14 +39,20 @@ use node_resolver::resolve_specifier_into_node_modules; use node_resolver::NodeResolutionKind; use node_resolver::ResolutionMode; use once_cell::sync::Lazy; -use std::borrow::Cow; -use std::collections::HashMap; -use std::fmt; -use std::path::Path; -use std::path::PathBuf; -use std::sync::Arc; use thiserror::Error; +use crate::args::TsConfig; +use crate::args::TypeCheckMode; +use crate::cache::FastInsecureHasher; +use crate::cache::ModuleInfoCache; +use crate::node::CliNodeResolver; +use crate::npm::CliNpmResolver; +use crate::resolver::CjsTracker; +use crate::sys::CliSys; +use crate::util::checksum; +use crate::util::path::mapped_specifier_for_tsc; +use crate::worker::create_isolate_create_params; + mod diagnostics; pub use self::diagnostics::Diagnostic; @@ -380,7 +381,7 @@ impl TypeCheckingCjsTracker { #[derive(Debug)] pub struct RequestNpmState { pub cjs_tracker: Arc, - pub node_resolver: Arc, + pub node_resolver: Arc, pub npm_resolver: Arc, } @@ -661,7 +662,7 @@ fn op_load_inner( } else { // means it's Deno code importing an npm module let specifier = resolve_specifier_into_node_modules( - &FsSysTraitsAdapter::new_real(), + &CliSys::default(), &module.specifier, ); Some(Cow::Owned(load_from_node_modules( @@ -925,7 +926,7 @@ fn resolve_graph_specifier_types( // we currently only use "External" for when the module is in an npm package Ok(state.maybe_npm.as_ref().map(|_| { let specifier = resolve_specifier_into_node_modules( - &FsSysTraitsAdapter::new_real(), + &CliSys::default(), &module.specifier, ); into_specifier_and_media_type(Some(specifier)) @@ -1136,10 +1137,6 @@ pub fn exec(request: Request) -> Result { #[cfg(test)] mod tests { - use super::Diagnostic; - use super::DiagnosticCategory; - use super::*; - use crate::args::TsConfig; use deno_core::futures::future; use deno_core::serde_json; use deno_core::OpState; @@ -1147,6 +1144,11 @@ mod tests { use deno_graph::ModuleGraph; use test_util::PathRef; + use super::Diagnostic; + use super::DiagnosticCategory; + use super::*; + use crate::args::TsConfig; + #[derive(Debug, Default)] pub struct MockLoader { pub fixtures: PathRef, diff --git a/cli/util/archive.rs b/cli/util/archive.rs index e2183d57ab..e3efd69adb 100644 --- a/cli/util/archive.rs +++ b/cli/util/archive.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::fs; use std::path::Path; diff --git a/cli/util/checksum.rs b/cli/util/checksum.rs index c9c55ec2b4..b15380abd7 100644 --- a/cli/util/checksum.rs +++ b/cli/util/checksum.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use ring::digest::Context; use ring::digest::SHA256; diff --git a/cli/util/console.rs b/cli/util/console.rs index 74e6928a28..d22d41f5ea 100644 --- a/cli/util/console.rs +++ b/cli/util/console.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_runtime::ops::tty::ConsoleSize; diff --git a/cli/util/diff.rs b/cli/util/diff.rs index 14ece0c44c..a42da3a89a 100644 --- a/cli/util/diff.rs +++ b/cli/util/diff.rs @@ -1,9 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::fmt::Write as _; -use crate::colors; use dissimilar::diff as difference; use dissimilar::Chunk; -use std::fmt::Write as _; + +use crate::colors; /// Print diff of the same file_path, before and after formatting. /// diff --git a/cli/util/display.rs b/cli/util/display.rs index 8795d3db68..dff08f31fa 100644 --- a/cli/util/display.rs +++ b/cli/util/display.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::io::Write; use deno_core::error::AnyError; use deno_core::serde_json; use deno_runtime::colors; -use std::io::Write; /// A function that converts a float to a string the represents a human /// readable version of that number. diff --git a/cli/util/draw_thread.rs b/cli/util/draw_thread.rs index 164a8fc713..a2d7681425 100644 --- a/cli/util/draw_thread.rs +++ b/cli/util/draw_thread.rs @@ -1,13 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::io::IsTerminal; +use std::sync::Arc; +use std::time::Duration; use console_static_text::ConsoleStaticText; use deno_core::parking_lot::Mutex; use deno_core::unsync::spawn_blocking; use deno_runtime::ops::tty::ConsoleSize; use once_cell::sync::Lazy; -use std::io::IsTerminal; -use std::sync::Arc; -use std::time::Duration; use crate::util::console::console_size; diff --git a/cli/util/extract.rs b/cli/util/extract.rs index c4562060d8..825e81bb4b 100644 --- a/cli/util/extract.rs +++ b/cli/util/extract.rs @@ -1,4 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::BTreeSet; +use std::fmt::Write as _; +use std::sync::Arc; use deno_ast::swc::ast; use deno_ast::swc::atoms::Atom; @@ -17,9 +21,6 @@ use deno_cache_dir::file_fetcher::File; use deno_core::error::AnyError; use deno_core::ModuleSpecifier; use regex::Regex; -use std::collections::BTreeSet; -use std::fmt::Write as _; -use std::sync::Arc; use crate::file_fetcher::TextDecodedFile; use crate::util::path::mapped_specifier_for_tsc; @@ -808,11 +809,12 @@ fn wrap_in_deno_test(stmts: Vec, test_name: Atom) -> ast::Stmt { #[cfg(test)] mod tests { - use super::*; - use crate::file_fetcher::TextDecodedFile; use deno_ast::swc::atoms::Atom; use pretty_assertions::assert_eq; + use super::*; + use crate::file_fetcher::TextDecodedFile; + #[test] fn test_extract_doc_tests() { struct Input { diff --git a/cli/util/file_watcher.rs b/cli/util/file_watcher.rs index b9318a6e4b..ca769b70fe 100644 --- a/cli/util/file_watcher.rs +++ b/cli/util/file_watcher.rs @@ -1,8 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::args::Flags; -use crate::colors; -use crate::util::fs::canonicalize_path; +use std::cell::RefCell; +use std::collections::HashSet; +use std::io::IsTerminal; +use std::path::PathBuf; +use std::rc::Rc; +use std::sync::Arc; +use std::time::Duration; use deno_config::glob::PathOrPatternSet; use deno_core::error::AnyError; @@ -18,18 +22,15 @@ use notify::Error as NotifyError; use notify::RecommendedWatcher; use notify::RecursiveMode; use notify::Watcher; -use std::cell::RefCell; -use std::collections::HashSet; -use std::io::IsTerminal; -use std::path::PathBuf; -use std::rc::Rc; -use std::sync::Arc; -use std::time::Duration; use tokio::select; use tokio::sync::mpsc; use tokio::sync::mpsc::UnboundedReceiver; use tokio::time::sleep; +use crate::args::Flags; +use crate::colors; +use crate::util::fs::canonicalize_path; + const CLEAR_SCREEN: &str = "\x1B[H\x1B[2J\x1B[3J"; const DEBOUNCE_INTERVAL: Duration = Duration::from_millis(200); diff --git a/cli/util/fs.rs b/cli/util/fs.rs index 58b5fc72c6..396e5dc146 100644 --- a/cli/util/fs.rs +++ b/cli/util/fs.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::io::Error; use std::io::ErrorKind; @@ -17,8 +17,8 @@ use deno_core::anyhow::Context; use deno_core::error::AnyError; use deno_core::unsync::spawn_blocking; use deno_core::ModuleSpecifier; -use deno_runtime::deno_fs::FsSysTraitsAdapter; +use crate::sys::CliSys; use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; use crate::util::progress_bar::ProgressMessagePrompt; @@ -76,7 +76,7 @@ pub fn canonicalize_path_maybe_not_exists( path: &Path, ) -> Result { deno_path_util::fs::canonicalize_path_maybe_not_exists( - &FsSysTraitsAdapter::new_real(), + &CliSys::default(), path, ) } @@ -126,7 +126,7 @@ pub fn collect_specifiers( .ignore_git_folder() .ignore_node_modules() .set_vendor_folder(vendor_folder) - .collect_file_patterns(&FsSysTraitsAdapter::new_real(), files)?; + .collect_file_patterns(&CliSys::default(), files)?; let mut collected_files_as_urls = collected_files .iter() .map(|f| specifier_from_file_path(f).unwrap()) @@ -152,10 +152,12 @@ mod clone_dir_imp { #[cfg(target_vendor = "apple")] mod apple { - use super::super::copy_dir_recursive; - use deno_core::error::AnyError; use std::os::unix::ffi::OsStrExt; use std::path::Path; + + use deno_core::error::AnyError; + + use super::super::copy_dir_recursive; fn clonefile(from: &Path, to: &Path) -> std::io::Result<()> { let from = std::ffi::CString::new(from.as_os_str().as_bytes())?; let to = std::ffi::CString::new(to.as_os_str().as_bytes())?; @@ -198,13 +200,11 @@ mod clone_dir_imp { from: &std::path::Path, to: &std::path::Path, ) -> Result<(), deno_core::error::AnyError> { - use deno_runtime::deno_fs::FsSysTraitsAdapter; + use crate::sys::CliSys; - if let Err(e) = deno_npm_cache::hard_link_dir_recursive( - &FsSysTraitsAdapter::new_real(), - from, - to, - ) { + if let Err(e) = + deno_npm_cache::hard_link_dir_recursive(&CliSys::default(), from, to) + { log::debug!("Failed to hard link dir {:?} to {:?}: {}", from, to, e); super::copy_dir_recursive(from, to)?; } @@ -464,7 +464,6 @@ pub fn specifier_from_file_path( #[cfg(test)] mod tests { - use super::*; use deno_core::futures; use deno_core::parking_lot::Mutex; use deno_path_util::normalize_path; @@ -473,6 +472,8 @@ mod tests { use test_util::TempDir; use tokio::sync::Notify; + use super::*; + #[test] fn test_normalize_path() { assert_eq!(normalize_path(Path::new("a/../b")), PathBuf::from("b")); diff --git a/cli/util/logger.rs b/cli/util/logger.rs index 783f8a5f68..2bd4760ebd 100644 --- a/cli/util/logger.rs +++ b/cli/util/logger.rs @@ -1,9 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::io::Write; -use super::draw_thread::DrawThread; use deno_telemetry::OtelConfig; use deno_telemetry::OtelConsoleConfig; -use std::io::Write; + +use super::draw_thread::DrawThread; struct CliLogger { otel_console_config: OtelConsoleConfig, diff --git a/cli/util/mod.rs b/cli/util/mod.rs index f81a74c449..0578ecb423 100644 --- a/cli/util/mod.rs +++ b/cli/util/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Note: Only add code in this folder that has no application specific logic pub mod archive; diff --git a/cli/util/path.rs b/cli/util/path.rs index 539e1235a8..90b2df6a3c 100644 --- a/cli/util/path.rs +++ b/cli/util/path.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::path::Path; diff --git a/cli/util/progress_bar/mod.rs b/cli/util/progress_bar/mod.rs index 85be056d84..3b5bb20e55 100644 --- a/cli/util/progress_bar/mod.rs +++ b/cli/util/progress_bar/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::atomic::AtomicU64; use std::sync::atomic::Ordering; @@ -8,15 +8,13 @@ use std::time::Instant; use deno_core::parking_lot::Mutex; use deno_runtime::ops::tty::ConsoleSize; -use crate::colors; - use self::renderer::ProgressBarRenderer; use self::renderer::ProgressData; use self::renderer::ProgressDataDisplayEntry; - use super::draw_thread::DrawThread; use super::draw_thread::DrawThreadGuard; use super::draw_thread::DrawThreadRenderer; +use crate::colors; mod renderer; diff --git a/cli/util/progress_bar/renderer.rs b/cli/util/progress_bar/renderer.rs index db3d37140f..3498c7ae0f 100644 --- a/cli/util/progress_bar/renderer.rs +++ b/cli/util/progress_bar/renderer.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::fmt::Write; use std::sync::atomic::AtomicUsize; @@ -7,9 +7,8 @@ use std::time::Duration; use deno_terminal::colors; -use crate::util::display::human_download_size; - use super::ProgressMessagePrompt; +use crate::util::display::human_download_size; #[derive(Clone)] pub struct ProgressDataDisplayEntry { @@ -224,11 +223,13 @@ fn get_elapsed_text(elapsed: Duration) -> String { #[cfg(test)] mod test { - use super::*; - use pretty_assertions::assert_eq; use std::time::Duration; + + use pretty_assertions::assert_eq; use test_util::assert_contains; + use super::*; + #[test] fn should_get_elapsed_text() { assert_eq!(get_elapsed_text(Duration::from_secs(1)), "[00:01]"); diff --git a/cli/util/result.rs b/cli/util/result.rs index 3203d04eb7..6a67416f26 100644 --- a/cli/util/result.rs +++ b/cli/util/result.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::convert::Infallible; diff --git a/cli/util/retry.rs b/cli/util/retry.rs index a8febe60de..ac36a380ed 100644 --- a/cli/util/retry.rs +++ b/cli/util/retry.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::future::Future; use std::time::Duration; diff --git a/cli/util/sync/async_flag.rs b/cli/util/sync/async_flag.rs index 2bdff63c04..a9ca46002d 100644 --- a/cli/util/sync/async_flag.rs +++ b/cli/util/sync/async_flag.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use tokio_util::sync::CancellationToken; diff --git a/cli/util/sync/mod.rs b/cli/util/sync/mod.rs index c3b2a315b0..74ec469533 100644 --- a/cli/util/sync/mod.rs +++ b/cli/util/sync/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod async_flag; mod sync_read_async_write_lock; diff --git a/cli/util/sync/sync_read_async_write_lock.rs b/cli/util/sync/sync_read_async_write_lock.rs index 8bd211aa72..48ad6bb863 100644 --- a/cli/util/sync/sync_read_async_write_lock.rs +++ b/cli/util/sync/sync_read_async_write_lock.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::parking_lot::RwLock; use deno_core::parking_lot::RwLockReadGuard; diff --git a/cli/util/sync/task_queue.rs b/cli/util/sync/task_queue.rs index 6ef747e1ae..4c5abfab3b 100644 --- a/cli/util/sync/task_queue.rs +++ b/cli/util/sync/task_queue.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::LinkedList; use std::sync::Arc; @@ -146,9 +146,10 @@ impl<'a> Future for TaskQueuePermitAcquireFuture<'a> { #[cfg(test)] mod test { + use std::sync::Arc; + use deno_core::futures; use deno_core::parking_lot::Mutex; - use std::sync::Arc; use super::*; diff --git a/cli/util/text_encoding.rs b/cli/util/text_encoding.rs index 107b78a213..b5a288be7b 100644 --- a/cli/util/text_encoding.rs +++ b/cli/util/text_encoding.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::ops::Range; diff --git a/cli/util/unix.rs b/cli/util/unix.rs index 2c76a54c38..4b6ac1f320 100644 --- a/cli/util/unix.rs +++ b/cli/util/unix.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// Raise soft file descriptor limit to hard file descriptor limit. /// This is the difference between `ulimit -n` and `ulimit -n -H`. diff --git a/cli/util/v8.rs b/cli/util/v8.rs index 6e690e6f30..403d1955a5 100644 --- a/cli/util/v8.rs +++ b/cli/util/v8.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub mod convert; diff --git a/cli/util/v8/convert.rs b/cli/util/v8/convert.rs index 28107d9010..4d0cb732a8 100644 --- a/cli/util/v8/convert.rs +++ b/cli/util/v8/convert.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::v8; use deno_core::FromV8; diff --git a/cli/util/windows.rs b/cli/util/windows.rs index 37e78a5d08..7f516efbeb 100644 --- a/cli/util/windows.rs +++ b/cli/util/windows.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// Ensures that stdin, stdout, and stderr are open and have valid HANDLEs /// associated with them. There are many places where a `std::fs::File` is @@ -8,6 +8,7 @@ pub fn ensure_stdio_open() { // SAFETY: winapi calls unsafe { use std::mem::size_of; + use winapi::shared::minwindef::DWORD; use winapi::shared::minwindef::FALSE; use winapi::shared::minwindef::TRUE; diff --git a/cli/version.rs b/cli/version.rs index 0cdb32102a..fb0fe98b29 100644 --- a/cli/version.rs +++ b/cli/version.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use once_cell::sync::Lazy; diff --git a/cli/worker.rs b/cli/worker.rs index 7653e72b75..6289d00cf8 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::path::Path; use std::path::PathBuf; @@ -23,8 +23,6 @@ use deno_runtime::deno_fs; use deno_runtime::deno_node::NodeExtInitServices; use deno_runtime::deno_node::NodeRequireLoader; use deno_runtime::deno_node::NodeRequireLoaderRc; -use deno_runtime::deno_node::NodeResolver; -use deno_runtime::deno_node::PackageJsonResolver; use deno_runtime::deno_permissions::PermissionsContainer; use deno_runtime::deno_tls::RootCertStoreProvider; use deno_runtime::deno_web::BlobStore; @@ -53,7 +51,10 @@ use crate::args::DenoSubcommand; use crate::args::NpmCachingStrategy; use crate::args::StorageKeyResolver; use crate::errors; +use crate::node::CliNodeResolver; +use crate::node::CliPackageJsonResolver; use crate::npm::CliNpmResolver; +use crate::sys::CliSys; use crate::util::checksum; use crate::util::file_watcher::WatcherCommunicator; use crate::util::file_watcher::WatcherRestartMode; @@ -145,13 +146,14 @@ struct SharedWorkerState { maybe_inspector_server: Option>, maybe_lockfile: Option>, module_loader_factory: Box, - node_resolver: Arc, + node_resolver: Arc, npm_resolver: Arc, - pkg_json_resolver: Arc, + pkg_json_resolver: Arc, root_cert_store_provider: Arc, root_permissions: PermissionsContainer, shared_array_buffer_store: SharedArrayBufferStore, storage_key_resolver: StorageKeyResolver, + sys: CliSys, options: CliMainWorkerOptions, subcommand: DenoSubcommand, otel_config: OtelConfig, @@ -162,12 +164,13 @@ impl SharedWorkerState { pub fn create_node_init_services( &self, node_require_loader: NodeRequireLoaderRc, - ) -> NodeExtInitServices { + ) -> NodeExtInitServices { NodeExtInitServices { node_require_loader, node_resolver: self.node_resolver.clone(), npm_resolver: self.npm_resolver.clone().into_npm_pkg_folder_resolver(), pkg_json_resolver: self.pkg_json_resolver.clone(), + sys: self.sys.clone(), } } @@ -418,12 +421,13 @@ impl CliMainWorkerFactory { maybe_inspector_server: Option>, maybe_lockfile: Option>, module_loader_factory: Box, - node_resolver: Arc, + node_resolver: Arc, npm_resolver: Arc, - pkg_json_resolver: Arc, + pkg_json_resolver: Arc, root_cert_store_provider: Arc, root_permissions: PermissionsContainer, storage_key_resolver: StorageKeyResolver, + sys: CliSys, subcommand: DenoSubcommand, options: CliMainWorkerOptions, otel_config: OtelConfig, @@ -448,6 +452,7 @@ impl CliMainWorkerFactory { root_permissions, shared_array_buffer_store: Default::default(), storage_key_resolver, + sys, options, subcommand, otel_config, @@ -858,25 +863,27 @@ pub fn create_isolate_create_params() -> Option { #[allow(clippy::print_stderr)] #[cfg(test)] mod tests { - use super::*; use deno_core::resolve_path; use deno_core::FsModuleLoader; use deno_fs::RealFs; use deno_runtime::deno_permissions::Permissions; use deno_runtime::permissions::RuntimePermissionDescriptorParser; + use super::*; + fn create_test_worker() -> MainWorker { let main_module = resolve_path("./hello.js", &std::env::current_dir().unwrap()).unwrap(); let fs = Arc::new(RealFs); - let permission_desc_parser = - Arc::new(RuntimePermissionDescriptorParser::new(fs.clone())); + let permission_desc_parser = Arc::new( + RuntimePermissionDescriptorParser::new(crate::sys::CliSys::default()), + ); let options = WorkerOptions { startup_snapshot: crate::js::deno_isolate_init(), ..Default::default() }; - MainWorker::bootstrap_from_options( + MainWorker::bootstrap_from_options::( main_module, WorkerServiceOptions { module_loader: Rc::new(FsModuleLoader), diff --git a/ext/broadcast_channel/01_broadcast_channel.js b/ext/broadcast_channel/01_broadcast_channel.js index 1a4bb36474..a71ae465cf 100644 --- a/ext/broadcast_channel/01_broadcast_channel.js +++ b/ext/broadcast_channel/01_broadcast_channel.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// diff --git a/ext/broadcast_channel/Cargo.toml b/ext/broadcast_channel/Cargo.toml index 4dea8f21e1..48b4127b0e 100644 --- a/ext/broadcast_channel/Cargo.toml +++ b/ext/broadcast_channel/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_broadcast_channel" diff --git a/ext/broadcast_channel/in_memory_broadcast_channel.rs b/ext/broadcast_channel/in_memory_broadcast_channel.rs index 61dc68e17d..33803c74f4 100644 --- a/ext/broadcast_channel/in_memory_broadcast_channel.rs +++ b/ext/broadcast_channel/in_memory_broadcast_channel.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::Arc; diff --git a/ext/broadcast_channel/lib.deno_broadcast_channel.d.ts b/ext/broadcast_channel/lib.deno_broadcast_channel.d.ts index 339765ec9c..a43f8609b9 100644 --- a/ext/broadcast_channel/lib.deno_broadcast_channel.d.ts +++ b/ext/broadcast_channel/lib.deno_broadcast_channel.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any no-var diff --git a/ext/broadcast_channel/lib.rs b/ext/broadcast_channel/lib.rs index c1de118a36..4929153bfe 100644 --- a/ext/broadcast_channel/lib.rs +++ b/ext/broadcast_channel/lib.rs @@ -1,10 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod in_memory_broadcast_channel; -pub use in_memory_broadcast_channel::InMemoryBroadcastChannel; -pub use in_memory_broadcast_channel::InMemoryBroadcastChannelResource; - use std::cell::RefCell; use std::path::PathBuf; use std::rc::Rc; @@ -15,6 +12,8 @@ use deno_core::JsBuffer; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; +pub use in_memory_broadcast_channel::InMemoryBroadcastChannel; +pub use in_memory_broadcast_channel::InMemoryBroadcastChannelResource; use tokio::sync::broadcast::error::SendError as BroadcastSendError; use tokio::sync::mpsc::error::SendError as MpscSendError; diff --git a/ext/cache/01_cache.js b/ext/cache/01_cache.js index 269261f401..55aac3a4d8 100644 --- a/ext/cache/01_cache.js +++ b/ext/cache/01_cache.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; import { op_cache_delete, diff --git a/ext/cache/Cargo.toml b/ext/cache/Cargo.toml index 96aec27576..cb4eef87df 100644 --- a/ext/cache/Cargo.toml +++ b/ext/cache/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_cache" diff --git a/ext/cache/lib.deno_cache.d.ts b/ext/cache/lib.deno_cache.d.ts index f9e1818482..9995af7f66 100644 --- a/ext/cache/lib.deno_cache.d.ts +++ b/ext/cache/lib.deno_cache.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-var diff --git a/ext/cache/lib.rs b/ext/cache/lib.rs index 524d4cea05..6ee7380cf0 100644 --- a/ext/cache/lib.rs +++ b/ext/cache/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::path::PathBuf; diff --git a/ext/cache/sqlite.rs b/ext/cache/sqlite.rs index 469e3e51d6..8bd73b4799 100644 --- a/ext/cache/sqlite.rs +++ b/ext/cache/sqlite.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::path::PathBuf; use std::pin::Pin; diff --git a/ext/canvas/01_image.js b/ext/canvas/01_image.js index 3ea72db6ac..4b39c041b4 100644 --- a/ext/canvas/01_image.js +++ b/ext/canvas/01_image.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { internals, primordials } from "ext:core/mod.js"; import { op_image_decode_png, op_image_process } from "ext:core/ops"; diff --git a/ext/canvas/Cargo.toml b/ext/canvas/Cargo.toml index 7c7cc49b7c..0bc3dcb8fb 100644 --- a/ext/canvas/Cargo.toml +++ b/ext/canvas/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_canvas" diff --git a/ext/canvas/lib.deno_canvas.d.ts b/ext/canvas/lib.deno_canvas.d.ts index c695ba5cd8..84d3cbdd42 100644 --- a/ext/canvas/lib.deno_canvas.d.ts +++ b/ext/canvas/lib.deno_canvas.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-var diff --git a/ext/canvas/lib.rs b/ext/canvas/lib.rs index defb288ac9..533b8c3fb3 100644 --- a/ext/canvas/lib.rs +++ b/ext/canvas/lib.rs @@ -1,4 +1,6 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::path::PathBuf; use deno_core::op2; use deno_core::ToJsBuffer; @@ -9,7 +11,6 @@ use image::Pixel; use image::RgbaImage; use serde::Deserialize; use serde::Serialize; -use std::path::PathBuf; #[derive(Debug, thiserror::Error)] pub enum CanvasError { diff --git a/ext/console/01_console.js b/ext/console/01_console.js index 3803492b90..a85faaccf1 100644 --- a/ext/console/01_console.js +++ b/ext/console/01_console.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// diff --git a/ext/console/Cargo.toml b/ext/console/Cargo.toml index f68dd7d198..b4811265ba 100644 --- a/ext/console/Cargo.toml +++ b/ext/console/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_console" diff --git a/ext/console/internal.d.ts b/ext/console/internal.d.ts index 5f9627cf56..e90c9b6f11 100644 --- a/ext/console/internal.d.ts +++ b/ext/console/internal.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// /// diff --git a/ext/console/lib.deno_console.d.ts b/ext/console/lib.deno_console.d.ts index 0c73972d36..54bbcab892 100644 --- a/ext/console/lib.deno_console.d.ts +++ b/ext/console/lib.deno_console.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any diff --git a/ext/console/lib.rs b/ext/console/lib.rs index 87fc8327da..48a75329af 100644 --- a/ext/console/lib.rs +++ b/ext/console/lib.rs @@ -1,7 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::path::PathBuf; + use deno_core::op2; use deno_core::v8; -use std::path::PathBuf; deno_core::extension!( deno_console, diff --git a/ext/cron/01_cron.ts b/ext/cron/01_cron.ts index b5c556a677..db193053d8 100644 --- a/ext/cron/01_cron.ts +++ b/ext/cron/01_cron.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, internals, primordials } from "ext:core/mod.js"; const { diff --git a/ext/cron/Cargo.toml b/ext/cron/Cargo.toml index 022a8418cf..821a2aa884 100644 --- a/ext/cron/Cargo.toml +++ b/ext/cron/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_cron" diff --git a/ext/cron/interface.rs b/ext/cron/interface.rs index a19525cc4e..f92d601796 100644 --- a/ext/cron/interface.rs +++ b/ext/cron/interface.rs @@ -1,7 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use async_trait::async_trait; use crate::CronError; -use async_trait::async_trait; pub trait CronHandler { type EH: CronHandle + 'static; diff --git a/ext/cron/lib.rs b/ext/cron/lib.rs index feffb5e511..2c8d534d54 100644 --- a/ext/cron/lib.rs +++ b/ext/cron/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod interface; pub mod local; @@ -7,13 +7,14 @@ use std::borrow::Cow; use std::cell::RefCell; use std::rc::Rc; -pub use crate::interface::*; use deno_core::error::get_custom_error_class; use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; +pub use crate::interface::*; + pub const UNSTABLE_FEATURE_NAME: &str = "cron"; deno_core::extension!(deno_cron, diff --git a/ext/cron/local.rs b/ext/cron/local.rs index 1110baadb8..d6213a7e36 100644 --- a/ext/cron/local.rs +++ b/ext/cron/local.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::OnceCell; use std::cell::RefCell; diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index 63b1905145..5a9f32cb00 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/crypto/Cargo.toml b/ext/crypto/Cargo.toml index c283cc9277..8f7fea28d7 100644 --- a/ext/crypto/Cargo.toml +++ b/ext/crypto/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_crypto" diff --git a/ext/crypto/decrypt.rs b/ext/crypto/decrypt.rs index 1140475183..8a00ffd8cd 100644 --- a/ext/crypto/decrypt.rs +++ b/ext/crypto/decrypt.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use aes::cipher::block_padding::Pkcs7; use aes::cipher::BlockDecryptMut; diff --git a/ext/crypto/ed25519.rs b/ext/crypto/ed25519.rs index da34b7d25d..d64b6904dd 100644 --- a/ext/crypto/ed25519.rs +++ b/ext/crypto/ed25519.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use base64::prelude::BASE64_URL_SAFE_NO_PAD; use base64::Engine; diff --git a/ext/crypto/encrypt.rs b/ext/crypto/encrypt.rs index 66b27657f8..f3464b5032 100644 --- a/ext/crypto/encrypt.rs +++ b/ext/crypto/encrypt.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use aes::cipher::block_padding::Pkcs7; use aes::cipher::BlockEncryptMut; diff --git a/ext/crypto/export_key.rs b/ext/crypto/export_key.rs index edf0d7239c..c4e41ef2da 100644 --- a/ext/crypto/export_key.rs +++ b/ext/crypto/export_key.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use base64::prelude::BASE64_URL_SAFE_NO_PAD; use base64::Engine; diff --git a/ext/crypto/generate_key.rs b/ext/crypto/generate_key.rs index 3c0bd77c22..953e2f1df1 100644 --- a/ext/crypto/generate_key.rs +++ b/ext/crypto/generate_key.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::op2; use deno_core::unsync::spawn_blocking; diff --git a/ext/crypto/import_key.rs b/ext/crypto/import_key.rs index 3463ca2beb..4011f2536b 100644 --- a/ext/crypto/import_key.rs +++ b/ext/crypto/import_key.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use base64::Engine; use deno_core::op2; diff --git a/ext/crypto/key.rs b/ext/crypto/key.rs index 6b3bf26f43..52a035ef01 100644 --- a/ext/crypto/key.rs +++ b/ext/crypto/key.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use ring::agreement::Algorithm as RingAlgorithm; use ring::digest; diff --git a/ext/crypto/lib.deno_crypto.d.ts b/ext/crypto/lib.deno_crypto.d.ts index 827c0224ce..3f4edb9245 100644 --- a/ext/crypto/lib.deno_crypto.d.ts +++ b/ext/crypto/lib.deno_crypto.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-var diff --git a/ext/crypto/lib.rs b/ext/crypto/lib.rs index 69dcd1413a..f468af5b07 100644 --- a/ext/crypto/lib.rs +++ b/ext/crypto/lib.rs @@ -1,22 +1,22 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::num::NonZeroU32; +use std::path::PathBuf; use aes_kw::KekAes128; use aes_kw::KekAes192; use aes_kw::KekAes256; - use base64::prelude::BASE64_URL_SAFE_NO_PAD; use base64::Engine; use deno_core::error::not_supported; use deno_core::op2; -use deno_core::ToJsBuffer; - use deno_core::unsync::spawn_blocking; use deno_core::JsBuffer; use deno_core::OpState; -use serde::Deserialize; - +use deno_core::ToJsBuffer; use p256::elliptic_curve::sec1::FromEncodedPoint; use p256::pkcs8::DecodePrivateKey; +pub use rand; use rand::rngs::OsRng; use rand::rngs::StdRng; use rand::thread_rng; @@ -41,15 +41,12 @@ use rsa::traits::SignatureScheme; use rsa::Pss; use rsa::RsaPrivateKey; use rsa::RsaPublicKey; +use serde::Deserialize; use sha1::Sha1; use sha2::Digest; use sha2::Sha256; use sha2::Sha384; -use sha2::Sha512; -use std::num::NonZeroU32; -use std::path::PathBuf; - -pub use rand; // Re-export rand +use sha2::Sha512; // Re-export rand mod decrypt; mod ed25519; diff --git a/ext/crypto/shared.rs b/ext/crypto/shared.rs index f70d32856c..60ba560c98 100644 --- a/ext/crypto/shared.rs +++ b/ext/crypto/shared.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; diff --git a/ext/crypto/x25519.rs b/ext/crypto/x25519.rs index d2c4d986b9..80537d435f 100644 --- a/ext/crypto/x25519.rs +++ b/ext/crypto/x25519.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use curve25519_dalek::montgomery::MontgomeryPoint; use deno_core::op2; diff --git a/ext/crypto/x448.rs b/ext/crypto/x448.rs index 89bf48e28b..c582aa9661 100644 --- a/ext/crypto/x448.rs +++ b/ext/crypto/x448.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::op2; use deno_core::ToJsBuffer; diff --git a/ext/fetch/20_headers.js b/ext/fetch/20_headers.js index e56a74c423..fb97adb13b 100644 --- a/ext/fetch/20_headers.js +++ b/ext/fetch/20_headers.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/fetch/21_formdata.js b/ext/fetch/21_formdata.js index 7d466b8e25..8b91a0fa47 100644 --- a/ext/fetch/21_formdata.js +++ b/ext/fetch/21_formdata.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/fetch/22_body.js b/ext/fetch/22_body.js index bb2bee77e2..f180bda18d 100644 --- a/ext/fetch/22_body.js +++ b/ext/fetch/22_body.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/fetch/22_http_client.js b/ext/fetch/22_http_client.js index 6a1243ee0b..b74979c4c6 100644 --- a/ext/fetch/22_http_client.js +++ b/ext/fetch/22_http_client.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js index 61cac22d2e..9aa2f0fe5c 100644 --- a/ext/fetch/23_request.js +++ b/ext/fetch/23_request.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js index 278dcb7dec..0a86e04310 100644 --- a/ext/fetch/23_response.js +++ b/ext/fetch/23_response.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js index 12b9c4582b..f26e2e3fb9 100644 --- a/ext/fetch/26_fetch.js +++ b/ext/fetch/26_fetch.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/fetch/27_eventsource.js b/ext/fetch/27_eventsource.js index aadbb5fe71..99ea4073a5 100644 --- a/ext/fetch/27_eventsource.js +++ b/ext/fetch/27_eventsource.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// diff --git a/ext/fetch/Cargo.toml b/ext/fetch/Cargo.toml index e6e4ded4af..ec82281bf4 100644 --- a/ext/fetch/Cargo.toml +++ b/ext/fetch/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_fetch" diff --git a/ext/fetch/dns.rs b/ext/fetch/dns.rs index fdde4e17bb..e233021400 100644 --- a/ext/fetch/dns.rs +++ b/ext/fetch/dns.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::future::Future; use std::io; use std::net::SocketAddr; diff --git a/ext/fetch/fs_fetch_handler.rs b/ext/fetch/fs_fetch_handler.rs index c236dd9c67..33293d0a27 100644 --- a/ext/fetch/fs_fetch_handler.rs +++ b/ext/fetch/fs_fetch_handler.rs @@ -1,8 +1,6 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::CancelHandle; -use crate::CancelableResponseFuture; -use crate::FetchHandler; +use std::rc::Rc; use deno_core::futures::FutureExt; use deno_core::futures::TryFutureExt; @@ -12,9 +10,12 @@ use deno_core::CancelFuture; use deno_core::OpState; use http::StatusCode; use http_body_util::BodyExt; -use std::rc::Rc; use tokio_util::io::ReaderStream; +use crate::CancelHandle; +use crate::CancelableResponseFuture; +use crate::FetchHandler; + /// An implementation which tries to read file URLs from the file system via /// tokio::fs. #[derive(Clone)] diff --git a/ext/fetch/internal.d.ts b/ext/fetch/internal.d.ts index 17565992f4..8ab38f9b62 100644 --- a/ext/fetch/internal.d.ts +++ b/ext/fetch/internal.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any no-var diff --git a/ext/fetch/lib.deno_fetch.d.ts b/ext/fetch/lib.deno_fetch.d.ts index 8614dec899..2be844f0f8 100644 --- a/ext/fetch/lib.deno_fetch.d.ts +++ b/ext/fetch/lib.deno_fetch.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any no-var diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs index 103698b3bf..d1f3963743 100644 --- a/ext/fetch/lib.rs +++ b/ext/fetch/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub mod dns; mod fs_fetch_handler; @@ -19,6 +19,10 @@ use std::sync::Arc; use std::task::Context; use std::task::Poll; +use bytes::Bytes; +// Re-export data_url +pub use data_url; +use data_url::DataUrl; use deno_core::futures::stream::Peekable; use deno_core::futures::Future; use deno_core::futures::FutureExt; @@ -51,9 +55,7 @@ use deno_tls::RootCertStoreProvider; use deno_tls::TlsKey; use deno_tls::TlsKeys; use deno_tls::TlsKeysHolder; - -use bytes::Bytes; -use data_url::DataUrl; +pub use fs_fetch_handler::FsFetchHandler; use http::header::HeaderName; use http::header::HeaderValue; use http::header::ACCEPT; @@ -75,18 +77,13 @@ use hyper_util::client::legacy::connect::HttpInfo; use hyper_util::client::legacy::Builder as HyperClientBuilder; use hyper_util::rt::TokioExecutor; use hyper_util::rt::TokioTimer; +pub use proxy::basic_auth; use serde::Deserialize; use serde::Serialize; use tower::retry; use tower::ServiceExt; use tower_http::decompression::Decompression; -// Re-export data_url -pub use data_url; -pub use proxy::basic_auth; - -pub use fs_fetch_handler::FsFetchHandler; - #[derive(Clone)] pub struct Options { pub user_agent: String, diff --git a/ext/fetch/proxy.rs b/ext/fetch/proxy.rs index 88fc211ecc..3b371a07b1 100644 --- a/ext/fetch/proxy.rs +++ b/ext/fetch/proxy.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! Parts of this module should be able to be replaced with other crates //! eventually, once generic versions appear in hyper-util, et al. @@ -13,7 +13,6 @@ use std::task::Poll; use deno_core::futures::TryFutureExt; use deno_tls::rustls::ClientConfig as TlsConfig; - use http::header::HeaderValue; use http::uri::Scheme; use http::Uri; @@ -108,9 +107,10 @@ pub(crate) fn from_env() -> Proxies { } pub fn basic_auth(user: &str, pass: Option<&str>) -> HeaderValue { + use std::io::Write; + use base64::prelude::BASE64_STANDARD; use base64::write::EncoderWriter; - use std::io::Write; let mut buf = b"Basic ".to_vec(); { diff --git a/ext/fetch/tests.rs b/ext/fetch/tests.rs index 243b80bd90..4e023be4fa 100644 --- a/ext/fetch/tests.rs +++ b/ext/fetch/tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::net::SocketAddr; use std::sync::atomic::AtomicUsize; @@ -12,10 +12,9 @@ use http_body_util::BodyExt; use tokio::io::AsyncReadExt; use tokio::io::AsyncWriteExt; -use crate::dns; - use super::create_http_client; use super::CreateHttpClientOptions; +use crate::dns; static EXAMPLE_CRT: &[u8] = include_bytes!("../tls/testdata/example1_cert.der"); static EXAMPLE_KEY: &[u8] = diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js index d3b07dc373..b8c12180c9 100644 --- a/ext/ffi/00_ffi.js +++ b/ext/ffi/00_ffi.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; const { diff --git a/ext/ffi/Cargo.toml b/ext/ffi/Cargo.toml index 9cd5c77013..0af0f4a131 100644 --- a/ext/ffi/Cargo.toml +++ b/ext/ffi/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_ffi" diff --git a/ext/ffi/call.rs b/ext/ffi/call.rs index c964071a09..001b925af5 100644 --- a/ext/ffi/call.rs +++ b/ext/ffi/call.rs @@ -1,12 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::cell::RefCell; +use std::ffi::c_void; +use std::future::Future; +use std::rc::Rc; -use crate::callback::PtrSymbol; -use crate::dlfcn::DynamicLibraryResource; -use crate::ir::*; -use crate::symbol::NativeType; -use crate::symbol::Symbol; -use crate::FfiPermissions; -use crate::ForeignFunction; use deno_core::op2; use deno_core::serde_json::Value; use deno_core::serde_v8::BigInt as V8BigInt; @@ -18,10 +16,14 @@ use deno_core::ResourceId; use libffi::middle::Arg; use num_bigint::BigInt; use serde::Serialize; -use std::cell::RefCell; -use std::ffi::c_void; -use std::future::Future; -use std::rc::Rc; + +use crate::callback::PtrSymbol; +use crate::dlfcn::DynamicLibraryResource; +use crate::ir::*; +use crate::symbol::NativeType; +use crate::symbol::Symbol; +use crate::FfiPermissions; +use crate::ForeignFunction; #[derive(Debug, thiserror::Error)] pub enum CallError { diff --git a/ext/ffi/callback.rs b/ext/ffi/callback.rs index eff14503d1..c4b5e14842 100644 --- a/ext/ffi/callback.rs +++ b/ext/ffi/callback.rs @@ -1,19 +1,5 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::symbol::NativeType; -use crate::FfiPermissions; -use crate::ForeignFunction; -use deno_core::op2; -use deno_core::v8; -use deno_core::v8::TryCatch; -use deno_core::CancelFuture; -use deno_core::CancelHandle; -use deno_core::OpState; -use deno_core::Resource; -use deno_core::ResourceId; -use deno_core::V8CrossThreadTaskSpawner; -use libffi::middle::Cif; -use serde::Deserialize; use std::borrow::Cow; use std::cell::RefCell; use std::ffi::c_void; @@ -27,6 +13,22 @@ use std::sync::atomic; use std::sync::atomic::AtomicU32; use std::task::Poll; +use deno_core::op2; +use deno_core::v8; +use deno_core::v8::TryCatch; +use deno_core::CancelFuture; +use deno_core::CancelHandle; +use deno_core::OpState; +use deno_core::Resource; +use deno_core::ResourceId; +use deno_core::V8CrossThreadTaskSpawner; +use libffi::middle::Cif; +use serde::Deserialize; + +use crate::symbol::NativeType; +use crate::FfiPermissions; +use crate::ForeignFunction; + static THREAD_ID_COUNTER: AtomicU32 = AtomicU32::new(1); thread_local! { diff --git a/ext/ffi/dlfcn.rs b/ext/ffi/dlfcn.rs index e1bb121d8c..4eea2402a0 100644 --- a/ext/ffi/dlfcn.rs +++ b/ext/ffi/dlfcn.rs @@ -1,11 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::collections::HashMap; +use std::ffi::c_void; +use std::rc::Rc; -use crate::ir::out_buffer_as_ptr; -use crate::symbol::NativeType; -use crate::symbol::Symbol; -use crate::turbocall; -use crate::turbocall::Turbocall; -use crate::FfiPermissions; use deno_core::op2; use deno_core::v8; use deno_core::GarbageCollected; @@ -14,11 +14,13 @@ use deno_core::Resource; use dlopen2::raw::Library; use serde::Deserialize; use serde_value::ValueDeserializer; -use std::borrow::Cow; -use std::cell::RefCell; -use std::collections::HashMap; -use std::ffi::c_void; -use std::rc::Rc; + +use crate::ir::out_buffer_as_ptr; +use crate::symbol::NativeType; +use crate::symbol::Symbol; +use crate::turbocall; +use crate::turbocall::Turbocall; +use crate::FfiPermissions; #[derive(Debug, thiserror::Error)] pub enum DlfcnError { @@ -324,6 +326,7 @@ pub(crate) fn format_error( // https://github.com/denoland/deno/issues/11632 dlopen2::Error::OpeningLibraryError(e) => { use std::os::windows::ffi::OsStrExt; + use winapi::shared::minwindef::DWORD; use winapi::shared::winerror::ERROR_INSUFFICIENT_BUFFER; use winapi::um::errhandlingapi::GetLastError; @@ -392,10 +395,11 @@ pub(crate) fn format_error( #[cfg(test)] mod tests { + use serde_json::json; + use super::ForeignFunction; use super::ForeignSymbol; use crate::symbol::NativeType; - use serde_json::json; #[cfg(target_os = "windows")] #[test] diff --git a/ext/ffi/ir.rs b/ext/ffi/ir.rs index 2e80842166..7b2f167ce7 100644 --- a/ext/ffi/ir.rs +++ b/ext/ffi/ir.rs @@ -1,11 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::symbol::NativeType; -use deno_core::v8; -use libffi::middle::Arg; use std::ffi::c_void; use std::ptr; +use deno_core::v8; +use libffi::middle::Arg; + +use crate::symbol::NativeType; + #[derive(Debug, thiserror::Error)] pub enum IRError { #[error("Invalid FFI u8 type, expected boolean")] diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs index 73ec7757ab..7fed3c32aa 100644 --- a/ext/ffi/lib.rs +++ b/ext/ffi/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::mem::size_of; use std::os::raw::c_char; @@ -17,24 +17,23 @@ mod turbocall; use call::op_ffi_call_nonblocking; use call::op_ffi_call_ptr; use call::op_ffi_call_ptr_nonblocking; +pub use call::CallError; use callback::op_ffi_unsafe_callback_close; use callback::op_ffi_unsafe_callback_create; use callback::op_ffi_unsafe_callback_ref; +pub use callback::CallbackError; +use deno_permissions::PermissionCheckError; use dlfcn::op_ffi_load; +pub use dlfcn::DlfcnError; use dlfcn::ForeignFunction; +pub use ir::IRError; use r#static::op_ffi_get_static; +pub use r#static::StaticError; +pub use repr::ReprError; use repr::*; use symbol::NativeType; use symbol::Symbol; -pub use call::CallError; -pub use callback::CallbackError; -use deno_permissions::PermissionCheckError; -pub use dlfcn::DlfcnError; -pub use ir::IRError; -pub use r#static::StaticError; -pub use repr::ReprError; - #[cfg(not(target_pointer_width = "64"))] compile_error!("platform not supported"); diff --git a/ext/ffi/repr.rs b/ext/ffi/repr.rs index eea15f3e97..05bef40a89 100644 --- a/ext/ffi/repr.rs +++ b/ext/ffi/repr.rs @@ -1,14 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::FfiPermissions; -use deno_core::op2; -use deno_core::v8; -use deno_core::OpState; use std::ffi::c_char; use std::ffi::c_void; use std::ffi::CStr; use std::ptr; +use deno_core::op2; +use deno_core::v8; +use deno_core::OpState; + +use crate::FfiPermissions; + #[derive(Debug, thiserror::Error)] pub enum ReprError { #[error("Invalid pointer to offset, pointer is null")] diff --git a/ext/ffi/static.rs b/ext/ffi/static.rs index 61b4059336..6ad7fe6d37 100644 --- a/ext/ffi/static.rs +++ b/ext/ffi/static.rs @@ -1,12 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; -use crate::dlfcn::DynamicLibraryResource; -use crate::symbol::NativeType; use deno_core::op2; use deno_core::v8; use deno_core::OpState; use deno_core::ResourceId; -use std::ptr; + +use crate::dlfcn::DynamicLibraryResource; +use crate::symbol::NativeType; #[derive(Debug, thiserror::Error)] pub enum StaticError { diff --git a/ext/ffi/symbol.rs b/ext/ffi/symbol.rs index cee1c7d33e..c4a68cf753 100644 --- a/ext/ffi/symbol.rs +++ b/ext/ffi/symbol.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::error::type_error; use deno_core::error::AnyError; diff --git a/ext/ffi/turbocall.rs b/ext/ffi/turbocall.rs index 38b4062ab7..499168dceb 100644 --- a/ext/ffi/turbocall.rs +++ b/ext/ffi/turbocall.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cmp::max; use std::ffi::c_void; diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 4e71acb1b2..74e3c87c17 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; const { diff --git a/ext/fs/Cargo.toml b/ext/fs/Cargo.toml index 8692f04a73..b7d22b7f93 100644 --- a/ext/fs/Cargo.toml +++ b/ext/fs/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_fs" @@ -25,12 +25,10 @@ deno_io.workspace = true deno_path_util.workspace = true deno_permissions.workspace = true filetime.workspace = true -getrandom = "0.2" libc.workspace = true rand.workspace = true rayon = "1.8.0" serde.workspace = true -sys_traits.workspace = true thiserror.workspace = true [target.'cfg(unix)'.dependencies] diff --git a/ext/fs/in_memory_fs.rs b/ext/fs/in_memory_fs.rs deleted file mode 100644 index b79b0ae984..0000000000 --- a/ext/fs/in_memory_fs.rs +++ /dev/null @@ -1,481 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -// Allow using Arc for this module. -#![allow(clippy::disallowed_types)] - -use std::borrow::Cow; -use std::collections::hash_map::Entry; -use std::collections::HashMap; -use std::io::Error; -use std::io::ErrorKind; -use std::path::Path; -use std::path::PathBuf; -use std::rc::Rc; -use std::sync::Arc; - -use deno_core::parking_lot::Mutex; -use deno_io::fs::File; -use deno_io::fs::FsError; -use deno_io::fs::FsResult; -use deno_io::fs::FsStat; -use deno_path_util::normalize_path; - -use crate::interface::AccessCheckCb; -use crate::interface::FsDirEntry; -use crate::interface::FsFileType; -use crate::FileSystem; -use crate::OpenOptions; - -#[derive(Debug)] -enum PathEntry { - Dir, - File(Vec), -} - -/// A very basic in-memory file system useful for swapping out in -/// the place of a RealFs for testing purposes. -/// -/// Please develop this out as you need functionality. -#[derive(Debug, Default)] -pub struct InMemoryFs { - entries: Mutex>>, -} - -impl InMemoryFs { - pub fn setup_text_files(&self, files: Vec<(String, String)>) { - for (path, text) in files { - let path = PathBuf::from(path); - self.mkdir_sync(path.parent().unwrap(), true, None).unwrap(); - self - .write_file_sync( - &path, - OpenOptions::write(true, false, false, None), - None, - &text.into_bytes(), - ) - .unwrap(); - } - } - - fn get_entry(&self, path: &Path) -> Option> { - let path = normalize_path(path); - self.entries.lock().get(&path).cloned() - } -} - -#[async_trait::async_trait(?Send)] -impl FileSystem for InMemoryFs { - fn cwd(&self) -> FsResult { - Err(FsError::NotSupported) - } - - fn tmp_dir(&self) -> FsResult { - Err(FsError::NotSupported) - } - - fn chdir(&self, _path: &Path) -> FsResult<()> { - Err(FsError::NotSupported) - } - - fn umask(&self, _mask: Option) -> FsResult { - Err(FsError::NotSupported) - } - - fn open_sync( - &self, - _path: &Path, - _options: OpenOptions, - _access_check: Option, - ) -> FsResult> { - Err(FsError::NotSupported) - } - async fn open_async<'a>( - &'a self, - path: PathBuf, - options: OpenOptions, - access_check: Option>, - ) -> FsResult> { - self.open_sync(&path, options, access_check) - } - - fn mkdir_sync( - &self, - path: &Path, - recursive: bool, - _mode: Option, - ) -> FsResult<()> { - let path = normalize_path(path); - - if let Some(parent) = path.parent() { - let entry = self.entries.lock().get(parent).cloned(); - match entry { - Some(entry) => match &*entry { - PathEntry::File(_) => { - return Err(FsError::Io(Error::new( - ErrorKind::InvalidInput, - "Parent is a file", - ))) - } - PathEntry::Dir => {} - }, - None => { - if recursive { - self.mkdir_sync(parent, true, None)?; - } else { - return Err(FsError::Io(Error::new( - ErrorKind::NotFound, - "Not found", - ))); - } - } - } - } - - let entry = self.entries.lock().get(&path).cloned(); - match entry { - Some(entry) => match &*entry { - PathEntry::File(_) => Err(FsError::Io(Error::new( - ErrorKind::InvalidInput, - "Is a file", - ))), - PathEntry::Dir => Ok(()), - }, - None => { - self.entries.lock().insert(path, Arc::new(PathEntry::Dir)); - Ok(()) - } - } - } - async fn mkdir_async( - &self, - path: PathBuf, - recursive: bool, - mode: Option, - ) -> FsResult<()> { - self.mkdir_sync(&path, recursive, mode) - } - - fn chmod_sync(&self, _path: &Path, _mode: u32) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn chmod_async(&self, path: PathBuf, mode: u32) -> FsResult<()> { - self.chmod_sync(&path, mode) - } - - fn chown_sync( - &self, - _path: &Path, - _uid: Option, - _gid: Option, - ) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn chown_async( - &self, - path: PathBuf, - uid: Option, - gid: Option, - ) -> FsResult<()> { - self.chown_sync(&path, uid, gid) - } - - fn lchown_sync( - &self, - _path: &Path, - _uid: Option, - _gid: Option, - ) -> FsResult<()> { - Err(FsError::NotSupported) - } - - async fn lchown_async( - &self, - path: PathBuf, - uid: Option, - gid: Option, - ) -> FsResult<()> { - self.lchown_sync(&path, uid, gid) - } - - fn remove_sync(&self, _path: &Path, _recursive: bool) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn remove_async(&self, path: PathBuf, recursive: bool) -> FsResult<()> { - self.remove_sync(&path, recursive) - } - - fn copy_file_sync(&self, _from: &Path, _to: &Path) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn copy_file_async(&self, from: PathBuf, to: PathBuf) -> FsResult<()> { - self.copy_file_sync(&from, &to) - } - - fn cp_sync(&self, _from: &Path, _to: &Path) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn cp_async(&self, from: PathBuf, to: PathBuf) -> FsResult<()> { - self.cp_sync(&from, &to) - } - - fn stat_sync(&self, path: &Path) -> FsResult { - let entry = self.get_entry(path); - match entry { - Some(entry) => match &*entry { - PathEntry::Dir => Ok(FsStat { - is_file: false, - is_directory: true, - is_symlink: false, - size: 0, - mtime: None, - atime: None, - birthtime: None, - ctime: None, - dev: 0, - ino: 0, - mode: 0, - nlink: 0, - uid: 0, - gid: 0, - rdev: 0, - blksize: 0, - blocks: 0, - is_block_device: false, - is_char_device: false, - is_fifo: false, - is_socket: false, - }), - PathEntry::File(data) => Ok(FsStat { - is_file: true, - is_directory: false, - is_symlink: false, - size: data.len() as u64, - mtime: None, - atime: None, - birthtime: None, - ctime: None, - dev: 0, - ino: 0, - mode: 0, - nlink: 0, - uid: 0, - gid: 0, - rdev: 0, - blksize: 0, - blocks: 0, - is_block_device: false, - is_char_device: false, - is_fifo: false, - is_socket: false, - }), - }, - None => Err(FsError::Io(Error::new(ErrorKind::NotFound, "Not found"))), - } - } - async fn stat_async(&self, path: PathBuf) -> FsResult { - self.stat_sync(&path) - } - - fn lstat_sync(&self, _path: &Path) -> FsResult { - Err(FsError::NotSupported) - } - async fn lstat_async(&self, path: PathBuf) -> FsResult { - self.lstat_sync(&path) - } - - fn realpath_sync(&self, _path: &Path) -> FsResult { - Err(FsError::NotSupported) - } - async fn realpath_async(&self, path: PathBuf) -> FsResult { - self.realpath_sync(&path) - } - - fn read_dir_sync(&self, _path: &Path) -> FsResult> { - Err(FsError::NotSupported) - } - async fn read_dir_async(&self, path: PathBuf) -> FsResult> { - self.read_dir_sync(&path) - } - - fn rename_sync(&self, _oldpath: &Path, _newpath: &Path) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn rename_async( - &self, - oldpath: PathBuf, - newpath: PathBuf, - ) -> FsResult<()> { - self.rename_sync(&oldpath, &newpath) - } - - fn link_sync(&self, _oldpath: &Path, _newpath: &Path) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn link_async( - &self, - oldpath: PathBuf, - newpath: PathBuf, - ) -> FsResult<()> { - self.link_sync(&oldpath, &newpath) - } - - fn symlink_sync( - &self, - _oldpath: &Path, - _newpath: &Path, - _file_type: Option, - ) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn symlink_async( - &self, - oldpath: PathBuf, - newpath: PathBuf, - file_type: Option, - ) -> FsResult<()> { - self.symlink_sync(&oldpath, &newpath, file_type) - } - - fn read_link_sync(&self, _path: &Path) -> FsResult { - Err(FsError::NotSupported) - } - async fn read_link_async(&self, path: PathBuf) -> FsResult { - self.read_link_sync(&path) - } - - fn truncate_sync(&self, _path: &Path, _len: u64) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn truncate_async(&self, path: PathBuf, len: u64) -> FsResult<()> { - self.truncate_sync(&path, len) - } - - fn utime_sync( - &self, - _path: &Path, - _atime_secs: i64, - _atime_nanos: u32, - _mtime_secs: i64, - _mtime_nanos: u32, - ) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn utime_async( - &self, - path: PathBuf, - atime_secs: i64, - atime_nanos: u32, - mtime_secs: i64, - mtime_nanos: u32, - ) -> FsResult<()> { - self.utime_sync(&path, atime_secs, atime_nanos, mtime_secs, mtime_nanos) - } - - fn lutime_sync( - &self, - _path: &Path, - _atime_secs: i64, - _atime_nanos: u32, - _mtime_secs: i64, - _mtime_nanos: u32, - ) -> FsResult<()> { - Err(FsError::NotSupported) - } - async fn lutime_async( - &self, - path: PathBuf, - atime_secs: i64, - atime_nanos: u32, - mtime_secs: i64, - mtime_nanos: u32, - ) -> FsResult<()> { - self.lutime_sync(&path, atime_secs, atime_nanos, mtime_secs, mtime_nanos) - } - - fn write_file_sync( - &self, - path: &Path, - options: OpenOptions, - _access_check: Option, - data: &[u8], - ) -> FsResult<()> { - let path = normalize_path(path); - let has_parent_dir = path - .parent() - .and_then(|parent| self.get_entry(parent)) - .map(|e| matches!(*e, PathEntry::Dir)) - .unwrap_or(false); - if !has_parent_dir { - return Err(FsError::Io(Error::new( - ErrorKind::NotFound, - "Parent directory does not exist", - ))); - } - let mut entries = self.entries.lock(); - let entry = entries.entry(path.clone()); - match entry { - Entry::Occupied(mut entry) => { - if let PathEntry::File(existing_data) = &**entry.get() { - if options.create_new { - return Err(FsError::Io(Error::new( - ErrorKind::AlreadyExists, - "File already exists", - ))); - } - if options.append { - let mut new_data = existing_data.clone(); - new_data.extend_from_slice(data); - entry.insert(Arc::new(PathEntry::File(new_data))); - } else { - entry.insert(Arc::new(PathEntry::File(data.to_vec()))); - } - Ok(()) - } else { - Err(FsError::Io(Error::new( - ErrorKind::InvalidInput, - "Not a file", - ))) - } - } - Entry::Vacant(entry) => { - entry.insert(Arc::new(PathEntry::File(data.to_vec()))); - Ok(()) - } - } - } - - async fn write_file_async<'a>( - &'a self, - path: PathBuf, - options: OpenOptions, - access_check: Option>, - data: Vec, - ) -> FsResult<()> { - self.write_file_sync(&path, options, access_check, &data) - } - - fn read_file_sync( - &self, - path: &Path, - _access_check: Option, - ) -> FsResult> { - let entry = self.get_entry(path); - match entry { - Some(entry) => match &*entry { - PathEntry::File(data) => Ok(Cow::Owned(data.clone())), - PathEntry::Dir => Err(FsError::Io(Error::new( - ErrorKind::InvalidInput, - "Is a directory", - ))), - }, - None => Err(FsError::Io(Error::new(ErrorKind::NotFound, "Not found"))), - } - } - async fn read_file_async<'a>( - &'a self, - path: PathBuf, - access_check: Option>, - ) -> FsResult> { - self.read_file_sync(&path, access_check) - } -} diff --git a/ext/fs/interface.rs b/ext/fs/interface.rs index 304c263614..0aae2b998f 100644 --- a/ext/fs/interface.rs +++ b/ext/fs/interface.rs @@ -1,21 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use core::str; use std::borrow::Cow; use std::path::Path; use std::path::PathBuf; use std::rc::Rc; -use std::time::Duration; -use std::time::SystemTime; - -use serde::Deserialize; -use serde::Serialize; use deno_io::fs::File; use deno_io::fs::FsResult; use deno_io::fs::FsStat; -use sys_traits::FsFile; -use sys_traits::FsFileSetPermissions; +use serde::Deserialize; +use serde::Serialize; use crate::sync::MaybeSend; use crate::sync::MaybeSync; @@ -75,7 +70,7 @@ pub enum FsFileType { } /// WARNING: This is part of the public JS Deno API. -#[derive(Debug, Serialize)] +#[derive(Debug, Clone, Serialize)] #[serde(rename_all = "camelCase")] pub struct FsDirEntry { pub name: String, @@ -104,56 +99,6 @@ impl AccessCheckFn for T where { } -#[derive(Debug)] -pub struct FsStatSlim { - file_type: sys_traits::FileType, - modified: Result, -} - -impl FsStatSlim { - pub fn from_std(metadata: &std::fs::Metadata) -> Self { - Self { - file_type: metadata.file_type().into(), - modified: metadata.modified(), - } - } - - pub fn from_deno_fs_stat(data: &FsStat) -> Self { - FsStatSlim { - file_type: if data.is_file { - sys_traits::FileType::File - } else if data.is_directory { - sys_traits::FileType::Dir - } else if data.is_symlink { - sys_traits::FileType::Symlink - } else { - sys_traits::FileType::Unknown - }, - modified: data - .mtime - .map(|ms| SystemTime::UNIX_EPOCH + Duration::from_millis(ms)) - .ok_or_else(|| { - std::io::Error::new(std::io::ErrorKind::InvalidData, "No mtime") - }), - } - } -} - -impl sys_traits::FsMetadataValue for FsStatSlim { - #[inline] - fn file_type(&self) -> sys_traits::FileType { - self.file_type - } - - fn modified(&self) -> Result { - self - .modified - .as_ref() - .copied() - .map_err(|err| std::io::Error::new(err.kind(), err.to_string())) - } -} - pub type AccessCheckCb<'a> = &'a mut (dyn AccessCheckFn + 'a); #[async_trait::async_trait(?Send)] @@ -415,289 +360,3 @@ fn string_from_utf8_lossy(buf: Vec) -> String { Cow::Borrowed(_) => unsafe { String::from_utf8_unchecked(buf) }, } } - -// todo(dsherret): this is temporary. Instead of using the `FileSystem` trait implementation -// in the CLI, the CLI should instead create it's own file system using `sys_traits` traits -// then that can implement the `FileSystem` trait. Then this `FileSystem` trait can stay here -// for use only for `ext/fs` and not the entire CLI. -#[derive(Debug, Clone)] -pub struct FsSysTraitsAdapter(pub FileSystemRc); - -impl FsSysTraitsAdapter { - pub fn new_real() -> Self { - Self(crate::sync::new_rc(crate::RealFs)) - } -} - -impl sys_traits::BaseFsHardLink for FsSysTraitsAdapter { - #[inline] - fn base_fs_hard_link(&self, src: &Path, dst: &Path) -> std::io::Result<()> { - self - .0 - .link_sync(src, dst) - .map_err(|err| err.into_io_error()) - } -} - -impl sys_traits::BaseFsRead for FsSysTraitsAdapter { - #[inline] - fn base_fs_read(&self, path: &Path) -> std::io::Result> { - self - .0 - .read_file_sync(path, None) - .map_err(|err| err.into_io_error()) - } -} - -#[derive(Debug)] -pub struct FsSysTraitsAdapterReadDirEntry { - path: PathBuf, - entry: FsDirEntry, -} - -impl sys_traits::FsDirEntry for FsSysTraitsAdapterReadDirEntry { - type Metadata = FsStatSlim; - - fn file_name(&self) -> Cow { - Cow::Borrowed(self.entry.name.as_ref()) - } - - fn file_type(&self) -> std::io::Result { - if self.entry.is_file { - Ok(sys_traits::FileType::File) - } else if self.entry.is_directory { - Ok(sys_traits::FileType::Dir) - } else if self.entry.is_symlink { - Ok(sys_traits::FileType::Symlink) - } else { - Ok(sys_traits::FileType::Unknown) - } - } - - fn metadata(&self) -> std::io::Result { - Ok(FsStatSlim { - file_type: self.file_type().unwrap(), - modified: Err(std::io::Error::new( - std::io::ErrorKind::Other, - "not supported", - )), - }) - } - - fn path(&self) -> Cow { - Cow::Borrowed(&self.path) - } -} - -impl sys_traits::BaseFsReadDir for FsSysTraitsAdapter { - type ReadDirEntry = FsSysTraitsAdapterReadDirEntry; - - fn base_fs_read_dir( - &self, - path: &Path, - ) -> std::io::Result< - Box>>, - > { - // todo(dsherret): needs to actually be iterable and not allocate a vector - let entries = self - .0 - .read_dir_sync(path) - .map_err(|err| err.into_io_error())?; - let parent_dir = path.to_path_buf(); - Ok(Box::new(entries.into_iter().map(move |entry| { - Ok(FsSysTraitsAdapterReadDirEntry { - path: parent_dir.join(&entry.name), - entry, - }) - }))) - } -} - -impl sys_traits::BaseFsCanonicalize for FsSysTraitsAdapter { - #[inline] - fn base_fs_canonicalize(&self, path: &Path) -> std::io::Result { - self - .0 - .realpath_sync(path) - .map_err(|err| err.into_io_error()) - } -} - -impl sys_traits::BaseFsMetadata for FsSysTraitsAdapter { - type Metadata = FsStatSlim; - - #[inline] - fn base_fs_metadata(&self, path: &Path) -> std::io::Result { - self - .0 - .stat_sync(path) - .map(|data| FsStatSlim::from_deno_fs_stat(&data)) - .map_err(|err| err.into_io_error()) - } - - #[inline] - fn base_fs_symlink_metadata( - &self, - path: &Path, - ) -> std::io::Result { - self - .0 - .lstat_sync(path) - .map(|data| FsStatSlim::from_deno_fs_stat(&data)) - .map_err(|err| err.into_io_error()) - } -} - -impl sys_traits::BaseFsCreateDir for FsSysTraitsAdapter { - #[inline] - fn base_fs_create_dir( - &self, - path: &Path, - options: &sys_traits::CreateDirOptions, - ) -> std::io::Result<()> { - self - .0 - .mkdir_sync(path, options.recursive, options.mode) - .map_err(|err| err.into_io_error()) - } -} - -impl sys_traits::BaseFsRemoveFile for FsSysTraitsAdapter { - #[inline] - fn base_fs_remove_file(&self, path: &Path) -> std::io::Result<()> { - self - .0 - .remove_sync(path, false) - .map_err(|err| err.into_io_error()) - } -} - -impl sys_traits::BaseFsRename for FsSysTraitsAdapter { - #[inline] - fn base_fs_rename(&self, from: &Path, to: &Path) -> std::io::Result<()> { - self - .0 - .rename_sync(from, to) - .map_err(|err| err.into_io_error()) - } -} - -pub struct FsFileAdapter(pub Rc); - -impl FsFile for FsFileAdapter {} - -impl FsFileSetPermissions for FsFileAdapter { - #[inline] - fn fs_file_set_permissions(&mut self, mode: u32) -> std::io::Result<()> { - if cfg!(windows) { - Ok(()) // ignore - } else { - self - .0 - .clone() - .chmod_sync(mode) - .map_err(|err| err.into_io_error()) - } - } -} - -impl std::io::Read for FsFileAdapter { - #[inline] - fn read(&mut self, buf: &mut [u8]) -> std::io::Result { - self - .0 - .clone() - .read_sync(buf) - .map_err(|err| err.into_io_error()) - } -} - -impl std::io::Seek for FsFileAdapter { - fn seek(&mut self, pos: std::io::SeekFrom) -> std::io::Result { - self - .0 - .clone() - .seek_sync(pos) - .map_err(|err| err.into_io_error()) - } -} - -impl std::io::Write for FsFileAdapter { - #[inline] - fn write(&mut self, buf: &[u8]) -> std::io::Result { - self - .0 - .clone() - .write_sync(buf) - .map_err(|err| err.into_io_error()) - } - - #[inline] - fn flush(&mut self) -> std::io::Result<()> { - self - .0 - .clone() - .sync_sync() - .map_err(|err| err.into_io_error()) - } -} - -impl sys_traits::BaseFsOpen for FsSysTraitsAdapter { - type File = FsFileAdapter; - - fn base_fs_open( - &self, - path: &Path, - options: &sys_traits::OpenOptions, - ) -> std::io::Result { - self - .0 - .open_sync( - path, - OpenOptions { - read: options.read, - write: options.write, - create: options.create, - truncate: options.truncate, - append: options.append, - create_new: options.create_new, - mode: options.mode, - }, - None, - ) - .map(FsFileAdapter) - .map_err(|err| err.into_io_error()) - } -} - -impl sys_traits::SystemRandom for FsSysTraitsAdapter { - #[inline] - fn sys_random(&self, buf: &mut [u8]) -> std::io::Result<()> { - getrandom::getrandom(buf).map_err(|err| { - std::io::Error::new(std::io::ErrorKind::Other, err.to_string()) - }) - } -} - -impl sys_traits::SystemTimeNow for FsSysTraitsAdapter { - #[inline] - fn sys_time_now(&self) -> SystemTime { - SystemTime::now() - } -} - -impl sys_traits::ThreadSleep for FsSysTraitsAdapter { - #[inline] - fn thread_sleep(&self, dur: Duration) { - std::thread::sleep(dur); - } -} - -impl sys_traits::BaseEnvVar for FsSysTraitsAdapter { - fn base_env_var_os( - &self, - key: &std::ffi::OsStr, - ) -> Option { - std::env::var_os(key) - } -} diff --git a/ext/fs/lib.rs b/ext/fs/lib.rs index cfcf249783..89bd5bc09a 100644 --- a/ext/fs/lib.rs +++ b/ext/fs/lib.rs @@ -1,37 +1,32 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -mod in_memory_fs; mod interface; mod ops; mod std_fs; pub mod sync; -pub use crate::in_memory_fs::InMemoryFs; +use std::borrow::Cow; +use std::path::Path; +use std::path::PathBuf; + +use deno_io::fs::FsError; +use deno_permissions::PermissionCheckError; + pub use crate::interface::AccessCheckCb; pub use crate::interface::AccessCheckFn; pub use crate::interface::FileSystem; pub use crate::interface::FileSystemRc; pub use crate::interface::FsDirEntry; pub use crate::interface::FsFileType; -pub use crate::interface::FsStatSlim; -pub use crate::interface::FsSysTraitsAdapter; pub use crate::interface::OpenOptions; pub use crate::ops::FsOpsError; pub use crate::ops::FsOpsErrorKind; pub use crate::ops::OperationError; -pub use crate::ops::V8MaybeStaticStr; +use crate::ops::*; pub use crate::std_fs::RealFs; pub use crate::sync::MaybeSend; pub use crate::sync::MaybeSync; -use crate::ops::*; - -use deno_io::fs::FsError; -use deno_permissions::PermissionCheckError; -use std::borrow::Cow; -use std::path::Path; -use std::path::PathBuf; - pub trait FsPermissions { fn check_open<'a>( &mut self, diff --git a/ext/fs/ops.rs b/ext/fs/ops.rs index 521ff65471..64be03ea61 100644 --- a/ext/fs/ops.rs +++ b/ext/fs/ops.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::RefCell; @@ -11,15 +11,8 @@ use std::path::PathBuf; use std::path::StripPrefixError; use std::rc::Rc; -use crate::interface::AccessCheckFn; -use crate::interface::FileSystemRc; -use crate::interface::FsDirEntry; -use crate::interface::FsFileType; -use crate::FsPermissions; -use crate::OpenOptions; use boxed_error::Boxed; use deno_core::op2; -use deno_core::v8; use deno_core::CancelFuture; use deno_core::CancelHandle; use deno_core::FastString; @@ -27,7 +20,6 @@ use deno_core::JsBuffer; use deno_core::OpState; use deno_core::ResourceId; use deno_core::ToJsBuffer; -use deno_core::ToV8; use deno_io::fs::FileResource; use deno_io::fs::FsError; use deno_io::fs::FsStat; @@ -37,6 +29,13 @@ use rand::thread_rng; use rand::Rng; use serde::Serialize; +use crate::interface::AccessCheckFn; +use crate::interface::FileSystemRc; +use crate::interface::FsDirEntry; +use crate::interface::FsFileType; +use crate::FsPermissions; +use crate::OpenOptions; + #[derive(Debug, Boxed)] pub struct FsOpsError(pub Box); @@ -1384,51 +1383,12 @@ where Ok(buf.into_owned().into_boxed_slice().into()) } -// todo(https://github.com/denoland/deno_core/pull/986): remove -// when upgrading deno_core -#[derive(Debug)] -pub struct FastStringV8AllocationError; - -impl std::error::Error for FastStringV8AllocationError {} - -impl std::fmt::Display for FastStringV8AllocationError { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!( - f, - "failed to allocate string; buffer exceeds maximum length" - ) - } -} - -/// Maintains a static reference to the string if possible. -pub struct V8MaybeStaticStr(pub Cow<'static, str>); - -impl<'s> ToV8<'s> for V8MaybeStaticStr { - type Error = FastStringV8AllocationError; - - #[inline] - fn to_v8( - self, - scope: &mut v8::HandleScope<'s>, - ) -> Result, Self::Error> { - Ok( - match self.0 { - Cow::Borrowed(text) => FastString::from_static(text), - Cow::Owned(value) => value.into(), - } - .v8_string(scope) - .map_err(|_| FastStringV8AllocationError)? - .into(), - ) - } -} - #[op2(stack_trace)] #[to_v8] pub fn op_fs_read_file_text_sync

( state: &mut OpState, #[string] path: String, -) -> Result +) -> Result where P: FsPermissions + 'static, { @@ -1440,7 +1400,10 @@ where let str = fs .read_text_file_lossy_sync(&path, Some(&mut access_check)) .map_err(|error| map_permission_error("readfile", error, &path))?; - Ok(V8MaybeStaticStr(str)) + Ok(match str { + Cow::Borrowed(text) => FastString::from_static(text), + Cow::Owned(value) => value.into(), + }) } #[op2(async, stack_trace)] @@ -1449,7 +1412,7 @@ pub async fn op_fs_read_file_text_async

( state: Rc>, #[string] path: String, #[smi] cancel_rid: Option, -) -> Result +) -> Result where P: FsPermissions + 'static, { @@ -1483,7 +1446,10 @@ where .map_err(|error| map_permission_error("readfile", error, &path))? }; - Ok(V8MaybeStaticStr(str)) + Ok(match str { + Cow::Borrowed(text) => FastString::from_static(text), + Cow::Owned(value) => value.into(), + }) } fn to_seek_from(offset: i64, whence: i32) -> Result { diff --git a/ext/fs/std_fs.rs b/ext/fs/std_fs.rs index 76d37e430c..4845e9c7bc 100644 --- a/ext/fs/std_fs.rs +++ b/ext/fs/std_fs.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(clippy::disallowed_methods)] @@ -26,7 +26,7 @@ use crate::interface::FsFileType; use crate::FileSystem; use crate::OpenOptions; -#[derive(Debug, Clone)] +#[derive(Debug, Default, Clone)] pub struct RealFs; #[async_trait::async_trait(?Send)] @@ -61,7 +61,7 @@ impl FileSystem for RealFs { umask(Mode::from_bits_truncate(mask as mode_t)) } else { // If no mask provided, we query the current. Requires two syscalls. - let prev = umask(Mode::from_bits_truncate(0o777)); + let prev = umask(Mode::from_bits_truncate(0)); let _ = umask(prev); prev }; @@ -503,6 +503,7 @@ fn remove(path: &Path, recursive: bool) -> FsResult<()> { #[cfg(not(unix))] { use std::os::windows::prelude::MetadataExt; + use winapi::um::winnt::FILE_ATTRIBUTE_DIRECTORY; if metadata.file_attributes() & FILE_ATTRIBUTE_DIRECTORY != 0 { fs::remove_dir(path) @@ -520,13 +521,14 @@ fn remove(path: &Path, recursive: bool) -> FsResult<()> { fn copy_file(from: &Path, to: &Path) -> FsResult<()> { #[cfg(target_os = "macos")] { - use libc::clonefile; - use libc::stat; - use libc::unlink; use std::ffi::CString; use std::os::unix::fs::OpenOptionsExt; use std::os::unix::fs::PermissionsExt; + use libc::clonefile; + use libc::stat; + use libc::unlink; + let from_str = CString::new(from.as_os_str().as_encoded_bytes()) .map_err(|err| io::Error::new(io::ErrorKind::InvalidInput, err))?; let to_str = CString::new(to.as_os_str().as_encoded_bytes()) @@ -670,11 +672,12 @@ fn cp(from: &Path, to: &Path) -> FsResult<()> { #[cfg(target_os = "macos")] { // Just clonefile() - use libc::clonefile; - use libc::unlink; use std::ffi::CString; use std::os::unix::ffi::OsStrExt; + use libc::clonefile; + use libc::unlink; + let from_str = CString::new(from.as_os_str().as_bytes()) .map_err(|err| io::Error::new(io::ErrorKind::InvalidInput, err))?; let to_str = CString::new(to.as_os_str().as_bytes()) @@ -761,11 +764,17 @@ fn stat(path: &Path) -> FsResult { #[cfg(windows)] fn stat(path: &Path) -> FsResult { - let metadata = fs::metadata(path)?; - let mut fsstat = FsStat::from_std(metadata); + use std::os::windows::fs::OpenOptionsExt; + use winapi::um::winbase::FILE_FLAG_BACKUP_SEMANTICS; - let path = path.canonicalize()?; - stat_extra(&mut fsstat, &path, FILE_FLAG_BACKUP_SEMANTICS)?; + + let mut opts = fs::OpenOptions::new(); + opts.access_mode(0); // no read or write + opts.custom_flags(FILE_FLAG_BACKUP_SEMANTICS); + let file = opts.open(path)?; + let metadata = file.metadata()?; + let mut fsstat = FsStat::from_std(metadata); + stat_extra(&file, &mut fsstat)?; Ok(fsstat) } @@ -777,34 +786,24 @@ fn lstat(path: &Path) -> FsResult { #[cfg(windows)] fn lstat(path: &Path) -> FsResult { + use std::os::windows::fs::OpenOptionsExt; + use winapi::um::winbase::FILE_FLAG_BACKUP_SEMANTICS; use winapi::um::winbase::FILE_FLAG_OPEN_REPARSE_POINT; - let metadata = fs::symlink_metadata(path)?; + let mut opts = fs::OpenOptions::new(); + opts.access_mode(0); // no read or write + opts.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT); + let file = opts.open(path)?; + let metadata = file.metadata()?; let mut fsstat = FsStat::from_std(metadata); - stat_extra( - &mut fsstat, - path, - FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, - )?; + stat_extra(&file, &mut fsstat)?; Ok(fsstat) } #[cfg(windows)] -fn stat_extra( - fsstat: &mut FsStat, - path: &Path, - file_flags: winapi::shared::minwindef::DWORD, -) -> FsResult<()> { - use std::os::windows::prelude::OsStrExt; - - use winapi::um::fileapi::CreateFileW; - use winapi::um::fileapi::OPEN_EXISTING; - use winapi::um::handleapi::CloseHandle; - use winapi::um::handleapi::INVALID_HANDLE_VALUE; - use winapi::um::winnt::FILE_SHARE_DELETE; - use winapi::um::winnt::FILE_SHARE_READ; - use winapi::um::winnt::FILE_SHARE_WRITE; +fn stat_extra(file: &std::fs::File, fsstat: &mut FsStat) -> FsResult<()> { + use std::os::windows::io::AsRawHandle; unsafe fn get_dev( handle: winapi::shared::ntdef::HANDLE, @@ -873,23 +872,9 @@ fn stat_extra( // SAFETY: winapi calls unsafe { - let mut path: Vec<_> = path.as_os_str().encode_wide().collect(); - path.push(0); - let file_handle = CreateFileW( - path.as_ptr(), - 0, - FILE_SHARE_READ | FILE_SHARE_DELETE | FILE_SHARE_WRITE, - std::ptr::null_mut(), - OPEN_EXISTING, - file_flags, - std::ptr::null_mut(), - ); - if file_handle == INVALID_HANDLE_VALUE { - return Err(std::io::Error::last_os_error().into()); - } + let file_handle = file.as_raw_handle(); - let result = get_dev(file_handle); - fsstat.dev = result?; + fsstat.dev = get_dev(file_handle)?; if let Ok(file_info) = query_file_information(file_handle) { fsstat.ctime = Some(windows_time_to_unix_time_msec( @@ -928,7 +913,6 @@ fn stat_extra( } } - CloseHandle(file_handle); Ok(()) } } @@ -944,6 +928,7 @@ fn exists(path: &Path) -> bool { #[cfg(windows)] { use std::os::windows::ffi::OsStrExt; + use winapi::um::fileapi::GetFileAttributesW; use winapi::um::fileapi::INVALID_FILE_ATTRIBUTES; diff --git a/ext/fs/sync.rs b/ext/fs/sync.rs index 06694f1dc4..2c07ba42df 100644 --- a/ext/fs/sync.rs +++ b/ext/fs/sync.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub use inner::*; @@ -6,10 +6,9 @@ pub use inner::*; mod inner { #![allow(clippy::disallowed_types)] - pub use std::sync::Arc as MaybeArc; - pub use core::marker::Send as MaybeSend; pub use core::marker::Sync as MaybeSync; + pub use std::sync::Arc as MaybeArc; } #[cfg(not(feature = "sync_fs"))] diff --git a/ext/http/00_serve.ts b/ext/http/00_serve.ts index 446533e910..6e5f25b473 100644 --- a/ext/http/00_serve.ts +++ b/ext/http/00_serve.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, internals, primordials } from "ext:core/mod.js"; const { diff --git a/ext/http/01_http.js b/ext/http/01_http.js index 9302bd8a0f..83983fa0ca 100644 --- a/ext/http/01_http.js +++ b/ext/http/01_http.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; const { diff --git a/ext/http/02_websocket.ts b/ext/http/02_websocket.ts index 96af4d4822..4d37b04a1d 100644 --- a/ext/http/02_websocket.ts +++ b/ext/http/02_websocket.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { internals, primordials } from "ext:core/mod.js"; import { op_http_websocket_accept_header } from "ext:core/ops"; const { diff --git a/ext/http/Cargo.toml b/ext/http/Cargo.toml index e7aaad2fc0..8f131b84e6 100644 --- a/ext/http/Cargo.toml +++ b/ext/http/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_http" diff --git a/ext/http/benches/compressible.rs b/ext/http/benches/compressible.rs index 5ac09cb8bb..96b21512ba 100644 --- a/ext/http/benches/compressible.rs +++ b/ext/http/benches/compressible.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use bencher::benchmark_group; use bencher::benchmark_main; use bencher::Bencher; diff --git a/ext/http/compressible.rs b/ext/http/compressible.rs index 6e96582e7e..5c499f957d 100644 --- a/ext/http/compressible.rs +++ b/ext/http/compressible.rs @@ -1,7 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::str::FromStr; use phf::phf_set; -use std::str::FromStr; // Data obtained from https://github.com/jshttp/mime-db/blob/fa5e4ef3cc8907ec3c5ec5b85af0c63d7059a5cd/db.json // Important! Keep this list sorted alphabetically. diff --git a/ext/http/fly_accept_encoding.rs b/ext/http/fly_accept_encoding.rs index 4d6fd2231e..1be864fd3b 100644 --- a/ext/http/fly_accept_encoding.rs +++ b/ext/http/fly_accept_encoding.rs @@ -1,5 +1,5 @@ // Copyright 2018 Yoshua Wuyts. All rights reserved. MIT license. -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Forked from https://github.com/superfly/accept-encoding/blob/1cded757ec7ff3916e5bfe7441db76cdc48170dc/ // Forked to support both http 0.3 and http 1.0 crates. @@ -124,11 +124,12 @@ fn encodings_iter_inner<'s>( #[cfg(test)] mod tests { - use super::*; use http_v02::header::ACCEPT_ENCODING; use http_v02::HeaderMap; use http_v02::HeaderValue; + use super::*; + fn encodings( headers: &HeaderMap, ) -> Result, f32)>, EncodingError> { diff --git a/ext/http/http_next.rs b/ext/http/http_next.rs index 7dbac6021a..d9861a0a6b 100644 --- a/ext/http/http_next.rs +++ b/ext/http/http_next.rs @@ -1,24 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::compressible::is_content_compressible; -use crate::extract_network_stream; -use crate::network_buffered_stream::NetworkStreamPrefixCheck; -use crate::request_body::HttpRequestBody; -use crate::request_properties::HttpConnectionProperties; -use crate::request_properties::HttpListenProperties; -use crate::request_properties::HttpPropertyExtractor; -use crate::response_body::Compression; -use crate::response_body::ResponseBytesInner; -use crate::service::handle_request; -use crate::service::http_general_trace; -use crate::service::http_trace; -use crate::service::HttpRecord; -use crate::service::HttpRecordResponse; -use crate::service::HttpRequestBodyAutocloser; -use crate::service::HttpServerState; -use crate::service::SignallingRc; -use crate::websocket_upgrade::WebSocketUpgrade; -use crate::LocalExecutor; -use crate::Options; +// Copyright 2018-2025 the Deno authors. MIT license. +use std::borrow::Cow; +use std::cell::RefCell; +use std::ffi::c_void; +use std::future::Future; +use std::io; +use std::pin::Pin; +use std::ptr::null; +use std::rc::Rc; + use cache_control::CacheControl; use deno_core::external; use deno_core::futures::future::poll_fn; @@ -44,6 +33,7 @@ use deno_core::ResourceId; use deno_net::ops_tls::TlsStream; use deno_net::raw::NetworkStream; use deno_websocket::ws_create_server_stream; +use fly_accept_encoding::Encoding; use hyper::body::Incoming; use hyper::header::HeaderMap; use hyper::header::ACCEPT_ENCODING; @@ -63,21 +53,31 @@ use hyper::StatusCode; use hyper_util::rt::TokioIo; use once_cell::sync::Lazy; use smallvec::SmallVec; -use std::borrow::Cow; -use std::cell::RefCell; -use std::ffi::c_void; -use std::future::Future; -use std::io; -use std::pin::Pin; -use std::ptr::null; -use std::rc::Rc; - -use super::fly_accept_encoding; -use fly_accept_encoding::Encoding; - use tokio::io::AsyncReadExt; use tokio::io::AsyncWriteExt; +use super::fly_accept_encoding; +use crate::compressible::is_content_compressible; +use crate::extract_network_stream; +use crate::network_buffered_stream::NetworkStreamPrefixCheck; +use crate::request_body::HttpRequestBody; +use crate::request_properties::HttpConnectionProperties; +use crate::request_properties::HttpListenProperties; +use crate::request_properties::HttpPropertyExtractor; +use crate::response_body::Compression; +use crate::response_body::ResponseBytesInner; +use crate::service::handle_request; +use crate::service::http_general_trace; +use crate::service::http_trace; +use crate::service::HttpRecord; +use crate::service::HttpRecordResponse; +use crate::service::HttpRequestBodyAutocloser; +use crate::service::HttpServerState; +use crate::service::SignallingRc; +use crate::websocket_upgrade::WebSocketUpgrade; +use crate::LocalExecutor; +use crate::Options; + type Request = hyper::Request; static USE_WRITEV: Lazy = Lazy::new(|| { diff --git a/ext/http/lib.rs b/ext/http/lib.rs index 39b0bbc2af..e68bf3787d 100644 --- a/ext/http/lib.rs +++ b/ext/http/lib.rs @@ -1,4 +1,20 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::cmp::min; +use std::error::Error; +use std::future::Future; +use std::io; +use std::io::Write; +use std::mem::replace; +use std::mem::take; +use std::pin::pin; +use std::pin::Pin; +use std::rc::Rc; +use std::sync::Arc; +use std::task::Context; +use std::task::Poll; use async_compression::tokio::write::BrotliEncoder; use async_compression::tokio::write::GzipEncoder; @@ -54,21 +70,6 @@ use hyper_v014::HeaderMap; use hyper_v014::Request; use hyper_v014::Response; use serde::Serialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::cmp::min; -use std::error::Error; -use std::future::Future; -use std::io; -use std::io::Write; -use std::mem::replace; -use std::mem::take; -use std::pin::pin; -use std::pin::Pin; -use std::rc::Rc; -use std::sync::Arc; -use std::task::Context; -use std::task::Poll; use tokio::io::AsyncRead; use tokio::io::AsyncWrite; use tokio::io::AsyncWriteExt; diff --git a/ext/http/network_buffered_stream.rs b/ext/http/network_buffered_stream.rs index 73df2dbd9f..5882dd14e3 100644 --- a/ext/http/network_buffered_stream.rs +++ b/ext/http/network_buffered_stream.rs @@ -1,12 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use bytes::Bytes; -use deno_core::futures::future::poll_fn; -use deno_core::futures::ready; use std::io; use std::mem::MaybeUninit; use std::pin::Pin; use std::task::Poll; + +use bytes::Bytes; +use deno_core::futures::future::poll_fn; +use deno_core::futures::ready; use tokio::io::AsyncRead; use tokio::io::AsyncWrite; use tokio::io::ReadBuf; @@ -227,9 +228,10 @@ impl AsyncWrite #[cfg(test)] mod tests { - use super::*; use tokio::io::AsyncReadExt; + use super::*; + struct YieldsOneByteAtATime(&'static [u8]); impl AsyncRead for YieldsOneByteAtATime { diff --git a/ext/http/reader_stream.rs b/ext/http/reader_stream.rs index be6d571b1a..b6985927f4 100644 --- a/ext/http/reader_stream.rs +++ b/ext/http/reader_stream.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::pin::Pin; use std::sync::atomic::AtomicBool; @@ -66,11 +66,12 @@ impl Stream for ExternallyAbortableReaderStream { #[cfg(test)] mod tests { - use super::*; use bytes::Bytes; use deno_core::futures::StreamExt; use tokio::io::AsyncWriteExt; + use super::*; + #[tokio::test] async fn success() { let (a, b) = tokio::io::duplex(64 * 1024); diff --git a/ext/http/request_body.rs b/ext/http/request_body.rs index f1c3f358ea..e7c9a06e2c 100644 --- a/ext/http/request_body.rs +++ b/ext/http/request_body.rs @@ -1,4 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::borrow::Cow; +use std::pin::Pin; +use std::rc::Rc; +use std::task::ready; +use std::task::Poll; + use bytes::Bytes; use deno_core::futures::stream::Peekable; use deno_core::futures::Stream; @@ -12,11 +18,6 @@ use deno_core::Resource; use hyper::body::Body; use hyper::body::Incoming; use hyper::body::SizeHint; -use std::borrow::Cow; -use std::pin::Pin; -use std::rc::Rc; -use std::task::ready; -use std::task::Poll; /// Converts a hyper incoming body stream into a stream of [`Bytes`] that we can use to read in V8. struct ReadFuture(Incoming); diff --git a/ext/http/request_properties.rs b/ext/http/request_properties.rs index 39d35a79f1..9e60a22baf 100644 --- a/ext/http/request_properties.rs +++ b/ext/http/request_properties.rs @@ -1,4 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::borrow::Cow; +use std::net::Ipv4Addr; +use std::net::SocketAddr; +use std::net::SocketAddrV4; +use std::rc::Rc; + use deno_core::error::AnyError; use deno_core::OpState; use deno_core::ResourceId; @@ -11,11 +17,6 @@ use deno_net::raw::NetworkStreamType; use hyper::header::HOST; use hyper::HeaderMap; use hyper::Uri; -use std::borrow::Cow; -use std::net::Ipv4Addr; -use std::net::SocketAddr; -use std::net::SocketAddrV4; -use std::rc::Rc; // TODO(mmastrac): I don't like that we have to clone this, but it's one-time setup #[derive(Clone)] diff --git a/ext/http/response_body.rs b/ext/http/response_body.rs index bac43bf3c8..ff264a8305 100644 --- a/ext/http/response_body.rs +++ b/ext/http/response_body.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::io::Write; use std::pin::Pin; use std::rc::Rc; @@ -573,12 +573,14 @@ impl PollFrame for BrotliResponseStream { #[allow(clippy::print_stderr)] #[cfg(test)] mod tests { - use super::*; - use deno_core::futures::future::poll_fn; use std::hash::Hasher; use std::io::Read; use std::io::Write; + use deno_core::futures::future::poll_fn; + + use super::*; + fn zeros() -> Vec { vec![0; 1024 * 1024] } diff --git a/ext/http/service.rs b/ext/http/service.rs index ce24dea43f..3b7db49fc4 100644 --- a/ext/http/service.rs +++ b/ext/http/service.rs @@ -1,21 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::request_properties::HttpConnectionProperties; -use crate::response_body::ResponseBytesInner; -use crate::response_body::ResponseStreamResult; -use deno_core::futures::ready; -use deno_core::BufView; -use deno_core::OpState; -use deno_core::ResourceId; -use http::request::Parts; -use hyper::body::Body; -use hyper::body::Frame; -use hyper::body::Incoming; -use hyper::body::SizeHint; -use hyper::header::HeaderMap; -use hyper::upgrade::OnUpgrade; - -use scopeguard::guard; -use scopeguard::ScopeGuard; +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::Cell; use std::cell::Ref; use std::cell::RefCell; @@ -27,8 +10,26 @@ use std::rc::Rc; use std::task::Context; use std::task::Poll; use std::task::Waker; + +use deno_core::futures::ready; +use deno_core::BufView; +use deno_core::OpState; +use deno_core::ResourceId; +use http::request::Parts; +use hyper::body::Body; +use hyper::body::Frame; +use hyper::body::Incoming; +use hyper::body::SizeHint; +use hyper::header::HeaderMap; +use hyper::upgrade::OnUpgrade; +use scopeguard::guard; +use scopeguard::ScopeGuard; use tokio::sync::oneshot; +use crate::request_properties::HttpConnectionProperties; +use crate::response_body::ResponseBytesInner; +use crate::response_body::ResponseStreamResult; + pub type Request = hyper::Request; pub type Response = hyper::Response; @@ -606,16 +607,18 @@ impl Drop for HttpRecordResponse { #[cfg(test)] mod tests { - use super::*; - use crate::response_body::Compression; - use crate::response_body::ResponseBytesInner; + use std::error::Error as StdError; + use bytes::Buf; use deno_net::raw::NetworkStreamType; use hyper::body::Body; use hyper::service::service_fn; use hyper::service::HttpService; use hyper_util::rt::TokioIo; - use std::error::Error as StdError; + + use super::*; + use crate::response_body::Compression; + use crate::response_body::ResponseBytesInner; /// Execute client request on service and concurrently map the response. async fn serve_request( diff --git a/ext/http/websocket_upgrade.rs b/ext/http/websocket_upgrade.rs index af9504717e..aae4a13883 100644 --- a/ext/http/websocket_upgrade.rs +++ b/ext/http/websocket_upgrade.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::marker::PhantomData; @@ -169,9 +169,10 @@ impl WebSocketUpgrade { #[cfg(test)] mod tests { - use super::*; use hyper_v014::Body; + use super::*; + type ExpectedResponseAndHead = Option<(Response, &'static [u8])>; fn assert_response( diff --git a/ext/io/12_io.js b/ext/io/12_io.js index 3cdcb113ba..b2556649ee 100644 --- a/ext/io/12_io.js +++ b/ext/io/12_io.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Interfaces 100% copied from Go. // Documentation liberally lifted from them too. diff --git a/ext/io/Cargo.toml b/ext/io/Cargo.toml index 9298c654c1..782bd64444 100644 --- a/ext/io/Cargo.toml +++ b/ext/io/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_io" diff --git a/ext/io/bi_pipe.rs b/ext/io/bi_pipe.rs index bf65d3037f..33c3267075 100644 --- a/ext/io/bi_pipe.rs +++ b/ext/io/bi_pipe.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::rc::Rc; @@ -338,6 +338,11 @@ pub fn bi_pipe_pair_raw( // TODO(nathanwhit): more granular unsafe blocks // SAFETY: win32 calls unsafe { + use std::io; + use std::os::windows::ffi::OsStrExt; + use std::path::Path; + use std::ptr; + use windows_sys::Win32::Foundation::CloseHandle; use windows_sys::Win32::Foundation::ERROR_ACCESS_DENIED; use windows_sys::Win32::Foundation::ERROR_PIPE_CONNECTED; @@ -355,11 +360,6 @@ pub fn bi_pipe_pair_raw( use windows_sys::Win32::System::Pipes::PIPE_READMODE_BYTE; use windows_sys::Win32::System::Pipes::PIPE_TYPE_BYTE; - use std::io; - use std::os::windows::ffi::OsStrExt; - use std::path::Path; - use std::ptr; - let (path, hd1) = loop { let name = format!("\\\\.\\pipe\\{}", uuid::Uuid::new_v4()); let mut path = Path::new(&name) diff --git a/ext/io/fs.rs b/ext/io/fs.rs index bd5dfd0bb9..ee0c7da5da 100644 --- a/ext/io/fs.rs +++ b/ext/io/fs.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::fmt::Formatter; diff --git a/ext/io/lib.rs b/ext/io/lib.rs index 873fccd7b8..f78e5a58fc 100644 --- a/ext/io/lib.rs +++ b/ext/io/lib.rs @@ -1,5 +1,23 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::borrow::Cow; +use std::cell::RefCell; +use std::fs::File as StdFile; +use std::future::Future; +use std::io; +use std::io::ErrorKind; +use std::io::Read; +use std::io::Seek; +use std::io::Write; +#[cfg(unix)] +use std::os::unix::io::FromRawFd; +#[cfg(windows)] +use std::os::windows::io::FromRawHandle; +use std::rc::Rc; +#[cfg(windows)] +use std::sync::Arc; + +use deno_core::futures::TryFutureExt; use deno_core::op2; use deno_core::unsync::spawn_blocking; use deno_core::unsync::TaskQueue; @@ -21,40 +39,20 @@ use fs::FsResult; use fs::FsStat; use fs3::FileExt; use once_cell::sync::Lazy; -use std::borrow::Cow; -use std::cell::RefCell; -use std::fs::File as StdFile; -use std::future::Future; -use std::io; -use std::io::ErrorKind; -use std::io::Read; -use std::io::Seek; -use std::io::Write; -use std::rc::Rc; +#[cfg(windows)] +use parking_lot::Condvar; +#[cfg(windows)] +use parking_lot::Mutex; use tokio::io::AsyncRead; use tokio::io::AsyncReadExt; use tokio::io::AsyncWrite; use tokio::io::AsyncWriteExt; use tokio::process; - -#[cfg(unix)] -use std::os::unix::io::FromRawFd; - -#[cfg(windows)] -use std::os::windows::io::FromRawHandle; #[cfg(windows)] use winapi::um::processenv::GetStdHandle; #[cfg(windows)] use winapi::um::winbase; -use deno_core::futures::TryFutureExt; -#[cfg(windows)] -use parking_lot::Condvar; -#[cfg(windows)] -use parking_lot::Mutex; -#[cfg(windows)] -use std::sync::Arc; - pub mod fs; mod pipe; #[cfg(windows)] @@ -62,19 +60,18 @@ mod winpipe; mod bi_pipe; -pub use pipe::pipe; -pub use pipe::AsyncPipeRead; -pub use pipe::AsyncPipeWrite; -pub use pipe::PipeRead; -pub use pipe::PipeWrite; -pub use pipe::RawPipeHandle; - pub use bi_pipe::bi_pipe_pair_raw; pub use bi_pipe::BiPipe; pub use bi_pipe::BiPipeRead; pub use bi_pipe::BiPipeResource; pub use bi_pipe::BiPipeWrite; pub use bi_pipe::RawBiPipeHandle; +pub use pipe::pipe; +pub use pipe::AsyncPipeRead; +pub use pipe::AsyncPipeWrite; +pub use pipe::PipeRead; +pub use pipe::PipeWrite; +pub use pipe::RawPipeHandle; /// Abstraction over `AsRawFd` (unix) and `AsRawHandle` (windows) pub trait AsRawIoHandle { diff --git a/ext/io/pipe.rs b/ext/io/pipe.rs index e0e019e277..5172bea10e 100644 --- a/ext/io/pipe.rs +++ b/ext/io/pipe.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::io; use std::pin::Pin; use std::process::Stdio; @@ -299,13 +299,14 @@ pub fn pipe_impl() -> io::Result<(PipeRead, PipeWrite)> { #[cfg(test)] mod tests { - use super::*; - use std::io::Read; use std::io::Write; + use tokio::io::AsyncReadExt; use tokio::io::AsyncWriteExt; + use super::*; + #[test] fn test_pipe() { let (mut read, mut write) = pipe().unwrap(); diff --git a/ext/io/winpipe.rs b/ext/io/winpipe.rs index 01d018008d..600eda4091 100644 --- a/ext/io/winpipe.rs +++ b/ext/io/winpipe.rs @@ -1,10 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use rand::thread_rng; -use rand::RngCore; +// Copyright 2018-2025 the Deno authors. MIT license. use std::io; use std::os::windows::io::RawHandle; use std::sync::atomic::AtomicU32; use std::sync::atomic::Ordering; + +use rand::thread_rng; +use rand::RngCore; use winapi::shared::minwindef::DWORD; use winapi::um::errhandlingapi::GetLastError; use winapi::um::fileapi::CreateFileA; @@ -116,7 +117,6 @@ fn create_named_pipe_inner() -> io::Result<(RawHandle, RawHandle)> { #[cfg(test)] mod tests { - use super::*; use std::fs::File; use std::io::Read; use std::io::Write; @@ -124,6 +124,8 @@ mod tests { use std::sync::Arc; use std::sync::Barrier; + use super::*; + #[test] fn make_named_pipe() { let (server, client) = create_named_pipe().unwrap(); diff --git a/ext/kv/01_db.ts b/ext/kv/01_db.ts index c644ff7121..0575c2c414 100644 --- a/ext/kv/01_db.ts +++ b/ext/kv/01_db.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; const { diff --git a/ext/kv/Cargo.toml b/ext/kv/Cargo.toml index c97aa75552..451fa50cf9 100644 --- a/ext/kv/Cargo.toml +++ b/ext/kv/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_kv" diff --git a/ext/kv/config.rs b/ext/kv/config.rs index 7166bcbcc2..f762a74578 100644 --- a/ext/kv/config.rs +++ b/ext/kv/config.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #[derive(Clone, Copy, Debug)] pub struct KvConfig { diff --git a/ext/kv/dynamic.rs b/ext/kv/dynamic.rs index 6d545d79f6..33e3d4842f 100644 --- a/ext/kv/dynamic.rs +++ b/ext/kv/dynamic.rs @@ -1,8 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::rc::Rc; +use async_trait::async_trait; +use deno_core::error::type_error; +use deno_core::error::AnyError; +use deno_core::OpState; +use denokv_proto::CommitResult; +use denokv_proto::ReadRangeOutput; +use denokv_proto::WatchStream; + use crate::remote::RemoteDbHandlerPermissions; use crate::sqlite::SqliteDbHandler; use crate::sqlite::SqliteDbHandlerPermissions; @@ -12,13 +20,6 @@ use crate::DatabaseHandler; use crate::QueueMessageHandle; use crate::ReadRange; use crate::SnapshotReadOptions; -use async_trait::async_trait; -use deno_core::error::type_error; -use deno_core::error::AnyError; -use deno_core::OpState; -use denokv_proto::CommitResult; -use denokv_proto::ReadRangeOutput; -use denokv_proto::WatchStream; pub struct MultiBackendDbHandler { backends: Vec<(&'static [&'static str], Box)>, diff --git a/ext/kv/interface.rs b/ext/kv/interface.rs index 9737a9366d..fec0ef1afd 100644 --- a/ext/kv/interface.rs +++ b/ext/kv/interface.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::rc::Rc; diff --git a/ext/kv/lib.rs b/ext/kv/lib.rs index ce7509721a..82dda6d759 100644 --- a/ext/kv/lib.rs +++ b/ext/kv/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub mod config; pub mod dynamic; diff --git a/ext/kv/remote.rs b/ext/kv/remote.rs index 891786e319..cb408ef644 100644 --- a/ext/kv/remote.rs +++ b/ext/kv/remote.rs @@ -1,11 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::marker::PhantomData; use std::rc::Rc; use std::sync::Arc; -use crate::DatabaseHandler; use anyhow::Context; use async_trait::async_trait; use bytes::Bytes; @@ -27,6 +26,8 @@ use denokv_remote::RemoteTransport; use http_body_util::BodyExt; use url::Url; +use crate::DatabaseHandler; + #[derive(Clone)] pub struct HttpOptions { pub user_agent: String, diff --git a/ext/kv/sqlite.rs b/ext/kv/sqlite.rs index 9de5209275..a88c61d723 100644 --- a/ext/kv/sqlite.rs +++ b/ext/kv/sqlite.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::RefCell; @@ -13,7 +13,6 @@ use std::sync::Arc; use std::sync::Mutex; use std::sync::OnceLock; -use crate::DatabaseHandler; use async_trait::async_trait; use deno_core::error::type_error; use deno_core::error::AnyError; @@ -27,6 +26,8 @@ use denokv_sqlite::SqliteNotifier; use rand::SeedableRng; use rusqlite::OpenFlags; +use crate::DatabaseHandler; + static SQLITE_NOTIFIERS_MAP: OnceLock>> = OnceLock::new(); diff --git a/ext/napi/Cargo.toml b/ext/napi/Cargo.toml index 5d726b3e31..a17fd9e0f6 100644 --- a/ext/napi/Cargo.toml +++ b/ext/napi/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_napi" diff --git a/ext/napi/build.rs b/ext/napi/build.rs index 8705830a95..71686d6451 100644 --- a/ext/napi/build.rs +++ b/ext/napi/build.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. fn main() { let symbols_file_name = match std::env::consts::OS { diff --git a/ext/napi/function.rs b/ext/napi/function.rs index a128ad7900..681f014421 100644 --- a/ext/napi/function.rs +++ b/ext/napi/function.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use crate::*; #[repr(C)] diff --git a/ext/napi/js_native_api.rs b/ext/napi/js_native_api.rs index 53a12d6eba..80579081f3 100644 --- a/ext/napi/js_native_api.rs +++ b/ext/napi/js_native_api.rs @@ -1,12 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(non_upper_case_globals)] #![deny(unsafe_op_in_unsafe_fn)] const NAPI_VERSION: u32 = 9; -use crate::*; +use std::ptr::NonNull; + use libc::INT_MAX; +use napi_sym::napi_sym; use super::util::check_new_from_utf8; use super::util::check_new_from_utf8_len; @@ -20,8 +22,7 @@ use crate::check_env; use crate::function::create_function; use crate::function::create_function_template; use crate::function::CallbackInfo; -use napi_sym::napi_sym; -use std::ptr::NonNull; +use crate::*; #[derive(Debug, Clone, Copy, PartialEq)] enum ReferenceOwnership { diff --git a/ext/napi/lib.rs b/ext/napi/lib.rs index 6db6af48a2..3f495e05e6 100644 --- a/ext/napi/lib.rs +++ b/ext/napi/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] @@ -22,17 +22,18 @@ pub mod util; pub mod uv; use core::ptr::NonNull; +use std::cell::RefCell; +use std::collections::HashMap; +use std::path::PathBuf; +use std::rc::Rc; +use std::thread_local; + use deno_core::op2; use deno_core::parking_lot::RwLock; use deno_core::url::Url; use deno_core::ExternalOpsTracker; use deno_core::OpState; use deno_core::V8CrossThreadTaskSpawner; -use std::cell::RefCell; -use std::collections::HashMap; -use std::path::PathBuf; -use std::rc::Rc; -use std::thread_local; #[derive(Debug, thiserror::Error)] pub enum NApiError { @@ -46,20 +47,19 @@ pub enum NApiError { Permission(#[from] PermissionCheckError), } -#[cfg(unix)] -use libloading::os::unix::*; - -#[cfg(windows)] -use libloading::os::windows::*; +pub use std::ffi::CStr; +pub use std::os::raw::c_char; +pub use std::os::raw::c_void; +pub use std::ptr; // Expose common stuff for ease of use. // `use deno_napi::*` pub use deno_core::v8; use deno_permissions::PermissionCheckError; -pub use std::ffi::CStr; -pub use std::os::raw::c_char; -pub use std::os::raw::c_void; -pub use std::ptr; +#[cfg(unix)] +use libloading::os::unix::*; +#[cfg(windows)] +use libloading::os::windows::*; pub use value::napi_value; pub mod function; diff --git a/ext/napi/node_api.rs b/ext/napi/node_api.rs index 2ca5c8d0b4..13ea0b3e62 100644 --- a/ext/napi/node_api.rs +++ b/ext/napi/node_api.rs @@ -1,7 +1,18 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![deny(unsafe_op_in_unsafe_fn)] +use std::sync::atomic::AtomicBool; +use std::sync::atomic::AtomicU8; +use std::sync::atomic::AtomicUsize; +use std::sync::atomic::Ordering; +use std::sync::Arc; + +use deno_core::parking_lot::Condvar; +use deno_core::parking_lot::Mutex; +use deno_core::V8CrossThreadTaskSpawner; +use napi_sym::napi_sym; + use super::util::get_array_buffer_ptr; use super::util::make_external_backing_store; use super::util::napi_clear_last_error; @@ -10,15 +21,6 @@ use super::util::SendPtr; use crate::check_arg; use crate::check_env; use crate::*; -use deno_core::parking_lot::Condvar; -use deno_core::parking_lot::Mutex; -use deno_core::V8CrossThreadTaskSpawner; -use napi_sym::napi_sym; -use std::sync::atomic::AtomicBool; -use std::sync::atomic::AtomicU8; -use std::sync::atomic::AtomicUsize; -use std::sync::atomic::Ordering; -use std::sync::Arc; #[napi_sym] fn napi_module_register(module: *const NapiModule) -> napi_status { diff --git a/ext/napi/sym/Cargo.toml b/ext/napi/sym/Cargo.toml index 22228bd2f6..c832a1fa30 100644 --- a/ext/napi/sym/Cargo.toml +++ b/ext/napi/sym/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "napi_sym" diff --git a/ext/napi/sym/lib.rs b/ext/napi/sym/lib.rs index e2826306b9..94444d8541 100644 --- a/ext/napi/sym/lib.rs +++ b/ext/napi/sym/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use proc_macro::TokenStream; use quote::quote; diff --git a/ext/napi/util.rs b/ext/napi/util.rs index 21e9d433aa..a913eade16 100644 --- a/ext/napi/util.rs +++ b/ext/napi/util.rs @@ -1,7 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::*; +// Copyright 2018-2025 the Deno authors. MIT license. use libc::INT_MAX; +use crate::*; + #[repr(transparent)] pub(crate) struct SendPtr(pub *const T); diff --git a/ext/napi/uv.rs b/ext/napi/uv.rs index ea6b539665..ef4ac495c3 100644 --- a/ext/napi/uv.rs +++ b/ext/napi/uv.rs @@ -1,10 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::*; -use deno_core::parking_lot::Mutex; use std::mem::MaybeUninit; use std::ptr::addr_of_mut; +use deno_core::parking_lot::Mutex; + +use crate::*; + fn assert_ok(res: c_int) -> c_int { if res != 0 { log::error!("bad result in uv polyfill: {res}"); @@ -15,11 +17,12 @@ fn assert_ok(res: c_int) -> c_int { res } +use std::ffi::c_int; + use js_native_api::napi_create_string_utf8; use node_api::napi_create_async_work; use node_api::napi_delete_async_work; use node_api::napi_queue_async_work; -use std::ffi::c_int; const UV_MUTEX_SIZE: usize = { #[cfg(unix)] diff --git a/ext/napi/value.rs b/ext/napi/value.rs index 71beac07e2..851a56e963 100644 --- a/ext/napi/value.rs +++ b/ext/napi/value.rs @@ -1,11 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use deno_core::v8; use std::mem::transmute; use std::ops::Deref; use std::os::raw::c_void; use std::ptr::NonNull; +use deno_core::v8; + /// An FFI-opaque, nullable wrapper around v8::Local. /// rusty_v8 Local handle cannot be empty but napi_value can be. #[repr(transparent)] diff --git a/ext/net/01_net.js b/ext/net/01_net.js index c3e5f9e5ca..3afbd031e6 100644 --- a/ext/net/01_net.js +++ b/ext/net/01_net.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; const { diff --git a/ext/net/02_tls.js b/ext/net/02_tls.js index 6dad965590..21d5512ebd 100644 --- a/ext/net/02_tls.js +++ b/ext/net/02_tls.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, internals, primordials } from "ext:core/mod.js"; const { internalRidSymbol } = core; diff --git a/ext/net/03_quic.js b/ext/net/03_quic.js index e100e7bd64..48b35866d2 100644 --- a/ext/net/03_quic.js +++ b/ext/net/03_quic.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { op_quic_accept, diff --git a/ext/net/Cargo.toml b/ext/net/Cargo.toml index eaee7bfb4b..a834d8c8f3 100644 --- a/ext/net/Cargo.toml +++ b/ext/net/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_net" diff --git a/ext/net/io.rs b/ext/net/io.rs index 2907fa398b..3f12b92a9a 100644 --- a/ext/net/io.rs +++ b/ext/net/io.rs @@ -1,4 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::rc::Rc; use deno_core::futures::TryFutureExt; use deno_core::AsyncMutFuture; @@ -9,14 +12,11 @@ use deno_core::CancelTryFuture; use deno_core::RcRef; use deno_core::Resource; use socket2::SockRef; -use std::borrow::Cow; -use std::rc::Rc; use tokio::io::AsyncRead; use tokio::io::AsyncReadExt; use tokio::io::AsyncWrite; use tokio::io::AsyncWriteExt; use tokio::net::tcp; - #[cfg(unix)] use tokio::net::unix; diff --git a/ext/net/lib.deno_net.d.ts b/ext/net/lib.deno_net.d.ts index 958474cbbd..8e0c384168 100644 --- a/ext/net/lib.deno_net.d.ts +++ b/ext/net/lib.deno_net.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// /// diff --git a/ext/net/lib.rs b/ext/net/lib.rs index 04b3f80010..b2b87fc6ad 100644 --- a/ext/net/lib.rs +++ b/ext/net/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub mod io; pub mod ops; @@ -10,15 +10,16 @@ pub mod raw; pub mod resolve_addr; pub mod tcp; +use std::borrow::Cow; +use std::path::Path; +use std::path::PathBuf; +use std::sync::Arc; + use deno_core::error::AnyError; use deno_core::OpState; use deno_permissions::PermissionCheckError; use deno_tls::rustls::RootCertStore; use deno_tls::RootCertStoreProvider; -use std::borrow::Cow; -use std::path::Path; -use std::path::PathBuf; -use std::sync::Arc; pub const UNSTABLE_FEATURE_NAME: &str = "net"; @@ -204,9 +205,10 @@ deno_core::extension!(deno_net, /// Stub ops for non-unix platforms. #[cfg(not(unix))] mod ops_unix { - use crate::NetPermissions; use deno_core::op2; + use crate::NetPermissions; + macro_rules! stub_op { ($name:ident) => { #[op2(fast)] diff --git a/ext/net/ops.rs b/ext/net/ops.rs index 16148ac90d..1fb0f39280 100644 --- a/ext/net/ops.rs +++ b/ext/net/ops.rs @@ -1,16 +1,17 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::net::Ipv4Addr; +use std::net::Ipv6Addr; +use std::net::SocketAddr; +use std::rc::Rc; +use std::str::FromStr; -use crate::io::TcpStreamResource; -use crate::raw::NetworkListenerResource; -use crate::resolve_addr::resolve_addr; -use crate::resolve_addr::resolve_addr_sync; -use crate::tcp::TcpListener; -use crate::NetPermissions; use deno_core::op2; -use deno_core::CancelFuture; - use deno_core::AsyncRefCell; use deno_core::ByteString; +use deno_core::CancelFuture; use deno_core::CancelHandle; use deno_core::CancelTryFuture; use deno_core::JsBuffer; @@ -35,16 +36,16 @@ use socket2::Domain; use socket2::Protocol; use socket2::Socket; use socket2::Type; -use std::borrow::Cow; -use std::cell::RefCell; -use std::net::Ipv4Addr; -use std::net::Ipv6Addr; -use std::net::SocketAddr; -use std::rc::Rc; -use std::str::FromStr; use tokio::net::TcpStream; use tokio::net::UdpSocket; +use crate::io::TcpStreamResource; +use crate::raw::NetworkListenerResource; +use crate::resolve_addr::resolve_addr; +use crate::resolve_addr::resolve_addr_sync; +use crate::tcp::TcpListener; +use crate::NetPermissions; + #[derive(Serialize, Clone, Debug)] #[serde(rename_all = "camelCase")] pub struct TlsHandshakeInfo { @@ -834,7 +835,14 @@ fn rdata_to_return_record( #[cfg(test)] mod tests { - use super::*; + use std::net::Ipv4Addr; + use std::net::Ipv6Addr; + use std::net::ToSocketAddrs; + use std::path::Path; + use std::path::PathBuf; + use std::sync::Arc; + use std::sync::Mutex; + use deno_core::futures::FutureExt; use deno_core::JsRuntime; use deno_core::RuntimeOptions; @@ -855,13 +863,8 @@ mod tests { use hickory_proto::rr::record_data::RData; use hickory_proto::rr::Name; use socket2::SockRef; - use std::net::Ipv4Addr; - use std::net::Ipv6Addr; - use std::net::ToSocketAddrs; - use std::path::Path; - use std::path::PathBuf; - use std::sync::Arc; - use std::sync::Mutex; + + use super::*; #[test] fn rdata_to_return_record_a() { diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs index 4d2073fd09..5b8cd47751 100644 --- a/ext/net/ops_tls.rs +++ b/ext/net/ops_tls.rs @@ -1,16 +1,17 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::convert::From; +use std::fs::File; +use std::io::BufReader; +use std::io::ErrorKind; +use std::io::Read; +use std::net::SocketAddr; +use std::num::NonZeroUsize; +use std::rc::Rc; +use std::sync::Arc; -use crate::io::TcpStreamResource; -use crate::ops::IpAddr; -use crate::ops::NetError; -use crate::ops::TlsHandshakeInfo; -use crate::raw::NetworkListenerResource; -use crate::resolve_addr::resolve_addr; -use crate::resolve_addr::resolve_addr_sync; -use crate::tcp::TcpListener; -use crate::DefaultTlsOptions; -use crate::NetPermissions; -use crate::UnsafelyIgnoreCertificateErrors; use deno_core::futures::TryFutureExt; use deno_core::op2; use deno_core::v8; @@ -35,25 +36,25 @@ use deno_tls::TlsKey; use deno_tls::TlsKeyLookup; use deno_tls::TlsKeys; use deno_tls::TlsKeysHolder; +pub use rustls_tokio_stream::TlsStream; use rustls_tokio_stream::TlsStreamRead; use rustls_tokio_stream::TlsStreamWrite; use serde::Deserialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::convert::From; -use std::fs::File; -use std::io::BufReader; -use std::io::ErrorKind; -use std::io::Read; -use std::net::SocketAddr; -use std::num::NonZeroUsize; -use std::rc::Rc; -use std::sync::Arc; use tokio::io::AsyncReadExt; use tokio::io::AsyncWriteExt; use tokio::net::TcpStream; -pub use rustls_tokio_stream::TlsStream; +use crate::io::TcpStreamResource; +use crate::ops::IpAddr; +use crate::ops::NetError; +use crate::ops::TlsHandshakeInfo; +use crate::raw::NetworkListenerResource; +use crate::resolve_addr::resolve_addr; +use crate::resolve_addr::resolve_addr_sync; +use crate::tcp::TcpListener; +use crate::DefaultTlsOptions; +use crate::NetPermissions; +use crate::UnsafelyIgnoreCertificateErrors; pub(crate) const TLS_BUFFER_SIZE: Option = NonZeroUsize::new(65536); diff --git a/ext/net/ops_unix.rs b/ext/net/ops_unix.rs index 483dc99b40..b347b81dc7 100644 --- a/ext/net/ops_unix.rs +++ b/ext/net/ops_unix.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::path::Path; +use std::rc::Rc; -use crate::io::UnixStreamResource; -use crate::ops::NetError; -use crate::raw::NetworkListenerResource; -use crate::NetPermissions; use deno_core::op2; use deno_core::AsyncRefCell; use deno_core::CancelHandle; @@ -15,14 +16,15 @@ use deno_core::Resource; use deno_core::ResourceId; use serde::Deserialize; use serde::Serialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::path::Path; -use std::rc::Rc; use tokio::net::UnixDatagram; use tokio::net::UnixListener; pub use tokio::net::UnixStream; +use crate::io::UnixStreamResource; +use crate::ops::NetError; +use crate::raw::NetworkListenerResource; +use crate::NetPermissions; + /// A utility function to map OsStrings to Strings pub fn into_string(s: std::ffi::OsString) -> Result { s.into_string().map_err(NetError::InvalidUtf8) diff --git a/ext/net/quic.rs b/ext/net/quic.rs index 16f68364be..676b2f06a1 100644 --- a/ext/net/quic.rs +++ b/ext/net/quic.rs @@ -1,9 +1,20 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::future::Future; +use std::net::IpAddr; +use std::net::Ipv4Addr; +use std::net::Ipv6Addr; +use std::net::SocketAddrV4; +use std::net::SocketAddrV6; +use std::pin::pin; +use std::rc::Rc; +use std::sync::Arc; +use std::task::Context; +use std::task::Poll; +use std::time::Duration; -use crate::resolve_addr::resolve_addr; -use crate::DefaultTlsOptions; -use crate::NetPermissions; -use crate::UnsafelyIgnoreCertificateErrors; use deno_core::error::bad_resource; use deno_core::error::generic_error; use deno_core::error::AnyError; @@ -27,20 +38,11 @@ use quinn::crypto::rustls::QuicClientConfig; use quinn::crypto::rustls::QuicServerConfig; use serde::Deserialize; use serde::Serialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::future::Future; -use std::net::IpAddr; -use std::net::Ipv4Addr; -use std::net::Ipv6Addr; -use std::net::SocketAddrV4; -use std::net::SocketAddrV6; -use std::pin::pin; -use std::rc::Rc; -use std::sync::Arc; -use std::task::Context; -use std::task::Poll; -use std::time::Duration; + +use crate::resolve_addr::resolve_addr; +use crate::DefaultTlsOptions; +use crate::NetPermissions; +use crate::UnsafelyIgnoreCertificateErrors; #[derive(Debug, Deserialize, Serialize)] struct Addr { diff --git a/ext/net/raw.rs b/ext/net/raw.rs index a2ebfb5acb..0312d661a5 100644 --- a/ext/net/raw.rs +++ b/ext/net/raw.rs @@ -1,6 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::io::TcpStreamResource; -use crate::ops_tls::TlsStreamResource; +// Copyright 2018-2025 the Deno authors. MIT license. +use std::borrow::Cow; +use std::rc::Rc; + use deno_core::error::bad_resource_id; use deno_core::error::custom_error; use deno_core::error::AnyError; @@ -9,8 +10,9 @@ use deno_core::CancelHandle; use deno_core::Resource; use deno_core::ResourceId; use deno_core::ResourceTable; -use std::borrow::Cow; -use std::rc::Rc; + +use crate::io::TcpStreamResource; +use crate::ops_tls::TlsStreamResource; pub trait NetworkStreamTrait: Into { type Resource; diff --git a/ext/net/resolve_addr.rs b/ext/net/resolve_addr.rs index 3a97081eac..9a757391ea 100644 --- a/ext/net/resolve_addr.rs +++ b/ext/net/resolve_addr.rs @@ -1,7 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::net::SocketAddr; use std::net::ToSocketAddrs; + use tokio::net::lookup_host; /// Resolve network address *asynchronously*. @@ -38,12 +39,13 @@ fn make_addr_port_pair(hostname: &str, port: u16) -> (&str, u16) { #[cfg(test)] mod tests { - use super::*; use std::net::Ipv4Addr; use std::net::Ipv6Addr; use std::net::SocketAddrV4; use std::net::SocketAddrV6; + use super::*; + #[tokio::test] async fn resolve_addr1() { let expected = vec![SocketAddr::V4(SocketAddrV4::new( diff --git a/ext/net/tcp.rs b/ext/net/tcp.rs index 63baa8e4be..f2cd5f5705 100644 --- a/ext/net/tcp.rs +++ b/ext/net/tcp.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::net::SocketAddr; use std::sync::Arc; diff --git a/ext/node/Cargo.toml b/ext/node/Cargo.toml index 50e72dfcbe..a3936af735 100644 --- a/ext/node/Cargo.toml +++ b/ext/node/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_node" @@ -14,7 +14,7 @@ description = "Node compatibility for Deno" path = "lib.rs" [features] -sync_fs = ["deno_package_json/sync", "node_resolver/sync"] +sync_fs = ["deno_fs/sync_fs", "deno_package_json/sync", "node_resolver/sync"] [dependencies] aead-gcm-stream = "0.4" @@ -93,6 +93,7 @@ simd-json = "0.14.0" sm3 = "0.4.2" spki.workspace = true stable_deref_trait = "1.2.0" +sys_traits = { workspace = true, features = ["real"] } thiserror.workspace = true tokio.workspace = true tokio-eld = "0.2" diff --git a/ext/node/benchmarks/child_process_ipc.mjs b/ext/node/benchmarks/child_process_ipc.mjs index fa671d76f7..aa4e2699d7 100644 --- a/ext/node/benchmarks/child_process_ipc.mjs +++ b/ext/node/benchmarks/child_process_ipc.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { fork } from "node:child_process"; import process from "node:process"; diff --git a/ext/node/build.rs b/ext/node/build.rs index 041110f257..0d42f2cd76 100644 --- a/ext/node/build.rs +++ b/ext/node/build.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::env; diff --git a/ext/node/global.rs b/ext/node/global.rs index 4d6695431d..a89a3f9830 100644 --- a/ext/node/global.rs +++ b/ext/node/global.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::v8; use deno_core::v8::GetPropertyNamesArgs; diff --git a/ext/node/lib.rs b/ext/node/lib.rs index b9b459efc1..d7aa82430d 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![deny(clippy::print_stderr)] #![deny(clippy::print_stdout)] @@ -14,10 +14,10 @@ use deno_core::url::Url; #[allow(unused_imports)] use deno_core::v8; use deno_core::v8::ExternalReference; -use deno_fs::FsSysTraitsAdapter; use node_resolver::errors::ClosestPkgJsonError; use node_resolver::IsBuiltInNodeModuleChecker; use node_resolver::NpmPackageFolderResolverRc; +use node_resolver::PackageJsonResolverRc; use once_cell::sync::Lazy; extern crate libz_sys as zlib; @@ -185,16 +185,17 @@ fn op_node_build_os() -> String { } #[derive(Clone)] -pub struct NodeExtInitServices { +pub struct NodeExtInitServices { pub node_require_loader: NodeRequireLoaderRc, - pub node_resolver: NodeResolverRc, + pub node_resolver: NodeResolverRc, pub npm_resolver: NpmPackageFolderResolverRc, - pub pkg_json_resolver: PackageJsonResolverRc, + pub pkg_json_resolver: PackageJsonResolverRc, + pub sys: TSys, } deno_core::extension!(deno_node, deps = [ deno_io, deno_fs ], - parameters = [P: NodePermissions], + parameters = [P: NodePermissions, TSys: ExtNodeSys], ops = [ ops::blocklist::op_socket_address_parse, ops::blocklist::op_socket_address_get_serialization, @@ -262,6 +263,7 @@ deno_core::extension!(deno_node, ops::crypto::keys::op_node_derive_public_key_from_private_key, ops::crypto::keys::op_node_dh_keys_generate_and_export, ops::crypto::keys::op_node_export_private_key_der, + ops::crypto::keys::op_node_export_private_key_jwk, ops::crypto::keys::op_node_export_private_key_pem, ops::crypto::keys::op_node_export_public_key_der, ops::crypto::keys::op_node_export_public_key_pem, @@ -391,29 +393,29 @@ deno_core::extension!(deno_node, op_node_build_os, ops::require::op_require_can_parse_as_esm, ops::require::op_require_init_paths, - ops::require::op_require_node_module_paths

, + ops::require::op_require_node_module_paths, ops::require::op_require_proxy_path, - ops::require::op_require_is_deno_dir_package, + ops::require::op_require_is_deno_dir_package, ops::require::op_require_resolve_deno_dir, ops::require::op_require_is_maybe_cjs, ops::require::op_require_is_request_relative, ops::require::op_require_resolve_lookup_paths, - ops::require::op_require_try_self_parent_path

, - ops::require::op_require_try_self

, - ops::require::op_require_real_path

, + ops::require::op_require_try_self_parent_path, + ops::require::op_require_try_self, + ops::require::op_require_real_path, ops::require::op_require_path_is_absolute, ops::require::op_require_path_dirname, - ops::require::op_require_stat

, + ops::require::op_require_stat, ops::require::op_require_path_resolve, ops::require::op_require_path_basename, ops::require::op_require_read_file

, ops::require::op_require_as_file_path, - ops::require::op_require_resolve_exports

, - ops::require::op_require_read_package_scope

, - ops::require::op_require_package_imports_resolve

, + ops::require::op_require_resolve_exports, + ops::require::op_require_read_package_scope, + ops::require::op_require_package_imports_resolve, ops::require::op_require_break_on_next_statement, ops::util::op_node_guess_handle_type, - ops::worker_threads::op_worker_threads_filename

, + ops::worker_threads::op_worker_threads_filename, ops::ipc::op_node_child_ipc_pipe, ops::ipc::op_node_ipc_write, ops::ipc::op_node_ipc_read, @@ -679,13 +681,14 @@ deno_core::extension!(deno_node, "node:zlib" = "zlib.ts", ], options = { - maybe_init: Option, + maybe_init: Option>, fs: deno_fs::FileSystemRc, }, state = |state, options| { state.put(options.fs.clone()); if let Some(init) = &options.maybe_init { + state.put(init.sys.clone()); state.put(init.node_require_loader.clone()); state.put(init.node_resolver.clone()); state.put(init.npm_resolver.clone()); @@ -819,18 +822,22 @@ impl IsBuiltInNodeModuleChecker for RealIsBuiltInNodeModuleChecker { } } -pub type NodeResolver = node_resolver::NodeResolver< - RealIsBuiltInNodeModuleChecker, - FsSysTraitsAdapter, ->; +pub trait ExtNodeSys: + sys_traits::BaseFsCanonicalize + + sys_traits::BaseFsMetadata + + sys_traits::BaseFsRead + + sys_traits::EnvCurrentDir + + Clone +{ +} + +impl ExtNodeSys for sys_traits::impls::RealSys {} + +pub type NodeResolver = + node_resolver::NodeResolver; #[allow(clippy::disallowed_types)] -pub type NodeResolverRc = deno_fs::sync::MaybeArc; -pub type PackageJsonResolver = - node_resolver::PackageJsonResolver; +pub type NodeResolverRc = deno_fs::sync::MaybeArc>; #[allow(clippy::disallowed_types)] -pub type PackageJsonResolverRc = deno_fs::sync::MaybeArc< - node_resolver::PackageJsonResolver, ->; pub fn create_host_defined_options<'s>( scope: &mut v8::HandleScope<'s>, diff --git a/ext/node/ops/blocklist.rs b/ext/node/ops/blocklist.rs index 6c64d68eca..bcb36fc97b 100644 --- a/ext/node/ops/blocklist.rs +++ b/ext/node/ops/blocklist.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::collections::HashSet; @@ -9,7 +9,6 @@ use std::net::SocketAddr; use deno_core::op2; use deno_core::OpState; - use ipnetwork::IpNetwork; use ipnetwork::Ipv4Network; use ipnetwork::Ipv6Network; diff --git a/ext/node/ops/buffer.rs b/ext/node/ops/buffer.rs index 01f878ec15..e3ae2b2391 100644 --- a/ext/node/ops/buffer.rs +++ b/ext/node/ops/buffer.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::anyhow::anyhow; use deno_core::anyhow::Result; diff --git a/ext/node/ops/crypto/cipher.rs b/ext/node/ops/crypto/cipher.rs index 7f5b108a04..500d8d1b4b 100644 --- a/ext/node/ops/crypto/cipher.rs +++ b/ext/node/ops/crypto/cipher.rs @@ -1,4 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::rc::Rc; use aes::cipher::block_padding::Pkcs7; use aes::cipher::BlockDecryptMut; @@ -8,10 +12,6 @@ use deno_core::Resource; use digest::generic_array::GenericArray; use digest::KeyInit; -use std::borrow::Cow; -use std::cell::RefCell; -use std::rc::Rc; - type Tag = Option>; type Aes128Gcm = aead_gcm_stream::AesGcm; diff --git a/ext/node/ops/crypto/dh.rs b/ext/node/ops/crypto/dh.rs index ff2bd030eb..88452c3660 100644 --- a/ext/node/ops/crypto/dh.rs +++ b/ext/node/ops/crypto/dh.rs @@ -1,10 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::primes::Prime; use num_bigint_dig::BigUint; use num_bigint_dig::RandBigInt; use num_traits::FromPrimitive; +use super::primes::Prime; + #[derive(Clone)] pub struct PublicKey(BigUint); diff --git a/ext/node/ops/crypto/digest.rs b/ext/node/ops/crypto/digest.rs index a7d8fb51f1..f9810e8c67 100644 --- a/ext/node/ops/crypto/digest.rs +++ b/ext/node/ops/crypto/digest.rs @@ -1,11 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::cell::RefCell; +use std::rc::Rc; + use deno_core::GarbageCollected; use digest::Digest; use digest::DynDigest; use digest::ExtendableOutput; use digest::Update; -use std::cell::RefCell; -use std::rc::Rc; pub struct Hasher { pub hash: Rc>>, diff --git a/ext/node/ops/crypto/keys.rs b/ext/node/ops/crypto/keys.rs index f164972d48..d982d96a8c 100644 --- a/ext/node/ops/crypto/keys.rs +++ b/ext/node/ops/crypto/keys.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::RefCell; @@ -26,6 +26,7 @@ use rsa::pkcs1::DecodeRsaPrivateKey as _; use rsa::pkcs1::DecodeRsaPublicKey; use rsa::pkcs1::EncodeRsaPrivateKey as _; use rsa::pkcs1::EncodeRsaPublicKey; +use rsa::traits::PrivateKeyParts; use rsa::traits::PublicKeyParts; use rsa::RsaPrivateKey; use rsa::RsaPublicKey; @@ -255,6 +256,16 @@ impl EcPrivateKey { EcPrivateKey::P384(key) => EcPublicKey::P384(key.public_key()), } } + + pub fn to_jwk(&self) -> Result { + match self { + EcPrivateKey::P224(_) => { + Err(AsymmetricPrivateKeyJwkError::UnsupportedJwkEcCurveP224) + } + EcPrivateKey::P256(key) => Ok(key.to_jwk()), + EcPrivateKey::P384(key) => Ok(key.to_jwk()), + } + } } // https://oidref.com/ @@ -1107,6 +1118,16 @@ fn bytes_to_b64(bytes: &[u8]) -> String { BASE64_URL_SAFE_NO_PAD.encode(bytes) } +#[derive(Debug, thiserror::Error)] +pub enum AsymmetricPrivateKeyJwkError { + #[error("key is not an asymmetric private key")] + KeyIsNotAsymmetricPrivateKey, + #[error("Unsupported JWK EC curve: P224")] + UnsupportedJwkEcCurveP224, + #[error("jwk export not implemented for this key type")] + JwkExportNotImplementedForKeyType, +} + #[derive(Debug, thiserror::Error)] pub enum AsymmetricPublicKeyJwkError { #[error("key is not an asymmetric public key")] @@ -1328,7 +1349,73 @@ pub enum AsymmetricPrivateKeyDerError { UnsupportedKeyType(String), } +// https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2 +fn rsa_private_to_jwk(key: &RsaPrivateKey) -> deno_core::serde_json::Value { + let n = key.n(); + let e = key.e(); + let d = key.d(); + let p = &key.primes()[0]; + let q = &key.primes()[1]; + let dp = key.dp(); + let dq = key.dq(); + let qi = key.crt_coefficient(); + let oth = &key.primes()[2..]; + + let mut obj = deno_core::serde_json::json!({ + "kty": "RSA", + "n": bytes_to_b64(&n.to_bytes_be()), + "e": bytes_to_b64(&e.to_bytes_be()), + "d": bytes_to_b64(&d.to_bytes_be()), + "p": bytes_to_b64(&p.to_bytes_be()), + "q": bytes_to_b64(&q.to_bytes_be()), + "dp": dp.map(|dp| bytes_to_b64(&dp.to_bytes_be())), + "dq": dq.map(|dq| bytes_to_b64(&dq.to_bytes_be())), + "qi": qi.map(|qi| bytes_to_b64(&qi.to_bytes_be())), + }); + + if !oth.is_empty() { + obj["oth"] = deno_core::serde_json::json!(oth + .iter() + .map(|o| o.to_bytes_be()) + .collect::>()); + } + + obj +} + impl AsymmetricPrivateKey { + fn export_jwk( + &self, + ) -> Result { + match self { + AsymmetricPrivateKey::Rsa(key) => Ok(rsa_private_to_jwk(key)), + AsymmetricPrivateKey::RsaPss(key) => Ok(rsa_private_to_jwk(&key.key)), + AsymmetricPrivateKey::Ec(key) => { + let jwk = key.to_jwk()?; + Ok(deno_core::serde_json::json!(jwk)) + } + AsymmetricPrivateKey::X25519(static_secret) => { + let bytes = static_secret.to_bytes(); + + Ok(deno_core::serde_json::json!({ + "kty": "OKP", + "crv": "X25519", + "d": bytes_to_b64(&bytes), + })) + } + AsymmetricPrivateKey::Ed25519(key) => { + let bytes = key.to_bytes(); + + Ok(deno_core::serde_json::json!({ + "kty": "OKP", + "crv": "Ed25519", + "d": bytes_to_b64(&bytes), + })) + } + _ => Err(AsymmetricPrivateKeyJwkError::JwkExportNotImplementedForKeyType), + } + } + fn export_der( &self, typ: &str, @@ -2329,6 +2416,28 @@ pub fn op_node_export_private_key_pem( Ok(String::from_utf8(out).expect("invalid pem is not possible")) } +#[derive(Debug, thiserror::Error)] +pub enum ExportPrivateKeyJwkError { + #[error(transparent)] + AsymmetricPublicKeyJwk(#[from] AsymmetricPrivateKeyJwkError), + #[error("very large data")] + VeryLargeData, + #[error(transparent)] + Der(#[from] der::Error), +} + +#[op2] +#[serde] +pub fn op_node_export_private_key_jwk( + #[cppgc] handle: &KeyObjectHandle, +) -> Result { + let private_key = handle + .as_private_key() + .ok_or(AsymmetricPrivateKeyJwkError::KeyIsNotAsymmetricPrivateKey)?; + + Ok(private_key.export_jwk()?) +} + #[op2] #[buffer] pub fn op_node_export_private_key_der( diff --git a/ext/node/ops/crypto/md5_sha1.rs b/ext/node/ops/crypto/md5_sha1.rs index 9164b0a1cb..c6c6eb1c83 100644 --- a/ext/node/ops/crypto/md5_sha1.rs +++ b/ext/node/ops/crypto/md5_sha1.rs @@ -1,5 +1,6 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use core::fmt; + use digest::core_api::AlgorithmName; use digest::core_api::BlockSizeUser; use digest::core_api::Buffer; diff --git a/ext/node/ops/crypto/mod.rs b/ext/node/ops/crypto/mod.rs index e90e820909..19a0bbfc40 100644 --- a/ext/node/ops/crypto/mod.rs +++ b/ext/node/ops/crypto/mod.rs @@ -1,4 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::future::Future; +use std::rc::Rc; + use deno_core::error::generic_error; use deno_core::error::type_error; use deno_core::op2; @@ -16,16 +19,13 @@ use keys::EcPublicKey; use keys::KeyObjectHandle; use num_bigint::BigInt; use num_bigint_dig::BigUint; +use p224::NistP224; +use p256::NistP256; +use p384::NistP384; use rand::distributions::Distribution; use rand::distributions::Uniform; use rand::Rng; use ring::signature::Ed25519KeyPair; -use std::future::Future; -use std::rc::Rc; - -use p224::NistP224; -use p256::NistP256; -use p384::NistP384; use rsa::pkcs8::DecodePrivateKey; use rsa::pkcs8::DecodePublicKey; use rsa::Oaep; diff --git a/ext/node/ops/crypto/pkcs3.rs b/ext/node/ops/crypto/pkcs3.rs index 5772514608..6668148d23 100644 --- a/ext/node/ops/crypto/pkcs3.rs +++ b/ext/node/ops/crypto/pkcs3.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // // PKCS #3: Diffie-Hellman Key Agreement Standard diff --git a/ext/node/ops/crypto/primes.rs b/ext/node/ops/crypto/primes.rs index 2e5d1ff63c..65ffa7a7a0 100644 --- a/ext/node/ops/crypto/primes.rs +++ b/ext/node/ops/crypto/primes.rs @@ -1,4 +1,6 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ops::Deref; use num_bigint::BigInt; use num_bigint_dig::RandPrime; @@ -6,7 +8,6 @@ use num_integer::Integer; use num_traits::One; use num_traits::Zero; use rand::Rng; -use std::ops::Deref; #[derive(Clone)] pub struct Prime(pub num_bigint_dig::BigUint); @@ -283,9 +284,10 @@ static SMALL_PRIMES: [u32; 2047] = [ #[cfg(test)] mod tests { - use super::*; use num_bigint::BigInt; + use super::*; + #[test] fn test_prime() { for &p in SMALL_PRIMES.iter() { diff --git a/ext/node/ops/crypto/sign.rs b/ext/node/ops/crypto/sign.rs index 30094c0765..e7c15d16b7 100644 --- a/ext/node/ops/crypto/sign.rs +++ b/ext/node/ops/crypto/sign.rs @@ -1,24 +1,24 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use core::ops::Add; + +use ecdsa::der::MaxOverhead; +use ecdsa::der::MaxSize; +use elliptic_curve::generic_array::ArrayLength; +use elliptic_curve::FieldBytesSize; use rand::rngs::OsRng; use rsa::signature::hazmat::PrehashSigner as _; use rsa::signature::hazmat::PrehashVerifier as _; use rsa::traits::SignatureScheme as _; use spki::der::Decode; -use crate::ops::crypto::digest::match_fixed_digest; -use crate::ops::crypto::digest::match_fixed_digest_with_oid; - use super::keys::AsymmetricPrivateKey; use super::keys::AsymmetricPublicKey; use super::keys::EcPrivateKey; use super::keys::EcPublicKey; use super::keys::KeyObjectHandle; use super::keys::RsaPssHashAlgorithm; -use core::ops::Add; -use ecdsa::der::MaxOverhead; -use ecdsa::der::MaxSize; -use elliptic_curve::generic_array::ArrayLength; -use elliptic_curve::FieldBytesSize; +use crate::ops::crypto::digest::match_fixed_digest; +use crate::ops::crypto::digest::match_fixed_digest_with_oid; fn dsa_signature( encoding: u32, diff --git a/ext/node/ops/crypto/x509.rs b/ext/node/ops/crypto/x509.rs index ab8e52f703..23b19720e3 100644 --- a/ext/node/ops/crypto/x509.rs +++ b/ext/node/ops/crypto/x509.rs @@ -1,7 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ops::Deref; use deno_core::op2; - +use digest::Digest; use x509_parser::der_parser::asn1_rs::Any; use x509_parser::der_parser::asn1_rs::Tag; use x509_parser::der_parser::oid::Oid; @@ -9,14 +11,10 @@ pub use x509_parser::error::X509Error; use x509_parser::extensions; use x509_parser::pem; use x509_parser::prelude::*; - -use super::KeyObjectHandle; - -use std::ops::Deref; use yoke::Yoke; use yoke::Yokeable; -use digest::Digest; +use super::KeyObjectHandle; enum CertificateSources { Der(Box<[u8]>), diff --git a/ext/node/ops/fs.rs b/ext/node/ops/fs.rs index 58a688a1fe..73db3ea2e5 100644 --- a/ext/node/ops/fs.rs +++ b/ext/node/ops/fs.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::rc::Rc; @@ -207,6 +207,7 @@ where { use std::ffi::OsStr; use std::os::windows::ffi::OsStrExt; + use windows_sys::Win32::Storage::FileSystem::GetDiskFreeSpaceW; let _ = bigint; diff --git a/ext/node/ops/http.rs b/ext/node/ops/http.rs index eb28e68aee..ad6217b6a6 100644 --- a/ext/node/ops/http.rs +++ b/ext/node/ops/http.rs @@ -1,7 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::RefCell; +use std::cmp::min; use std::fmt::Debug; use std::pin::Pin; use std::rc::Rc; @@ -48,7 +49,6 @@ use http_body_util::BodyExt; use hyper::body::Frame; use hyper::body::Incoming; use hyper_util::rt::TokioIo; -use std::cmp::min; use tokio::io::AsyncReadExt; use tokio::io::AsyncWriteExt; diff --git a/ext/node/ops/http2.rs b/ext/node/ops/http2.rs index 53dada9f41..c6c6484477 100644 --- a/ext/node/ops/http2.rs +++ b/ext/node/ops/http2.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::RefCell; diff --git a/ext/node/ops/idna.rs b/ext/node/ops/idna.rs index a3d85e77c2..4ae1ce3954 100644 --- a/ext/node/ops/idna.rs +++ b/ext/node/ops/idna.rs @@ -1,9 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -use deno_core::op2; +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; +use deno_core::op2; + // map_domain, to_ascii and to_unicode are based on the punycode implementation in node.js // https://github.com/nodejs/node/blob/73025c4dec042e344eeea7912ed39f7b7c4a3991/lib/punycode.js diff --git a/ext/node/ops/inspector.rs b/ext/node/ops/inspector.rs index 9986aeb197..03cfed4592 100644 --- a/ext/node/ops/inspector.rs +++ b/ext/node/ops/inspector.rs @@ -1,6 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::cell::RefCell; +use std::rc::Rc; -use crate::NodePermissions; use deno_core::anyhow::Error; use deno_core::error::generic_error; use deno_core::futures::channel::mpsc; @@ -11,8 +13,8 @@ use deno_core::InspectorSessionKind; use deno_core::InspectorSessionOptions; use deno_core::JsRuntimeInspector; use deno_core::OpState; -use std::cell::RefCell; -use std::rc::Rc; + +use crate::NodePermissions; #[op2(fast)] pub fn op_inspector_enabled() -> bool { diff --git a/ext/node/ops/ipc.rs b/ext/node/ops/ipc.rs index 672cf0d707..0eb3ae6aae 100644 --- a/ext/node/ops/ipc.rs +++ b/ext/node/ops/ipc.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub use impl_::*; @@ -30,6 +30,9 @@ mod impl_ { use deno_core::RcRef; use deno_core::ResourceId; use deno_core::ToV8; + use deno_io::BiPipe; + use deno_io::BiPipeRead; + use deno_io::BiPipeWrite; use memchr::memchr; use pin_project_lite::pin_project; use serde::Serialize; @@ -37,10 +40,6 @@ mod impl_ { use tokio::io::AsyncWriteExt; use tokio::io::ReadBuf; - use deno_io::BiPipe; - use deno_io::BiPipeRead; - use deno_io::BiPipeWrite; - /// Wrapper around v8 value that implements Serialize. struct SerializeWrapper<'a, 'b>( RefCell<&'b mut v8::HandleScope<'a>>, @@ -624,13 +623,15 @@ mod impl_ { #[cfg(test)] mod tests { - use super::IpcJsonStreamResource; + use std::rc::Rc; + use deno_core::serde_json::json; use deno_core::v8; use deno_core::JsRuntime; use deno_core::RcRef; use deno_core::RuntimeOptions; - use std::rc::Rc; + + use super::IpcJsonStreamResource; #[allow(clippy::unused_async)] #[cfg(unix)] diff --git a/ext/node/ops/mod.rs b/ext/node/ops/mod.rs index e5ea8b4172..0b7be91860 100644 --- a/ext/node/ops/mod.rs +++ b/ext/node/ops/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub mod blocklist; pub mod buffer; diff --git a/ext/node/ops/os/cpus.rs b/ext/node/ops/os/cpus.rs index 2b931884c3..d9b28ce88c 100644 --- a/ext/node/ops/os/cpus.rs +++ b/ext/node/ops/os/cpus.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::serde::Serialize; @@ -127,13 +127,13 @@ pub fn cpu_info() -> Option> { #[cfg(target_os = "windows")] pub fn cpu_info() -> Option> { + use std::os::windows::ffi::OsStrExt; + use std::os::windows::ffi::OsStringExt; + use windows_sys::Wdk::System::SystemInformation::NtQuerySystemInformation; use windows_sys::Wdk::System::SystemInformation::SystemProcessorPerformanceInformation; use windows_sys::Win32::System::WindowsProgramming::SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; - use std::os::windows::ffi::OsStrExt; - use std::os::windows::ffi::OsStringExt; - fn encode_wide(s: &str) -> Vec { std::ffi::OsString::from(s) .encode_wide() diff --git a/ext/node/ops/os/mod.rs b/ext/node/ops/os/mod.rs index ddb2a70c64..d45f67bd13 100644 --- a/ext/node/ops/os/mod.rs +++ b/ext/node/ops/os/mod.rs @@ -1,11 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::mem::MaybeUninit; -use crate::NodePermissions; use deno_core::op2; use deno_core::OpState; +use crate::NodePermissions; + mod cpus; pub mod priority; diff --git a/ext/node/ops/os/priority.rs b/ext/node/ops/os/priority.rs index 9a1ebcca70..f9e686ceba 100644 --- a/ext/node/ops/os/priority.rs +++ b/ext/node/ops/os/priority.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub use impl_::*; diff --git a/ext/node/ops/perf_hooks.rs b/ext/node/ops/perf_hooks.rs index 636d0b2adb..eca5fe2fa8 100644 --- a/ext/node/ops/perf_hooks.rs +++ b/ext/node/ops/perf_hooks.rs @@ -1,10 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::cell::Cell; use deno_core::op2; use deno_core::GarbageCollected; -use std::cell::Cell; - #[derive(Debug, thiserror::Error)] pub enum PerfHooksError { #[error(transparent)] diff --git a/ext/node/ops/process.rs b/ext/node/ops/process.rs index 45c599bee2..0ef360af8c 100644 --- a/ext/node/ops/process.rs +++ b/ext/node/ops/process.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::op2; use deno_core::OpState; diff --git a/ext/node/ops/require.rs b/ext/node/ops/require.rs index ddcdec0bbd..218079d4e1 100644 --- a/ext/node/ops/require.rs +++ b/ext/node/ops/require.rs @@ -1,14 +1,19 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::path::Path; +use std::path::PathBuf; +use std::rc::Rc; use boxed_error::Boxed; use deno_core::error::AnyError; use deno_core::op2; use deno_core::url::Url; use deno_core::v8; +use deno_core::FastString; use deno_core::JsRuntimeInspector; use deno_core::OpState; -use deno_fs::FileSystemRc; -use deno_fs::V8MaybeStaticStr; use deno_package_json::PackageJsonRc; use deno_path_util::normalize_path; use deno_path_util::url_from_file_path; @@ -17,12 +22,11 @@ use node_resolver::errors::ClosestPkgJsonError; use node_resolver::NodeResolutionKind; use node_resolver::ResolutionMode; use node_resolver::REQUIRE_CONDITIONS; -use std::borrow::Cow; -use std::cell::RefCell; -use std::path::Path; -use std::path::PathBuf; -use std::rc::Rc; +use sys_traits::FsCanonicalize; +use sys_traits::FsMetadata; +use sys_traits::FsMetadataValue; +use crate::ExtNodeSys; use crate::NodePermissions; use crate::NodeRequireLoaderRc; use crate::NodeResolverRc; @@ -68,11 +72,11 @@ pub enum RequireErrorKind { #[error(transparent)] UrlConversion(#[from] deno_path_util::PathToUrlError), #[error(transparent)] - Fs(#[from] deno_io::fs::FsError), + Fs(#[from] std::io::Error), #[error(transparent)] ReadModule(deno_core::error::AnyError), #[error("Unable to get CWD: {0}")] - UnableToGetCwd(deno_io::fs::FsError), + UnableToGetCwd(std::io::Error), } #[op2] @@ -128,19 +132,21 @@ pub fn op_require_init_paths() -> Vec { #[op2(stack_trace)] #[serde] -pub fn op_require_node_module_paths

( +pub fn op_require_node_module_paths< + P: NodePermissions + 'static, + TSys: ExtNodeSys + 'static, +>( state: &mut OpState, #[string] from: String, -) -> Result, RequireError> -where - P: NodePermissions + 'static, -{ - let fs = state.borrow::(); +) -> Result, RequireError> { + let sys = state.borrow::(); // Guarantee that "from" is absolute. let from = if from.starts_with("file:///") { url_to_file_path(&Url::parse(&from)?)? } else { - let current_dir = &fs.cwd().map_err(RequireErrorKind::UnableToGetCwd)?; + let current_dir = &sys + .env_current_dir() + .map_err(RequireErrorKind::UnableToGetCwd)?; normalize_path(current_dir.join(from)) }; @@ -238,11 +244,11 @@ pub fn op_require_resolve_deno_dir( } #[op2(fast)] -pub fn op_require_is_deno_dir_package( +pub fn op_require_is_deno_dir_package( state: &mut OpState, #[string] path: String, ) -> bool { - let resolver = state.borrow::(); + let resolver = state.borrow::>(); match deno_path_util::url_from_file_path(&PathBuf::from(path)) { Ok(specifier) => resolver.in_npm_package(&specifier), Err(_) => false, @@ -297,18 +303,18 @@ pub fn op_require_path_is_absolute(#[string] p: String) -> bool { } #[op2(fast, stack_trace)] -pub fn op_require_stat

( +pub fn op_require_stat< + P: NodePermissions + 'static, + TSys: ExtNodeSys + 'static, +>( state: &mut OpState, #[string] path: String, -) -> Result -where - P: NodePermissions + 'static, -{ +) -> Result { let path = PathBuf::from(path); let path = ensure_read_permission::

(state, &path)?; - let fs = state.borrow::(); - if let Ok(metadata) = fs.stat_sync(&path) { - if metadata.is_file { + let sys = state.borrow::(); + if let Ok(metadata) = sys.fs_metadata(&path) { + if metadata.file_type().is_file() { return Ok(0); } else { return Ok(1); @@ -320,19 +326,19 @@ where #[op2(stack_trace)] #[string] -pub fn op_require_real_path

( +pub fn op_require_real_path< + P: NodePermissions + 'static, + TSys: ExtNodeSys + 'static, +>( state: &mut OpState, #[string] request: String, -) -> Result -where - P: NodePermissions + 'static, -{ +) -> Result { let path = PathBuf::from(request); let path = ensure_read_permission::

(state, &path) .map_err(RequireErrorKind::Permission)?; - let fs = state.borrow::(); + let sys = state.borrow::(); let canonicalized_path = - deno_path_util::strip_unc_prefix(fs.realpath_sync(&path)?); + deno_path_util::strip_unc_prefix(sys.fs_canonicalize(&path)?); Ok(canonicalized_path.to_string_lossy().into_owned()) } @@ -384,15 +390,15 @@ pub fn op_require_path_basename( #[op2(stack_trace)] #[string] -pub fn op_require_try_self_parent_path

( +pub fn op_require_try_self_parent_path< + P: NodePermissions + 'static, + TSys: ExtNodeSys + 'static, +>( state: &mut OpState, has_parent: bool, #[string] maybe_parent_filename: Option, #[string] maybe_parent_id: Option, -) -> Result, deno_core::error::AnyError> -where - P: NodePermissions + 'static, -{ +) -> Result, deno_core::error::AnyError> { if !has_parent { return Ok(None); } @@ -403,8 +409,8 @@ where if let Some(parent_id) = maybe_parent_id { if parent_id == "" || parent_id == "internal/preload" { - let fs = state.borrow::(); - if let Ok(cwd) = fs.cwd() { + let sys = state.borrow::(); + if let Ok(cwd) = sys.env_current_dir() { let cwd = ensure_read_permission::

(state, &cwd)?; return Ok(Some(cwd.to_string_lossy().into_owned())); } @@ -415,19 +421,19 @@ where #[op2(stack_trace)] #[string] -pub fn op_require_try_self

( +pub fn op_require_try_self< + P: NodePermissions + 'static, + TSys: ExtNodeSys + 'static, +>( state: &mut OpState, #[string] parent_path: Option, #[string] request: String, -) -> Result, RequireError> -where - P: NodePermissions + 'static, -{ +) -> Result, RequireError> { if parent_path.is_none() { return Ok(None); } - let pkg_json_resolver = state.borrow::(); + let pkg_json_resolver = state.borrow::>(); let pkg = pkg_json_resolver .get_closest_package_json_from_file_path(&PathBuf::from( parent_path.unwrap(), @@ -459,7 +465,7 @@ where let referrer = deno_core::url::Url::from_file_path(&pkg.path).unwrap(); if let Some(exports) = &pkg.exports { - let node_resolver = state.borrow::(); + let node_resolver = state.borrow::>(); let r = node_resolver.package_exports_resolve( &pkg.path, &expansion, @@ -484,7 +490,7 @@ where pub fn op_require_read_file

( state: &mut OpState, #[string] file_path: String, -) -> Result +) -> Result where P: NodePermissions + 'static, { @@ -495,7 +501,10 @@ where let loader = state.borrow::(); loader .load_text_file_lossy(&file_path) - .map(V8MaybeStaticStr) + .map(|s| match s { + Cow::Borrowed(s) => FastString::from_static(s), + Cow::Owned(s) => s.into(), + }) .map_err(|e| RequireErrorKind::ReadModule(e).into_box()) } @@ -513,7 +522,10 @@ pub fn op_require_as_file_path(#[string] file_or_url: String) -> String { #[op2(stack_trace)] #[string] -pub fn op_require_resolve_exports

( +pub fn op_require_resolve_exports< + P: NodePermissions + 'static, + TSys: ExtNodeSys + 'static, +>( state: &mut OpState, uses_local_node_modules_dir: bool, #[string] modules_path_str: String, @@ -521,13 +533,10 @@ pub fn op_require_resolve_exports

( #[string] name: String, #[string] expansion: String, #[string] parent_path: String, -) -> Result, RequireError> -where - P: NodePermissions + 'static, -{ - let fs = state.borrow::(); - let node_resolver = state.borrow::(); - let pkg_json_resolver = state.borrow::(); +) -> Result, RequireError> { + let sys = state.borrow::(); + let node_resolver = state.borrow::>(); + let pkg_json_resolver = state.borrow::>(); let modules_path = PathBuf::from(&modules_path_str); let modules_specifier = deno_path_util::url_from_file_path(&modules_path)?; @@ -538,7 +547,7 @@ where } else { let mod_dir = path_resolve([modules_path_str.as_str(), name.as_str()].into_iter()); - if fs.is_dir_sync(&mod_dir) { + if sys.fs_is_dir_no_err(&mod_dir) { mod_dir } else { modules_path @@ -589,14 +598,14 @@ pub fn op_require_is_maybe_cjs( #[op2(stack_trace)] #[serde] -pub fn op_require_read_package_scope

( +pub fn op_require_read_package_scope< + P: NodePermissions + 'static, + TSys: ExtNodeSys + 'static, +>( state: &mut OpState, #[string] package_json_path: String, -) -> Option -where - P: NodePermissions + 'static, -{ - let pkg_json_resolver = state.borrow::(); +) -> Option { + let pkg_json_resolver = state.borrow::>(); let package_json_path = PathBuf::from(package_json_path); if package_json_path.file_name() != Some("package.json".as_ref()) { // permissions: do not allow reading a non-package.json file @@ -610,18 +619,18 @@ where #[op2(stack_trace)] #[string] -pub fn op_require_package_imports_resolve

( +pub fn op_require_package_imports_resolve< + P: NodePermissions + 'static, + TSys: ExtNodeSys + 'static, +>( state: &mut OpState, #[string] referrer_filename: String, #[string] request: String, -) -> Result, RequireError> -where - P: NodePermissions + 'static, -{ +) -> Result, RequireError> { let referrer_path = PathBuf::from(&referrer_filename); let referrer_path = ensure_read_permission::

(state, &referrer_path) .map_err(RequireErrorKind::Permission)?; - let pkg_json_resolver = state.borrow::(); + let pkg_json_resolver = state.borrow::>(); let Some(pkg) = pkg_json_resolver .get_closest_package_json_from_file_path(&referrer_path)? else { @@ -629,7 +638,7 @@ where }; if pkg.imports.is_some() { - let node_resolver = state.borrow::(); + let node_resolver = state.borrow::>(); let referrer_url = Url::from_file_path(&referrer_filename).unwrap(); let url = node_resolver.package_imports_resolve( &request, diff --git a/ext/node/ops/tls.rs b/ext/node/ops/tls.rs index 86b1779601..8b2845e023 100644 --- a/ext/node/ops/tls.rs +++ b/ext/node/ops/tls.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use base64::Engine; use deno_core::op2; use webpki_root_certs; diff --git a/ext/node/ops/util.rs b/ext/node/ops/util.rs index 1c177ac043..bc1d2c0588 100644 --- a/ext/node/ops/util.rs +++ b/ext/node/ops/util.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::op2; use deno_core::OpState; diff --git a/ext/node/ops/v8.rs b/ext/node/ops/v8.rs index 8f09314d1d..8f4a70dccf 100644 --- a/ext/node/ops/v8.rs +++ b/ext/node/ops/v8.rs @@ -1,11 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr::NonNull; use deno_core::op2; use deno_core::v8; use deno_core::FastString; use deno_core::GarbageCollected; use deno_core::ToJsBuffer; -use std::ptr::NonNull; use v8::ValueDeserializerHelper; use v8::ValueSerializerHelper; diff --git a/ext/node/ops/vm.rs b/ext/node/ops/vm.rs index 25881cbaed..34eff8865c 100644 --- a/ext/node/ops/vm.rs +++ b/ext/node/ops/vm.rs @@ -1,14 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::sync::atomic::AtomicBool; +use std::sync::atomic::Ordering; +use std::time::Duration; -use crate::create_host_defined_options; use deno_core::op2; use deno_core::serde_v8; use deno_core::v8; use deno_core::v8::MapFnTo; use deno_core::JsBuffer; -use std::sync::atomic::AtomicBool; -use std::sync::atomic::Ordering; -use std::time::Duration; + +use crate::create_host_defined_options; pub const PRIVATE_SYMBOL_NAME: v8::OneByteConst = v8::String::create_external_onebyte_const(b"node:contextify:context"); diff --git a/ext/node/ops/vm_internal.rs b/ext/node/ops/vm_internal.rs index 815f570ead..e8c1cc02f0 100644 --- a/ext/node/ops/vm_internal.rs +++ b/ext/node/ops/vm_internal.rs @@ -1,11 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::create_host_defined_options; use deno_core::error::type_error; use deno_core::error::AnyError; use deno_core::v8; use deno_core::v8::MapFnTo; +use crate::create_host_defined_options; + pub const PRIVATE_SYMBOL_NAME: v8::OneByteConst = v8::String::create_external_onebyte_const(b"node:contextify:context"); diff --git a/ext/node/ops/winerror.rs b/ext/node/ops/winerror.rs index cb053774ef..5cbeddc5ae 100644 --- a/ext/node/ops/winerror.rs +++ b/ext/node/ops/winerror.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ext/node/ops/worker_threads.rs b/ext/node/ops/worker_threads.rs index 37a7b477d0..f7aa8c71cb 100644 --- a/ext/node/ops/worker_threads.rs +++ b/ext/node/ops/worker_threads.rs @@ -1,13 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use deno_core::op2; -use deno_core::url::Url; -use deno_core::OpState; -use deno_fs::FileSystemRc; use std::borrow::Cow; use std::path::Path; use std::path::PathBuf; +use deno_core::op2; +use deno_core::url::Url; +use deno_core::OpState; +use sys_traits::FsCanonicalize; +use sys_traits::FsMetadata; + +use crate::ExtNodeSys; use crate::NodePermissions; use crate::NodeRequireLoaderRc; @@ -41,19 +44,19 @@ pub enum WorkerThreadsFilenameError { #[error("File not found [{0:?}]")] FileNotFound(PathBuf), #[error(transparent)] - Fs(#[from] deno_io::fs::FsError), + Fs(#[from] std::io::Error), } // todo(dsherret): we should remove this and do all this work inside op_create_worker #[op2(stack_trace)] #[string] -pub fn op_worker_threads_filename

( +pub fn op_worker_threads_filename< + P: NodePermissions + 'static, + TSys: ExtNodeSys + 'static, +>( state: &mut OpState, #[string] specifier: String, -) -> Result -where - P: NodePermissions + 'static, -{ +) -> Result { if specifier.starts_with("data:") { return Ok(specifier); } @@ -66,9 +69,9 @@ where } let path = ensure_read_permission::

(state, &path) .map_err(WorkerThreadsFilenameError::Permission)?; - let fs = state.borrow::(); + let sys = state.borrow::(); let canonicalized_path = - deno_path_util::strip_unc_prefix(fs.realpath_sync(&path)?); + deno_path_util::strip_unc_prefix(sys.fs_canonicalize(&path)?); Url::from_file_path(canonicalized_path) .map_err(|_| WorkerThreadsFilenameError::UrlFromPathString)? }; @@ -77,8 +80,8 @@ where .map_err(|_| WorkerThreadsFilenameError::UrlToPathString)?; let url_path = ensure_read_permission::

(state, &url_path) .map_err(WorkerThreadsFilenameError::Permission)?; - let fs = state.borrow::(); - if !fs.exists_sync(&url_path) { + let sys = state.borrow::(); + if !sys.fs_exists_no_err(&url_path) { return Err(WorkerThreadsFilenameError::FileNotFound( url_path.to_path_buf(), )); diff --git a/ext/node/ops/zlib/alloc.rs b/ext/node/ops/zlib/alloc.rs index d425a18d5e..6066ab6a8e 100644 --- a/ext/node/ops/zlib/alloc.rs +++ b/ext/node/ops/zlib/alloc.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Workaround for https://github.com/rust-lang/libz-sys/issues/55 // See https://github.com/rust-lang/flate2-rs/blob/31fb07820345691352aaa64f367c1e482ad9cfdc/src/ffi/c.rs#L60 diff --git a/ext/node/ops/zlib/brotli.rs b/ext/node/ops/zlib/brotli.rs index 1a681ff7f7..5d15df559f 100644 --- a/ext/node/ops/zlib/brotli.rs +++ b/ext/node/ops/zlib/brotli.rs @@ -1,4 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::cell::RefCell; +use std::io::Read; + use brotli::enc::backward_references::BrotliEncoderMode; use brotli::enc::encode::BrotliEncoderCompress; use brotli::enc::encode::BrotliEncoderOperation; @@ -14,8 +17,6 @@ use deno_core::JsBuffer; use deno_core::OpState; use deno_core::Resource; use deno_core::ToJsBuffer; -use std::cell::RefCell; -use std::io::Read; #[derive(Debug, thiserror::Error)] pub enum BrotliError { diff --git a/ext/node/ops/zlib/mod.rs b/ext/node/ops/zlib/mod.rs index 991c0925d2..b5277e7a34 100644 --- a/ext/node/ops/zlib/mod.rs +++ b/ext/node/ops/zlib/mod.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; use deno_core::op2; use libc::c_ulong; -use std::borrow::Cow; -use std::cell::RefCell; use zlib::*; mod alloc; diff --git a/ext/node/ops/zlib/mode.rs b/ext/node/ops/zlib/mode.rs index 41565f9b11..c0660a7c7a 100644 --- a/ext/node/ops/zlib/mode.rs +++ b/ext/node/ops/zlib/mode.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #[derive(Debug, thiserror::Error)] #[error("bad argument")] diff --git a/ext/node/ops/zlib/stream.rs b/ext/node/ops/zlib/stream.rs index afcdcc4d70..de7abcacbd 100644 --- a/ext/node/ops/zlib/stream.rs +++ b/ext/node/ops/zlib/stream.rs @@ -1,11 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use super::mode::Flush; -use super::mode::Mode; use std::ffi::c_int; use std::ops::Deref; use std::ops::DerefMut; +use super::mode::Flush; +use super::mode::Mode; + pub struct StreamWrapper { pub strm: zlib::z_stream, } diff --git a/ext/node/polyfill.rs b/ext/node/polyfill.rs index 42cc794955..6e6e9d09c2 100644 --- a/ext/node/polyfill.rs +++ b/ext/node/polyfill.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// e.g. `is_builtin_node_module("assert")` pub fn is_builtin_node_module(module_name: &str) -> bool { @@ -57,6 +57,7 @@ generate_builtin_node_module_lists! { "http2", "https", "inspector", + "inspector/promises", "module", "net", "os", diff --git a/ext/node/polyfills/00_globals.js b/ext/node/polyfills/00_globals.js index efe491acc1..8a896412bc 100644 --- a/ext/node/polyfills/00_globals.js +++ b/ext/node/polyfills/00_globals.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/01_require.js b/ext/node/polyfills/01_require.js index df73cad6b7..8f3201755f 100644 --- a/ext/node/polyfills/01_require.js +++ b/ext/node/polyfills/01_require.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/02_init.js b/ext/node/polyfills/02_init.js index b25f7ad574..a069bd828c 100644 --- a/ext/node/polyfills/02_init.js +++ b/ext/node/polyfills/02_init.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/_brotli.js b/ext/node/polyfills/_brotli.js index 108e5319a9..308cad42ad 100644 --- a/ext/node/polyfills/_brotli.js +++ b/ext/node/polyfills/_brotli.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; const { diff --git a/ext/node/polyfills/_events.d.ts b/ext/node/polyfills/_events.d.ts index 1b765041e5..98a6b9d2f4 100644 --- a/ext/node/polyfills/_events.d.ts +++ b/ext/node/polyfills/_events.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any // Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/9b9cd671114a2a5178809798d8e7f4d8ca6c2671/types/node/events.d.ts diff --git a/ext/node/polyfills/_events.mjs b/ext/node/polyfills/_events.mjs index ce7a8ebf24..feecad2743 100644 --- a/ext/node/polyfills/_events.mjs +++ b/ext/node/polyfills/_events.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/_fs/_fs_access.ts b/ext/node/polyfills/_fs/_fs_access.ts index 824386e64b..561e023cd8 100644 --- a/ext/node/polyfills/_fs/_fs_access.ts +++ b/ext/node/polyfills/_fs/_fs_access.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_appendFile.ts b/ext/node/polyfills/_fs/_fs_appendFile.ts index 7077898623..ed47ea5a83 100644 --- a/ext/node/polyfills/_fs/_fs_appendFile.ts +++ b/ext/node/polyfills/_fs/_fs_appendFile.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { CallbackWithError, diff --git a/ext/node/polyfills/_fs/_fs_chmod.ts b/ext/node/polyfills/_fs/_fs_chmod.ts index eec8c7a8a9..195b4f810a 100644 --- a/ext/node/polyfills/_fs/_fs_chmod.ts +++ b/ext/node/polyfills/_fs/_fs_chmod.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_chown.ts b/ext/node/polyfills/_fs/_fs_chown.ts index 56364109d5..0056502f20 100644 --- a/ext/node/polyfills/_fs/_fs_chown.ts +++ b/ext/node/polyfills/_fs/_fs_chown.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_close.ts b/ext/node/polyfills/_fs/_fs_close.ts index fd01a0336a..476b3912be 100644 --- a/ext/node/polyfills/_fs/_fs_close.ts +++ b/ext/node/polyfills/_fs/_fs_close.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_common.ts b/ext/node/polyfills/_fs/_fs_common.ts index a29548bb36..9ec474afa9 100644 --- a/ext/node/polyfills/_fs/_fs_common.ts +++ b/ext/node/polyfills/_fs/_fs_common.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_constants.ts b/ext/node/polyfills/_fs/_fs_constants.ts index 0af75f072c..3d5d0b5898 100644 --- a/ext/node/polyfills/_fs/_fs_constants.ts +++ b/ext/node/polyfills/_fs/_fs_constants.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { fs } from "ext:deno_node/internal_binding/constants.ts"; diff --git a/ext/node/polyfills/_fs/_fs_copy.ts b/ext/node/polyfills/_fs/_fs_copy.ts index 0434bff4d1..87204e348c 100644 --- a/ext/node/polyfills/_fs/_fs_copy.ts +++ b/ext/node/polyfills/_fs/_fs_copy.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_cp.js b/ext/node/polyfills/_fs/_fs_cp.js index 52dd8f5056..29bc633224 100644 --- a/ext/node/polyfills/_fs/_fs_cp.js +++ b/ext/node/polyfills/_fs/_fs_cp.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; import { op_node_cp, op_node_cp_sync } from "ext:core/ops"; import { diff --git a/ext/node/polyfills/_fs/_fs_dir.ts b/ext/node/polyfills/_fs/_fs_dir.ts index ed051fb0bf..2a496562d6 100644 --- a/ext/node/polyfills/_fs/_fs_dir.ts +++ b/ext/node/polyfills/_fs/_fs_dir.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; import Dirent from "ext:deno_node/_fs/_fs_dirent.ts"; diff --git a/ext/node/polyfills/_fs/_fs_dirent.ts b/ext/node/polyfills/_fs/_fs_dirent.ts index d4ad6bb430..fce7a6e72d 100644 --- a/ext/node/polyfills/_fs/_fs_dirent.ts +++ b/ext/node/polyfills/_fs/_fs_dirent.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { notImplemented } from "ext:deno_node/_utils.ts"; export default class Dirent { diff --git a/ext/node/polyfills/_fs/_fs_exists.ts b/ext/node/polyfills/_fs/_fs_exists.ts index b5bbe235a4..6a285f5e60 100644 --- a/ext/node/polyfills/_fs/_fs_exists.ts +++ b/ext/node/polyfills/_fs/_fs_exists.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_fdatasync.ts b/ext/node/polyfills/_fs/_fs_fdatasync.ts index 0c3f50f1c6..02226e1c96 100644 --- a/ext/node/polyfills/_fs/_fs_fdatasync.ts +++ b/ext/node/polyfills/_fs/_fs_fdatasync.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_fstat.ts b/ext/node/polyfills/_fs/_fs_fstat.ts index 1a845dfff4..37c057c378 100644 --- a/ext/node/polyfills/_fs/_fs_fstat.ts +++ b/ext/node/polyfills/_fs/_fs_fstat.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_fsync.ts b/ext/node/polyfills/_fs/_fs_fsync.ts index 75d4b37569..a07f440778 100644 --- a/ext/node/polyfills/_fs/_fs_fsync.ts +++ b/ext/node/polyfills/_fs/_fs_fsync.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_ftruncate.ts b/ext/node/polyfills/_fs/_fs_ftruncate.ts index 79320137f9..6a8614b734 100644 --- a/ext/node/polyfills/_fs/_fs_ftruncate.ts +++ b/ext/node/polyfills/_fs/_fs_ftruncate.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_futimes.ts b/ext/node/polyfills/_fs/_fs_futimes.ts index 98cd1066c3..be274f4d11 100644 --- a/ext/node/polyfills/_fs/_fs_futimes.ts +++ b/ext/node/polyfills/_fs/_fs_futimes.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_lchown.ts b/ext/node/polyfills/_fs/_fs_lchown.ts index 8611c8021d..293155f9d0 100644 --- a/ext/node/polyfills/_fs/_fs_lchown.ts +++ b/ext/node/polyfills/_fs/_fs_lchown.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_link.ts b/ext/node/polyfills/_fs/_fs_link.ts index a10860c12f..73ed890d36 100644 --- a/ext/node/polyfills/_fs/_fs_link.ts +++ b/ext/node/polyfills/_fs/_fs_link.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_lstat.ts b/ext/node/polyfills/_fs/_fs_lstat.ts index 6ce401444f..b9f80bfc51 100644 --- a/ext/node/polyfills/_fs/_fs_lstat.ts +++ b/ext/node/polyfills/_fs/_fs_lstat.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_lutimes.ts b/ext/node/polyfills/_fs/_fs_lutimes.ts index 2475c57149..3f8dd167c0 100644 --- a/ext/node/polyfills/_fs/_fs_lutimes.ts +++ b/ext/node/polyfills/_fs/_fs_lutimes.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_mkdir.ts b/ext/node/polyfills/_fs/_fs_mkdir.ts index 06a8b35221..03d36629e5 100644 --- a/ext/node/polyfills/_fs/_fs_mkdir.ts +++ b/ext/node/polyfills/_fs/_fs_mkdir.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_mkdtemp.ts b/ext/node/polyfills/_fs/_fs_mkdtemp.ts index 5498828b5b..46060971a8 100644 --- a/ext/node/polyfills/_fs/_fs_mkdtemp.ts +++ b/ext/node/polyfills/_fs/_fs_mkdtemp.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Node.js contributors. All rights reserved. MIT License. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/_fs/_fs_open.ts b/ext/node/polyfills/_fs/_fs_open.ts index 31ca4bb619..85628ddcef 100644 --- a/ext/node/polyfills/_fs/_fs_open.ts +++ b/ext/node/polyfills/_fs/_fs_open.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_opendir.ts b/ext/node/polyfills/_fs/_fs_opendir.ts index 3280f0fd5c..51379fd451 100644 --- a/ext/node/polyfills/_fs/_fs_opendir.ts +++ b/ext/node/polyfills/_fs/_fs_opendir.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_read.ts b/ext/node/polyfills/_fs/_fs_read.ts index df4f5e375d..c7f3acf4d8 100644 --- a/ext/node/polyfills/_fs/_fs_read.ts +++ b/ext/node/polyfills/_fs/_fs_read.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_readFile.ts b/ext/node/polyfills/_fs/_fs_readFile.ts index b1bc53675d..752a683ca7 100644 --- a/ext/node/polyfills/_fs/_fs_readFile.ts +++ b/ext/node/polyfills/_fs/_fs_readFile.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_readdir.ts b/ext/node/polyfills/_fs/_fs_readdir.ts index 59c802e424..4b34451a38 100644 --- a/ext/node/polyfills/_fs/_fs_readdir.ts +++ b/ext/node/polyfills/_fs/_fs_readdir.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_readlink.ts b/ext/node/polyfills/_fs/_fs_readlink.ts index 08bea843fa..084dbc2d09 100644 --- a/ext/node/polyfills/_fs/_fs_readlink.ts +++ b/ext/node/polyfills/_fs/_fs_readlink.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_readv.ts b/ext/node/polyfills/_fs/_fs_readv.ts index 2259f029ae..4486959b76 100644 --- a/ext/node/polyfills/_fs/_fs_readv.ts +++ b/ext/node/polyfills/_fs/_fs_readv.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_realpath.ts b/ext/node/polyfills/_fs/_fs_realpath.ts index 4568748ba7..12f5f10a43 100644 --- a/ext/node/polyfills/_fs/_fs_realpath.ts +++ b/ext/node/polyfills/_fs/_fs_realpath.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_rename.ts b/ext/node/polyfills/_fs/_fs_rename.ts index 41569c80f3..7a84cf8d98 100644 --- a/ext/node/polyfills/_fs/_fs_rename.ts +++ b/ext/node/polyfills/_fs/_fs_rename.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_rm.ts b/ext/node/polyfills/_fs/_fs_rm.ts index 5730f8c413..cce2ab95c0 100644 --- a/ext/node/polyfills/_fs/_fs_rm.ts +++ b/ext/node/polyfills/_fs/_fs_rm.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_rmdir.ts b/ext/node/polyfills/_fs/_fs_rmdir.ts index 00c085ebd5..6a78e9e467 100644 --- a/ext/node/polyfills/_fs/_fs_rmdir.ts +++ b/ext/node/polyfills/_fs/_fs_rmdir.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_stat.ts b/ext/node/polyfills/_fs/_fs_stat.ts index f264746686..031c8dbb50 100644 --- a/ext/node/polyfills/_fs/_fs_stat.ts +++ b/ext/node/polyfills/_fs/_fs_stat.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_statfs.js b/ext/node/polyfills/_fs/_fs_statfs.js index 51da1ed684..90953c12b5 100644 --- a/ext/node/polyfills/_fs/_fs_statfs.js +++ b/ext/node/polyfills/_fs/_fs_statfs.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { BigInt } from "ext:deno_node/internal/primordials.mjs"; import { op_node_statfs } from "ext:core/ops"; diff --git a/ext/node/polyfills/_fs/_fs_symlink.ts b/ext/node/polyfills/_fs/_fs_symlink.ts index 350263423a..953697e44c 100644 --- a/ext/node/polyfills/_fs/_fs_symlink.ts +++ b/ext/node/polyfills/_fs/_fs_symlink.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_truncate.ts b/ext/node/polyfills/_fs/_fs_truncate.ts index a7e79b9c30..47b87eecdc 100644 --- a/ext/node/polyfills/_fs/_fs_truncate.ts +++ b/ext/node/polyfills/_fs/_fs_truncate.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_unlink.ts b/ext/node/polyfills/_fs/_fs_unlink.ts index 1d9aefa46f..d046c40f35 100644 --- a/ext/node/polyfills/_fs/_fs_unlink.ts +++ b/ext/node/polyfills/_fs/_fs_unlink.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_utimes.ts b/ext/node/polyfills/_fs/_fs_utimes.ts index 3fff4a4623..ff25fffed8 100644 --- a/ext/node/polyfills/_fs/_fs_utimes.ts +++ b/ext/node/polyfills/_fs/_fs_utimes.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_watch.ts b/ext/node/polyfills/_fs/_fs_watch.ts index eb2cd8bfa2..8b92e9aa44 100644 --- a/ext/node/polyfills/_fs/_fs_watch.ts +++ b/ext/node/polyfills/_fs/_fs_watch.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_write.d.ts b/ext/node/polyfills/_fs/_fs_write.d.ts index 7171ec6dbd..cd8257ec35 100644 --- a/ext/node/polyfills/_fs/_fs_write.d.ts +++ b/ext/node/polyfills/_fs/_fs_write.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d9df51e34526f48bef4e2546a006157b391ad96c/types/node/fs.d.ts import { BufferEncoding, ErrnoException } from "ext:deno_node/_global.d.ts"; diff --git a/ext/node/polyfills/_fs/_fs_write.mjs b/ext/node/polyfills/_fs/_fs_write.mjs index 254094c9ad..a0d0af6017 100644 --- a/ext/node/polyfills/_fs/_fs_write.mjs +++ b/ext/node/polyfills/_fs/_fs_write.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/_fs/_fs_writeFile.ts b/ext/node/polyfills/_fs/_fs_writeFile.ts index dd324815b9..c76be8a6b8 100644 --- a/ext/node/polyfills/_fs/_fs_writeFile.ts +++ b/ext/node/polyfills/_fs/_fs_writeFile.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/_fs/_fs_writev.d.ts b/ext/node/polyfills/_fs/_fs_writev.d.ts index daa4dbbcf4..1ba5511ff1 100644 --- a/ext/node/polyfills/_fs/_fs_writev.d.ts +++ b/ext/node/polyfills/_fs/_fs_writev.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d9df51e34526f48bef4e2546a006157b391ad96c/types/node/fs.d.ts import { ErrnoException } from "ext:deno_node/_global.d.ts"; diff --git a/ext/node/polyfills/_fs/_fs_writev.mjs b/ext/node/polyfills/_fs/_fs_writev.mjs index 055bce0b24..61807c7f68 100644 --- a/ext/node/polyfills/_fs/_fs_writev.mjs +++ b/ext/node/polyfills/_fs/_fs_writev.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/_global.d.ts b/ext/node/polyfills/_global.d.ts index 8587acbbb2..1e610de08d 100644 --- a/ext/node/polyfills/_global.d.ts +++ b/ext/node/polyfills/_global.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { EventEmitter } from "ext:deno_node/_events.d.ts"; import { Buffer } from "node:buffer"; diff --git a/ext/node/polyfills/_http_agent.mjs b/ext/node/polyfills/_http_agent.mjs index 53bb64ed53..4de58cb406 100644 --- a/ext/node/polyfills/_http_agent.mjs +++ b/ext/node/polyfills/_http_agent.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/_http_common.ts b/ext/node/polyfills/_http_common.ts index 86143b4dea..f2ca75ec1c 100644 --- a/ext/node/polyfills/_http_common.ts +++ b/ext/node/polyfills/_http_common.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/_http_outgoing.ts b/ext/node/polyfills/_http_outgoing.ts index 5a9a8ad7e6..fcc6394eb8 100644 --- a/ext/node/polyfills/_http_outgoing.ts +++ b/ext/node/polyfills/_http_outgoing.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/_http_server.ts b/ext/node/polyfills/_http_server.ts index c2867de0c6..cf80f1e6e0 100644 --- a/ext/node/polyfills/_http_server.ts +++ b/ext/node/polyfills/_http_server.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. export enum STATUS_CODES { /** RFC 7231, 6.2.1 */ diff --git a/ext/node/polyfills/_next_tick.ts b/ext/node/polyfills/_next_tick.ts index af306a29c8..355b6ca6ba 100644 --- a/ext/node/polyfills/_next_tick.ts +++ b/ext/node/polyfills/_next_tick.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/_process/exiting.ts b/ext/node/polyfills/_process/exiting.ts index 01991e9c96..c1a032b643 100644 --- a/ext/node/polyfills/_process/exiting.ts +++ b/ext/node/polyfills/_process/exiting.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore prefer-const export let _exiting = false; diff --git a/ext/node/polyfills/_process/process.ts b/ext/node/polyfills/_process/process.ts index 6f69139c98..06e48160de 100644 --- a/ext/node/polyfills/_process/process.ts +++ b/ext/node/polyfills/_process/process.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // The following are all the process APIs that don't depend on the stream module diff --git a/ext/node/polyfills/_process/streams.mjs b/ext/node/polyfills/_process/streams.mjs index 3573956c9d..9a838e7d38 100644 --- a/ext/node/polyfills/_process/streams.mjs +++ b/ext/node/polyfills/_process/streams.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/_readline.d.ts b/ext/node/polyfills/_readline.d.ts index fcaa327a05..256cb87887 100644 --- a/ext/node/polyfills/_readline.d.ts +++ b/ext/node/polyfills/_readline.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any // Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/cd61f5b4d3d143108569ec3f88adc0eb34b961c4/types/node/readline.d.ts diff --git a/ext/node/polyfills/_readline.mjs b/ext/node/polyfills/_readline.mjs index 2af717152b..3943736ea9 100644 --- a/ext/node/polyfills/_readline.mjs +++ b/ext/node/polyfills/_readline.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/_readline_shared_types.d.ts b/ext/node/polyfills/_readline_shared_types.d.ts index b58ad035e7..f88de9091c 100644 --- a/ext/node/polyfills/_readline_shared_types.d.ts +++ b/ext/node/polyfills/_readline_shared_types.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Part of https://github.com/DefinitelyTyped/DefinitelyTyped/blob/cd61f5b4d3d143108569ec3f88adc0eb34b961c4/types/node/readline.d.ts diff --git a/ext/node/polyfills/_stream.d.ts b/ext/node/polyfills/_stream.d.ts index d251d9bee2..6ae3494118 100644 --- a/ext/node/polyfills/_stream.d.ts +++ b/ext/node/polyfills/_stream.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any // Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/4f538975138678878fed5b2555c0672aa578ab7d/types/node/stream.d.ts diff --git a/ext/node/polyfills/_stream.mjs b/ext/node/polyfills/_stream.mjs index 02640abcd9..3fc79b69df 100644 --- a/ext/node/polyfills/_stream.mjs +++ b/ext/node/polyfills/_stream.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-fmt-ignore-file // deno-lint-ignore-file diff --git a/ext/node/polyfills/_tls_common.ts b/ext/node/polyfills/_tls_common.ts index d00c3629e1..4e5904b971 100644 --- a/ext/node/polyfills/_tls_common.ts +++ b/ext/node/polyfills/_tls_common.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file no-explicit-any diff --git a/ext/node/polyfills/_tls_wrap.ts b/ext/node/polyfills/_tls_wrap.ts index 9e5def9f2b..0edea1c053 100644 --- a/ext/node/polyfills/_tls_wrap.ts +++ b/ext/node/polyfills/_tls_wrap.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/_util/_util_callbackify.js b/ext/node/polyfills/_util/_util_callbackify.js index cb30f79150..ae83850bc0 100644 --- a/ext/node/polyfills/_util/_util_callbackify.js +++ b/ext/node/polyfills/_util/_util_callbackify.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // // Adapted from Node.js. Copyright Joyent, Inc. and other Node contributors. // diff --git a/ext/node/polyfills/_util/asserts.ts b/ext/node/polyfills/_util/asserts.ts index 8f90cf168a..71c3cc863d 100644 --- a/ext/node/polyfills/_util/asserts.ts +++ b/ext/node/polyfills/_util/asserts.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; const { diff --git a/ext/node/polyfills/_util/async.ts b/ext/node/polyfills/_util/async.ts index 0cacccacc7..445febcaaf 100644 --- a/ext/node/polyfills/_util/async.ts +++ b/ext/node/polyfills/_util/async.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This module is vendored from std/async/delay.ts // (with some modifications) diff --git a/ext/node/polyfills/_util/os.ts b/ext/node/polyfills/_util/os.ts index 421d5d9da0..f72dc662d9 100644 --- a/ext/node/polyfills/_util/os.ts +++ b/ext/node/polyfills/_util/os.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { op_node_build_os } from "ext:core/ops"; diff --git a/ext/node/polyfills/_util/std_asserts.ts b/ext/node/polyfills/_util/std_asserts.ts index 78b749f549..7623741379 100644 --- a/ext/node/polyfills/_util/std_asserts.ts +++ b/ext/node/polyfills/_util/std_asserts.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // vendored from std/assert/mod.ts import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/_util/std_fmt_colors.ts b/ext/node/polyfills/_util/std_fmt_colors.ts index 5072b298ee..f1dc97f6ca 100644 --- a/ext/node/polyfills/_util/std_fmt_colors.ts +++ b/ext/node/polyfills/_util/std_fmt_colors.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This file is vendored from std/fmt/colors.ts import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/_util/std_testing_diff.ts b/ext/node/polyfills/_util/std_testing_diff.ts index 5155fd242c..1b680c6cca 100644 --- a/ext/node/polyfills/_util/std_testing_diff.ts +++ b/ext/node/polyfills/_util/std_testing_diff.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This file was vendored from std/testing/_diff.ts import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/_utils.ts b/ext/node/polyfills/_utils.ts index 79d84e00f0..7f20782e2b 100644 --- a/ext/node/polyfills/_utils.ts +++ b/ext/node/polyfills/_utils.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; const { diff --git a/ext/node/polyfills/_zlib.mjs b/ext/node/polyfills/_zlib.mjs index 07fc440ef5..bb6bac1bd0 100644 --- a/ext/node/polyfills/_zlib.mjs +++ b/ext/node/polyfills/_zlib.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright (c) 2014-2015 Devon Govett // Forked from https://github.com/browserify/browserify-zlib diff --git a/ext/node/polyfills/_zlib_binding.mjs b/ext/node/polyfills/_zlib_binding.mjs index 069b7f8351..37125b88ac 100644 --- a/ext/node/polyfills/_zlib_binding.mjs +++ b/ext/node/polyfills/_zlib_binding.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/assert.ts b/ext/node/polyfills/assert.ts index 188c7a0c2f..48b4627044 100644 --- a/ext/node/polyfills/assert.ts +++ b/ext/node/polyfills/assert.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file ban-types prefer-primordials diff --git a/ext/node/polyfills/assert/strict.ts b/ext/node/polyfills/assert/strict.ts index 9837167627..883deaf087 100644 --- a/ext/node/polyfills/assert/strict.ts +++ b/ext/node/polyfills/assert/strict.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { strict } from "node:assert"; export { diff --git a/ext/node/polyfills/assertion_error.ts b/ext/node/polyfills/assertion_error.ts index ff1168dc30..b56cec2c1d 100644 --- a/ext/node/polyfills/assertion_error.ts +++ b/ext/node/polyfills/assertion_error.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Adapted from Node.js. Copyright Joyent, Inc. and other Node contributors. diff --git a/ext/node/polyfills/async_hooks.ts b/ext/node/polyfills/async_hooks.ts index 7a2f153dac..e01110bd3b 100644 --- a/ext/node/polyfills/async_hooks.ts +++ b/ext/node/polyfills/async_hooks.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/buffer.ts b/ext/node/polyfills/buffer.ts index efe3b07a97..38000c6edb 100644 --- a/ext/node/polyfills/buffer.ts +++ b/ext/node/polyfills/buffer.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @deno-types="./internal/buffer.d.ts" export { atob, diff --git a/ext/node/polyfills/child_process.ts b/ext/node/polyfills/child_process.ts index eda718ff34..184b29bd2b 100644 --- a/ext/node/polyfills/child_process.ts +++ b/ext/node/polyfills/child_process.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This module implements 'child_process' module of Node.JS API. // ref: https://nodejs.org/api/child_process.html diff --git a/ext/node/polyfills/cluster.ts b/ext/node/polyfills/cluster.ts index 8abc2fedcd..67534676b4 100644 --- a/ext/node/polyfills/cluster.ts +++ b/ext/node/polyfills/cluster.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import { notImplemented } from "ext:deno_node/_utils.ts"; diff --git a/ext/node/polyfills/console.ts b/ext/node/polyfills/console.ts index f74c9af165..1189d95064 100644 --- a/ext/node/polyfills/console.ts +++ b/ext/node/polyfills/console.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; import { Console } from "ext:deno_node/internal/console/constructor.mjs"; diff --git a/ext/node/polyfills/constants.ts b/ext/node/polyfills/constants.ts index e5004039b1..421c8b641a 100644 --- a/ext/node/polyfills/constants.ts +++ b/ext/node/polyfills/constants.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Based on: https://github.com/nodejs/node/blob/0646eda/lib/constants.js diff --git a/ext/node/polyfills/crypto.ts b/ext/node/polyfills/crypto.ts index 908d21b006..ff3bdc7752 100644 --- a/ext/node/polyfills/crypto.ts +++ b/ext/node/polyfills/crypto.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/dgram.ts b/ext/node/polyfills/dgram.ts index 99f4940ec2..56fb8d8f32 100644 --- a/ext/node/polyfills/dgram.ts +++ b/ext/node/polyfills/dgram.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/diagnostics_channel.js b/ext/node/polyfills/diagnostics_channel.js index 807c33e475..65533e0803 100644 --- a/ext/node/polyfills/diagnostics_channel.js +++ b/ext/node/polyfills/diagnostics_channel.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/dns.ts b/ext/node/polyfills/dns.ts index 78b934e602..b8e4af6eec 100644 --- a/ext/node/polyfills/dns.ts +++ b/ext/node/polyfills/dns.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/dns/promises.ts b/ext/node/polyfills/dns/promises.ts index 6bc539cba9..422ae05c64 100644 --- a/ext/node/polyfills/dns/promises.ts +++ b/ext/node/polyfills/dns/promises.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/domain.ts b/ext/node/polyfills/domain.ts index 7093779966..daa613ede0 100644 --- a/ext/node/polyfills/domain.ts +++ b/ext/node/polyfills/domain.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // This code has been inspired by https://github.com/bevry/domain-browser/commit/8bce7f4a093966ca850da75b024239ad5d0b33c6 diff --git a/ext/node/polyfills/events.ts b/ext/node/polyfills/events.ts index 78f3d8768c..891f3d3b8d 100644 --- a/ext/node/polyfills/events.ts +++ b/ext/node/polyfills/events.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @deno-types="./_events.d.ts" export { addAbortListener, diff --git a/ext/node/polyfills/fs.ts b/ext/node/polyfills/fs.ts index cbdc36afe5..76ff9ebd12 100644 --- a/ext/node/polyfills/fs.ts +++ b/ext/node/polyfills/fs.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { access, accessPromise, diff --git a/ext/node/polyfills/fs/promises.ts b/ext/node/polyfills/fs/promises.ts index a5125dac8d..f8d63e94e0 100644 --- a/ext/node/polyfills/fs/promises.ts +++ b/ext/node/polyfills/fs/promises.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { promises as fsPromises } from "node:fs"; export const access = fsPromises.access; diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index e911535be5..f698ca01b3 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/http2.ts b/ext/node/polyfills/http2.ts index 1b3f74f6f6..ab2faa2d08 100644 --- a/ext/node/polyfills/http2.ts +++ b/ext/node/polyfills/http2.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/https.ts b/ext/node/polyfills/https.ts index fd700173eb..d958d8e746 100644 --- a/ext/node/polyfills/https.ts +++ b/ext/node/polyfills/https.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/inspector.js b/ext/node/polyfills/inspector.js index 7eb15ce917..bb2661b9cd 100644 --- a/ext/node/polyfills/inspector.js +++ b/ext/node/polyfills/inspector.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import process from "node:process"; diff --git a/ext/node/polyfills/inspector/promises.js b/ext/node/polyfills/inspector/promises.js index 3483e53f5e..a075eba001 100644 --- a/ext/node/polyfills/inspector/promises.js +++ b/ext/node/polyfills/inspector/promises.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import inspector from "node:inspector"; diff --git a/ext/node/polyfills/internal/assert.mjs b/ext/node/polyfills/internal/assert.mjs index 20ed511e02..01b5fad460 100644 --- a/ext/node/polyfills/internal/assert.mjs +++ b/ext/node/polyfills/internal/assert.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { ERR_INTERNAL_ASSERTION } from "ext:deno_node/internal/errors.ts"; function assert(value, message) { diff --git a/ext/node/polyfills/internal/async_hooks.ts b/ext/node/polyfills/internal/async_hooks.ts index a5d6728e33..a2f52e6979 100644 --- a/ext/node/polyfills/internal/async_hooks.ts +++ b/ext/node/polyfills/internal/async_hooks.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/blocklist.mjs b/ext/node/polyfills/internal/blocklist.mjs index 8a7c9c376a..d45592a8ff 100644 --- a/ext/node/polyfills/internal/blocklist.mjs +++ b/ext/node/polyfills/internal/blocklist.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/internal/buffer.d.ts b/ext/node/polyfills/internal/buffer.d.ts index 2008dc2432..125deb0ef2 100644 --- a/ext/node/polyfills/internal/buffer.d.ts +++ b/ext/node/polyfills/internal/buffer.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright DefinitelyTyped contributors. All rights reserved. MIT license. /** diff --git a/ext/node/polyfills/internal/buffer.mjs b/ext/node/polyfills/internal/buffer.mjs index dd549221fa..033d8a1e1e 100644 --- a/ext/node/polyfills/internal/buffer.mjs +++ b/ext/node/polyfills/internal/buffer.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // Copyright Feross Aboukhadijeh, and other contributors. All rights reserved. MIT license. diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index cfff1079ff..17809cc559 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This module implements 'child_process' module of Node.JS API. // ref: https://nodejs.org/api/child_process.html diff --git a/ext/node/polyfills/internal/cli_table.ts b/ext/node/polyfills/internal/cli_table.ts index 9826e524f6..c6991ed06d 100644 --- a/ext/node/polyfills/internal/cli_table.ts +++ b/ext/node/polyfills/internal/cli_table.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/console/constructor.mjs b/ext/node/polyfills/internal/console/constructor.mjs index ebf5cbec4f..0736fd4c47 100644 --- a/ext/node/polyfills/internal/console/constructor.mjs +++ b/ext/node/polyfills/internal/console/constructor.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/constants.ts b/ext/node/polyfills/internal/constants.ts index 521cea987c..3c83c0f0ef 100644 --- a/ext/node/polyfills/internal/constants.ts +++ b/ext/node/polyfills/internal/constants.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import { isWindows } from "ext:deno_node/_util/os.ts"; diff --git a/ext/node/polyfills/internal/crypto/_keys.ts b/ext/node/polyfills/internal/crypto/_keys.ts index e799862458..9a097f82e3 100644 --- a/ext/node/polyfills/internal/crypto/_keys.ts +++ b/ext/node/polyfills/internal/crypto/_keys.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This file is here because to break a circular dependency between streams and // crypto. diff --git a/ext/node/polyfills/internal/crypto/_randomBytes.ts b/ext/node/polyfills/internal/crypto/_randomBytes.ts index e1dc5c5ac8..c8608a7c53 100644 --- a/ext/node/polyfills/internal/crypto/_randomBytes.ts +++ b/ext/node/polyfills/internal/crypto/_randomBytes.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/crypto/_randomFill.mjs b/ext/node/polyfills/internal/crypto/_randomFill.mjs index 8ef864562f..20a6e1c022 100644 --- a/ext/node/polyfills/internal/crypto/_randomFill.mjs +++ b/ext/node/polyfills/internal/crypto/_randomFill.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/crypto/_randomInt.ts b/ext/node/polyfills/internal/crypto/_randomInt.ts index e08b3e9639..65a8bacf13 100644 --- a/ext/node/polyfills/internal/crypto/_randomInt.ts +++ b/ext/node/polyfills/internal/crypto/_randomInt.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { op_node_random_int } from "ext:core/ops"; import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/internal/crypto/certificate.ts b/ext/node/polyfills/internal/crypto/certificate.ts index c15236c5cb..cd64ba36d9 100644 --- a/ext/node/polyfills/internal/crypto/certificate.ts +++ b/ext/node/polyfills/internal/crypto/certificate.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. import { notImplemented } from "ext:deno_node/_utils.ts"; diff --git a/ext/node/polyfills/internal/crypto/cipher.ts b/ext/node/polyfills/internal/crypto/cipher.ts index c1c5ce8901..dd1698f46e 100644 --- a/ext/node/polyfills/internal/crypto/cipher.ts +++ b/ext/node/polyfills/internal/crypto/cipher.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/crypto/constants.ts b/ext/node/polyfills/internal/crypto/constants.ts index d9c0b2d63b..77fe9bbf43 100644 --- a/ext/node/polyfills/internal/crypto/constants.ts +++ b/ext/node/polyfills/internal/crypto/constants.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/crypto/diffiehellman.ts b/ext/node/polyfills/internal/crypto/diffiehellman.ts index a439306a97..fb0da4e60b 100644 --- a/ext/node/polyfills/internal/crypto/diffiehellman.ts +++ b/ext/node/polyfills/internal/crypto/diffiehellman.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/crypto/hash.ts b/ext/node/polyfills/internal/crypto/hash.ts index c42ca39892..3b3ec928fb 100644 --- a/ext/node/polyfills/internal/crypto/hash.ts +++ b/ext/node/polyfills/internal/crypto/hash.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/crypto/hkdf.ts b/ext/node/polyfills/internal/crypto/hkdf.ts index cb1dbee46b..282633ba26 100644 --- a/ext/node/polyfills/internal/crypto/hkdf.ts +++ b/ext/node/polyfills/internal/crypto/hkdf.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/crypto/keygen.ts b/ext/node/polyfills/internal/crypto/keygen.ts index b023ab1060..8d9a98e324 100644 --- a/ext/node/polyfills/internal/crypto/keygen.ts +++ b/ext/node/polyfills/internal/crypto/keygen.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/crypto/keys.ts b/ext/node/polyfills/internal/crypto/keys.ts index c91c23cc3d..a6ef6b156d 100644 --- a/ext/node/polyfills/internal/crypto/keys.ts +++ b/ext/node/polyfills/internal/crypto/keys.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills @@ -20,6 +20,7 @@ import { op_node_create_secret_key, op_node_derive_public_key_from_private_key, op_node_export_private_key_der, + op_node_export_private_key_jwk, op_node_export_private_key_pem, op_node_export_public_key_der, op_node_export_public_key_jwk, @@ -791,7 +792,7 @@ export class PrivateKeyObject extends AsymmetricKeyObject { export(options: JwkKeyExportOptions | KeyExportOptions) { if (options && options.format === "jwk") { - notImplemented("jwk private key export not implemented"); + return op_node_export_private_key_jwk(this[kHandle]); } const { format, diff --git a/ext/node/polyfills/internal/crypto/pbkdf2.ts b/ext/node/polyfills/internal/crypto/pbkdf2.ts index 4e58cb68b3..84a3032c75 100644 --- a/ext/node/polyfills/internal/crypto/pbkdf2.ts +++ b/ext/node/polyfills/internal/crypto/pbkdf2.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/crypto/random.ts b/ext/node/polyfills/internal/crypto/random.ts index a41b868190..9d8864aabc 100644 --- a/ext/node/polyfills/internal/crypto/random.ts +++ b/ext/node/polyfills/internal/crypto/random.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/crypto/scrypt.ts b/ext/node/polyfills/internal/crypto/scrypt.ts index ce8649bbe2..e20ad33011 100644 --- a/ext/node/polyfills/internal/crypto/scrypt.ts +++ b/ext/node/polyfills/internal/crypto/scrypt.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /* MIT License diff --git a/ext/node/polyfills/internal/crypto/sig.ts b/ext/node/polyfills/internal/crypto/sig.ts index a05f16478d..d75f522f37 100644 --- a/ext/node/polyfills/internal/crypto/sig.ts +++ b/ext/node/polyfills/internal/crypto/sig.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/crypto/types.ts b/ext/node/polyfills/internal/crypto/types.ts index 17b15127ef..60f913ca2d 100644 --- a/ext/node/polyfills/internal/crypto/types.ts +++ b/ext/node/polyfills/internal/crypto/types.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. import { BufferEncoding } from "ext:deno_node/_global.d.ts"; diff --git a/ext/node/polyfills/internal/crypto/util.ts b/ext/node/polyfills/internal/crypto/util.ts index 6c925f6577..7e6f4a9b40 100644 --- a/ext/node/polyfills/internal/crypto/util.ts +++ b/ext/node/polyfills/internal/crypto/util.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/crypto/x509.ts b/ext/node/polyfills/internal/crypto/x509.ts index 699e45a51b..a37db7365e 100644 --- a/ext/node/polyfills/internal/crypto/x509.ts +++ b/ext/node/polyfills/internal/crypto/x509.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/dgram.ts b/ext/node/polyfills/internal/dgram.ts index e34f92f1ea..d69baa7ef2 100644 --- a/ext/node/polyfills/internal/dgram.ts +++ b/ext/node/polyfills/internal/dgram.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/dns/promises.ts b/ext/node/polyfills/internal/dns/promises.ts index ee4248163d..b431c4502f 100644 --- a/ext/node/polyfills/internal/dns/promises.ts +++ b/ext/node/polyfills/internal/dns/promises.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/dns/utils.ts b/ext/node/polyfills/internal/dns/utils.ts index 226fce93dd..a405d3f509 100644 --- a/ext/node/polyfills/internal/dns/utils.ts +++ b/ext/node/polyfills/internal/dns/utils.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/dtrace.ts b/ext/node/polyfills/internal/dtrace.ts index 3443aec7ff..716c48c7cc 100644 --- a/ext/node/polyfills/internal/dtrace.ts +++ b/ext/node/polyfills/internal/dtrace.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/error_codes.ts b/ext/node/polyfills/internal/error_codes.ts index 0603e9e114..638c0584c2 100644 --- a/ext/node/polyfills/internal/error_codes.ts +++ b/ext/node/polyfills/internal/error_codes.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Lazily initializes the error classes in this object. // This trick is necessary for avoiding circular dendencies between diff --git a/ext/node/polyfills/internal/errors.ts b/ext/node/polyfills/internal/errors.ts index d79232aed7..5d35f07dd8 100644 --- a/ext/node/polyfills/internal/errors.ts +++ b/ext/node/polyfills/internal/errors.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Node.js contributors. All rights reserved. MIT License. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/event_target.mjs b/ext/node/polyfills/internal/event_target.mjs index 4409b00ed4..80c6041c57 100644 --- a/ext/node/polyfills/internal/event_target.mjs +++ b/ext/node/polyfills/internal/event_target.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Node.js contributors. All rights reserved. MIT License. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/events/abort_listener.mjs b/ext/node/polyfills/internal/events/abort_listener.mjs index f1430489fa..0407b93595 100644 --- a/ext/node/polyfills/internal/events/abort_listener.mjs +++ b/ext/node/polyfills/internal/events/abort_listener.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. import { primordials } from "ext:deno_node/internal/test/binding.ts"; diff --git a/ext/node/polyfills/internal/fixed_queue.ts b/ext/node/polyfills/internal/fixed_queue.ts index 0a2209c8d5..d9355e73c5 100644 --- a/ext/node/polyfills/internal/fixed_queue.ts +++ b/ext/node/polyfills/internal/fixed_queue.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/internal/fs/handle.ts b/ext/node/polyfills/internal/fs/handle.ts index ee035f2f5c..ace9a7635c 100644 --- a/ext/node/polyfills/internal/fs/handle.ts +++ b/ext/node/polyfills/internal/fs/handle.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/fs/streams.d.ts b/ext/node/polyfills/internal/fs/streams.d.ts index b4c235f9b5..8459120573 100644 --- a/ext/node/polyfills/internal/fs/streams.d.ts +++ b/ext/node/polyfills/internal/fs/streams.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright DefinitelyTyped contributors. All rights reserved. MIT license. // deno-lint-ignore-file no-explicit-any diff --git a/ext/node/polyfills/internal/fs/streams.mjs b/ext/node/polyfills/internal/fs/streams.mjs index 3b4409c4cf..5adb8da225 100644 --- a/ext/node/polyfills/internal/fs/streams.mjs +++ b/ext/node/polyfills/internal/fs/streams.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/fs/utils.mjs b/ext/node/polyfills/internal/fs/utils.mjs index b0ef34873e..9e8558dea2 100644 --- a/ext/node/polyfills/internal/fs/utils.mjs +++ b/ext/node/polyfills/internal/fs/utils.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/hide_stack_frames.ts b/ext/node/polyfills/internal/hide_stack_frames.ts index 4145189fff..93d7aca095 100644 --- a/ext/node/polyfills/internal/hide_stack_frames.ts +++ b/ext/node/polyfills/internal/hide_stack_frames.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/http.ts b/ext/node/polyfills/internal/http.ts index ddf082f451..d559442bbc 100644 --- a/ext/node/polyfills/internal/http.ts +++ b/ext/node/polyfills/internal/http.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/idna.ts b/ext/node/polyfills/internal/idna.ts index 93ed065cce..8a53b7e721 100644 --- a/ext/node/polyfills/internal/idna.ts +++ b/ext/node/polyfills/internal/idna.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/net.ts b/ext/node/polyfills/internal/net.ts index a3dcb3ed21..a14dcae9b8 100644 --- a/ext/node/polyfills/internal/net.ts +++ b/ext/node/polyfills/internal/net.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/normalize_encoding.mjs b/ext/node/polyfills/internal/normalize_encoding.mjs index a367337880..6ae322f118 100644 --- a/ext/node/polyfills/internal/normalize_encoding.mjs +++ b/ext/node/polyfills/internal/normalize_encoding.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/options.ts b/ext/node/polyfills/internal/options.ts index 4b62a11285..16ac62a69f 100644 --- a/ext/node/polyfills/internal/options.ts +++ b/ext/node/polyfills/internal/options.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/primordials.mjs b/ext/node/polyfills/internal/primordials.mjs index cddd1aa66d..027994a3d2 100644 --- a/ext/node/polyfills/internal/primordials.mjs +++ b/ext/node/polyfills/internal/primordials.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/process/per_thread.mjs b/ext/node/polyfills/internal/process/per_thread.mjs index b4db3f3691..9d784be153 100644 --- a/ext/node/polyfills/internal/process/per_thread.mjs +++ b/ext/node/polyfills/internal/process/per_thread.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/process/report.ts b/ext/node/polyfills/internal/process/report.ts index c4a1ff5616..5374c449fc 100644 --- a/ext/node/polyfills/internal/process/report.ts +++ b/ext/node/polyfills/internal/process/report.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; const { diff --git a/ext/node/polyfills/internal/querystring.ts b/ext/node/polyfills/internal/querystring.ts index a34e4e4b76..1824203c60 100644 --- a/ext/node/polyfills/internal/querystring.ts +++ b/ext/node/polyfills/internal/querystring.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/readline/callbacks.mjs b/ext/node/polyfills/internal/readline/callbacks.mjs index 5e3d7382fc..4f860776e0 100644 --- a/ext/node/polyfills/internal/readline/callbacks.mjs +++ b/ext/node/polyfills/internal/readline/callbacks.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs b/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs index e016fd1533..27a010b420 100644 --- a/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs +++ b/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/readline/interface.mjs b/ext/node/polyfills/internal/readline/interface.mjs index bdb832f881..9988f6c46b 100644 --- a/ext/node/polyfills/internal/readline/interface.mjs +++ b/ext/node/polyfills/internal/readline/interface.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/readline/promises.mjs b/ext/node/polyfills/internal/readline/promises.mjs index f1de6a2d31..21ab8b6d93 100644 --- a/ext/node/polyfills/internal/readline/promises.mjs +++ b/ext/node/polyfills/internal/readline/promises.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/readline/symbols.mjs b/ext/node/polyfills/internal/readline/symbols.mjs index 299cc8c9a7..7b935d1243 100644 --- a/ext/node/polyfills/internal/readline/symbols.mjs +++ b/ext/node/polyfills/internal/readline/symbols.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/readline/utils.mjs b/ext/node/polyfills/internal/readline/utils.mjs index b9372ab0ea..495c373638 100644 --- a/ext/node/polyfills/internal/readline/utils.mjs +++ b/ext/node/polyfills/internal/readline/utils.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/stream_base_commons.ts b/ext/node/polyfills/internal/stream_base_commons.ts index 1fabb73f47..050658d4f5 100644 --- a/ext/node/polyfills/internal/stream_base_commons.ts +++ b/ext/node/polyfills/internal/stream_base_commons.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/streams/add-abort-signal.mjs b/ext/node/polyfills/internal/streams/add-abort-signal.mjs index 2e66c86643..d6a3ca099e 100644 --- a/ext/node/polyfills/internal/streams/add-abort-signal.mjs +++ b/ext/node/polyfills/internal/streams/add-abort-signal.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/buffer_list.mjs b/ext/node/polyfills/internal/streams/buffer_list.mjs index db3a703388..cb9dba563b 100644 --- a/ext/node/polyfills/internal/streams/buffer_list.mjs +++ b/ext/node/polyfills/internal/streams/buffer_list.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/destroy.mjs b/ext/node/polyfills/internal/streams/destroy.mjs index 27420e78bf..6e60e20ace 100644 --- a/ext/node/polyfills/internal/streams/destroy.mjs +++ b/ext/node/polyfills/internal/streams/destroy.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/duplex.mjs b/ext/node/polyfills/internal/streams/duplex.mjs index b7c0b077ff..0424c3d17b 100644 --- a/ext/node/polyfills/internal/streams/duplex.mjs +++ b/ext/node/polyfills/internal/streams/duplex.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/end-of-stream.mjs b/ext/node/polyfills/internal/streams/end-of-stream.mjs index aebdb90bf3..be9bf0a50c 100644 --- a/ext/node/polyfills/internal/streams/end-of-stream.mjs +++ b/ext/node/polyfills/internal/streams/end-of-stream.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/lazy_transform.mjs b/ext/node/polyfills/internal/streams/lazy_transform.mjs index 3033ee6d4c..f5cf8ac48a 100644 --- a/ext/node/polyfills/internal/streams/lazy_transform.mjs +++ b/ext/node/polyfills/internal/streams/lazy_transform.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/passthrough.mjs b/ext/node/polyfills/internal/streams/passthrough.mjs index 8c7d4f3560..aa3f26a52c 100644 --- a/ext/node/polyfills/internal/streams/passthrough.mjs +++ b/ext/node/polyfills/internal/streams/passthrough.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/readable.mjs b/ext/node/polyfills/internal/streams/readable.mjs index c5411d6451..7c291f3932 100644 --- a/ext/node/polyfills/internal/streams/readable.mjs +++ b/ext/node/polyfills/internal/streams/readable.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/state.mjs b/ext/node/polyfills/internal/streams/state.mjs index 428492306b..599620ce7a 100644 --- a/ext/node/polyfills/internal/streams/state.mjs +++ b/ext/node/polyfills/internal/streams/state.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/transform.mjs b/ext/node/polyfills/internal/streams/transform.mjs index af368365cb..ac2bf6acc9 100644 --- a/ext/node/polyfills/internal/streams/transform.mjs +++ b/ext/node/polyfills/internal/streams/transform.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/utils.mjs b/ext/node/polyfills/internal/streams/utils.mjs index a2506bd5de..65551b129d 100644 --- a/ext/node/polyfills/internal/streams/utils.mjs +++ b/ext/node/polyfills/internal/streams/utils.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/streams/writable.mjs b/ext/node/polyfills/internal/streams/writable.mjs index c02e4e0e1d..7f1679e372 100644 --- a/ext/node/polyfills/internal/streams/writable.mjs +++ b/ext/node/polyfills/internal/streams/writable.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/test/binding.ts b/ext/node/polyfills/internal/test/binding.ts index cce56b922c..bbd78ec471 100644 --- a/ext/node/polyfills/internal/test/binding.ts +++ b/ext/node/polyfills/internal/test/binding.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. import { getBinding } from "ext:deno_node/internal_binding/mod.ts"; import type { BindingName } from "ext:deno_node/internal_binding/mod.ts"; diff --git a/ext/node/polyfills/internal/timers.mjs b/ext/node/polyfills/internal/timers.mjs index 363f55f693..84dd165e26 100644 --- a/ext/node/polyfills/internal/timers.mjs +++ b/ext/node/polyfills/internal/timers.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/url.ts b/ext/node/polyfills/internal/url.ts index 4b9da49ec0..82d7a8b4bf 100644 --- a/ext/node/polyfills/internal/url.ts +++ b/ext/node/polyfills/internal/url.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/util.mjs b/ext/node/polyfills/internal/util.mjs index a603a975ad..91de868920 100644 --- a/ext/node/polyfills/internal/util.mjs +++ b/ext/node/polyfills/internal/util.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal/util/comparisons.ts b/ext/node/polyfills/internal/util/comparisons.ts index 39e30c69aa..44f0bef007 100644 --- a/ext/node/polyfills/internal/util/comparisons.ts +++ b/ext/node/polyfills/internal/util/comparisons.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file diff --git a/ext/node/polyfills/internal/util/debuglog.ts b/ext/node/polyfills/internal/util/debuglog.ts index bbaba7b6fc..dc05aff825 100644 --- a/ext/node/polyfills/internal/util/debuglog.ts +++ b/ext/node/polyfills/internal/util/debuglog.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal/util/inspect.mjs b/ext/node/polyfills/internal/util/inspect.mjs index ae797449bf..0587059122 100644 --- a/ext/node/polyfills/internal/util/inspect.mjs +++ b/ext/node/polyfills/internal/util/inspect.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal/util/parse_args/parse_args.js b/ext/node/polyfills/internal/util/parse_args/parse_args.js index 742f2a1f0d..c4a60bcd35 100644 --- a/ext/node/polyfills/internal/util/parse_args/parse_args.js +++ b/ext/node/polyfills/internal/util/parse_args/parse_args.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/internal/util/parse_args/utils.js b/ext/node/polyfills/internal/util/parse_args/utils.js index 1ceed0b9e8..dd76fa1512 100644 --- a/ext/node/polyfills/internal/util/parse_args/utils.js +++ b/ext/node/polyfills/internal/util/parse_args/utils.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/internal/util/types.ts b/ext/node/polyfills/internal/util/types.ts index b8aca59680..9415c9db5f 100644 --- a/ext/node/polyfills/internal/util/types.ts +++ b/ext/node/polyfills/internal/util/types.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // // Adapted from Node.js. Copyright Joyent, Inc. and other Node contributors. // diff --git a/ext/node/polyfills/internal/validators.mjs b/ext/node/polyfills/internal/validators.mjs index 12962b8432..0529dca546 100644 --- a/ext/node/polyfills/internal/validators.mjs +++ b/ext/node/polyfills/internal/validators.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/internal_binding/_libuv_winerror.ts b/ext/node/polyfills/internal_binding/_libuv_winerror.ts index 3ba7d9cdae..b84c60226c 100644 --- a/ext/node/polyfills/internal_binding/_libuv_winerror.ts +++ b/ext/node/polyfills/internal_binding/_libuv_winerror.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { op_node_sys_to_uv_error } from "ext:core/ops"; diff --git a/ext/node/polyfills/internal_binding/_listen.ts b/ext/node/polyfills/internal_binding/_listen.ts index 613fdd999d..06e13af79f 100644 --- a/ext/node/polyfills/internal_binding/_listen.ts +++ b/ext/node/polyfills/internal_binding/_listen.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal_binding/_node.ts b/ext/node/polyfills/internal_binding/_node.ts index bf6b776130..1e4f1d257e 100644 --- a/ext/node/polyfills/internal_binding/_node.ts +++ b/ext/node/polyfills/internal_binding/_node.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This file contains C++ node globals accessed in internal binding calls /** diff --git a/ext/node/polyfills/internal_binding/_timingSafeEqual.ts b/ext/node/polyfills/internal_binding/_timingSafeEqual.ts index d9811c5505..f24e70b723 100644 --- a/ext/node/polyfills/internal_binding/_timingSafeEqual.ts +++ b/ext/node/polyfills/internal_binding/_timingSafeEqual.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal_binding/_utils.ts b/ext/node/polyfills/internal_binding/_utils.ts index 74dc3cbcd6..c3e5ca7adb 100644 --- a/ext/node/polyfills/internal_binding/_utils.ts +++ b/ext/node/polyfills/internal_binding/_utils.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal_binding/ares.ts b/ext/node/polyfills/internal_binding/ares.ts index 46afdfb195..807617aa94 100644 --- a/ext/node/polyfills/internal_binding/ares.ts +++ b/ext/node/polyfills/internal_binding/ares.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /* Copyright 1998 by the Massachusetts Institute of Technology. * * Permission to use, copy, modify, and distribute this diff --git a/ext/node/polyfills/internal_binding/async_wrap.ts b/ext/node/polyfills/internal_binding/async_wrap.ts index affee03fab..4480e1a0a7 100644 --- a/ext/node/polyfills/internal_binding/async_wrap.ts +++ b/ext/node/polyfills/internal_binding/async_wrap.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/buffer.ts b/ext/node/polyfills/internal_binding/buffer.ts index 4b8e5388b2..7a543e6f03 100644 --- a/ext/node/polyfills/internal_binding/buffer.ts +++ b/ext/node/polyfills/internal_binding/buffer.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal_binding/cares_wrap.ts b/ext/node/polyfills/internal_binding/cares_wrap.ts index cbd0bb8ef6..6a864e5855 100644 --- a/ext/node/polyfills/internal_binding/cares_wrap.ts +++ b/ext/node/polyfills/internal_binding/cares_wrap.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/connection_wrap.ts b/ext/node/polyfills/internal_binding/connection_wrap.ts index ef07025e29..036d7a3e5b 100644 --- a/ext/node/polyfills/internal_binding/connection_wrap.ts +++ b/ext/node/polyfills/internal_binding/connection_wrap.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/constants.ts b/ext/node/polyfills/internal_binding/constants.ts index ccb0ba5702..5e1afb7222 100644 --- a/ext/node/polyfills/internal_binding/constants.ts +++ b/ext/node/polyfills/internal_binding/constants.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { op_node_build_os } from "ext:core/ops"; diff --git a/ext/node/polyfills/internal_binding/crypto.ts b/ext/node/polyfills/internal_binding/crypto.ts index 3aabbbf344..e3d03a4b1a 100644 --- a/ext/node/polyfills/internal_binding/crypto.ts +++ b/ext/node/polyfills/internal_binding/crypto.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. import { notImplemented } from "ext:deno_node/_utils.ts"; diff --git a/ext/node/polyfills/internal_binding/handle_wrap.ts b/ext/node/polyfills/internal_binding/handle_wrap.ts index 1b3036a7ef..61a34fbc06 100644 --- a/ext/node/polyfills/internal_binding/handle_wrap.ts +++ b/ext/node/polyfills/internal_binding/handle_wrap.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/http_parser.ts b/ext/node/polyfills/internal_binding/http_parser.ts index bad10d9851..ac087e24de 100644 --- a/ext/node/polyfills/internal_binding/http_parser.ts +++ b/ext/node/polyfills/internal_binding/http_parser.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/mod.ts b/ext/node/polyfills/internal_binding/mod.ts index ebbfc629f1..25a5a2c7c2 100644 --- a/ext/node/polyfills/internal_binding/mod.ts +++ b/ext/node/polyfills/internal_binding/mod.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/internal_binding/node_file.ts b/ext/node/polyfills/internal_binding/node_file.ts index 6c134ec4bc..1e97ee5cf7 100644 --- a/ext/node/polyfills/internal_binding/node_file.ts +++ b/ext/node/polyfills/internal_binding/node_file.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/node_options.ts b/ext/node/polyfills/internal_binding/node_options.ts index ddacb28b6d..927fd39b94 100644 --- a/ext/node/polyfills/internal_binding/node_options.ts +++ b/ext/node/polyfills/internal_binding/node_options.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/pipe_wrap.ts b/ext/node/polyfills/internal_binding/pipe_wrap.ts index 3e366b3c76..3917be36ee 100644 --- a/ext/node/polyfills/internal_binding/pipe_wrap.ts +++ b/ext/node/polyfills/internal_binding/pipe_wrap.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/stream_wrap.ts b/ext/node/polyfills/internal_binding/stream_wrap.ts index 19c9357ce8..e66c737be0 100644 --- a/ext/node/polyfills/internal_binding/stream_wrap.ts +++ b/ext/node/polyfills/internal_binding/stream_wrap.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/string_decoder.ts b/ext/node/polyfills/internal_binding/string_decoder.ts index 7f8c954a35..4825ea0aa9 100644 --- a/ext/node/polyfills/internal_binding/string_decoder.ts +++ b/ext/node/polyfills/internal_binding/string_decoder.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { Encodings } from "ext:deno_node/internal_binding/_node.ts"; const encodings = []; diff --git a/ext/node/polyfills/internal_binding/symbols.ts b/ext/node/polyfills/internal_binding/symbols.ts index 2b0656b0ea..affc63eb84 100644 --- a/ext/node/polyfills/internal_binding/symbols.ts +++ b/ext/node/polyfills/internal_binding/symbols.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/tcp_wrap.ts b/ext/node/polyfills/internal_binding/tcp_wrap.ts index d9f1c5356a..6c19e2dd29 100644 --- a/ext/node/polyfills/internal_binding/tcp_wrap.ts +++ b/ext/node/polyfills/internal_binding/tcp_wrap.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/types.ts b/ext/node/polyfills/internal_binding/types.ts index 2d301ba1b2..a0fd338600 100644 --- a/ext/node/polyfills/internal_binding/types.ts +++ b/ext/node/polyfills/internal_binding/types.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // // Adapted from Node.js. Copyright Joyent, Inc. and other Node contributors. // diff --git a/ext/node/polyfills/internal_binding/udp_wrap.ts b/ext/node/polyfills/internal_binding/udp_wrap.ts index db6961ddb7..337dfe75c2 100644 --- a/ext/node/polyfills/internal_binding/udp_wrap.ts +++ b/ext/node/polyfills/internal_binding/udp_wrap.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/util.ts b/ext/node/polyfills/internal_binding/util.ts index c8fb32d8ca..9297e1b20c 100644 --- a/ext/node/polyfills/internal_binding/util.ts +++ b/ext/node/polyfills/internal_binding/util.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/internal_binding/uv.ts b/ext/node/polyfills/internal_binding/uv.ts index 6cd70a7e85..cd868cb395 100644 --- a/ext/node/polyfills/internal_binding/uv.ts +++ b/ext/node/polyfills/internal_binding/uv.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/net.ts b/ext/node/polyfills/net.ts index b2b0c9857c..3f7603079e 100644 --- a/ext/node/polyfills/net.ts +++ b/ext/node/polyfills/net.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/os.ts b/ext/node/polyfills/os.ts index edc89ed2c3..bd4b285ba3 100644 --- a/ext/node/polyfills/os.ts +++ b/ext/node/polyfills/os.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/path.ts b/ext/node/polyfills/path.ts index 19ba2e26d3..255f9592a0 100644 --- a/ext/node/polyfills/path.ts +++ b/ext/node/polyfills/path.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. export * from "ext:deno_node/path/mod.ts"; import m from "ext:deno_node/path/mod.ts"; export default m; diff --git a/ext/node/polyfills/path/_constants.ts b/ext/node/polyfills/path/_constants.ts index 3407515169..b18f90601f 100644 --- a/ext/node/polyfills/path/_constants.ts +++ b/ext/node/polyfills/path/_constants.ts @@ -1,6 +1,6 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Alphabet chars. export const CHAR_UPPERCASE_A = 65; /* A */ diff --git a/ext/node/polyfills/path/_interface.ts b/ext/node/polyfills/path/_interface.ts index cb40bae12e..e37933962b 100644 --- a/ext/node/polyfills/path/_interface.ts +++ b/ext/node/polyfills/path/_interface.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /** * A parsed path object generated by path.parse() or consumed by path.format(). diff --git a/ext/node/polyfills/path/_posix.ts b/ext/node/polyfills/path/_posix.ts index bf0b91d488..6a4aa2117a 100644 --- a/ext/node/polyfills/path/_posix.ts +++ b/ext/node/polyfills/path/_posix.ts @@ -1,6 +1,6 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/path/_util.ts b/ext/node/polyfills/path/_util.ts index 9248c68ae5..1e95faea41 100644 --- a/ext/node/polyfills/path/_util.ts +++ b/ext/node/polyfills/path/_util.ts @@ -1,6 +1,6 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/path/_win32.ts b/ext/node/polyfills/path/_win32.ts index 11c82e0eee..70a0d8a006 100644 --- a/ext/node/polyfills/path/_win32.ts +++ b/ext/node/polyfills/path/_win32.ts @@ -1,6 +1,6 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/path/common.ts b/ext/node/polyfills/path/common.ts index ee2987307e..9c1c91a650 100644 --- a/ext/node/polyfills/path/common.ts +++ b/ext/node/polyfills/path/common.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This module is browser compatible. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/path/mod.ts b/ext/node/polyfills/path/mod.ts index e74c1da4db..5fd5e34e57 100644 --- a/ext/node/polyfills/path/mod.ts +++ b/ext/node/polyfills/path/mod.ts @@ -1,6 +1,6 @@ // Copyright the Browserify authors. MIT License. // Ported mostly from https://github.com/browserify/path-browserify/ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { isWindows } from "ext:deno_node/_util/os.ts"; import _win32 from "ext:deno_node/path/_win32.ts"; diff --git a/ext/node/polyfills/path/posix.ts b/ext/node/polyfills/path/posix.ts index 2b6582ff6d..474d74afaf 100644 --- a/ext/node/polyfills/path/posix.ts +++ b/ext/node/polyfills/path/posix.ts @@ -1,6 +1,6 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import path from "ext:deno_node/path/mod.ts"; diff --git a/ext/node/polyfills/path/separator.ts b/ext/node/polyfills/path/separator.ts index 36dce7df99..bb9eaf7bb4 100644 --- a/ext/node/polyfills/path/separator.ts +++ b/ext/node/polyfills/path/separator.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/path/win32.ts b/ext/node/polyfills/path/win32.ts index 02e6f97c5a..740a346508 100644 --- a/ext/node/polyfills/path/win32.ts +++ b/ext/node/polyfills/path/win32.ts @@ -1,6 +1,6 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import path from "ext:deno_node/path/mod.ts"; diff --git a/ext/node/polyfills/perf_hooks.ts b/ext/node/polyfills/perf_hooks.ts index ec76b3ce2d..af4e7b261f 100644 --- a/ext/node/polyfills/perf_hooks.ts +++ b/ext/node/polyfills/perf_hooks.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts index 647376d5cf..e91a2ee005 100644 --- a/ext/node/polyfills/process.ts +++ b/ext/node/polyfills/process.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/punycode.ts b/ext/node/polyfills/punycode.ts index adecdf4f9a..6e29dd81f9 100644 --- a/ext/node/polyfills/punycode.ts +++ b/ext/node/polyfills/punycode.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { op_node_idna_punycode_decode, diff --git a/ext/node/polyfills/querystring.js b/ext/node/polyfills/querystring.js index 5eb6a077aa..206c3f5f82 100644 --- a/ext/node/polyfills/querystring.js +++ b/ext/node/polyfills/querystring.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials diff --git a/ext/node/polyfills/readline.ts b/ext/node/polyfills/readline.ts index 5813dd3d9b..6b7e51fe9d 100644 --- a/ext/node/polyfills/readline.ts +++ b/ext/node/polyfills/readline.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @deno-types="./_readline.d.ts" import { diff --git a/ext/node/polyfills/readline/promises.ts b/ext/node/polyfills/readline/promises.ts index 76c8b350d4..0e5ae6b8bb 100644 --- a/ext/node/polyfills/readline/promises.ts +++ b/ext/node/polyfills/readline/promises.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/repl.ts b/ext/node/polyfills/repl.ts index a7acc5b19a..c0e69d93eb 100644 --- a/ext/node/polyfills/repl.ts +++ b/ext/node/polyfills/repl.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/stream.ts b/ext/node/polyfills/stream.ts index 96262428f0..2c9821dee6 100644 --- a/ext/node/polyfills/stream.ts +++ b/ext/node/polyfills/stream.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // compose, destroy and isDisturbed are experimental APIs without // typings. They can be exposed once they are released as stable in Node diff --git a/ext/node/polyfills/stream/consumers.mjs b/ext/node/polyfills/stream/consumers.mjs index dc5d29f611..5f436c3e17 100644 --- a/ext/node/polyfills/stream/consumers.mjs +++ b/ext/node/polyfills/stream/consumers.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/stream/promises.mjs b/ext/node/polyfills/stream/promises.mjs index 1282ca8963..007000d883 100644 --- a/ext/node/polyfills/stream/promises.mjs +++ b/ext/node/polyfills/stream/promises.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import { Stream } from "ext:deno_node/_stream.mjs"; diff --git a/ext/node/polyfills/stream/web.ts b/ext/node/polyfills/stream/web.ts index 9cb361f862..c0594c0cb7 100644 --- a/ext/node/polyfills/stream/web.ts +++ b/ext/node/polyfills/stream/web.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { ByteLengthQueuingStrategy, diff --git a/ext/node/polyfills/string_decoder.ts b/ext/node/polyfills/string_decoder.ts index b4a422e4b6..f8dfe8d9a8 100644 --- a/ext/node/polyfills/string_decoder.ts +++ b/ext/node/polyfills/string_decoder.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/sys.ts b/ext/node/polyfills/sys.ts index 4ee112caea..e10f174b6d 100644 --- a/ext/node/polyfills/sys.ts +++ b/ext/node/polyfills/sys.ts @@ -1,3 +1,3 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. export * from "node:util"; export { default } from "node:util"; diff --git a/ext/node/polyfills/testing.ts b/ext/node/polyfills/testing.ts index 901c38ed36..39014533a5 100644 --- a/ext/node/polyfills/testing.ts +++ b/ext/node/polyfills/testing.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; const { PromisePrototypeThen } = primordials; diff --git a/ext/node/polyfills/timers.ts b/ext/node/polyfills/timers.ts index fa5f7a2042..9ef704a0b3 100644 --- a/ext/node/polyfills/timers.ts +++ b/ext/node/polyfills/timers.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; const { diff --git a/ext/node/polyfills/timers/promises.ts b/ext/node/polyfills/timers/promises.ts index b2896fe809..2ec2327330 100644 --- a/ext/node/polyfills/timers/promises.ts +++ b/ext/node/polyfills/timers/promises.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import timers from "node:timers"; export const setTimeout = timers.promises.setTimeout; diff --git a/ext/node/polyfills/tls.ts b/ext/node/polyfills/tls.ts index 4cfe9ebd63..345994236e 100644 --- a/ext/node/polyfills/tls.ts +++ b/ext/node/polyfills/tls.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. // TODO(petamoriken): enable prefer-primordials for node polyfills diff --git a/ext/node/polyfills/trace_events.ts b/ext/node/polyfills/trace_events.ts index bb3ea97459..4df631a4c5 100644 --- a/ext/node/polyfills/trace_events.ts +++ b/ext/node/polyfills/trace_events.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts"; diff --git a/ext/node/polyfills/tty.js b/ext/node/polyfills/tty.js index e906c5f677..1545ab12ec 100644 --- a/ext/node/polyfills/tty.js +++ b/ext/node/polyfills/tty.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { op_bootstrap_color_depth } from "ext:core/ops"; import { core, primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/url.ts b/ext/node/polyfills/url.ts index 4eeb0381f6..b2744ff6cc 100644 --- a/ext/node/polyfills/url.ts +++ b/ext/node/polyfills/url.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/ext/node/polyfills/util.ts b/ext/node/polyfills/util.ts index d82b288b03..06c75ef79a 100644 --- a/ext/node/polyfills/util.ts +++ b/ext/node/polyfills/util.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; const { diff --git a/ext/node/polyfills/util/types.ts b/ext/node/polyfills/util/types.ts index 5f2ead19bb..fbf9092d9d 100644 --- a/ext/node/polyfills/util/types.ts +++ b/ext/node/polyfills/util/types.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as types from "ext:deno_node/internal/util/types.ts"; export * from "ext:deno_node/internal/util/types.ts"; export default { ...types }; diff --git a/ext/node/polyfills/v8.ts b/ext/node/polyfills/v8.ts index e24a79ab5a..6d7892a724 100644 --- a/ext/node/polyfills/v8.ts +++ b/ext/node/polyfills/v8.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. /// diff --git a/ext/node/polyfills/vm.js b/ext/node/polyfills/vm.js index b64c847c58..72279abcf8 100644 --- a/ext/node/polyfills/vm.js +++ b/ext/node/polyfills/vm.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. import { Buffer } from "node:buffer"; diff --git a/ext/node/polyfills/wasi.ts b/ext/node/polyfills/wasi.ts index 4bdc776a4c..b948b0e35c 100644 --- a/ext/node/polyfills/wasi.ts +++ b/ext/node/polyfills/wasi.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/worker_threads.ts b/ext/node/polyfills/worker_threads.ts index dc844169c5..87de9a5a5c 100644 --- a/ext/node/polyfills/worker_threads.ts +++ b/ext/node/polyfills/worker_threads.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. import { core, internals, primordials } from "ext:core/mod.js"; diff --git a/ext/node/polyfills/zlib.ts b/ext/node/polyfills/zlib.ts index 6e5d02b5be..08a9238bd5 100644 --- a/ext/node/polyfills/zlib.ts +++ b/ext/node/polyfills/zlib.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { notImplemented } from "ext:deno_node/_utils.ts"; import { zlib as constants } from "ext:deno_node/internal_binding/constants.ts"; import { diff --git a/ext/telemetry/Cargo.toml b/ext/telemetry/Cargo.toml index fedaed6656..4328b707d3 100644 --- a/ext/telemetry/Cargo.toml +++ b/ext/telemetry/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_telemetry" diff --git a/ext/telemetry/lib.rs b/ext/telemetry/lib.rs index 8018843dc4..eeff09ed88 100644 --- a/ext/telemetry/lib.rs +++ b/ext/telemetry/lib.rs @@ -1,4 +1,19 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::collections::HashMap; +use std::env; +use std::fmt::Debug; +use std::pin::Pin; +use std::rc::Rc; +use std::sync::Arc; +use std::sync::Mutex; +use std::task::Context; +use std::task::Poll; +use std::thread; +use std::time::Duration; +use std::time::SystemTime; use deno_core::anyhow; use deno_core::anyhow::anyhow; @@ -57,20 +72,6 @@ use opentelemetry_semantic_conventions::resource::TELEMETRY_SDK_NAME; use opentelemetry_semantic_conventions::resource::TELEMETRY_SDK_VERSION; use serde::Deserialize; use serde::Serialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::collections::HashMap; -use std::env; -use std::fmt::Debug; -use std::pin::Pin; -use std::rc::Rc; -use std::sync::Arc; -use std::sync::Mutex; -use std::task::Context; -use std::task::Poll; -use std::thread; -use std::time::Duration; -use std::time::SystemTime; use tokio::sync::oneshot; use tokio::task::JoinSet; @@ -469,6 +470,11 @@ impl DenoPeriodicReader { } mod hyper_client { + use std::fmt::Debug; + use std::pin::Pin; + use std::task::Poll; + use std::task::{self}; + use http_body_util::BodyExt; use http_body_util::Full; use hyper::body::Body as HttpBody; @@ -480,10 +486,6 @@ mod hyper_client { use opentelemetry_http::Request; use opentelemetry_http::Response; use opentelemetry_http::ResponseExt; - use std::fmt::Debug; - use std::pin::Pin; - use std::task::Poll; - use std::task::{self}; use super::OtelSharedRuntime; diff --git a/ext/telemetry/telemetry.ts b/ext/telemetry/telemetry.ts index 86b4fe059d..31e052c28b 100644 --- a/ext/telemetry/telemetry.ts +++ b/ext/telemetry/telemetry.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { diff --git a/ext/telemetry/util.ts b/ext/telemetry/util.ts index 7e30d5d859..ac233f7a9f 100644 --- a/ext/telemetry/util.ts +++ b/ext/telemetry/util.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; import type { Span } from "ext:deno_telemetry/telemetry.ts"; diff --git a/ext/tls/Cargo.toml b/ext/tls/Cargo.toml index 6bf1b8ea03..53d85ba83c 100644 --- a/ext/tls/Cargo.toml +++ b/ext/tls/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_tls" diff --git a/ext/tls/lib.rs b/ext/tls/lib.rs index 883d2995e4..63e78e3f83 100644 --- a/ext/tls/lib.rs +++ b/ext/tls/lib.rs @@ -1,32 +1,32 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -pub use deno_native_certs; -pub use rustls; -use rustls::pki_types::CertificateDer; -use rustls::pki_types::PrivateKeyDer; -use rustls::pki_types::ServerName; -pub use rustls_pemfile; -pub use rustls_tokio_stream::*; -pub use webpki; -pub use webpki_roots; - -use rustls::client::danger::HandshakeSignatureValid; -use rustls::client::danger::ServerCertVerified; -use rustls::client::danger::ServerCertVerifier; -use rustls::client::WebPkiServerVerifier; -use rustls::ClientConfig; -use rustls::DigitallySignedStruct; -use rustls::RootCertStore; -use rustls_pemfile::certs; -use rustls_pemfile::ec_private_keys; -use rustls_pemfile::pkcs8_private_keys; -use rustls_pemfile::rsa_private_keys; -use serde::Deserialize; +// Copyright 2018-2025 the Deno authors. MIT license. use std::io::BufRead; use std::io::BufReader; use std::io::Cursor; use std::net::IpAddr; use std::sync::Arc; +pub use deno_native_certs; +pub use rustls; +use rustls::client::danger::HandshakeSignatureValid; +use rustls::client::danger::ServerCertVerified; +use rustls::client::danger::ServerCertVerifier; +use rustls::client::WebPkiServerVerifier; +use rustls::pki_types::CertificateDer; +use rustls::pki_types::PrivateKeyDer; +use rustls::pki_types::ServerName; +use rustls::ClientConfig; +use rustls::DigitallySignedStruct; +use rustls::RootCertStore; +pub use rustls_pemfile; +use rustls_pemfile::certs; +use rustls_pemfile::ec_private_keys; +use rustls_pemfile::pkcs8_private_keys; +use rustls_pemfile::rsa_private_keys; +pub use rustls_tokio_stream::*; +use serde::Deserialize; +pub use webpki; +pub use webpki_roots; + mod tls_key; pub use tls_key::*; diff --git a/ext/tls/tls_key.rs b/ext/tls/tls_key.rs index b7baa604b9..dfd2863e5e 100644 --- a/ext/tls/tls_key.rs +++ b/ext/tls/tls_key.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! These represent the various types of TLS keys we support for both client and server //! connections. @@ -11,12 +11,6 @@ //! key lookup can handle closing one end of the pair, in which case they will just //! attempt to clean up the associated resources. -use deno_core::futures::future::poll_fn; -use deno_core::futures::future::Either; -use deno_core::futures::FutureExt; -use deno_core::unsync::spawn; -use rustls::ServerConfig; -use rustls_tokio_stream::ServerConfigProvider; use std::cell::RefCell; use std::collections::HashMap; use std::fmt::Debug; @@ -25,6 +19,13 @@ use std::future::Future; use std::io::ErrorKind; use std::rc::Rc; use std::sync::Arc; + +use deno_core::futures::future::poll_fn; +use deno_core::futures::future::Either; +use deno_core::futures::FutureExt; +use deno_core::unsync::spawn; +use rustls::ServerConfig; +use rustls_tokio_stream::ServerConfigProvider; use tokio::sync::broadcast; use tokio::sync::mpsc; use tokio::sync::oneshot; @@ -269,9 +270,10 @@ impl TlsKeyLookup { #[cfg(test)] pub mod tests { - use super::*; use deno_core::unsync::spawn; + use super::*; + fn tls_key_for_test(sni: &str) -> TlsKey { let manifest_dir = std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()); diff --git a/ext/url/00_url.js b/ext/url/00_url.js index ec875da768..c853430d1a 100644 --- a/ext/url/00_url.js +++ b/ext/url/00_url.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/url/01_urlpattern.js b/ext/url/01_urlpattern.js index 6e27563089..5febef3332 100644 --- a/ext/url/01_urlpattern.js +++ b/ext/url/01_urlpattern.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/url/Cargo.toml b/ext/url/Cargo.toml index 9ca3ce6752..4dcb6f42ca 100644 --- a/ext/url/Cargo.toml +++ b/ext/url/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_url" diff --git a/ext/url/benches/url_ops.rs b/ext/url/benches/url_ops.rs index 70afb96db2..9295a08d51 100644 --- a/ext/url/benches/url_ops.rs +++ b/ext/url/benches/url_ops.rs @@ -1,10 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_bench_util::bench_js_sync; use deno_bench_util::bench_or_profile; use deno_bench_util::bencher::benchmark_group; use deno_bench_util::bencher::Bencher; - use deno_core::Extension; fn setup() -> Vec { diff --git a/ext/url/internal.d.ts b/ext/url/internal.d.ts index 11bacb0e1b..69e0472e8e 100644 --- a/ext/url/internal.d.ts +++ b/ext/url/internal.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// /// diff --git a/ext/url/lib.deno_url.d.ts b/ext/url/lib.deno_url.d.ts index 946c70607f..08fe74cd66 100644 --- a/ext/url/lib.deno_url.d.ts +++ b/ext/url/lib.deno_url.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any no-var diff --git a/ext/url/lib.rs b/ext/url/lib.rs index f8946532ae..0e9ca5839a 100644 --- a/ext/url/lib.rs +++ b/ext/url/lib.rs @@ -1,7 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod urlpattern; +use std::path::PathBuf; + use deno_core::error::type_error; use deno_core::error::AnyError; use deno_core::op2; @@ -10,13 +12,11 @@ use deno_core::url::quirks; use deno_core::url::Url; use deno_core::JsBuffer; use deno_core::OpState; -use std::path::PathBuf; +pub use urlpattern::UrlPatternError; use crate::urlpattern::op_urlpattern_parse; use crate::urlpattern::op_urlpattern_process_match_input; -pub use urlpattern::UrlPatternError; - deno_core::extension!( deno_url, deps = [deno_webidl], diff --git a/ext/url/urlpattern.rs b/ext/url/urlpattern.rs index 7d4e8ee71b..88564625da 100644 --- a/ext/url/urlpattern.rs +++ b/ext/url/urlpattern.rs @@ -1,7 +1,6 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::op2; - use urlpattern::quirks; use urlpattern::quirks::MatchInput; use urlpattern::quirks::StringOrInit; diff --git a/ext/web/00_infra.js b/ext/web/00_infra.js index 9a75f8fa58..8ca42e86c2 100644 --- a/ext/web/00_infra.js +++ b/ext/web/00_infra.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/01_dom_exception.js b/ext/web/01_dom_exception.js index db2996e0c6..730fda860f 100644 --- a/ext/web/01_dom_exception.js +++ b/ext/web/01_dom_exception.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/01_mimesniff.js b/ext/web/01_mimesniff.js index e60783bbe1..9a687a8305 100644 --- a/ext/web/01_mimesniff.js +++ b/ext/web/01_mimesniff.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/02_event.js b/ext/web/02_event.js index f6351c4b9e..810e48537d 100644 --- a/ext/web/02_event.js +++ b/ext/web/02_event.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This module follows most of the WHATWG Living Standard for the DOM logic. // Many parts of the DOM are not implemented in Deno, but the logic for those diff --git a/ext/web/02_structured_clone.js b/ext/web/02_structured_clone.js index 776a8ee96e..453700fc41 100644 --- a/ext/web/02_structured_clone.js +++ b/ext/web/02_structured_clone.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/02_timers.js b/ext/web/02_timers.js index 6058febd59..c74f9baff9 100644 --- a/ext/web/02_timers.js +++ b/ext/web/02_timers.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { op_defer } from "ext:core/ops"; diff --git a/ext/web/03_abort_signal.js b/ext/web/03_abort_signal.js index 93b3cf0522..1f9ce42e1e 100644 --- a/ext/web/03_abort_signal.js +++ b/ext/web/03_abort_signal.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/04_global_interfaces.js b/ext/web/04_global_interfaces.js index 7c7f83b431..bda695b530 100644 --- a/ext/web/04_global_interfaces.js +++ b/ext/web/04_global_interfaces.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/05_base64.js b/ext/web/05_base64.js index e6796e1dc3..155201f853 100644 --- a/ext/web/05_base64.js +++ b/ext/web/05_base64.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index f3ac711fc7..0b9ae538e2 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/06_streams_types.d.ts b/ext/web/06_streams_types.d.ts index fe05ee6e65..0a6cb6503a 100644 --- a/ext/web/06_streams_types.d.ts +++ b/ext/web/06_streams_types.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // ** Internal Interfaces ** diff --git a/ext/web/08_text_encoding.js b/ext/web/08_text_encoding.js index 3163c96282..8988c06c36 100644 --- a/ext/web/08_text_encoding.js +++ b/ext/web/08_text_encoding.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/09_file.js b/ext/web/09_file.js index 7c1d79ce31..cdad0b7396 100644 --- a/ext/web/09_file.js +++ b/ext/web/09_file.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/10_filereader.js b/ext/web/10_filereader.js index 2718606380..cecc6484a6 100644 --- a/ext/web/10_filereader.js +++ b/ext/web/10_filereader.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/12_location.js b/ext/web/12_location.js index ba0c47e2d1..cc1afb3d05 100644 --- a/ext/web/12_location.js +++ b/ext/web/12_location.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js index 79fec9de2f..f96cd193f4 100644 --- a/ext/web/13_message_port.js +++ b/ext/web/13_message_port.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/14_compression.js b/ext/web/14_compression.js index 1adb205b22..de49d7ad3d 100644 --- a/ext/web/14_compression.js +++ b/ext/web/14_compression.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/web/15_performance.js b/ext/web/15_performance.js index f23e851246..967cdda470 100644 --- a/ext/web/15_performance.js +++ b/ext/web/15_performance.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; import { op_now, op_time_origin } from "ext:core/ops"; diff --git a/ext/web/16_image_data.js b/ext/web/16_image_data.js index 13df0d07be..bd69da7903 100644 --- a/ext/web/16_image_data.js +++ b/ext/web/16_image_data.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; import * as webidl from "ext:deno_webidl/00_webidl.js"; diff --git a/ext/web/Cargo.toml b/ext/web/Cargo.toml index 44fb2e46bf..dd521ad037 100644 --- a/ext/web/Cargo.toml +++ b/ext/web/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_web" diff --git a/ext/web/benches/encoding.rs b/ext/web/benches/encoding.rs index d0738c6452..42497ef3ce 100644 --- a/ext/web/benches/encoding.rs +++ b/ext/web/benches/encoding.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_bench_util::bench_js_sync; use deno_bench_util::bench_or_profile; diff --git a/ext/web/benches/timers_ops.rs b/ext/web/benches/timers_ops.rs index d39ee4eeae..a8a52ad916 100644 --- a/ext/web/benches/timers_ops.rs +++ b/ext/web/benches/timers_ops.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_bench_util::bench_js_async; use deno_bench_util::bench_or_profile; diff --git a/ext/web/blob.rs b/ext/web/blob.rs index bc64a0f27e..8723337093 100644 --- a/ext/web/blob.rs +++ b/ext/web/blob.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::collections::HashMap; diff --git a/ext/web/compression.rs b/ext/web/compression.rs index 6967009915..650cc84085 100644 --- a/ext/web/compression.rs +++ b/ext/web/compression.rs @@ -1,4 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::cell::RefCell; +use std::io::Write; use deno_core::op2; use flate2::write::DeflateDecoder; @@ -8,8 +11,6 @@ use flate2::write::GzEncoder; use flate2::write::ZlibDecoder; use flate2::write::ZlibEncoder; use flate2::Compression; -use std::cell::RefCell; -use std::io::Write; #[derive(Debug, thiserror::Error)] pub enum CompressionError { diff --git a/ext/web/internal.d.ts b/ext/web/internal.d.ts index b2aea80d9f..64a8633854 100644 --- a/ext/web/internal.d.ts +++ b/ext/web/internal.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// /// diff --git a/ext/web/lib.deno_web.d.ts b/ext/web/lib.deno_web.d.ts index 8aafbad535..1fb003b66f 100644 --- a/ext/web/lib.deno_web.d.ts +++ b/ext/web/lib.deno_web.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any no-var diff --git a/ext/web/lib.rs b/ext/web/lib.rs index af0fc2c276..07b00f0049 100644 --- a/ext/web/lib.rs +++ b/ext/web/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod blob; mod compression; @@ -6,17 +6,6 @@ mod message_port; mod stream_resource; mod timers; -use deno_core::op2; -use deno_core::url::Url; -use deno_core::v8; -use deno_core::ByteString; -use deno_core::ToJsBuffer; -use deno_core::U16String; - -use encoding_rs::CoderResult; -use encoding_rs::Decoder; -use encoding_rs::DecoderResult; -use encoding_rs::Encoding; use std::borrow::Cow; use std::cell::RefCell; use std::path::PathBuf; @@ -24,6 +13,16 @@ use std::sync::Arc; pub use blob::BlobError; pub use compression::CompressionError; +use deno_core::op2; +use deno_core::url::Url; +use deno_core::v8; +use deno_core::ByteString; +use deno_core::ToJsBuffer; +use deno_core::U16String; +use encoding_rs::CoderResult; +use encoding_rs::Decoder; +use encoding_rs::DecoderResult; +use encoding_rs::Encoding; pub use message_port::MessagePortError; pub use stream_resource::StreamResourceError; @@ -38,7 +37,6 @@ pub use crate::blob::Blob; pub use crate::blob::BlobPart; pub use crate::blob::BlobStore; pub use crate::blob::InMemoryBlobPart; - pub use crate::message_port::create_entangled_message_port; pub use crate::message_port::deserialize_js_transferables; use crate::message_port::op_message_port_create_entangled; @@ -49,7 +47,6 @@ pub use crate::message_port::serialize_transferables; pub use crate::message_port::JsMessageData; pub use crate::message_port::MessagePort; pub use crate::message_port::Transferable; - use crate::timers::op_defer; use crate::timers::op_now; use crate::timers::op_time_origin; diff --git a/ext/web/message_port.rs b/ext/web/message_port.rs index 1a4a09073d..b2aad6776f 100644 --- a/ext/web/message_port.rs +++ b/ext/web/message_port.rs @@ -1,11 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::RefCell; use std::rc::Rc; use deno_core::op2; - use deno_core::CancelFuture; use deno_core::CancelHandle; use deno_core::DetachedBuffer; diff --git a/ext/web/stream_resource.rs b/ext/web/stream_resource.rs index c44a385ea9..5613f57384 100644 --- a/ext/web/stream_resource.rs +++ b/ext/web/stream_resource.rs @@ -1,4 +1,17 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::borrow::Cow; +use std::cell::RefCell; +use std::cell::RefMut; +use std::ffi::c_void; +use std::future::Future; +use std::marker::PhantomData; +use std::mem::MaybeUninit; +use std::pin::Pin; +use std::rc::Rc; +use std::task::Context; +use std::task::Poll; +use std::task::Waker; + use bytes::BytesMut; use deno_core::external; use deno_core::op2; @@ -17,18 +30,6 @@ use deno_core::Resource; use deno_core::ResourceId; use futures::future::poll_fn; use futures::TryFutureExt; -use std::borrow::Cow; -use std::cell::RefCell; -use std::cell::RefMut; -use std::ffi::c_void; -use std::future::Future; -use std::marker::PhantomData; -use std::mem::MaybeUninit; -use std::pin::Pin; -use std::rc::Rc; -use std::task::Context; -use std::task::Poll; -use std::task::Waker; #[derive(Debug, thiserror::Error)] pub enum StreamResourceError { @@ -607,13 +608,15 @@ impl Drop for ReadableStreamResourceData { #[cfg(test)] mod tests { - use super::*; - use deno_core::v8; use std::cell::OnceCell; use std::sync::atomic::AtomicUsize; use std::sync::OnceLock; use std::time::Duration; + use deno_core::v8; + + use super::*; + static V8_GLOBAL: OnceLock<()> = OnceLock::new(); thread_local! { diff --git a/ext/web/timers.rs b/ext/web/timers.rs index 06444ed34f..7929b6050e 100644 --- a/ext/web/timers.rs +++ b/ext/web/timers.rs @@ -1,14 +1,15 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! This module helps deno implement timers and performance APIs. -use deno_core::op2; -use deno_core::OpState; use std::time::Duration; use std::time::Instant; use std::time::SystemTime; use std::time::UNIX_EPOCH; +use deno_core::op2; +use deno_core::OpState; + pub trait TimersPermission { fn allow_hrtime(&mut self) -> bool; } diff --git a/ext/webgpu/00_init.js b/ext/webgpu/00_init.js index 0f10847cef..81bb27286d 100644 --- a/ext/webgpu/00_init.js +++ b/ext/webgpu/00_init.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core } from "ext:core/mod.js"; diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js index d371f49ea1..5ce34a5e7b 100644 --- a/ext/webgpu/01_webgpu.js +++ b/ext/webgpu/01_webgpu.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/webgpu/02_surface.js b/ext/webgpu/02_surface.js index ce723b891f..b0561469a9 100644 --- a/ext/webgpu/02_surface.js +++ b/ext/webgpu/02_surface.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check /// diff --git a/ext/webgpu/Cargo.toml b/ext/webgpu/Cargo.toml index 3a491afcf8..9aa1b2370c 100644 --- a/ext/webgpu/Cargo.toml +++ b/ext/webgpu/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_webgpu" diff --git a/ext/webgpu/binding.rs b/ext/webgpu/binding.rs index 41708acc7f..2849cf9bfe 100644 --- a/ext/webgpu/binding.rs +++ b/ext/webgpu/binding.rs @@ -1,4 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::rc::Rc; use deno_core::error::AnyError; use deno_core::op2; @@ -6,8 +9,6 @@ use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; use serde::Deserialize; -use std::borrow::Cow; -use std::rc::Rc; use super::error::WebGpuResult; diff --git a/ext/webgpu/buffer.rs b/ext/webgpu/buffer.rs index c2b53890e0..e8e33244c9 100644 --- a/ext/webgpu/buffer.rs +++ b/ext/webgpu/buffer.rs @@ -1,9 +1,5 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use deno_core::op2; -use deno_core::OpState; -use deno_core::Resource; -use deno_core::ResourceId; use std::borrow::Cow; use std::cell::RefCell; use std::rc::Rc; @@ -11,6 +7,11 @@ use std::sync::Arc; use std::sync::Mutex; use std::time::Duration; +use deno_core::op2; +use deno_core::OpState; +use deno_core::Resource; +use deno_core::ResourceId; + use super::error::WebGpuResult; #[derive(Debug, thiserror::Error)] diff --git a/ext/webgpu/bundle.rs b/ext/webgpu/bundle.rs index d9a5b29539..5fc147a44a 100644 --- a/ext/webgpu/bundle.rs +++ b/ext/webgpu/bundle.rs @@ -1,13 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::rc::Rc; use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; use serde::Deserialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::rc::Rc; use super::error::WebGpuResult; diff --git a/ext/webgpu/byow.rs b/ext/webgpu/byow.rs index c9e1177b1e..7c16c8a0d2 100644 --- a/ext/webgpu/byow.rs +++ b/ext/webgpu/byow.rs @@ -1,8 +1,5 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use deno_core::op2; -use deno_core::OpState; -use deno_core::ResourceId; use std::ffi::c_void; #[cfg(any( target_os = "linux", @@ -12,6 +9,10 @@ use std::ffi::c_void; ))] use std::ptr::NonNull; +use deno_core::op2; +use deno_core::OpState; +use deno_core::ResourceId; + use crate::surface::WebGpuSurface; #[derive(Debug, thiserror::Error)] diff --git a/ext/webgpu/command_encoder.rs b/ext/webgpu/command_encoder.rs index 4bee7aac30..4b14345a2c 100644 --- a/ext/webgpu/command_encoder.rs +++ b/ext/webgpu/command_encoder.rs @@ -1,17 +1,18 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::rc::Rc; -use crate::WebGpuQuerySet; use deno_core::error::AnyError; use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; use serde::Deserialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::rc::Rc; use super::error::WebGpuResult; +use crate::WebGpuQuerySet; pub(crate) struct WebGpuCommandEncoder( pub(crate) super::Instance, diff --git a/ext/webgpu/compute_pass.rs b/ext/webgpu/compute_pass.rs index 17043c7671..22cd522d8a 100644 --- a/ext/webgpu/compute_pass.rs +++ b/ext/webgpu/compute_pass.rs @@ -1,12 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; use deno_core::error::AnyError; use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; -use std::borrow::Cow; -use std::cell::RefCell; use super::error::WebGpuResult; diff --git a/ext/webgpu/error.rs b/ext/webgpu/error.rs index f08f765386..f022a56916 100644 --- a/ext/webgpu/error.rs +++ b/ext/webgpu/error.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::convert::From; +use std::error::Error; use deno_core::ResourceId; use serde::Serialize; -use std::convert::From; -use std::error::Error; use wgpu_core::binding_model::CreateBindGroupError; use wgpu_core::binding_model::CreateBindGroupLayoutError; use wgpu_core::binding_model::CreatePipelineLayoutError; diff --git a/ext/webgpu/lib.rs b/ext/webgpu/lib.rs index 5dc8278e41..bdf0f39b63 100644 --- a/ext/webgpu/lib.rs +++ b/ext/webgpu/lib.rs @@ -1,22 +1,22 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![cfg(not(target_arch = "wasm32"))] #![warn(unsafe_op_in_unsafe_fn)] +use std::borrow::Cow; +use std::cell::RefCell; +use std::collections::HashSet; +use std::rc::Rc; + use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; +use error::WebGpuResult; use serde::Deserialize; use serde::Serialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::collections::HashSet; -use std::rc::Rc; pub use wgpu_core; pub use wgpu_types; -use error::WebGpuResult; - pub const UNSTABLE_FEATURE_NAME: &str = "webgpu"; #[macro_use] diff --git a/ext/webgpu/pipeline.rs b/ext/webgpu/pipeline.rs index a6b0cb8cec..87b1610ad7 100644 --- a/ext/webgpu/pipeline.rs +++ b/ext/webgpu/pipeline.rs @@ -1,4 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::collections::HashMap; +use std::rc::Rc; use deno_core::error::AnyError; use deno_core::op2; @@ -7,9 +11,6 @@ use deno_core::Resource; use deno_core::ResourceId; use serde::Deserialize; use serde::Serialize; -use std::borrow::Cow; -use std::collections::HashMap; -use std::rc::Rc; use super::error::WebGpuError; use super::error::WebGpuResult; diff --git a/ext/webgpu/queue.rs b/ext/webgpu/queue.rs index 8c8bbec95e..4f367f5469 100644 --- a/ext/webgpu/queue.rs +++ b/ext/webgpu/queue.rs @@ -1,17 +1,18 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::rc::Rc; -use crate::command_encoder::WebGpuCommandBuffer; -use crate::Instance; use deno_core::error::AnyError; use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; use serde::Deserialize; -use std::borrow::Cow; -use std::rc::Rc; use super::error::WebGpuResult; +use crate::command_encoder::WebGpuCommandBuffer; +use crate::Instance; pub struct WebGpuQueue(pub Instance, pub wgpu_core::id::QueueId); impl Resource for WebGpuQueue { diff --git a/ext/webgpu/render_pass.rs b/ext/webgpu/render_pass.rs index 9b9d87d9fc..41d610c0f9 100644 --- a/ext/webgpu/render_pass.rs +++ b/ext/webgpu/render_pass.rs @@ -1,12 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; use serde::Deserialize; -use std::borrow::Cow; -use std::cell::RefCell; use super::error::WebGpuResult; diff --git a/ext/webgpu/sampler.rs b/ext/webgpu/sampler.rs index 9fc1269ea7..e4f73e93ac 100644 --- a/ext/webgpu/sampler.rs +++ b/ext/webgpu/sampler.rs @@ -1,12 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::rc::Rc; use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; use serde::Deserialize; -use std::borrow::Cow; -use std::rc::Rc; use super::error::WebGpuResult; diff --git a/ext/webgpu/shader.rs b/ext/webgpu/shader.rs index 4653bd85bf..f57e24fa26 100644 --- a/ext/webgpu/shader.rs +++ b/ext/webgpu/shader.rs @@ -1,11 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::rc::Rc; use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; -use std::borrow::Cow; -use std::rc::Rc; use super::error::WebGpuResult; diff --git a/ext/webgpu/surface.rs b/ext/webgpu/surface.rs index 297eaeb008..e23c5f182b 100644 --- a/ext/webgpu/surface.rs +++ b/ext/webgpu/surface.rs @@ -1,15 +1,17 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::rc::Rc; -use super::WebGpuResult; use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; use serde::Deserialize; -use std::borrow::Cow; -use std::rc::Rc; use wgpu_types::SurfaceStatus; +use super::WebGpuResult; + #[derive(Debug, thiserror::Error)] pub enum SurfaceError { #[error(transparent)] diff --git a/ext/webgpu/texture.rs b/ext/webgpu/texture.rs index f8a5e05a3e..a354567de8 100644 --- a/ext/webgpu/texture.rs +++ b/ext/webgpu/texture.rs @@ -1,12 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::rc::Rc; use deno_core::op2; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; use serde::Deserialize; -use std::borrow::Cow; -use std::rc::Rc; use super::error::WebGpuResult; pub(crate) struct WebGpuTexture { diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js index eb18cbcc3e..b3c3b299f0 100644 --- a/ext/webidl/00_webidl.js +++ b/ext/webidl/00_webidl.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Adapted from https://github.com/jsdom/webidl-conversions. // Copyright Domenic Denicola. Licensed under BSD-2-Clause License. diff --git a/ext/webidl/Cargo.toml b/ext/webidl/Cargo.toml index 60cb9f29f8..ab285c7204 100644 --- a/ext/webidl/Cargo.toml +++ b/ext/webidl/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_webidl" diff --git a/ext/webidl/benches/dict.js b/ext/webidl/benches/dict.js index 9e7367d62c..8aedc51235 100644 --- a/ext/webidl/benches/dict.js +++ b/ext/webidl/benches/dict.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file diff --git a/ext/webidl/benches/dict.rs b/ext/webidl/benches/dict.rs index cfb658fa84..aea491cf12 100644 --- a/ext/webidl/benches/dict.rs +++ b/ext/webidl/benches/dict.rs @@ -1,10 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_bench_util::bench_js_sync; use deno_bench_util::bench_or_profile; use deno_bench_util::bencher::benchmark_group; use deno_bench_util::bencher::Bencher; - use deno_core::Extension; fn setup() -> Vec { diff --git a/ext/webidl/internal.d.ts b/ext/webidl/internal.d.ts index 375d548d32..a884d982aa 100644 --- a/ext/webidl/internal.d.ts +++ b/ext/webidl/internal.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any /// diff --git a/ext/webidl/lib.rs b/ext/webidl/lib.rs index 51dbed33a5..7a3608def4 100644 --- a/ext/webidl/lib.rs +++ b/ext/webidl/lib.rs @@ -1,3 +1,3 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. deno_core::extension!(deno_webidl, esm = ["00_webidl.js"],); diff --git a/ext/websocket/01_websocket.js b/ext/websocket/01_websocket.js index 78572f5f00..e0db51f4be 100644 --- a/ext/websocket/01_websocket.js +++ b/ext/websocket/01_websocket.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// diff --git a/ext/websocket/02_websocketstream.js b/ext/websocket/02_websocketstream.js index 838ae3d4ce..a1b76fb6c0 100644 --- a/ext/websocket/02_websocketstream.js +++ b/ext/websocket/02_websocketstream.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// diff --git a/ext/websocket/Cargo.toml b/ext/websocket/Cargo.toml index 8b8359f074..a1f1c98ba1 100644 --- a/ext/websocket/Cargo.toml +++ b/ext/websocket/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_websocket" diff --git a/ext/websocket/autobahn/autobahn_server.js b/ext/websocket/autobahn/autobahn_server.js index 7400c8d547..1c0d4bbaf6 100644 --- a/ext/websocket/autobahn/autobahn_server.js +++ b/ext/websocket/autobahn/autobahn_server.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { parseArgs } from "@std/cli/parse-args"; const { port } = parseArgs(Deno.args, { diff --git a/ext/websocket/autobahn/fuzzingclient.js b/ext/websocket/autobahn/fuzzingclient.js index fed0fd6aa9..8602319650 100644 --- a/ext/websocket/autobahn/fuzzingclient.js +++ b/ext/websocket/autobahn/fuzzingclient.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file diff --git a/ext/websocket/lib.deno_websocket.d.ts b/ext/websocket/lib.deno_websocket.d.ts index fb7ea6070c..28cf8b8ab3 100644 --- a/ext/websocket/lib.deno_websocket.d.ts +++ b/ext/websocket/lib.deno_websocket.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any no-var diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs index 5aef1a7a55..5819906da6 100644 --- a/ext/websocket/lib.rs +++ b/ext/websocket/lib.rs @@ -1,5 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::stream::WebSocketStream; +// Copyright 2018-2025 the Deno authors. MIT license. +use std::borrow::Cow; +use std::cell::Cell; +use std::cell::RefCell; +use std::future::Future; +use std::num::NonZeroUsize; +use std::path::PathBuf; +use std::rc::Rc; +use std::sync::Arc; + use bytes::Bytes; use deno_core::futures::TryFutureExt; use deno_core::op2; @@ -17,12 +25,20 @@ use deno_core::Resource; use deno_core::ResourceId; use deno_core::ToJsBuffer; use deno_net::raw::NetworkStream; +use deno_permissions::PermissionCheckError; use deno_tls::create_client_config; use deno_tls::rustls::ClientConfig; use deno_tls::rustls::ClientConnection; use deno_tls::RootCertStoreProvider; use deno_tls::SocketUse; use deno_tls::TlsKeys; +use fastwebsockets::CloseCode; +use fastwebsockets::FragmentCollectorRead; +use fastwebsockets::Frame; +use fastwebsockets::OpCode; +use fastwebsockets::Role; +use fastwebsockets::WebSocket; +use fastwebsockets::WebSocketWrite; use http::header::CONNECTION; use http::header::UPGRADE; use http::HeaderName; @@ -36,28 +52,13 @@ use rustls_tokio_stream::rustls::pki_types::ServerName; use rustls_tokio_stream::rustls::RootCertStore; use rustls_tokio_stream::TlsStream; use serde::Serialize; -use std::borrow::Cow; -use std::cell::Cell; -use std::cell::RefCell; -use std::future::Future; -use std::num::NonZeroUsize; -use std::path::PathBuf; -use std::rc::Rc; -use std::sync::Arc; use tokio::io::AsyncRead; use tokio::io::AsyncWrite; use tokio::io::ReadHalf; use tokio::io::WriteHalf; use tokio::net::TcpStream; -use deno_permissions::PermissionCheckError; -use fastwebsockets::CloseCode; -use fastwebsockets::FragmentCollectorRead; -use fastwebsockets::Frame; -use fastwebsockets::OpCode; -use fastwebsockets::Role; -use fastwebsockets::WebSocket; -use fastwebsockets::WebSocketWrite; +use crate::stream::WebSocketStream; mod stream; diff --git a/ext/websocket/stream.rs b/ext/websocket/stream.rs index 2cd2622175..c2ac4ee5d8 100644 --- a/ext/websocket/stream.rs +++ b/ext/websocket/stream.rs @@ -1,4 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::io::ErrorKind; +use std::pin::Pin; +use std::task::ready; +use std::task::Poll; + use bytes::Buf; use bytes::Bytes; use deno_net::raw::NetworkStream; @@ -6,10 +11,6 @@ use h2::RecvStream; use h2::SendStream; use hyper::upgrade::Upgraded; use hyper_util::rt::TokioIo; -use std::io::ErrorKind; -use std::pin::Pin; -use std::task::ready; -use std::task::Poll; use tokio::io::AsyncRead; use tokio::io::AsyncWrite; use tokio::io::ReadBuf; diff --git a/ext/webstorage/01_webstorage.js b/ext/webstorage/01_webstorage.js index 12abea8387..7adf190782 100644 --- a/ext/webstorage/01_webstorage.js +++ b/ext/webstorage/01_webstorage.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// diff --git a/ext/webstorage/Cargo.toml b/ext/webstorage/Cargo.toml index 4f9795d098..2cae0d8e01 100644 --- a/ext/webstorage/Cargo.toml +++ b/ext/webstorage/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_webstorage" diff --git a/ext/webstorage/lib.deno_webstorage.d.ts b/ext/webstorage/lib.deno_webstorage.d.ts index fa6d403dea..5f5aafa1b8 100644 --- a/ext/webstorage/lib.deno_webstorage.d.ts +++ b/ext/webstorage/lib.deno_webstorage.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any no-var diff --git a/ext/webstorage/lib.rs b/ext/webstorage/lib.rs index c3e4c46596..ca6b43a827 100644 --- a/ext/webstorage/lib.rs +++ b/ext/webstorage/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // NOTE to all: use **cached** prepared statements when interfacing with SQLite. @@ -7,12 +7,11 @@ use std::path::PathBuf; use deno_core::op2; use deno_core::GarbageCollected; use deno_core::OpState; +pub use rusqlite; use rusqlite::params; use rusqlite::Connection; use rusqlite::OptionalExtension; -pub use rusqlite; - #[derive(Debug, thiserror::Error)] pub enum WebStorageError { #[error("LocalStorage is not supported in this context.")] diff --git a/resolvers/deno/Cargo.toml b/resolvers/deno/Cargo.toml index 12c18d4452..71e75d5a1d 100644 --- a/resolvers/deno/Cargo.toml +++ b/resolvers/deno/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_resolver" diff --git a/resolvers/deno/cjs.rs b/resolvers/deno/cjs.rs index 2ec253d41a..bae645b481 100644 --- a/resolvers/deno/cjs.rs +++ b/resolvers/deno/cjs.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_media_type::MediaType; use node_resolver::errors::ClosestPkgJsonError; diff --git a/resolvers/deno/lib.rs b/resolvers/deno/lib.rs index c943aacdae..ab01f397fb 100644 --- a/resolvers/deno/lib.rs +++ b/resolvers/deno/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![deny(clippy::print_stderr)] #![deny(clippy::print_stdout)] diff --git a/resolvers/deno/npm/byonm.rs b/resolvers/deno/npm/byonm.rs index 3056a70f61..3ceec368ad 100644 --- a/resolvers/deno/npm/byonm.rs +++ b/resolvers/deno/npm/byonm.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::path::Path; diff --git a/resolvers/deno/npm/local.rs b/resolvers/deno/npm/local.rs index aef476ad94..6322a4b3f7 100644 --- a/resolvers/deno/npm/local.rs +++ b/resolvers/deno/npm/local.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; diff --git a/resolvers/deno/npm/mod.rs b/resolvers/deno/npm/mod.rs index 082940eb34..1501c05941 100644 --- a/resolvers/deno/npm/mod.rs +++ b/resolvers/deno/npm/mod.rs @@ -1,11 +1,17 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::fmt::Debug; use std::path::PathBuf; use boxed_error::Boxed; +pub use byonm::ByonmInNpmPackageChecker; +pub use byonm::ByonmNpmResolver; +pub use byonm::ByonmNpmResolverCreateOptions; +pub use byonm::ByonmNpmResolverRc; +pub use byonm::ByonmResolvePkgFolderFromDenoReqError; use deno_semver::npm::NpmPackageReqReference; use deno_semver::package::PackageReq; +pub use local::normalize_pkg_name_for_node_modules_deno_folder; use node_resolver::errors::NodeResolveError; use node_resolver::errors::NodeResolveErrorKind; use node_resolver::errors::PackageFolderResolveErrorKind; @@ -26,13 +32,6 @@ use sys_traits::FsReadDir; use thiserror::Error; use url::Url; -pub use byonm::ByonmInNpmPackageChecker; -pub use byonm::ByonmNpmResolver; -pub use byonm::ByonmNpmResolverCreateOptions; -pub use byonm::ByonmNpmResolverRc; -pub use byonm::ByonmResolvePkgFolderFromDenoReqError; -pub use local::normalize_pkg_name_for_node_modules_deno_folder; - mod byonm; mod local; diff --git a/resolvers/deno/sloppy_imports.rs b/resolvers/deno/sloppy_imports.rs index 6644222a8b..b6fbf487dd 100644 --- a/resolvers/deno/sloppy_imports.rs +++ b/resolvers/deno/sloppy_imports.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::path::Path; diff --git a/resolvers/deno/sync.rs b/resolvers/deno/sync.rs index ebcf8509d5..43635e62b7 100644 --- a/resolvers/deno/sync.rs +++ b/resolvers/deno/sync.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub use inner::*; diff --git a/resolvers/node/Cargo.toml b/resolvers/node/Cargo.toml index 1e35c0a355..bdb0ba2ab1 100644 --- a/resolvers/node/Cargo.toml +++ b/resolvers/node/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "node_resolver" diff --git a/resolvers/node/analyze.rs b/resolvers/node/analyze.rs index 2024e6a1e8..a6ba3927aa 100644 --- a/resolvers/node/analyze.rs +++ b/resolvers/node/analyze.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::collections::BTreeSet; @@ -6,6 +6,8 @@ use std::collections::HashSet; use std::path::Path; use std::path::PathBuf; +use anyhow::Context; +use anyhow::Error as AnyError; use deno_path_util::url_from_file_path; use deno_path_util::url_to_file_path; use futures::future::LocalBoxFuture; @@ -13,9 +15,6 @@ use futures::stream::FuturesUnordered; use futures::FutureExt; use futures::StreamExt; use once_cell::sync::Lazy; - -use anyhow::Context; -use anyhow::Error as AnyError; use sys_traits::FsCanonicalize; use sys_traits::FsMetadata; use sys_traits::FsRead; diff --git a/resolvers/node/errors.rs b/resolvers/node/errors.rs index 26b1a1d84a..4157bd4c85 100644 --- a/resolvers/node/errors.rs +++ b/resolvers/node/errors.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::fmt::Write; diff --git a/resolvers/node/lib.rs b/resolvers/node/lib.rs index 075f819ebb..7d8c98eafc 100644 --- a/resolvers/node/lib.rs +++ b/resolvers/node/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![deny(clippy::print_stderr)] #![deny(clippy::print_stdout)] diff --git a/resolvers/node/npm.rs b/resolvers/node/npm.rs index ab3a179426..f799d6ddee 100644 --- a/resolvers/node/npm.rs +++ b/resolvers/node/npm.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::path::Path; use std::path::PathBuf; diff --git a/resolvers/node/package_json.rs b/resolvers/node/package_json.rs index ebbe099014..2e1d5110bd 100644 --- a/resolvers/node/package_json.rs +++ b/resolvers/node/package_json.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::collections::HashMap; diff --git a/resolvers/node/path.rs b/resolvers/node/path.rs index 8c2d35fadf..525aeb36ef 100644 --- a/resolvers/node/path.rs +++ b/resolvers/node/path.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::path::Component; use std::path::Path; diff --git a/resolvers/node/resolution.rs b/resolvers/node/resolution.rs index 95631daf39..d0b52213f3 100644 --- a/resolvers/node/resolution.rs +++ b/resolvers/node/resolution.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::path::Path; @@ -6,6 +6,7 @@ use std::path::PathBuf; use anyhow::bail; use anyhow::Error as AnyError; +use deno_package_json::PackageJson; use deno_path_util::url_from_file_path; use serde_json::Map; use serde_json::Value; @@ -48,7 +49,6 @@ use crate::npm::InNpmPackageCheckerRc; use crate::NpmPackageFolderResolverRc; use crate::PackageJsonResolverRc; use crate::PathClean; -use deno_package_json::PackageJson; pub static DEFAULT_CONDITIONS: &[&str] = &["deno", "node", "import"]; pub static REQUIRE_CONDITIONS: &[&str] = &["require", "node"]; diff --git a/resolvers/node/sync.rs b/resolvers/node/sync.rs index 3c4729aa2c..8cf06932ac 100644 --- a/resolvers/node/sync.rs +++ b/resolvers/node/sync.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub use inner::*; @@ -6,10 +6,9 @@ pub use inner::*; mod inner { #![allow(clippy::disallowed_types)] - pub use std::sync::Arc as MaybeArc; - pub use core::marker::Send as MaybeSend; pub use core::marker::Sync as MaybeSync; + pub use std::sync::Arc as MaybeArc; } #[cfg(not(feature = "sync"))] diff --git a/resolvers/npm_cache/Cargo.toml b/resolvers/npm_cache/Cargo.toml index 48d0a32437..328355d340 100644 --- a/resolvers/npm_cache/Cargo.toml +++ b/resolvers/npm_cache/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_npm_cache" diff --git a/resolvers/npm_cache/fs_util.rs b/resolvers/npm_cache/fs_util.rs index ed123f085c..625d83e24d 100644 --- a/resolvers/npm_cache/fs_util.rs +++ b/resolvers/npm_cache/fs_util.rs @@ -1,10 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use anyhow::Context; -use anyhow::Error as AnyError; use std::io::ErrorKind; use std::path::Path; use std::time::Duration; + +use anyhow::Context; +use anyhow::Error as AnyError; use sys_traits::FsCreateDirAll; use sys_traits::FsDirEntry; use sys_traits::FsHardLink; diff --git a/resolvers/npm_cache/lib.rs b/resolvers/npm_cache/lib.rs index e681fa71ac..012c277e22 100644 --- a/resolvers/npm_cache/lib.rs +++ b/resolvers/npm_cache/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashSet; use std::io::ErrorKind; @@ -40,13 +40,12 @@ mod tarball; mod tarball_extract; pub use fs_util::hard_link_dir_recursive; -pub use registry_info::RegistryInfoProvider; -pub use tarball::TarballCache; - // todo(#27198): make both of these private and get the rest of the code // using RegistryInfoProvider. pub use registry_info::get_package_url; +pub use registry_info::RegistryInfoProvider; pub use remote::maybe_auth_header_for_npm_registry; +pub use tarball::TarballCache; #[derive(Debug)] pub struct DownloadError { diff --git a/resolvers/npm_cache/registry_info.rs b/resolvers/npm_cache/registry_info.rs index 57e188200d..0637d75c19 100644 --- a/resolvers/npm_cache/registry_info.rs +++ b/resolvers/npm_cache/registry_info.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::collections::HashSet; diff --git a/resolvers/npm_cache/remote.rs b/resolvers/npm_cache/remote.rs index 538554612f..16eb0f6cd9 100644 --- a/resolvers/npm_cache/remote.rs +++ b/resolvers/npm_cache/remote.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use anyhow::bail; use anyhow::Context; diff --git a/resolvers/npm_cache/tarball.rs b/resolvers/npm_cache/tarball.rs index 3a7e9df8a9..49ca3bc7fd 100644 --- a/resolvers/npm_cache/tarball.rs +++ b/resolvers/npm_cache/tarball.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::sync::Arc; diff --git a/resolvers/npm_cache/tarball_extract.rs b/resolvers/npm_cache/tarball_extract.rs index affe93eaa4..cf408ac632 100644 --- a/resolvers/npm_cache/tarball_extract.rs +++ b/resolvers/npm_cache/tarball_extract.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::collections::HashSet; diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 4612e87887..9826a7459d 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_runtime" @@ -122,6 +122,7 @@ same-file = "1.0.6" serde.workspace = true signal-hook = "0.3.17" signal-hook-registry = "1.4.0" +sys_traits.workspace = true tempfile.workspace = true thiserror.workspace = true tokio.workspace = true diff --git a/runtime/code_cache.rs b/runtime/code_cache.rs index b4a7ce188f..b7ee8a9ed6 100644 --- a/runtime/code_cache.rs +++ b/runtime/code_cache.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::ModuleSpecifier; diff --git a/runtime/errors.rs b/runtime/errors.rs index 3f8e900851..7b61395866 100644 --- a/runtime/errors.rs +++ b/runtime/errors.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! There are many types of errors in Deno: //! - AnyError: a generic wrapper that can encapsulate any type of error. @@ -9,16 +9,11 @@ //! Diagnostics are compile-time type errors, whereas JsErrors are runtime //! exceptions. -use crate::ops::fs_events::FsEventsError; -use crate::ops::http::HttpStartError; -use crate::ops::os::OsError; -use crate::ops::permissions::PermissionError; -use crate::ops::process::CheckRunPermissionError; -use crate::ops::process::ProcessError; -use crate::ops::signal::SignalError; -use crate::ops::tty::TtyError; -use crate::ops::web_worker::SyncFetchError; -use crate::ops::worker_host::CreateWorkerError; +use std::env; +use std::error::Error; +use std::io; +use std::sync::Arc; + use deno_broadcast_channel::BroadcastChannelError; use deno_cache::CacheError; use deno_canvas::CanvasError; @@ -68,10 +63,17 @@ use deno_websocket::HandshakeError; use deno_websocket::WebsocketError; use deno_webstorage::WebStorageError; use rustyline::error::ReadlineError; -use std::env; -use std::error::Error; -use std::io; -use std::sync::Arc; + +use crate::ops::fs_events::FsEventsError; +use crate::ops::http::HttpStartError; +use crate::ops::os::OsError; +use crate::ops::permissions::PermissionError; +use crate::ops::process::CheckRunPermissionError; +use crate::ops::process::ProcessError; +use crate::ops::signal::SignalError; +use crate::ops::tty::TtyError; +use crate::ops::web_worker::SyncFetchError; +use crate::ops::worker_host::CreateWorkerError; fn get_run_descriptor_parse_error(e: &RunDescriptorParseError) -> &'static str { match e { @@ -1047,11 +1049,6 @@ fn get_fs_error(e: &FsError) -> &'static str { } mod node { - use super::get_error_class_name; - use super::get_io_error_class; - use super::get_permission_check_error_class; - use super::get_serde_json_error_class; - use super::get_url_parse_error_class; pub use deno_node::ops::blocklist::BlocklistError; pub use deno_node::ops::crypto::cipher::CipherContextError; pub use deno_node::ops::crypto::cipher::CipherError; @@ -1096,6 +1093,12 @@ mod node { pub use deno_node::ops::zlib::mode::ModeError; pub use deno_node::ops::zlib::ZlibError; + use super::get_error_class_name; + use super::get_io_error_class; + use super::get_permission_check_error_class; + use super::get_serde_json_error_class; + use super::get_url_parse_error_class; + pub fn get_blocklist_error(error: &BlocklistError) -> &'static str { match error { BlocklistError::AddrParse(_) => "Error", @@ -1157,7 +1160,7 @@ mod node { WorkerThreadsFilenameError::UrlToPathString => "Error", WorkerThreadsFilenameError::UrlToPath => "Error", WorkerThreadsFilenameError::FileNotFound(_) => "Error", - WorkerThreadsFilenameError::Fs(e) => super::get_fs_error(e), + WorkerThreadsFilenameError::Fs(e) => super::get_io_error_class(e), } } @@ -1173,7 +1176,7 @@ mod node { | UrlConversion(_) | ReadModule(_) | PackageImportsResolve(_) => "Error", - Fs(e) | UnableToGetCwd(e) => super::get_fs_error(e), + Fs(e) | UnableToGetCwd(e) => super::get_io_error_class(e), } } diff --git a/runtime/examples/extension/bootstrap.js b/runtime/examples/extension/bootstrap.js index 9461acb84a..78e0cb999f 100644 --- a/runtime/examples/extension/bootstrap.js +++ b/runtime/examples/extension/bootstrap.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { op_hello } from "ext:core/ops"; function hello() { op_hello("world"); diff --git a/runtime/examples/extension/main.js b/runtime/examples/extension/main.js index 4d6e4e3b7d..4a66aecf58 100644 --- a/runtime/examples/extension/main.js +++ b/runtime/examples/extension/main.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. console.log("Hello world from JS!"); console.log(Deno.build); Extension.hello(); diff --git a/runtime/examples/extension/main.rs b/runtime/examples/extension/main.rs index 1ff16ec83f..9f0eb63b01 100644 --- a/runtime/examples/extension/main.rs +++ b/runtime/examples/extension/main.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(clippy::print_stdout)] #![allow(clippy::print_stderr)] @@ -37,11 +37,12 @@ async fn main() -> Result<(), AnyError> { let main_module = ModuleSpecifier::from_file_path(js_path).unwrap(); eprintln!("Running {main_module}..."); let fs = Arc::new(RealFs); - let permission_desc_parser = - Arc::new(RuntimePermissionDescriptorParser::new(fs.clone())); + let permission_desc_parser = Arc::new( + RuntimePermissionDescriptorParser::new(sys_traits::impls::RealSys), + ); let mut worker = MainWorker::bootstrap_from_options( main_module.clone(), - WorkerServiceOptions { + WorkerServiceOptions:: { module_loader: Rc::new(FsModuleLoader), permissions: PermissionsContainer::allow_all(permission_desc_parser), blob_store: Default::default(), diff --git a/runtime/fmt_errors.rs b/runtime/fmt_errors.rs index 3c60c3a3d7..1a2bc5dfd3 100644 --- a/runtime/fmt_errors.rs +++ b/runtime/fmt_errors.rs @@ -1,11 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! This mod provides DenoError to unify errors across Deno. +use std::fmt::Write as _; + use color_print::cformat; use color_print::cstr; use deno_core::error::format_frame; use deno_core::error::JsError; use deno_terminal::colors; -use std::fmt::Write as _; #[derive(Debug, Clone)] struct ErrorReference<'a> { @@ -490,9 +491,10 @@ pub fn format_js_error(js_error: &JsError) -> String { #[cfg(test)] mod tests { - use super::*; use test_util::strip_ansi_codes; + use super::*; + #[test] fn test_format_none_source_line() { let actual = format_maybe_source_line(None, None, false, 0); diff --git a/runtime/fs_util.rs b/runtime/fs_util.rs index a858e9770d..7788a97170 100644 --- a/runtime/fs_util.rs +++ b/runtime/fs_util.rs @@ -1,10 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::path::Path; +use std::path::PathBuf; use deno_core::anyhow::Context; use deno_core::error::AnyError; use deno_path_util::normalize_path; -use std::path::Path; -use std::path::PathBuf; #[inline] pub fn resolve_from_cwd(path: &Path) -> Result { diff --git a/runtime/inspector_server.rs b/runtime/inspector_server.rs index a789dd3dca..75e9668db4 100644 --- a/runtime/inspector_server.rs +++ b/runtime/inspector_server.rs @@ -1,7 +1,15 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Alias for the future `!` type. use core::convert::Infallible as Never; +use std::cell::RefCell; +use std::collections::HashMap; +use std::net::SocketAddr; +use std::pin::pin; +use std::process; +use std::rc::Rc; +use std::thread; + use deno_core::anyhow::Context; use deno_core::error::AnyError; use deno_core::futures::channel::mpsc; @@ -28,13 +36,6 @@ use fastwebsockets::OpCode; use fastwebsockets::WebSocket; use hyper::body::Bytes; use hyper_util::rt::TokioIo; -use std::cell::RefCell; -use std::collections::HashMap; -use std::net::SocketAddr; -use std::pin::pin; -use std::process; -use std::rc::Rc; -use std::thread; use tokio::net::TcpListener; use tokio::sync::broadcast; use uuid::Uuid; diff --git a/runtime/js.rs b/runtime/js.rs index a8384ceacf..55ab75b66b 100644 --- a/runtime/js.rs +++ b/runtime/js.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #[cfg(not(feature = "include_js_files_for_snapshotting"))] pub static SOURCE_CODE_FOR_99_MAIN_JS: &str = include_str!("js/99_main.js"); diff --git a/runtime/js/01_errors.js b/runtime/js/01_errors.js index ea567a5d08..09fd82e867 100644 --- a/runtime/js/01_errors.js +++ b/runtime/js/01_errors.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; const { BadResource, Interrupted, NotCapable } = core; diff --git a/runtime/js/01_version.ts b/runtime/js/01_version.ts index 33a8f50cdd..779a886897 100644 --- a/runtime/js/01_version.ts +++ b/runtime/js/01_version.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; const { diff --git a/runtime/js/06_util.js b/runtime/js/06_util.js index bf71c371b9..658cfa69aa 100644 --- a/runtime/js/06_util.js +++ b/runtime/js/06_util.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; import { op_bootstrap_log_level } from "ext:core/ops"; diff --git a/runtime/js/10_permissions.js b/runtime/js/10_permissions.js index 831b6bf2ae..c835cc1c5a 100644 --- a/runtime/js/10_permissions.js +++ b/runtime/js/10_permissions.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; import { diff --git a/runtime/js/11_workers.js b/runtime/js/11_workers.js index 3853761920..fd36866936 100644 --- a/runtime/js/11_workers.js +++ b/runtime/js/11_workers.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { diff --git a/runtime/js/30_os.js b/runtime/js/30_os.js index f3dfda886d..166b983f45 100644 --- a/runtime/js/30_os.js +++ b/runtime/js/30_os.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { primordials } from "ext:core/mod.js"; import { diff --git a/runtime/js/40_fs_events.js b/runtime/js/40_fs_events.js index 322ee6b3ca..25f397b840 100644 --- a/runtime/js/40_fs_events.js +++ b/runtime/js/40_fs_events.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { op_fs_events_open, op_fs_events_poll } from "ext:core/ops"; diff --git a/runtime/js/40_process.js b/runtime/js/40_process.js index e2cb1d95b2..fde97fac64 100644 --- a/runtime/js/40_process.js +++ b/runtime/js/40_process.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, internals, primordials } from "ext:core/mod.js"; import { diff --git a/runtime/js/40_signals.js b/runtime/js/40_signals.js index 41f25af677..161adfabbc 100644 --- a/runtime/js/40_signals.js +++ b/runtime/js/40_signals.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { op_signal_bind, op_signal_poll, op_signal_unbind } from "ext:core/ops"; diff --git a/runtime/js/40_tty.js b/runtime/js/40_tty.js index 72e7b68846..56f8721eaf 100644 --- a/runtime/js/40_tty.js +++ b/runtime/js/40_tty.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { op_console_size } from "ext:core/ops"; const { diff --git a/runtime/js/41_prompt.js b/runtime/js/41_prompt.js index 8460862d2e..e300f69a3c 100644 --- a/runtime/js/41_prompt.js +++ b/runtime/js/41_prompt.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { op_read_line_prompt } from "ext:core/ops"; const { diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index 5511649279..e13a8d1307 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core } from "ext:core/mod.js"; import { diff --git a/runtime/js/98_global_scope_shared.js b/runtime/js/98_global_scope_shared.js index c01bde6fad..99bace7647 100644 --- a/runtime/js/98_global_scope_shared.js +++ b/runtime/js/98_global_scope_shared.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core } from "ext:core/mod.js"; diff --git a/runtime/js/98_global_scope_window.js b/runtime/js/98_global_scope_window.js index 098422f56f..c42a940a82 100644 --- a/runtime/js/98_global_scope_window.js +++ b/runtime/js/98_global_scope_window.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { diff --git a/runtime/js/98_global_scope_worker.js b/runtime/js/98_global_scope_worker.js index 4dc6157867..f10bb2830d 100644 --- a/runtime/js/98_global_scope_worker.js +++ b/runtime/js/98_global_scope_worker.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { core, primordials } from "ext:core/mod.js"; import { diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index a11444bc36..03c662bcab 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Remove Intl.v8BreakIterator because it is a non-standard API. delete Intl.v8BreakIterator; diff --git a/runtime/lib.rs b/runtime/lib.rs index 1f449dc69a..3e48ec89c0 100644 --- a/runtime/lib.rs +++ b/runtime/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub use deno_broadcast_channel; pub use deno_cache; diff --git a/runtime/ops/bootstrap.rs b/runtime/ops/bootstrap.rs index bbbddc61ba..b362217d2c 100644 --- a/runtime/ops/bootstrap.rs +++ b/runtime/ops/bootstrap.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::op2; use deno_core::OpState; diff --git a/runtime/ops/fs_events.rs b/runtime/ops/fs_events.rs index f6e5ceff5c..e8fb9f2cef 100644 --- a/runtime/ops/fs_events.rs +++ b/runtime/ops/fs_events.rs @@ -1,5 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::borrow::Cow; +use std::cell::RefCell; +use std::convert::From; +use std::path::Path; +use std::path::PathBuf; +use std::rc::Rc; +use std::sync::Arc; + +use deno_core::op2; use deno_core::parking_lot::Mutex; use deno_core::AsyncRefCell; use deno_core::CancelFuture; @@ -8,9 +17,6 @@ use deno_core::OpState; use deno_core::RcRef; use deno_core::Resource; use deno_core::ResourceId; - -use deno_core::op2; - use deno_permissions::PermissionsContainer; use notify::event::Event as NotifyEvent; use notify::event::ModifyKind; @@ -20,13 +26,6 @@ use notify::RecommendedWatcher; use notify::RecursiveMode; use notify::Watcher; use serde::Serialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::convert::From; -use std::path::Path; -use std::path::PathBuf; -use std::rc::Rc; -use std::sync::Arc; use tokio::sync::mpsc; deno_core::extension!( diff --git a/runtime/ops/http.rs b/runtime/ops/http.rs index 6e31576686..c9dc16cafe 100644 --- a/runtime/ops/http.rs +++ b/runtime/ops/http.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::rc::Rc; diff --git a/runtime/ops/mod.rs b/runtime/ops/mod.rs index 67065b901b..438c3896e6 100644 --- a/runtime/ops/mod.rs +++ b/runtime/ops/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. pub mod bootstrap; pub mod fs_events; diff --git a/runtime/ops/os/mod.rs b/runtime/ops/os/mod.rs index 71169217a7..a17b467cb7 100644 --- a/runtime/ops/os/mod.rs +++ b/runtime/ops/os/mod.rs @@ -1,7 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::collections::HashMap; +use std::env; -use crate::sys_info; -use crate::worker::ExitCode; use deno_core::op2; use deno_core::v8; use deno_core::OpState; @@ -9,8 +10,9 @@ use deno_node::NODE_ENV_VAR_ALLOWLIST; use deno_path_util::normalize_path; use deno_permissions::PermissionsContainer; use serde::Serialize; -use std::collections::HashMap; -use std::env; + +use crate::sys_info; +use crate::worker::ExitCode; deno_core::extension!( deno_os, diff --git a/runtime/ops/permissions.rs b/runtime/ops/permissions.rs index b5f9e284df..216637787c 100644 --- a/runtime/ops/permissions.rs +++ b/runtime/ops/permissions.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use ::deno_permissions::PermissionState; use ::deno_permissions::PermissionsContainer; diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs index 422f229632..cda0c73111 100644 --- a/runtime/ops/process.rs +++ b/runtime/ops/process.rs @@ -1,4 +1,20 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::cell::RefCell; +use std::collections::HashMap; +use std::ffi::OsString; +use std::io::Write; +#[cfg(unix)] +use std::os::unix::prelude::ExitStatusExt; +#[cfg(unix)] +use std::os::unix::process::CommandExt; +#[cfg(windows)] +use std::os::windows::process::CommandExt; +use std::path::Path; +use std::path::PathBuf; +use std::process::ExitStatus; +use std::rc::Rc; use deno_core::op2; use deno_core::serde_json; @@ -18,25 +34,9 @@ use deno_permissions::PermissionsContainer; use deno_permissions::RunQueryDescriptor; use serde::Deserialize; use serde::Serialize; -use std::borrow::Cow; -use std::cell::RefCell; -use std::collections::HashMap; -use std::ffi::OsString; -use std::io::Write; -use std::path::Path; -use std::path::PathBuf; -use std::process::ExitStatus; -use std::rc::Rc; use tokio::process::Command; -#[cfg(windows)] -use std::os::windows::process::CommandExt; - use crate::ops::signal::SignalError; -#[cfg(unix)] -use std::os::unix::prelude::ExitStatusExt; -#[cfg(unix)] -use std::os::unix::process::CommandExt; pub const UNSTABLE_FEATURE_NAME: &str = "process"; @@ -1087,6 +1087,7 @@ mod deprecated { pub fn kill(pid: i32, signal: &str) -> Result<(), ProcessError> { use std::io::Error; use std::io::ErrorKind::NotFound; + use winapi::shared::minwindef::DWORD; use winapi::shared::minwindef::FALSE; use winapi::shared::minwindef::TRUE; diff --git a/runtime/ops/runtime.rs b/runtime/ops/runtime.rs index 8d54783fc9..e95193167d 100644 --- a/runtime/ops/runtime.rs +++ b/runtime/ops/runtime.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::op2; use deno_core::ModuleSpecifier; @@ -34,6 +34,7 @@ pub fn op_ppid() -> i64 { // - Apache License, Version 2.0 // - MIT license use std::mem; + use winapi::shared::minwindef::DWORD; use winapi::um::handleapi::CloseHandle; use winapi::um::handleapi::INVALID_HANDLE_VALUE; diff --git a/runtime/ops/signal.rs b/runtime/ops/signal.rs index ef87c37297..dfb52463cd 100644 --- a/runtime/ops/signal.rs +++ b/runtime/ops/signal.rs @@ -1,13 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use deno_core::op2; -use deno_core::AsyncRefCell; -use deno_core::CancelFuture; -use deno_core::CancelHandle; -use deno_core::OpState; -use deno_core::RcRef; -use deno_core::Resource; -use deno_core::ResourceId; - +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::cell::RefCell; #[cfg(unix)] @@ -18,6 +9,14 @@ use std::sync::atomic::AtomicBool; #[cfg(unix)] use std::sync::Arc; +use deno_core::op2; +use deno_core::AsyncRefCell; +use deno_core::CancelFuture; +use deno_core::CancelHandle; +use deno_core::OpState; +use deno_core::RcRef; +use deno_core::Resource; +use deno_core::ResourceId; #[cfg(unix)] use tokio::signal::unix::signal; #[cfg(unix)] diff --git a/runtime/ops/tty.rs b/runtime/ops/tty.rs index 7849185faa..4843acccf3 100644 --- a/runtime/ops/tty.rs +++ b/runtime/ops/tty.rs @@ -1,9 +1,23 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +#[cfg(unix)] +use std::cell::RefCell; +#[cfg(unix)] +use std::collections::HashMap; use std::io::Error; +#[cfg(windows)] +use std::sync::Arc; use deno_core::op2; +#[cfg(windows)] +use deno_core::parking_lot::Mutex; use deno_core::OpState; +#[cfg(unix)] +use deno_core::ResourceId; +#[cfg(windows)] +use deno_io::WinTtyState; +#[cfg(unix)] +use nix::sys::termios; use rustyline::config::Configurer; use rustyline::error::ReadlineError; use rustyline::Cmd; @@ -12,22 +26,6 @@ use rustyline::KeyCode; use rustyline::KeyEvent; use rustyline::Modifiers; -#[cfg(windows)] -use deno_core::parking_lot::Mutex; -#[cfg(windows)] -use deno_io::WinTtyState; -#[cfg(windows)] -use std::sync::Arc; - -#[cfg(unix)] -use deno_core::ResourceId; -#[cfg(unix)] -use nix::sys::termios; -#[cfg(unix)] -use std::cell::RefCell; -#[cfg(unix)] -use std::collections::HashMap; - #[cfg(unix)] #[derive(Default, Clone)] struct TtyModeStore( @@ -116,7 +114,6 @@ fn op_set_raw( #[cfg(windows)] { use winapi::shared::minwindef::FALSE; - use winapi::um::consoleapi; let handle = handle_or_fd; diff --git a/runtime/ops/web_worker.rs b/runtime/ops/web_worker.rs index d0c3eea668..5cde7d5373 100644 --- a/runtime/ops/web_worker.rs +++ b/runtime/ops/web_worker.rs @@ -1,19 +1,20 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. mod sync_fetch; -use crate::web_worker::WebWorkerInternalHandle; -use crate::web_worker::WebWorkerType; +use std::cell::RefCell; +use std::rc::Rc; + use deno_core::op2; use deno_core::CancelFuture; use deno_core::OpState; use deno_web::JsMessageData; use deno_web::MessagePortError; -use std::cell::RefCell; -use std::rc::Rc; +pub use sync_fetch::SyncFetchError; use self::sync_fetch::op_worker_sync_fetch; -pub use sync_fetch::SyncFetchError; +use crate::web_worker::WebWorkerInternalHandle; +use crate::web_worker::WebWorkerType; deno_core::extension!( deno_web_worker, diff --git a/runtime/ops/web_worker/sync_fetch.rs b/runtime/ops/web_worker/sync_fetch.rs index 508bcb7bb0..c9b622d31e 100644 --- a/runtime/ops/web_worker/sync_fetch.rs +++ b/runtime/ops/web_worker/sync_fetch.rs @@ -1,9 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::sync::Arc; -use crate::web_worker::WebWorkerInternalHandle; -use crate::web_worker::WebWorkerType; use deno_core::futures::StreamExt; use deno_core::op2; use deno_core::url::Url; @@ -16,6 +14,9 @@ use hyper::body::Bytes; use serde::Deserialize; use serde::Serialize; +use crate::web_worker::WebWorkerInternalHandle; +use crate::web_worker::WebWorkerType; + // TODO(andreubotella) Properly parse the MIME type fn mime_type_essence(mime_type: &str) -> String { let essence = match mime_type.split_once(';') { diff --git a/runtime/ops/worker_host.rs b/runtime/ops/worker_host.rs index 131bad1962..45285943eb 100644 --- a/runtime/ops/worker_host.rs +++ b/runtime/ops/worker_host.rs @@ -1,15 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::cell::RefCell; +use std::collections::HashMap; +use std::rc::Rc; +use std::sync::Arc; -use crate::ops::TestingFeaturesEnabled; -use crate::web_worker::run_web_worker; -use crate::web_worker::SendableWebWorkerHandle; -use crate::web_worker::WebWorker; -use crate::web_worker::WebWorkerHandle; -use crate::web_worker::WebWorkerType; -use crate::web_worker::WorkerControlEvent; -use crate::web_worker::WorkerId; -use crate::web_worker::WorkerMetadata; -use crate::worker::FormatJsErrorFn; use deno_core::op2; use deno_core::serde::Deserialize; use deno_core::CancelFuture; @@ -22,10 +17,17 @@ use deno_web::deserialize_js_transferables; use deno_web::JsMessageData; use deno_web::MessagePortError; use log::debug; -use std::cell::RefCell; -use std::collections::HashMap; -use std::rc::Rc; -use std::sync::Arc; + +use crate::ops::TestingFeaturesEnabled; +use crate::web_worker::run_web_worker; +use crate::web_worker::SendableWebWorkerHandle; +use crate::web_worker::WebWorker; +use crate::web_worker::WebWorkerHandle; +use crate::web_worker::WebWorkerType; +use crate::web_worker::WorkerControlEvent; +use crate::web_worker::WorkerId; +use crate::web_worker::WorkerMetadata; +use crate::worker::FormatJsErrorFn; pub const UNSTABLE_FEATURE_NAME: &str = "worker-options"; diff --git a/runtime/permissions.rs b/runtime/permissions.rs index e8460e03f8..8b65c6b1b0 100644 --- a/runtime/permissions.rs +++ b/runtime/permissions.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::path::Path; use std::path::PathBuf; @@ -21,13 +21,17 @@ use deno_permissions::SysDescriptorParseError; use deno_permissions::WriteDescriptor; #[derive(Debug)] -pub struct RuntimePermissionDescriptorParser { - fs: deno_fs::FileSystemRc, +pub struct RuntimePermissionDescriptorParser< + TSys: sys_traits::EnvCurrentDir + Send + Sync, +> { + sys: TSys, } -impl RuntimePermissionDescriptorParser { - pub fn new(fs: deno_fs::FileSystemRc) -> Self { - Self { fs } +impl + RuntimePermissionDescriptorParser +{ + pub fn new(sys: TSys) -> Self { + Self { sys } } fn resolve_from_cwd(&self, path: &str) -> Result { @@ -45,14 +49,15 @@ impl RuntimePermissionDescriptorParser { fn resolve_cwd(&self) -> Result { self - .fs - .cwd() - .map_err(|e| PathResolveError::CwdResolve(e.into_io_error())) + .sys + .env_current_dir() + .map_err(PathResolveError::CwdResolve) } } -impl deno_permissions::PermissionDescriptorParser - for RuntimePermissionDescriptorParser +impl + deno_permissions::PermissionDescriptorParser + for RuntimePermissionDescriptorParser { fn parse_read_descriptor( &self, @@ -151,16 +156,14 @@ impl deno_permissions::PermissionDescriptorParser #[cfg(test)] mod test { - use std::sync::Arc; - - use deno_fs::RealFs; use deno_permissions::PermissionDescriptorParser; use super::*; #[test] fn test_handle_empty_value() { - let parser = RuntimePermissionDescriptorParser::new(Arc::new(RealFs)); + let parser = + RuntimePermissionDescriptorParser::new(sys_traits::impls::RealSys); assert!(parser.parse_read_descriptor("").is_err()); assert!(parser.parse_write_descriptor("").is_err()); assert!(parser.parse_env_descriptor("").is_err()); diff --git a/runtime/permissions/Cargo.toml b/runtime/permissions/Cargo.toml index a7bd342a9c..b9259941aa 100644 --- a/runtime/permissions/Cargo.toml +++ b/runtime/permissions/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "deno_permissions" diff --git a/runtime/permissions/lib.rs b/runtime/permissions/lib.rs index 1c5fb36f93..b36668b10c 100644 --- a/runtime/permissions/lib.rs +++ b/runtime/permissions/lib.rs @@ -1,4 +1,17 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::collections::HashSet; +use std::ffi::OsStr; +use std::fmt; +use std::fmt::Debug; +use std::hash::Hash; +use std::net::IpAddr; +use std::net::Ipv6Addr; +use std::path::Path; +use std::path::PathBuf; +use std::string::ToString; +use std::sync::Arc; use capacity_builder::StringBuilder; use deno_core::parking_lot::Mutex; @@ -15,28 +28,15 @@ use deno_path_util::url_to_file_path; use deno_terminal::colors; use fqdn::FQDN; use once_cell::sync::Lazy; -use std::borrow::Cow; -use std::collections::HashSet; -use std::ffi::OsStr; -use std::fmt; -use std::fmt::Debug; -use std::hash::Hash; -use std::net::IpAddr; -use std::net::Ipv6Addr; -use std::path::Path; -use std::path::PathBuf; -use std::string::ToString; -use std::sync::Arc; pub mod prompter; use prompter::permission_prompt; -use prompter::PERMISSION_EMOJI; - pub use prompter::set_prompt_callbacks; pub use prompter::set_prompter; pub use prompter::PermissionPrompter; pub use prompter::PromptCallback; pub use prompter::PromptResponse; +use prompter::PERMISSION_EMOJI; #[derive(Debug, thiserror::Error)] pub enum PermissionDeniedError { @@ -3691,11 +3691,13 @@ pub fn is_standalone() -> bool { #[cfg(test)] mod tests { - use super::*; + use std::net::Ipv4Addr; + use deno_core::serde_json::json; use fqdn::fqdn; use prompter::tests::*; - use std::net::Ipv4Addr; + + use super::*; // Creates vector of strings, Vec macro_rules! svec { diff --git a/runtime/permissions/prompter.rs b/runtime/permissions/prompter.rs index 0272744cc2..94384427d1 100644 --- a/runtime/permissions/prompter.rs +++ b/runtime/permissions/prompter.rs @@ -1,10 +1,5 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::is_standalone; -use deno_core::error::JsStackFrame; -use deno_core::parking_lot::Mutex; -use deno_terminal::colors; -use once_cell::sync::Lazy; use std::fmt::Write; use std::io::BufRead; use std::io::IsTerminal; @@ -12,6 +7,13 @@ use std::io::StderrLock; use std::io::StdinLock; use std::io::Write as IoWrite; +use deno_core::error::JsStackFrame; +use deno_core::parking_lot::Mutex; +use deno_terminal::colors; +use once_cell::sync::Lazy; + +use crate::is_standalone; + /// Helper function to make control characters visible so users can see the underlying filename. fn escape_control_characters(s: &str) -> std::borrow::Cow { if !s.contains(|c: char| c.is_ascii_control() || c.is_control()) { @@ -489,10 +491,11 @@ impl PermissionPrompter for TtyPrompter { #[cfg(test)] pub mod tests { - use super::*; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering; + use super::*; + pub struct TestPrompter; impl PermissionPrompter for TestPrompter { diff --git a/runtime/shared.rs b/runtime/shared.rs index f7d76f67a7..1a9f2e66be 100644 --- a/runtime/shared.rs +++ b/runtime/shared.rs @@ -1,6 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Utilities shared between `build.rs` and the rest of the crate. +use std::path::Path; + use deno_ast::MediaType; use deno_ast::ParseParams; use deno_ast::SourceMapOption; @@ -10,7 +12,6 @@ use deno_core::Extension; use deno_core::ModuleCodeString; use deno_core::ModuleName; use deno_core::SourceMapData; -use std::path::Path; extension!(runtime, deps = [ diff --git a/runtime/signal.rs b/runtime/signal.rs index 0ef83d7de8..b11353b3b2 100644 --- a/runtime/signal.rs +++ b/runtime/signal.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #[cfg(target_os = "windows")] #[derive(Debug, thiserror::Error)] diff --git a/runtime/snapshot.rs b/runtime/snapshot.rs index 48c500ef74..8d008eeab0 100644 --- a/runtime/snapshot.rs +++ b/runtime/snapshot.rs @@ -1,9 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::borrow::Cow; +use std::io::Write; +use std::path::Path; +use std::path::PathBuf; +use std::rc::Rc; +use std::sync::Arc; -use crate::ops; -use crate::ops::bootstrap::SnapshotOptions; -use crate::shared::maybe_transpile_source; -use crate::shared::runtime; use deno_cache::SqliteBackedCache; use deno_core::snapshot::*; use deno_core::v8; @@ -11,12 +14,11 @@ use deno_core::Extension; use deno_http::DefaultHttpPropertyExtractor; use deno_io::fs::FsError; use deno_permissions::PermissionCheckError; -use std::borrow::Cow; -use std::io::Write; -use std::path::Path; -use std::path::PathBuf; -use std::rc::Rc; -use std::sync::Arc; + +use crate::ops; +use crate::ops::bootstrap::SnapshotOptions; +use crate::shared::maybe_transpile_source; +use crate::shared::runtime; #[derive(Clone)] struct Permissions; @@ -306,7 +308,10 @@ pub fn create_runtime_snapshot( ), deno_io::deno_io::init_ops_and_esm(Default::default()), deno_fs::deno_fs::init_ops_and_esm::(fs.clone()), - deno_node::deno_node::init_ops_and_esm::(None, fs.clone()), + deno_node::deno_node::init_ops_and_esm::< + Permissions, + sys_traits::impls::RealSys, + >(None, fs.clone()), runtime::init_ops_and_esm(), ops::runtime::deno_runtime::init_ops("deno:runtime".parse().unwrap()), ops::worker_host::deno_worker_host::init_ops( diff --git a/runtime/sys_info.rs b/runtime/sys_info.rs index 99bfcfe103..e6bd16c0f3 100644 --- a/runtime/sys_info.rs +++ b/runtime/sys_info.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #[cfg(target_family = "windows")] use std::sync::Once; @@ -159,6 +159,7 @@ pub fn hostname() -> String { use std::ffi::OsString; use std::mem; use std::os::windows::ffi::OsStringExt; + use winapi::shared::minwindef::MAKEWORD; use winapi::um::winsock2::GetHostNameW; use winapi::um::winsock2::WSAStartup; @@ -307,6 +308,7 @@ pub fn mem_info() -> Option { // - `dwLength` is set to the size of the struct. unsafe { use std::mem; + use winapi::shared::minwindef; use winapi::um::psapi::GetPerformanceInfo; use winapi::um::psapi::PERFORMANCE_INFORMATION; diff --git a/runtime/tokio_util.rs b/runtime/tokio_util.rs index aa0282ece8..370b8a6d92 100644 --- a/runtime/tokio_util.rs +++ b/runtime/tokio_util.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::fmt::Debug; use std::str::FromStr; diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index faf4f3fc52..270fc1ab9f 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -1,4 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::cell::RefCell; +use std::fmt; +use std::rc::Rc; +use std::sync::atomic::AtomicBool; +use std::sync::atomic::AtomicU32; +use std::sync::atomic::Ordering; +use std::sync::Arc; +use std::task::Context; +use std::task::Poll; use deno_broadcast_channel::InMemoryBroadcastChannel; use deno_cache::CreateCache; @@ -33,6 +43,7 @@ use deno_fs::FileSystem; use deno_http::DefaultHttpPropertyExtractor; use deno_io::Stdio; use deno_kv::dynamic::MultiBackendDbHandler; +use deno_node::ExtNodeSys; use deno_node::NodeExtInitServices; use deno_permissions::PermissionsContainer; use deno_terminal::colors; @@ -45,15 +56,6 @@ use deno_web::JsMessageData; use deno_web::MessagePort; use deno_web::Transferable; use log::debug; -use std::cell::RefCell; -use std::fmt; -use std::rc::Rc; -use std::sync::atomic::AtomicBool; -use std::sync::atomic::AtomicU32; -use std::sync::atomic::Ordering; -use std::sync::Arc; -use std::task::Context; -use std::task::Poll; use crate::inspector_server::InspectorServer; use crate::ops; @@ -337,7 +339,7 @@ fn create_handles( (internal_handle, external_handle) } -pub struct WebWorkerServiceOptions { +pub struct WebWorkerServiceOptions { pub blob_store: Arc, pub broadcast_channel: InMemoryBroadcastChannel, pub compiled_wasm_module_store: Option, @@ -345,7 +347,7 @@ pub struct WebWorkerServiceOptions { pub fs: Arc, pub maybe_inspector_server: Option>, pub module_loader: Rc, - pub node_services: Option, + pub node_services: Option>, pub npm_process_state_provider: Option, pub permissions: PermissionsContainer, pub root_cert_store_provider: Option>, @@ -402,8 +404,8 @@ impl Drop for WebWorker { } impl WebWorker { - pub fn bootstrap_from_options( - services: WebWorkerServiceOptions, + pub fn bootstrap_from_options( + services: WebWorkerServiceOptions, options: WebWorkerOptions, ) -> (Self, SendableWebWorkerHandle) { let (mut worker, handle, bootstrap_options) = @@ -412,8 +414,8 @@ impl WebWorker { (worker, handle) } - fn from_options( - services: WebWorkerServiceOptions, + fn from_options( + services: WebWorkerServiceOptions, mut options: WebWorkerOptions, ) -> (Self, SendableWebWorkerHandle, BootstrapOptions) { deno_core::extension!(deno_permissions_web_worker, @@ -504,7 +506,7 @@ impl WebWorker { deno_fs::deno_fs::init_ops_and_esm::( services.fs.clone(), ), - deno_node::deno_node::init_ops_and_esm::( + deno_node::deno_node::init_ops_and_esm::( services.node_services, services.fs, ), diff --git a/runtime/worker.rs b/runtime/worker.rs index 46fbd7b43f..de29b66291 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::collections::HashMap; use std::rc::Rc; @@ -39,6 +39,7 @@ use deno_fs::FileSystem; use deno_http::DefaultHttpPropertyExtractor; use deno_io::Stdio; use deno_kv::dynamic::MultiBackendDbHandler; +use deno_node::ExtNodeSys; use deno_node::NodeExtInitServices; use deno_permissions::PermissionsContainer; use deno_tls::RootCertStoreProvider; @@ -128,7 +129,7 @@ pub struct MainWorker { dispatch_process_exit_event_fn_global: v8::Global, } -pub struct WorkerServiceOptions { +pub struct WorkerServiceOptions { pub blob_store: Arc, pub broadcast_channel: InMemoryBroadcastChannel, pub feature_checker: Arc, @@ -139,7 +140,7 @@ pub struct WorkerServiceOptions { /// If not provided runtime will error if code being /// executed tries to load modules. pub module_loader: Rc, - pub node_services: Option, + pub node_services: Option>, pub npm_process_state_provider: Option, pub permissions: PermissionsContainer, pub root_cert_store_provider: Option>, @@ -304,9 +305,9 @@ pub fn create_op_metrics( } impl MainWorker { - pub fn bootstrap_from_options( + pub fn bootstrap_from_options( main_module: ModuleSpecifier, - services: WorkerServiceOptions, + services: WorkerServiceOptions, options: WorkerOptions, ) -> Self { let (mut worker, bootstrap_options) = @@ -315,9 +316,9 @@ impl MainWorker { worker } - fn from_options( + fn from_options( main_module: ModuleSpecifier, - services: WorkerServiceOptions, + services: WorkerServiceOptions, mut options: WorkerOptions, ) -> (Self, BootstrapOptions) { deno_core::extension!(deno_permissions_worker, @@ -417,7 +418,7 @@ impl MainWorker { deno_fs::deno_fs::init_ops_and_esm::( services.fs.clone(), ), - deno_node::deno_node::init_ops_and_esm::( + deno_node::deno_node::init_ops_and_esm::( services.node_services, services.fs, ), diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index 8364fe0d2b..ff90804f3b 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -1,13 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::cell::RefCell; +use std::thread; use deno_core::v8; use deno_core::ModuleSpecifier; use deno_telemetry::OtelConfig; -use serde::Serialize; -use std::cell::RefCell; -use std::thread; - use deno_terminal::colors; +use serde::Serialize; /// The execution mode for this worker. Some modes may have implicit behaviour. #[derive(Copy, Clone)] diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 1300066c64..cff778b2de 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "cli_tests" diff --git a/tests/ffi/Cargo.toml b/tests/ffi/Cargo.toml index a5d2883ef2..bae9aa6bb5 100644 --- a/tests/ffi/Cargo.toml +++ b/tests/ffi/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "test_ffi" diff --git a/tests/ffi/src/lib.rs b/tests/ffi/src/lib.rs index 09c2afb3de..ca416fb980 100644 --- a/tests/ffi/src/lib.rs +++ b/tests/ffi/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(clippy::print_stdout)] #![allow(clippy::print_stderr)] diff --git a/tests/ffi/tests/bench.js b/tests/ffi/tests/bench.js index 2b4fbd55ba..c4b935398a 100644 --- a/tests/ffi/tests/bench.js +++ b/tests/ffi/tests/bench.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file const targetDir = Deno.execPath().replace(/[^\/\\]+$/, ""); diff --git a/tests/ffi/tests/event_loop_integration.ts b/tests/ffi/tests/event_loop_integration.ts index e3914d9662..17c2d17f0b 100644 --- a/tests/ffi/tests/event_loop_integration.ts +++ b/tests/ffi/tests/event_loop_integration.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/ffi/tests/ffi_callback_errors.ts b/tests/ffi/tests/ffi_callback_errors.ts index 797ff236c1..3f165158b4 100644 --- a/tests/ffi/tests/ffi_callback_errors.ts +++ b/tests/ffi/tests/ffi_callback_errors.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/ffi/tests/ffi_types.ts b/tests/ffi/tests/ffi_types.ts index a996195c69..0ae51c61fb 100644 --- a/tests/ffi/tests/ffi_types.ts +++ b/tests/ffi/tests/ffi_types.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file // Only for testing types. Invoke with `deno install --entrypoint` diff --git a/tests/ffi/tests/integration_tests.rs b/tests/ffi/tests/integration_tests.rs index dbc0036bc2..7e92641ae5 100644 --- a/tests/ffi/tests/integration_tests.rs +++ b/tests/ffi/tests/integration_tests.rs @@ -1,10 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(clippy::print_stdout)] #![allow(clippy::print_stderr)] -use pretty_assertions::assert_eq; use std::process::Command; + +use pretty_assertions::assert_eq; use test_util::deno_cmd; use test_util::deno_config_path; use test_util::ffi_tests_path; diff --git a/tests/ffi/tests/test.js b/tests/ffi/tests/test.js index 074db81882..a93b648a2e 100644 --- a/tests/ffi/tests/test.js +++ b/tests/ffi/tests/test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file // Run using cargo test or `--v8-flags=--allow-natives-syntax` diff --git a/tests/ffi/tests/thread_safe_test.js b/tests/ffi/tests/thread_safe_test.js index fffa61a04f..519b0bd4fd 100644 --- a/tests/ffi/tests/thread_safe_test.js +++ b/tests/ffi/tests/thread_safe_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file const targetDir = Deno.execPath().replace(/[^\/\\]+$/, ""); diff --git a/tests/ffi/tests/thread_safe_test_worker.js b/tests/ffi/tests/thread_safe_test_worker.js index fc4854436e..390b4d8a3f 100644 --- a/tests/ffi/tests/thread_safe_test_worker.js +++ b/tests/ffi/tests/thread_safe_test_worker.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file const targetDir = Deno.execPath().replace(/[^\/\\]+$/, ""); diff --git a/tests/integration/bench_tests.rs b/tests/integration/bench_tests.rs index 4ee029d648..b8d38a7f91 100644 --- a/tests/integration/bench_tests.rs +++ b/tests/integration/bench_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::serde_json::json; use deno_core::url::Url; diff --git a/tests/integration/cache_tests.rs b/tests/integration/cache_tests.rs index 4cddae1af1..3fbed3cbd4 100644 --- a/tests/integration/cache_tests.rs +++ b/tests/integration/cache_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use test_util::TestContext; use test_util::TestContextBuilder; diff --git a/tests/integration/check_tests.rs b/tests/integration/check_tests.rs index a1fdf83403..15a2d96d04 100644 --- a/tests/integration/check_tests.rs +++ b/tests/integration/check_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_lockfile::NewLockfileOptions; use deno_semver::jsr::JsrDepPackageReq; diff --git a/tests/integration/compile_tests.rs b/tests/integration/compile_tests.rs index a715233933..e61a1ed9eb 100644 --- a/tests/integration/compile_tests.rs +++ b/tests/integration/compile_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::serde_json; use test_util as util; diff --git a/tests/integration/coverage_tests.rs b/tests/integration/coverage_tests.rs index ab18ef76d3..ab09d54267 100644 --- a/tests/integration/coverage_tests.rs +++ b/tests/integration/coverage_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::serde_json; use test_util as util; diff --git a/tests/integration/eval_tests.rs b/tests/integration/eval_tests.rs index 198be3a4e8..836cab900e 100644 --- a/tests/integration/eval_tests.rs +++ b/tests/integration/eval_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use test_util as util; diff --git a/tests/integration/flags_tests.rs b/tests/integration/flags_tests.rs index e233ca5baf..e819ea6c99 100644 --- a/tests/integration/flags_tests.rs +++ b/tests/integration/flags_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use test_util as util; use util::assert_contains; diff --git a/tests/integration/fmt_tests.rs b/tests/integration/fmt_tests.rs index ccf54a4d0f..468c9cfbc8 100644 --- a/tests/integration/fmt_tests.rs +++ b/tests/integration/fmt_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::serde_json::json; use test_util as util; diff --git a/tests/integration/init_tests.rs b/tests/integration/init_tests.rs index a447e7bcef..5bbec687b0 100644 --- a/tests/integration/init_tests.rs +++ b/tests/integration/init_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use test_util as util; use util::assert_contains; diff --git a/tests/integration/inspector_tests.rs b/tests/integration/inspector_tests.rs index fa1b3a9d83..7c1be193a1 100644 --- a/tests/integration/inspector_tests.rs +++ b/tests/integration/inspector_tests.rs @@ -1,4 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::io::BufRead; +use std::process::ChildStderr; +use std::time::Duration; use bytes::Bytes; use deno_core::anyhow::anyhow; @@ -6,7 +10,6 @@ use deno_core::error::AnyError; use deno_core::serde_json; use deno_core::serde_json::json; use deno_core::url; - use fastwebsockets::FragmentCollector; use fastwebsockets::Frame; use fastwebsockets::WebSocket; @@ -15,9 +18,6 @@ use hyper::upgrade::Upgraded; use hyper::Request; use hyper::Response; use hyper_util::rt::TokioIo; -use std::io::BufRead; -use std::process::ChildStderr; -use std::time::Duration; use test_util as util; use tokio::net::TcpStream; use tokio::time::timeout; diff --git a/tests/integration/install_tests.rs b/tests/integration/install_tests.rs index b0c1e44778..29a65a70b8 100644 --- a/tests/integration/install_tests.rs +++ b/tests/integration/install_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use test_util as util; use test_util::assert_contains; diff --git a/tests/integration/js_unit_tests.rs b/tests/integration/js_unit_tests.rs index afb97a3458..9ecec8b426 100644 --- a/tests/integration/js_unit_tests.rs +++ b/tests/integration/js_unit_tests.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::io::BufRead; use std::io::BufReader; use std::time::Duration; use std::time::Instant; + use test_util as util; util::unit_test_factory!( diff --git a/tests/integration/jsr_tests.rs b/tests/integration/jsr_tests.rs index d3fa5cd98f..95a9fcb437 100644 --- a/tests/integration/jsr_tests.rs +++ b/tests/integration/jsr_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_cache_dir::HttpCache; use deno_core::serde_json; diff --git a/tests/integration/jupyter_tests.rs b/tests/integration/jupyter_tests.rs index e99780a276..4ef993c157 100644 --- a/tests/integration/jupyter_tests.rs +++ b/tests/integration/jupyter_tests.rs @@ -1,15 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::process::Output; use std::sync::Arc; use std::time::Duration; use bytes::Bytes; -use test_util::assertions::assert_json_subset; -use test_util::DenoChild; -use test_util::TestContext; -use test_util::TestContextBuilder; - use chrono::DateTime; use chrono::Utc; use deno_core::anyhow::Result; @@ -18,6 +13,10 @@ use deno_core::serde_json::json; use deno_core::serde_json::Value; use serde::Deserialize; use serde::Serialize; +use test_util::assertions::assert_json_subset; +use test_util::DenoChild; +use test_util::TestContext; +use test_util::TestContextBuilder; use tokio::sync::Mutex; use tokio::time::timeout; use uuid::Uuid; diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 825cef6247..23676c2f92 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -1,4 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::fs; +use std::str::FromStr; use deno_ast::ModuleSpecifier; use deno_core::serde::Deserialize; @@ -7,8 +10,6 @@ use deno_core::serde_json::json; use deno_core::serde_json::Value; use deno_core::url::Url; use pretty_assertions::assert_eq; -use std::fs; -use std::str::FromStr; use test_util::assert_starts_with; use test_util::assertions::assert_json_subset; use test_util::deno_cmd_with_deno_dir; @@ -8712,6 +8713,7 @@ fn lsp_completions_node_specifier() { "node:http2", "node:https", "node:inspector", + "node:inspector/promises", "node:module", "node:net", "node:os", diff --git a/tests/integration/mod.rs b/tests/integration/mod.rs index 37c7502284..a69bc65042 100644 --- a/tests/integration/mod.rs +++ b/tests/integration/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(clippy::print_stdout)] #![allow(clippy::print_stderr)] diff --git a/tests/integration/node_unit_tests.rs b/tests/integration/node_unit_tests.rs index 9cb1af9496..ef76e365a4 100644 --- a/tests/integration/node_unit_tests.rs +++ b/tests/integration/node_unit_tests.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::io::BufRead; use std::io::BufReader; use std::time::Duration; use std::time::Instant; + use test_util as util; use test_util::itest; use util::deno_config_path; diff --git a/tests/integration/npm_tests.rs b/tests/integration/npm_tests.rs index ffd3b817d4..033d948b2e 100644 --- a/tests/integration/npm_tests.rs +++ b/tests/integration/npm_tests.rs @@ -1,9 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::serde_json; use deno_core::serde_json::json; use deno_core::serde_json::Value; - use pretty_assertions::assert_eq; use test_util as util; use test_util::itest; diff --git a/tests/integration/pm_tests.rs b/tests/integration/pm_tests.rs index e3db9006fa..e8985ebfb1 100644 --- a/tests/integration/pm_tests.rs +++ b/tests/integration/pm_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use deno_core::serde_json::json; use test_util::assert_contains; diff --git a/tests/integration/publish_tests.rs b/tests/integration/publish_tests.rs index b97479e78e..332b7c6fa6 100644 --- a/tests/integration/publish_tests.rs +++ b/tests/integration/publish_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::process::Command; diff --git a/tests/integration/repl_tests.rs b/tests/integration/repl_tests.rs index 9eceb2f05d..4faf629af5 100644 --- a/tests/integration/repl_tests.rs +++ b/tests/integration/repl_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use test_util as util; use test_util::assert_contains; diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index 77c0a46c5f..ebb372418e 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::io::BufReader; use std::io::Cursor; @@ -11,7 +11,6 @@ use std::sync::Arc; use bytes::Bytes; use deno_core::serde_json::json; use deno_core::url; - use deno_tls::rustls; use deno_tls::rustls::ClientConnection; use deno_tls::rustls_pemfile; @@ -2215,15 +2214,16 @@ fn basic_auth_tokens() { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_resolve_dns() { + use std::net::SocketAddr; + use std::str::FromStr; + use std::sync::Arc; + use std::time::Duration; + use hickory_server::authority::Catalog; use hickory_server::authority::ZoneType; use hickory_server::proto::rr::Name; use hickory_server::store::in_memory::InMemoryAuthority; use hickory_server::ServerFuture; - use std::net::SocketAddr; - use std::str::FromStr; - use std::sync::Arc; - use std::time::Duration; use tokio::net::TcpListener; use tokio::net::UdpSocket; use tokio::sync::oneshot; diff --git a/tests/integration/serve_tests.rs b/tests/integration/serve_tests.rs index f3c8a31d93..8771930847 100644 --- a/tests/integration/serve_tests.rs +++ b/tests/integration/serve_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::collections::HashMap; diff --git a/tests/integration/shared_library_tests.rs b/tests/integration/shared_library_tests.rs index 4d33e6584e..d7cdf5b426 100644 --- a/tests/integration/shared_library_tests.rs +++ b/tests/integration/shared_library_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #[cfg(all(target_os = "linux", target_arch = "x86_64"))] #[test] diff --git a/tests/integration/task_tests.rs b/tests/integration/task_tests.rs index f2e901228a..1db5376cdd 100644 --- a/tests/integration/task_tests.rs +++ b/tests/integration/task_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Most of the tests for this are in deno_task_shell. // These tests are intended to only test integration. diff --git a/tests/integration/test_tests.rs b/tests/integration/test_tests.rs index ca83682833..cfa9d9f2d6 100644 --- a/tests/integration/test_tests.rs +++ b/tests/integration/test_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use test_util as util; use util::assert_contains; diff --git a/tests/integration/upgrade_tests.rs b/tests/integration/upgrade_tests.rs index 5132b4ca5b..7748f0ca1a 100644 --- a/tests/integration/upgrade_tests.rs +++ b/tests/integration/upgrade_tests.rs @@ -1,8 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::process::Command; use std::process::Stdio; use std::time::Instant; + use test_util as util; use test_util::assert_starts_with; use test_util::TestContext; diff --git a/tests/integration/watcher_tests.rs b/tests/integration/watcher_tests.rs index 055e46af9c..a180be2fb3 100644 --- a/tests/integration/watcher_tests.rs +++ b/tests/integration/watcher_tests.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use flaky_test::flaky_test; use test_util as util; @@ -6,9 +6,8 @@ use test_util::assert_contains; use test_util::env_vars_for_npm_tests; use test_util::TempDir; use tokio::io::AsyncBufReadExt; -use util::DenoChild; - use util::assert_not_contains; +use util::DenoChild; /// Logs to stderr every time next_line() is called struct LoggingLines diff --git a/tests/lib.rs b/tests/lib.rs index 0a39b9f87d..d841ab9f3f 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -1 +1 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. diff --git a/tests/napi/Cargo.toml b/tests/napi/Cargo.toml index e3de253683..e8a39a0cda 100644 --- a/tests/napi/Cargo.toml +++ b/tests/napi/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "test_napi" diff --git a/tests/napi/array_test.js b/tests/napi/array_test.js index 572d3a8994..c72e5d3849 100644 --- a/tests/napi/array_test.js +++ b/tests/napi/array_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/arraybuffer_test.js b/tests/napi/arraybuffer_test.js index f55b9a78c5..a11f761130 100644 --- a/tests/napi/arraybuffer_test.js +++ b/tests/napi/arraybuffer_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/async_test.js b/tests/napi/async_test.js index 4d9ad99c26..f3d258a543 100644 --- a/tests/napi/async_test.js +++ b/tests/napi/async_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/bigint_test.js b/tests/napi/bigint_test.js index 4a9ada2057..19c5317d75 100644 --- a/tests/napi/bigint_test.js +++ b/tests/napi/bigint_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/build.rs b/tests/napi/build.rs index c2fe86a531..73fce9172a 100644 --- a/tests/napi/build.rs +++ b/tests/napi/build.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. extern crate napi_build; diff --git a/tests/napi/callback_test.js b/tests/napi/callback_test.js index c132fefa18..3c56b11a28 100644 --- a/tests/napi/callback_test.js +++ b/tests/napi/callback_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/cleanup_hook_test.js b/tests/napi/cleanup_hook_test.js index 2c1f73e12b..8e4430eef7 100644 --- a/tests/napi/cleanup_hook_test.js +++ b/tests/napi/cleanup_hook_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/napi/coerce_test.js b/tests/napi/coerce_test.js index 64f0148016..91e8950980 100644 --- a/tests/napi/coerce_test.js +++ b/tests/napi/coerce_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/common.js b/tests/napi/common.js index 6dfdc873a8..7df63c4f90 100644 --- a/tests/napi/common.js +++ b/tests/napi/common.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. export { assert, assertEquals, assertRejects, assertThrows } from "@std/assert"; export { fromFileUrl } from "@std/path"; diff --git a/tests/napi/date_test.js b/tests/napi/date_test.js index 49eec5cca1..2625010494 100644 --- a/tests/napi/date_test.js +++ b/tests/napi/date_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/env_test.js b/tests/napi/env_test.js index 72b868a668..0b9fad314b 100644 --- a/tests/napi/env_test.js +++ b/tests/napi/env_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/error_test.js b/tests/napi/error_test.js index 57acde5c16..cab36b0a30 100644 --- a/tests/napi/error_test.js +++ b/tests/napi/error_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/napi/init_test.js b/tests/napi/init_test.js index 9486824780..8cd5298dde 100644 --- a/tests/napi/init_test.js +++ b/tests/napi/init_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { Buffer } from "node:buffer"; import { assert, libSuffix } from "./common.js"; diff --git a/tests/napi/make_callback_test.js b/tests/napi/make_callback_test.js index b1f7912aea..60aa5ae4c7 100644 --- a/tests/napi/make_callback_test.js +++ b/tests/napi/make_callback_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/mem_test.js b/tests/napi/mem_test.js index bee8c194ea..2c8b0be75a 100644 --- a/tests/napi/mem_test.js +++ b/tests/napi/mem_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/module.c b/tests/napi/module.c index 1ae2ace5d3..9eb90887a8 100644 --- a/tests/napi/module.c +++ b/tests/napi/module.c @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. typedef struct napi_module { int nm_version; diff --git a/tests/napi/numbers_test.js b/tests/napi/numbers_test.js index 8a99c831d0..4914a24751 100644 --- a/tests/napi/numbers_test.js +++ b/tests/napi/numbers_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/object_test.js b/tests/napi/object_test.js index 6226b0138c..5ab81359c4 100644 --- a/tests/napi/object_test.js +++ b/tests/napi/object_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/napi/object_wrap_test.js b/tests/napi/object_wrap_test.js index ee6d4af86b..7c7eecbbd4 100644 --- a/tests/napi/object_wrap_test.js +++ b/tests/napi/object_wrap_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { Buffer } from "node:buffer"; import { assert, assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/promise_test.js b/tests/napi/promise_test.js index e4bbfee6b8..3b9ba15b67 100644 --- a/tests/napi/promise_test.js +++ b/tests/napi/promise_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertRejects, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/properties_test.js b/tests/napi/properties_test.js index 21a3555e8e..ee86eaa19b 100644 --- a/tests/napi/properties_test.js +++ b/tests/napi/properties_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/src/array.rs b/tests/napi/src/array.rs index 6df420eb57..b2aba94fff 100644 --- a/tests/napi/src/array.rs +++ b/tests/napi/src/array.rs @@ -1,12 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::ValueType::napi_number; +use napi_sys::ValueType::napi_object; +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::ValueType::napi_number; -use napi_sys::ValueType::napi_object; -use napi_sys::*; -use std::ptr; extern "C" fn test_array_new( env: napi_env, diff --git a/tests/napi/src/arraybuffer.rs b/tests/napi/src/arraybuffer.rs index 8402f5d861..0fe39b53cc 100644 --- a/tests/napi/src/arraybuffer.rs +++ b/tests/napi/src/arraybuffer.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::*; extern "C" fn test_detached( env: napi_env, diff --git a/tests/napi/src/async.rs b/tests/napi/src/async.rs index 367d2e9ef0..a91f7037b2 100644 --- a/tests/napi/src/async.rs +++ b/tests/napi/src/async.rs @@ -1,14 +1,16 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::os::raw::c_char; +use std::os::raw::c_void; +use std::ptr; + +use napi_sys::Status::napi_ok; +use napi_sys::ValueType::napi_function; +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::Status::napi_ok; -use napi_sys::ValueType::napi_function; -use napi_sys::*; -use std::os::raw::c_char; -use std::os::raw::c_void; -use std::ptr; pub struct Baton { called: bool, diff --git a/tests/napi/src/bigint.rs b/tests/napi/src/bigint.rs index d867823313..6e1d728b32 100644 --- a/tests/napi/src/bigint.rs +++ b/tests/napi/src/bigint.rs @@ -1,13 +1,15 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::Status::napi_pending_exception; +use napi_sys::ValueType::napi_bigint; +use napi_sys::*; use crate::assert_napi_ok; use crate::cstr; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::Status::napi_pending_exception; -use napi_sys::ValueType::napi_bigint; -use napi_sys::*; -use std::ptr; extern "C" fn is_lossless( env: napi_env, diff --git a/tests/napi/src/callback.rs b/tests/napi/src/callback.rs index 2512f6a38f..1ce1d688c2 100644 --- a/tests/napi/src/callback.rs +++ b/tests/napi/src/callback.rs @@ -1,15 +1,17 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; -use crate::assert_napi_ok; -use crate::napi_get_callback_info; -use crate::napi_new_property; use napi_sys::ValueType::napi_function; use napi_sys::ValueType::napi_object; use napi_sys::ValueType::napi_undefined; use napi_sys::*; -use std::ptr; use Status::napi_pending_exception; +use crate::assert_napi_ok; +use crate::napi_get_callback_info; +use crate::napi_new_property; + /// `test_callback_run((a, b) => a + b, [1, 2])` => 3 extern "C" fn test_callback_run( env: napi_env, diff --git a/tests/napi/src/coerce.rs b/tests/napi/src/coerce.rs index a405783843..e0fa50c89e 100644 --- a/tests/napi/src/coerce.rs +++ b/tests/napi/src/coerce.rs @@ -1,10 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::*; -use std::ptr; extern "C" fn test_coerce_bool( env: napi_env, diff --git a/tests/napi/src/date.rs b/tests/napi/src/date.rs index 4d3c155c32..1db5bd088b 100644 --- a/tests/napi/src/date.rs +++ b/tests/napi/src/date.rs @@ -1,11 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::ValueType::napi_number; +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::ValueType::napi_number; -use napi_sys::*; -use std::ptr; extern "C" fn create_date( env: napi_env, diff --git a/tests/napi/src/env.rs b/tests/napi/src/env.rs index ebc6532a3c..b1b56191ec 100644 --- a/tests/napi/src/env.rs +++ b/tests/napi/src/env.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::*; extern "C" fn get_node_global( env: napi_env, diff --git a/tests/napi/src/error.rs b/tests/napi/src/error.rs index e0d79c836a..6de0d529b2 100644 --- a/tests/napi/src/error.rs +++ b/tests/napi/src/error.rs @@ -1,11 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::*; use crate::assert_napi_ok; use crate::cstr; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::*; -use std::ptr; extern "C" fn check_error( env: napi_env, diff --git a/tests/napi/src/finalizer.rs b/tests/napi/src/finalizer.rs index 9769e775e2..56e0a326a7 100644 --- a/tests/napi/src/finalizer.rs +++ b/tests/napi/src/finalizer.rs @@ -1,11 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::ValueType::napi_object; +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::ValueType::napi_object; -use napi_sys::*; -use std::ptr; unsafe extern "C" fn finalize_cb( _env: napi_env, diff --git a/tests/napi/src/lib.rs b/tests/napi/src/lib.rs index 8c6190ad3e..6162feded6 100644 --- a/tests/napi/src/lib.rs +++ b/tests/napi/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(clippy::all)] #![allow(clippy::print_stdout)] diff --git a/tests/napi/src/make_callback.rs b/tests/napi/src/make_callback.rs index 945df34523..c19d34e50c 100644 --- a/tests/napi/src/make_callback.rs +++ b/tests/napi/src/make_callback.rs @@ -1,10 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::ValueType::napi_function; +use napi_sys::*; use crate::assert_napi_ok; use crate::cstr; -use napi_sys::ValueType::napi_function; -use napi_sys::*; -use std::ptr; extern "C" fn make_callback( env: napi_env, diff --git a/tests/napi/src/mem.rs b/tests/napi/src/mem.rs index ebb6a5c7ac..a05cd3abf4 100644 --- a/tests/napi/src/mem.rs +++ b/tests/napi/src/mem.rs @@ -1,9 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_new_property; -use napi_sys::*; -use std::ptr; extern "C" fn adjust_external_memory( env: napi_env, diff --git a/tests/napi/src/numbers.rs b/tests/napi/src/numbers.rs index 777ccbfac7..9c4174f727 100644 --- a/tests/napi/src/numbers.rs +++ b/tests/napi/src/numbers.rs @@ -1,11 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::ValueType::napi_number; +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::ValueType::napi_number; -use napi_sys::*; -use std::ptr; extern "C" fn test_int32( env: napi_env, diff --git a/tests/napi/src/object.rs b/tests/napi/src/object.rs index 9876f4dae0..9014134803 100644 --- a/tests/napi/src/object.rs +++ b/tests/napi/src/object.rs @@ -1,10 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::*; -use std::ptr; extern "C" fn test_object_new( env: napi_env, diff --git a/tests/napi/src/object_wrap.rs b/tests/napi/src/object_wrap.rs index 63e9e2e232..11844917b5 100644 --- a/tests/napi/src/object_wrap.rs +++ b/tests/napi/src/object_wrap.rs @@ -1,16 +1,18 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::assert_napi_ok; -use crate::napi_get_callback_info; -use crate::napi_new_property; -use napi_sys::ValueType::napi_number; -use napi_sys::*; use std::cell::RefCell; use std::collections::HashMap; use std::os::raw::c_char; use std::os::raw::c_void; use std::ptr; +use napi_sys::ValueType::napi_number; +use napi_sys::*; + +use crate::assert_napi_ok; +use crate::napi_get_callback_info; +use crate::napi_new_property; + pub struct NapiObject { counter: i32, } diff --git a/tests/napi/src/primitives.rs b/tests/napi/src/primitives.rs index 28fb8ec3db..7717a0aaac 100644 --- a/tests/napi/src/primitives.rs +++ b/tests/napi/src/primitives.rs @@ -1,9 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_new_property; -use napi_sys::*; -use std::ptr; extern "C" fn test_get_undefined( env: napi_env, diff --git a/tests/napi/src/promise.rs b/tests/napi/src/promise.rs index 1f1c31f1eb..eab379d617 100644 --- a/tests/napi/src/promise.rs +++ b/tests/napi/src/promise.rs @@ -1,11 +1,13 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; +use std::ptr::addr_of_mut; + +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::*; -use std::ptr; -use std::ptr::addr_of_mut; static mut CURRENT_DEFERRED: napi_deferred = ptr::null_mut(); diff --git a/tests/napi/src/properties.rs b/tests/napi/src/properties.rs index 43bef1949a..4244c7ba06 100644 --- a/tests/napi/src/properties.rs +++ b/tests/napi/src/properties.rs @@ -1,10 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::ptr; + +use napi_sys::PropertyAttributes::*; +use napi_sys::*; use crate::assert_napi_ok; use crate::cstr; -use napi_sys::PropertyAttributes::*; -use napi_sys::*; -use std::ptr; static NICE: i64 = 69; diff --git a/tests/napi/src/strings.rs b/tests/napi/src/strings.rs index 301ab23df2..027ae68176 100644 --- a/tests/napi/src/strings.rs +++ b/tests/napi/src/strings.rs @@ -1,10 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use napi_sys::ValueType::napi_string; +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::ValueType::napi_string; -use napi_sys::*; extern "C" fn test_utf8(env: napi_env, info: napi_callback_info) -> napi_value { let (args, argc, _) = napi_get_callback_info!(env, info, 1); diff --git a/tests/napi/src/symbol.rs b/tests/napi/src/symbol.rs index 6387d449f1..30c7cbde64 100644 --- a/tests/napi/src/symbol.rs +++ b/tests/napi/src/symbol.rs @@ -1,10 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use napi_sys::ValueType::napi_string; +use napi_sys::*; use crate::assert_napi_ok; use crate::napi_get_callback_info; use crate::napi_new_property; -use napi_sys::ValueType::napi_string; -use napi_sys::*; extern "C" fn symbol_new( env: napi_env, diff --git a/tests/napi/src/tsfn.rs b/tests/napi/src/tsfn.rs index a3a231cec1..830145501d 100644 --- a/tests/napi/src/tsfn.rs +++ b/tests/napi/src/tsfn.rs @@ -1,13 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This test performs initialization similar to napi-rs. // https://github.com/napi-rs/napi-rs/commit/a5a04a4e545f268769cc78e2bd6c45af4336aac3 -use napi_sys as sys; use std::ffi::c_char; use std::ffi::c_void; use std::ptr; +use napi_sys as sys; + macro_rules! check_status_or_panic { ($code:expr, $msg:expr) => {{ let c = $code; diff --git a/tests/napi/src/typedarray.rs b/tests/napi/src/typedarray.rs index b512bd32fe..95adf957e4 100644 --- a/tests/napi/src/typedarray.rs +++ b/tests/napi/src/typedarray.rs @@ -1,16 +1,18 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::assert_napi_ok; -use crate::napi_get_callback_info; -use crate::napi_new_property; use core::ffi::c_void; +use std::os::raw::c_char; +use std::ptr; + use napi_sys::Status::napi_ok; use napi_sys::TypedarrayType; use napi_sys::ValueType::napi_number; use napi_sys::ValueType::napi_object; use napi_sys::*; -use std::os::raw::c_char; -use std::ptr; + +use crate::assert_napi_ok; +use crate::napi_get_callback_info; +use crate::napi_new_property; extern "C" fn test_multiply( env: napi_env, diff --git a/tests/napi/src/uv.rs b/tests/napi/src/uv.rs index 555470c008..45ca114adc 100644 --- a/tests/napi/src/uv.rs +++ b/tests/napi/src/uv.rs @@ -1,8 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::mem::MaybeUninit; +use std::ptr; +use std::ptr::addr_of_mut; +use std::ptr::null_mut; +use std::time::Duration; -use crate::assert_napi_ok; -use crate::napi_get_callback_info; -use crate::napi_new_property; use libuv_sys_lite::uv_async_init; use libuv_sys_lite::uv_async_t; use libuv_sys_lite::uv_close; @@ -12,11 +15,10 @@ use libuv_sys_lite::uv_mutex_lock; use libuv_sys_lite::uv_mutex_t; use libuv_sys_lite::uv_mutex_unlock; use napi_sys::*; -use std::mem::MaybeUninit; -use std::ptr; -use std::ptr::addr_of_mut; -use std::ptr::null_mut; -use std::time::Duration; + +use crate::assert_napi_ok; +use crate::napi_get_callback_info; +use crate::napi_new_property; struct KeepAlive { tsfn: napi_threadsafe_function, diff --git a/tests/napi/strings_test.js b/tests/napi/strings_test.js index 45cb133b28..01fc873a74 100644 --- a/tests/napi/strings_test.js +++ b/tests/napi/strings_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/symbol_test.js b/tests/napi/symbol_test.js index d8edec0232..3f0f277647 100644 --- a/tests/napi/symbol_test.js +++ b/tests/napi/symbol_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/tests/napi_tests.rs b/tests/napi/tests/napi_tests.rs index 53d4258f93..f97fdce289 100644 --- a/tests/napi/tests/napi_tests.rs +++ b/tests/napi/tests/napi_tests.rs @@ -1,9 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(clippy::print_stdout)] #![allow(clippy::print_stderr)] use std::process::Command; + use test_util::deno_cmd; use test_util::deno_config_path; use test_util::env_vars_for_npm_tests; diff --git a/tests/napi/typedarray_test.js b/tests/napi/typedarray_test.js index 25729754a5..f7887e4b1c 100644 --- a/tests/napi/typedarray_test.js +++ b/tests/napi/typedarray_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/napi/uv_test.js b/tests/napi/uv_test.js index af20b26493..f0ff613f31 100644 --- a/tests/napi/uv_test.js +++ b/tests/napi/uv_test.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, loadTestLibrary } from "./common.js"; diff --git a/tests/node_compat/common.ts b/tests/node_compat/common.ts index 2982095a29..a86373d69f 100644 --- a/tests/node_compat/common.ts +++ b/tests/node_compat/common.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { partition } from "@std/collections/partition"; import { join } from "@std/path"; import * as JSONC from "@std/jsonc"; diff --git a/tests/node_compat/polyfill_globals.js b/tests/node_compat/polyfill_globals.js index f22143d9bd..8bbd5cc7df 100644 --- a/tests/node_compat/polyfill_globals.js +++ b/tests/node_compat/polyfill_globals.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { Buffer } from "node:buffer"; import { clearImmediate, diff --git a/tests/node_compat/runner.ts b/tests/node_compat/runner.ts index 56803fad44..6bc750447a 100644 --- a/tests/node_compat/runner.ts +++ b/tests/node_compat/runner.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import "./polyfill_globals.js"; import { createRequire } from "node:module"; import { toFileUrl } from "@std/path/to-file-url"; diff --git a/tests/node_compat/runner/challenge_new_test.ts b/tests/node_compat/runner/challenge_new_test.ts index 313bf60490..c95391d3e0 100644 --- a/tests/node_compat/runner/challenge_new_test.ts +++ b/tests/node_compat/runner/challenge_new_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console import { deadline } from "@std/async/deadline"; diff --git a/tests/node_compat/runner/setup.ts b/tests/node_compat/runner/setup.ts index b655633ead..d256842e14 100755 --- a/tests/node_compat/runner/setup.ts +++ b/tests/node_compat/runner/setup.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --allow-read=. --allow-write=. --allow-run=git --config=tests/config/deno.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/node_compat/test.ts b/tests/node_compat/test.ts index 52d2b17169..fe6b2e879b 100644 --- a/tests/node_compat/test.ts +++ b/tests/node_compat/test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/node_compat/test_runner.rs b/tests/node_compat/test_runner.rs index 15749ca7fd..150b632b90 100644 --- a/tests/node_compat/test_runner.rs +++ b/tests/node_compat/test_runner.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use test_util as util; use util::deno_config_path; diff --git a/tests/registry/jsr/@std/assert/0.220.1/mod.ts b/tests/registry/jsr/@std/assert/0.220.1/mod.ts index fdcb56c8cf..44aa962030 100644 --- a/tests/registry/jsr/@std/assert/0.220.1/mod.ts +++ b/tests/registry/jsr/@std/assert/0.220.1/mod.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /** A library of assertion functions. * If the assertion is false an `AssertionError` will be thrown which will diff --git a/tests/registry/jsr/@std/assert/1.0.0/mod.ts b/tests/registry/jsr/@std/assert/1.0.0/mod.ts index fdcb56c8cf..44aa962030 100644 --- a/tests/registry/jsr/@std/assert/1.0.0/mod.ts +++ b/tests/registry/jsr/@std/assert/1.0.0/mod.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /** A library of assertion functions. * If the assertion is false an `AssertionError` will be thrown which will diff --git a/tests/registry/jsr/@std/http/1.0.0/mod.ts b/tests/registry/jsr/@std/http/1.0.0/mod.ts index 0a0e82847f..991765213a 100644 --- a/tests/registry/jsr/@std/http/1.0.0/mod.ts +++ b/tests/registry/jsr/@std/http/1.0.0/mod.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /** * Request handler for {@linkcode Route}. diff --git a/tests/registry/jsr/@std/path/0.220.1/_common/assert_path.ts b/tests/registry/jsr/@std/path/0.220.1/_common/assert_path.ts index 7033edcd1a..2d7f7f1b92 100644 --- a/tests/registry/jsr/@std/path/0.220.1/_common/assert_path.ts +++ b/tests/registry/jsr/@std/path/0.220.1/_common/assert_path.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright the Browserify authors. MIT License. export function assertPath(path?: string) { diff --git a/tests/registry/jsr/@std/path/0.220.1/_common/constants.ts b/tests/registry/jsr/@std/path/0.220.1/_common/constants.ts index 9bfd411b66..2dae0df89f 100644 --- a/tests/registry/jsr/@std/path/0.220.1/_common/constants.ts +++ b/tests/registry/jsr/@std/path/0.220.1/_common/constants.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ // This module is browser compatible. diff --git a/tests/registry/jsr/@std/path/0.220.1/_common/normalize.ts b/tests/registry/jsr/@std/path/0.220.1/_common/normalize.ts index 3a1a162845..a3d0a0caee 100644 --- a/tests/registry/jsr/@std/path/0.220.1/_common/normalize.ts +++ b/tests/registry/jsr/@std/path/0.220.1/_common/normalize.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This module is browser compatible. import { assertPath } from "./assert_path.ts"; diff --git a/tests/registry/jsr/@std/path/0.220.1/_common/normalize_string.ts b/tests/registry/jsr/@std/path/0.220.1/_common/normalize_string.ts index d8f0e090a6..dbcf59029b 100644 --- a/tests/registry/jsr/@std/path/0.220.1/_common/normalize_string.ts +++ b/tests/registry/jsr/@std/path/0.220.1/_common/normalize_string.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ // This module is browser compatible. diff --git a/tests/registry/jsr/@std/path/0.220.1/posix/_util.ts b/tests/registry/jsr/@std/path/0.220.1/posix/_util.ts index b446155df5..ff4f87c2aa 100644 --- a/tests/registry/jsr/@std/path/0.220.1/posix/_util.ts +++ b/tests/registry/jsr/@std/path/0.220.1/posix/_util.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ // This module is browser compatible. diff --git a/tests/registry/jsr/@std/path/0.220.1/posix/join.ts b/tests/registry/jsr/@std/path/0.220.1/posix/join.ts index 625762ab97..85bfb63794 100644 --- a/tests/registry/jsr/@std/path/0.220.1/posix/join.ts +++ b/tests/registry/jsr/@std/path/0.220.1/posix/join.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This module is browser compatible. import { assertPath } from "../_common/assert_path.ts"; diff --git a/tests/registry/jsr/@std/path/0.220.1/posix/normalize.ts b/tests/registry/jsr/@std/path/0.220.1/posix/normalize.ts index 8e88ad254b..40ccc59412 100644 --- a/tests/registry/jsr/@std/path/0.220.1/posix/normalize.ts +++ b/tests/registry/jsr/@std/path/0.220.1/posix/normalize.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This module is browser compatible. import { assertArg } from "../_common/normalize.ts"; diff --git a/tests/registry/jsr/@std/url/0.220.1/join.ts b/tests/registry/jsr/@std/url/0.220.1/join.ts index b9c8f19d31..b1f42a0a97 100644 --- a/tests/registry/jsr/@std/url/0.220.1/join.ts +++ b/tests/registry/jsr/@std/url/0.220.1/join.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This module is browser compatible. import { join as posixJoin } from "jsr:@std/path@^0.220.1/posix/join"; diff --git a/tests/registry/jsr/@std/url/0.220.1/normalize.ts b/tests/registry/jsr/@std/url/0.220.1/normalize.ts index e8d728435b..f9d89dd8f9 100644 --- a/tests/registry/jsr/@std/url/0.220.1/normalize.ts +++ b/tests/registry/jsr/@std/url/0.220.1/normalize.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This module is browser compatible. import { normalize as posixNormalize } from "jsr:@std/path@^0.220.1/posix/normalize"; diff --git a/tests/registry/npm/trim_registry_files.js b/tests/registry/npm/trim_registry_files.js index 608624b1d3..e6fbe1353f 100644 --- a/tests/registry/npm/trim_registry_files.js +++ b/tests/registry/npm/trim_registry_files.js @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --allow-write=. --allow-read=. -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Run this to trim the registry.json files diff --git a/tests/specs/cli/otel_basic/basic.ts b/tests/specs/cli/otel_basic/basic.ts index 5c4ae43cd8..1f69277660 100644 --- a/tests/specs/cli/otel_basic/basic.ts +++ b/tests/specs/cli/otel_basic/basic.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { trace } from "npm:@opentelemetry/api@1.9.0"; import "jsr:@deno/otel@0.0.2/register"; diff --git a/tests/specs/cli/otel_basic/main.ts b/tests/specs/cli/otel_basic/main.ts index 634727cea7..608d1d3341 100644 --- a/tests/specs/cli/otel_basic/main.ts +++ b/tests/specs/cli/otel_basic/main.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. const data = { spans: [], diff --git a/tests/specs/mod.rs b/tests/specs/mod.rs index 985a6c7c40..4da5a87d14 100644 --- a/tests/specs/mod.rs +++ b/tests/specs/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::collections::BTreeMap; diff --git a/tests/specs/repl/console_log/093_console_log_format.js b/tests/specs/repl/console_log/093_console_log_format.js index 15022411ca..3ac9988023 100644 --- a/tests/specs/repl/console_log/093_console_log_format.js +++ b/tests/specs/repl/console_log/093_console_log_format.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. class Frac { constructor(num, den) { this.num = num; diff --git a/tests/specs/run/045_proxy/programmatic_proxy_client.ts b/tests/specs/run/045_proxy/programmatic_proxy_client.ts index 73af590c71..c238440755 100644 --- a/tests/specs/run/045_proxy/programmatic_proxy_client.ts +++ b/tests/specs/run/045_proxy/programmatic_proxy_client.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. const client = Deno.createHttpClient({ proxy: { diff --git a/tests/specs/run/045_proxy/proxy_client.ts b/tests/specs/run/045_proxy/proxy_client.ts index 41deae2a5d..13fcc134ba 100644 --- a/tests/specs/run/045_proxy/proxy_client.ts +++ b/tests/specs/run/045_proxy/proxy_client.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. const res = await fetch( "http://localhost:4545/run/045_mod.ts", ); diff --git a/tests/specs/run/045_proxy/proxy_test.ts b/tests/specs/run/045_proxy/proxy_test.ts index 22115a3aa8..04f4c9d06d 100644 --- a/tests/specs/run/045_proxy/proxy_test.ts +++ b/tests/specs/run/045_proxy/proxy_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. const addr = Deno.args[1] || "localhost:4555"; function proxyServer() { diff --git a/tests/specs/run/finalization_registry/finalization_registry.js b/tests/specs/run/finalization_registry/finalization_registry.js index ee9dc384f5..76d68d6df5 100644 --- a/tests/specs/run/finalization_registry/finalization_registry.js +++ b/tests/specs/run/finalization_registry/finalization_registry.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. "use strict"; function assertEquals(a, b) { diff --git a/tests/specs/run/heapstats/heapstats.js b/tests/specs/run/heapstats/heapstats.js index b93c9c120d..c0dc0da81c 100644 --- a/tests/specs/run/heapstats/heapstats.js +++ b/tests/specs/run/heapstats/heapstats.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. "use strict"; function allocTest(alloc, allocAssert, deallocAssert) { diff --git a/tests/specs/run/tls_connecttls/textproto.ts b/tests/specs/run/tls_connecttls/textproto.ts index 9e0f5f5f0a..6b8ac92ecb 100644 --- a/tests/specs/run/tls_connecttls/textproto.ts +++ b/tests/specs/run/tls_connecttls/textproto.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/tests/specs/run/tls_starttls/textproto.ts b/tests/specs/run/tls_starttls/textproto.ts index 9e0f5f5f0a..6b8ac92ecb 100644 --- a/tests/specs/run/tls_starttls/textproto.ts +++ b/tests/specs/run/tls_starttls/textproto.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/tests/specs/run/worker_close_in_wasm_reactions/worker_close_in_wasm_reactions.js b/tests/specs/run/worker_close_in_wasm_reactions/worker_close_in_wasm_reactions.js index 2f62707eff..38508c31c4 100644 --- a/tests/specs/run/worker_close_in_wasm_reactions/worker_close_in_wasm_reactions.js +++ b/tests/specs/run/worker_close_in_wasm_reactions/worker_close_in_wasm_reactions.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // https://github.com/denoland/deno/issues/12263 // Test for a panic that happens when a worker is closed in the reactions of a diff --git a/tests/specs/run/worker_close_nested/close_nested_child.js b/tests/specs/run/worker_close_nested/close_nested_child.js index 97980c689e..1f2b2091a6 100644 --- a/tests/specs/run/worker_close_nested/close_nested_child.js +++ b/tests/specs/run/worker_close_nested/close_nested_child.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. console.log("Starting the child worker"); diff --git a/tests/specs/run/worker_close_nested/close_nested_parent.js b/tests/specs/run/worker_close_nested/close_nested_parent.js index d1fe47553e..ddb9aec26d 100644 --- a/tests/specs/run/worker_close_nested/close_nested_parent.js +++ b/tests/specs/run/worker_close_nested/close_nested_parent.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. console.log("Starting the parent worker"); diff --git a/tests/specs/run/worker_close_nested/worker_close_nested.js b/tests/specs/run/worker_close_nested/worker_close_nested.js index 8d9c88d1cf..179eb48fa1 100644 --- a/tests/specs/run/worker_close_nested/worker_close_nested.js +++ b/tests/specs/run/worker_close_nested/worker_close_nested.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Test that closing a worker which has living child workers will automatically // close the children. diff --git a/tests/specs/run/worker_close_race/close_race_worker.js b/tests/specs/run/worker_close_race/close_race_worker.js index 6964be34a0..945fed9dd0 100644 --- a/tests/specs/run/worker_close_race/close_race_worker.js +++ b/tests/specs/run/worker_close_race/close_race_worker.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. setTimeout(() => { self.postMessage(""); diff --git a/tests/specs/run/worker_close_race/worker_close_race.js b/tests/specs/run/worker_close_race/worker_close_race.js index 188cd9ed88..b39062df50 100644 --- a/tests/specs/run/worker_close_race/worker_close_race.js +++ b/tests/specs/run/worker_close_race/worker_close_race.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // https://github.com/denoland/deno/issues/11416 // Test for a race condition between a worker's `close()` and the main thread's diff --git a/tests/specs/run/worker_drop_handle_race/worker_drop_handle_race.js b/tests/specs/run/worker_drop_handle_race/worker_drop_handle_race.js index ef9bcbe072..bfacc332ac 100644 --- a/tests/specs/run/worker_drop_handle_race/worker_drop_handle_race.js +++ b/tests/specs/run/worker_drop_handle_race/worker_drop_handle_race.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // https://github.com/denoland/deno/issues/11342 // Test for a panic that happens when the main thread's event loop finishes diff --git a/tests/specs/run/worker_drop_handle_race_terminate/worker_drop_handle_race_terminate.js b/tests/specs/run/worker_drop_handle_race_terminate/worker_drop_handle_race_terminate.js index 7c4e0b1099..85a3c51072 100644 --- a/tests/specs/run/worker_drop_handle_race_terminate/worker_drop_handle_race_terminate.js +++ b/tests/specs/run/worker_drop_handle_race_terminate/worker_drop_handle_race_terminate.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Test that the panic in https://github.com/denoland/deno/issues/11342 does not // happen when calling worker.terminate() after fixing diff --git a/tests/testdata/commonjs/example.js b/tests/testdata/commonjs/example.js index d2f89d3f02..0feedb12d4 100644 --- a/tests/testdata/commonjs/example.js +++ b/tests/testdata/commonjs/example.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore no-undef const processMod = require("process"); const osMod = require("node:os"); diff --git a/tests/testdata/run/textproto.ts b/tests/testdata/run/textproto.ts index 9e0f5f5f0a..6b8ac92ecb 100644 --- a/tests/testdata/run/textproto.ts +++ b/tests/testdata/run/textproto.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/tests/testdata/workers/close_nested_child.js b/tests/testdata/workers/close_nested_child.js index 97980c689e..1f2b2091a6 100644 --- a/tests/testdata/workers/close_nested_child.js +++ b/tests/testdata/workers/close_nested_child.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. console.log("Starting the child worker"); diff --git a/tests/testdata/workers/close_nested_parent.js b/tests/testdata/workers/close_nested_parent.js index d1fe47553e..ddb9aec26d 100644 --- a/tests/testdata/workers/close_nested_parent.js +++ b/tests/testdata/workers/close_nested_parent.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. console.log("Starting the parent worker"); diff --git a/tests/testdata/workers/close_race_worker.js b/tests/testdata/workers/close_race_worker.js index 6964be34a0..945fed9dd0 100644 --- a/tests/testdata/workers/close_race_worker.js +++ b/tests/testdata/workers/close_race_worker.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. setTimeout(() => { self.postMessage(""); diff --git a/tests/testdata/workers/http_worker.js b/tests/testdata/workers/http_worker.js index 27bc9c038c..fd11641feb 100644 --- a/tests/testdata/workers/http_worker.js +++ b/tests/testdata/workers/http_worker.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-deprecated-deno-api diff --git a/tests/unit/abort_controller_test.ts b/tests/unit/abort_controller_test.ts index 60ea6aa245..52a1bad803 100644 --- a/tests/unit/abort_controller_test.ts +++ b/tests/unit/abort_controller_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals } from "./test_util.ts"; diff --git a/tests/unit/blob_test.ts b/tests/unit/blob_test.ts index b578253142..b89f4703e2 100644 --- a/tests/unit/blob_test.ts +++ b/tests/unit/blob_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertStringIncludes } from "./test_util.ts"; import { concat } from "@std/bytes/concat"; diff --git a/tests/unit/body_test.ts b/tests/unit/body_test.ts index fb51fd0076..28a1c697b1 100644 --- a/tests/unit/body_test.ts +++ b/tests/unit/body_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertRejects } from "./test_util.ts"; // just a hack to get a body object diff --git a/tests/unit/broadcast_channel_test.ts b/tests/unit/broadcast_channel_test.ts index dce5f10867..f4efe68c4f 100644 --- a/tests/unit/broadcast_channel_test.ts +++ b/tests/unit/broadcast_channel_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "@std/assert"; Deno.test("BroadcastChannel worker", async () => { diff --git a/tests/unit/build_test.ts b/tests/unit/build_test.ts index f697b64d39..9f4e3a5cbf 100644 --- a/tests/unit/build_test.ts +++ b/tests/unit/build_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert } from "./test_util.ts"; Deno.test(function buildInfo() { diff --git a/tests/unit/cache_api_test.ts b/tests/unit/cache_api_test.ts index 08f768e334..ec84e9c908 100644 --- a/tests/unit/cache_api_test.ts +++ b/tests/unit/cache_api_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/chmod_test.ts b/tests/unit/chmod_test.ts index 9ff6301e28..6d815ea1eb 100644 --- a/tests/unit/chmod_test.ts +++ b/tests/unit/chmod_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/chown_test.ts b/tests/unit/chown_test.ts index eda4d34037..99e7dd445a 100644 --- a/tests/unit/chown_test.ts +++ b/tests/unit/chown_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertRejects, assertThrows } from "./test_util.ts"; // chown on Windows is noop for now, so ignore its testing on Windows diff --git a/tests/unit/command_test.ts b/tests/unit/command_test.ts index 8345548f85..268b0c25ba 100644 --- a/tests/unit/command_test.ts +++ b/tests/unit/command_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit/console_test.ts b/tests/unit/console_test.ts index 06f5dd7e61..7b19e49cbd 100644 --- a/tests/unit/console_test.ts +++ b/tests/unit/console_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // TODO(ry) The unit test functions in this module are too coarse. They should // be broken up into smaller bits. diff --git a/tests/unit/copy_file_test.ts b/tests/unit/copy_file_test.ts index 9405184e33..fa4a9d837c 100644 --- a/tests/unit/copy_file_test.ts +++ b/tests/unit/copy_file_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertRejects, assertThrows } from "./test_util.ts"; function readFileString(filename: string | URL): string { diff --git a/tests/unit/cron_test.ts b/tests/unit/cron_test.ts index 5f14f6c784..325ee5535d 100644 --- a/tests/unit/cron_test.ts +++ b/tests/unit/cron_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows } from "./test_util.ts"; // @ts-ignore This is not publicly typed namespace, but it's there for sure. diff --git a/tests/unit/custom_event_test.ts b/tests/unit/custom_event_test.ts index b72084eb23..ddefd4cce6 100644 --- a/tests/unit/custom_event_test.ts +++ b/tests/unit/custom_event_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; Deno.test(function customEventInitializedWithDetail() { diff --git a/tests/unit/dir_test.ts b/tests/unit/dir_test.ts index 1e702f549a..dbf88609c2 100644 --- a/tests/unit/dir_test.ts +++ b/tests/unit/dir_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertThrows } from "./test_util.ts"; Deno.test({ permissions: { read: true } }, function dirCwdNotNull() { diff --git a/tests/unit/dom_exception_test.ts b/tests/unit/dom_exception_test.ts index 4e894f5fc8..2e0c9f71e1 100644 --- a/tests/unit/dom_exception_test.ts +++ b/tests/unit/dom_exception_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit/error_stack_test.ts b/tests/unit/error_stack_test.ts index 7188b9f53d..fea8913494 100644 --- a/tests/unit/error_stack_test.ts +++ b/tests/unit/error_stack_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertMatch } from "./test_util.ts"; Deno.test(function errorStackMessageLine() { diff --git a/tests/unit/error_test.ts b/tests/unit/error_test.ts index bf0ef50627..48e1f7879b 100644 --- a/tests/unit/error_test.ts +++ b/tests/unit/error_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertThrows, fail } from "./test_util.ts"; Deno.test("Errors work", () => { diff --git a/tests/unit/esnext_test.ts b/tests/unit/esnext_test.ts index 1d5759aafa..2c597ef7ba 100644 --- a/tests/unit/esnext_test.ts +++ b/tests/unit/esnext_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; // TODO(@kitsonk) remove when we are no longer patching TypeScript to have diff --git a/tests/unit/event_source_test.ts b/tests/unit/event_source_test.ts index 242c12d6e8..2ce7178b00 100644 --- a/tests/unit/event_source_test.ts +++ b/tests/unit/event_source_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertStrictEquals } from "./test_util.ts"; Deno.test( diff --git a/tests/unit/event_target_test.ts b/tests/unit/event_target_test.ts index 3f7d8ee24a..ca1c496143 100644 --- a/tests/unit/event_target_test.ts +++ b/tests/unit/event_target_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows } from "./test_util.ts"; diff --git a/tests/unit/event_test.ts b/tests/unit/event_test.ts index bd398fd410..d022e1c1d1 100644 --- a/tests/unit/event_test.ts +++ b/tests/unit/event_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertStringIncludes } from "./test_util.ts"; Deno.test(function eventInitializedWithType() { diff --git a/tests/unit/fetch_test.ts b/tests/unit/fetch_test.ts index 298a266903..094b963e19 100644 --- a/tests/unit/fetch_test.ts +++ b/tests/unit/fetch_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/unit/ffi_test.ts b/tests/unit/ffi_test.ts index 98338b15e6..9db0ad0c26 100644 --- a/tests/unit/ffi_test.ts +++ b/tests/unit/ffi_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertRejects, assertThrows } from "./test_util.ts"; diff --git a/tests/unit/file_test.ts b/tests/unit/file_test.ts index 1af3a3f84d..38e4dce64a 100644 --- a/tests/unit/file_test.ts +++ b/tests/unit/file_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals } from "./test_util.ts"; // deno-lint-ignore no-explicit-any diff --git a/tests/unit/filereader_test.ts b/tests/unit/filereader_test.ts index 158cf53835..21ca25ed48 100644 --- a/tests/unit/filereader_test.ts +++ b/tests/unit/filereader_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; Deno.test(function fileReaderConstruct() { diff --git a/tests/unit/files_test.ts b/tests/unit/files_test.ts index c22d3deb77..aa211b224d 100644 --- a/tests/unit/files_test.ts +++ b/tests/unit/files_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit/fs_events_test.ts b/tests/unit/fs_events_test.ts index 7489626b9f..d9bdf454d5 100644 --- a/tests/unit/fs_events_test.ts +++ b/tests/unit/fs_events_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertThrows, delay } from "./test_util.ts"; diff --git a/tests/unit/get_random_values_test.ts b/tests/unit/get_random_values_test.ts index 75aaf4c1b2..47ba78a325 100644 --- a/tests/unit/get_random_values_test.ts +++ b/tests/unit/get_random_values_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertNotEquals, assertStrictEquals } from "./test_util.ts"; Deno.test(function getRandomValuesInt8Array() { diff --git a/tests/unit/globals_test.ts b/tests/unit/globals_test.ts index 6de228e1c9..84773dbf47 100644 --- a/tests/unit/globals_test.ts +++ b/tests/unit/globals_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-node-globals import { diff --git a/tests/unit/headers_test.ts b/tests/unit/headers_test.ts index ea72f784b5..969b2a36f4 100644 --- a/tests/unit/headers_test.ts +++ b/tests/unit/headers_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertThrows } from "./test_util.ts"; const { inspectArgs, diff --git a/tests/unit/http_test.ts b/tests/unit/http_test.ts index 355b155afd..809b36227b 100644 --- a/tests/unit/http_test.ts +++ b/tests/unit/http_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-nocheck `Deno.serveHttp()` was soft-removed in Deno 2. // deno-lint-ignore-file no-deprecated-deno-api diff --git a/tests/unit/image_bitmap_test.ts b/tests/unit/image_bitmap_test.ts index 0066311820..ca5b85c178 100644 --- a/tests/unit/image_bitmap_test.ts +++ b/tests/unit/image_bitmap_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; diff --git a/tests/unit/image_data_test.ts b/tests/unit/image_data_test.ts index 7156301a05..c6dfb0d372 100644 --- a/tests/unit/image_data_test.ts +++ b/tests/unit/image_data_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; diff --git a/tests/unit/internals_test.ts b/tests/unit/internals_test.ts index bb4c21793e..7ca9b6d336 100644 --- a/tests/unit/internals_test.ts +++ b/tests/unit/internals_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert } from "./test_util.ts"; Deno.test(function internalsExists() { diff --git a/tests/unit/intl_test.ts b/tests/unit/intl_test.ts index 6e4de378c9..e177dc45b0 100644 --- a/tests/unit/intl_test.ts +++ b/tests/unit/intl_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; Deno.test("Intl.v8BreakIterator should be undefined", () => { diff --git a/tests/unit/jupyter_test.ts b/tests/unit/jupyter_test.ts index 07defe2305..e29bb2b300 100644 --- a/tests/unit/jupyter_test.ts +++ b/tests/unit/jupyter_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows } from "./test_util.ts"; diff --git a/tests/unit/kv_queue_test.ts b/tests/unit/kv_queue_test.ts index d92977169f..569eb92800 100644 --- a/tests/unit/kv_queue_test.ts +++ b/tests/unit/kv_queue_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertFalse } from "./test_util.ts"; Deno.test({}, async function queueTestDbClose() { diff --git a/tests/unit/kv_queue_test_no_db_close.ts b/tests/unit/kv_queue_test_no_db_close.ts index 947e1c5e62..7c4bbf271e 100644 --- a/tests/unit/kv_queue_test_no_db_close.ts +++ b/tests/unit/kv_queue_test_no_db_close.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertNotEquals } from "./test_util.ts"; Deno.test({ diff --git a/tests/unit/kv_queue_undelivered_test.ts b/tests/unit/kv_queue_undelivered_test.ts index 1fcefe7e26..2fbfefbd69 100644 --- a/tests/unit/kv_queue_undelivered_test.ts +++ b/tests/unit/kv_queue_undelivered_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; const sleep = (time: number) => new Promise((r) => setTimeout(r, time)); diff --git a/tests/unit/kv_test.ts b/tests/unit/kv_test.ts index e603bc196d..b47d3118c7 100644 --- a/tests/unit/kv_test.ts +++ b/tests/unit/kv_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/link_test.ts b/tests/unit/link_test.ts index dfa72479c5..5093c5720d 100644 --- a/tests/unit/link_test.ts +++ b/tests/unit/link_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/lint_plugin_test.ts b/tests/unit/lint_plugin_test.ts index 38a7e1b091..5b00f49d01 100644 --- a/tests/unit/lint_plugin_test.ts +++ b/tests/unit/lint_plugin_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; diff --git a/tests/unit/lint_selectors_test.ts b/tests/unit/lint_selectors_test.ts index 0909a4907a..c116871318 100644 --- a/tests/unit/lint_selectors_test.ts +++ b/tests/unit/lint_selectors_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "@std/assert/equals"; import { diff --git a/tests/unit/make_temp_test.ts b/tests/unit/make_temp_test.ts index 32383387b5..d22b633091 100644 --- a/tests/unit/make_temp_test.ts +++ b/tests/unit/make_temp_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/message_channel_test.ts b/tests/unit/message_channel_test.ts index 0fcbc5e95d..bf7bb6443a 100644 --- a/tests/unit/message_channel_test.ts +++ b/tests/unit/message_channel_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // NOTE: these are just sometests to test the TypeScript types. Real coverage is // provided by WPT. import { assert, assertEquals } from "@std/assert"; diff --git a/tests/unit/mkdir_test.ts b/tests/unit/mkdir_test.ts index def77cd3e4..7b71e4a799 100644 --- a/tests/unit/mkdir_test.ts +++ b/tests/unit/mkdir_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/navigator_test.ts b/tests/unit/navigator_test.ts index 5dcc423fa5..955c34dcc4 100644 --- a/tests/unit/navigator_test.ts +++ b/tests/unit/navigator_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert } from "./test_util.ts"; Deno.test(function navigatorNumCpus() { diff --git a/tests/unit/net_test.ts b/tests/unit/net_test.ts index cfa42b3d36..9c2819c30a 100644 --- a/tests/unit/net_test.ts +++ b/tests/unit/net_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/network_interfaces_test.ts b/tests/unit/network_interfaces_test.ts index 160efbfe60..675400365f 100644 --- a/tests/unit/network_interfaces_test.ts +++ b/tests/unit/network_interfaces_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert } from "./test_util.ts"; diff --git a/tests/unit/ops_test.ts b/tests/unit/ops_test.ts index 631e5c5736..60f67cdca6 100644 --- a/tests/unit/ops_test.ts +++ b/tests/unit/ops_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. const EXPECTED_OP_COUNT = 13; diff --git a/tests/unit/os_test.ts b/tests/unit/os_test.ts index a70796505f..36b6daad2f 100644 --- a/tests/unit/os_test.ts +++ b/tests/unit/os_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/path_from_url_test.ts b/tests/unit/path_from_url_test.ts index b3a6406bcb..3785f2bbb5 100644 --- a/tests/unit/path_from_url_test.ts +++ b/tests/unit/path_from_url_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows } from "./test_util.ts"; diff --git a/tests/unit/performance_test.ts b/tests/unit/performance_test.ts index fa056c7f54..22f51a4ce6 100644 --- a/tests/unit/performance_test.ts +++ b/tests/unit/performance_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/permissions_test.ts b/tests/unit/permissions_test.ts index f981b10fd6..8bb1633423 100644 --- a/tests/unit/permissions_test.ts +++ b/tests/unit/permissions_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/process_test.ts b/tests/unit/process_test.ts index 5cbab3b4c5..17589d8581 100644 --- a/tests/unit/process_test.ts +++ b/tests/unit/process_test.ts @@ -1,5 +1,5 @@ // deno-lint-ignore-file no-deprecated-deno-api -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/progressevent_test.ts b/tests/unit/progressevent_test.ts index 809c2ad391..3e7aa9ec15 100644 --- a/tests/unit/progressevent_test.ts +++ b/tests/unit/progressevent_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; Deno.test(function progressEventConstruct() { diff --git a/tests/unit/promise_hooks_test.ts b/tests/unit/promise_hooks_test.ts index f7c44155d1..7fd7a8f51d 100644 --- a/tests/unit/promise_hooks_test.ts +++ b/tests/unit/promise_hooks_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; diff --git a/tests/unit/quic_test.ts b/tests/unit/quic_test.ts index f5423327de..63163e15d6 100644 --- a/tests/unit/quic_test.ts +++ b/tests/unit/quic_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; diff --git a/tests/unit/read_dir_test.ts b/tests/unit/read_dir_test.ts index b00495eb45..9c5e6da79f 100644 --- a/tests/unit/read_dir_test.ts +++ b/tests/unit/read_dir_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/read_file_test.ts b/tests/unit/read_file_test.ts index 7123833e9c..5716816b37 100644 --- a/tests/unit/read_file_test.ts +++ b/tests/unit/read_file_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/read_link_test.ts b/tests/unit/read_link_test.ts index c89ffe4927..7ecee2d567 100644 --- a/tests/unit/read_link_test.ts +++ b/tests/unit/read_link_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertRejects, diff --git a/tests/unit/read_text_file_test.ts b/tests/unit/read_text_file_test.ts index 1ec57bde35..39cd3e798c 100644 --- a/tests/unit/read_text_file_test.ts +++ b/tests/unit/read_text_file_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit/real_path_test.ts b/tests/unit/real_path_test.ts index 7832846308..79dd0c084f 100644 --- a/tests/unit/real_path_test.ts +++ b/tests/unit/real_path_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/ref_unref_test.ts b/tests/unit/ref_unref_test.ts index 6f5bcf0a77..751f2af387 100644 --- a/tests/unit/ref_unref_test.ts +++ b/tests/unit/ref_unref_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertNotEquals, execCode } from "./test_util.ts"; diff --git a/tests/unit/remove_test.ts b/tests/unit/remove_test.ts index 261ff6bd05..38421f8610 100644 --- a/tests/unit/remove_test.ts +++ b/tests/unit/remove_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertRejects, assertThrows } from "./test_util.ts"; const REMOVE_METHODS = ["remove", "removeSync"] as const; diff --git a/tests/unit/rename_test.ts b/tests/unit/rename_test.ts index 3162c699c6..bacd54c675 100644 --- a/tests/unit/rename_test.ts +++ b/tests/unit/rename_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/request_test.ts b/tests/unit/request_test.ts index fe34c20a50..fa7619cd93 100644 --- a/tests/unit/request_test.ts +++ b/tests/unit/request_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertStringIncludes } from "./test_util.ts"; Deno.test(async function fromInit() { diff --git a/tests/unit/response_test.ts b/tests/unit/response_test.ts index bbdd5f481d..383790af3a 100644 --- a/tests/unit/response_test.ts +++ b/tests/unit/response_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/serve_test.ts b/tests/unit/serve_test.ts index f5896bc64b..7aefd5b7d3 100644 --- a/tests/unit/serve_test.ts +++ b/tests/unit/serve_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/unit/signal_test.ts b/tests/unit/signal_test.ts index 8923aa75bf..bfaa9aac90 100644 --- a/tests/unit/signal_test.ts +++ b/tests/unit/signal_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows, delay } from "./test_util.ts"; Deno.test( diff --git a/tests/unit/stat_test.ts b/tests/unit/stat_test.ts index 0609035b41..0f10f6e2d6 100644 --- a/tests/unit/stat_test.ts +++ b/tests/unit/stat_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit/stdio_test.ts b/tests/unit/stdio_test.ts index d24fdc8efa..c605ccb9ad 100644 --- a/tests/unit/stdio_test.ts +++ b/tests/unit/stdio_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; Deno.test(async function stdioStdinRead() { diff --git a/tests/unit/streams_test.ts b/tests/unit/streams_test.ts index 53225a1553..84a87d166d 100644 --- a/tests/unit/streams_test.ts +++ b/tests/unit/streams_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertRejects, diff --git a/tests/unit/structured_clone_test.ts b/tests/unit/structured_clone_test.ts index 6e0473f9a9..fc5d68e9da 100644 --- a/tests/unit/structured_clone_test.ts +++ b/tests/unit/structured_clone_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertThrows } from "./test_util.ts"; diff --git a/tests/unit/symbol_test.ts b/tests/unit/symbol_test.ts index 54db7f5bae..2dca022b14 100644 --- a/tests/unit/symbol_test.ts +++ b/tests/unit/symbol_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert } from "./test_util.ts"; // Test that `Symbol.metadata` is defined. This file can be removed when V8 diff --git a/tests/unit/symlink_test.ts b/tests/unit/symlink_test.ts index 47a685ec61..cdf0ea5bbd 100644 --- a/tests/unit/symlink_test.ts +++ b/tests/unit/symlink_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertRejects, diff --git a/tests/unit/test_util.ts b/tests/unit/test_util.ts index a987cb5427..6e7865ea7a 100644 --- a/tests/unit/test_util.ts +++ b/tests/unit/test_util.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as colors from "@std/fmt/colors"; import { assert } from "@std/assert"; diff --git a/tests/unit/testing_test.ts b/tests/unit/testing_test.ts index 51372c42b0..96104df9c4 100644 --- a/tests/unit/testing_test.ts +++ b/tests/unit/testing_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertRejects, assertThrows } from "./test_util.ts"; Deno.test(function testWrongOverloads() { diff --git a/tests/unit/text_encoding_test.ts b/tests/unit/text_encoding_test.ts index 719e5907e4..1f378b2125 100644 --- a/tests/unit/text_encoding_test.ts +++ b/tests/unit/text_encoding_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/timers_test.ts b/tests/unit/timers_test.ts index 580d8c524e..29d338c761 100644 --- a/tests/unit/timers_test.ts +++ b/tests/unit/timers_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/unit/tls_sni_test.ts b/tests/unit/tls_sni_test.ts index a8d51108e7..3874753ded 100644 --- a/tests/unit/tls_sni_test.ts +++ b/tests/unit/tls_sni_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertRejects } from "./test_util.ts"; // @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol const { resolverSymbol, serverNameSymbol } = Deno[Deno.internal]; diff --git a/tests/unit/tls_test.ts b/tests/unit/tls_test.ts index 219f4a4508..53db347a13 100644 --- a/tests/unit/tls_test.ts +++ b/tests/unit/tls_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/truncate_test.ts b/tests/unit/truncate_test.ts index cebd6e8ee1..ae41b82271 100644 --- a/tests/unit/truncate_test.ts +++ b/tests/unit/truncate_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertRejects, assertThrows } from "./test_util.ts"; Deno.test( diff --git a/tests/unit/tty_color_test.ts b/tests/unit/tty_color_test.ts index 6f26891e37..a1ca43951c 100644 --- a/tests/unit/tty_color_test.ts +++ b/tests/unit/tty_color_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; // Note tests for Deno.stdin.setRaw is in integration tests. diff --git a/tests/unit/tty_test.ts b/tests/unit/tty_test.ts index 1d29a0b706..352c313b43 100644 --- a/tests/unit/tty_test.ts +++ b/tests/unit/tty_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-deprecated-deno-api diff --git a/tests/unit/umask_test.ts b/tests/unit/umask_test.ts index 0e97f0d353..c7cdd68e4c 100644 --- a/tests/unit/umask_test.ts +++ b/tests/unit/umask_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; Deno.test( diff --git a/tests/unit/url_search_params_test.ts b/tests/unit/url_search_params_test.ts index d682c291a9..9846c7a91c 100644 --- a/tests/unit/url_search_params_test.ts +++ b/tests/unit/url_search_params_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals } from "./test_util.ts"; Deno.test(function urlSearchParamsWithMultipleSpaces() { diff --git a/tests/unit/url_test.ts b/tests/unit/url_test.ts index b0dc86232b..5643fbd258 100644 --- a/tests/unit/url_test.ts +++ b/tests/unit/url_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/urlpattern_test.ts b/tests/unit/urlpattern_test.ts index 3c1fb0cf19..4d815cd042 100644 --- a/tests/unit/urlpattern_test.ts +++ b/tests/unit/urlpattern_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals } from "./test_util.ts"; import { assertType, IsExact } from "@std/testing/types"; diff --git a/tests/unit/utime_test.ts b/tests/unit/utime_test.ts index 7a1fee74eb..5669499aaf 100644 --- a/tests/unit/utime_test.ts +++ b/tests/unit/utime_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, diff --git a/tests/unit/version_test.ts b/tests/unit/version_test.ts index 307295ad87..fd570fb16d 100644 --- a/tests/unit/version_test.ts +++ b/tests/unit/version_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals } from "./test_util.ts"; diff --git a/tests/unit/wasm_test.ts b/tests/unit/wasm_test.ts index 8ee9392f93..80bc468f7d 100644 --- a/tests/unit/wasm_test.ts +++ b/tests/unit/wasm_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertRejects } from "./test_util.ts"; diff --git a/tests/unit/webcrypto_test.ts b/tests/unit/webcrypto_test.ts index 09552a0587..bc5b307de5 100644 --- a/tests/unit/webcrypto_test.ts +++ b/tests/unit/webcrypto_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit/webgpu_test.ts b/tests/unit/webgpu_test.ts index aac75d3420..f7bfc0bbc2 100644 --- a/tests/unit/webgpu_test.ts +++ b/tests/unit/webgpu_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertThrows } from "./test_util.ts"; diff --git a/tests/unit/websocket_test.ts b/tests/unit/websocket_test.ts index d9878828db..1c8c4581bf 100644 --- a/tests/unit/websocket_test.ts +++ b/tests/unit/websocket_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertThrows, fail } from "./test_util.ts"; const servePort = 4248; diff --git a/tests/unit/websocketstream_test.ts.disabled b/tests/unit/websocketstream_test.ts.disabled index 4f8c321c92..7a64318d47 100644 --- a/tests/unit/websocketstream_test.ts.disabled +++ b/tests/unit/websocketstream_test.ts.disabled @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, diff --git a/tests/unit/webstorage_test.ts b/tests/unit/webstorage_test.ts index aa832b1c4b..1c2f9cfa34 100644 --- a/tests/unit/webstorage_test.ts +++ b/tests/unit/webstorage_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any import { assert, assertEquals, assertThrows } from "./test_util.ts"; diff --git a/tests/unit/worker_permissions_test.ts b/tests/unit/worker_permissions_test.ts index 28bf9f92af..20736357f5 100644 --- a/tests/unit/worker_permissions_test.ts +++ b/tests/unit/worker_permissions_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "./test_util.ts"; Deno.test( diff --git a/tests/unit/worker_test.ts b/tests/unit/worker_test.ts index 42c257282c..c0777bb78b 100644 --- a/tests/unit/worker_test.ts +++ b/tests/unit/worker_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/unit/write_file_test.ts b/tests/unit/write_file_test.ts index 15e462cca9..53a5434e04 100644 --- a/tests/unit/write_file_test.ts +++ b/tests/unit/write_file_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit/write_text_file_test.ts b/tests/unit/write_text_file_test.ts index 9e1b75326b..f8209250a1 100644 --- a/tests/unit/write_text_file_test.ts +++ b/tests/unit/write_text_file_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit_node/_fs/_fs_access_test.ts b/tests/unit_node/_fs/_fs_access_test.ts index 0881769f2c..1333d9b7c8 100644 --- a/tests/unit_node/_fs/_fs_access_test.ts +++ b/tests/unit_node/_fs/_fs_access_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as fs from "node:fs"; import { assertRejects, assertThrows } from "@std/assert"; diff --git a/tests/unit_node/_fs/_fs_appendFile_test.ts b/tests/unit_node/_fs/_fs_appendFile_test.ts index 5ee8eabed4..d6f45786cb 100644 --- a/tests/unit_node/_fs/_fs_appendFile_test.ts +++ b/tests/unit_node/_fs/_fs_appendFile_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows, fail } from "@std/assert"; import { appendFile, appendFileSync } from "node:fs"; import { fromFileUrl } from "@std/path"; diff --git a/tests/unit_node/_fs/_fs_chmod_test.ts b/tests/unit_node/_fs/_fs_chmod_test.ts index 97dc9ecdda..db097397e2 100644 --- a/tests/unit_node/_fs/_fs_chmod_test.ts +++ b/tests/unit_node/_fs/_fs_chmod_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertRejects, assertThrows, fail } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { chmod, chmodSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_chown_test.ts b/tests/unit_node/_fs/_fs_chown_test.ts index 6cb2f576ad..d9e6870ac6 100644 --- a/tests/unit_node/_fs/_fs_chown_test.ts +++ b/tests/unit_node/_fs/_fs_chown_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, fail } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { chown, chownSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_close_test.ts b/tests/unit_node/_fs/_fs_close_test.ts index 8880bc0461..62f2d4f05e 100644 --- a/tests/unit_node/_fs/_fs_close_test.ts +++ b/tests/unit_node/_fs/_fs_close_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertThrows, fail } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { close, closeSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_copy_test.ts b/tests/unit_node/_fs/_fs_copy_test.ts index 22f30ea373..b52f1951c6 100644 --- a/tests/unit_node/_fs/_fs_copy_test.ts +++ b/tests/unit_node/_fs/_fs_copy_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as path from "@std/path"; import { assert } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; diff --git a/tests/unit_node/_fs/_fs_dir_test.ts b/tests/unit_node/_fs/_fs_dir_test.ts index 0f41543e92..7da76e50fb 100644 --- a/tests/unit_node/_fs/_fs_dir_test.ts +++ b/tests/unit_node/_fs/_fs_dir_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, fail } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { Dir as DirOrig, type Dirent } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_dirent_test.ts b/tests/unit_node/_fs/_fs_dirent_test.ts index 093617fafd..a709163f4a 100644 --- a/tests/unit_node/_fs/_fs_dirent_test.ts +++ b/tests/unit_node/_fs/_fs_dirent_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertThrows } from "@std/assert"; import { Dirent as Dirent_ } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_exists_test.ts b/tests/unit_node/_fs/_fs_exists_test.ts index 7ed7584ae6..3de7afdc18 100644 --- a/tests/unit_node/_fs/_fs_exists_test.ts +++ b/tests/unit_node/_fs/_fs_exists_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertStringIncludes } from "@std/assert"; import { exists, existsSync } from "node:fs"; import { promisify } from "node:util"; diff --git a/tests/unit_node/_fs/_fs_fdatasync_test.ts b/tests/unit_node/_fs/_fs_fdatasync_test.ts index 40ca2969f9..59c2b5657f 100644 --- a/tests/unit_node/_fs/_fs_fdatasync_test.ts +++ b/tests/unit_node/_fs/_fs_fdatasync_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, fail } from "@std/assert"; import { fdatasync, fdatasyncSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_fstat_test.ts b/tests/unit_node/_fs/_fs_fstat_test.ts index afcac836f6..79e5106525 100644 --- a/tests/unit_node/_fs/_fs_fstat_test.ts +++ b/tests/unit_node/_fs/_fs_fstat_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { fstat, fstatSync } from "node:fs"; import { fail } from "@std/assert"; diff --git a/tests/unit_node/_fs/_fs_fsync_test.ts b/tests/unit_node/_fs/_fs_fsync_test.ts index 3c1509410e..cd01786a2f 100644 --- a/tests/unit_node/_fs/_fs_fsync_test.ts +++ b/tests/unit_node/_fs/_fs_fsync_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, fail } from "@std/assert"; import { fsync, fsyncSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_ftruncate_test.ts b/tests/unit_node/_fs/_fs_ftruncate_test.ts index 974f8f168e..b51ac6c2ca 100644 --- a/tests/unit_node/_fs/_fs_ftruncate_test.ts +++ b/tests/unit_node/_fs/_fs_ftruncate_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows, fail } from "@std/assert"; import { ftruncate, ftruncateSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_futimes_test.ts b/tests/unit_node/_fs/_fs_futimes_test.ts index 9b0c64efd6..207610abed 100644 --- a/tests/unit_node/_fs/_fs_futimes_test.ts +++ b/tests/unit_node/_fs/_fs_futimes_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows, fail } from "@std/assert"; import { futimes, futimesSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_handle_test.ts b/tests/unit_node/_fs/_fs_handle_test.ts index 84d72c0745..61214bde26 100644 --- a/tests/unit_node/_fs/_fs_handle_test.ts +++ b/tests/unit_node/_fs/_fs_handle_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as path from "@std/path"; import { Buffer } from "node:buffer"; import * as fs from "node:fs/promises"; diff --git a/tests/unit_node/_fs/_fs_link_test.ts b/tests/unit_node/_fs/_fs_link_test.ts index 3062db7a67..fca1dfe869 100644 --- a/tests/unit_node/_fs/_fs_link_test.ts +++ b/tests/unit_node/_fs/_fs_link_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as path from "@std/path"; import { assert, assertEquals, fail } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; diff --git a/tests/unit_node/_fs/_fs_lstat_test.ts b/tests/unit_node/_fs/_fs_lstat_test.ts index 6a42443452..196d5f23b7 100644 --- a/tests/unit_node/_fs/_fs_lstat_test.ts +++ b/tests/unit_node/_fs/_fs_lstat_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { lstat, lstatSync } from "node:fs"; import { fail } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; diff --git a/tests/unit_node/_fs/_fs_mkdir_test.ts b/tests/unit_node/_fs/_fs_mkdir_test.ts index b9f6adf44c..d3476a23a7 100644 --- a/tests/unit_node/_fs/_fs_mkdir_test.ts +++ b/tests/unit_node/_fs/_fs_mkdir_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as path from "@std/path"; import { assert } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; diff --git a/tests/unit_node/_fs/_fs_mkdtemp_test.ts b/tests/unit_node/_fs/_fs_mkdtemp_test.ts index 47530b495a..4e130d4b9d 100644 --- a/tests/unit_node/_fs/_fs_mkdtemp_test.ts +++ b/tests/unit_node/_fs/_fs_mkdtemp_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertRejects, assertThrows } from "@std/assert"; import { EncodingOption, existsSync, mkdtemp, mkdtempSync } from "node:fs"; import { env } from "node:process"; diff --git a/tests/unit_node/_fs/_fs_open_test.ts b/tests/unit_node/_fs/_fs_open_test.ts index b4679cbab6..cd8cdf791b 100644 --- a/tests/unit_node/_fs/_fs_open_test.ts +++ b/tests/unit_node/_fs/_fs_open_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { O_APPEND, O_CREAT, diff --git a/tests/unit_node/_fs/_fs_opendir_test.ts b/tests/unit_node/_fs/_fs_opendir_test.ts index e22a47a702..37200d364f 100644 --- a/tests/unit_node/_fs/_fs_opendir_test.ts +++ b/tests/unit_node/_fs/_fs_opendir_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit_node/_fs/_fs_readFile_test.ts b/tests/unit_node/_fs/_fs_readFile_test.ts index a75f12d1f6..0903777bca 100644 --- a/tests/unit_node/_fs/_fs_readFile_test.ts +++ b/tests/unit_node/_fs/_fs_readFile_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { promises, readFile, readFileSync } from "node:fs"; import * as path from "@std/path"; diff --git a/tests/unit_node/_fs/_fs_read_test.ts b/tests/unit_node/_fs/_fs_read_test.ts index 867ec01c5c..6def1ff71d 100644 --- a/tests/unit_node/_fs/_fs_read_test.ts +++ b/tests/unit_node/_fs/_fs_read_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// import { assert, diff --git a/tests/unit_node/_fs/_fs_readdir_test.ts b/tests/unit_node/_fs/_fs_readdir_test.ts index 3e36b1dc2d..b5071b5777 100644 --- a/tests/unit_node/_fs/_fs_readdir_test.ts +++ b/tests/unit_node/_fs/_fs_readdir_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertNotEquals, fail } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { readdir, readdirSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_readlink_test.ts b/tests/unit_node/_fs/_fs_readlink_test.ts index 23c5e3896e..9443f2903f 100644 --- a/tests/unit_node/_fs/_fs_readlink_test.ts +++ b/tests/unit_node/_fs/_fs_readlink_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { readlink, readlinkSync } from "node:fs"; import { assert, assertEquals } from "@std/assert"; diff --git a/tests/unit_node/_fs/_fs_realpath_test.ts b/tests/unit_node/_fs/_fs_realpath_test.ts index b0285cf545..25d266c4bf 100644 --- a/tests/unit_node/_fs/_fs_realpath_test.ts +++ b/tests/unit_node/_fs/_fs_realpath_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as path from "@std/path"; import { assertEquals } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; diff --git a/tests/unit_node/_fs/_fs_rename_test.ts b/tests/unit_node/_fs/_fs_rename_test.ts index 76d2e13141..91185e02a2 100644 --- a/tests/unit_node/_fs/_fs_rename_test.ts +++ b/tests/unit_node/_fs/_fs_rename_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, fail } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { rename, renameSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_rm_test.ts b/tests/unit_node/_fs/_fs_rm_test.ts index 6ded2e5645..da02b60f30 100644 --- a/tests/unit_node/_fs/_fs_rm_test.ts +++ b/tests/unit_node/_fs/_fs_rm_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertRejects, assertThrows, fail } from "@std/assert"; import { rm, rmSync } from "node:fs"; import { existsSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_rmdir_test.ts b/tests/unit_node/_fs/_fs_rmdir_test.ts index db0c692a40..90d2c7c8a8 100644 --- a/tests/unit_node/_fs/_fs_rmdir_test.ts +++ b/tests/unit_node/_fs/_fs_rmdir_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, fail } from "@std/assert"; import { rmdir, rmdirSync } from "node:fs"; import { existsSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_stat_test.ts b/tests/unit_node/_fs/_fs_stat_test.ts index 3cbbe940b0..d10521d0cd 100644 --- a/tests/unit_node/_fs/_fs_stat_test.ts +++ b/tests/unit_node/_fs/_fs_stat_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { BigIntStats, stat, Stats, statSync } from "node:fs"; import { assert, assertEquals, fail } from "@std/assert"; diff --git a/tests/unit_node/_fs/_fs_statfs_test.ts b/tests/unit_node/_fs/_fs_statfs_test.ts index fc85bcf174..51cbb0e552 100644 --- a/tests/unit_node/_fs/_fs_statfs_test.ts +++ b/tests/unit_node/_fs/_fs_statfs_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as fs from "node:fs"; import { assertEquals, assertRejects } from "@std/assert"; diff --git a/tests/unit_node/_fs/_fs_symlink_test.ts b/tests/unit_node/_fs/_fs_symlink_test.ts index dfd6adb51a..d4a86bfc0f 100644 --- a/tests/unit_node/_fs/_fs_symlink_test.ts +++ b/tests/unit_node/_fs/_fs_symlink_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertThrows, fail } from "@std/assert"; import { symlink, symlinkSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_truncate_test.ts b/tests/unit_node/_fs/_fs_truncate_test.ts index 67bd021e45..ebb33a0c29 100644 --- a/tests/unit_node/_fs/_fs_truncate_test.ts +++ b/tests/unit_node/_fs/_fs_truncate_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows, fail } from "@std/assert"; import { truncate, truncateSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_unlink_test.ts b/tests/unit_node/_fs/_fs_unlink_test.ts index f96217f8ef..a48ef58bc7 100644 --- a/tests/unit_node/_fs/_fs_unlink_test.ts +++ b/tests/unit_node/_fs/_fs_unlink_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, fail } from "@std/assert"; import { existsSync } from "node:fs"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; diff --git a/tests/unit_node/_fs/_fs_utimes_test.ts b/tests/unit_node/_fs/_fs_utimes_test.ts index 717d511c06..56233973ac 100644 --- a/tests/unit_node/_fs/_fs_utimes_test.ts +++ b/tests/unit_node/_fs/_fs_utimes_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows, fail } from "@std/assert"; import { utimes, utimesSync } from "node:fs"; diff --git a/tests/unit_node/_fs/_fs_watch_test.ts b/tests/unit_node/_fs/_fs_watch_test.ts index 963e0889f1..d611202066 100644 --- a/tests/unit_node/_fs/_fs_watch_test.ts +++ b/tests/unit_node/_fs/_fs_watch_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { unwatchFile, watch, watchFile } from "node:fs"; import { watch as watchPromise } from "node:fs/promises"; import { assert, assertEquals } from "@std/assert"; diff --git a/tests/unit_node/_fs/_fs_writeFile_test.ts b/tests/unit_node/_fs/_fs_writeFile_test.ts index 2733a2df0b..503faf8f4c 100644 --- a/tests/unit_node/_fs/_fs_writeFile_test.ts +++ b/tests/unit_node/_fs/_fs_writeFile_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, diff --git a/tests/unit_node/_fs/_fs_write_test.ts b/tests/unit_node/_fs/_fs_write_test.ts index 400fce73aa..6a5d4c9c26 100644 --- a/tests/unit_node/_fs/_fs_write_test.ts +++ b/tests/unit_node/_fs/_fs_write_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/unit_node/_test_utils.ts b/tests/unit_node/_test_utils.ts index c451ccd84b..a78444fd4a 100644 --- a/tests/unit_node/_test_utils.ts +++ b/tests/unit_node/_test_utils.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertStringIncludes } from "@std/assert"; diff --git a/tests/unit_node/assert_test.ts b/tests/unit_node/assert_test.ts index dc565458f6..f6dc18836d 100644 --- a/tests/unit_node/assert_test.ts +++ b/tests/unit_node/assert_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as assert from "node:assert"; Deno.test("[node/assert] .throws() compares Error instance", () => { diff --git a/tests/unit_node/assertion_error_test.ts b/tests/unit_node/assertion_error_test.ts index 4f8fe70ba5..60b0020d90 100644 --- a/tests/unit_node/assertion_error_test.ts +++ b/tests/unit_node/assertion_error_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { stripAnsiCode } from "@std/fmt/colors"; import { assert, assertStrictEquals } from "@std/assert"; import { AssertionError } from "node:assert"; diff --git a/tests/unit_node/async_hooks_test.ts b/tests/unit_node/async_hooks_test.ts index edad57bf76..d76898bcf5 100644 --- a/tests/unit_node/async_hooks_test.ts +++ b/tests/unit_node/async_hooks_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { AsyncLocalStorage, AsyncResource } from "node:async_hooks"; import process from "node:process"; import { setImmediate } from "node:timers"; diff --git a/tests/unit_node/buffer_test.ts b/tests/unit_node/buffer_test.ts index bd7f6edb17..3929769ffa 100644 --- a/tests/unit_node/buffer_test.ts +++ b/tests/unit_node/buffer_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { Buffer } from "node:buffer"; import { assertEquals, assertThrows } from "@std/assert"; diff --git a/tests/unit_node/child_process_test.ts b/tests/unit_node/child_process_test.ts index 0ea3c46cf0..bd875ad419 100644 --- a/tests/unit_node/child_process_test.ts +++ b/tests/unit_node/child_process_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import CP from "node:child_process"; import { Buffer } from "node:buffer"; diff --git a/tests/unit_node/cluster_test.ts b/tests/unit_node/cluster_test.ts index d9a59ae63a..e0335c4824 100644 --- a/tests/unit_node/cluster_test.ts +++ b/tests/unit_node/cluster_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "@std/assert"; import cluster from "node:cluster"; import * as clusterNamed from "node:cluster"; diff --git a/tests/unit_node/console_test.ts b/tests/unit_node/console_test.ts index 25d4a78e57..a9e3551074 100644 --- a/tests/unit_node/console_test.ts +++ b/tests/unit_node/console_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import vm from "node:vm"; import { stripAnsiCode } from "@std/fmt/colors"; diff --git a/tests/unit_node/crypto/crypto_cipher_gcm_test.ts b/tests/unit_node/crypto/crypto_cipher_gcm_test.ts index 16f6f56a9c..dd02ee5e32 100644 --- a/tests/unit_node/crypto/crypto_cipher_gcm_test.ts +++ b/tests/unit_node/crypto/crypto_cipher_gcm_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import crypto from "node:crypto"; import { Buffer } from "node:buffer"; diff --git a/tests/unit_node/crypto/crypto_cipher_test.ts b/tests/unit_node/crypto/crypto_cipher_test.ts index e40625c5a4..bc001c8d0f 100644 --- a/tests/unit_node/crypto/crypto_cipher_test.ts +++ b/tests/unit_node/crypto/crypto_cipher_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import crypto from "node:crypto"; import { Buffer } from "node:buffer"; import { Readable } from "node:stream"; diff --git a/tests/unit_node/crypto/crypto_hash_test.ts b/tests/unit_node/crypto/crypto_hash_test.ts index 0d4e307096..0a3fd2245e 100644 --- a/tests/unit_node/crypto/crypto_hash_test.ts +++ b/tests/unit_node/crypto/crypto_hash_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { createHash, createHmac, getHashes } from "node:crypto"; import { Buffer } from "node:buffer"; import { Readable } from "node:stream"; diff --git a/tests/unit_node/crypto/crypto_hkdf_test.ts b/tests/unit_node/crypto/crypto_hkdf_test.ts index 34102fd03d..dc128db584 100644 --- a/tests/unit_node/crypto/crypto_hkdf_test.ts +++ b/tests/unit_node/crypto/crypto_hkdf_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { hkdfSync } from "node:crypto"; import { assertEquals } from "@std/assert"; import { Buffer } from "node:buffer"; diff --git a/tests/unit_node/crypto/crypto_import_export.ts b/tests/unit_node/crypto/crypto_import_export.ts index fc41cbacc2..458178d578 100644 --- a/tests/unit_node/crypto/crypto_import_export.ts +++ b/tests/unit_node/crypto/crypto_import_export.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import crypto, { KeyFormat } from "node:crypto"; import path from "node:path"; import { Buffer } from "node:buffer"; diff --git a/tests/unit_node/crypto/crypto_key_test.ts b/tests/unit_node/crypto/crypto_key_test.ts index 5d206acc72..ac54a35419 100644 --- a/tests/unit_node/crypto/crypto_key_test.ts +++ b/tests/unit_node/crypto/crypto_key_test.ts @@ -1,6 +1,6 @@ // deno-lint-ignore-file no-explicit-any -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { createECDH, createHmac, @@ -700,3 +700,19 @@ Deno.test("generateKeyPair promisify", async () => { assert(publicKey.startsWith("-----BEGIN PUBLIC KEY-----")); assert(privateKey.startsWith("-----BEGIN PRIVATE KEY-----")); }); + +Deno.test("RSA export private JWK", function () { + // @ts-ignore @types/node broken + const { privateKey, publicKey } = generateKeyPairSync("rsa", { + modulusLength: 4096, + publicKeyEncoding: { + format: "jwk", + }, + privateKeyEncoding: { + format: "jwk", + }, + }); + + assertEquals((privateKey as any).kty, "RSA"); + assertEquals((privateKey as any).n, (publicKey as any).n); +}); diff --git a/tests/unit_node/crypto/crypto_misc_test.ts b/tests/unit_node/crypto/crypto_misc_test.ts index 9f72683398..3c49edd388 100644 --- a/tests/unit_node/crypto/crypto_misc_test.ts +++ b/tests/unit_node/crypto/crypto_misc_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { randomFillSync, randomUUID, timingSafeEqual } from "node:crypto"; import { Buffer } from "node:buffer"; import { assert, assertEquals, assertThrows } from "../../unit/test_util.ts"; diff --git a/tests/unit_node/crypto/crypto_pbkdf2_test.ts b/tests/unit_node/crypto/crypto_pbkdf2_test.ts index c937eb0c47..5eb4b82210 100644 --- a/tests/unit_node/crypto/crypto_pbkdf2_test.ts +++ b/tests/unit_node/crypto/crypto_pbkdf2_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { pbkdf2, pbkdf2Sync } from "node:crypto"; import { assert, assertEquals } from "@std/assert"; import nodeFixtures from "../testdata/crypto_digest_fixtures.json" with { diff --git a/tests/unit_node/crypto/crypto_scrypt_test.ts b/tests/unit_node/crypto/crypto_scrypt_test.ts index 03c08909ea..3f4d1437f0 100644 --- a/tests/unit_node/crypto/crypto_scrypt_test.ts +++ b/tests/unit_node/crypto/crypto_scrypt_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { scrypt, scryptSync } from "node:crypto"; import { Buffer } from "node:buffer"; import { assertEquals } from "@std/assert"; diff --git a/tests/unit_node/crypto/crypto_sign_test.ts b/tests/unit_node/crypto/crypto_sign_test.ts index 97c80b28af..24b049ca36 100644 --- a/tests/unit_node/crypto/crypto_sign_test.ts +++ b/tests/unit_node/crypto/crypto_sign_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals } from "@std/assert"; import { diff --git a/tests/unit_node/crypto/generate_fixture.mjs b/tests/unit_node/crypto/generate_fixture.mjs index 3724fe4aff..3fb78e82c4 100644 --- a/tests/unit_node/crypto/generate_fixture.mjs +++ b/tests/unit_node/crypto/generate_fixture.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Run this file with `node` to regenerate the testdata/crypto_digest_fixtures.json file. import { readFileSync, writeFileSync } from "node:fs"; diff --git a/tests/unit_node/crypto/generate_keys.mjs b/tests/unit_node/crypto/generate_keys.mjs index 29d9f570f3..d422729a29 100644 --- a/tests/unit_node/crypto/generate_keys.mjs +++ b/tests/unit_node/crypto/generate_keys.mjs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { writeFileSync } from "node:fs"; import { join } from "node:path"; diff --git a/tests/unit_node/dgram_test.ts b/tests/unit_node/dgram_test.ts index 2ccdfbfb7a..521b2448ad 100644 --- a/tests/unit_node/dgram_test.ts +++ b/tests/unit_node/dgram_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "@std/assert"; import { execCode } from "../unit/test_util.ts"; diff --git a/tests/unit_node/domain_test.ts b/tests/unit_node/domain_test.ts index ddc56efae3..59b2c57b77 100644 --- a/tests/unit_node/domain_test.ts +++ b/tests/unit_node/domain_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Copyright © Benjamin Lupton // This code has been forked by https://github.com/bevry/domain-browser/commit/8bce7f4a093966ca850da75b024239ad5d0b33c6 diff --git a/tests/unit_node/events_test.ts b/tests/unit_node/events_test.ts index 8cfef6319a..152ace787b 100644 --- a/tests/unit_node/events_test.ts +++ b/tests/unit_node/events_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import events, { addAbortListener, EventEmitter } from "node:events"; diff --git a/tests/unit_node/fetch_test.ts b/tests/unit_node/fetch_test.ts index 399d6052a5..d005fd1d6e 100644 --- a/tests/unit_node/fetch_test.ts +++ b/tests/unit_node/fetch_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "@std/assert"; import { createReadStream } from "node:fs"; diff --git a/tests/unit_node/fs_test.ts b/tests/unit_node/fs_test.ts index 32bea40e75..2dcd45529f 100644 --- a/tests/unit_node/fs_test.ts +++ b/tests/unit_node/fs_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// import { assert, assertEquals, assertRejects, assertThrows } from "@std/assert"; diff --git a/tests/unit_node/http2_test.ts b/tests/unit_node/http2_test.ts index 90f2388124..698e6b4ebe 100644 --- a/tests/unit_node/http2_test.ts +++ b/tests/unit_node/http2_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/unit_node/http_test.ts b/tests/unit_node/http_test.ts index f30a4a20a3..7478546617 100644 --- a/tests/unit_node/http_test.ts +++ b/tests/unit_node/http_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/unit_node/inspector_test.ts b/tests/unit_node/inspector_test.ts index a53e977bb6..ed94332108 100644 --- a/tests/unit_node/inspector_test.ts +++ b/tests/unit_node/inspector_test.ts @@ -1,5 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import inspector, { Session } from "node:inspector"; +import inspectorPromises, { + Session as SessionPromise, +} from "node:inspector/promises"; import { assertEquals } from "@std/assert/equals"; Deno.test("[node/inspector] - importing inspector works", () => { @@ -9,3 +12,11 @@ Deno.test("[node/inspector] - importing inspector works", () => { Deno.test("[node/inspector] - Session constructor should not throw", () => { new Session(); }); + +Deno.test("[node/inspector/promises] - importing inspector works", () => { + assertEquals(typeof inspectorPromises.open, "function"); +}); + +Deno.test("[node/inspector/promises] - Session constructor should not throw", () => { + new SessionPromise(); +}); diff --git a/tests/unit_node/internal/_randomBytes_test.ts b/tests/unit_node/internal/_randomBytes_test.ts index ff3acf5e38..d479f44e76 100644 --- a/tests/unit_node/internal/_randomBytes_test.ts +++ b/tests/unit_node/internal/_randomBytes_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals, assertRejects, assertThrows } from "@std/assert"; import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { pseudoRandomBytes, randomBytes } from "node:crypto"; diff --git a/tests/unit_node/internal/_randomFill_test.ts b/tests/unit_node/internal/_randomFill_test.ts index 7b590666cd..d865b75f39 100644 --- a/tests/unit_node/internal/_randomFill_test.ts +++ b/tests/unit_node/internal/_randomFill_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { Buffer } from "node:buffer"; import { randomFill, randomFillSync } from "node:crypto"; import { assertEquals, assertNotEquals, assertThrows } from "@std/assert"; diff --git a/tests/unit_node/internal/_randomInt_test.ts b/tests/unit_node/internal/_randomInt_test.ts index b0d9d771ee..ec2f869551 100644 --- a/tests/unit_node/internal/_randomInt_test.ts +++ b/tests/unit_node/internal/_randomInt_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { randomInt } from "node:crypto"; import { assert, assertThrows } from "@std/assert"; diff --git a/tests/unit_node/module_test.ts b/tests/unit_node/module_test.ts index 96c3504bd2..728a339fb6 100644 --- a/tests/unit_node/module_test.ts +++ b/tests/unit_node/module_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { builtinModules, diff --git a/tests/unit_node/net_test.ts b/tests/unit_node/net_test.ts index 83d751866f..1142e6201d 100644 --- a/tests/unit_node/net_test.ts +++ b/tests/unit_node/net_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tests/unit_node/os_test.ts b/tests/unit_node/os_test.ts index 78636e755d..99ad82c031 100644 --- a/tests/unit_node/os_test.ts +++ b/tests/unit_node/os_test.ts @@ -1,5 +1,5 @@ // deno-lint-ignore-file no-undef -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import os from "node:os"; import { diff --git a/tests/unit_node/path_test.ts b/tests/unit_node/path_test.ts index bd0711334d..63aa5ee2c1 100644 --- a/tests/unit_node/path_test.ts +++ b/tests/unit_node/path_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import path from "node:path"; import posix from "node:path/posix"; diff --git a/tests/unit_node/perf_hooks_test.ts b/tests/unit_node/perf_hooks_test.ts index 83d0062228..a77dd08538 100644 --- a/tests/unit_node/perf_hooks_test.ts +++ b/tests/unit_node/perf_hooks_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as perfHooks from "node:perf_hooks"; import { monitorEventLoopDelay, diff --git a/tests/unit_node/process_test.ts b/tests/unit_node/process_test.ts index 49de2dce1d..592bd6497f 100644 --- a/tests/unit_node/process_test.ts +++ b/tests/unit_node/process_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-undef no-console diff --git a/tests/unit_node/punycode_test.ts b/tests/unit_node/punycode_test.ts index fffa26164f..d4fa5b50a0 100644 --- a/tests/unit_node/punycode_test.ts +++ b/tests/unit_node/punycode_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import * as punycode from "node:punycode"; import { assertEquals } from "@std/assert"; diff --git a/tests/unit_node/querystring_test.ts b/tests/unit_node/querystring_test.ts index 09672df370..d57941264c 100644 --- a/tests/unit_node/querystring_test.ts +++ b/tests/unit_node/querystring_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "@std/assert"; import { parse, stringify } from "node:querystring"; diff --git a/tests/unit_node/readline_test.ts b/tests/unit_node/readline_test.ts index 68f0cd7c92..02fd6958bf 100644 --- a/tests/unit_node/readline_test.ts +++ b/tests/unit_node/readline_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { createInterface, Interface } from "node:readline"; import { assertInstanceOf } from "@std/assert"; import { Readable, Writable } from "node:stream"; diff --git a/tests/unit_node/repl_test.ts b/tests/unit_node/repl_test.ts index 693fdcc9eb..d0759f442f 100644 --- a/tests/unit_node/repl_test.ts +++ b/tests/unit_node/repl_test.ts @@ -1,5 +1,5 @@ // deno-lint-ignore-file no-undef -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import repl from "node:repl"; import { assert } from "@std/assert"; diff --git a/tests/unit_node/stream_test.ts b/tests/unit_node/stream_test.ts index b8542f6cfd..9c58ae03d6 100644 --- a/tests/unit_node/stream_test.ts +++ b/tests/unit_node/stream_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals } from "@std/assert"; import { fromFileUrl, relative } from "@std/path"; diff --git a/tests/unit_node/string_decoder_test.ts b/tests/unit_node/string_decoder_test.ts index 34fbdd8810..1062373422 100644 --- a/tests/unit_node/string_decoder_test.ts +++ b/tests/unit_node/string_decoder_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals } from "@std/assert"; import { Buffer } from "node:buffer"; import { StringDecoder } from "node:string_decoder"; diff --git a/tests/unit_node/timers_test.ts b/tests/unit_node/timers_test.ts index ecff32e763..43a3338096 100644 --- a/tests/unit_node/timers_test.ts +++ b/tests/unit_node/timers_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, fail } from "@std/assert"; import * as timers from "node:timers"; diff --git a/tests/unit_node/tls_test.ts b/tests/unit_node/tls_test.ts index 627b948cd1..f34d9efb5b 100644 --- a/tests/unit_node/tls_test.ts +++ b/tests/unit_node/tls_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit_node/tty_test.ts b/tests/unit_node/tty_test.ts index df2888ddd0..9acf9be614 100644 --- a/tests/unit_node/tty_test.ts +++ b/tests/unit_node/tty_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any import { assert } from "@std/assert"; diff --git a/tests/unit_node/util_test.ts b/tests/unit_node/util_test.ts index af174b0f4d..0f83bb1b9a 100644 --- a/tests/unit_node/util_test.ts +++ b/tests/unit_node/util_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit_node/v8_test.ts b/tests/unit_node/v8_test.ts index f7208fb0ef..7262ccd1fb 100644 --- a/tests/unit_node/v8_test.ts +++ b/tests/unit_node/v8_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { cachedDataVersionTag, deserialize, diff --git a/tests/unit_node/vm_test.ts b/tests/unit_node/vm_test.ts index 85b9556637..2876208e2f 100644 --- a/tests/unit_node/vm_test.ts +++ b/tests/unit_node/vm_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assertEquals, assertThrows } from "@std/assert"; import { createContext, diff --git a/tests/unit_node/wasi_test.ts b/tests/unit_node/wasi_test.ts index 6af2d4b1db..ae174e961b 100644 --- a/tests/unit_node/wasi_test.ts +++ b/tests/unit_node/wasi_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import wasi from "node:wasi"; import { assertThrows } from "@std/assert"; diff --git a/tests/unit_node/worker_threads_test.ts b/tests/unit_node/worker_threads_test.ts index 5f38d51d4d..c994b91eb1 100644 --- a/tests/unit_node/worker_threads_test.ts +++ b/tests/unit_node/worker_threads_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, diff --git a/tests/unit_node/zlib_test.ts b/tests/unit_node/zlib_test.ts index de2d2450d1..fb066a30d1 100644 --- a/tests/unit_node/zlib_test.ts +++ b/tests/unit_node/zlib_test.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { assert, assertEquals } from "@std/assert"; import { fromFileUrl, relative } from "@std/path"; diff --git a/tests/util/server/Cargo.toml b/tests/util/server/Cargo.toml index efc81da17c..aec9f6e91c 100644 --- a/tests/util/server/Cargo.toml +++ b/tests/util/server/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2025 the Deno authors. MIT license. [package] name = "test_server" diff --git a/tests/util/server/src/assertions.rs b/tests/util/server/src/assertions.rs index c8b8845f4c..9eb39fb4a8 100644 --- a/tests/util/server/src/assertions.rs +++ b/tests/util/server/src/assertions.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::io::Write; diff --git a/tests/util/server/src/builders.rs b/tests/util/server/src/builders.rs index 1cc1af2812..d5df8d09c8 100644 --- a/tests/util/server/src/builders.rs +++ b/tests/util/server/src/builders.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::cell::RefCell; use std::collections::HashMap; diff --git a/tests/util/server/src/factory.rs b/tests/util/server/src/factory.rs index 5b796fbc1d..a13d673971 100644 --- a/tests/util/server/src/factory.rs +++ b/tests/util/server/src/factory.rs @@ -1,8 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use glob::glob; +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashSet; use std::path::PathBuf; +use glob::glob; + /// Generate a unit test factory verified and backed by a glob. #[macro_export] macro_rules! unit_test_factory { diff --git a/tests/util/server/src/fs.rs b/tests/util/server/src/fs.rs index 7feb0799ae..19b94731eb 100644 --- a/tests/util/server/src/fs.rs +++ b/tests/util/server/src/fs.rs @@ -1,7 +1,5 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use lsp_types::Uri; -use pretty_assertions::assert_eq; use std::borrow::Cow; use std::collections::HashSet; use std::ffi::OsStr; @@ -15,6 +13,8 @@ use std::str::FromStr; use std::sync::Arc; use anyhow::Context; +use lsp_types::Uri; +use pretty_assertions::assert_eq; use serde::de::DeserializeOwned; use serde::Serialize; use url::Url; diff --git a/tests/util/server/src/https.rs b/tests/util/server/src/https.rs index 617fd5cae2..f3fc1291fe 100644 --- a/tests/util/server/src/https.rs +++ b/tests/util/server/src/https.rs @@ -1,4 +1,9 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. +use std::io; +use std::num::NonZeroUsize; +use std::result::Result; +use std::sync::Arc; + use anyhow::anyhow; use futures::Stream; use futures::StreamExt; @@ -6,10 +11,6 @@ use rustls_tokio_stream::rustls; use rustls_tokio_stream::rustls::pki_types::CertificateDer; use rustls_tokio_stream::rustls::pki_types::PrivateKeyDer; use rustls_tokio_stream::TlsStream; -use std::io; -use std::num::NonZeroUsize; -use std::result::Result; -use std::sync::Arc; use tokio::net::TcpStream; use crate::get_tcp_listener_stream; diff --git a/tests/util/server/src/lib.rs b/tests/util/server/src/lib.rs index 531944bf6a..477568ab1b 100644 --- a/tests/util/server/src/lib.rs +++ b/tests/util/server/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::env; @@ -1296,9 +1296,10 @@ pub(crate) mod colors { #[cfg(test)] mod tests { - use super::*; use pretty_assertions::assert_eq; + use super::*; + #[test] fn parse_wrk_output_1() { const TEXT: &str = include_str!("./testdata/wrk1.txt"); diff --git a/tests/util/server/src/lsp.rs b/tests/util/server/src/lsp.rs index 92169ee644..8b16d17c6f 100644 --- a/tests/util/server/src/lsp.rs +++ b/tests/util/server/src/lsp.rs @@ -1,11 +1,24 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::deno_exe_path; -use crate::jsr_registry_url; -use crate::npm_registry_url; -use crate::PathRef; - -use super::TempDir; +use std::collections::HashMap; +use std::collections::HashSet; +use std::ffi::OsStr; +use std::ffi::OsString; +use std::io; +use std::io::BufRead; +use std::io::BufReader; +use std::io::Write; +use std::path::Path; +use std::process::Child; +use std::process::ChildStdin; +use std::process::ChildStdout; +use std::process::Command; +use std::process::Stdio; +use std::str::FromStr; +use std::sync::mpsc; +use std::sync::Arc; +use std::time::Duration; +use std::time::Instant; use anyhow::Result; use lsp_types as lsp; @@ -32,27 +45,14 @@ use serde::Serialize; use serde_json::json; use serde_json::to_value; use serde_json::Value; -use std::collections::HashMap; -use std::collections::HashSet; -use std::ffi::OsStr; -use std::ffi::OsString; -use std::io; -use std::io::BufRead; -use std::io::BufReader; -use std::io::Write; -use std::path::Path; -use std::process::Child; -use std::process::ChildStdin; -use std::process::ChildStdout; -use std::process::Command; -use std::process::Stdio; -use std::str::FromStr; -use std::sync::mpsc; -use std::sync::Arc; -use std::time::Duration; -use std::time::Instant; use url::Url; +use super::TempDir; +use crate::deno_exe_path; +use crate::jsr_registry_url; +use crate::npm_registry_url; +use crate::PathRef; + static CONTENT_TYPE_REG: Lazy = lazy_regex::lazy_regex!(r"(?i)^content-length:\s+(\d+)"); diff --git a/tests/util/server/src/macros.rs b/tests/util/server/src/macros.rs index e076583f19..52c84acf00 100644 --- a/tests/util/server/src/macros.rs +++ b/tests/util/server/src/macros.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #[macro_export] // https://stackoverflow.com/questions/38088067/equivalent-of-func-or-function-in-rust diff --git a/tests/util/server/src/npm.rs b/tests/util/server/src/npm.rs index 0261b2532c..da9a59cf2f 100644 --- a/tests/util/server/src/npm.rs +++ b/tests/util/server/src/npm.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::collections::HashMap; use std::fs; diff --git a/tests/util/server/src/pty.rs b/tests/util/server/src/pty.rs index 07659262cf..d72617cd5e 100644 --- a/tests/util/server/src/pty.rs +++ b/tests/util/server/src/pty.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use std::borrow::Cow; use std::collections::HashMap; @@ -323,9 +323,10 @@ fn create_pty( cwd: &Path, env_vars: Option>, ) -> Box { - use crate::pty::unix::UnixPty; use std::os::unix::process::CommandExt; + use crate::pty::unix::UnixPty; + // Manually open pty main/secondary sides in the test process. Since we're not actually // changing uid/gid here, this is the easiest way to do it. diff --git a/tests/util/server/src/servers/grpc.rs b/tests/util/server/src/servers/grpc.rs index 144afc06a3..f097fbd595 100644 --- a/tests/util/server/src/servers/grpc.rs +++ b/tests/util/server/src/servers/grpc.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. use futures::StreamExt; use h2; diff --git a/tests/util/server/src/servers/hyper_utils.rs b/tests/util/server/src/servers/hyper_utils.rs index 8e01151ed4..a8b30ac24e 100644 --- a/tests/util/server/src/servers/hyper_utils.rs +++ b/tests/util/server/src/servers/hyper_utils.rs @@ -1,4 +1,10 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::convert::Infallible; +use std::io; +use std::net::SocketAddr; +use std::pin::Pin; +use std::result::Result; use bytes::Bytes; use futures::Future; @@ -10,11 +16,6 @@ use http::Request; use http::Response; use http_body_util::combinators::UnsyncBoxBody; use hyper_util::rt::TokioIo; -use std::convert::Infallible; -use std::io; -use std::net::SocketAddr; -use std::pin::Pin; -use std::result::Result; use tokio::net::TcpListener; #[derive(Debug, Clone, Copy)] diff --git a/tests/util/server/src/servers/jsr_registry.rs b/tests/util/server/src/servers/jsr_registry.rs index 8970750a28..b4b045087c 100644 --- a/tests/util/server/src/servers/jsr_registry.rs +++ b/tests/util/server/src/servers/jsr_registry.rs @@ -1,10 +1,12 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::tests_path; +use std::collections::BTreeMap; +use std::collections::HashMap; +use std::convert::Infallible; +use std::net::SocketAddr; +use std::path::Path; +use std::sync::Mutex; -use super::run_server; -use super::ServerKind; -use super::ServerOptions; use base64::engine::general_purpose::STANDARD_NO_PAD; use base64::Engine as _; use bytes::Bytes; @@ -17,12 +19,11 @@ use hyper::Response; use hyper::StatusCode; use once_cell::sync::Lazy; use serde_json::json; -use std::collections::BTreeMap; -use std::collections::HashMap; -use std::convert::Infallible; -use std::net::SocketAddr; -use std::path::Path; -use std::sync::Mutex; + +use super::run_server; +use super::ServerKind; +use super::ServerOptions; +use crate::tests_path; pub async fn registry_server(port: u16) { let registry_server_addr = SocketAddr::from(([127, 0, 0, 1], port)); diff --git a/tests/util/server/src/servers/mod.rs b/tests/util/server/src/servers/mod.rs index 4345c27cde..03f327319c 100644 --- a/tests/util/server/src/servers/mod.rs +++ b/tests/util/server/src/servers/mod.rs @@ -1,7 +1,14 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // Usage: provide a port as argument to run hyper_hello benchmark server // otherwise this starts multiple servers on many ports for test endpoints. +use std::collections::HashMap; +use std::convert::Infallible; +use std::env; +use std::net::SocketAddr; +use std::result::Result; +use std::time::Duration; + use base64::prelude::BASE64_STANDARD; use base64::Engine; use bytes::Bytes; @@ -27,12 +34,6 @@ use http_body_util::Empty; use http_body_util::Full; use pretty_assertions::assert_eq; use prost::Message; -use std::collections::HashMap; -use std::convert::Infallible; -use std::env; -use std::net::SocketAddr; -use std::result::Result; -use std::time::Duration; use tokio::io::AsyncWriteExt; use tokio::net::TcpStream; @@ -48,12 +49,11 @@ use hyper_utils::run_server_with_acceptor; use hyper_utils::ServerKind; use hyper_utils::ServerOptions; -use crate::TEST_SERVERS_COUNT; - use super::https::get_tls_listener_stream; use super::https::SupportedHttpVersions; use super::std_path; use super::testdata_path; +use crate::TEST_SERVERS_COUNT; pub(crate) const PORT: u16 = 4545; const TEST_AUTH_TOKEN: &str = "abcdef123456789"; diff --git a/tests/util/server/src/servers/nodejs_org_mirror.rs b/tests/util/server/src/servers/nodejs_org_mirror.rs index 521e79d3c4..e3e94757c0 100644 --- a/tests/util/server/src/servers/nodejs_org_mirror.rs +++ b/tests/util/server/src/servers/nodejs_org_mirror.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. //! Server for NodeJS header tarballs, used by `node-gyp` in tests to download headers //! diff --git a/tests/util/server/src/servers/npm_registry.rs b/tests/util/server/src/servers/npm_registry.rs index 4ada468fac..c814b83340 100644 --- a/tests/util/server/src/servers/npm_registry.rs +++ b/tests/util/server/src/servers/npm_registry.rs @@ -1,14 +1,11 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. -use crate::npm; +use std::convert::Infallible; +use std::net::Ipv6Addr; +use std::net::SocketAddr; +use std::net::SocketAddrV6; +use std::path::PathBuf; -use super::custom_headers; -use super::empty_body; -use super::hyper_utils::HandlerOutput; -use super::run_server; -use super::string_body; -use super::ServerKind; -use super::ServerOptions; use bytes::Bytes; use futures::future::LocalBoxFuture; use futures::Future; @@ -18,11 +15,15 @@ use hyper::body::Incoming; use hyper::Request; use hyper::Response; use hyper::StatusCode; -use std::convert::Infallible; -use std::net::Ipv6Addr; -use std::net::SocketAddr; -use std::net::SocketAddrV6; -use std::path::PathBuf; + +use super::custom_headers; +use super::empty_body; +use super::hyper_utils::HandlerOutput; +use super::run_server; +use super::string_body; +use super::ServerKind; +use super::ServerOptions; +use crate::npm; pub fn public_npm_registry(port: u16) -> Vec> { run_npm_server(port, "npm registry server error", { diff --git a/tests/util/server/src/servers/ws.rs b/tests/util/server/src/servers/ws.rs index dd4efbf659..2b9189f3e1 100644 --- a/tests/util/server/src/servers/ws.rs +++ b/tests/util/server/src/servers/ws.rs @@ -1,4 +1,7 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. + +use std::pin::Pin; +use std::result::Result; use anyhow::anyhow; use bytes::Bytes; @@ -22,8 +25,6 @@ use hyper::Response; use hyper::StatusCode; use hyper_util::rt::TokioIo; use pretty_assertions::assert_eq; -use std::pin::Pin; -use std::result::Result; use tokio::io::AsyncReadExt; use tokio::io::AsyncWriteExt; diff --git a/tests/util/server/src/spawn.rs b/tests/util/server/src/spawn.rs index bfd83e9b26..936da7c785 100644 --- a/tests/util/server/src/spawn.rs +++ b/tests/util/server/src/spawn.rs @@ -1,7 +1,8 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use anyhow::Error; +// Copyright 2018-2025 the Deno authors. MIT license. use std::convert::Infallible; +use anyhow::Error; + /// For unix targets, we just replace our current process with the desired cargo process. #[cfg(unix)] pub fn exec_replace_inner( @@ -30,6 +31,7 @@ pub fn exec_replace_inner( ) -> Result { use std::os::windows::io::AsRawHandle; use std::process::Command; + use win32job::ExtendedLimitInfo; use win32job::Job; diff --git a/tests/util/server/src/test_server.rs b/tests/util/server/src/test_server.rs index 3ae3eaa7d9..a118318e6f 100644 --- a/tests/util/server/src/test_server.rs +++ b/tests/util/server/src/test_server.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. #![allow(clippy::print_stdout)] #![allow(clippy::print_stderr)] diff --git a/tests/wpt/runner/runner.ts b/tests/wpt/runner/runner.ts index 6e654fd334..e124d28c7a 100644 --- a/tests/wpt/runner/runner.ts +++ b/tests/wpt/runner/runner.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { delay, join, diff --git a/tests/wpt/runner/testharnessreport.js b/tests/wpt/runner/testharnessreport.js index 7cc6a9e2dd..f5fce1efe3 100644 --- a/tests/wpt/runner/testharnessreport.js +++ b/tests/wpt/runner/testharnessreport.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. window.add_result_callback(({ message, name, stack, status }) => { const data = new TextEncoder().encode( diff --git a/tests/wpt/runner/utils.ts b/tests/wpt/runner/utils.ts index 140c388ec2..1d9426aed9 100644 --- a/tests/wpt/runner/utils.ts +++ b/tests/wpt/runner/utils.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. /// FLAGS import { parseArgs } from "@std/cli/parse-args"; diff --git a/tests/wpt/wpt.ts b/tests/wpt/wpt.ts index b13a10cf4c..ec4a77fba1 100755 --- a/tests/wpt/wpt.ts +++ b/tests/wpt/wpt.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --allow-write --allow-read --allow-net --allow-env --allow-run --config=tests/config/deno.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tools/build_bench.ts b/tools/build_bench.ts index 400737561b..ccc72410ba 100755 --- a/tools/build_bench.ts +++ b/tools/build_bench.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --allow-env --allow-read --allow-write --allow-run=git,cargo -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import $ from "https://deno.land/x/dax@0.32.0/mod.ts"; diff --git a/tools/build_benchmark_jsons.js b/tools/build_benchmark_jsons.js index 64310f75a7..6ed7cb0d83 100755 --- a/tools/build_benchmark_jsons.js +++ b/tools/build_benchmark_jsons.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { buildPath, existsSync, join } from "./util.js"; const currentDataFile = join(buildPath(), "bench.json"); diff --git a/tools/copyright_checker.js b/tools/copyright_checker.js index d7d196bc44..9ac84e3ec5 100755 --- a/tools/copyright_checker.js +++ b/tools/copyright_checker.js @@ -1,11 +1,11 @@ #!/usr/bin/env -S deno run --allow-read=. --allow-run=git --config=tests/config/deno.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console import { getSources, ROOT_PATH } from "./util.js"; -const copyrightYear = 2024; +const copyrightYear = 2025; const buffer = new Uint8Array(1024); const textDecoder = new TextDecoder(); @@ -63,7 +63,7 @@ export async function checkCopyright() { const ACCEPTABLE_LINES = /^(\/\/ deno-lint-.*|\/\/ Copyright.*|\/\/ Ported.*|\s*|#!\/.*)\n/; const COPYRIGHT_LINE = - `Copyright 2018-${copyrightYear} the Deno authors. All rights reserved. MIT license.`; + `Copyright 2018-${copyrightYear} the Deno authors. MIT license.`; const TOML_COPYRIGHT_LINE = "# " + COPYRIGHT_LINE; const C_STYLE_COPYRIGHT_LINE = "// " + COPYRIGHT_LINE; diff --git a/tools/format.js b/tools/format.js index b29667ca77..02211cdaf8 100755 --- a/tools/format.js +++ b/tools/format.js @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --allow-all --config=tests/config/deno.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { join, ROOT_PATH } from "./util.js"; const subcommand = Deno.args.includes("--check") ? "check" : "fmt"; diff --git a/tools/generate_types_deno.ts b/tools/generate_types_deno.ts index 265b6f5371..e88b4bfa6f 100755 --- a/tools/generate_types_deno.ts +++ b/tools/generate_types_deno.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run -A -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This script is used to generate the @types/deno package on DefinitelyTyped. diff --git a/tools/install_prebuilt.js b/tools/install_prebuilt.js index 0c983d405d..c7a58c4691 100755 --- a/tools/install_prebuilt.js +++ b/tools/install_prebuilt.js @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --unstable --allow-write --allow-read --allow-net --config=tests/config/deno.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { getPrebuilt } from "./util.js"; const args = Deno.args.slice(); diff --git a/tools/jsdoc_checker.js b/tools/jsdoc_checker.js index 241d04273b..034782136c 100755 --- a/tools/jsdoc_checker.js +++ b/tools/jsdoc_checker.js @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --allow-read --allow-env --allow-sys --config=tests/config/deno.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { Node, Project, ts } from "npm:ts-morph@22.0.0"; import { join, ROOT_PATH } from "./util.js"; diff --git a/tools/lint.js b/tools/lint.js index 5bc3f2654f..3f548d5c3a 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --allow-all --config=tests/config/deno.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tools/napi/generate_symbols_lists.js b/tools/napi/generate_symbols_lists.js index efb0edc043..42942777f6 100755 --- a/tools/napi/generate_symbols_lists.js +++ b/tools/napi/generate_symbols_lists.js @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --allow-read --allow-write -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import exports from "../../ext/napi/sym/symbol_exports.json" with { type: "json", diff --git a/tools/ops.d.ts b/tools/ops.d.ts index 8acb1e5883..1d6dc8304a 100644 --- a/tools/ops.d.ts +++ b/tools/ops.d.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This file is intentionally empty - that puts this file into script mode, // which then allows all symbols to be imported from the file. diff --git a/tools/release/00_start_release.ts b/tools/release/00_start_release.ts index 125a76af66..a7a5d22a40 100755 --- a/tools/release/00_start_release.ts +++ b/tools/release/00_start_release.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run -A --quiet --lock=tools/deno.lock.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tools/release/01_bump_crate_versions.ts b/tools/release/01_bump_crate_versions.ts index bef8011ba1..ddbc785c75 100755 --- a/tools/release/01_bump_crate_versions.ts +++ b/tools/release/01_bump_crate_versions.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { DenoWorkspace } from "./deno_workspace.ts"; import { $, GitLogOutput, semver } from "./deps.ts"; diff --git a/tools/release/02_create_pr.ts b/tools/release/02_create_pr.ts index 5ef64cd144..97f50f0d44 100755 --- a/tools/release/02_create_pr.ts +++ b/tools/release/02_create_pr.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { DenoWorkspace } from "./deno_workspace.ts"; import { $, createOctoKit, getGitHubRepository } from "./deps.ts"; diff --git a/tools/release/03_publish_crates.ts b/tools/release/03_publish_crates.ts index ecfb75e796..17ab2f71f7 100755 --- a/tools/release/03_publish_crates.ts +++ b/tools/release/03_publish_crates.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tools/release/04_post_publish.ts b/tools/release/04_post_publish.ts index 2fa9e73561..42bf2dbafd 100755 --- a/tools/release/04_post_publish.ts +++ b/tools/release/04_post_publish.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { DenoWorkspace } from "./deno_workspace.ts"; import { $, createOctoKit, getGitHubRepository } from "./deps.ts"; diff --git a/tools/release/05_create_release_notes.ts b/tools/release/05_create_release_notes.ts index 9ea9ade31f..383f5ba089 100755 --- a/tools/release/05_create_release_notes.ts +++ b/tools/release/05_create_release_notes.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { $ } from "./deps.ts"; import { DenoWorkspace } from "./deno_workspace.ts"; diff --git a/tools/release/deno_workspace.ts b/tools/release/deno_workspace.ts index e55a02b73f..e5d9f1b928 100644 --- a/tools/release/deno_workspace.ts +++ b/tools/release/deno_workspace.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { $, ReleasesMdFile, Repo } from "./deps.ts"; diff --git a/tools/release/deps.ts b/tools/release/deps.ts index 568830a74b..17177870d7 100644 --- a/tools/release/deps.ts +++ b/tools/release/deps.ts @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. export * from "https://raw.githubusercontent.com/denoland/automation/0.19.0/mod.ts"; export * from "https://raw.githubusercontent.com/denoland/automation/0.19.0/github_actions.ts"; diff --git a/tools/release/npm/bin.cjs b/tools/release/npm/bin.cjs index 984aa350f1..aaa9dd343c 100644 --- a/tools/release/npm/bin.cjs +++ b/tools/release/npm/bin.cjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // @ts-check const path = require("path"); diff --git a/tools/release/npm/build.ts b/tools/release/npm/build.ts index b1f1c45cbf..606ff6dbe8 100755 --- a/tools/release/npm/build.ts +++ b/tools/release/npm/build.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // NOTICE: This deployment/npm folder was lifted from https://github.com/dprint/dprint/blob/0ba79811cc96d2dee8e0cf766a8c8c0fc44879c2/deployment/npm/ // with permission (Copyright 2019-2023 David Sherret) import $ from "jsr:@david/dax@^0.42.0"; diff --git a/tools/release/npm/install.cjs b/tools/release/npm/install.cjs index 8bf9aabe47..5546818941 100644 --- a/tools/release/npm/install.cjs +++ b/tools/release/npm/install.cjs @@ -1,5 +1,5 @@ // @ts-check -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. "use strict"; require("./install_api.cjs").runInstall(); diff --git a/tools/release/npm/install_api.cjs b/tools/release/npm/install_api.cjs index 026d8ccc45..d2571839bc 100644 --- a/tools/release/npm/install_api.cjs +++ b/tools/release/npm/install_api.cjs @@ -1,5 +1,5 @@ // @ts-check -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. "use strict"; const fs = require("fs"); diff --git a/tools/release/promote_to_release.ts b/tools/release/promote_to_release.ts index 046f4d33a8..bca798d22c 100755 --- a/tools/release/promote_to_release.ts +++ b/tools/release/promote_to_release.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tools/upload_wptfyi.js b/tools/upload_wptfyi.js index 23dd4c6602..b08f352329 100644 --- a/tools/upload_wptfyi.js +++ b/tools/upload_wptfyi.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // This script pushes new WPT results to wpt.fyi. When the `--ghstatus` flag is // passed, will automatically add a status check to the commit with a link to diff --git a/tools/util.js b/tools/util.js index 8669337bff..07f405098c 100644 --- a/tools/util.js +++ b/tools/util.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tools/verify_pr_title.js b/tools/verify_pr_title.js index 90a045d3f4..dd623bb630 100644 --- a/tools/verify_pr_title.js +++ b/tools/verify_pr_title.js @@ -1,4 +1,4 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-console diff --git a/tools/wgpu_sync.js b/tools/wgpu_sync.js index 1d9e180d52..995a4b5975 100755 --- a/tools/wgpu_sync.js +++ b/tools/wgpu_sync.js @@ -1,5 +1,5 @@ #!/usr/bin/env -S deno run --unstable --allow-read --allow-write --allow-run --config=tests/config/deno.json -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2025 the Deno authors. MIT license. import { join, ROOT_PATH } from "./util.js";