From 01f0d03ae82c422c1f9551f3bfbb57daac769ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 2 Jul 2023 20:19:30 +0200 Subject: [PATCH] refactor: rename built-in node modules from ext:deno_node/ to node: (#19680) Closes https://github.com/denoland/deno/issues/19510 --- Cargo.lock | 12 +- Cargo.toml | 6 +- cli/build.rs | 5 +- cli/tests/unit_node/module_test.ts | 17 +- ext/node/lib.rs | 105 +++---- ext/node/polyfill.rs | 269 +++++------------- ext/node/polyfills/01_require.js | 94 +++--- ext/node/polyfills/02_init.js | 2 +- ext/node/polyfills/_brotli.js | 4 +- ext/node/polyfills/_fs/_fs_access.ts | 2 +- ext/node/polyfills/_fs/_fs_chmod.ts | 4 +- ext/node/polyfills/_fs/_fs_chown.ts | 4 +- ext/node/polyfills/_fs/_fs_copy.ts | 2 +- ext/node/polyfills/_fs/_fs_open.ts | 2 +- ext/node/polyfills/_fs/_fs_opendir.ts | 2 +- ext/node/polyfills/_fs/_fs_read.ts | 2 +- ext/node/polyfills/_fs/_fs_readFile.ts | 2 +- ext/node/polyfills/_fs/_fs_readdir.ts | 2 +- ext/node/polyfills/_fs/_fs_rmdir.ts | 4 +- ext/node/polyfills/_fs/_fs_watch.ts | 8 +- ext/node/polyfills/_fs/_fs_write.mjs | 2 +- ext/node/polyfills/_fs/_fs_writeFile.ts | 2 +- ext/node/polyfills/_fs/_fs_writev.mjs | 2 +- ext/node/polyfills/_global.d.ts | 2 +- ext/node/polyfills/_http_agent.mjs | 6 +- ext/node/polyfills/_http_outgoing.ts | 10 +- ext/node/polyfills/_process/streams.mjs | 4 +- ext/node/polyfills/_readline.d.ts | 2 +- ext/node/polyfills/_readline.mjs | 2 +- ext/node/polyfills/_stream.d.ts | 2 +- ext/node/polyfills/_stream.mjs | 10 +- ext/node/polyfills/_tls_wrap.ts | 6 +- ext/node/polyfills/_zlib.mjs | 8 +- ext/node/polyfills/assert.ts | 2 +- ext/node/polyfills/assert/strict.ts | 4 +- ext/node/polyfills/assertion_error.ts | 2 +- ext/node/polyfills/child_process.ts | 6 +- ext/node/polyfills/constants.ts | 4 +- ext/node/polyfills/dgram.ts | 10 +- ext/node/polyfills/diagnostics_channel.ts | 2 +- ext/node/polyfills/dns.ts | 2 +- ext/node/polyfills/dns/promises.ts | 2 +- ext/node/polyfills/fs/promises.ts | 2 +- ext/node/polyfills/http.ts | 10 +- ext/node/polyfills/http2.ts | 8 +- ext/node/polyfills/https.ts | 9 +- ext/node/polyfills/inspector.ts | 2 +- ext/node/polyfills/internal/child_process.ts | 8 +- .../internal/console/constructor.mjs | 2 +- .../polyfills/internal/crypto/_randomBytes.ts | 2 +- .../polyfills/internal/crypto/_randomFill.ts | 2 +- .../polyfills/internal/crypto/certificate.ts | 2 +- ext/node/polyfills/internal/crypto/cipher.ts | 2 +- .../internal/crypto/diffiehellman.ts | 2 +- ext/node/polyfills/internal/crypto/hash.ts | 4 +- ext/node/polyfills/internal/crypto/keygen.ts | 2 +- ext/node/polyfills/internal/crypto/keys.ts | 2 +- ext/node/polyfills/internal/crypto/pbkdf2.ts | 2 +- ext/node/polyfills/internal/crypto/scrypt.ts | 2 +- ext/node/polyfills/internal/crypto/sig.ts | 2 +- ext/node/polyfills/internal/crypto/util.ts | 2 +- ext/node/polyfills/internal/crypto/x509.ts | 2 +- ext/node/polyfills/internal/dgram.ts | 2 +- ext/node/polyfills/internal/dns/promises.ts | 2 +- ext/node/polyfills/internal/dns/utils.ts | 2 +- ext/node/polyfills/internal/event_target.mjs | 6 +- ext/node/polyfills/internal/fs/handle.ts | 6 +- ext/node/polyfills/internal/fs/streams.d.ts | 4 +- ext/node/polyfills/internal/fs/streams.mjs | 6 +- ext/node/polyfills/internal/fs/utils.mjs | 8 +- ext/node/polyfills/internal/http.ts | 2 +- ext/node/polyfills/internal/net.ts | 2 +- .../internal/readline/emitKeypressEvents.mjs | 4 +- .../polyfills/internal/readline/interface.mjs | 6 +- .../polyfills/internal/stream_base_commons.ts | 4 +- .../internal/streams/buffer_list.mjs | 2 +- .../internal/streams/lazy_transform.mjs | 2 +- ext/node/polyfills/internal/timers.mjs | 2 +- ext/node/polyfills/internal/url.ts | 4 +- .../polyfills/internal/util/comparisons.ts | 2 +- .../internal_binding/_timingSafeEqual.ts | 2 +- .../polyfills/internal_binding/stream_wrap.ts | 2 +- .../polyfills/internal_binding/udp_wrap.ts | 2 +- ext/node/polyfills/net.ts | 10 +- ext/node/polyfills/os.ts | 2 +- ext/node/polyfills/process.ts | 4 +- ext/node/polyfills/querystring.ts | 2 +- ext/node/polyfills/stream/consumers.mjs | 2 +- ext/node/polyfills/string_decoder.ts | 2 +- ext/node/polyfills/sys.ts | 4 +- ext/node/polyfills/timers/promises.ts | 4 +- ext/node/polyfills/tty.ts | 2 +- ext/node/polyfills/url.ts | 11 +- ext/node/polyfills/util.ts | 6 +- ext/node/polyfills/worker_threads.ts | 4 +- runtime/build.rs | 18 +- runtime/web_worker.rs | 13 +- runtime/worker.rs | 15 +- tools/core_import_map.json | 96 +++---- 99 files changed, 422 insertions(+), 554 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 01aea82a3d..032b726bda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -958,9 +958,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.193.0" +version = "0.194.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d7eeb863655f377ffe22d5a90f01d1b57b4d4ad0acbfeec266d5d3faf4cd1cf" +checksum = "cc857567cdff39a7d554c686b0353cc89958cd2b34319dd11793541323531e9d" dependencies = [ "anyhow", "bytes", @@ -1331,9 +1331,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.71.0" +version = "0.72.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dd95626e113f292ce758f216bb12e50c9c58e886195bcd85231e715c73d6470" +checksum = "5229c9b8b4fe7805123794727c4be2a8af46c41c49681ce07d20bca09978e74d" dependencies = [ "deno-proc-macro-rules", "lazy-regex", @@ -4366,9 +4366,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.104.0" +version = "0.105.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2481189a5019f43a6b68620193578623701323754409555c36588c81ee2487de" +checksum = "4b30e810bbf80dff0dfa2a13eeeb9060a4038b210bb230410c9b3f5b33669afe" dependencies = [ "bytes", "derive_more", diff --git a/Cargo.toml b/Cargo.toml index e8060ca2a1..75c03c7dbf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,9 +41,9 @@ repository = "https://github.com/denoland/deno" v8 = { version = "0.74.1", default-features = false } deno_ast = { version = "0.27.0", features = ["transpiling"] } -deno_core = { version = "0.193.0" } -deno_ops = { version = "0.70.0" } -serde_v8 = { version = "0.103.0" } +deno_core = { version = "0.194.0" } +deno_ops = { version = "0.71.0" } +serde_v8 = { version = "0.104.0" } deno_runtime = { version = "0.117.0", path = "./runtime" } napi_sym = { version = "0.39.0", path = "./cli/napi/sym" } diff --git a/cli/build.rs b/cli/build.rs index 305d622a64..3e74a3ff30 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -38,10 +38,7 @@ mod ts { fn op_build_info(state: &mut OpState) -> Value { let build_specifier = "asset:///bootstrap.ts"; - let node_built_in_module_names = SUPPORTED_BUILTIN_NODE_MODULES - .iter() - .map(|p| p.module_name()) - .collect::>(); + let node_built_in_module_names = SUPPORTED_BUILTIN_NODE_MODULES.to_vec(); let build_libs = state.borrow::>(); json!({ "buildSpecifier": build_specifier, diff --git a/cli/tests/unit_node/module_test.ts b/cli/tests/unit_node/module_test.ts index 3a675c7a17..9818f4766c 100644 --- a/cli/tests/unit_node/module_test.ts +++ b/cli/tests/unit_node/module_test.ts @@ -1,6 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -import { Module } from "node:module"; +import { createRequire, Module } from "node:module"; import { assert, assertEquals, @@ -58,3 +58,18 @@ Deno.test("[node/module _nodeModulePaths] prevents duplicate root /node_modules" "Missing root 'node_modules' directory", ); }); + +Deno.test("Built-in Node modules have `node:` prefix", () => { + let thrown = false; + try { + // @ts-ignore We want to explicitly test wrong call signature + createRequire(); + } catch (e) { + thrown = true; + const stackLines = e.stack.split("\n"); + // Assert that built-in node modules have `node:` specifiers. + assert(stackLines.some((line: string) => line.includes("(node:module:"))); + } + + assert(thrown); +}); diff --git a/ext/node/lib.rs b/ext/node/lib.rs index bb8d744c85..f139f0c7ba 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -31,8 +31,8 @@ mod resolution; pub use package_json::PackageJson; pub use path::PathClean; pub use polyfill::is_builtin_node_module; -pub use polyfill::NodeModulePolyfill; pub use polyfill::SUPPORTED_BUILTIN_NODE_MODULES; +pub use polyfill::SUPPORTED_BUILTIN_NODE_MODULES_WITH_PREFIX; pub use resolution::NodeModuleKind; pub use resolution::NodeResolution; pub use resolution::NodeResolutionMode; @@ -251,7 +251,6 @@ deno_core::extension!(deno_node, esm = [ dir "polyfills", "00_globals.js", - "01_require.js", "02_init.js", "_brotli.js", "_events.mjs", @@ -315,27 +314,7 @@ deno_core::extension!(deno_node, "_utils.ts", "_zlib_binding.mjs", "_zlib.mjs", - "assert.ts", - "assert/strict.ts", "assertion_error.ts", - "async_hooks.ts", - "buffer.ts", - "child_process.ts", - "cluster.ts", - "console.ts", - "constants.ts", - "crypto.ts", - "dgram.ts", - "diagnostics_channel.ts", - "dns.ts", - "dns/promises.ts", - "domain.ts", - "events.ts", - "fs.ts", - "fs/promises.ts", - "http.ts", - "http2.ts", - "https.ts", "inspector.ts", "internal_binding/_libuv_winerror.ts", "internal_binding/_listen.ts", @@ -435,9 +414,6 @@ deno_core::extension!(deno_node, "internal/util/inspect.mjs", "internal/util/types.ts", "internal/validators.mjs", - "net.ts", - "os.ts", - "path.ts", "path/_constants.ts", "path/_interface.ts", "path/_util.ts", @@ -445,34 +421,61 @@ deno_core::extension!(deno_node, "path/_win32.ts", "path/common.ts", "path/mod.ts", - "path/posix.ts", "path/separator.ts", - "path/win32.ts", - "perf_hooks.ts", - "process.ts", - "punycode.ts", - "querystring.ts", - "readline.ts", "readline/promises.ts", "repl.ts", - "stream.ts", - "stream/consumers.mjs", - "stream/promises.mjs", - "stream/web.ts", - "string_decoder.ts", - "sys.ts", - "timers.ts", - "timers/promises.ts", - "tls.ts", - "tty.ts", - "url.ts", - "util.ts", - "util/types.ts", - "v8.ts", - "vm.ts", - "wasi.ts", - "worker_threads.ts", - "zlib.ts", + "wasi.ts" + ], + esm_with_specifiers = [ + dir "polyfills", + ("node:assert", "assert.ts"), + ("node:assert/strict", "assert/strict.ts"), + ("node:async_hooks", "async_hooks.ts"), + ("node:buffer", "buffer.ts"), + ("node:child_process", "child_process.ts"), + ("node:cluster", "cluster.ts"), + ("node:console", "console.ts"), + ("node:constants", "constants.ts"), + ("node:crypto", "crypto.ts"), + ("node:dgram", "dgram.ts"), + ("node:diagnostics_channel", "diagnostics_channel.ts"), + ("node:dns", "dns.ts"), + ("node:dns/promises", "dns/promises.ts"), + ("node:domain", "domain.ts"), + ("node:events", "events.ts"), + ("node:fs", "fs.ts"), + ("node:fs/promises", "fs/promises.ts"), + ("node:http", "http.ts"), + ("node:http2", "http2.ts"), + ("node:https", "https.ts"), + ("node:module", "01_require.js"), + ("node:net", "net.ts"), + ("node:os", "os.ts"), + ("node:path", "path.ts"), + ("node:path/posix", "path/posix.ts"), + ("node:path/win32", "path/win32.ts"), + ("node:perf_hooks", "perf_hooks.ts"), + ("node:process", "process.ts"), + ("node:punycode", "punycode.ts"), + ("node:querystring", "querystring.ts"), + ("node:readline", "readline.ts"), + ("node:stream", "stream.ts"), + ("node:stream/consumers", "stream/consumers.mjs"), + ("node:stream/promises", "stream/promises.mjs"), + ("node:stream/web", "stream/web.ts"), + ("node:string_decoder", "string_decoder.ts"), + ("node:sys", "sys.ts"), + ("node:timers", "timers.ts"), + ("node:timers/promises", "timers/promises.ts"), + ("node:tls", "tls.ts"), + ("node:tty", "tty.ts"), + ("node:url", "url.ts"), + ("node:util", "util.ts"), + ("node:util/types", "util/types.ts"), + ("node:v8", "v8.ts"), + ("node:vm", "vm.ts"), + ("node:worker_threads", "worker_threads.ts"), + ("node:zlib", "zlib.ts"), ], options = { maybe_npm_resolver: Option, @@ -488,7 +491,7 @@ deno_core::extension!(deno_node, npm_resolver, ))) } - }, + } ); pub fn initialize_runtime( diff --git a/ext/node/polyfill.rs b/ext/node/polyfill.rs index 434c20b03d..16ffe185dc 100644 --- a/ext/node/polyfill.rs +++ b/ext/node/polyfill.rs @@ -4,214 +4,73 @@ pub fn is_builtin_node_module(module_name: &str) -> bool { SUPPORTED_BUILTIN_NODE_MODULES .iter() - .any(|m| m.module_name() == module_name) + .any(|m| *m == module_name) } -pub struct NodeModulePolyfill { - /// Name of the module like "assert" or "timers/promises" - pub specifier: &'static str, - pub ext_specifier: &'static str, -} +macro_rules! generate_builtin_node_module_lists { + ($( $module_name:literal ,)+) => { + pub static SUPPORTED_BUILTIN_NODE_MODULES: &[&str] = &[ + $( + $module_name, + )+ + ]; -impl NodeModulePolyfill { - pub fn module_name(&self) -> &'static str { - debug_assert!(self.specifier.starts_with("node:")); - &self.specifier[5..] - } + pub static SUPPORTED_BUILTIN_NODE_MODULES_WITH_PREFIX: &[&str] = &[ + $( + concat!("node:", $module_name), + )+ + ]; + }; } // NOTE(bartlomieju): keep this list in sync with `ext/node/polyfills/01_require.js` -pub static SUPPORTED_BUILTIN_NODE_MODULES: &[NodeModulePolyfill] = &[ - NodeModulePolyfill { - specifier: "node:assert", - ext_specifier: "ext:deno_node/assert.ts", - }, - NodeModulePolyfill { - specifier: "node:assert/strict", - ext_specifier: "ext:deno_node/assert/strict.ts", - }, - NodeModulePolyfill { - specifier: "node:async_hooks", - ext_specifier: "ext:deno_node/async_hooks.ts", - }, - NodeModulePolyfill { - specifier: "node:buffer", - ext_specifier: "ext:deno_node/buffer.ts", - }, - NodeModulePolyfill { - specifier: "node:child_process", - ext_specifier: "ext:deno_node/child_process.ts", - }, - NodeModulePolyfill { - specifier: "node:cluster", - ext_specifier: "ext:deno_node/cluster.ts", - }, - NodeModulePolyfill { - specifier: "node:console", - ext_specifier: "ext:deno_node/console.ts", - }, - NodeModulePolyfill { - specifier: "node:constants", - ext_specifier: "ext:deno_node/constants.ts", - }, - NodeModulePolyfill { - specifier: "node:crypto", - ext_specifier: "ext:deno_node/crypto.ts", - }, - NodeModulePolyfill { - specifier: "node:dgram", - ext_specifier: "ext:deno_node/dgram.ts", - }, - NodeModulePolyfill { - specifier: "node:diagnostics_channel", - ext_specifier: "ext:deno_node/diagnostics_channel.ts", - }, - NodeModulePolyfill { - specifier: "node:dns", - ext_specifier: "ext:deno_node/dns.ts", - }, - NodeModulePolyfill { - specifier: "node:dns/promises", - ext_specifier: "ext:deno_node/dns/promises.ts", - }, - NodeModulePolyfill { - specifier: "node:domain", - ext_specifier: "ext:deno_node/domain.ts", - }, - NodeModulePolyfill { - specifier: "node:events", - ext_specifier: "ext:deno_node/events.ts", - }, - NodeModulePolyfill { - specifier: "node:fs", - ext_specifier: "ext:deno_node/fs.ts", - }, - NodeModulePolyfill { - specifier: "node:fs/promises", - ext_specifier: "ext:deno_node/fs/promises.ts", - }, - NodeModulePolyfill { - specifier: "node:http", - ext_specifier: "ext:deno_node/http.ts", - }, - NodeModulePolyfill { - specifier: "node:http2", - ext_specifier: "ext:deno_node/http2.ts", - }, - NodeModulePolyfill { - specifier: "node:https", - ext_specifier: "ext:deno_node/https.ts", - }, - NodeModulePolyfill { - specifier: "node:module", - ext_specifier: "ext:deno_node/01_require.js", - }, - NodeModulePolyfill { - specifier: "node:net", - ext_specifier: "ext:deno_node/net.ts", - }, - NodeModulePolyfill { - specifier: "node:os", - ext_specifier: "ext:deno_node/os.ts", - }, - NodeModulePolyfill { - specifier: "node:path", - ext_specifier: "ext:deno_node/path.ts", - }, - NodeModulePolyfill { - specifier: "node:path/posix", - ext_specifier: "ext:deno_node/path/posix.ts", - }, - NodeModulePolyfill { - specifier: "node:path/win32", - ext_specifier: "ext:deno_node/path/win32.ts", - }, - NodeModulePolyfill { - specifier: "node:perf_hooks", - ext_specifier: "ext:deno_node/perf_hooks.ts", - }, - NodeModulePolyfill { - specifier: "node:process", - ext_specifier: "ext:deno_node/process.ts", - }, - NodeModulePolyfill { - specifier: "node:punycode", - ext_specifier: "ext:deno_node/punycode.ts", - }, - NodeModulePolyfill { - specifier: "node:querystring", - ext_specifier: "ext:deno_node/querystring.ts", - }, - NodeModulePolyfill { - specifier: "node:readline", - ext_specifier: "ext:deno_node/readline.ts", - }, - NodeModulePolyfill { - specifier: "node:stream", - ext_specifier: "ext:deno_node/stream.ts", - }, - NodeModulePolyfill { - specifier: "node:stream/consumers", - ext_specifier: "ext:deno_node/stream/consumers.mjs", - }, - NodeModulePolyfill { - specifier: "node:stream/promises", - ext_specifier: "ext:deno_node/stream/promises.mjs", - }, - NodeModulePolyfill { - specifier: "node:stream/web", - ext_specifier: "ext:deno_node/stream/web.ts", - }, - NodeModulePolyfill { - specifier: "node:string_decoder", - ext_specifier: "ext:deno_node/string_decoder.ts", - }, - NodeModulePolyfill { - specifier: "node:sys", - ext_specifier: "ext:deno_node/sys.ts", - }, - NodeModulePolyfill { - specifier: "node:timers", - ext_specifier: "ext:deno_node/timers.ts", - }, - NodeModulePolyfill { - specifier: "node:timers/promises", - ext_specifier: "ext:deno_node/timers/promises.ts", - }, - NodeModulePolyfill { - specifier: "node:tls", - ext_specifier: "ext:deno_node/tls.ts", - }, - NodeModulePolyfill { - specifier: "node:tty", - ext_specifier: "ext:deno_node/tty.ts", - }, - NodeModulePolyfill { - specifier: "node:url", - ext_specifier: "ext:deno_node/url.ts", - }, - NodeModulePolyfill { - specifier: "node:util", - ext_specifier: "ext:deno_node/util.ts", - }, - NodeModulePolyfill { - specifier: "node:util/types", - ext_specifier: "ext:deno_node/util/types.ts", - }, - NodeModulePolyfill { - specifier: "node:v8", - ext_specifier: "ext:deno_node/v8.ts", - }, - NodeModulePolyfill { - specifier: "node:vm", - ext_specifier: "ext:deno_node/vm.ts", - }, - NodeModulePolyfill { - specifier: "node:worker_threads", - ext_specifier: "ext:deno_node/worker_threads.ts", - }, - NodeModulePolyfill { - specifier: "node:zlib", - ext_specifier: "ext:deno_node/zlib.ts", - }, -]; +generate_builtin_node_module_lists! { + "assert", + "assert/strict", + "async_hooks", + "buffer", + "child_process", + "cluster", + "console", + "constants", + "crypto", + "dgram", + "diagnostics_channel", + "dns", + "dns/promises", + "domain", + "events", + "fs", + "fs/promises", + "http", + "http2", + "https", + "module", + "net", + "os", + "path", + "path/posix", + "path/win32", + "perf_hooks", + "process", + "punycode", + "querystring", + "readline", + "stream", + "stream/consumers", + "stream/promises", + "stream/web", + "string_decoder", + "sys", + "timers", + "timers/promises", + "tls", + "tty", + "url", + "util", + "util/types", + "v8", + "vm", + "worker_threads", + "zlib", +} diff --git a/ext/node/polyfills/01_require.js b/ext/node/polyfills/01_require.js index da8e1e3be9..b27565a406 100644 --- a/ext/node/polyfills/01_require.js +++ b/ext/node/polyfills/01_require.js @@ -48,26 +48,26 @@ import _streamPassthrough from "ext:deno_node/internal/streams/passthrough.mjs"; import _streamReadable from "ext:deno_node/internal/streams/readable.mjs"; import _streamTransform from "ext:deno_node/internal/streams/transform.mjs"; import _streamWritable from "ext:deno_node/internal/streams/writable.mjs"; -import assert from "ext:deno_node/assert.ts"; -import assertStrict from "ext:deno_node/assert/strict.ts"; -import asyncHooks from "ext:deno_node/async_hooks.ts"; -import buffer from "ext:deno_node/buffer.ts"; -import childProcess from "ext:deno_node/child_process.ts"; -import cluster from "ext:deno_node/cluster.ts"; -import console from "ext:deno_node/console.ts"; -import constants from "ext:deno_node/constants.ts"; -import crypto from "ext:deno_node/crypto.ts"; -import dgram from "ext:deno_node/dgram.ts"; -import diagnosticsChannel from "ext:deno_node/diagnostics_channel.ts"; -import dns from "ext:deno_node/dns.ts"; -import dnsPromises from "ext:deno_node/dns/promises.ts"; -import domain from "ext:deno_node/domain.ts"; -import events from "ext:deno_node/events.ts"; -import fs from "ext:deno_node/fs.ts"; -import fsPromises from "ext:deno_node/fs/promises.ts"; -import http from "ext:deno_node/http.ts"; -import http2 from "ext:deno_node/http2.ts"; -import https from "ext:deno_node/https.ts"; +import assert from "node:assert"; +import assertStrict from "node:assert/strict"; +import asyncHooks from "node:async_hooks"; +import buffer from "node:buffer"; +import childProcess from "node:child_process"; +import cluster from "node:cluster"; +import console from "node:console"; +import constants from "node:constants"; +import crypto from "node:crypto"; +import dgram from "node:dgram"; +import diagnosticsChannel from "node:diagnostics_channel"; +import dns from "node:dns"; +import dnsPromises from "node:dns/promises"; +import domain from "node:domain"; +import events from "node:events"; +import fs from "node:fs"; +import fsPromises from "node:fs/promises"; +import http from "node:http"; +import http2 from "node:http2"; +import https from "node:https"; import inspector from "ext:deno_node/inspector.ts"; import internalCp from "ext:deno_node/internal/child_process.ts"; import internalCryptoCertificate from "ext:deno_node/internal/crypto/certificate.ts"; @@ -98,36 +98,36 @@ import internalTestBinding from "ext:deno_node/internal/test/binding.ts"; import internalTimers from "ext:deno_node/internal/timers.mjs"; import internalUtil from "ext:deno_node/internal/util.mjs"; import internalUtilInspect from "ext:deno_node/internal/util/inspect.mjs"; -import net from "ext:deno_node/net.ts"; -import os from "ext:deno_node/os.ts"; -import pathPosix from "ext:deno_node/path/posix.ts"; -import pathWin32 from "ext:deno_node/path/win32.ts"; -import path from "ext:deno_node/path.ts"; -import perfHooks from "ext:deno_node/perf_hooks.ts"; -import punycode from "ext:deno_node/punycode.ts"; -import process from "ext:deno_node/process.ts"; -import querystring from "ext:deno_node/querystring.ts"; -import readline from "ext:deno_node/readline.ts"; +import net from "node:net"; +import os from "node:os"; +import pathPosix from "node:path/posix"; +import pathWin32 from "node:path/win32"; +import path from "node:path"; +import perfHooks from "node:perf_hooks"; +import punycode from "node:punycode"; +import process from "node:process"; +import querystring from "node:querystring"; +import readline from "node:readline"; import readlinePromises from "ext:deno_node/readline/promises.ts"; import repl from "ext:deno_node/repl.ts"; -import stream from "ext:deno_node/stream.ts"; -import streamConsumers from "ext:deno_node/stream/consumers.mjs"; -import streamPromises from "ext:deno_node/stream/promises.mjs"; -import streamWeb from "ext:deno_node/stream/web.ts"; -import stringDecoder from "ext:deno_node/string_decoder.ts"; -import sys from "ext:deno_node/sys.ts"; -import timers from "ext:deno_node/timers.ts"; -import timersPromises from "ext:deno_node/timers/promises.ts"; -import tls from "ext:deno_node/tls.ts"; -import tty from "ext:deno_node/tty.ts"; -import url from "ext:deno_node/url.ts"; -import utilTypes from "ext:deno_node/util/types.ts"; -import util from "ext:deno_node/util.ts"; -import v8 from "ext:deno_node/v8.ts"; -import vm from "ext:deno_node/vm.ts"; -import workerThreads from "ext:deno_node/worker_threads.ts"; +import stream from "node:stream"; +import streamConsumers from "node:stream/consumers"; +import streamPromises from "node:stream/promises"; +import streamWeb from "node:stream/web"; +import stringDecoder from "node:string_decoder"; +import sys from "node:sys"; +import timers from "node:timers"; +import timersPromises from "node:timers/promises"; +import tls from "node:tls"; +import tty from "node:tty"; +import url from "node:url"; +import utilTypes from "node:util/types"; +import util from "node:util"; +import v8 from "node:v8"; +import vm from "node:vm"; +import workerThreads from "node:worker_threads"; import wasi from "ext:deno_node/wasi.ts"; -import zlib from "ext:deno_node/zlib.ts"; +import zlib from "node:zlib"; const nativeModuleExports = ObjectCreate(null); const builtinModules = []; diff --git a/ext/node/polyfills/02_init.js b/ext/node/polyfills/02_init.js index a2fba8c0c5..8a6e0195f9 100644 --- a/ext/node/polyfills/02_init.js +++ b/ext/node/polyfills/02_init.js @@ -7,7 +7,7 @@ const requireImpl = internals.requireImpl; const primordials = globalThis.__bootstrap.primordials; const { ObjectDefineProperty } = primordials; import { nodeGlobals, nodeGlobalThis } from "ext:deno_node/00_globals.js"; -import "ext:deno_node/01_require.js"; +import "node:module"; let initialized = false; diff --git a/ext/node/polyfills/_brotli.js b/ext/node/polyfills/_brotli.js index 716b918ea3..6f77bb341a 100644 --- a/ext/node/polyfills/_brotli.js +++ b/ext/node/polyfills/_brotli.js @@ -5,8 +5,8 @@ import { zlib as constants } from "ext:deno_node/internal_binding/constants.ts"; import { TextEncoder } from "ext:deno_web/08_text_encoding.js"; -import { Transform } from "ext:deno_node/stream.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Transform } from "node:stream"; +import { Buffer } from "node:buffer"; const { core } = globalThis.__bootstrap; const { ops } = core; diff --git a/ext/node/polyfills/_fs/_fs_access.ts b/ext/node/polyfills/_fs/_fs_access.ts index edb621598c..646403b27e 100644 --- a/ext/node/polyfills/_fs/_fs_access.ts +++ b/ext/node/polyfills/_fs/_fs_access.ts @@ -13,7 +13,7 @@ import { getValidatedPath, getValidMode, } from "ext:deno_node/internal/fs/utils.mjs"; -import type { Buffer } from "ext:deno_node/buffer.ts"; +import type { Buffer } from "node:buffer"; import { promisify } from "ext:deno_node/internal/util.mjs"; export function access( diff --git a/ext/node/polyfills/_fs/_fs_chmod.ts b/ext/node/polyfills/_fs/_fs_chmod.ts index 867ede99c5..b20273f5d6 100644 --- a/ext/node/polyfills/_fs/_fs_chmod.ts +++ b/ext/node/polyfills/_fs/_fs_chmod.ts @@ -5,9 +5,9 @@ import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs"; -import * as pathModule from "ext:deno_node/path.ts"; +import * as pathModule from "node:path"; import { parseFileMode } from "ext:deno_node/internal/validators.mjs"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { promisify } from "ext:deno_node/internal/util.mjs"; export function chmod( diff --git a/ext/node/polyfills/_fs/_fs_chown.ts b/ext/node/polyfills/_fs/_fs_chown.ts index 6cd78d2068..6e835146fb 100644 --- a/ext/node/polyfills/_fs/_fs_chown.ts +++ b/ext/node/polyfills/_fs/_fs_chown.ts @@ -11,9 +11,9 @@ import { getValidatedPath, kMaxUserId, } from "ext:deno_node/internal/fs/utils.mjs"; -import * as pathModule from "ext:deno_node/path.ts"; +import * as pathModule from "node:path"; import { validateInteger } from "ext:deno_node/internal/validators.mjs"; -import type { Buffer } from "ext:deno_node/buffer.ts"; +import type { Buffer } from "node:buffer"; import { promisify } from "ext:deno_node/internal/util.mjs"; /** diff --git a/ext/node/polyfills/_fs/_fs_copy.ts b/ext/node/polyfills/_fs/_fs_copy.ts index 3d51d6faed..6ecf516e4f 100644 --- a/ext/node/polyfills/_fs/_fs_copy.ts +++ b/ext/node/polyfills/_fs/_fs_copy.ts @@ -5,7 +5,7 @@ import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts"; import { makeCallback } from "ext:deno_node/_fs/_fs_common.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { getValidatedPath, getValidMode, diff --git a/ext/node/polyfills/_fs/_fs_open.ts b/ext/node/polyfills/_fs/_fs_open.ts index 4fccf8c287..571a06a5d2 100644 --- a/ext/node/polyfills/_fs/_fs_open.ts +++ b/ext/node/polyfills/_fs/_fs_open.ts @@ -16,7 +16,7 @@ import { parseFileMode } from "ext:deno_node/internal/validators.mjs"; import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs"; import { FileHandle } from "ext:deno_node/internal/fs/handle.ts"; -import type { Buffer } from "ext:deno_node/buffer.ts"; +import type { Buffer } from "node:buffer"; function existsSync(filePath: string | URL): boolean { try { diff --git a/ext/node/polyfills/_fs/_fs_opendir.ts b/ext/node/polyfills/_fs/_fs_opendir.ts index 1a36649156..2ab0a62802 100644 --- a/ext/node/polyfills/_fs/_fs_opendir.ts +++ b/ext/node/polyfills/_fs/_fs_opendir.ts @@ -4,7 +4,7 @@ // deno-lint-ignore-file prefer-primordials import Dir from "ext:deno_node/_fs/_fs_dir.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { getOptions, getValidatedPath, diff --git a/ext/node/polyfills/_fs/_fs_read.ts b/ext/node/polyfills/_fs/_fs_read.ts index e220b62e44..6d7efbeefa 100644 --- a/ext/node/polyfills/_fs/_fs_read.ts +++ b/ext/node/polyfills/_fs/_fs_read.ts @@ -3,7 +3,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts"; import * as io from "ext:deno_io/12_io.js"; import * as fs from "ext:deno_fs/30_fs.js"; diff --git a/ext/node/polyfills/_fs/_fs_readFile.ts b/ext/node/polyfills/_fs/_fs_readFile.ts index ad7456254a..740ca4e3d4 100644 --- a/ext/node/polyfills/_fs/_fs_readFile.ts +++ b/ext/node/polyfills/_fs/_fs_readFile.ts @@ -9,7 +9,7 @@ import { getEncoding, TextOptionsArgument, } from "ext:deno_node/_fs/_fs_common.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { readAll } from "ext:deno_io/12_io.js"; import { FileHandle } from "ext:deno_node/internal/fs/handle.ts"; import { pathFromURL } from "ext:deno_web/00_infra.js"; diff --git a/ext/node/polyfills/_fs/_fs_readdir.ts b/ext/node/polyfills/_fs/_fs_readdir.ts index f00e47927c..ce8e0185c6 100644 --- a/ext/node/polyfills/_fs/_fs_readdir.ts +++ b/ext/node/polyfills/_fs/_fs_readdir.ts @@ -8,7 +8,7 @@ import { asyncIterableToCallback } from "ext:deno_node/_fs/_fs_watch.ts"; import Dirent from "ext:deno_node/_fs/_fs_dirent.ts"; import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { promisify } from "ext:deno_node/internal/util.mjs"; function toDirent(val: Deno.DirEntry): Dirent { diff --git a/ext/node/polyfills/_fs/_fs_rmdir.ts b/ext/node/polyfills/_fs/_fs_rmdir.ts index e375d489e8..c2c43e1e32 100644 --- a/ext/node/polyfills/_fs/_fs_rmdir.ts +++ b/ext/node/polyfills/_fs/_fs_rmdir.ts @@ -10,12 +10,12 @@ import { validateRmOptions, validateRmOptionsSync, } from "ext:deno_node/internal/fs/utils.mjs"; -import { toNamespacedPath } from "ext:deno_node/path.ts"; +import { toNamespacedPath } from "node:path"; import { denoErrorToNodeError, ERR_FS_RMDIR_ENOTDIR, } from "ext:deno_node/internal/errors.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { promisify } from "ext:deno_node/internal/util.mjs"; type rmdirOptions = { diff --git a/ext/node/polyfills/_fs/_fs_watch.ts b/ext/node/polyfills/_fs/_fs_watch.ts index 32b7bbf5d5..1b132bebcc 100644 --- a/ext/node/polyfills/_fs/_fs_watch.ts +++ b/ext/node/polyfills/_fs/_fs_watch.ts @@ -3,15 +3,15 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { basename } from "ext:deno_node/path.ts"; -import { EventEmitter } from "ext:deno_node/events.ts"; +import { basename } from "node:path"; +import { EventEmitter } from "node:events"; import { notImplemented } from "ext:deno_node/_utils.ts"; -import { promisify } from "ext:deno_node/util.ts"; +import { promisify } from "node:util"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs"; import { validateFunction } from "ext:deno_node/internal/validators.mjs"; import { stat, Stats } from "ext:deno_node/_fs/_fs_stat.ts"; import { Stats as StatsClass } from "ext:deno_node/internal/fs/utils.mjs"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { delay } from "ext:deno_node/_util/async.ts"; const statPromisified = promisify(stat); diff --git a/ext/node/polyfills/_fs/_fs_write.mjs b/ext/node/polyfills/_fs/_fs_write.mjs index 63fbcb49cc..aea1e72365 100644 --- a/ext/node/polyfills/_fs/_fs_write.mjs +++ b/ext/node/polyfills/_fs/_fs_write.mjs @@ -4,7 +4,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { validateEncoding, validateInteger } from "ext:deno_node/internal/validators.mjs"; import * as io from "ext:deno_io/12_io.js"; import * as fs from "ext:deno_fs/30_fs.js"; diff --git a/ext/node/polyfills/_fs/_fs_writeFile.ts b/ext/node/polyfills/_fs/_fs_writeFile.ts index 7d8c8243d2..3f263173fa 100644 --- a/ext/node/polyfills/_fs/_fs_writeFile.ts +++ b/ext/node/polyfills/_fs/_fs_writeFile.ts @@ -5,7 +5,7 @@ import { Encodings } from "ext:deno_node/_utils.ts"; import { pathFromURL } from "ext:deno_web/00_infra.js"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { CallbackWithError, checkEncoding, diff --git a/ext/node/polyfills/_fs/_fs_writev.mjs b/ext/node/polyfills/_fs/_fs_writev.mjs index 34f77ac21b..f27985c2a2 100644 --- a/ext/node/polyfills/_fs/_fs_writev.mjs +++ b/ext/node/polyfills/_fs/_fs_writev.mjs @@ -4,7 +4,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { validateBufferArray } from "ext:deno_node/internal/fs/utils.mjs"; import { getValidatedFd } from "ext:deno_node/internal/fs/utils.mjs"; import { maybeCallback } from "ext:deno_node/_fs/_fs_common.ts"; diff --git a/ext/node/polyfills/_global.d.ts b/ext/node/polyfills/_global.d.ts index e137556f46..9ec64dfd78 100644 --- a/ext/node/polyfills/_global.d.ts +++ b/ext/node/polyfills/_global.d.ts @@ -1,6 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. import { EventEmitter } from "ext:deno_node/_events.d.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; /** One of: * | "ascii" diff --git a/ext/node/polyfills/_http_agent.mjs b/ext/node/polyfills/_http_agent.mjs index 1e693edf93..27a57b783a 100644 --- a/ext/node/polyfills/_http_agent.mjs +++ b/ext/node/polyfills/_http_agent.mjs @@ -4,13 +4,13 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import * as net from "ext:deno_node/net.ts"; -import EventEmitter from "ext:deno_node/events.ts"; +import * as net from "node:net"; +import EventEmitter from "node:events"; import { debuglog } from "ext:deno_node/internal/util/debuglog.ts"; let debug = debuglog("http", (fn) => { debug = fn; }); -import { AsyncResource } from "ext:deno_node/async_hooks.ts"; +import { AsyncResource } from "node:async_hooks"; import { symbols } from "ext:deno_node/internal/async_hooks.ts"; // deno-lint-ignore camelcase const { async_id_symbol } = symbols; diff --git a/ext/node/polyfills/_http_outgoing.ts b/ext/node/polyfills/_http_outgoing.ts index 36e177acc5..62d3af3c69 100644 --- a/ext/node/polyfills/_http_outgoing.ts +++ b/ext/node/polyfills/_http_outgoing.ts @@ -7,17 +7,17 @@ const core = globalThis.__bootstrap.core; import { getDefaultHighWaterMark } from "ext:deno_node/internal/streams/state.mjs"; import assert from "ext:deno_node/internal/assert.mjs"; -import EE from "ext:deno_node/events.ts"; -import { Stream } from "ext:deno_node/stream.ts"; -import { deprecate } from "ext:deno_node/util.ts"; -import type { Socket } from "ext:deno_node/net.ts"; +import EE from "node:events"; +import { Stream } from "node:stream"; +import { deprecate } from "node:util"; +import type { Socket } from "node:net"; import { kNeedDrain, kOutHeaders, // utcDate, } from "ext:deno_node/internal/http.ts"; import { notImplemented } from "ext:deno_node/_utils.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { _checkInvalidHeaderChar as checkInvalidHeaderChar, _checkIsHttpToken as checkIsHttpToken, diff --git a/ext/node/polyfills/_process/streams.mjs b/ext/node/polyfills/_process/streams.mjs index 3968e07ff6..bb9ed69ec4 100644 --- a/ext/node/polyfills/_process/streams.mjs +++ b/ext/node/polyfills/_process/streams.mjs @@ -4,14 +4,14 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { clearLine, clearScreenDown, cursorTo, moveCursor, } from "ext:deno_node/internal/readline/callbacks.mjs"; -import { Duplex, Readable, Writable } from "ext:deno_node/stream.ts"; +import { Duplex, Readable, Writable } from "node:stream"; import { isWindows } from "ext:deno_node/_util/os.ts"; import { fs as fsConstants } from "ext:deno_node/internal_binding/constants.ts"; import * as io from "ext:deno_io/12_io.js"; diff --git a/ext/node/polyfills/_readline.d.ts b/ext/node/polyfills/_readline.d.ts index fcd053d5a7..34eba03114 100644 --- a/ext/node/polyfills/_readline.d.ts +++ b/ext/node/polyfills/_readline.d.ts @@ -6,7 +6,7 @@ import { Abortable, EventEmitter } from "ext:deno_node/_events.d.ts"; import * as promises from "ext:deno_node/readline/promises.ts"; import { ReadableStream, WritableStream } from "ext:deno_node/_global.d.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import type { AsyncCompleter, Completer, diff --git a/ext/node/polyfills/_readline.mjs b/ext/node/polyfills/_readline.mjs index ea1c9b7358..499d803fbc 100644 --- a/ext/node/polyfills/_readline.mjs +++ b/ext/node/polyfills/_readline.mjs @@ -35,7 +35,7 @@ import promises from "ext:deno_node/readline/promises.ts"; import { validateAbortSignal } from "ext:deno_node/internal/validators.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs"; import { AbortError } from "ext:deno_node/internal/errors.ts"; -import process from "ext:deno_node/process.ts"; +import process from "node:process"; import { Interface as _Interface, diff --git a/ext/node/polyfills/_stream.d.ts b/ext/node/polyfills/_stream.d.ts index 382bb9093c..fa9d77fc84 100644 --- a/ext/node/polyfills/_stream.d.ts +++ b/ext/node/polyfills/_stream.d.ts @@ -3,7 +3,7 @@ // Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/4f538975138678878fed5b2555c0672aa578ab7d/types/node/stream.d.ts -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { Abortable, EventEmitter } from "ext:deno_node/_events.d.ts"; import { Buffered, diff --git a/ext/node/polyfills/_stream.mjs b/ext/node/polyfills/_stream.mjs index 2e2fcce8c3..26d5fd30a3 100644 --- a/ext/node/polyfills/_stream.mjs +++ b/ext/node/polyfills/_stream.mjs @@ -5,7 +5,7 @@ import { nextTick } from "ext:deno_node/_next_tick.ts"; import { AbortController } from "ext:deno_web/03_abort_signal.js"; import { Blob } from "ext:deno_web/09_file.js"; -import { StringDecoder } from "ext:deno_node/string_decoder.ts"; +import { StringDecoder } from "node:string_decoder"; import { createDeferredPromise, kEmptyObject, @@ -49,9 +49,9 @@ import { // $ esbuild --bundle --legal-comments=none --target=es2022 --tree-shaking=true --format=esm . // ... then making sure the file uses the existing ext:deno_node stuff instead of bundling it const __process$ = { nextTick }; -import __buffer$ from "ext:deno_node/buffer.ts"; -import __string_decoder$ from "ext:deno_node/string_decoder.ts"; -import __events$ from "ext:deno_node/events.ts"; +import __buffer$ from "node:buffer"; +import __string_decoder$ from "node:string_decoder"; +import __events$ from "node:events"; var __getOwnPropNames = Object.getOwnPropertyNames; var __commonJS = (cb, mod) => @@ -5722,7 +5722,7 @@ import { isWritable, isWritableEnded, } from "ext:deno_node/internal/streams/utils.mjs"; -import { ReadableStream, WritableStream } from "ext:deno_node/stream/web.ts"; +import { ReadableStream, WritableStream } from "node:stream/web"; import { validateBoolean, validateObject, diff --git a/ext/node/polyfills/_tls_wrap.ts b/ext/node/polyfills/_tls_wrap.ts index 561864137b..39df239d0d 100644 --- a/ext/node/polyfills/_tls_wrap.ts +++ b/ext/node/polyfills/_tls_wrap.ts @@ -9,11 +9,11 @@ import { StringPrototypeReplace, } from "ext:deno_node/internal/primordials.mjs"; import assert from "ext:deno_node/internal/assert.mjs"; -import * as net from "ext:deno_node/net.ts"; +import * as net from "node:net"; import { createSecureContext } from "ext:deno_node/_tls_common.ts"; import { kStreamBaseField } from "ext:deno_node/internal_binding/stream_wrap.ts"; import { connResetException } from "ext:deno_node/internal/errors.ts"; -import { emitWarning } from "ext:deno_node/process.ts"; +import { emitWarning } from "node:process"; import { debuglog } from "ext:deno_node/internal/util/debuglog.ts"; import { constants as TCPConstants, @@ -23,7 +23,7 @@ import { constants as PipeConstants, Pipe, } from "ext:deno_node/internal_binding/pipe_wrap.ts"; -import { EventEmitter } from "ext:deno_node/events.ts"; +import { EventEmitter } from "node:events"; import { kEmptyObject } from "ext:deno_node/internal/util.mjs"; import { nextTick } from "ext:deno_node/_next_tick.ts"; diff --git a/ext/node/polyfills/_zlib.mjs b/ext/node/polyfills/_zlib.mjs index c7bf02bee4..f733658000 100644 --- a/ext/node/polyfills/_zlib.mjs +++ b/ext/node/polyfills/_zlib.mjs @@ -4,11 +4,11 @@ // deno-lint-ignore-file -import { Buffer, kMaxLength } from "ext:deno_node/buffer.ts"; -import { Transform } from "ext:deno_node/stream.ts"; +import { Buffer, kMaxLength } from "node:buffer"; +import { Transform } from "node:stream"; import * as binding from "ext:deno_node/_zlib_binding.mjs"; -import util from "ext:deno_node/util.ts"; -import { ok as assert } from "ext:deno_node/assert.ts"; +import util from "node:util"; +import { ok as assert } from "node:assert"; import { zlib as zlibConstants } from "ext:deno_node/internal_binding/constants.ts"; import { nextTick } from "ext:deno_node/_next_tick.ts"; diff --git a/ext/node/polyfills/assert.ts b/ext/node/polyfills/assert.ts index d0f764bb1e..418074505d 100644 --- a/ext/node/polyfills/assert.ts +++ b/ext/node/polyfills/assert.ts @@ -8,7 +8,7 @@ import { AssertionErrorConstructorOptions, } from "ext:deno_node/assertion_error.ts"; import * as asserts from "ext:deno_node/_util/std_asserts.ts"; -import { inspect } from "ext:deno_node/util.ts"; +import { inspect } from "node:util"; import { ERR_AMBIGUOUS_ARGUMENT, ERR_INVALID_ARG_TYPE, diff --git a/ext/node/polyfills/assert/strict.ts b/ext/node/polyfills/assert/strict.ts index ce7435d670..ef4bbba6ac 100644 --- a/ext/node/polyfills/assert/strict.ts +++ b/ext/node/polyfills/assert/strict.ts @@ -1,5 +1,5 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -import { strict } from "ext:deno_node/assert.ts"; +import { strict } from "node:assert"; export { AssertionError, @@ -20,7 +20,7 @@ export { rejects, strictEqual, throws, -} from "ext:deno_node/assert.ts"; +} from "node:assert"; export { strict }; export default strict; diff --git a/ext/node/polyfills/assertion_error.ts b/ext/node/polyfills/assertion_error.ts index e6aec61654..ecfedd4a54 100644 --- a/ext/node/polyfills/assertion_error.ts +++ b/ext/node/polyfills/assertion_error.ts @@ -24,7 +24,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { inspect } from "ext:deno_node/util.ts"; +import { inspect } from "node:util"; import { stripColor as removeColors } from "ext:deno_node/_util/std_fmt_colors.ts"; import * as io from "ext:deno_io/12_io.js"; diff --git a/ext/node/polyfills/child_process.ts b/ext/node/polyfills/child_process.ts index 0b8a15a027..94a1084473 100644 --- a/ext/node/polyfills/child_process.ts +++ b/ext/node/polyfills/child_process.ts @@ -38,10 +38,10 @@ import { ObjectAssign, StringPrototypeSlice, } from "ext:deno_node/internal/primordials.mjs"; -import { getSystemErrorName, promisify } from "ext:deno_node/util.ts"; +import { getSystemErrorName, promisify } from "node:util"; import { createDeferredPromise } from "ext:deno_node/internal/util.mjs"; -import process from "ext:deno_node/process.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import process from "node:process"; +import { Buffer } from "node:buffer"; import { convertToValidSignal, kEmptyObject, diff --git a/ext/node/polyfills/constants.ts b/ext/node/polyfills/constants.ts index 4584da6ccd..3a866c9739 100644 --- a/ext/node/polyfills/constants.ts +++ b/ext/node/polyfills/constants.ts @@ -2,8 +2,8 @@ // Based on: https://github.com/nodejs/node/blob/0646eda/lib/constants.js -import { constants as fsConstants } from "ext:deno_node/fs.ts"; -import { constants as osConstants } from "ext:deno_node/os.ts"; +import { constants as fsConstants } from "node:fs"; +import { constants as osConstants } from "node:os"; export default { ...fsConstants, diff --git a/ext/node/polyfills/dgram.ts b/ext/node/polyfills/dgram.ts index d164936c4d..f533f2ce1b 100644 --- a/ext/node/polyfills/dgram.ts +++ b/ext/node/polyfills/dgram.ts @@ -23,9 +23,9 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; -import { EventEmitter } from "ext:deno_node/events.ts"; -import { lookup as defaultLookup } from "ext:deno_node/dns.ts"; +import { Buffer } from "node:buffer"; +import { EventEmitter } from "node:events"; +import { lookup as defaultLookup } from "node:dns"; import type { ErrnoException, NodeSystemErrorCtx, @@ -62,8 +62,8 @@ import { } from "ext:deno_node/internal/validators.mjs"; import { guessHandleType } from "ext:deno_node/internal_binding/util.ts"; import { os } from "ext:deno_node/internal_binding/constants.ts"; -import { nextTick } from "ext:deno_node/process.ts"; -import { channel } from "ext:deno_node/diagnostics_channel.ts"; +import { nextTick } from "node:process"; +import { channel } from "node:diagnostics_channel"; import { isArrayBufferView } from "ext:deno_node/internal/util/types.ts"; const { UV_UDP_REUSEADDR, UV_UDP_IPV6ONLY } = os; diff --git a/ext/node/polyfills/diagnostics_channel.ts b/ext/node/polyfills/diagnostics_channel.ts index fb6482c29a..0a00fbf976 100644 --- a/ext/node/polyfills/diagnostics_channel.ts +++ b/ext/node/polyfills/diagnostics_channel.ts @@ -5,7 +5,7 @@ import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts"; import { validateFunction } from "ext:deno_node/internal/validators.mjs"; -import { nextTick } from "ext:deno_node/process.ts"; +import { nextTick } from "node:process"; type Subscriber = (message: unknown, name?: string) => void; diff --git a/ext/node/polyfills/dns.ts b/ext/node/polyfills/dns.ts index 6f209962fd..9701976f33 100644 --- a/ext/node/polyfills/dns.ts +++ b/ext/node/polyfills/dns.ts @@ -92,7 +92,7 @@ import { GetAddrInfoReqWrap, QueryReqWrap, } from "ext:deno_node/internal_binding/cares_wrap.ts"; -import { toASCII } from "ext:deno_node/punycode.ts"; +import { toASCII } from "node:punycode"; import { notImplemented } from "ext:deno_node/_utils.ts"; function onlookup( diff --git a/ext/node/polyfills/dns/promises.ts b/ext/node/polyfills/dns/promises.ts index 75498b80f4..ce6aad1194 100644 --- a/ext/node/polyfills/dns/promises.ts +++ b/ext/node/polyfills/dns/promises.ts @@ -19,7 +19,7 @@ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -import { promises } from "ext:deno_node/dns.ts"; +import { promises } from "node:dns"; export const { getServers, lookup, diff --git a/ext/node/polyfills/fs/promises.ts b/ext/node/polyfills/fs/promises.ts index e07dbea008..224b547f38 100644 --- a/ext/node/polyfills/fs/promises.ts +++ b/ext/node/polyfills/fs/promises.ts @@ -1,5 +1,5 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -import { promises as fsPromises } from "ext:deno_node/fs.ts"; +import { promises as fsPromises } from "node:fs"; export const access = fsPromises.access; export const copyFile = fsPromises.copyFile; diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index f651b1f503..fcc4909208 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -13,10 +13,10 @@ import { // createConnection, ListenOptions, Socket, -} from "ext:deno_node/net.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +} from "node:net"; +import { Buffer } from "node:buffer"; import { ERR_SERVER_NOT_RUNNING } from "ext:deno_node/internal/errors.ts"; -import { EventEmitter } from "ext:deno_node/events.ts"; +import { EventEmitter } from "node:events"; import { nextTick } from "ext:deno_node/_next_tick.ts"; import { validateBoolean, @@ -29,13 +29,13 @@ import { finished, Readable as NodeReadable, Writable as NodeWritable, -} from "ext:deno_node/stream.ts"; +} from "node:stream"; import { OutgoingMessage, parseUniqueHeadersOption, validateHeaderName, } from "ext:deno_node/_http_outgoing.ts"; -import { ok as assert } from "ext:deno_node/assert.ts"; +import { ok as assert } from "node:assert"; import { kOutHeaders } from "ext:deno_node/internal/http.ts"; import { _checkIsHttpToken as checkIsHttpToken } from "ext:deno_node/_http_common.ts"; import { Agent, globalAgent } from "ext:deno_node/_http_agent.mjs"; diff --git a/ext/node/polyfills/http2.ts b/ext/node/polyfills/http2.ts index f5d819bb71..20306584f8 100644 --- a/ext/node/polyfills/http2.ts +++ b/ext/node/polyfills/http2.ts @@ -5,12 +5,12 @@ // deno-lint-ignore-file prefer-primordials import { notImplemented, warnNotImplemented } from "ext:deno_node/_utils.ts"; -import { EventEmitter } from "ext:deno_node/events.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; -import { Server, Socket, TCP } from "ext:deno_node/net.ts"; +import { EventEmitter } from "node:events"; +import { Buffer } from "node:buffer"; +import { Server, Socket, TCP } from "node:net"; import { TypedArray } from "ext:deno_node/internal/util/types.ts"; import { setStreamTimeout } from "ext:deno_node/internal/stream_base_commons.ts"; -import { FileHandle } from "ext:deno_node/fs/promises.ts"; +import { FileHandle } from "node:fs/promises"; import { kStreamBaseField } from "ext:deno_node/internal_binding/stream_wrap.ts"; import { addTrailers, serveHttpOnConnection } from "ext:deno_http/00_serve.js"; import { type Deferred, deferred } from "ext:deno_node/_util/async.ts"; diff --git a/ext/node/polyfills/https.ts b/ext/node/polyfills/https.ts index 6b7c315d25..c504f08747 100644 --- a/ext/node/polyfills/https.ts +++ b/ext/node/polyfills/https.ts @@ -10,16 +10,13 @@ import { ClientRequest, IncomingMessageForClient as IncomingMessage, type RequestOptions, -} from "ext:deno_node/http.ts"; +} from "node:http"; import { Agent as HttpAgent } from "ext:deno_node/_http_agent.mjs"; import { createHttpClient } from "ext:deno_fetch/22_http_client.js"; -import { - type ServerHandler, - ServerImpl as HttpServer, -} from "ext:deno_node/http.ts"; +import { type ServerHandler, ServerImpl as HttpServer } from "node:http"; import { validateObject } from "ext:deno_node/internal/validators.mjs"; import { kEmptyObject } from "ext:deno_node/internal/util.mjs"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; export class Server extends HttpServer { constructor(opts, requestListener?: ServerHandler) { diff --git a/ext/node/polyfills/inspector.ts b/ext/node/polyfills/inspector.ts index 0522bb40da..0cfe0240d4 100644 --- a/ext/node/polyfills/inspector.ts +++ b/ext/node/polyfills/inspector.ts @@ -4,7 +4,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { EventEmitter } from "ext:deno_node/events.ts"; +import { EventEmitter } from "node:events"; import { notImplemented } from "ext:deno_node/_utils.ts"; const connectionSymbol = Symbol("connectionProperty"); diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index cab52a4ba1..b11281fd72 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -7,10 +7,10 @@ // deno-lint-ignore-file prefer-primordials import { assert } from "ext:deno_node/_util/asserts.ts"; -import { EventEmitter } from "ext:deno_node/events.ts"; +import { EventEmitter } from "node:events"; import { os } from "ext:deno_node/internal_binding/constants.ts"; import { notImplemented, warnNotImplemented } from "ext:deno_node/_utils.ts"; -import { Readable, Stream, Writable } from "ext:deno_node/stream.ts"; +import { Readable, Stream, Writable } from "node:stream"; import { deferred } from "ext:deno_node/_util/async.ts"; import { isWindows } from "ext:deno_node/_util/os.ts"; import { nextTick } from "ext:deno_node/_next_tick.ts"; @@ -20,7 +20,7 @@ import { ERR_INVALID_ARG_VALUE, ERR_UNKNOWN_SIGNAL, } from "ext:deno_node/internal/errors.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { errnoException } from "ext:deno_node/internal/errors.ts"; import { ErrnoException } from "ext:deno_node/_global.d.ts"; import { codeMap } from "ext:deno_node/internal_binding/uv.ts"; @@ -43,7 +43,7 @@ import { } from "ext:deno_node/internal/primordials.mjs"; import { kEmptyObject } from "ext:deno_node/internal/util.mjs"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs"; -import process from "ext:deno_node/process.ts"; +import process from "node:process"; export function mapValues( record: Readonly>, diff --git a/ext/node/polyfills/internal/console/constructor.mjs b/ext/node/polyfills/internal/console/constructor.mjs index 9c28fc9ebd..f15e677ec0 100644 --- a/ext/node/polyfills/internal/console/constructor.mjs +++ b/ext/node/polyfills/internal/console/constructor.mjs @@ -28,7 +28,7 @@ const previewEntries = (iter, isKeyValue) => { return [...iter]; } }; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; const { isBuffer } = Buffer; import { formatWithOptions, inspect } from "ext:deno_node/internal/util/inspect.mjs"; import { diff --git a/ext/node/polyfills/internal/crypto/_randomBytes.ts b/ext/node/polyfills/internal/crypto/_randomBytes.ts index aff5ea5227..71fdca99c9 100644 --- a/ext/node/polyfills/internal/crypto/_randomBytes.ts +++ b/ext/node/polyfills/internal/crypto/_randomBytes.ts @@ -3,7 +3,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; export const MAX_RANDOM_VALUES = 65536; export const MAX_SIZE = 4294967295; diff --git a/ext/node/polyfills/internal/crypto/_randomFill.ts b/ext/node/polyfills/internal/crypto/_randomFill.ts index dab6d3108e..927acaf8d0 100644 --- a/ext/node/polyfills/internal/crypto/_randomFill.ts +++ b/ext/node/polyfills/internal/crypto/_randomFill.ts @@ -6,7 +6,7 @@ import { MAX_SIZE as kMaxUint32, } from "ext:deno_node/internal/crypto/_randomBytes.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; const { core } = globalThis.__bootstrap; const { ops } = core; diff --git a/ext/node/polyfills/internal/crypto/certificate.ts b/ext/node/polyfills/internal/crypto/certificate.ts index ebcfecbdad..98c00a621b 100644 --- a/ext/node/polyfills/internal/crypto/certificate.ts +++ b/ext/node/polyfills/internal/crypto/certificate.ts @@ -2,7 +2,7 @@ // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. import { notImplemented } from "ext:deno_node/_utils.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { BinaryLike } from "ext:deno_node/internal/crypto/types.ts"; export class Certificate { diff --git a/ext/node/polyfills/internal/crypto/cipher.ts b/ext/node/polyfills/internal/crypto/cipher.ts index 002cafe1ce..e954562c58 100644 --- a/ext/node/polyfills/internal/crypto/cipher.ts +++ b/ext/node/polyfills/internal/crypto/cipher.ts @@ -9,7 +9,7 @@ import { validateInt32, validateObject, } from "ext:deno_node/internal/validators.mjs"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { notImplemented } from "ext:deno_node/_utils.ts"; import type { TransformOptions } from "ext:deno_node/_stream.d.ts"; import { Transform } from "ext:deno_node/_stream.mjs"; diff --git a/ext/node/polyfills/internal/crypto/diffiehellman.ts b/ext/node/polyfills/internal/crypto/diffiehellman.ts index 7621e93fcc..9b11920cd5 100644 --- a/ext/node/polyfills/internal/crypto/diffiehellman.ts +++ b/ext/node/polyfills/internal/crypto/diffiehellman.ts @@ -18,7 +18,7 @@ import { validateInt32, validateString, } from "ext:deno_node/internal/validators.mjs"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { EllipticCurve, ellipticCurves, diff --git a/ext/node/polyfills/internal/crypto/hash.ts b/ext/node/polyfills/internal/crypto/hash.ts index d24c23ec9f..cd29251c23 100644 --- a/ext/node/polyfills/internal/crypto/hash.ts +++ b/ext/node/polyfills/internal/crypto/hash.ts @@ -5,8 +5,8 @@ // deno-lint-ignore-file prefer-primordials import { TextEncoder } from "ext:deno_web/08_text_encoding.js"; -import { Buffer } from "ext:deno_node/buffer.ts"; -import { Transform } from "ext:deno_node/stream.ts"; +import { Buffer } from "node:buffer"; +import { Transform } from "node:stream"; import { forgivingBase64Encode as encodeToBase64, forgivingBase64UrlEncode as encodeToBase64Url, diff --git a/ext/node/polyfills/internal/crypto/keygen.ts b/ext/node/polyfills/internal/crypto/keygen.ts index c0f82d9dfc..29a062e002 100644 --- a/ext/node/polyfills/internal/crypto/keygen.ts +++ b/ext/node/polyfills/internal/crypto/keygen.ts @@ -26,7 +26,7 @@ import { validateString, validateUint32, } from "ext:deno_node/internal/validators.mjs"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { KeyFormat, KeyType } from "ext:deno_node/internal/crypto/types.ts"; const { core } = globalThis.__bootstrap; diff --git a/ext/node/polyfills/internal/crypto/keys.ts b/ext/node/polyfills/internal/crypto/keys.ts index 8356a908c9..f6e5cbb86c 100644 --- a/ext/node/polyfills/internal/crypto/keys.ts +++ b/ext/node/polyfills/internal/crypto/keys.ts @@ -20,7 +20,7 @@ import type { PrivateKeyInput, PublicKeyInput, } from "ext:deno_node/internal/crypto/types.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { isAnyArrayBuffer, isArrayBufferView, diff --git a/ext/node/polyfills/internal/crypto/pbkdf2.ts b/ext/node/polyfills/internal/crypto/pbkdf2.ts index 10f35e54f4..f177d153a2 100644 --- a/ext/node/polyfills/internal/crypto/pbkdf2.ts +++ b/ext/node/polyfills/internal/crypto/pbkdf2.ts @@ -3,7 +3,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { HASH_DATA } from "ext:deno_node/internal/crypto/types.ts"; const { core } = globalThis.__bootstrap; diff --git a/ext/node/polyfills/internal/crypto/scrypt.ts b/ext/node/polyfills/internal/crypto/scrypt.ts index ca9187edbc..e87cdb856c 100644 --- a/ext/node/polyfills/internal/crypto/scrypt.ts +++ b/ext/node/polyfills/internal/crypto/scrypt.ts @@ -26,7 +26,7 @@ SOFTWARE. // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { HASH_DATA } from "ext:deno_node/internal/crypto/types.ts"; const { core } = globalThis.__bootstrap; diff --git a/ext/node/polyfills/internal/crypto/sig.ts b/ext/node/polyfills/internal/crypto/sig.ts index 29e8ba3bbe..ebbd11dc6c 100644 --- a/ext/node/polyfills/internal/crypto/sig.ts +++ b/ext/node/polyfills/internal/crypto/sig.ts @@ -9,7 +9,7 @@ import { validateFunction, validateString, } from "ext:deno_node/internal/validators.mjs"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import type { WritableOptions } from "ext:deno_node/_stream.d.ts"; import Writable from "ext:deno_node/internal/streams/writable.mjs"; import type { diff --git a/ext/node/polyfills/internal/crypto/util.ts b/ext/node/polyfills/internal/crypto/util.ts index ad4e8ef23b..57977ace27 100644 --- a/ext/node/polyfills/internal/crypto/util.ts +++ b/ext/node/polyfills/internal/crypto/util.ts @@ -5,7 +5,7 @@ // deno-lint-ignore-file prefer-primordials import { notImplemented } from "ext:deno_node/_utils.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { ERR_INVALID_ARG_TYPE, hideStackFrames, diff --git a/ext/node/polyfills/internal/crypto/x509.ts b/ext/node/polyfills/internal/crypto/x509.ts index d01c81ddf5..ea2b3b8a09 100644 --- a/ext/node/polyfills/internal/crypto/x509.ts +++ b/ext/node/polyfills/internal/crypto/x509.ts @@ -5,7 +5,7 @@ // deno-lint-ignore-file prefer-primordials import { KeyObject } from "ext:deno_node/internal/crypto/keys.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts"; import { isArrayBufferView } from "ext:deno_node/internal/util/types.ts"; import { validateString } from "ext:deno_node/internal/validators.mjs"; diff --git a/ext/node/polyfills/internal/dgram.ts b/ext/node/polyfills/internal/dgram.ts index cffbe9a9a7..8794a26d8b 100644 --- a/ext/node/polyfills/internal/dgram.ts +++ b/ext/node/polyfills/internal/dgram.ts @@ -23,7 +23,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { lookup as defaultLookup } from "ext:deno_node/dns.ts"; +import { lookup as defaultLookup } from "node:dns"; import { isInt32, validateFunction, diff --git a/ext/node/polyfills/internal/dns/promises.ts b/ext/node/polyfills/internal/dns/promises.ts index c88377aff9..c68fedae35 100644 --- a/ext/node/polyfills/internal/dns/promises.ts +++ b/ext/node/polyfills/internal/dns/promises.ts @@ -59,7 +59,7 @@ import { GetAddrInfoReqWrap, QueryReqWrap, } from "ext:deno_node/internal_binding/cares_wrap.ts"; -import { toASCII } from "ext:deno_node/punycode.ts"; +import { toASCII } from "node:punycode"; function onlookup( this: GetAddrInfoReqWrap, diff --git a/ext/node/polyfills/internal/dns/utils.ts b/ext/node/polyfills/internal/dns/utils.ts index e9747f42ed..c78046b56a 100644 --- a/ext/node/polyfills/internal/dns/utils.ts +++ b/ext/node/polyfills/internal/dns/utils.ts @@ -24,7 +24,7 @@ // deno-lint-ignore-file prefer-primordials import { getOptionValue } from "ext:deno_node/internal/options.ts"; -import { emitWarning } from "ext:deno_node/process.ts"; +import { emitWarning } from "node:process"; import { AI_ADDRCONFIG, AI_ALL, diff --git a/ext/node/polyfills/internal/event_target.mjs b/ext/node/polyfills/internal/event_target.mjs index 2ecbbcde9d..7f7ab8c609 100644 --- a/ext/node/polyfills/internal/event_target.mjs +++ b/ext/node/polyfills/internal/event_target.mjs @@ -11,7 +11,7 @@ import { ERR_MISSING_ARGS, } from "ext:deno_node/internal/errors.ts"; import { validateObject, validateString } from "ext:deno_node/internal/validators.mjs"; -import { emitWarning } from "ext:deno_node/process.ts"; +import { emitWarning } from "node:process"; import { nextTick } from "ext:deno_node/_next_tick.ts"; import { Event as WebEvent, EventTarget as WebEventTarget } from "ext:deno_web/02_event.js"; @@ -20,12 +20,12 @@ import { kEmptyObject, kEnumerableProperty, } from "ext:deno_node/internal/util.mjs"; -import { inspect } from "ext:deno_node/util.ts"; +import { inspect } from "node:util"; const kIsEventTarget = Symbol.for("nodejs.event_target"); const kIsNodeEventTarget = Symbol("kIsNodeEventTarget"); -import { EventEmitter } from "ext:deno_node/events.ts"; +import { EventEmitter } from "node:events"; const { kMaxEventTargetListeners, kMaxEventTargetListenersWarned, diff --git a/ext/node/polyfills/internal/fs/handle.ts b/ext/node/polyfills/internal/fs/handle.ts index 28b97616a6..edf2708e92 100644 --- a/ext/node/polyfills/internal/fs/handle.ts +++ b/ext/node/polyfills/internal/fs/handle.ts @@ -3,9 +3,9 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { EventEmitter } from "ext:deno_node/events.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; -import { promises, read, write } from "ext:deno_node/fs.ts"; +import { EventEmitter } from "node:events"; +import { Buffer } from "node:buffer"; +import { promises, read, write } from "node:fs"; import { BinaryOptionsArgument, FileOptionsArgument, diff --git a/ext/node/polyfills/internal/fs/streams.d.ts b/ext/node/polyfills/internal/fs/streams.d.ts index 03d12b6d7e..7562bfb852 100644 --- a/ext/node/polyfills/internal/fs/streams.d.ts +++ b/ext/node/polyfills/internal/fs/streams.d.ts @@ -3,9 +3,9 @@ // deno-lint-ignore-file no-explicit-any import * as stream from "ext:deno_node/_stream.d.ts"; -import * as promises from "ext:deno_node/fs/promises.ts"; +import * as promises from "node:fs/promises"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { BufferEncoding, ErrnoException } from "ext:deno_node/_global.d.ts"; type PathLike = string | Buffer | URL; diff --git a/ext/node/polyfills/internal/fs/streams.mjs b/ext/node/polyfills/internal/fs/streams.mjs index feb13462b3..ef913f6e23 100644 --- a/ext/node/polyfills/internal/fs/streams.mjs +++ b/ext/node/polyfills/internal/fs/streams.mjs @@ -6,7 +6,7 @@ import { ERR_INVALID_ARG_TYPE, ERR_OUT_OF_RANGE } from "ext:deno_node/internal/errors.ts"; import { kEmptyObject } from "ext:deno_node/internal/util.mjs"; -import { deprecate } from "ext:deno_node/util.ts"; +import { deprecate } from "node:util"; import { validateFunction, validateInteger } from "ext:deno_node/internal/validators.mjs"; import { errorOrDestroy } from "ext:deno_node/internal/streams/destroy.mjs"; import { open as fsOpen } from "ext:deno_node/_fs/_fs_open.ts"; @@ -14,14 +14,14 @@ import { read as fsRead } from "ext:deno_node/_fs/_fs_read.ts"; import { write as fsWrite } from "ext:deno_node/_fs/_fs_write.mjs"; import { writev as fsWritev } from "ext:deno_node/_fs/_fs_writev.mjs"; import { close as fsClose } from "ext:deno_node/_fs/_fs_close.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { copyObject, getOptions, getValidatedFd, validatePath, } from "ext:deno_node/internal/fs/utils.mjs"; -import { finished, Readable, Writable } from "ext:deno_node/stream.ts"; +import { finished, Readable, Writable } from "node:stream"; import { toPathIfFileURL } from "ext:deno_node/internal/url.ts"; import { nextTick } from "ext:deno_node/_next_tick.ts"; const kIoDone = Symbol("kIoDone"); diff --git a/ext/node/polyfills/internal/fs/utils.mjs b/ext/node/polyfills/internal/fs/utils.mjs index d73aae19bf..09169127d2 100644 --- a/ext/node/polyfills/internal/fs/utils.mjs +++ b/ext/node/polyfills/internal/fs/utils.mjs @@ -5,7 +5,7 @@ "use strict"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { ERR_FS_EISDIR, ERR_FS_INVALID_SYMLINK_TYPE, @@ -23,7 +23,7 @@ import { isUint8Array, } from "ext:deno_node/internal/util/types.ts"; import { once } from "ext:deno_node/internal/util.mjs"; -import { deprecate } from "ext:deno_node/util.ts"; +import { deprecate } from "node:util"; import { toPathIfFileURL } from "ext:deno_node/internal/url.ts"; import { validateAbortSignal, @@ -34,14 +34,14 @@ import { validateObject, validateUint32, } from "ext:deno_node/internal/validators.mjs"; -import pathModule from "ext:deno_node/path.ts"; +import pathModule from "node:path"; const kType = Symbol("type"); const kStats = Symbol("stats"); import assert from "ext:deno_node/internal/assert.mjs"; import { lstat, lstatSync } from "ext:deno_node/_fs/_fs_lstat.ts"; import { stat, statSync } from "ext:deno_node/_fs/_fs_stat.ts"; import { isWindows } from "ext:deno_node/_util/os.ts"; -import process from "ext:deno_node/process.ts"; +import process from "node:process"; import { fs as fsConstants, diff --git a/ext/node/polyfills/internal/http.ts b/ext/node/polyfills/internal/http.ts index 00e6506eb4..3ea589907f 100644 --- a/ext/node/polyfills/internal/http.ts +++ b/ext/node/polyfills/internal/http.ts @@ -4,7 +4,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { setUnrefTimeout } from "ext:deno_node/timers.ts"; +import { setUnrefTimeout } from "node:timers"; import { notImplemented } from "ext:deno_node/_utils.ts"; let utcCache: string | undefined; diff --git a/ext/node/polyfills/internal/net.ts b/ext/node/polyfills/internal/net.ts index cec65aabd4..4a6b8ba2c7 100644 --- a/ext/node/polyfills/internal/net.ts +++ b/ext/node/polyfills/internal/net.ts @@ -23,7 +23,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { uvException } from "ext:deno_node/internal/errors.ts"; import { writeBuffer } from "ext:deno_node/internal_binding/node_file.ts"; diff --git a/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs b/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs index 145dd18ff0..6a68e0f678 100644 --- a/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs +++ b/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs @@ -25,13 +25,13 @@ import { charLengthAt, CSI, emitKeys } from "ext:deno_node/internal/readline/utils.mjs"; import { kSawKeyPress } from "ext:deno_node/internal/readline/symbols.mjs"; -import { clearTimeout, setTimeout } from "ext:deno_node/timers.ts"; +import { clearTimeout, setTimeout } from "node:timers"; const { kEscape, } = CSI; -import { StringDecoder } from "ext:deno_node/string_decoder.ts"; +import { StringDecoder } from "node:string_decoder"; const KEYPRESS_DECODER = Symbol("keypress-decoder"); const ESCAPE_DECODER = Symbol("escape-decoder"); diff --git a/ext/node/polyfills/internal/readline/interface.mjs b/ext/node/polyfills/internal/readline/interface.mjs index 8f0eb50476..3c214322a9 100644 --- a/ext/node/polyfills/internal/readline/interface.mjs +++ b/ext/node/polyfills/internal/readline/interface.mjs @@ -36,7 +36,7 @@ import { getStringWidth, stripVTControlCharacters, } from "ext:deno_node/internal/util/inspect.mjs"; -import EventEmitter from "ext:deno_node/events.ts"; +import EventEmitter from "node:events"; import { emitKeypressEvents } from "ext:deno_node/internal/readline/emitKeypressEvents.mjs"; import { charLengthAt, @@ -46,9 +46,9 @@ import { } from "ext:deno_node/internal/readline/utils.mjs"; import { clearScreenDown, cursorTo, moveCursor } from "ext:deno_node/internal/readline/callbacks.mjs"; import { Readable } from "ext:deno_node/_stream.mjs"; -import process from "ext:deno_node/process.ts"; +import process from "node:process"; -import { StringDecoder } from "ext:deno_node/string_decoder.ts"; +import { StringDecoder } from "node:string_decoder"; import { kAddHistory, kDecoder, diff --git a/ext/node/polyfills/internal/stream_base_commons.ts b/ext/node/polyfills/internal/stream_base_commons.ts index 9e665d29b0..250f54c7db 100644 --- a/ext/node/polyfills/internal/stream_base_commons.ts +++ b/ext/node/polyfills/internal/stream_base_commons.ts @@ -35,10 +35,10 @@ import { import { isUint8Array } from "ext:deno_node/internal/util/types.ts"; import { errnoException } from "ext:deno_node/internal/errors.ts"; import { getTimerDuration, kTimeout } from "ext:deno_node/internal/timers.mjs"; -import { setUnrefTimeout } from "ext:deno_node/timers.ts"; +import { setUnrefTimeout } from "node:timers"; import { validateFunction } from "ext:deno_node/internal/validators.mjs"; import { codeMap } from "ext:deno_node/internal_binding/uv.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; export const kMaybeDestroy = Symbol("kMaybeDestroy"); export const kUpdateTimer = Symbol("kUpdateTimer"); diff --git a/ext/node/polyfills/internal/streams/buffer_list.mjs b/ext/node/polyfills/internal/streams/buffer_list.mjs index 37ad26b74c..5b81134acc 100644 --- a/ext/node/polyfills/internal/streams/buffer_list.mjs +++ b/ext/node/polyfills/internal/streams/buffer_list.mjs @@ -2,7 +2,7 @@ // Copyright Joyent and Node contributors. All rights reserved. MIT license. // deno-lint-ignore-file -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { inspect } from "ext:deno_node/internal/util/inspect.mjs"; class BufferList { diff --git a/ext/node/polyfills/internal/streams/lazy_transform.mjs b/ext/node/polyfills/internal/streams/lazy_transform.mjs index 2e2defffc1..0606341bbb 100644 --- a/ext/node/polyfills/internal/streams/lazy_transform.mjs +++ b/ext/node/polyfills/internal/streams/lazy_transform.mjs @@ -3,7 +3,7 @@ // deno-lint-ignore-file import { getDefaultEncoding } from "ext:deno_node/internal/crypto/util.ts"; -import stream from "ext:deno_node/stream.ts"; +import stream from "node:stream"; function LazyTransform(options) { this._options = options; diff --git a/ext/node/polyfills/internal/timers.mjs b/ext/node/polyfills/internal/timers.mjs index cf2f8c070c..d7c986917b 100644 --- a/ext/node/polyfills/internal/timers.mjs +++ b/ext/node/polyfills/internal/timers.mjs @@ -7,7 +7,7 @@ import { inspect } from "ext:deno_node/internal/util/inspect.mjs"; import { validateFunction, validateNumber } from "ext:deno_node/internal/validators.mjs"; import { ERR_OUT_OF_RANGE } from "ext:deno_node/internal/errors.ts"; -import { emitWarning } from "ext:deno_node/process.ts"; +import { emitWarning } from "node:process"; import { setTimeout as setTimeout_, clearTimeout as clearTimeout_, diff --git a/ext/node/polyfills/internal/url.ts b/ext/node/polyfills/internal/url.ts index 71d6fb9849..248730f4db 100644 --- a/ext/node/polyfills/internal/url.ts +++ b/ext/node/polyfills/internal/url.ts @@ -3,8 +3,8 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { fileURLToPath } from "ext:deno_node/url.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { fileURLToPath } from "node:url"; +import { Buffer } from "node:buffer"; const searchParams = Symbol("query"); diff --git a/ext/node/polyfills/internal/util/comparisons.ts b/ext/node/polyfills/internal/util/comparisons.ts index 1ceeabaae6..83dcf40dbd 100644 --- a/ext/node/polyfills/internal/util/comparisons.ts +++ b/ext/node/polyfills/internal/util/comparisons.ts @@ -21,7 +21,7 @@ import { isTypedArray, } from "ext:deno_node/internal/util/types.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { getOwnNonIndexProperties, ONLY_ENUMERABLE, diff --git a/ext/node/polyfills/internal_binding/_timingSafeEqual.ts b/ext/node/polyfills/internal_binding/_timingSafeEqual.ts index 3857027b66..8a3064deeb 100644 --- a/ext/node/polyfills/internal_binding/_timingSafeEqual.ts +++ b/ext/node/polyfills/internal_binding/_timingSafeEqual.ts @@ -3,7 +3,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; function assert(cond) { if (!cond) { diff --git a/ext/node/polyfills/internal_binding/stream_wrap.ts b/ext/node/polyfills/internal_binding/stream_wrap.ts index 093094a6a9..4d2c8c4d73 100644 --- a/ext/node/polyfills/internal_binding/stream_wrap.ts +++ b/ext/node/polyfills/internal_binding/stream_wrap.ts @@ -31,7 +31,7 @@ // deno-lint-ignore-file prefer-primordials import { TextEncoder } from "ext:deno_web/08_text_encoding.js"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { notImplemented } from "ext:deno_node/_utils.ts"; import { HandleWrap } from "ext:deno_node/internal_binding/handle_wrap.ts"; import { diff --git a/ext/node/polyfills/internal_binding/udp_wrap.ts b/ext/node/polyfills/internal_binding/udp_wrap.ts index 870a5d479f..d8b0bf0593 100644 --- a/ext/node/polyfills/internal_binding/udp_wrap.ts +++ b/ext/node/polyfills/internal_binding/udp_wrap.ts @@ -34,7 +34,7 @@ import { HandleWrap } from "ext:deno_node/internal_binding/handle_wrap.ts"; import { ownerSymbol } from "ext:deno_node/internal_binding/symbols.ts"; import { codeMap, errorMap } from "ext:deno_node/internal_binding/uv.ts"; import { notImplemented } from "ext:deno_node/_utils.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import type { ErrnoException } from "ext:deno_node/internal/errors.ts"; import { isIP } from "ext:deno_node/internal/net.ts"; import * as net from "ext:deno_net/01_net.js"; diff --git a/ext/node/polyfills/net.ts b/ext/node/polyfills/net.ts index ba39ea7f66..fb1c1bdb64 100644 --- a/ext/node/polyfills/net.ts +++ b/ext/node/polyfills/net.ts @@ -24,14 +24,14 @@ // deno-lint-ignore-file prefer-primordials import { notImplemented } from "ext:deno_node/_utils.ts"; -import { EventEmitter } from "ext:deno_node/events.ts"; +import { EventEmitter } from "node:events"; import { isIP, isIPv4, isIPv6, normalizedArgsSymbol, } from "ext:deno_node/internal/net.ts"; -import { Duplex } from "ext:deno_node/stream.ts"; +import { Duplex } from "node:stream"; import { asyncIdSymbol, defaultTriggerAsyncIdScope, @@ -74,7 +74,7 @@ import { DTRACE_NET_SERVER_CONNECTION, DTRACE_NET_STREAM_END, } from "ext:deno_node/internal/dtrace.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import type { LookupOneOptions } from "ext:deno_node/internal/dns/utils.ts"; import { validateAbortSignal, @@ -97,14 +97,14 @@ import { import { ShutdownWrap } from "ext:deno_node/internal_binding/stream_wrap.ts"; import { assert } from "ext:deno_node/_util/asserts.ts"; import { isWindows } from "ext:deno_node/_util/os.ts"; -import { ADDRCONFIG, lookup as dnsLookup } from "ext:deno_node/dns.ts"; +import { ADDRCONFIG, lookup as dnsLookup } from "node:dns"; import { codeMap } from "ext:deno_node/internal_binding/uv.ts"; import { guessHandleType } from "ext:deno_node/internal_binding/util.ts"; import { debuglog } from "ext:deno_node/internal/util/debuglog.ts"; import type { DuplexOptions } from "ext:deno_node/_stream.d.ts"; import type { BufferEncoding } from "ext:deno_node/_global.d.ts"; import type { Abortable } from "ext:deno_node/_events.d.ts"; -import { channel } from "ext:deno_node/diagnostics_channel.ts"; +import { channel } from "node:diagnostics_channel"; let debug = debuglog("net", (fn) => { debug = fn; diff --git a/ext/node/polyfills/os.ts b/ext/node/polyfills/os.ts index 134b21215d..acdc1c9770 100644 --- a/ext/node/polyfills/os.ts +++ b/ext/node/polyfills/os.ts @@ -25,7 +25,7 @@ import { notImplemented } from "ext:deno_node/_utils.ts"; import { validateIntegerRange } from "ext:deno_node/_utils.ts"; -import process from "ext:deno_node/process.ts"; +import process from "node:process"; import { isWindows, osType } from "ext:deno_node/_util/os.ts"; import { os } from "ext:deno_node/internal_binding/constants.ts"; import { osUptime } from "ext:runtime/30_os.js"; diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts index 9c98c0ce35..5c4720a8ff 100644 --- a/ext/node/polyfills/process.ts +++ b/ext/node/polyfills/process.ts @@ -7,7 +7,7 @@ const internals = globalThis.__bootstrap.internals; const { core } = globalThis.__bootstrap; import { notImplemented, warnNotImplemented } from "ext:deno_node/_utils.ts"; -import { EventEmitter } from "ext:deno_node/events.ts"; +import { EventEmitter } from "node:events"; import { validateString } from "ext:deno_node/internal/validators.mjs"; import { ERR_INVALID_ARG_TYPE, @@ -16,7 +16,7 @@ import { } from "ext:deno_node/internal/errors.ts"; import { getOptionValue } from "ext:deno_node/internal/options.ts"; import { assert } from "ext:deno_node/_util/asserts.ts"; -import { join } from "ext:deno_node/path.ts"; +import { join } from "node:path"; import { pathFromURL } from "ext:deno_web/00_infra.js"; import { arch as arch_, diff --git a/ext/node/polyfills/querystring.ts b/ext/node/polyfills/querystring.ts index 8a395902ba..25774fa49d 100644 --- a/ext/node/polyfills/querystring.ts +++ b/ext/node/polyfills/querystring.ts @@ -3,7 +3,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { encodeStr, hexTable } from "ext:deno_node/internal/querystring.ts"; /** diff --git a/ext/node/polyfills/stream/consumers.mjs b/ext/node/polyfills/stream/consumers.mjs index c58aba8f07..5930ee518a 100644 --- a/ext/node/polyfills/stream/consumers.mjs +++ b/ext/node/polyfills/stream/consumers.mjs @@ -5,7 +5,7 @@ // deno-lint-ignore-file prefer-primordials import { TextDecoder } from "ext:deno_web/08_text_encoding.js"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; /** * @typedef {import('../_global.d.ts').ReadableStream diff --git a/ext/node/polyfills/string_decoder.ts b/ext/node/polyfills/string_decoder.ts index afcd58472e..63de444fa8 100644 --- a/ext/node/polyfills/string_decoder.ts +++ b/ext/node/polyfills/string_decoder.ts @@ -23,7 +23,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { Buffer } from "ext:deno_node/buffer.ts"; +import { Buffer } from "node:buffer"; import { normalizeEncoding as castEncoding, notImplemented, diff --git a/ext/node/polyfills/sys.ts b/ext/node/polyfills/sys.ts index 5f7c2c9600..73c4193437 100644 --- a/ext/node/polyfills/sys.ts +++ b/ext/node/polyfills/sys.ts @@ -1,3 +1,3 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -export * from "ext:deno_node/util.ts"; -export { default } from "ext:deno_node/util.ts"; +export * from "node:util"; +export { default } from "node:util"; diff --git a/ext/node/polyfills/timers/promises.ts b/ext/node/polyfills/timers/promises.ts index fae3bc8086..18cf76079a 100644 --- a/ext/node/polyfills/timers/promises.ts +++ b/ext/node/polyfills/timers/promises.ts @@ -1,6 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -import { promisify } from "ext:deno_node/util.ts"; -import timers from "ext:deno_node/timers.ts"; +import { promisify } from "node:util"; +import timers from "node:timers"; export const setTimeout = promisify(timers.setTimeout), setImmediate = promisify(timers.setImmediate), diff --git a/ext/node/polyfills/tty.ts b/ext/node/polyfills/tty.ts index 1b4b9d2738..d33f779caa 100644 --- a/ext/node/polyfills/tty.ts +++ b/ext/node/polyfills/tty.ts @@ -1,6 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -import { Socket } from "ext:deno_node/net.ts"; +import { Socket } from "node:net"; // Returns true when the given numeric fd is associated with a TTY and false otherwise. function isatty(fd: number) { diff --git a/ext/node/polyfills/url.ts b/ext/node/polyfills/url.ts index ae4c26e7a9..1a8f4bf293 100644 --- a/ext/node/polyfills/url.ts +++ b/ext/node/polyfills/url.ts @@ -69,15 +69,12 @@ import { CHAR_VERTICAL_LINE, CHAR_ZERO_WIDTH_NOBREAK_SPACE, } from "ext:deno_node/path/_constants.ts"; -import * as path from "ext:deno_node/path.ts"; -import { toASCII, toUnicode } from "ext:deno_node/punycode.ts"; +import * as path from "node:path"; +import { toASCII, toUnicode } from "node:punycode"; import { isWindows, osType } from "ext:deno_node/_util/os.ts"; import { encodeStr, hexTable } from "ext:deno_node/internal/querystring.ts"; -import querystring from "ext:deno_node/querystring.ts"; -import type { - ParsedUrlQuery, - ParsedUrlQueryInput, -} from "ext:deno_node/querystring.ts"; +import querystring from "node:querystring"; +import type { ParsedUrlQuery, ParsedUrlQueryInput } from "node:querystring"; import { URL, URLSearchParams } from "ext:deno_url/00_url.js"; const forwardSlashRegEx = /\//g; diff --git a/ext/node/polyfills/util.ts b/ext/node/polyfills/util.ts index 0c9690050f..36ee12c424 100644 --- a/ext/node/polyfills/util.ts +++ b/ext/node/polyfills/util.ts @@ -13,10 +13,10 @@ import { stripVTControlCharacters, } from "ext:deno_node/internal/util/inspect.mjs"; import { codes } from "ext:deno_node/internal/error_codes.ts"; -import types from "ext:deno_node/util/types.ts"; -import { Buffer } from "ext:deno_node/buffer.ts"; +import types from "node:util/types"; +import { Buffer } from "node:buffer"; import { isDeepStrictEqual } from "ext:deno_node/internal/util/comparisons.ts"; -import process from "ext:deno_node/process.ts"; +import process from "node:process"; import { validateString } from "ext:deno_node/internal/validators.mjs"; export { diff --git a/ext/node/polyfills/worker_threads.ts b/ext/node/polyfills/worker_threads.ts index 9af162c9ed..5d999f7af9 100644 --- a/ext/node/polyfills/worker_threads.ts +++ b/ext/node/polyfills/worker_threads.ts @@ -4,9 +4,9 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { isAbsolute, resolve } from "ext:deno_node/path.ts"; +import { isAbsolute, resolve } from "node:path"; import { notImplemented } from "ext:deno_node/_utils.ts"; -import { EventEmitter, once } from "ext:deno_node/events.ts"; +import { EventEmitter, once } from "node:events"; import { BroadcastChannel } from "ext:deno_broadcast_channel/01_broadcast_channel.js"; import { MessageChannel, MessagePort } from "ext:deno_web/13_message_port.js"; diff --git a/runtime/build.rs b/runtime/build.rs index e5d0067a73..dd222a8a0c 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -24,16 +24,23 @@ mod startup_snapshot { fn transpile_ts_for_snapshotting( file_source: &ExtensionFileSource, ) -> Result { - let media_type = MediaType::from_path(Path::new(&file_source.specifier)); + // Always transpile `node:` built-in modules, since they might be TypeScript. + let media_type = if file_source.specifier.starts_with("node:") { + MediaType::TypeScript + } else { + MediaType::from_path(Path::new(&file_source.specifier)) + }; let should_transpile = match media_type { MediaType::JavaScript => false, MediaType::Mjs => false, MediaType::TypeScript => true, - _ => panic!( - "Unsupported media type for snapshotting {media_type:?} for file {}", - file_source.specifier - ), + _ => { + panic!( + "Unsupported media type for snapshotting {media_type:?} for file {}", + file_source.specifier + ) + } }; let code = file_source.load()?; @@ -284,7 +291,6 @@ mod startup_snapshot { runtime_main, deps = [runtime], customizer = |ext: &mut deno_core::ExtensionBuilder| { - eprintln!("I am here!!!"); ext.esm_entry_point("ext:runtime/90_deno_ns.js"); } ); diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index 3efc981048..9561813267 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -38,6 +38,7 @@ use deno_fs::FileSystem; use deno_http::DefaultHttpPropertyExtractor; use deno_io::Stdio; use deno_kv::sqlite::SqliteDbHandler; +use deno_node::SUPPORTED_BUILTIN_NODE_MODULES_WITH_PREFIX; use deno_tls::RootCertStoreProvider; use deno_web::create_entangled_message_port; use deno_web::BlobStore; @@ -484,14 +485,10 @@ impl WebWorker { let startup_snapshot = options.startup_snapshot .expect("deno_runtime startup snapshot is not available with 'create_runtime_snapshot' Cargo feature."); - // Clear extension modules from the module map, except preserve `ext:deno_node` + // Clear extension modules from the module map, except preserve `node:*` // modules as `node:` specifiers. - let rename_modules = Some( - deno_node::SUPPORTED_BUILTIN_NODE_MODULES - .iter() - .map(|p| (p.ext_specifier, p.specifier)) - .collect(), - ); + let preserve_snapshotted_modules = + Some(SUPPORTED_BUILTIN_NODE_MODULES_WITH_PREFIX); let mut js_runtime = JsRuntime::new(RuntimeOptions { module_loader: Some(options.module_loader.clone()), @@ -502,7 +499,7 @@ impl WebWorker { compiled_wasm_module_store: options.compiled_wasm_module_store.clone(), extensions, inspector: options.maybe_inspector_server.is_some(), - rename_modules, + preserve_snapshotted_modules, ..Default::default() }); diff --git a/runtime/worker.rs b/runtime/worker.rs index 20fb6db848..d33cb2c802 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -34,6 +34,7 @@ use deno_fs::FileSystem; use deno_http::DefaultHttpPropertyExtractor; use deno_io::Stdio; use deno_kv::sqlite::SqliteDbHandler; +use deno_node::SUPPORTED_BUILTIN_NODE_MODULES_WITH_PREFIX; use deno_tls::RootCertStoreProvider; use deno_web::BlobStore; use log::debug; @@ -313,14 +314,10 @@ impl MainWorker { let startup_snapshot = options.startup_snapshot .expect("deno_runtime startup snapshot is not available with 'create_runtime_snapshot' Cargo feature."); - // Clear extension modules from the module map, except preserve `ext:deno_node` - // modules as `node:` specifiers. - let rename_modules = Some( - deno_node::SUPPORTED_BUILTIN_NODE_MODULES - .iter() - .map(|p| (p.ext_specifier, p.specifier)) - .collect(), - ); + // Clear extension modules from the module map, except preserve `node:*` + // modules. + let preserve_snapshotted_modules = + Some(SUPPORTED_BUILTIN_NODE_MODULES_WITH_PREFIX); let mut js_runtime = JsRuntime::new(RuntimeOptions { module_loader: Some(options.module_loader.clone()), @@ -331,7 +328,7 @@ impl MainWorker { shared_array_buffer_store: options.shared_array_buffer_store.clone(), compiled_wasm_module_store: options.compiled_wasm_module_store.clone(), extensions, - rename_modules, + preserve_snapshotted_modules, inspector: options.maybe_inspector_server.is_some(), is_main: true, ..Default::default() diff --git a/tools/core_import_map.json b/tools/core_import_map.json index c4c4b99f2a..b75c3a9bbd 100644 --- a/tools/core_import_map.json +++ b/tools/core_import_map.json @@ -52,27 +52,27 @@ "ext:deno_node/_utils.ts": "../ext/node/polyfills/_utils.ts", "ext:deno_node/_zlib_binding.mjs": "../ext/node/polyfills/_zlib_binding.mjs", "ext:deno_node/00_globals.js": "../ext/node/polyfills/00_globals.js", - "ext:deno_node/01_require.js": "../ext/node/polyfills/01_require.js", - "ext:deno_node/assert.ts": "../ext/node/polyfills/assert.ts", - "ext:deno_node/assert/strict.ts": "../ext/node/polyfills/assert/strict.ts", - "ext:deno_node/async_hooks.ts": "../ext/node/polyfills/async_hooks.ts", - "ext:deno_node/buffer.ts": "../ext/node/polyfills/buffer.ts", - "ext:deno_node/child_process.ts": "../ext/node/polyfills/child_process.ts", - "ext:deno_node/cluster.ts": "../ext/node/polyfills/cluster.ts", - "ext:deno_node/console.ts": "../ext/node/polyfills/console.ts", - "ext:deno_node/constants.ts": "../ext/node/polyfills/constants.ts", - "ext:deno_node/crypto.ts": "../ext/node/polyfills/crypto.ts", - "ext:deno_node/dgram.ts": "../ext/node/polyfills/dgram.ts", - "ext:deno_node/diagnostics_channel.ts": "../ext/node/polyfills/diagnostics_channel.ts", - "ext:deno_node/dns.ts": "../ext/node/polyfills/dns.ts", - "ext:deno_node/dns/promises.ts": "../ext/node/polyfills/dns/promises.ts", - "ext:deno_node/domain.ts": "../ext/node/polyfills/domain.ts", - "ext:deno_node/events.ts": "../ext/node/polyfills/events.ts", - "ext:deno_node/fs.ts": "../ext/node/polyfills/fs.ts", - "ext:deno_node/fs/promises.ts": "../ext/node/polyfills/fs/promises.ts", - "ext:deno_node/http.ts": "../ext/node/polyfills/http.ts", - "ext:deno_node/http2.ts": "../ext/node/polyfills/http2.ts", - "ext:deno_node/https.ts": "../ext/node/polyfills/https.ts", + "node:module": "../ext/node/polyfills/01_require.js", + "node:assert": "../ext/node/polyfills/assert.ts", + "node:assert/strict": "../ext/node/polyfills/assert/strict.ts", + "node:async_hooks": "../ext/node/polyfills/async_hooks.ts", + "node:buffer": "../ext/node/polyfills/buffer.ts", + "node:child_process": "../ext/node/polyfills/child_process.ts", + "node:cluster": "../ext/node/polyfills/cluster.ts", + "node:console": "../ext/node/polyfills/console.ts", + "node:constants": "../ext/node/polyfills/constants.ts", + "node:crypto": "../ext/node/polyfills/crypto.ts", + "node:dgram": "../ext/node/polyfills/dgram.ts", + "node:diagnostics_channel": "../ext/node/polyfills/diagnostics_channel.ts", + "node:dns": "../ext/node/polyfills/dns.ts", + "node:dns/promises": "../ext/node/polyfills/dns/promises.ts", + "node:domain": "../ext/node/polyfills/domain.ts", + "node:events": "../ext/node/polyfills/events.ts", + "node:fs": "../ext/node/polyfills/fs.ts", + "node:fs/promises": "../ext/node/polyfills/fs/promises.ts", + "node:http": "../ext/node/polyfills/http.ts", + "node:http2": "../ext/node/polyfills/http2.ts", + "node:https": "../ext/node/polyfills/https.ts", "ext:deno_node/inspector.ts": "../ext/node/polyfills/inspector.ts", "ext:deno_node/internal_binding/_libuv_winerror.ts": "../ext/node/polyfills/internal_binding/_libuv_winerror.ts", "ext:deno_node/internal_binding/_listen.ts": "../ext/node/polyfills/internal_binding/_listen.ts", @@ -164,43 +164,43 @@ "ext:deno_node/internal/util/inspect.mjs": "../ext/node/polyfills/internal/util/inspect.mjs", "ext:deno_node/internal/util/types.ts": "../ext/node/polyfills/internal/util/types.ts", "ext:deno_node/internal/validators.mjs": "../ext/node/polyfills/internal/validators.mjs", - "ext:deno_node/net.ts": "../ext/node/polyfills/net.ts", - "ext:deno_node/os.ts": "../ext/node/polyfills/os.ts", - "ext:deno_node/path.ts": "../ext/node/polyfills/path.ts", + "node:net": "../ext/node/polyfills/net.ts", + "node:os": "../ext/node/polyfills/os.ts", + "node:path": "../ext/node/polyfills/path.ts", "ext:deno_node/path/_constants.ts": "../ext/node/polyfills/path/_constants.ts", "ext:deno_node/path/_interface.ts": "../ext/node/polyfills/path/_interface.ts", "ext:deno_node/path/_posix.ts": "../ext/node/polyfills/path/_posix.ts", "ext:deno_node/path/_util.ts": "../ext/node/polyfills/path/_util.ts", "ext:deno_node/path/_win32.ts": "../ext/node/polyfills/path/_win32.ts", "ext:deno_node/path/mod.ts": "../ext/node/polyfills/path/mod.ts", - "ext:deno_node/path/posix.ts": "../ext/node/polyfills/path/posix.ts", + "node:path/posix": "../ext/node/polyfills/path/posix.ts", "ext:deno_node/path/separator.ts": "../ext/node/polyfills/path/separator.ts", - "ext:deno_node/path/win32.ts": "../ext/node/polyfills/path/win32.ts", - "ext:deno_node/perf_hooks.ts": "../ext/node/polyfills/perf_hooks.ts", - "ext:deno_node/process.ts": "../ext/node/polyfills/process.ts", - "ext:deno_node/punycode.ts": "../ext/node/polyfills/punycode.ts", - "ext:deno_node/querystring.ts": "../ext/node/polyfills/querystring.ts", - "ext:deno_node/readline.ts": "../ext/node/polyfills/readline.ts", + "node:path/win32": "../ext/node/polyfills/path/win32.ts", + "node:perf_hooks": "../ext/node/polyfills/perf_hooks.ts", + "node:process": "../ext/node/polyfills/process.ts", + "node:punycode": "../ext/node/polyfills/punycode.ts", + "node:querystring": "../ext/node/polyfills/querystring.ts", + "node:readline": "../ext/node/polyfills/readline.ts", "ext:deno_node/readline/promises.ts": "../ext/node/polyfills/readline/promises.ts", "ext:deno_node/repl.ts": "../ext/node/polyfills/repl.ts", - "ext:deno_node/stream.ts": "../ext/node/polyfills/stream.ts", - "ext:deno_node/stream/consumers.mjs": "../ext/node/polyfills/stream/consumers.mjs", - "ext:deno_node/stream/promises.mjs": "../ext/node/polyfills/stream/promises.mjs", - "ext:deno_node/stream/web.ts": "../ext/node/polyfills/stream/web.ts", - "ext:deno_node/string_decoder.ts": "../ext/node/polyfills/string_decoder.ts", - "ext:deno_node/sys.ts": "../ext/node/polyfills/sys.ts", - "ext:deno_node/timers.ts": "../ext/node/polyfills/timers.ts", - "ext:deno_node/timers/promises.ts": "../ext/node/polyfills/timers/promises.ts", - "ext:deno_node/tls.ts": "../ext/node/polyfills/tls.ts", - "ext:deno_node/tty.ts": "../ext/node/polyfills/tty.ts", - "ext:deno_node/url.ts": "../ext/node/polyfills/url.ts", - "ext:deno_node/util.ts": "../ext/node/polyfills/util.ts", - "ext:deno_node/util/types.ts": "../ext/node/polyfills/util/types.ts", - "ext:deno_node/v8.ts": "../ext/node/polyfills/v8.ts", - "ext:deno_node/vm.ts": "../ext/node/polyfills/vm.ts", + "node:stream": "../ext/node/polyfills/stream.ts", + "node:stream/consumers": "../ext/node/polyfills/stream/consumers.mjs", + "node:stream/promises": "../ext/node/polyfills/stream/promises.mjs", + "node:stream/web": "../ext/node/polyfills/stream/web.ts", + "node:string_decoder": "../ext/node/polyfills/string_decoder.ts", + "node:sys": "../ext/node/polyfills/sys.ts", + "node:timers": "../ext/node/polyfills/timers.ts", + "node:timers/promises": "../ext/node/polyfills/timers/promises.ts", + "node:tls": "../ext/node/polyfills/tls.ts", + "node:tty": "../ext/node/polyfills/tty.ts", + "node:url": "../ext/node/polyfills/url.ts", + "node:util": "../ext/node/polyfills/util.ts", + "node:util/types": "../ext/node/polyfills/util/types.ts", + "node:v8": "../ext/node/polyfills/v8.ts", + "node:vm": "../ext/node/polyfills/vm.ts", "ext:deno_node/wasi.ts": "../ext/node/polyfills/wasi.ts", - "ext:deno_node/worker_threads.ts": "../ext/node/polyfills/worker_threads.ts", - "ext:deno_node/zlib.ts": "../ext/node/polyfills/zlib.ts", + "node:worker_threads": "../ext/node/polyfills/worker_threads.ts", + "node:zlib": "../ext/node/polyfills/zlib.ts", "ext:deno_url/00_url.js": "../ext/url/00_url.js", "ext:deno_url/01_urlpattern.js": "../ext/url/01_urlpattern.js", "ext:deno_web/00_infra.js": "../ext/web/00_infra.js",