1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041)

This commit renames "deno_core::InternalModuleLoader" to
"ExtModuleLoader" and changes the specifiers used by the 
modules loaded from this loader to "ext:".

"internal:" scheme was really ambiguous and it's more characters than
"ext:", which should result in slightly smaller snapshot size.

Closes https://github.com/denoland/deno/issues/18020
This commit is contained in:
Bartek Iwańczuk 2023-03-08 07:44:54 -04:00 committed by GitHub
parent d24c6ea27f
commit 72fe9bb470
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
293 changed files with 1509 additions and 1632 deletions

View file

@ -10,9 +10,9 @@ use crate::profiling::is_profiling;
pub fn create_js_runtime(setup: impl FnOnce() -> Vec<Extension>) -> JsRuntime { pub fn create_js_runtime(setup: impl FnOnce() -> Vec<Extension>) -> JsRuntime {
JsRuntime::new(RuntimeOptions { JsRuntime::new(RuntimeOptions {
extensions_with_js: setup(), extensions_with_js: setup(),
module_loader: Some(std::rc::Rc::new( module_loader: Some(
deno_core::InternalModuleLoader::default(), std::rc::Rc::new(deno_core::ExtModuleLoader::default()),
)), ),
..Default::default() ..Default::default()
}) })
} }

View file

@ -3,10 +3,10 @@
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
const ops = core.ops; const ops = core.ops;
const internals = globalThis.__bootstrap.internals; const internals = globalThis.__bootstrap.internals;
import { setExitHandler } from "internal:runtime/30_os.js"; import { setExitHandler } from "ext:runtime/30_os.js";
import { Console } from "internal:deno_console/02_console.js"; import { Console } from "ext:deno_console/02_console.js";
import { serializePermissions } from "internal:runtime/10_permissions.js"; import { serializePermissions } from "ext:runtime/10_permissions.js";
import { assert } from "internal:deno_web/00_infra.js"; import { assert } from "ext:deno_web/00_infra.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { const {
ArrayFrom, ArrayFrom,
@ -1424,6 +1424,6 @@ internals.testing = {
enableBench, enableBench,
}; };
import { denoNs } from "internal:runtime/90_deno_ns.js"; import { denoNs } from "ext:runtime/90_deno_ns.js";
denoNs.bench = bench; denoNs.bench = bench;
denoNs.test = test; denoNs.test = test;

View file

@ -4048,14 +4048,14 @@ itest!(node_prefix_missing {
exit_code: 1, exit_code: 1,
}); });
itest!(internal_import { itest!(extension_import {
args: "run run/internal_import.ts", args: "run run/extension_import.ts",
output: "run/internal_import.ts.out", output: "run/extension_import.ts.out",
exit_code: 1, exit_code: 1,
}); });
itest!(internal_dynamic_import { itest!(extension_dynamic_import {
args: "run run/internal_dynamic_import.ts", args: "run run/extension_dynamic_import.ts",
output: "run/internal_dynamic_import.ts.out", output: "run/extension_dynamic_import.ts.out",
exit_code: 1, exit_code: 1,
}); });

View file

@ -2,5 +2,5 @@
new Event(); new Event();
^ ^
at [WILDCARD] at [WILDCARD]
at new Event (internal:deno_web/[WILDCARD]) at new Event (ext:deno_web/[WILDCARD])
at [WILDCARD] at [WILDCARD]

View file

@ -0,0 +1 @@
await import("ext:runtime/01_errors.js");

View file

@ -0,0 +1,4 @@
error: Uncaught TypeError: Cannot load extension module from external code
await import("ext:runtime/01_errors.js");
^
at [WILDCARD]/extension_dynamic_import.ts:1:1

View file

@ -0,0 +1 @@
import "ext:runtime/01_errors.js";

View file

@ -0,0 +1,8 @@
error: Unsupported scheme "ext" for module "ext:runtime/01_errors.js". Supported schemes: [
"data",
"blob",
"file",
"http",
"https",
]
at [WILDCARD]

View file

@ -1,5 +1,5 @@
error: Uncaught (in promise) TypeError: error sending request for url[WILDCARD] error: Uncaught (in promise) TypeError: error sending request for url[WILDCARD]
await fetch("https://nonexistent.deno.land/"); await fetch("https://nonexistent.deno.land/");
^[WILDCARD] ^[WILDCARD]
at async fetch (internal:[WILDCARD]) at async fetch (ext:[WILDCARD])
at async file:///[WILDCARD]/fetch_async_error_stack.ts:1:1 at async file:///[WILDCARD]/fetch_async_error_stack.ts:1:1

View file

@ -1 +0,0 @@
await import("internal:runtime/01_errors.js");

View file

@ -1,4 +0,0 @@
error: Uncaught TypeError: Cannot load internal module from external code
await import("internal:runtime/01_errors.js");
^
at [WILDCARD]/internal_dynamic_import.ts:1:1

View file

@ -1 +0,0 @@
import "internal:runtime/01_errors.js";

View file

@ -1,8 +0,0 @@
error: Unsupported scheme "internal" for module "internal:runtime/01_errors.js". Supported schemes: [
"data",
"blob",
"file",
"http",
"https",
]
at [WILDCARD]

View file

@ -3,4 +3,4 @@ error: Uncaught Error: foo
throw new Error("foo"); throw new Error("foo");
^ ^
at [WILDCARD]/queue_microtask_error.ts:2:9 at [WILDCARD]/queue_microtask_error.ts:2:9
at internal:core/[WILDCARD] at ext:core/[WILDCARD]

View file

@ -7,9 +7,9 @@
colno: 9, colno: 9,
error: Error: foo error: Error: foo
at [WILDCARD]/queue_microtask_error_handled.ts:18:9 at [WILDCARD]/queue_microtask_error_handled.ts:18:9
at internal:core/[WILDCARD] at ext:core/[WILDCARD]
} }
onerror() called Error: foo onerror() called Error: foo
at [WILDCARD]/queue_microtask_error_handled.ts:18:9 at [WILDCARD]/queue_microtask_error_handled.ts:18:9
at internal:core/[WILDCARD] at ext:core/[WILDCARD]
2 2

View file

@ -1,2 +1,2 @@
error: Uncaught (in promise) TypeError: Invalid WebAssembly content type. error: Uncaught (in promise) TypeError: Invalid WebAssembly content type.
at handleWasmStreaming (internal:deno_fetch/26_fetch.js:[WILDCARD]) at handleWasmStreaming (ext:deno_fetch/26_fetch.js:[WILDCARD])

View file

@ -2,7 +2,7 @@ error: Uncaught (in worker "") Error
throw new Error(); throw new Error();
^ ^
at [WILDCARD]/workers/drop_handle_race.js:2:9 at [WILDCARD]/workers/drop_handle_race.js:2:9
at Object.action (internal:deno_web/02_timers.js:[WILDCARD]) at Object.action (ext:deno_web/02_timers.js:[WILDCARD])
at handleTimerMacrotask (internal:deno_web/02_timers.js:[WILDCARD]) at handleTimerMacrotask (ext:deno_web/02_timers.js:[WILDCARD])
error: Uncaught (in promise) Error: Unhandled error in child worker. error: Uncaught (in promise) Error: Unhandled error in child worker.
at Worker.#pollControl (internal:runtime/11_workers.js:[WILDCARD]) at Worker.#pollControl (ext:runtime/11_workers.js:[WILDCARD])

View file

@ -37,13 +37,13 @@ failing step in failing test ... FAILED ([WILDCARD])
nested failure => ./test/steps/failing_steps.ts:[WILDCARD] nested failure => ./test/steps/failing_steps.ts:[WILDCARD]
error: Error: 1 test step failed. error: Error: 1 test step failed.
at runTest (internal:cli/40_testing.js:[WILDCARD]) at runTest (ext:cli/40_testing.js:[WILDCARD])
at async runTests (internal:cli/40_testing.js:[WILDCARD]) at async runTests (ext:cli/40_testing.js:[WILDCARD])
multiple test step failures => ./test/steps/failing_steps.ts:[WILDCARD] multiple test step failures => ./test/steps/failing_steps.ts:[WILDCARD]
error: Error: 2 test steps failed. error: Error: 2 test steps failed.
at runTest (internal:cli/40_testing.js:[WILDCARD]) at runTest (ext:cli/40_testing.js:[WILDCARD])
at async runTests (internal:cli/40_testing.js:[WILDCARD]) at async runTests (ext:cli/40_testing.js:[WILDCARD])
failing step in failing test => ./test/steps/failing_steps.ts:[WILDCARD] failing step in failing test => ./test/steps/failing_steps.ts:[WILDCARD]
error: Error: Fail test. error: Error: Fail test.

View file

@ -16,8 +16,8 @@ Deno.test(async function sendAsyncStackTrace() {
assertStringIncludes(s, "opcall_test.ts"); assertStringIncludes(s, "opcall_test.ts");
assertStringIncludes(s, "read"); assertStringIncludes(s, "read");
assert( assert(
!s.includes("internal:core"), !s.includes("ext:core"),
"opcall stack traces should NOT include internal:core internals such as unwrapOpResult", "opcall stack traces should NOT include ext:core internals such as unwrapOpResult",
); );
} }
}); });

View file

@ -594,7 +594,7 @@ fn filter_coverages(
coverages coverages
.into_iter() .into_iter()
.filter(|e| { .filter(|e| {
let is_internal = e.url.starts_with("internal:") let is_internal = e.url.starts_with("ext:")
|| e.url.ends_with("__anonymous__") || e.url.ends_with("__anonymous__")
|| e.url.ends_with("$deno$test.js") || e.url.ends_with("$deno$test.js")
|| e.url.ends_with(".snap"); || e.url.ends_with(".snap");

View file

@ -655,8 +655,7 @@ fn abbreviate_test_error(js_error: &JsError) -> JsError {
// check if there are any stack frames coming from user code // check if there are any stack frames coming from user code
let should_filter = frames.iter().any(|f| { let should_filter = frames.iter().any(|f| {
if let Some(file_name) = &f.file_name { if let Some(file_name) = &f.file_name {
!(file_name.starts_with("[internal:") !(file_name.starts_with("[ext:") || file_name.starts_with("ext:"))
|| file_name.starts_with("internal:"))
} else { } else {
true true
} }
@ -668,8 +667,7 @@ fn abbreviate_test_error(js_error: &JsError) -> JsError {
.rev() .rev()
.skip_while(|f| { .skip_while(|f| {
if let Some(file_name) = &f.file_name { if let Some(file_name) = &f.file_name {
file_name.starts_with("[internal:") file_name.starts_with("[ext:") || file_name.starts_with("ext:")
|| file_name.starts_with("internal:")
} else { } else {
false false
} }

View file

@ -281,11 +281,11 @@ pub fn host_import_module_dynamically_callback<'s>(
.unwrap() .unwrap()
.to_rust_string_lossy(scope); .to_rust_string_lossy(scope);
let is_internal_module = specifier_str.starts_with("internal:"); let is_ext_module = specifier_str.starts_with("ext:");
let resolver = v8::PromiseResolver::new(scope).unwrap(); let resolver = v8::PromiseResolver::new(scope).unwrap();
let promise = resolver.get_promise(scope); let promise = resolver.get_promise(scope);
if !is_internal_module { if !is_ext_module {
let assertions = parse_import_assertions( let assertions = parse_import_assertions(
scope, scope,
import_assertions, import_assertions,
@ -333,10 +333,10 @@ pub fn host_import_module_dynamically_callback<'s>(
let promise = promise.catch(scope, map_err).unwrap(); let promise = promise.catch(scope, map_err).unwrap();
if is_internal_module { if is_ext_module {
let message = v8::String::new_external_onebyte_static( let message = v8::String::new_external_onebyte_static(
scope, scope,
b"Cannot load internal module from external code", b"Cannot load extension module from external code",
) )
.unwrap(); .unwrap();
let exception = v8::Exception::type_error(scope, message); let exception = v8::Exception::type_error(scope, message);

View file

@ -272,7 +272,7 @@ impl JsError {
if let (Some(file_name), Some(line_number)) = if let (Some(file_name), Some(line_number)) =
(&frame.file_name, frame.line_number) (&frame.file_name, frame.line_number)
{ {
if !file_name.trim_start_matches('[').starts_with("internal:") { if !file_name.trim_start_matches('[').starts_with("ext:") {
source_line = get_source_line( source_line = get_source_line(
file_name, file_name,
line_number, line_number,
@ -424,7 +424,7 @@ impl JsError {
if let (Some(file_name), Some(line_number)) = if let (Some(file_name), Some(line_number)) =
(&frame.file_name, frame.line_number) (&frame.file_name, frame.line_number)
{ {
if !file_name.trim_start_matches('[').starts_with("internal:") { if !file_name.trim_start_matches('[').starts_with("ext:") {
source_line = get_source_line( source_line = get_source_line(
file_name, file_name,
line_number, line_number,
@ -438,7 +438,7 @@ impl JsError {
} }
} else if let Some(frame) = frames.first() { } else if let Some(frame) = frames.first() {
if let Some(file_name) = &frame.file_name { if let Some(file_name) = &frame.file_name {
if !file_name.trim_start_matches('[').starts_with("internal:") { if !file_name.trim_start_matches('[').starts_with("ext:") {
source_line = msg source_line = msg
.get_source_line(scope) .get_source_line(scope)
.map(|v| v.to_rust_string_lossy(scope)); .map(|v| v.to_rust_string_lossy(scope));

View file

@ -209,7 +209,7 @@ impl ExtensionBuilder {
// use a different result struct that `ExtensionFileSource` as it's confusing // use a different result struct that `ExtensionFileSource` as it's confusing
// when (and why) the remapping happens. // when (and why) the remapping happens.
js_files.into_iter().map(|file_source| ExtensionFileSource { js_files.into_iter().map(|file_source| ExtensionFileSource {
specifier: format!("internal:{}/{}", self.name, file_source.specifier), specifier: format!("ext:{}/{}", self.name, file_source.specifier),
code: file_source.code, code: file_source.code,
}); });
self.js.extend(js_files); self.js.extend(js_files);
@ -223,7 +223,7 @@ impl ExtensionBuilder {
// use a different result struct that `ExtensionFileSource` as it's confusing // use a different result struct that `ExtensionFileSource` as it's confusing
// when (and why) the remapping happens. // when (and why) the remapping happens.
.map(|file_source| ExtensionFileSource { .map(|file_source| ExtensionFileSource {
specifier: format!("internal:{}/{}", self.name, file_source.specifier), specifier: format!("ext:{}/{}", self.name, file_source.specifier),
code: file_source.code, code: file_source.code,
}); });
self.esm.extend(esm_files); self.esm.extend(esm_files);
@ -287,7 +287,7 @@ impl ExtensionBuilder {
/// Helps embed JS files in an extension. Returns a vector of /// Helps embed JS files in an extension. Returns a vector of
/// `ExtensionFileSource`, that represent the filename and source code. All /// `ExtensionFileSource`, that represent the filename and source code. All
/// specified files are rewritten into "internal:<extension_name>/<file_name>". /// specified files are rewritten into "ext:<extension_name>/<file_name>".
/// ///
/// An optional "dir" option can be specified to prefix all files with a /// An optional "dir" option can be specified to prefix all files with a
/// directory name. /// directory name.
@ -299,8 +299,8 @@ impl ExtensionBuilder {
/// "02_goodbye.js", /// "02_goodbye.js",
/// ) /// )
/// // Produces following specifiers: /// // Produces following specifiers:
/// - "internal:my_extension/01_hello.js" /// - "ext:my_extension/01_hello.js"
/// - "internal:my_extension/02_goodbye.js" /// - "ext:my_extension/02_goodbye.js"
/// ///
/// /// Example with "dir" option (for "my_extension"): /// /// Example with "dir" option (for "my_extension"):
/// ```ignore /// ```ignore
@ -310,8 +310,8 @@ impl ExtensionBuilder {
/// "02_goodbye.js", /// "02_goodbye.js",
/// ) /// )
/// // Produces following specifiers: /// // Produces following specifiers:
/// - "internal:my_extension/js/01_hello.js" /// - "ext:my_extension/js/01_hello.js"
/// - "internal:my_extension/js/02_goodbye.js" /// - "ext:my_extension/js/02_goodbye.js"
/// ``` /// ```
#[cfg(not(feature = "include_js_files_for_snapshotting"))] #[cfg(not(feature = "include_js_files_for_snapshotting"))]
#[macro_export] #[macro_export]

View file

@ -75,9 +75,9 @@ pub use crate::module_specifier::resolve_url_or_path;
pub use crate::module_specifier::ModuleResolutionError; pub use crate::module_specifier::ModuleResolutionError;
pub use crate::module_specifier::ModuleSpecifier; pub use crate::module_specifier::ModuleSpecifier;
pub use crate::module_specifier::DUMMY_SPECIFIER; pub use crate::module_specifier::DUMMY_SPECIFIER;
pub use crate::modules::ExtModuleLoader;
pub use crate::modules::ExtModuleLoaderCb;
pub use crate::modules::FsModuleLoader; pub use crate::modules::FsModuleLoader;
pub use crate::modules::InternalModuleLoader;
pub use crate::modules::InternalModuleLoaderCb;
pub use crate::modules::ModuleId; pub use crate::modules::ModuleId;
pub use crate::modules::ModuleLoader; pub use crate::modules::ModuleLoader;
pub use crate::modules::ModuleSource; pub use crate::modules::ModuleSource;
@ -141,16 +141,11 @@ pub mod _ops {
/// A helper macro that will return a call site in Rust code. Should be /// A helper macro that will return a call site in Rust code. Should be
/// used when executing internal one-line scripts for JsRuntime lifecycle. /// used when executing internal one-line scripts for JsRuntime lifecycle.
/// ///
/// Returns a string in form of: "`[internal:<filename>:<line>:<column>]`" /// Returns a string in form of: "`[ext:<filename>:<line>:<column>]`"
#[macro_export] #[macro_export]
macro_rules! located_script_name { macro_rules! located_script_name {
() => { () => {
format!( format!("[ext:{}:{}:{}]", std::file!(), std::line!(), std::column!());
"[internal:{}:{}:{}]",
std::file!(),
std::line!(),
std::column!()
);
}; };
} }

View file

@ -301,7 +301,7 @@ impl ModuleLoader for NoopModuleLoader {
} }
/// Helper function, that calls into `loader.resolve()`, but denies resolution /// Helper function, that calls into `loader.resolve()`, but denies resolution
/// of `internal` scheme if we are running with a snapshot loaded and not /// of `ext` scheme if we are running with a snapshot loaded and not
/// creating a snapshot /// creating a snapshot
pub(crate) fn resolve_helper( pub(crate) fn resolve_helper(
snapshot_loaded_and_not_snapshotting: bool, snapshot_loaded_and_not_snapshotting: bool,
@ -310,29 +310,28 @@ pub(crate) fn resolve_helper(
referrer: &str, referrer: &str,
kind: ResolutionKind, kind: ResolutionKind,
) -> Result<ModuleSpecifier, Error> { ) -> Result<ModuleSpecifier, Error> {
if snapshot_loaded_and_not_snapshotting && specifier.starts_with("internal:") if snapshot_loaded_and_not_snapshotting && specifier.starts_with("ext:") {
{
return Err(generic_error( return Err(generic_error(
"Cannot load internal module from external code", "Cannot load extension module from external code",
)); ));
} }
loader.resolve(specifier, referrer, kind) loader.resolve(specifier, referrer, kind)
} }
/// Function that can be passed to the `InternalModuleLoader` that allows to /// Function that can be passed to the `ExtModuleLoader` that allows to
/// transpile sources before passing to V8. /// transpile sources before passing to V8.
pub type InternalModuleLoaderCb = pub type ExtModuleLoaderCb =
Box<dyn Fn(&ExtensionFileSource) -> Result<String, Error>>; Box<dyn Fn(&ExtensionFileSource) -> Result<String, Error>>;
pub struct InternalModuleLoader { pub struct ExtModuleLoader {
module_loader: Rc<dyn ModuleLoader>, module_loader: Rc<dyn ModuleLoader>,
esm_sources: Vec<ExtensionFileSource>, esm_sources: Vec<ExtensionFileSource>,
used_esm_sources: RefCell<HashMap<String, bool>>, used_esm_sources: RefCell<HashMap<String, bool>>,
maybe_load_callback: Option<InternalModuleLoaderCb>, maybe_load_callback: Option<ExtModuleLoaderCb>,
} }
impl Default for InternalModuleLoader { impl Default for ExtModuleLoader {
fn default() -> Self { fn default() -> Self {
Self { Self {
module_loader: Rc::new(NoopModuleLoader), module_loader: Rc::new(NoopModuleLoader),
@ -343,18 +342,18 @@ impl Default for InternalModuleLoader {
} }
} }
impl InternalModuleLoader { impl ExtModuleLoader {
pub fn new( pub fn new(
module_loader: Option<Rc<dyn ModuleLoader>>, module_loader: Option<Rc<dyn ModuleLoader>>,
esm_sources: Vec<ExtensionFileSource>, esm_sources: Vec<ExtensionFileSource>,
maybe_load_callback: Option<InternalModuleLoaderCb>, maybe_load_callback: Option<ExtModuleLoaderCb>,
) -> Self { ) -> Self {
let used_esm_sources: HashMap<String, bool> = esm_sources let used_esm_sources: HashMap<String, bool> = esm_sources
.iter() .iter()
.map(|file_source| (file_source.specifier.to_string(), false)) .map(|file_source| (file_source.specifier.to_string(), false))
.collect(); .collect();
InternalModuleLoader { ExtModuleLoader {
module_loader: module_loader.unwrap_or_else(|| Rc::new(NoopModuleLoader)), module_loader: module_loader.unwrap_or_else(|| Rc::new(NoopModuleLoader)),
esm_sources, esm_sources,
used_esm_sources: RefCell::new(used_esm_sources), used_esm_sources: RefCell::new(used_esm_sources),
@ -363,7 +362,7 @@ impl InternalModuleLoader {
} }
} }
impl Drop for InternalModuleLoader { impl Drop for ExtModuleLoader {
fn drop(&mut self) { fn drop(&mut self) {
let used_esm_sources = self.used_esm_sources.get_mut(); let used_esm_sources = self.used_esm_sources.get_mut();
let unused_modules: Vec<_> = used_esm_sources let unused_modules: Vec<_> = used_esm_sources
@ -374,7 +373,7 @@ impl Drop for InternalModuleLoader {
if !unused_modules.is_empty() { if !unused_modules.is_empty() {
let mut msg = let mut msg =
"Following modules were passed to InternalModuleLoader but never used:\n" "Following modules were passed to ExtModuleLoader but never used:\n"
.to_string(); .to_string();
for m in unused_modules { for m in unused_modules {
msg.push_str(" - "); msg.push_str(" - ");
@ -386,7 +385,7 @@ impl Drop for InternalModuleLoader {
} }
} }
impl ModuleLoader for InternalModuleLoader { impl ModuleLoader for ExtModuleLoader {
fn resolve( fn resolve(
&self, &self,
specifier: &str, specifier: &str,
@ -394,14 +393,13 @@ impl ModuleLoader for InternalModuleLoader {
kind: ResolutionKind, kind: ResolutionKind,
) -> Result<ModuleSpecifier, Error> { ) -> Result<ModuleSpecifier, Error> {
if let Ok(url_specifier) = ModuleSpecifier::parse(specifier) { if let Ok(url_specifier) = ModuleSpecifier::parse(specifier) {
if url_specifier.scheme() == "internal" { if url_specifier.scheme() == "ext" {
let referrer_specifier = ModuleSpecifier::parse(referrer).ok(); let referrer_specifier = ModuleSpecifier::parse(referrer).ok();
if referrer == "." || referrer_specifier.unwrap().scheme() == "internal" if referrer == "." || referrer_specifier.unwrap().scheme() == "ext" {
{
return Ok(url_specifier); return Ok(url_specifier);
} else { } else {
return Err(generic_error( return Err(generic_error(
"Cannot load internal module from external code", "Cannot load extension module from external code",
)); ));
}; };
} }
@ -416,7 +414,7 @@ impl ModuleLoader for InternalModuleLoader {
maybe_referrer: Option<ModuleSpecifier>, maybe_referrer: Option<ModuleSpecifier>,
is_dyn_import: bool, is_dyn_import: bool,
) -> Pin<Box<ModuleSourceFuture>> { ) -> Pin<Box<ModuleSourceFuture>> {
if module_specifier.scheme() != "internal" { if module_specifier.scheme() != "ext" {
return self.module_loader.load( return self.module_loader.load(
module_specifier, module_specifier,
maybe_referrer, maybe_referrer,
@ -461,7 +459,7 @@ impl ModuleLoader for InternalModuleLoader {
async move { async move {
Err(generic_error(format!( Err(generic_error(format!(
"Cannot find internal module source for specifier {specifier}" "Cannot find extension module source for specifier {specifier}"
))) )))
} }
.boxed_local() .boxed_local()
@ -474,7 +472,7 @@ impl ModuleLoader for InternalModuleLoader {
maybe_referrer: Option<String>, maybe_referrer: Option<String>,
is_dyn_import: bool, is_dyn_import: bool,
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> { ) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
if module_specifier.scheme() == "internal" { if module_specifier.scheme() == "ext" {
return async { Ok(()) }.boxed_local(); return async { Ok(()) }.boxed_local();
} }
@ -2911,17 +2909,17 @@ if (import.meta.url != 'file:///main_with_code.js') throw Error();
} }
#[test] #[test]
fn internal_module_loader() { fn ext_module_loader() {
let loader = InternalModuleLoader::default(); let loader = ExtModuleLoader::default();
assert!(loader assert!(loader
.resolve("internal:foo", "internal:bar", ResolutionKind::Import) .resolve("ext:foo", "ext:bar", ResolutionKind::Import)
.is_ok()); .is_ok());
assert_eq!( assert_eq!(
loader loader
.resolve("internal:foo", "file://bar", ResolutionKind::Import) .resolve("ext:foo", "file://bar", ResolutionKind::Import)
.err() .err()
.map(|e| e.to_string()), .map(|e| e.to_string()),
Some("Cannot load internal module from external code".to_string()) Some("Cannot load extension module from external code".to_string())
); );
assert_eq!( assert_eq!(
loader loader
@ -2935,11 +2933,11 @@ if (import.meta.url != 'file:///main_with_code.js') throw Error();
); );
assert_eq!( assert_eq!(
loader loader
.resolve("file://foo", "internal:bar", ResolutionKind::Import) .resolve("file://foo", "ext:bar", ResolutionKind::Import)
.err() .err()
.map(|e| e.to_string()), .map(|e| e.to_string()),
Some( Some(
"Module loading is not supported; attempted to resolve: \"file://foo\" from \"internal:bar\"" "Module loading is not supported; attempted to resolve: \"file://foo\" from \"ext:bar\""
.to_string() .to_string()
) )
); );
@ -2947,13 +2945,13 @@ if (import.meta.url != 'file:///main_with_code.js') throw Error();
resolve_helper( resolve_helper(
true, true,
Rc::new(loader), Rc::new(loader),
"internal:core.js", "ext:core.js",
"file://bar", "file://bar",
ResolutionKind::Import, ResolutionKind::Import,
) )
.err() .err()
.map(|e| e.to_string()), .map(|e| e.to_string()),
Some("Cannot load internal module from external code".to_string()) Some("Cannot load extension module from external code".to_string())
); );
} }
} }

View file

@ -8,7 +8,7 @@ use crate::extensions::OpDecl;
use crate::extensions::OpEventLoopFn; use crate::extensions::OpEventLoopFn;
use crate::inspector::JsRuntimeInspector; use crate::inspector::JsRuntimeInspector;
use crate::module_specifier::ModuleSpecifier; use crate::module_specifier::ModuleSpecifier;
use crate::modules::InternalModuleLoaderCb; use crate::modules::ExtModuleLoaderCb;
use crate::modules::ModuleError; use crate::modules::ModuleError;
use crate::modules::ModuleId; use crate::modules::ModuleId;
use crate::modules::ModuleLoadId; use crate::modules::ModuleLoadId;
@ -275,7 +275,7 @@ pub struct RuntimeOptions {
/// An optional callback that will be called for each module that is loaded /// An optional callback that will be called for each module that is loaded
/// during snapshotting. This callback can be used to transpile source on the /// during snapshotting. This callback can be used to transpile source on the
/// fly, during snapshotting, eg. to transpile TypeScript to JavaScript. /// fly, during snapshotting, eg. to transpile TypeScript to JavaScript.
pub snapshot_module_load_cb: Option<InternalModuleLoaderCb>, pub snapshot_module_load_cb: Option<ExtModuleLoaderCb>,
/// Isolate creation parameters. /// Isolate creation parameters.
pub create_params: Option<v8::CreateParams>, pub create_params: Option<v8::CreateParams>,
@ -620,7 +620,7 @@ impl JsRuntime {
} }
} }
Rc::new(crate::modules::InternalModuleLoader::new( Rc::new(crate::modules::ExtModuleLoader::new(
options.module_loader, options.module_loader,
esm_sources, esm_sources,
options.snapshot_module_load_cb, options.snapshot_module_load_cb,
@ -3984,8 +3984,8 @@ assertEquals(1, notify_return_value);
) )
.unwrap_err(); .unwrap_err();
let error_string = error.to_string(); let error_string = error.to_string();
// Test that the script specifier is a URL: `internal:<repo-relative path>`. // Test that the script specifier is a URL: `ext:<repo-relative path>`.
assert!(error_string.contains("internal:core/01_core.js")); assert!(error_string.contains("ext:core/01_core.js"));
} }
#[test] #[test]
@ -5018,8 +5018,8 @@ Deno.core.opAsync("op_async_serialize_object_with_numbers_as_keys", {
) -> Pin<Box<ModuleSourceFuture>> { ) -> Pin<Box<ModuleSourceFuture>> {
let source = r#" let source = r#"
// This module doesn't really exist, just verifying that we'll get // This module doesn't really exist, just verifying that we'll get
// an error when specifier starts with "internal:". // an error when specifier starts with "ext:".
import { core } from "internal:core.js"; import { core } from "ext:core.js";
"#; "#;
async move { async move {
@ -5055,7 +5055,7 @@ Deno.core.opAsync("op_async_serialize_object_with_numbers_as_keys", {
.unwrap_err(); .unwrap_err();
assert_eq!( assert_eq!(
err.to_string(), err.to_string(),
"Cannot load internal module from external code" "Cannot load extension module from external code"
); );
} }
} }

View file

@ -4,8 +4,8 @@ use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use std::time::Instant; use std::time::Instant;
use crate::ExtModuleLoaderCb;
use crate::Extension; use crate::Extension;
use crate::InternalModuleLoaderCb;
use crate::JsRuntime; use crate::JsRuntime;
use crate::RuntimeOptions; use crate::RuntimeOptions;
use crate::Snapshot; use crate::Snapshot;
@ -19,7 +19,7 @@ pub struct CreateSnapshotOptions {
pub extensions: Vec<Extension>, pub extensions: Vec<Extension>,
pub extensions_with_js: Vec<Extension>, pub extensions_with_js: Vec<Extension>,
pub compression_cb: Option<Box<CompressionCb>>, pub compression_cb: Option<Box<CompressionCb>>,
pub snapshot_module_load_cb: Option<InternalModuleLoaderCb>, pub snapshot_module_load_cb: Option<ExtModuleLoaderCb>,
} }
pub fn create_snapshot(create_snapshot_options: CreateSnapshotOptions) { pub fn create_snapshot(create_snapshot_options: CreateSnapshotOptions) {

View file

@ -4,13 +4,13 @@
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
const ops = core.ops; const ops = core.ops;
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { import {
defineEventHandler, defineEventHandler,
EventTarget, EventTarget,
setTarget, setTarget,
} from "internal:deno_web/02_event.js"; } from "ext:deno_web/02_event.js";
import DOMException from "internal:deno_web/01_dom_exception.js"; import DOMException from "ext:deno_web/01_dom_exception.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { const {
ArrayPrototypeIndexOf, ArrayPrototypeIndexOf,

12
ext/cache/01_cache.js vendored
View file

@ -1,7 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { const {
Symbol, Symbol,
@ -12,11 +12,11 @@ import {
Request, Request,
RequestPrototype, RequestPrototype,
toInnerRequest, toInnerRequest,
} from "internal:deno_fetch/23_request.js"; } from "ext:deno_fetch/23_request.js";
import { toInnerResponse } from "internal:deno_fetch/23_response.js"; import { toInnerResponse } from "ext:deno_fetch/23_response.js";
import { URLPrototype } from "internal:deno_url/00_url.js"; import { URLPrototype } from "ext:deno_url/00_url.js";
import { getHeader } from "internal:deno_fetch/20_headers.js"; import { getHeader } from "ext:deno_fetch/20_headers.js";
import { readableStreamForRid } from "internal:deno_web/06_streams.js"; import { readableStreamForRid } from "ext:deno_web/06_streams.js";
class CacheStorage { class CacheStorage {
constructor() { constructor() {

View file

@ -118,7 +118,7 @@ const {
WeakMapPrototype, WeakMapPrototype,
WeakSetPrototype, WeakSetPrototype,
} = primordials; } = primordials;
import * as colors from "internal:deno_console/01_colors.js"; import * as colors from "ext:deno_console/01_colors.js";
function isInvalidDate(x) { function isInvalidDate(x) {
return isNaN(DatePrototypeGetTime(x)); return isNaN(DatePrototypeGetTime(x));

View file

@ -3,7 +3,7 @@
/// <reference no-default-lib="true" /> /// <reference no-default-lib="true" />
/// <reference lib="esnext" /> /// <reference lib="esnext" />
declare module "internal:deno_console/02_console.js" { declare module "ext:deno_console/02_console.js" {
function createFilteredInspectProxy<TObject>(params: { function createFilteredInspectProxy<TObject>(params: {
object: TObject; object: TObject;
keys: (keyof TObject)[]; keys: (keyof TObject)[];

View file

@ -9,8 +9,8 @@
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
const ops = core.ops; const ops = core.ops;
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import DOMException from "internal:deno_web/01_dom_exception.js"; import DOMException from "ext:deno_web/01_dom_exception.js";
const { const {
ArrayBufferPrototype, ArrayBufferPrototype,
ArrayBufferIsView, ArrayBufferIsView,

View file

@ -5,8 +5,8 @@
/// <reference path="../webidl/internal.d.ts" /> /// <reference path="../webidl/internal.d.ts" />
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { CryptoKey } from "internal:deno_crypto/00_crypto.js"; import { CryptoKey } from "ext:deno_crypto/00_crypto.js";
const { const {
ArrayBufferIsView, ArrayBufferIsView,
ArrayBufferPrototype, ArrayBufferPrototype,

View file

@ -9,7 +9,7 @@
/// <reference path="./lib.deno_fetch.d.ts" /> /// <reference path="./lib.deno_fetch.d.ts" />
/// <reference lib="esnext" /> /// <reference lib="esnext" />
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { import {
byteLowerCase, byteLowerCase,
collectHttpQuotedString, collectHttpQuotedString,
@ -18,7 +18,7 @@ import {
HTTP_TAB_OR_SPACE_SUFFIX_RE, HTTP_TAB_OR_SPACE_SUFFIX_RE,
HTTP_TOKEN_CODE_POINT_RE, HTTP_TOKEN_CODE_POINT_RE,
httpTrim, httpTrim,
} from "internal:deno_web/00_infra.js"; } from "ext:deno_web/00_infra.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { const {
ArrayIsArray, ArrayIsArray,

View file

@ -10,13 +10,13 @@
/// <reference lib="esnext" /> /// <reference lib="esnext" />
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { import {
Blob, Blob,
BlobPrototype, BlobPrototype,
File, File,
FilePrototype, FilePrototype,
} from "internal:deno_web/09_file.js"; } from "ext:deno_web/09_file.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { const {
ArrayPrototypePush, ArrayPrototypePush,

View file

@ -12,19 +12,19 @@
/// <reference lib="esnext" /> /// <reference lib="esnext" />
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { import {
parseUrlEncoded, parseUrlEncoded,
URLSearchParamsPrototype, URLSearchParamsPrototype,
} from "internal:deno_url/00_url.js"; } from "ext:deno_url/00_url.js";
import { import {
formDataFromEntries, formDataFromEntries,
FormDataPrototype, FormDataPrototype,
formDataToBlob, formDataToBlob,
parseFormData, parseFormData,
} from "internal:deno_fetch/21_formdata.js"; } from "ext:deno_fetch/21_formdata.js";
import * as mimesniff from "internal:deno_web/01_mimesniff.js"; import * as mimesniff from "ext:deno_web/01_mimesniff.js";
import { BlobPrototype } from "internal:deno_web/09_file.js"; import { BlobPrototype } from "ext:deno_web/09_file.js";
import { import {
createProxy, createProxy,
errorReadableStream, errorReadableStream,
@ -34,7 +34,7 @@ import {
readableStreamDisturb, readableStreamDisturb,
ReadableStreamPrototype, ReadableStreamPrototype,
readableStreamThrowIfErrored, readableStreamThrowIfErrored,
} from "internal:deno_web/06_streams.js"; } from "ext:deno_web/06_streams.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { const {
ArrayBufferPrototype, ArrayBufferPrototype,

View file

@ -9,30 +9,26 @@
/// <reference path="./lib.deno_fetch.d.ts" /> /// <reference path="./lib.deno_fetch.d.ts" />
/// <reference lib="esnext" /> /// <reference lib="esnext" />
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "internal:deno_console/02_console.js"; import { createFilteredInspectProxy } from "ext:deno_console/02_console.js";
import { import {
byteUpperCase, byteUpperCase,
HTTP_TOKEN_CODE_POINT_RE, HTTP_TOKEN_CODE_POINT_RE,
} from "internal:deno_web/00_infra.js"; } from "ext:deno_web/00_infra.js";
import { URL } from "internal:deno_url/00_url.js"; import { URL } from "ext:deno_url/00_url.js";
import { import { extractBody, InnerBody, mixinBody } from "ext:deno_fetch/22_body.js";
extractBody, import { getLocationHref } from "ext:deno_web/12_location.js";
InnerBody, import { extractMimeType } from "ext:deno_web/01_mimesniff.js";
mixinBody, import { blobFromObjectUrl } from "ext:deno_web/09_file.js";
} from "internal:deno_fetch/22_body.js";
import { getLocationHref } from "internal:deno_web/12_location.js";
import { extractMimeType } from "internal:deno_web/01_mimesniff.js";
import { blobFromObjectUrl } from "internal:deno_web/09_file.js";
import { import {
fillHeaders, fillHeaders,
getDecodeSplitHeader, getDecodeSplitHeader,
guardFromHeaders, guardFromHeaders,
headerListFromHeaders, headerListFromHeaders,
headersFromHeaderList, headersFromHeaderList,
} from "internal:deno_fetch/20_headers.js"; } from "ext:deno_fetch/20_headers.js";
import { HttpClientPrototype } from "internal:deno_fetch/22_http_client.js"; import { HttpClientPrototype } from "ext:deno_fetch/22_http_client.js";
import * as abortSignal from "internal:deno_web/03_abort_signal.js"; import * as abortSignal from "ext:deno_web/03_abort_signal.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { const {
ArrayPrototypeMap, ArrayPrototypeMap,

View file

@ -11,25 +11,25 @@
/// <reference lib="esnext" /> /// <reference lib="esnext" />
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "internal:deno_console/02_console.js"; import { createFilteredInspectProxy } from "ext:deno_console/02_console.js";
import { import {
byteLowerCase, byteLowerCase,
HTTP_TAB_OR_SPACE, HTTP_TAB_OR_SPACE,
regexMatcher, regexMatcher,
serializeJSValueToJSONString, serializeJSValueToJSONString,
} from "internal:deno_web/00_infra.js"; } from "ext:deno_web/00_infra.js";
import { extractBody, mixinBody } from "internal:deno_fetch/22_body.js"; import { extractBody, mixinBody } from "ext:deno_fetch/22_body.js";
import { getLocationHref } from "internal:deno_web/12_location.js"; import { getLocationHref } from "ext:deno_web/12_location.js";
import { extractMimeType } from "internal:deno_web/01_mimesniff.js"; import { extractMimeType } from "ext:deno_web/01_mimesniff.js";
import { URL } from "internal:deno_url/00_url.js"; import { URL } from "ext:deno_url/00_url.js";
import { import {
fillHeaders, fillHeaders,
getDecodeSplitHeader, getDecodeSplitHeader,
guardFromHeaders, guardFromHeaders,
headerListFromHeaders, headerListFromHeaders,
headersFromHeaderList, headersFromHeaderList,
} from "internal:deno_fetch/20_headers.js"; } from "ext:deno_fetch/20_headers.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { const {
ArrayPrototypeMap, ArrayPrototypeMap,

View file

@ -12,19 +12,16 @@
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
const ops = core.ops; const ops = core.ops;
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { byteLowerCase } from "internal:deno_web/00_infra.js"; import { byteLowerCase } from "ext:deno_web/00_infra.js";
import { BlobPrototype } from "internal:deno_web/09_file.js"; import { BlobPrototype } from "ext:deno_web/09_file.js";
import { import {
errorReadableStream, errorReadableStream,
readableStreamForRid, readableStreamForRid,
ReadableStreamPrototype, ReadableStreamPrototype,
} from "internal:deno_web/06_streams.js"; } from "ext:deno_web/06_streams.js";
import { extractBody, InnerBody } from "internal:deno_fetch/22_body.js"; import { extractBody, InnerBody } from "ext:deno_fetch/22_body.js";
import { import { processUrlList, toInnerRequest } from "ext:deno_fetch/23_request.js";
processUrlList,
toInnerRequest,
} from "internal:deno_fetch/23_request.js";
import { import {
abortedNetworkError, abortedNetworkError,
fromInnerResponse, fromInnerResponse,
@ -32,8 +29,8 @@ import {
nullBodyStatus, nullBodyStatus,
redirectStatus, redirectStatus,
toInnerResponse, toInnerResponse,
} from "internal:deno_fetch/23_response.js"; } from "ext:deno_fetch/23_response.js";
import * as abortSignal from "internal:deno_web/03_abort_signal.js"; import * as abortSignal from "ext:deno_web/03_abort_signal.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { const {
ArrayPrototypePush, ArrayPrototypePush,

View file

@ -9,7 +9,7 @@ declare var domIterable: {
DomIterableMixin(base: any, dataSymbol: symbol): any; DomIterableMixin(base: any, dataSymbol: symbol): any;
}; };
declare module "internal:deno_fetch/20_headers.js" { declare module "ext:deno_fetch/20_headers.js" {
class Headers { class Headers {
} }
type HeaderList = [string, string][]; type HeaderList = [string, string][];
@ -33,7 +33,7 @@ declare module "internal:deno_fetch/20_headers.js" {
): "immutable" | "request" | "request-no-cors" | "response" | "none"; ): "immutable" | "request" | "request-no-cors" | "response" | "none";
} }
declare module "internal:deno_fetch/21_formdata.js" { declare module "ext:deno_fetch/21_formdata.js" {
type FormData = typeof FormData; type FormData = typeof FormData;
function formDataToBlob( function formDataToBlob(
formData: FormData, formData: FormData,
@ -45,7 +45,7 @@ declare module "internal:deno_fetch/21_formdata.js" {
function formDataFromEntries(entries: FormDataEntry[]): FormData; function formDataFromEntries(entries: FormDataEntry[]): FormData;
} }
declare module "internal:deno_fetch/22_body.js" { declare module "ext:deno_fetch/22_body.js" {
function mixinBody( function mixinBody(
prototype: any, prototype: any,
bodySymbol: symbol, bodySymbol: symbol,
@ -66,7 +66,7 @@ declare module "internal:deno_fetch/22_body.js" {
}; };
} }
declare module "internal:deno_fetch/26_fetch.js" { declare module "ext:deno_fetch/26_fetch.js" {
function toInnerRequest(request: Request): InnerRequest; function toInnerRequest(request: Request): InnerRequest;
function fromInnerRequest( function fromInnerRequest(
inner: InnerRequest, inner: InnerRequest,

View file

@ -27,7 +27,7 @@ const {
SymbolFor, SymbolFor,
WeakMap, WeakMap,
} = primordials; } = primordials;
import { pathFromURL } from "internal:deno_web/00_infra.js"; import { pathFromURL } from "ext:deno_web/00_infra.js";
const promiseIdSymbol = SymbolFor("Deno.core.internalPromiseId"); const promiseIdSymbol = SymbolFor("Deno.core.internalPromiseId");

View file

@ -2,18 +2,18 @@
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
const ops = core.ops; const ops = core.ops;
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
import { BlobPrototype } from "internal:deno_web/09_file.js"; import { BlobPrototype } from "ext:deno_web/09_file.js";
import { TcpConn } from "internal:deno_net/01_net.js"; import { TcpConn } from "ext:deno_net/01_net.js";
import { toInnerResponse } from "internal:deno_fetch/23_response.js"; import { toInnerResponse } from "ext:deno_fetch/23_response.js";
import { _flash, fromFlashRequest } from "internal:deno_fetch/23_request.js"; import { _flash, fromFlashRequest } from "ext:deno_fetch/23_request.js";
import { Event } from "internal:deno_web/02_event.js"; import { Event } from "ext:deno_web/02_event.js";
import { import {
_state, _state,
getReadableStreamResourceBacking, getReadableStreamResourceBacking,
ReadableStream, ReadableStream,
readableStreamClose, readableStreamClose,
ReadableStreamPrototype, ReadableStreamPrototype,
} from "internal:deno_web/06_streams.js"; } from "ext:deno_web/06_streams.js";
import { import {
_eventLoop, _eventLoop,
_idleTimeoutDuration, _idleTimeoutDuration,
@ -23,8 +23,8 @@ import {
_rid, _rid,
_serverHandleIdleTimeout, _serverHandleIdleTimeout,
WebSocket, WebSocket,
} from "internal:deno_websocket/01_websocket.js"; } from "ext:deno_websocket/01_websocket.js";
import { _ws } from "internal:deno_http/01_http.js"; import { _ws } from "ext:deno_http/01_http.js";
const { const {
ObjectPrototypeIsPrototypeOf, ObjectPrototypeIsPrototypeOf,
PromisePrototype, PromisePrototype,

View file

@ -17,14 +17,14 @@ const {
SymbolIterator, SymbolIterator,
Uint32Array, Uint32Array,
} = primordials; } = primordials;
import { read, readSync, write, writeSync } from "internal:deno_io/12_io.js"; import { read, readSync, write, writeSync } from "ext:deno_io/12_io.js";
import * as abortSignal from "internal:deno_web/03_abort_signal.js"; import * as abortSignal from "ext:deno_web/03_abort_signal.js";
import { import {
readableStreamForRid, readableStreamForRid,
ReadableStreamPrototype, ReadableStreamPrototype,
writableStreamForRid, writableStreamForRid,
} from "internal:deno_web/06_streams.js"; } from "ext:deno_web/06_streams.js";
import { pathFromURL } from "internal:deno_web/00_infra.js"; import { pathFromURL } from "ext:deno_web/00_infra.js";
function chmodSync(path, mode) { function chmodSync(path, mode) {
ops.op_chmod_sync(pathFromURL(path), mode); ops.op_chmod_sync(pathFromURL(path), mode);

View file

@ -3,22 +3,22 @@ const core = globalThis.Deno.core;
const internals = globalThis.__bootstrap.internals; const internals = globalThis.__bootstrap.internals;
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { BadResourcePrototype, InterruptedPrototype, ops } = core; const { BadResourcePrototype, InterruptedPrototype, ops } = core;
import * as webidl from "internal:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { InnerBody } from "internal:deno_fetch/22_body.js"; import { InnerBody } from "ext:deno_fetch/22_body.js";
import { Event, setEventTargetData } from "internal:deno_web/02_event.js"; import { Event, setEventTargetData } from "ext:deno_web/02_event.js";
import { BlobPrototype } from "internal:deno_web/09_file.js"; import { BlobPrototype } from "ext:deno_web/09_file.js";
import { import {
fromInnerResponse, fromInnerResponse,
newInnerResponse, newInnerResponse,
ResponsePrototype, ResponsePrototype,
toInnerResponse, toInnerResponse,
} from "internal:deno_fetch/23_response.js"; } from "ext:deno_fetch/23_response.js";
import { import {
_flash, _flash,
fromInnerRequest, fromInnerRequest,
newInnerRequest, newInnerRequest,
} from "internal:deno_fetch/23_request.js"; } from "ext:deno_fetch/23_request.js";
import * as abortSignal from "internal:deno_web/03_abort_signal.js"; import * as abortSignal from "ext:deno_web/03_abort_signal.js";
import { import {
_eventLoop, _eventLoop,
_idleTimeoutDuration, _idleTimeoutDuration,
@ -29,16 +29,16 @@ import {
_server, _server,
_serverHandleIdleTimeout, _serverHandleIdleTimeout,
WebSocket, WebSocket,
} from "internal:deno_websocket/01_websocket.js"; } from "ext:deno_websocket/01_websocket.js";
import { TcpConn, UnixConn } from "internal:deno_net/01_net.js"; import { TcpConn, UnixConn } from "ext:deno_net/01_net.js";
import { TlsConn } from "internal:deno_net/02_tls.js"; import { TlsConn } from "ext:deno_net/02_tls.js";
import { import {
Deferred, Deferred,
getReadableStreamResourceBacking, getReadableStreamResourceBacking,
readableStreamClose, readableStreamClose,
readableStreamForRid, readableStreamForRid,
ReadableStreamPrototype, ReadableStreamPrototype,
} from "internal:deno_web/06_streams.js"; } from "ext:deno_web/06_streams.js";
const { const {
ArrayPrototypeIncludes, ArrayPrototypeIncludes,
ArrayPrototypeMap, ArrayPrototypeMap,

View file

@ -10,7 +10,7 @@ const primordials = globalThis.__bootstrap.primordials;
import { import {
readableStreamForRid, readableStreamForRid,
writableStreamForRid, writableStreamForRid,
} from "internal:deno_web/06_streams.js"; } from "ext:deno_web/06_streams.js";
const { const {
Uint8Array, Uint8Array,
ArrayPrototypePush, ArrayPrototypePush,

View file

@ -7,8 +7,8 @@ import {
readableStreamForRidUnrefableRef, readableStreamForRidUnrefableRef,
readableStreamForRidUnrefableUnref, readableStreamForRidUnrefableUnref,
writableStreamForRid, writableStreamForRid,
} from "internal:deno_web/06_streams.js"; } from "ext:deno_web/06_streams.js";
import * as abortSignal from "internal:deno_web/03_abort_signal.js"; import * as abortSignal from "ext:deno_web/03_abort_signal.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { const {
Error, Error,

View file

@ -2,7 +2,7 @@
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
const ops = core.ops; const ops = core.ops;
import { Conn, Listener } from "internal:deno_net/01_net.js"; import { Conn, Listener } from "ext:deno_net/01_net.js";
const primordials = globalThis.__bootstrap.primordials; const primordials = globalThis.__bootstrap.primordials;
const { TypeError } = primordials; const { TypeError } = primordials;

View file

@ -334,7 +334,7 @@ pub fn init_polyfill_ops_and_esm() -> Extension {
Extension::builder(env!("CARGO_PKG_NAME")) Extension::builder(env!("CARGO_PKG_NAME"))
.esm(esm_files) .esm(esm_files)
.esm_entry_point("internal:deno_node/module_all.ts") .esm_entry_point("ext:deno_node/module_all.ts")
.dependencies(vec!["deno_io", "deno_fs"]) .dependencies(vec!["deno_io", "deno_fs"])
.ops(vec![ .ops(vec![
crypto::op_node_create_hash::decl(), crypto::op_node_create_hash::decl(),

View file

@ -21,182 +21,182 @@ pub struct NodeModulePolyfill {
pub static SUPPORTED_BUILTIN_NODE_MODULES: &[NodeModulePolyfill] = &[ pub static SUPPORTED_BUILTIN_NODE_MODULES: &[NodeModulePolyfill] = &[
NodeModulePolyfill { NodeModulePolyfill {
name: "assert", name: "assert",
specifier: "internal:deno_node/assert.ts", specifier: "ext:deno_node/assert.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "assert/strict", name: "assert/strict",
specifier: "internal:deno_node/assert/strict.ts", specifier: "ext:deno_node/assert/strict.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "async_hooks", name: "async_hooks",
specifier: "internal:deno_node/async_hooks.ts", specifier: "ext:deno_node/async_hooks.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "buffer", name: "buffer",
specifier: "internal:deno_node/buffer.ts", specifier: "ext:deno_node/buffer.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "child_process", name: "child_process",
specifier: "internal:deno_node/child_process.ts", specifier: "ext:deno_node/child_process.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "cluster", name: "cluster",
specifier: "internal:deno_node/cluster.ts", specifier: "ext:deno_node/cluster.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "console", name: "console",
specifier: "internal:deno_node/console.ts", specifier: "ext:deno_node/console.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "constants", name: "constants",
specifier: "internal:deno_node/constants.ts", specifier: "ext:deno_node/constants.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "crypto", name: "crypto",
specifier: "internal:deno_node/crypto.ts", specifier: "ext:deno_node/crypto.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "dgram", name: "dgram",
specifier: "internal:deno_node/dgram.ts", specifier: "ext:deno_node/dgram.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "dns", name: "dns",
specifier: "internal:deno_node/dns.ts", specifier: "ext:deno_node/dns.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "dns/promises", name: "dns/promises",
specifier: "internal:deno_node/dns/promises.ts", specifier: "ext:deno_node/dns/promises.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "domain", name: "domain",
specifier: "internal:deno_node/domain.ts", specifier: "ext:deno_node/domain.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "events", name: "events",
specifier: "internal:deno_node/events.ts", specifier: "ext:deno_node/events.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "fs", name: "fs",
specifier: "internal:deno_node/fs.ts", specifier: "ext:deno_node/fs.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "fs/promises", name: "fs/promises",
specifier: "internal:deno_node/fs/promises.ts", specifier: "ext:deno_node/fs/promises.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "http", name: "http",
specifier: "internal:deno_node/http.ts", specifier: "ext:deno_node/http.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "https", name: "https",
specifier: "internal:deno_node/https.ts", specifier: "ext:deno_node/https.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "module", name: "module",
specifier: "internal:deno_node_loading/module_es_shim.js", specifier: "ext:deno_node_loading/module_es_shim.js",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "net", name: "net",
specifier: "internal:deno_node/net.ts", specifier: "ext:deno_node/net.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "os", name: "os",
specifier: "internal:deno_node/os.ts", specifier: "ext:deno_node/os.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "path", name: "path",
specifier: "internal:deno_node/path.ts", specifier: "ext:deno_node/path.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "path/posix", name: "path/posix",
specifier: "internal:deno_node/path/posix.ts", specifier: "ext:deno_node/path/posix.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "path/win32", name: "path/win32",
specifier: "internal:deno_node/path/win32.ts", specifier: "ext:deno_node/path/win32.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "perf_hooks", name: "perf_hooks",
specifier: "internal:deno_node/perf_hooks.ts", specifier: "ext:deno_node/perf_hooks.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "process", name: "process",
specifier: "internal:deno_node/process.ts", specifier: "ext:deno_node/process.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "querystring", name: "querystring",
specifier: "internal:deno_node/querystring.ts", specifier: "ext:deno_node/querystring.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "readline", name: "readline",
specifier: "internal:deno_node/readline.ts", specifier: "ext:deno_node/readline.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "stream", name: "stream",
specifier: "internal:deno_node/stream.ts", specifier: "ext:deno_node/stream.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "stream/consumers", name: "stream/consumers",
specifier: "internal:deno_node/stream/consumers.mjs", specifier: "ext:deno_node/stream/consumers.mjs",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "stream/promises", name: "stream/promises",
specifier: "internal:deno_node/stream/promises.mjs", specifier: "ext:deno_node/stream/promises.mjs",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "stream/web", name: "stream/web",
specifier: "internal:deno_node/stream/web.ts", specifier: "ext:deno_node/stream/web.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "string_decoder", name: "string_decoder",
specifier: "internal:deno_node/string_decoder.ts", specifier: "ext:deno_node/string_decoder.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "sys", name: "sys",
specifier: "internal:deno_node/sys.ts", specifier: "ext:deno_node/sys.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "timers", name: "timers",
specifier: "internal:deno_node/timers.ts", specifier: "ext:deno_node/timers.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "timers/promises", name: "timers/promises",
specifier: "internal:deno_node/timers/promises.ts", specifier: "ext:deno_node/timers/promises.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "tls", name: "tls",
specifier: "internal:deno_node/tls.ts", specifier: "ext:deno_node/tls.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "tty", name: "tty",
specifier: "internal:deno_node/tty.ts", specifier: "ext:deno_node/tty.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "url", name: "url",
specifier: "internal:deno_node/url.ts", specifier: "ext:deno_node/url.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "util", name: "util",
specifier: "internal:deno_node/util.ts", specifier: "ext:deno_node/util.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "util/types", name: "util/types",
specifier: "internal:deno_node/util/types.ts", specifier: "ext:deno_node/util/types.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "v8", name: "v8",
specifier: "internal:deno_node/v8.ts", specifier: "ext:deno_node/v8.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "vm", name: "vm",
specifier: "internal:deno_node/vm.ts", specifier: "ext:deno_node/vm.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "worker_threads", name: "worker_threads",
specifier: "internal:deno_node/worker_threads.ts", specifier: "ext:deno_node/worker_threads.ts",
}, },
NodeModulePolyfill { NodeModulePolyfill {
name: "zlib", name: "zlib",
specifier: "internal:deno_node/zlib.ts", specifier: "ext:deno_node/zlib.ts",
}, },
]; ];

View file

@ -6,7 +6,7 @@
// Note: deno_std shouldn't use Deno.core namespace. We should minimize these // Note: deno_std shouldn't use Deno.core namespace. We should minimize these
// usages. // usages.
import { TextEncoder } from "internal:deno_web/08_text_encoding.js"; import { TextEncoder } from "ext:deno_web/08_text_encoding.js";
// deno-lint-ignore no-explicit-any // deno-lint-ignore no-explicit-any
let DenoCore: any; let DenoCore: any;

View file

@ -24,21 +24,21 @@
const kRejection = Symbol.for("nodejs.rejection"); const kRejection = Symbol.for("nodejs.rejection");
import { inspect } from "internal:deno_node/internal/util/inspect.mjs"; import { inspect } from "ext:deno_node/internal/util/inspect.mjs";
import { import {
AbortError, AbortError,
// kEnhanceStackBeforeInspector, // kEnhanceStackBeforeInspector,
ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_TYPE,
ERR_OUT_OF_RANGE, ERR_OUT_OF_RANGE,
ERR_UNHANDLED_ERROR, ERR_UNHANDLED_ERROR,
} from "internal:deno_node/internal/errors.ts"; } from "ext:deno_node/internal/errors.ts";
import { import {
validateAbortSignal, validateAbortSignal,
validateBoolean, validateBoolean,
validateFunction, validateFunction,
} from "internal:deno_node/internal/validators.mjs"; } from "ext:deno_node/internal/validators.mjs";
import { spliceOne } from "internal:deno_node/_utils.ts"; import { spliceOne } from "ext:deno_node/_utils.ts";
const kCapture = Symbol("kCapture"); const kCapture = Symbol("kCapture");
const kErrorMonitor = Symbol("events.errorMonitor"); const kErrorMonitor = Symbol("events.errorMonitor");

View file

@ -3,15 +3,15 @@
import { import {
type CallbackWithError, type CallbackWithError,
makeCallback, makeCallback,
} from "internal:deno_node/_fs/_fs_common.ts"; } from "ext:deno_node/_fs/_fs_common.ts";
import { fs } from "internal:deno_node/internal_binding/constants.ts"; import { fs } from "ext:deno_node/internal_binding/constants.ts";
import { codeMap } from "internal:deno_node/internal_binding/uv.ts"; import { codeMap } from "ext:deno_node/internal_binding/uv.ts";
import { import {
getValidatedPath, getValidatedPath,
getValidMode, getValidMode,
} from "internal:deno_node/internal/fs/utils.mjs"; } from "ext:deno_node/internal/fs/utils.mjs";
import type { Buffer } from "internal:deno_node/buffer.ts"; import type { Buffer } from "ext:deno_node/buffer.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
export function access( export function access(
path: string | Buffer | URL, path: string | Buffer | URL,

View file

@ -4,17 +4,11 @@ import {
isFd, isFd,
maybeCallback, maybeCallback,
WriteFileOptions, WriteFileOptions,
} from "internal:deno_node/_fs/_fs_common.ts"; } from "ext:deno_node/_fs/_fs_common.ts";
import { Encodings } from "internal:deno_node/_utils.ts"; import { Encodings } from "ext:deno_node/_utils.ts";
import { import { copyObject, getOptions } from "ext:deno_node/internal/fs/utils.mjs";
copyObject, import { writeFile, writeFileSync } from "ext:deno_node/_fs/_fs_writeFile.ts";
getOptions, import { promisify } from "ext:deno_node/internal/util.mjs";
} from "internal:deno_node/internal/fs/utils.mjs";
import {
writeFile,
writeFileSync,
} from "internal:deno_node/_fs/_fs_writeFile.ts";
import { promisify } from "internal:deno_node/internal/util.mjs";
/** /**
* TODO: Also accept 'data' parameter as a Node polyfill Buffer type once these * TODO: Also accept 'data' parameter as a Node polyfill Buffer type once these

View file

@ -1,10 +1,10 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
import { getValidatedPath } from "internal:deno_node/internal/fs/utils.mjs"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
import * as pathModule from "internal:deno_node/path.ts"; import * as pathModule from "ext:deno_node/path.ts";
import { parseFileMode } from "internal:deno_node/internal/validators.mjs"; import { parseFileMode } from "ext:deno_node/internal/validators.mjs";
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
export function chmod( export function chmod(
path: string | Buffer | URL, path: string | Buffer | URL,

View file

@ -2,15 +2,15 @@
import { import {
type CallbackWithError, type CallbackWithError,
makeCallback, makeCallback,
} from "internal:deno_node/_fs/_fs_common.ts"; } from "ext:deno_node/_fs/_fs_common.ts";
import { import {
getValidatedPath, getValidatedPath,
kMaxUserId, kMaxUserId,
} from "internal:deno_node/internal/fs/utils.mjs"; } from "ext:deno_node/internal/fs/utils.mjs";
import * as pathModule from "internal:deno_node/path.ts"; import * as pathModule from "ext:deno_node/path.ts";
import { validateInteger } from "internal:deno_node/internal/validators.mjs"; import { validateInteger } from "ext:deno_node/internal/validators.mjs";
import type { Buffer } from "internal:deno_node/buffer.ts"; import type { Buffer } from "ext:deno_node/buffer.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
/** /**
* Asynchronously changes the owner and group * Asynchronously changes the owner and group

View file

@ -1,6 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
import { getValidatedFd } from "internal:deno_node/internal/fs/utils.mjs"; import { getValidatedFd } from "ext:deno_node/internal/fs/utils.mjs";
export function close(fd: number, callback: CallbackWithError) { export function close(fd: number, callback: CallbackWithError) {
fd = getValidatedFd(fd); fd = getValidatedFd(fd);

View file

@ -7,15 +7,15 @@ import {
O_RDWR, O_RDWR,
O_TRUNC, O_TRUNC,
O_WRONLY, O_WRONLY,
} from "internal:deno_node/_fs/_fs_constants.ts"; } from "ext:deno_node/_fs/_fs_constants.ts";
import { validateFunction } from "internal:deno_node/internal/validators.mjs"; import { validateFunction } from "ext:deno_node/internal/validators.mjs";
import type { ErrnoException } from "internal:deno_node/_global.d.ts"; import type { ErrnoException } from "ext:deno_node/_global.d.ts";
import { import {
BinaryEncodings, BinaryEncodings,
Encodings, Encodings,
notImplemented, notImplemented,
TextEncodings, TextEncodings,
} from "internal:deno_node/_utils.ts"; } from "ext:deno_node/_utils.ts";
export type CallbackWithError = (err: ErrnoException | null) => void; export type CallbackWithError = (err: ErrnoException | null) => void;
@ -212,7 +212,7 @@ export function getOpenOptions(
return openOptions; return openOptions;
} }
export { isUint32 as isFd } from "internal:deno_node/internal/validators.mjs"; export { isUint32 as isFd } from "ext:deno_node/internal/validators.mjs";
export function maybeCallback(cb: unknown) { export function maybeCallback(cb: unknown) {
validateFunction(cb, "cb"); validateFunction(cb, "cb");

View file

@ -1,6 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { fs } from "internal:deno_node/internal_binding/constants.ts"; import { fs } from "ext:deno_node/internal_binding/constants.ts";
export const { export const {
F_OK, F_OK,

View file

@ -1,14 +1,14 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
import { makeCallback } from "internal:deno_node/_fs/_fs_common.ts"; import { makeCallback } from "ext:deno_node/_fs/_fs_common.ts";
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { import {
getValidatedPath, getValidatedPath,
getValidMode, getValidMode,
} from "internal:deno_node/internal/fs/utils.mjs"; } from "ext:deno_node/internal/fs/utils.mjs";
import { fs } from "internal:deno_node/internal_binding/constants.ts"; import { fs } from "ext:deno_node/internal_binding/constants.ts";
import { codeMap } from "internal:deno_node/internal_binding/uv.ts"; import { codeMap } from "ext:deno_node/internal_binding/uv.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
export function copyFile( export function copyFile(
src: string | Buffer | URL, src: string | Buffer | URL,

View file

@ -1,8 +1,8 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import Dirent from "internal:deno_node/_fs/_fs_dirent.ts"; import Dirent from "ext:deno_node/_fs/_fs_dirent.ts";
import { assert } from "internal:deno_node/_util/asserts.ts"; import { assert } from "ext:deno_node/_util/asserts.ts";
import { ERR_MISSING_ARGS } from "internal:deno_node/internal/errors.ts"; import { ERR_MISSING_ARGS } from "ext:deno_node/internal/errors.ts";
import { TextDecoder } from "internal:deno_web/08_text_encoding.js"; import { TextDecoder } from "ext:deno_web/08_text_encoding.js";
export default class Dir { export default class Dir {
#dirPath: string | Uint8Array; #dirPath: string | Uint8Array;

View file

@ -1,5 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { notImplemented } from "internal:deno_node/_utils.ts"; import { notImplemented } from "ext:deno_node/_utils.ts";
export default class Dirent { export default class Dirent {
constructor(private entry: Deno.DirEntry) {} constructor(private entry: Deno.DirEntry) {}

View file

@ -1,5 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { fromFileUrl } from "internal:deno_node/path.ts"; import { fromFileUrl } from "ext:deno_node/path.ts";
type ExistsCallback = (exists: boolean) => void; type ExistsCallback = (exists: boolean) => void;

View file

@ -1,5 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
export function fdatasync( export function fdatasync(
fd: number, fd: number,

View file

@ -6,7 +6,7 @@ import {
statCallbackBigInt, statCallbackBigInt,
statOptions, statOptions,
Stats, Stats,
} from "internal:deno_node/_fs/_fs_stat.ts"; } from "ext:deno_node/_fs/_fs_stat.ts";
export function fstat(fd: number, callback: statCallback): void; export function fstat(fd: number, callback: statCallback): void;
export function fstat( export function fstat(

View file

@ -1,5 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
export function fsync( export function fsync(
fd: number, fd: number,

View file

@ -1,5 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
export function ftruncate( export function ftruncate(
fd: number, fd: number,

View file

@ -1,6 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
function getValidTime( function getValidTime(
time: number | string | Date, time: number | string | Date,

View file

@ -1,7 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
import { fromFileUrl } from "internal:deno_node/path.ts"; import { fromFileUrl } from "ext:deno_node/path.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
/** /**
* TODO: Also accept 'path' parameter as a Node polyfill Buffer type once these * TODO: Also accept 'path' parameter as a Node polyfill Buffer type once these

View file

@ -6,8 +6,8 @@ import {
statCallbackBigInt, statCallbackBigInt,
statOptions, statOptions,
Stats, Stats,
} from "internal:deno_node/_fs/_fs_stat.ts"; } from "ext:deno_node/_fs/_fs_stat.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
export function lstat(path: string | URL, callback: statCallback): void; export function lstat(path: string | URL, callback: statCallback): void;
export function lstat( export function lstat(

View file

@ -1,9 +1,9 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
import { denoErrorToNodeError } from "internal:deno_node/internal/errors.ts"; import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
import { getValidatedPath } from "internal:deno_node/internal/fs/utils.mjs"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
import { validateBoolean } from "internal:deno_node/internal/validators.mjs"; import { validateBoolean } from "ext:deno_node/internal/validators.mjs";
/** /**
* TODO: Also accept 'path' parameter as a Node polyfill Buffer type once these * TODO: Also accept 'path' parameter as a Node polyfill Buffer type once these

View file

@ -1,17 +1,14 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// Copyright Node.js contributors. All rights reserved. MIT License. // Copyright Node.js contributors. All rights reserved. MIT License.
import { import { TextDecoder, TextEncoder } from "ext:deno_web/08_text_encoding.js";
TextDecoder, import { existsSync } from "ext:deno_node/_fs/_fs_exists.ts";
TextEncoder, import { mkdir, mkdirSync } from "ext:deno_node/_fs/_fs_mkdir.ts";
} from "internal:deno_web/08_text_encoding.js";
import { existsSync } from "internal:deno_node/_fs/_fs_exists.ts";
import { mkdir, mkdirSync } from "internal:deno_node/_fs/_fs_mkdir.ts";
import { import {
ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_TYPE,
ERR_INVALID_OPT_VALUE_ENCODING, ERR_INVALID_OPT_VALUE_ENCODING,
} from "internal:deno_node/internal/errors.ts"; } from "ext:deno_node/internal/errors.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
export type mkdtempCallback = ( export type mkdtempCallback = (
err: Error | null, err: Error | null,

View file

@ -6,13 +6,13 @@ import {
O_RDWR, O_RDWR,
O_TRUNC, O_TRUNC,
O_WRONLY, O_WRONLY,
} from "internal:deno_node/_fs/_fs_constants.ts"; } from "ext:deno_node/_fs/_fs_constants.ts";
import { getOpenOptions } from "internal:deno_node/_fs/_fs_common.ts"; import { getOpenOptions } from "ext:deno_node/_fs/_fs_common.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
import { parseFileMode } from "internal:deno_node/internal/validators.mjs"; import { parseFileMode } from "ext:deno_node/internal/validators.mjs";
import { ERR_INVALID_ARG_TYPE } from "internal:deno_node/internal/errors.ts"; import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts";
import { getValidatedPath } from "internal:deno_node/internal/fs/utils.mjs"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
import type { Buffer } from "internal:deno_node/buffer.ts"; import type { Buffer } from "ext:deno_node/buffer.ts";
function existsSync(filePath: string | URL): boolean { function existsSync(filePath: string | URL): boolean {
try { try {

View file

@ -1,17 +1,17 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import Dir from "internal:deno_node/_fs/_fs_dir.ts"; import Dir from "ext:deno_node/_fs/_fs_dir.ts";
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { import {
getOptions, getOptions,
getValidatedPath, getValidatedPath,
} from "internal:deno_node/internal/fs/utils.mjs"; } from "ext:deno_node/internal/fs/utils.mjs";
import { denoErrorToNodeError } from "internal:deno_node/internal/errors.ts"; import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
import { import {
validateFunction, validateFunction,
validateInteger, validateInteger,
} from "internal:deno_node/internal/validators.mjs"; } from "ext:deno_node/internal/validators.mjs";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
/** These options aren't funcitonally used right now, as `Dir` doesn't yet support them. /** These options aren't funcitonally used right now, as `Dir` doesn't yet support them.
* However, these values are still validated. * However, these values are still validated.

View file

@ -1,14 +1,14 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { ERR_INVALID_ARG_TYPE } from "internal:deno_node/internal/errors.ts"; import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts";
import { import {
validateOffsetLengthRead, validateOffsetLengthRead,
validatePosition, validatePosition,
} from "internal:deno_node/internal/fs/utils.mjs"; } from "ext:deno_node/internal/fs/utils.mjs";
import { import {
validateBuffer, validateBuffer,
validateInteger, validateInteger,
} from "internal:deno_node/internal/validators.mjs"; } from "ext:deno_node/internal/validators.mjs";
type readOptions = { type readOptions = {
buffer: Buffer | Uint8Array; buffer: Buffer | Uint8Array;

View file

@ -4,15 +4,15 @@ import {
FileOptionsArgument, FileOptionsArgument,
getEncoding, getEncoding,
TextOptionsArgument, TextOptionsArgument,
} from "internal:deno_node/_fs/_fs_common.ts"; } from "ext:deno_node/_fs/_fs_common.ts";
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { fromFileUrl } from "internal:deno_node/path.ts"; import { fromFileUrl } from "ext:deno_node/path.ts";
import { import {
BinaryEncodings, BinaryEncodings,
Encodings, Encodings,
TextEncodings, TextEncodings,
} from "internal:deno_node/_utils.ts"; } from "ext:deno_node/_utils.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
function maybeDecode(data: Uint8Array, encoding: TextEncodings): string; function maybeDecode(data: Uint8Array, encoding: TextEncodings): string;
function maybeDecode( function maybeDecode(

View file

@ -1,15 +1,12 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { import { TextDecoder, TextEncoder } from "ext:deno_web/08_text_encoding.js";
TextDecoder, import { asyncIterableToCallback } from "ext:deno_node/_fs/_fs_watch.ts";
TextEncoder, import Dirent from "ext:deno_node/_fs/_fs_dirent.ts";
} from "internal:deno_web/08_text_encoding.js"; import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
import { asyncIterableToCallback } from "internal:deno_node/_fs/_fs_watch.ts"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
import Dirent from "internal:deno_node/_fs/_fs_dirent.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { denoErrorToNodeError } from "internal:deno_node/internal/errors.ts"; import { promisify } from "ext:deno_node/internal/util.mjs";
import { getValidatedPath } from "internal:deno_node/internal/fs/utils.mjs";
import { Buffer } from "internal:deno_node/buffer.ts";
import { promisify } from "internal:deno_node/internal/util.mjs";
function toDirent(val: Deno.DirEntry): Dirent { function toDirent(val: Deno.DirEntry): Dirent {
return new Dirent(val); return new Dirent(val);

View file

@ -1,13 +1,13 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { TextEncoder } from "internal:deno_web/08_text_encoding.js"; import { TextEncoder } from "ext:deno_web/08_text_encoding.js";
import { import {
intoCallbackAPIWithIntercept, intoCallbackAPIWithIntercept,
MaybeEmpty, MaybeEmpty,
notImplemented, notImplemented,
} from "internal:deno_node/_utils.ts"; } from "ext:deno_node/_utils.ts";
import { fromFileUrl } from "internal:deno_node/path.ts"; import { fromFileUrl } from "ext:deno_node/path.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
type ReadlinkCallback = ( type ReadlinkCallback = (
err: MaybeEmpty<Error>, err: MaybeEmpty<Error>,

View file

@ -1,5 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
type Options = { encoding: string }; type Options = { encoding: string };
type Callback = (err: Error | null, path?: string) => void; type Callback = (err: Error | null, path?: string) => void;

View file

@ -1,6 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { fromFileUrl } from "internal:deno_node/path.ts"; import { fromFileUrl } from "ext:deno_node/path.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
export function rename( export function rename(
oldPath: string | URL, oldPath: string | URL,

View file

@ -2,9 +2,9 @@
import { import {
validateRmOptions, validateRmOptions,
validateRmOptionsSync, validateRmOptionsSync,
} from "internal:deno_node/internal/fs/utils.mjs"; } from "ext:deno_node/internal/fs/utils.mjs";
import { denoErrorToNodeError } from "internal:deno_node/internal/errors.ts"; import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
type rmOptions = { type rmOptions = {
force?: boolean; force?: boolean;

View file

@ -5,14 +5,14 @@ import {
validateRmdirOptions, validateRmdirOptions,
validateRmOptions, validateRmOptions,
validateRmOptionsSync, validateRmOptionsSync,
} from "internal:deno_node/internal/fs/utils.mjs"; } from "ext:deno_node/internal/fs/utils.mjs";
import { toNamespacedPath } from "internal:deno_node/path.ts"; import { toNamespacedPath } from "ext:deno_node/path.ts";
import { import {
denoErrorToNodeError, denoErrorToNodeError,
ERR_FS_RMDIR_ENOTDIR, ERR_FS_RMDIR_ENOTDIR,
} from "internal:deno_node/internal/errors.ts"; } from "ext:deno_node/internal/errors.ts";
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
type rmdirOptions = { type rmdirOptions = {
maxRetries?: number; maxRetries?: number;

View file

@ -1,6 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { denoErrorToNodeError } from "internal:deno_node/internal/errors.ts"; import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
export type statOptions = { export type statOptions = {
bigint: boolean; bigint: boolean;

View file

@ -1,7 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
import { fromFileUrl } from "internal:deno_node/path.ts"; import { fromFileUrl } from "ext:deno_node/path.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
type SymlinkType = "file" | "dir"; type SymlinkType = "file" | "dir";

View file

@ -1,7 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
import { fromFileUrl } from "internal:deno_node/path.ts"; import { fromFileUrl } from "ext:deno_node/path.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
export function truncate( export function truncate(
path: string | URL, path: string | URL,

View file

@ -1,5 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
export function unlink(path: string | URL, callback: (err?: Error) => void) { export function unlink(path: string | URL, callback: (err?: Error) => void) {
if (!callback) throw new Error("No callback function supplied"); if (!callback) throw new Error("No callback function supplied");

View file

@ -1,8 +1,8 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts"; import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
import { fromFileUrl } from "internal:deno_node/path.ts"; import { fromFileUrl } from "ext:deno_node/path.ts";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
function getValidTime( function getValidTime(
time: number | string | Date, time: number | string | Date,

View file

@ -1,14 +1,14 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { basename } from "internal:deno_node/path.ts"; import { basename } from "ext:deno_node/path.ts";
import { EventEmitter } from "internal:deno_node/events.ts"; import { EventEmitter } from "ext:deno_node/events.ts";
import { notImplemented } from "internal:deno_node/_utils.ts"; import { notImplemented } from "ext:deno_node/_utils.ts";
import { promisify } from "internal:deno_node/util.ts"; import { promisify } from "ext:deno_node/util.ts";
import { getValidatedPath } from "internal:deno_node/internal/fs/utils.mjs"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
import { validateFunction } from "internal:deno_node/internal/validators.mjs"; import { validateFunction } from "ext:deno_node/internal/validators.mjs";
import { stat, Stats } from "internal:deno_node/_fs/_fs_stat.ts"; import { stat, Stats } from "ext:deno_node/_fs/_fs_stat.ts";
import { Stats as StatsClass } from "internal:deno_node/internal/fs/utils.mjs"; import { Stats as StatsClass } from "ext:deno_node/internal/fs/utils.mjs";
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { delay } from "internal:deno_node/_util/async.ts"; import { delay } from "ext:deno_node/_util/async.ts";
const statPromisified = promisify(stat); const statPromisified = promisify(stat);
const statAsync = async (filename: string): Promise<Stats | null> => { const statAsync = async (filename: string): Promise<Stats | null> => {

View file

@ -1,10 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d9df51e34526f48bef4e2546a006157b391ad96c/types/node/fs.d.ts // Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d9df51e34526f48bef4e2546a006157b391ad96c/types/node/fs.d.ts
import { import { BufferEncoding, ErrnoException } from "ext:deno_node/_global.d.ts";
BufferEncoding,
ErrnoException,
} from "internal:deno_node/_global.d.ts";
/** /**
* Write `buffer` to the file specified by `fd`. If `buffer` is a normal object, it * Write `buffer` to the file specified by `fd`. If `buffer` is a normal object, it

View file

@ -1,15 +1,15 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { validateEncoding, validateInteger } from "internal:deno_node/internal/validators.mjs"; import { validateEncoding, validateInteger } from "ext:deno_node/internal/validators.mjs";
import { import {
getValidatedFd, getValidatedFd,
showStringCoercionDeprecation, showStringCoercionDeprecation,
validateOffsetLengthWrite, validateOffsetLengthWrite,
validateStringAfterArrayBufferView, validateStringAfterArrayBufferView,
} from "internal:deno_node/internal/fs/utils.mjs"; } from "ext:deno_node/internal/fs/utils.mjs";
import { isArrayBufferView } from "internal:deno_node/internal/util/types.ts"; import { isArrayBufferView } from "ext:deno_node/internal/util/types.ts";
import { maybeCallback } from "internal:deno_node/_fs/_fs_common.ts"; import { maybeCallback } from "ext:deno_node/_fs/_fs_common.ts";
export function writeSync(fd, buffer, offset, length, position) { export function writeSync(fd, buffer, offset, length, position) {
fd = getValidatedFd(fd); fd = getValidatedFd(fd);

View file

@ -1,7 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { Encodings } from "internal:deno_node/_utils.ts"; import { Encodings } from "ext:deno_node/_utils.ts";
import { fromFileUrl } from "internal:deno_node/path.ts"; import { fromFileUrl } from "ext:deno_node/path.ts";
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { import {
CallbackWithError, CallbackWithError,
checkEncoding, checkEncoding,
@ -9,17 +9,17 @@ import {
getOpenOptions, getOpenOptions,
isFileOptions, isFileOptions,
WriteFileOptions, WriteFileOptions,
} from "internal:deno_node/_fs/_fs_common.ts"; } from "ext:deno_node/_fs/_fs_common.ts";
import { isWindows } from "internal:deno_node/_util/os.ts"; import { isWindows } from "ext:deno_node/_util/os.ts";
import { import {
AbortError, AbortError,
denoErrorToNodeError, denoErrorToNodeError,
} from "internal:deno_node/internal/errors.ts"; } from "ext:deno_node/internal/errors.ts";
import { import {
showStringCoercionDeprecation, showStringCoercionDeprecation,
validateStringAfterArrayBufferView, validateStringAfterArrayBufferView,
} from "internal:deno_node/internal/fs/utils.mjs"; } from "ext:deno_node/internal/fs/utils.mjs";
import { promisify } from "internal:deno_node/internal/util.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs";
interface Writer { interface Writer {
write(p: Uint8Array): Promise<number>; write(p: Uint8Array): Promise<number>;

View file

@ -1,7 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d9df51e34526f48bef4e2546a006157b391ad96c/types/node/fs.d.ts // Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d9df51e34526f48bef4e2546a006157b391ad96c/types/node/fs.d.ts
import { ErrnoException } from "internal:deno_node/_global.d.ts"; import { ErrnoException } from "ext:deno_node/_global.d.ts";
/** /**
* Write an array of `ArrayBufferView`s to the file specified by `fd` using`writev()`. * Write an array of `ArrayBufferView`s to the file specified by `fd` using`writev()`.

View file

@ -1,9 +1,9 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { validateBufferArray } from "internal:deno_node/internal/fs/utils.mjs"; import { validateBufferArray } from "ext:deno_node/internal/fs/utils.mjs";
import { getValidatedFd } from "internal:deno_node/internal/fs/utils.mjs"; import { getValidatedFd } from "ext:deno_node/internal/fs/utils.mjs";
import { maybeCallback } from "internal:deno_node/_fs/_fs_common.ts"; import { maybeCallback } from "ext:deno_node/_fs/_fs_common.ts";
export function writev(fd, buffers, position, callback) { export function writev(fd, buffers, position, callback) {
const innerWritev = async (fd, buffers, position) => { const innerWritev = async (fd, buffers, position) => {

View file

@ -1,6 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { EventEmitter } from "internal:deno_node/_events.d.ts"; import { EventEmitter } from "ext:deno_node/_events.d.ts";
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
/** One of: /** One of:
* | "ascii" * | "ascii"

View file

@ -1,23 +1,23 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// Copyright Joyent and Node contributors. All rights reserved. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license.
import * as net from "internal:deno_node/net.ts"; import * as net from "ext:deno_node/net.ts";
import EventEmitter from "internal:deno_node/events.ts"; import EventEmitter from "ext:deno_node/events.ts";
import { debuglog } from "internal:deno_node/internal/util/debuglog.ts"; import { debuglog } from "ext:deno_node/internal/util/debuglog.ts";
let debug = debuglog("http", (fn) => { let debug = debuglog("http", (fn) => {
debug = fn; debug = fn;
}); });
import { AsyncResource } from "internal:deno_node/async_hooks.ts"; import { AsyncResource } from "ext:deno_node/async_hooks.ts";
import { symbols } from "internal:deno_node/internal/async_hooks.ts"; import { symbols } from "ext:deno_node/internal/async_hooks.ts";
// deno-lint-ignore camelcase // deno-lint-ignore camelcase
const { async_id_symbol } = symbols; const { async_id_symbol } = symbols;
import { ERR_OUT_OF_RANGE } from "internal:deno_node/internal/errors.ts"; import { ERR_OUT_OF_RANGE } from "ext:deno_node/internal/errors.ts";
import { once } from "internal:deno_node/internal/util.mjs"; import { once } from "ext:deno_node/internal/util.mjs";
import { import {
validateNumber, validateNumber,
validateOneOf, validateOneOf,
validateString, validateString,
} from "internal:deno_node/internal/validators.mjs"; } from "ext:deno_node/internal/validators.mjs";
const kOnKeylog = Symbol("onkeylog"); const kOnKeylog = Symbol("onkeylog");
const kRequestOptions = Symbol("requestOptions"); const kRequestOptions = Symbol("requestOptions");

View file

@ -1,27 +1,27 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// Copyright Joyent and Node contributors. All rights reserved. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license.
import { getDefaultHighWaterMark } from "internal:deno_node/internal/streams/state.mjs"; import { getDefaultHighWaterMark } from "ext:deno_node/internal/streams/state.mjs";
import assert from "internal:deno_node/internal/assert.mjs"; import assert from "ext:deno_node/internal/assert.mjs";
import EE from "internal:deno_node/events.ts"; import EE from "ext:deno_node/events.ts";
import { Stream } from "internal:deno_node/stream.ts"; import { Stream } from "ext:deno_node/stream.ts";
import { deprecate } from "internal:deno_node/util.ts"; import { deprecate } from "ext:deno_node/util.ts";
import type { Socket } from "internal:deno_node/net.ts"; import type { Socket } from "ext:deno_node/net.ts";
import { import {
kNeedDrain, kNeedDrain,
kOutHeaders, kOutHeaders,
utcDate, utcDate,
} from "internal:deno_node/internal/http.ts"; } from "ext:deno_node/internal/http.ts";
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { import {
_checkInvalidHeaderChar as checkInvalidHeaderChar, _checkInvalidHeaderChar as checkInvalidHeaderChar,
_checkIsHttpToken as checkIsHttpToken, _checkIsHttpToken as checkIsHttpToken,
chunkExpression as RE_TE_CHUNKED, chunkExpression as RE_TE_CHUNKED,
} from "internal:deno_node/_http_common.ts"; } from "ext:deno_node/_http_common.ts";
import { import {
defaultTriggerAsyncIdScope, defaultTriggerAsyncIdScope,
symbols, symbols,
} from "internal:deno_node/internal/async_hooks.ts"; } from "ext:deno_node/internal/async_hooks.ts";
// deno-lint-ignore camelcase // deno-lint-ignore camelcase
const { async_id_symbol } = symbols; const { async_id_symbol } = symbols;
import { import {
@ -39,11 +39,11 @@ import {
ERR_STREAM_NULL_VALUES, ERR_STREAM_NULL_VALUES,
ERR_STREAM_WRITE_AFTER_END, ERR_STREAM_WRITE_AFTER_END,
hideStackFrames, hideStackFrames,
} from "internal:deno_node/internal/errors.ts"; } from "ext:deno_node/internal/errors.ts";
import { validateString } from "internal:deno_node/internal/validators.mjs"; import { validateString } from "ext:deno_node/internal/validators.mjs";
import { isUint8Array } from "internal:deno_node/internal/util/types.ts"; import { isUint8Array } from "ext:deno_node/internal/util/types.ts";
import { debuglog } from "internal:deno_node/internal/util/debuglog.ts"; import { debuglog } from "ext:deno_node/internal/util/debuglog.ts";
let debug = debuglog("http", (fn) => { let debug = debuglog("http", (fn) => {
debug = fn; debug = fn;
}); });

View file

@ -1,10 +1,10 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// Copyright Joyent, Inc. and other Node contributors. // Copyright Joyent, Inc. and other Node contributors.
import { core } from "internal:deno_node/_core.ts"; import { core } from "ext:deno_node/_core.ts";
import { validateFunction } from "internal:deno_node/internal/validators.mjs"; import { validateFunction } from "ext:deno_node/internal/validators.mjs";
import { _exiting } from "internal:deno_node/_process/exiting.ts"; import { _exiting } from "ext:deno_node/_process/exiting.ts";
import { FixedQueue } from "internal:deno_node/internal/fixed_queue.ts"; import { FixedQueue } from "ext:deno_node/internal/fixed_queue.ts";
interface Tock { interface Tock {
callback: (...args: Array<unknown>) => void; callback: (...args: Array<unknown>) => void;

View file

@ -21,7 +21,7 @@
// deno-lint-ignore-file // deno-lint-ignore-file
import { TextDecoder, TextEncoder } from "internal:deno_web/08_text_encoding.js"; import { TextDecoder, TextEncoder } from "ext:deno_web/08_text_encoding.js";
/* eslint-disable space-unary-ops */ /* eslint-disable space-unary-ops */
@ -418,7 +418,7 @@ const gen_bitlen = (s, desc) => // deflate_state *s;
/* Now recompute all bit lengths, scanning in increasing frequency. /* Now recompute all bit lengths, scanning in increasing frequency.
* h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
* lengths instead of fixing only the wrong ones. This idea is taken * lengths instead of fixing only the wrong ones. This idea is taken
* from "internal:deno_node/ar" written by Haruhiko Okumura.) * from "ext:deno_node/ar" written by Haruhiko Okumura.)
*/ */
for (bits = max_length; bits !== 0; bits--) { for (bits = max_length; bits !== 0; bits--) {
n = s.bl_count[bits]; n = s.bl_count[bits];

View file

@ -5,9 +5,9 @@
// They have to be split this way to prevent a circular dependency // They have to be split this way to prevent a circular dependency
const core = globalThis.Deno.core; const core = globalThis.Deno.core;
import { nextTick as _nextTick } from "internal:deno_node/_next_tick.ts"; import { nextTick as _nextTick } from "ext:deno_node/_next_tick.ts";
import { _exiting } from "internal:deno_node/_process/exiting.ts"; import { _exiting } from "ext:deno_node/_process/exiting.ts";
import * as fs from "internal:deno_fs/30_fs.js"; import * as fs from "ext:deno_fs/30_fs.js";
/** Returns the operating system CPU architecture for which the Deno binary was compiled */ /** Returns the operating system CPU architecture for which the Deno binary was compiled */
export function arch(): string { export function arch(): string {

View file

@ -1,17 +1,17 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license. // Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
import { Buffer } from "internal:deno_node/buffer.ts"; import { Buffer } from "ext:deno_node/buffer.ts";
import { import {
clearLine, clearLine,
clearScreenDown, clearScreenDown,
cursorTo, cursorTo,
moveCursor, moveCursor,
} from "internal:deno_node/internal/readline/callbacks.mjs"; } from "ext:deno_node/internal/readline/callbacks.mjs";
import { Duplex, Readable, Writable } from "internal:deno_node/stream.ts"; import { Duplex, Readable, Writable } from "ext:deno_node/stream.ts";
import { isWindows } from "internal:deno_node/_util/os.ts"; import { isWindows } from "ext:deno_node/_util/os.ts";
import { fs as fsConstants } from "internal:deno_node/internal_binding/constants.ts"; import { fs as fsConstants } from "ext:deno_node/internal_binding/constants.ts";
import * as io from "internal:deno_io/12_io.js"; import * as io from "ext:deno_io/12_io.js";
// https://github.com/nodejs/node/blob/00738314828074243c9a52a228ab4c68b04259ef/lib/internal/bootstrap/switches/is_main_thread.js#L41 // https://github.com/nodejs/node/blob/00738314828074243c9a52a228ab4c68b04259ef/lib/internal/bootstrap/switches/is_main_thread.js#L41
export function createWritableStdioStream(writer, name) { export function createWritableStdioStream(writer, name) {

Some files were not shown because too many files have changed in this diff Show more