mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 16:19:12 -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:
parent
d24c6ea27f
commit
72fe9bb470
293 changed files with 1509 additions and 1632 deletions
|
@ -10,9 +10,9 @@ use crate::profiling::is_profiling;
|
|||
pub fn create_js_runtime(setup: impl FnOnce() -> Vec<Extension>) -> JsRuntime {
|
||||
JsRuntime::new(RuntimeOptions {
|
||||
extensions_with_js: setup(),
|
||||
module_loader: Some(std::rc::Rc::new(
|
||||
deno_core::InternalModuleLoader::default(),
|
||||
)),
|
||||
module_loader: Some(
|
||||
std::rc::Rc::new(deno_core::ExtModuleLoader::default()),
|
||||
),
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
const core = globalThis.Deno.core;
|
||||
const ops = core.ops;
|
||||
const internals = globalThis.__bootstrap.internals;
|
||||
import { setExitHandler } from "internal:runtime/30_os.js";
|
||||
import { Console } from "internal:deno_console/02_console.js";
|
||||
import { serializePermissions } from "internal:runtime/10_permissions.js";
|
||||
import { assert } from "internal:deno_web/00_infra.js";
|
||||
import { setExitHandler } from "ext:runtime/30_os.js";
|
||||
import { Console } from "ext:deno_console/02_console.js";
|
||||
import { serializePermissions } from "ext:runtime/10_permissions.js";
|
||||
import { assert } from "ext:deno_web/00_infra.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const {
|
||||
ArrayFrom,
|
||||
|
@ -1424,6 +1424,6 @@ internals.testing = {
|
|||
enableBench,
|
||||
};
|
||||
|
||||
import { denoNs } from "internal:runtime/90_deno_ns.js";
|
||||
import { denoNs } from "ext:runtime/90_deno_ns.js";
|
||||
denoNs.bench = bench;
|
||||
denoNs.test = test;
|
||||
|
|
|
@ -4048,14 +4048,14 @@ itest!(node_prefix_missing {
|
|||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(internal_import {
|
||||
args: "run run/internal_import.ts",
|
||||
output: "run/internal_import.ts.out",
|
||||
itest!(extension_import {
|
||||
args: "run run/extension_import.ts",
|
||||
output: "run/extension_import.ts.out",
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(internal_dynamic_import {
|
||||
args: "run run/internal_dynamic_import.ts",
|
||||
output: "run/internal_dynamic_import.ts.out",
|
||||
itest!(extension_dynamic_import {
|
||||
args: "run run/extension_dynamic_import.ts",
|
||||
output: "run/extension_dynamic_import.ts.out",
|
||||
exit_code: 1,
|
||||
});
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
new Event();
|
||||
^
|
||||
at [WILDCARD]
|
||||
at new Event (internal:deno_web/[WILDCARD])
|
||||
at new Event (ext:deno_web/[WILDCARD])
|
||||
at [WILDCARD]
|
||||
|
|
1
cli/tests/testdata/run/extension_dynamic_import.ts
vendored
Normal file
1
cli/tests/testdata/run/extension_dynamic_import.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
await import("ext:runtime/01_errors.js");
|
4
cli/tests/testdata/run/extension_dynamic_import.ts.out
vendored
Normal file
4
cli/tests/testdata/run/extension_dynamic_import.ts.out
vendored
Normal 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
|
1
cli/tests/testdata/run/extension_import.ts
vendored
Normal file
1
cli/tests/testdata/run/extension_import.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
import "ext:runtime/01_errors.js";
|
8
cli/tests/testdata/run/extension_import.ts.out
vendored
Normal file
8
cli/tests/testdata/run/extension_import.ts.out
vendored
Normal 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]
|
|
@ -1,5 +1,5 @@
|
|||
error: Uncaught (in promise) TypeError: error sending request for url[WILDCARD]
|
||||
await fetch("https://nonexistent.deno.land/");
|
||||
^[WILDCARD]
|
||||
at async fetch (internal:[WILDCARD])
|
||||
at async fetch (ext:[WILDCARD])
|
||||
at async file:///[WILDCARD]/fetch_async_error_stack.ts:1:1
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
await import("internal:runtime/01_errors.js");
|
|
@ -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
|
1
cli/tests/testdata/run/internal_import.ts
vendored
1
cli/tests/testdata/run/internal_import.ts
vendored
|
@ -1 +0,0 @@
|
|||
import "internal:runtime/01_errors.js";
|
|
@ -1,8 +0,0 @@
|
|||
error: Unsupported scheme "internal" for module "internal:runtime/01_errors.js". Supported schemes: [
|
||||
"data",
|
||||
"blob",
|
||||
"file",
|
||||
"http",
|
||||
"https",
|
||||
]
|
||||
at [WILDCARD]
|
|
@ -3,4 +3,4 @@ error: Uncaught Error: foo
|
|||
throw new Error("foo");
|
||||
^
|
||||
at [WILDCARD]/queue_microtask_error.ts:2:9
|
||||
at internal:core/[WILDCARD]
|
||||
at ext:core/[WILDCARD]
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
colno: 9,
|
||||
error: Error: foo
|
||||
at [WILDCARD]/queue_microtask_error_handled.ts:18:9
|
||||
at internal:core/[WILDCARD]
|
||||
at ext:core/[WILDCARD]
|
||||
}
|
||||
onerror() called Error: foo
|
||||
at [WILDCARD]/queue_microtask_error_handled.ts:18:9
|
||||
at internal:core/[WILDCARD]
|
||||
at ext:core/[WILDCARD]
|
||||
2
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
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])
|
||||
|
|
|
@ -2,7 +2,7 @@ error: Uncaught (in worker "") Error
|
|||
throw new Error();
|
||||
^
|
||||
at [WILDCARD]/workers/drop_handle_race.js:2:9
|
||||
at Object.action (internal:deno_web/02_timers.js:[WILDCARD])
|
||||
at handleTimerMacrotask (internal:deno_web/02_timers.js:[WILDCARD])
|
||||
at Object.action (ext: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.
|
||||
at Worker.#pollControl (internal:runtime/11_workers.js:[WILDCARD])
|
||||
at Worker.#pollControl (ext:runtime/11_workers.js:[WILDCARD])
|
||||
|
|
|
@ -37,13 +37,13 @@ failing step in failing test ... FAILED ([WILDCARD])
|
|||
|
||||
nested failure => ./test/steps/failing_steps.ts:[WILDCARD]
|
||||
error: Error: 1 test step failed.
|
||||
at runTest (internal:cli/40_testing.js:[WILDCARD])
|
||||
at async runTests (internal:cli/40_testing.js:[WILDCARD])
|
||||
at runTest (ext:cli/40_testing.js:[WILDCARD])
|
||||
at async runTests (ext:cli/40_testing.js:[WILDCARD])
|
||||
|
||||
multiple test step failures => ./test/steps/failing_steps.ts:[WILDCARD]
|
||||
error: Error: 2 test steps failed.
|
||||
at runTest (internal:cli/40_testing.js:[WILDCARD])
|
||||
at async runTests (internal:cli/40_testing.js:[WILDCARD])
|
||||
at runTest (ext: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]
|
||||
error: Error: Fail test.
|
||||
|
|
|
@ -16,8 +16,8 @@ Deno.test(async function sendAsyncStackTrace() {
|
|||
assertStringIncludes(s, "opcall_test.ts");
|
||||
assertStringIncludes(s, "read");
|
||||
assert(
|
||||
!s.includes("internal:core"),
|
||||
"opcall stack traces should NOT include internal:core internals such as unwrapOpResult",
|
||||
!s.includes("ext:core"),
|
||||
"opcall stack traces should NOT include ext:core internals such as unwrapOpResult",
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -594,7 +594,7 @@ fn filter_coverages(
|
|||
coverages
|
||||
.into_iter()
|
||||
.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("$deno$test.js")
|
||||
|| e.url.ends_with(".snap");
|
||||
|
|
|
@ -655,8 +655,7 @@ fn abbreviate_test_error(js_error: &JsError) -> JsError {
|
|||
// check if there are any stack frames coming from user code
|
||||
let should_filter = frames.iter().any(|f| {
|
||||
if let Some(file_name) = &f.file_name {
|
||||
!(file_name.starts_with("[internal:")
|
||||
|| file_name.starts_with("internal:"))
|
||||
!(file_name.starts_with("[ext:") || file_name.starts_with("ext:"))
|
||||
} else {
|
||||
true
|
||||
}
|
||||
|
@ -668,8 +667,7 @@ fn abbreviate_test_error(js_error: &JsError) -> JsError {
|
|||
.rev()
|
||||
.skip_while(|f| {
|
||||
if let Some(file_name) = &f.file_name {
|
||||
file_name.starts_with("[internal:")
|
||||
|| file_name.starts_with("internal:")
|
||||
file_name.starts_with("[ext:") || file_name.starts_with("ext:")
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
|
@ -281,11 +281,11 @@ pub fn host_import_module_dynamically_callback<'s>(
|
|||
.unwrap()
|
||||
.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 promise = resolver.get_promise(scope);
|
||||
|
||||
if !is_internal_module {
|
||||
if !is_ext_module {
|
||||
let assertions = parse_import_assertions(
|
||||
scope,
|
||||
import_assertions,
|
||||
|
@ -333,10 +333,10 @@ pub fn host_import_module_dynamically_callback<'s>(
|
|||
|
||||
let promise = promise.catch(scope, map_err).unwrap();
|
||||
|
||||
if is_internal_module {
|
||||
if is_ext_module {
|
||||
let message = v8::String::new_external_onebyte_static(
|
||||
scope,
|
||||
b"Cannot load internal module from external code",
|
||||
b"Cannot load extension module from external code",
|
||||
)
|
||||
.unwrap();
|
||||
let exception = v8::Exception::type_error(scope, message);
|
||||
|
|
|
@ -272,7 +272,7 @@ impl JsError {
|
|||
if let (Some(file_name), Some(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(
|
||||
file_name,
|
||||
line_number,
|
||||
|
@ -424,7 +424,7 @@ impl JsError {
|
|||
if let (Some(file_name), Some(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(
|
||||
file_name,
|
||||
line_number,
|
||||
|
@ -438,7 +438,7 @@ impl JsError {
|
|||
}
|
||||
} else if let Some(frame) = frames.first() {
|
||||
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
|
||||
.get_source_line(scope)
|
||||
.map(|v| v.to_rust_string_lossy(scope));
|
||||
|
|
|
@ -209,7 +209,7 @@ impl ExtensionBuilder {
|
|||
// use a different result struct that `ExtensionFileSource` as it's confusing
|
||||
// when (and why) the remapping happens.
|
||||
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,
|
||||
});
|
||||
self.js.extend(js_files);
|
||||
|
@ -223,7 +223,7 @@ impl ExtensionBuilder {
|
|||
// use a different result struct that `ExtensionFileSource` as it's confusing
|
||||
// when (and why) the remapping happens.
|
||||
.map(|file_source| ExtensionFileSource {
|
||||
specifier: format!("internal:{}/{}", self.name, file_source.specifier),
|
||||
specifier: format!("ext:{}/{}", self.name, file_source.specifier),
|
||||
code: file_source.code,
|
||||
});
|
||||
self.esm.extend(esm_files);
|
||||
|
@ -287,7 +287,7 @@ impl ExtensionBuilder {
|
|||
|
||||
/// Helps embed JS files in an extension. Returns a vector of
|
||||
/// `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
|
||||
/// directory name.
|
||||
|
@ -299,8 +299,8 @@ impl ExtensionBuilder {
|
|||
/// "02_goodbye.js",
|
||||
/// )
|
||||
/// // Produces following specifiers:
|
||||
/// - "internal:my_extension/01_hello.js"
|
||||
/// - "internal:my_extension/02_goodbye.js"
|
||||
/// - "ext:my_extension/01_hello.js"
|
||||
/// - "ext:my_extension/02_goodbye.js"
|
||||
///
|
||||
/// /// Example with "dir" option (for "my_extension"):
|
||||
/// ```ignore
|
||||
|
@ -310,8 +310,8 @@ impl ExtensionBuilder {
|
|||
/// "02_goodbye.js",
|
||||
/// )
|
||||
/// // Produces following specifiers:
|
||||
/// - "internal:my_extension/js/01_hello.js"
|
||||
/// - "internal:my_extension/js/02_goodbye.js"
|
||||
/// - "ext:my_extension/js/01_hello.js"
|
||||
/// - "ext:my_extension/js/02_goodbye.js"
|
||||
/// ```
|
||||
#[cfg(not(feature = "include_js_files_for_snapshotting"))]
|
||||
#[macro_export]
|
||||
|
|
13
core/lib.rs
13
core/lib.rs
|
@ -75,9 +75,9 @@ pub use crate::module_specifier::resolve_url_or_path;
|
|||
pub use crate::module_specifier::ModuleResolutionError;
|
||||
pub use crate::module_specifier::ModuleSpecifier;
|
||||
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::InternalModuleLoader;
|
||||
pub use crate::modules::InternalModuleLoaderCb;
|
||||
pub use crate::modules::ModuleId;
|
||||
pub use crate::modules::ModuleLoader;
|
||||
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
|
||||
/// 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_rules! located_script_name {
|
||||
() => {
|
||||
format!(
|
||||
"[internal:{}:{}:{}]",
|
||||
std::file!(),
|
||||
std::line!(),
|
||||
std::column!()
|
||||
);
|
||||
format!("[ext:{}:{}:{}]", std::file!(), std::line!(), std::column!());
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ impl ModuleLoader for NoopModuleLoader {
|
|||
}
|
||||
|
||||
/// 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
|
||||
pub(crate) fn resolve_helper(
|
||||
snapshot_loaded_and_not_snapshotting: bool,
|
||||
|
@ -310,29 +310,28 @@ pub(crate) fn resolve_helper(
|
|||
referrer: &str,
|
||||
kind: ResolutionKind,
|
||||
) -> 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(
|
||||
"Cannot load internal module from external code",
|
||||
"Cannot load extension module from external code",
|
||||
));
|
||||
}
|
||||
|
||||
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.
|
||||
pub type InternalModuleLoaderCb =
|
||||
pub type ExtModuleLoaderCb =
|
||||
Box<dyn Fn(&ExtensionFileSource) -> Result<String, Error>>;
|
||||
|
||||
pub struct InternalModuleLoader {
|
||||
pub struct ExtModuleLoader {
|
||||
module_loader: Rc<dyn ModuleLoader>,
|
||||
esm_sources: Vec<ExtensionFileSource>,
|
||||
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 {
|
||||
Self {
|
||||
module_loader: Rc::new(NoopModuleLoader),
|
||||
|
@ -343,18 +342,18 @@ impl Default for InternalModuleLoader {
|
|||
}
|
||||
}
|
||||
|
||||
impl InternalModuleLoader {
|
||||
impl ExtModuleLoader {
|
||||
pub fn new(
|
||||
module_loader: Option<Rc<dyn ModuleLoader>>,
|
||||
esm_sources: Vec<ExtensionFileSource>,
|
||||
maybe_load_callback: Option<InternalModuleLoaderCb>,
|
||||
maybe_load_callback: Option<ExtModuleLoaderCb>,
|
||||
) -> Self {
|
||||
let used_esm_sources: HashMap<String, bool> = esm_sources
|
||||
.iter()
|
||||
.map(|file_source| (file_source.specifier.to_string(), false))
|
||||
.collect();
|
||||
|
||||
InternalModuleLoader {
|
||||
ExtModuleLoader {
|
||||
module_loader: module_loader.unwrap_or_else(|| Rc::new(NoopModuleLoader)),
|
||||
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) {
|
||||
let used_esm_sources = self.used_esm_sources.get_mut();
|
||||
let unused_modules: Vec<_> = used_esm_sources
|
||||
|
@ -374,8 +373,8 @@ impl Drop for InternalModuleLoader {
|
|||
|
||||
if !unused_modules.is_empty() {
|
||||
let mut msg =
|
||||
"Following modules were passed to InternalModuleLoader but never used:\n"
|
||||
.to_string();
|
||||
"Following modules were passed to ExtModuleLoader but never used:\n"
|
||||
.to_string();
|
||||
for m in unused_modules {
|
||||
msg.push_str(" - ");
|
||||
msg.push_str(m);
|
||||
|
@ -386,7 +385,7 @@ impl Drop for InternalModuleLoader {
|
|||
}
|
||||
}
|
||||
|
||||
impl ModuleLoader for InternalModuleLoader {
|
||||
impl ModuleLoader for ExtModuleLoader {
|
||||
fn resolve(
|
||||
&self,
|
||||
specifier: &str,
|
||||
|
@ -394,14 +393,13 @@ impl ModuleLoader for InternalModuleLoader {
|
|||
kind: ResolutionKind,
|
||||
) -> Result<ModuleSpecifier, Error> {
|
||||
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();
|
||||
if referrer == "." || referrer_specifier.unwrap().scheme() == "internal"
|
||||
{
|
||||
if referrer == "." || referrer_specifier.unwrap().scheme() == "ext" {
|
||||
return Ok(url_specifier);
|
||||
} else {
|
||||
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>,
|
||||
is_dyn_import: bool,
|
||||
) -> Pin<Box<ModuleSourceFuture>> {
|
||||
if module_specifier.scheme() != "internal" {
|
||||
if module_specifier.scheme() != "ext" {
|
||||
return self.module_loader.load(
|
||||
module_specifier,
|
||||
maybe_referrer,
|
||||
|
@ -461,7 +459,7 @@ impl ModuleLoader for InternalModuleLoader {
|
|||
|
||||
async move {
|
||||
Err(generic_error(format!(
|
||||
"Cannot find internal module source for specifier {specifier}"
|
||||
"Cannot find extension module source for specifier {specifier}"
|
||||
)))
|
||||
}
|
||||
.boxed_local()
|
||||
|
@ -474,7 +472,7 @@ impl ModuleLoader for InternalModuleLoader {
|
|||
maybe_referrer: Option<String>,
|
||||
is_dyn_import: bool,
|
||||
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
|
||||
if module_specifier.scheme() == "internal" {
|
||||
if module_specifier.scheme() == "ext" {
|
||||
return async { Ok(()) }.boxed_local();
|
||||
}
|
||||
|
||||
|
@ -2911,17 +2909,17 @@ if (import.meta.url != 'file:///main_with_code.js') throw Error();
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn internal_module_loader() {
|
||||
let loader = InternalModuleLoader::default();
|
||||
fn ext_module_loader() {
|
||||
let loader = ExtModuleLoader::default();
|
||||
assert!(loader
|
||||
.resolve("internal:foo", "internal:bar", ResolutionKind::Import)
|
||||
.resolve("ext:foo", "ext:bar", ResolutionKind::Import)
|
||||
.is_ok());
|
||||
assert_eq!(
|
||||
loader
|
||||
.resolve("internal:foo", "file://bar", ResolutionKind::Import)
|
||||
.resolve("ext:foo", "file://bar", ResolutionKind::Import)
|
||||
.err()
|
||||
.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!(
|
||||
loader
|
||||
|
@ -2935,11 +2933,11 @@ if (import.meta.url != 'file:///main_with_code.js') throw Error();
|
|||
);
|
||||
assert_eq!(
|
||||
loader
|
||||
.resolve("file://foo", "internal:bar", ResolutionKind::Import)
|
||||
.resolve("file://foo", "ext:bar", ResolutionKind::Import)
|
||||
.err()
|
||||
.map(|e| e.to_string()),
|
||||
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()
|
||||
)
|
||||
);
|
||||
|
@ -2947,13 +2945,13 @@ if (import.meta.url != 'file:///main_with_code.js') throw Error();
|
|||
resolve_helper(
|
||||
true,
|
||||
Rc::new(loader),
|
||||
"internal:core.js",
|
||||
"ext:core.js",
|
||||
"file://bar",
|
||||
ResolutionKind::Import,
|
||||
)
|
||||
.err()
|
||||
.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())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::extensions::OpDecl;
|
|||
use crate::extensions::OpEventLoopFn;
|
||||
use crate::inspector::JsRuntimeInspector;
|
||||
use crate::module_specifier::ModuleSpecifier;
|
||||
use crate::modules::InternalModuleLoaderCb;
|
||||
use crate::modules::ExtModuleLoaderCb;
|
||||
use crate::modules::ModuleError;
|
||||
use crate::modules::ModuleId;
|
||||
use crate::modules::ModuleLoadId;
|
||||
|
@ -275,7 +275,7 @@ pub struct RuntimeOptions {
|
|||
/// 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
|
||||
/// 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.
|
||||
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,
|
||||
esm_sources,
|
||||
options.snapshot_module_load_cb,
|
||||
|
@ -3984,8 +3984,8 @@ assertEquals(1, notify_return_value);
|
|||
)
|
||||
.unwrap_err();
|
||||
let error_string = error.to_string();
|
||||
// Test that the script specifier is a URL: `internal:<repo-relative path>`.
|
||||
assert!(error_string.contains("internal:core/01_core.js"));
|
||||
// Test that the script specifier is a URL: `ext:<repo-relative path>`.
|
||||
assert!(error_string.contains("ext:core/01_core.js"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -5018,8 +5018,8 @@ Deno.core.opAsync("op_async_serialize_object_with_numbers_as_keys", {
|
|||
) -> Pin<Box<ModuleSourceFuture>> {
|
||||
let source = r#"
|
||||
// This module doesn't really exist, just verifying that we'll get
|
||||
// an error when specifier starts with "internal:".
|
||||
import { core } from "internal:core.js";
|
||||
// an error when specifier starts with "ext:".
|
||||
import { core } from "ext:core.js";
|
||||
"#;
|
||||
|
||||
async move {
|
||||
|
@ -5055,7 +5055,7 @@ Deno.core.opAsync("op_async_serialize_object_with_numbers_as_keys", {
|
|||
.unwrap_err();
|
||||
assert_eq!(
|
||||
err.to_string(),
|
||||
"Cannot load internal module from external code"
|
||||
"Cannot load extension module from external code"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ use std::path::Path;
|
|||
use std::path::PathBuf;
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::ExtModuleLoaderCb;
|
||||
use crate::Extension;
|
||||
use crate::InternalModuleLoaderCb;
|
||||
use crate::JsRuntime;
|
||||
use crate::RuntimeOptions;
|
||||
use crate::Snapshot;
|
||||
|
@ -19,7 +19,7 @@ pub struct CreateSnapshotOptions {
|
|||
pub extensions: Vec<Extension>,
|
||||
pub extensions_with_js: Vec<Extension>,
|
||||
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) {
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
const core = globalThis.Deno.core;
|
||||
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 {
|
||||
defineEventHandler,
|
||||
EventTarget,
|
||||
setTarget,
|
||||
} from "internal:deno_web/02_event.js";
|
||||
import DOMException from "internal:deno_web/01_dom_exception.js";
|
||||
} from "ext:deno_web/02_event.js";
|
||||
import DOMException from "ext:deno_web/01_dom_exception.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const {
|
||||
ArrayPrototypeIndexOf,
|
||||
|
|
12
ext/cache/01_cache.js
vendored
12
ext/cache/01_cache.js
vendored
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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 {
|
||||
Symbol,
|
||||
|
@ -12,11 +12,11 @@ import {
|
|||
Request,
|
||||
RequestPrototype,
|
||||
toInnerRequest,
|
||||
} from "internal:deno_fetch/23_request.js";
|
||||
import { toInnerResponse } from "internal:deno_fetch/23_response.js";
|
||||
import { URLPrototype } from "internal:deno_url/00_url.js";
|
||||
import { getHeader } from "internal:deno_fetch/20_headers.js";
|
||||
import { readableStreamForRid } from "internal:deno_web/06_streams.js";
|
||||
} from "ext:deno_fetch/23_request.js";
|
||||
import { toInnerResponse } from "ext:deno_fetch/23_response.js";
|
||||
import { URLPrototype } from "ext:deno_url/00_url.js";
|
||||
import { getHeader } from "ext:deno_fetch/20_headers.js";
|
||||
import { readableStreamForRid } from "ext:deno_web/06_streams.js";
|
||||
|
||||
class CacheStorage {
|
||||
constructor() {
|
||||
|
|
|
@ -118,7 +118,7 @@ const {
|
|||
WeakMapPrototype,
|
||||
WeakSetPrototype,
|
||||
} = primordials;
|
||||
import * as colors from "internal:deno_console/01_colors.js";
|
||||
import * as colors from "ext:deno_console/01_colors.js";
|
||||
|
||||
function isInvalidDate(x) {
|
||||
return isNaN(DatePrototypeGetTime(x));
|
||||
|
|
2
ext/console/internal.d.ts
vendored
2
ext/console/internal.d.ts
vendored
|
@ -3,7 +3,7 @@
|
|||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="esnext" />
|
||||
|
||||
declare module "internal:deno_console/02_console.js" {
|
||||
declare module "ext:deno_console/02_console.js" {
|
||||
function createFilteredInspectProxy<TObject>(params: {
|
||||
object: TObject;
|
||||
keys: (keyof TObject)[];
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
const core = globalThis.Deno.core;
|
||||
const ops = core.ops;
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
import * as webidl from "internal:deno_webidl/00_webidl.js";
|
||||
import DOMException from "internal:deno_web/01_dom_exception.js";
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import DOMException from "ext:deno_web/01_dom_exception.js";
|
||||
const {
|
||||
ArrayBufferPrototype,
|
||||
ArrayBufferIsView,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
/// <reference path="../webidl/internal.d.ts" />
|
||||
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
import * as webidl from "internal:deno_webidl/00_webidl.js";
|
||||
import { CryptoKey } from "internal:deno_crypto/00_crypto.js";
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import { CryptoKey } from "ext:deno_crypto/00_crypto.js";
|
||||
const {
|
||||
ArrayBufferIsView,
|
||||
ArrayBufferPrototype,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
/// <reference path="./lib.deno_fetch.d.ts" />
|
||||
/// <reference lib="esnext" />
|
||||
|
||||
import * as webidl from "internal:deno_webidl/00_webidl.js";
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import {
|
||||
byteLowerCase,
|
||||
collectHttpQuotedString,
|
||||
|
@ -18,7 +18,7 @@ import {
|
|||
HTTP_TAB_OR_SPACE_SUFFIX_RE,
|
||||
HTTP_TOKEN_CODE_POINT_RE,
|
||||
httpTrim,
|
||||
} from "internal:deno_web/00_infra.js";
|
||||
} from "ext:deno_web/00_infra.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const {
|
||||
ArrayIsArray,
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
/// <reference lib="esnext" />
|
||||
|
||||
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 {
|
||||
Blob,
|
||||
BlobPrototype,
|
||||
File,
|
||||
FilePrototype,
|
||||
} from "internal:deno_web/09_file.js";
|
||||
} from "ext:deno_web/09_file.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const {
|
||||
ArrayPrototypePush,
|
||||
|
|
|
@ -12,19 +12,19 @@
|
|||
/// <reference lib="esnext" />
|
||||
|
||||
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 {
|
||||
parseUrlEncoded,
|
||||
URLSearchParamsPrototype,
|
||||
} from "internal:deno_url/00_url.js";
|
||||
} from "ext:deno_url/00_url.js";
|
||||
import {
|
||||
formDataFromEntries,
|
||||
FormDataPrototype,
|
||||
formDataToBlob,
|
||||
parseFormData,
|
||||
} from "internal:deno_fetch/21_formdata.js";
|
||||
import * as mimesniff from "internal:deno_web/01_mimesniff.js";
|
||||
import { BlobPrototype } from "internal:deno_web/09_file.js";
|
||||
} from "ext:deno_fetch/21_formdata.js";
|
||||
import * as mimesniff from "ext:deno_web/01_mimesniff.js";
|
||||
import { BlobPrototype } from "ext:deno_web/09_file.js";
|
||||
import {
|
||||
createProxy,
|
||||
errorReadableStream,
|
||||
|
@ -34,7 +34,7 @@ import {
|
|||
readableStreamDisturb,
|
||||
ReadableStreamPrototype,
|
||||
readableStreamThrowIfErrored,
|
||||
} from "internal:deno_web/06_streams.js";
|
||||
} from "ext:deno_web/06_streams.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const {
|
||||
ArrayBufferPrototype,
|
||||
|
|
|
@ -9,30 +9,26 @@
|
|||
/// <reference path="./lib.deno_fetch.d.ts" />
|
||||
/// <reference lib="esnext" />
|
||||
|
||||
import * as webidl from "internal:deno_webidl/00_webidl.js";
|
||||
import { createFilteredInspectProxy } from "internal:deno_console/02_console.js";
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import { createFilteredInspectProxy } from "ext:deno_console/02_console.js";
|
||||
import {
|
||||
byteUpperCase,
|
||||
HTTP_TOKEN_CODE_POINT_RE,
|
||||
} from "internal:deno_web/00_infra.js";
|
||||
import { URL } from "internal:deno_url/00_url.js";
|
||||
import {
|
||||
extractBody,
|
||||
InnerBody,
|
||||
mixinBody,
|
||||
} 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";
|
||||
} from "ext:deno_web/00_infra.js";
|
||||
import { URL } from "ext:deno_url/00_url.js";
|
||||
import { extractBody, InnerBody, mixinBody } from "ext:deno_fetch/22_body.js";
|
||||
import { getLocationHref } from "ext:deno_web/12_location.js";
|
||||
import { extractMimeType } from "ext:deno_web/01_mimesniff.js";
|
||||
import { blobFromObjectUrl } from "ext:deno_web/09_file.js";
|
||||
import {
|
||||
fillHeaders,
|
||||
getDecodeSplitHeader,
|
||||
guardFromHeaders,
|
||||
headerListFromHeaders,
|
||||
headersFromHeaderList,
|
||||
} from "internal:deno_fetch/20_headers.js";
|
||||
import { HttpClientPrototype } from "internal:deno_fetch/22_http_client.js";
|
||||
import * as abortSignal from "internal:deno_web/03_abort_signal.js";
|
||||
} from "ext:deno_fetch/20_headers.js";
|
||||
import { HttpClientPrototype } from "ext:deno_fetch/22_http_client.js";
|
||||
import * as abortSignal from "ext:deno_web/03_abort_signal.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const {
|
||||
ArrayPrototypeMap,
|
||||
|
|
|
@ -11,25 +11,25 @@
|
|||
/// <reference lib="esnext" />
|
||||
|
||||
const core = globalThis.Deno.core;
|
||||
import * as webidl from "internal:deno_webidl/00_webidl.js";
|
||||
import { createFilteredInspectProxy } from "internal:deno_console/02_console.js";
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import { createFilteredInspectProxy } from "ext:deno_console/02_console.js";
|
||||
import {
|
||||
byteLowerCase,
|
||||
HTTP_TAB_OR_SPACE,
|
||||
regexMatcher,
|
||||
serializeJSValueToJSONString,
|
||||
} from "internal:deno_web/00_infra.js";
|
||||
import { extractBody, mixinBody } 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 { URL } from "internal:deno_url/00_url.js";
|
||||
} from "ext:deno_web/00_infra.js";
|
||||
import { extractBody, mixinBody } from "ext:deno_fetch/22_body.js";
|
||||
import { getLocationHref } from "ext:deno_web/12_location.js";
|
||||
import { extractMimeType } from "ext:deno_web/01_mimesniff.js";
|
||||
import { URL } from "ext:deno_url/00_url.js";
|
||||
import {
|
||||
fillHeaders,
|
||||
getDecodeSplitHeader,
|
||||
guardFromHeaders,
|
||||
headerListFromHeaders,
|
||||
headersFromHeaderList,
|
||||
} from "internal:deno_fetch/20_headers.js";
|
||||
} from "ext:deno_fetch/20_headers.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const {
|
||||
ArrayPrototypeMap,
|
||||
|
|
|
@ -12,19 +12,16 @@
|
|||
|
||||
const core = globalThis.Deno.core;
|
||||
const ops = core.ops;
|
||||
import * as webidl from "internal:deno_webidl/00_webidl.js";
|
||||
import { byteLowerCase } from "internal:deno_web/00_infra.js";
|
||||
import { BlobPrototype } from "internal:deno_web/09_file.js";
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import { byteLowerCase } from "ext:deno_web/00_infra.js";
|
||||
import { BlobPrototype } from "ext:deno_web/09_file.js";
|
||||
import {
|
||||
errorReadableStream,
|
||||
readableStreamForRid,
|
||||
ReadableStreamPrototype,
|
||||
} from "internal:deno_web/06_streams.js";
|
||||
import { extractBody, InnerBody } from "internal:deno_fetch/22_body.js";
|
||||
import {
|
||||
processUrlList,
|
||||
toInnerRequest,
|
||||
} from "internal:deno_fetch/23_request.js";
|
||||
} from "ext:deno_web/06_streams.js";
|
||||
import { extractBody, InnerBody } from "ext:deno_fetch/22_body.js";
|
||||
import { processUrlList, toInnerRequest } from "ext:deno_fetch/23_request.js";
|
||||
import {
|
||||
abortedNetworkError,
|
||||
fromInnerResponse,
|
||||
|
@ -32,8 +29,8 @@ import {
|
|||
nullBodyStatus,
|
||||
redirectStatus,
|
||||
toInnerResponse,
|
||||
} from "internal:deno_fetch/23_response.js";
|
||||
import * as abortSignal from "internal:deno_web/03_abort_signal.js";
|
||||
} from "ext:deno_fetch/23_response.js";
|
||||
import * as abortSignal from "ext:deno_web/03_abort_signal.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const {
|
||||
ArrayPrototypePush,
|
||||
|
|
8
ext/fetch/internal.d.ts
vendored
8
ext/fetch/internal.d.ts
vendored
|
@ -9,7 +9,7 @@ declare var domIterable: {
|
|||
DomIterableMixin(base: any, dataSymbol: symbol): any;
|
||||
};
|
||||
|
||||
declare module "internal:deno_fetch/20_headers.js" {
|
||||
declare module "ext:deno_fetch/20_headers.js" {
|
||||
class Headers {
|
||||
}
|
||||
type HeaderList = [string, string][];
|
||||
|
@ -33,7 +33,7 @@ declare module "internal:deno_fetch/20_headers.js" {
|
|||
): "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;
|
||||
function formDataToBlob(
|
||||
formData: FormData,
|
||||
|
@ -45,7 +45,7 @@ declare module "internal:deno_fetch/21_formdata.js" {
|
|||
function formDataFromEntries(entries: FormDataEntry[]): FormData;
|
||||
}
|
||||
|
||||
declare module "internal:deno_fetch/22_body.js" {
|
||||
declare module "ext:deno_fetch/22_body.js" {
|
||||
function mixinBody(
|
||||
prototype: any,
|
||||
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 fromInnerRequest(
|
||||
inner: InnerRequest,
|
||||
|
|
|
@ -27,7 +27,7 @@ const {
|
|||
SymbolFor,
|
||||
WeakMap,
|
||||
} = 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");
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
const core = globalThis.Deno.core;
|
||||
const ops = core.ops;
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
import { BlobPrototype } from "internal:deno_web/09_file.js";
|
||||
import { TcpConn } from "internal:deno_net/01_net.js";
|
||||
import { toInnerResponse } from "internal:deno_fetch/23_response.js";
|
||||
import { _flash, fromFlashRequest } from "internal:deno_fetch/23_request.js";
|
||||
import { Event } from "internal:deno_web/02_event.js";
|
||||
import { BlobPrototype } from "ext:deno_web/09_file.js";
|
||||
import { TcpConn } from "ext:deno_net/01_net.js";
|
||||
import { toInnerResponse } from "ext:deno_fetch/23_response.js";
|
||||
import { _flash, fromFlashRequest } from "ext:deno_fetch/23_request.js";
|
||||
import { Event } from "ext:deno_web/02_event.js";
|
||||
import {
|
||||
_state,
|
||||
getReadableStreamResourceBacking,
|
||||
ReadableStream,
|
||||
readableStreamClose,
|
||||
ReadableStreamPrototype,
|
||||
} from "internal:deno_web/06_streams.js";
|
||||
} from "ext:deno_web/06_streams.js";
|
||||
import {
|
||||
_eventLoop,
|
||||
_idleTimeoutDuration,
|
||||
|
@ -23,8 +23,8 @@ import {
|
|||
_rid,
|
||||
_serverHandleIdleTimeout,
|
||||
WebSocket,
|
||||
} from "internal:deno_websocket/01_websocket.js";
|
||||
import { _ws } from "internal:deno_http/01_http.js";
|
||||
} from "ext:deno_websocket/01_websocket.js";
|
||||
import { _ws } from "ext:deno_http/01_http.js";
|
||||
const {
|
||||
ObjectPrototypeIsPrototypeOf,
|
||||
PromisePrototype,
|
||||
|
|
|
@ -17,14 +17,14 @@ const {
|
|||
SymbolIterator,
|
||||
Uint32Array,
|
||||
} = primordials;
|
||||
import { read, readSync, write, writeSync } from "internal:deno_io/12_io.js";
|
||||
import * as abortSignal from "internal:deno_web/03_abort_signal.js";
|
||||
import { read, readSync, write, writeSync } from "ext:deno_io/12_io.js";
|
||||
import * as abortSignal from "ext:deno_web/03_abort_signal.js";
|
||||
import {
|
||||
readableStreamForRid,
|
||||
ReadableStreamPrototype,
|
||||
writableStreamForRid,
|
||||
} from "internal:deno_web/06_streams.js";
|
||||
import { pathFromURL } from "internal:deno_web/00_infra.js";
|
||||
} from "ext:deno_web/06_streams.js";
|
||||
import { pathFromURL } from "ext:deno_web/00_infra.js";
|
||||
|
||||
function chmodSync(path, mode) {
|
||||
ops.op_chmod_sync(pathFromURL(path), mode);
|
||||
|
|
|
@ -3,22 +3,22 @@ const core = globalThis.Deno.core;
|
|||
const internals = globalThis.__bootstrap.internals;
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const { BadResourcePrototype, InterruptedPrototype, ops } = core;
|
||||
import * as webidl from "internal:deno_webidl/00_webidl.js";
|
||||
import { InnerBody } from "internal:deno_fetch/22_body.js";
|
||||
import { Event, setEventTargetData } from "internal:deno_web/02_event.js";
|
||||
import { BlobPrototype } from "internal:deno_web/09_file.js";
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import { InnerBody } from "ext:deno_fetch/22_body.js";
|
||||
import { Event, setEventTargetData } from "ext:deno_web/02_event.js";
|
||||
import { BlobPrototype } from "ext:deno_web/09_file.js";
|
||||
import {
|
||||
fromInnerResponse,
|
||||
newInnerResponse,
|
||||
ResponsePrototype,
|
||||
toInnerResponse,
|
||||
} from "internal:deno_fetch/23_response.js";
|
||||
} from "ext:deno_fetch/23_response.js";
|
||||
import {
|
||||
_flash,
|
||||
fromInnerRequest,
|
||||
newInnerRequest,
|
||||
} from "internal:deno_fetch/23_request.js";
|
||||
import * as abortSignal from "internal:deno_web/03_abort_signal.js";
|
||||
} from "ext:deno_fetch/23_request.js";
|
||||
import * as abortSignal from "ext:deno_web/03_abort_signal.js";
|
||||
import {
|
||||
_eventLoop,
|
||||
_idleTimeoutDuration,
|
||||
|
@ -29,16 +29,16 @@ import {
|
|||
_server,
|
||||
_serverHandleIdleTimeout,
|
||||
WebSocket,
|
||||
} from "internal:deno_websocket/01_websocket.js";
|
||||
import { TcpConn, UnixConn } from "internal:deno_net/01_net.js";
|
||||
import { TlsConn } from "internal:deno_net/02_tls.js";
|
||||
} from "ext:deno_websocket/01_websocket.js";
|
||||
import { TcpConn, UnixConn } from "ext:deno_net/01_net.js";
|
||||
import { TlsConn } from "ext:deno_net/02_tls.js";
|
||||
import {
|
||||
Deferred,
|
||||
getReadableStreamResourceBacking,
|
||||
readableStreamClose,
|
||||
readableStreamForRid,
|
||||
ReadableStreamPrototype,
|
||||
} from "internal:deno_web/06_streams.js";
|
||||
} from "ext:deno_web/06_streams.js";
|
||||
const {
|
||||
ArrayPrototypeIncludes,
|
||||
ArrayPrototypeMap,
|
||||
|
|
|
@ -10,7 +10,7 @@ const primordials = globalThis.__bootstrap.primordials;
|
|||
import {
|
||||
readableStreamForRid,
|
||||
writableStreamForRid,
|
||||
} from "internal:deno_web/06_streams.js";
|
||||
} from "ext:deno_web/06_streams.js";
|
||||
const {
|
||||
Uint8Array,
|
||||
ArrayPrototypePush,
|
||||
|
|
|
@ -7,8 +7,8 @@ import {
|
|||
readableStreamForRidUnrefableRef,
|
||||
readableStreamForRidUnrefableUnref,
|
||||
writableStreamForRid,
|
||||
} from "internal:deno_web/06_streams.js";
|
||||
import * as abortSignal from "internal:deno_web/03_abort_signal.js";
|
||||
} from "ext:deno_web/06_streams.js";
|
||||
import * as abortSignal from "ext:deno_web/03_abort_signal.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const {
|
||||
Error,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
const core = globalThis.Deno.core;
|
||||
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 { TypeError } = primordials;
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ pub fn init_polyfill_ops_and_esm() -> Extension {
|
|||
|
||||
Extension::builder(env!("CARGO_PKG_NAME"))
|
||||
.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"])
|
||||
.ops(vec![
|
||||
crypto::op_node_create_hash::decl(),
|
||||
|
|
|
@ -21,182 +21,182 @@ pub struct NodeModulePolyfill {
|
|||
pub static SUPPORTED_BUILTIN_NODE_MODULES: &[NodeModulePolyfill] = &[
|
||||
NodeModulePolyfill {
|
||||
name: "assert",
|
||||
specifier: "internal:deno_node/assert.ts",
|
||||
specifier: "ext:deno_node/assert.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "assert/strict",
|
||||
specifier: "internal:deno_node/assert/strict.ts",
|
||||
specifier: "ext:deno_node/assert/strict.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "async_hooks",
|
||||
specifier: "internal:deno_node/async_hooks.ts",
|
||||
specifier: "ext:deno_node/async_hooks.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "buffer",
|
||||
specifier: "internal:deno_node/buffer.ts",
|
||||
specifier: "ext:deno_node/buffer.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "child_process",
|
||||
specifier: "internal:deno_node/child_process.ts",
|
||||
specifier: "ext:deno_node/child_process.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "cluster",
|
||||
specifier: "internal:deno_node/cluster.ts",
|
||||
specifier: "ext:deno_node/cluster.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "console",
|
||||
specifier: "internal:deno_node/console.ts",
|
||||
specifier: "ext:deno_node/console.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "constants",
|
||||
specifier: "internal:deno_node/constants.ts",
|
||||
specifier: "ext:deno_node/constants.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "crypto",
|
||||
specifier: "internal:deno_node/crypto.ts",
|
||||
specifier: "ext:deno_node/crypto.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "dgram",
|
||||
specifier: "internal:deno_node/dgram.ts",
|
||||
specifier: "ext:deno_node/dgram.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "dns",
|
||||
specifier: "internal:deno_node/dns.ts",
|
||||
specifier: "ext:deno_node/dns.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "dns/promises",
|
||||
specifier: "internal:deno_node/dns/promises.ts",
|
||||
specifier: "ext:deno_node/dns/promises.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "domain",
|
||||
specifier: "internal:deno_node/domain.ts",
|
||||
specifier: "ext:deno_node/domain.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "events",
|
||||
specifier: "internal:deno_node/events.ts",
|
||||
specifier: "ext:deno_node/events.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "fs",
|
||||
specifier: "internal:deno_node/fs.ts",
|
||||
specifier: "ext:deno_node/fs.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "fs/promises",
|
||||
specifier: "internal:deno_node/fs/promises.ts",
|
||||
specifier: "ext:deno_node/fs/promises.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "http",
|
||||
specifier: "internal:deno_node/http.ts",
|
||||
specifier: "ext:deno_node/http.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "https",
|
||||
specifier: "internal:deno_node/https.ts",
|
||||
specifier: "ext:deno_node/https.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "module",
|
||||
specifier: "internal:deno_node_loading/module_es_shim.js",
|
||||
specifier: "ext:deno_node_loading/module_es_shim.js",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "net",
|
||||
specifier: "internal:deno_node/net.ts",
|
||||
specifier: "ext:deno_node/net.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "os",
|
||||
specifier: "internal:deno_node/os.ts",
|
||||
specifier: "ext:deno_node/os.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "path",
|
||||
specifier: "internal:deno_node/path.ts",
|
||||
specifier: "ext:deno_node/path.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "path/posix",
|
||||
specifier: "internal:deno_node/path/posix.ts",
|
||||
specifier: "ext:deno_node/path/posix.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "path/win32",
|
||||
specifier: "internal:deno_node/path/win32.ts",
|
||||
specifier: "ext:deno_node/path/win32.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "perf_hooks",
|
||||
specifier: "internal:deno_node/perf_hooks.ts",
|
||||
specifier: "ext:deno_node/perf_hooks.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "process",
|
||||
specifier: "internal:deno_node/process.ts",
|
||||
specifier: "ext:deno_node/process.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "querystring",
|
||||
specifier: "internal:deno_node/querystring.ts",
|
||||
specifier: "ext:deno_node/querystring.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "readline",
|
||||
specifier: "internal:deno_node/readline.ts",
|
||||
specifier: "ext:deno_node/readline.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "stream",
|
||||
specifier: "internal:deno_node/stream.ts",
|
||||
specifier: "ext:deno_node/stream.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "stream/consumers",
|
||||
specifier: "internal:deno_node/stream/consumers.mjs",
|
||||
specifier: "ext:deno_node/stream/consumers.mjs",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "stream/promises",
|
||||
specifier: "internal:deno_node/stream/promises.mjs",
|
||||
specifier: "ext:deno_node/stream/promises.mjs",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "stream/web",
|
||||
specifier: "internal:deno_node/stream/web.ts",
|
||||
specifier: "ext:deno_node/stream/web.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "string_decoder",
|
||||
specifier: "internal:deno_node/string_decoder.ts",
|
||||
specifier: "ext:deno_node/string_decoder.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "sys",
|
||||
specifier: "internal:deno_node/sys.ts",
|
||||
specifier: "ext:deno_node/sys.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "timers",
|
||||
specifier: "internal:deno_node/timers.ts",
|
||||
specifier: "ext:deno_node/timers.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "timers/promises",
|
||||
specifier: "internal:deno_node/timers/promises.ts",
|
||||
specifier: "ext:deno_node/timers/promises.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "tls",
|
||||
specifier: "internal:deno_node/tls.ts",
|
||||
specifier: "ext:deno_node/tls.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "tty",
|
||||
specifier: "internal:deno_node/tty.ts",
|
||||
specifier: "ext:deno_node/tty.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "url",
|
||||
specifier: "internal:deno_node/url.ts",
|
||||
specifier: "ext:deno_node/url.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "util",
|
||||
specifier: "internal:deno_node/util.ts",
|
||||
specifier: "ext:deno_node/util.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "util/types",
|
||||
specifier: "internal:deno_node/util/types.ts",
|
||||
specifier: "ext:deno_node/util/types.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "v8",
|
||||
specifier: "internal:deno_node/v8.ts",
|
||||
specifier: "ext:deno_node/v8.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "vm",
|
||||
specifier: "internal:deno_node/vm.ts",
|
||||
specifier: "ext:deno_node/vm.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "worker_threads",
|
||||
specifier: "internal:deno_node/worker_threads.ts",
|
||||
specifier: "ext:deno_node/worker_threads.ts",
|
||||
},
|
||||
NodeModulePolyfill {
|
||||
name: "zlib",
|
||||
specifier: "internal:deno_node/zlib.ts",
|
||||
specifier: "ext:deno_node/zlib.ts",
|
||||
},
|
||||
];
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// Note: deno_std shouldn't use Deno.core namespace. We should minimize these
|
||||
// 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
|
||||
let DenoCore: any;
|
||||
|
|
|
@ -24,21 +24,21 @@
|
|||
|
||||
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 {
|
||||
AbortError,
|
||||
// kEnhanceStackBeforeInspector,
|
||||
ERR_INVALID_ARG_TYPE,
|
||||
ERR_OUT_OF_RANGE,
|
||||
ERR_UNHANDLED_ERROR,
|
||||
} from "internal:deno_node/internal/errors.ts";
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
|
||||
import {
|
||||
validateAbortSignal,
|
||||
validateBoolean,
|
||||
validateFunction,
|
||||
} from "internal:deno_node/internal/validators.mjs";
|
||||
import { spliceOne } from "internal:deno_node/_utils.ts";
|
||||
} from "ext:deno_node/internal/validators.mjs";
|
||||
import { spliceOne } from "ext:deno_node/_utils.ts";
|
||||
|
||||
const kCapture = Symbol("kCapture");
|
||||
const kErrorMonitor = Symbol("events.errorMonitor");
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
import {
|
||||
type CallbackWithError,
|
||||
makeCallback,
|
||||
} from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { fs } from "internal:deno_node/internal_binding/constants.ts";
|
||||
import { codeMap } from "internal:deno_node/internal_binding/uv.ts";
|
||||
} from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { fs } from "ext:deno_node/internal_binding/constants.ts";
|
||||
import { codeMap } from "ext:deno_node/internal_binding/uv.ts";
|
||||
import {
|
||||
getValidatedPath,
|
||||
getValidMode,
|
||||
} from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import type { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import type { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
export function access(
|
||||
path: string | Buffer | URL,
|
||||
|
|
|
@ -4,17 +4,11 @@ import {
|
|||
isFd,
|
||||
maybeCallback,
|
||||
WriteFileOptions,
|
||||
} from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { Encodings } from "internal:deno_node/_utils.ts";
|
||||
import {
|
||||
copyObject,
|
||||
getOptions,
|
||||
} 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";
|
||||
} from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { Encodings } from "ext:deno_node/_utils.ts";
|
||||
import { copyObject, getOptions } from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { writeFile, writeFileSync } from "ext:deno_node/_fs/_fs_writeFile.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
/**
|
||||
* TODO: Also accept 'data' parameter as a Node polyfill Buffer type once these
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { getValidatedPath } from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import * as pathModule from "internal:deno_node/path.ts";
|
||||
import { parseFileMode } from "internal:deno_node/internal/validators.mjs";
|
||||
import { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import * as pathModule from "ext:deno_node/path.ts";
|
||||
import { parseFileMode } from "ext:deno_node/internal/validators.mjs";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
export function chmod(
|
||||
path: string | Buffer | URL,
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
import {
|
||||
type CallbackWithError,
|
||||
makeCallback,
|
||||
} from "internal:deno_node/_fs/_fs_common.ts";
|
||||
} from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import {
|
||||
getValidatedPath,
|
||||
kMaxUserId,
|
||||
} from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import * as pathModule from "internal:deno_node/path.ts";
|
||||
import { validateInteger } from "internal:deno_node/internal/validators.mjs";
|
||||
import type { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import * as pathModule from "ext:deno_node/path.ts";
|
||||
import { validateInteger } from "ext:deno_node/internal/validators.mjs";
|
||||
import type { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
/**
|
||||
* Asynchronously changes the owner and group
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { getValidatedFd } from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { getValidatedFd } from "ext:deno_node/internal/fs/utils.mjs";
|
||||
|
||||
export function close(fd: number, callback: CallbackWithError) {
|
||||
fd = getValidatedFd(fd);
|
||||
|
|
|
@ -7,15 +7,15 @@ import {
|
|||
O_RDWR,
|
||||
O_TRUNC,
|
||||
O_WRONLY,
|
||||
} from "internal:deno_node/_fs/_fs_constants.ts";
|
||||
import { validateFunction } from "internal:deno_node/internal/validators.mjs";
|
||||
import type { ErrnoException } from "internal:deno_node/_global.d.ts";
|
||||
} from "ext:deno_node/_fs/_fs_constants.ts";
|
||||
import { validateFunction } from "ext:deno_node/internal/validators.mjs";
|
||||
import type { ErrnoException } from "ext:deno_node/_global.d.ts";
|
||||
import {
|
||||
BinaryEncodings,
|
||||
Encodings,
|
||||
notImplemented,
|
||||
TextEncodings,
|
||||
} from "internal:deno_node/_utils.ts";
|
||||
} from "ext:deno_node/_utils.ts";
|
||||
|
||||
export type CallbackWithError = (err: ErrnoException | null) => void;
|
||||
|
||||
|
@ -212,7 +212,7 @@ export function getOpenOptions(
|
|||
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) {
|
||||
validateFunction(cb, "cb");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// 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 {
|
||||
F_OK,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { makeCallback } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { makeCallback } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import {
|
||||
getValidatedPath,
|
||||
getValidMode,
|
||||
} from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { fs } from "internal:deno_node/internal_binding/constants.ts";
|
||||
import { codeMap } from "internal:deno_node/internal_binding/uv.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { fs } from "ext:deno_node/internal_binding/constants.ts";
|
||||
import { codeMap } from "ext:deno_node/internal_binding/uv.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
export function copyFile(
|
||||
src: string | Buffer | URL,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import Dirent from "internal:deno_node/_fs/_fs_dirent.ts";
|
||||
import { assert } from "internal:deno_node/_util/asserts.ts";
|
||||
import { ERR_MISSING_ARGS } from "internal:deno_node/internal/errors.ts";
|
||||
import { TextDecoder } from "internal:deno_web/08_text_encoding.js";
|
||||
import Dirent from "ext:deno_node/_fs/_fs_dirent.ts";
|
||||
import { assert } from "ext:deno_node/_util/asserts.ts";
|
||||
import { ERR_MISSING_ARGS } from "ext:deno_node/internal/errors.ts";
|
||||
import { TextDecoder } from "ext:deno_web/08_text_encoding.js";
|
||||
|
||||
export default class Dir {
|
||||
#dirPath: string | Uint8Array;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// 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 {
|
||||
constructor(private entry: Deno.DirEntry) {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// 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;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// 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(
|
||||
fd: number,
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
statCallbackBigInt,
|
||||
statOptions,
|
||||
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(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// 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(
|
||||
fd: number,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// 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(
|
||||
fd: number,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// 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(
|
||||
time: number | string | Date,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { fromFileUrl } from "internal:deno_node/path.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { fromFileUrl } from "ext:deno_node/path.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
/**
|
||||
* TODO: Also accept 'path' parameter as a Node polyfill Buffer type once these
|
||||
|
|
|
@ -6,8 +6,8 @@ import {
|
|||
statCallbackBigInt,
|
||||
statOptions,
|
||||
Stats,
|
||||
} from "internal:deno_node/_fs/_fs_stat.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/_fs/_fs_stat.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
export function lstat(path: string | URL, callback: statCallback): void;
|
||||
export function lstat(
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
import { denoErrorToNodeError } from "internal:deno_node/internal/errors.ts";
|
||||
import { getValidatedPath } from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { validateBoolean } from "internal:deno_node/internal/validators.mjs";
|
||||
import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
|
||||
import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { validateBoolean } from "ext:deno_node/internal/validators.mjs";
|
||||
|
||||
/**
|
||||
* TODO: Also accept 'path' parameter as a Node polyfill Buffer type once these
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
// Copyright Node.js contributors. All rights reserved. MIT License.
|
||||
|
||||
import {
|
||||
TextDecoder,
|
||||
TextEncoder,
|
||||
} 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 { TextDecoder, TextEncoder } from "ext:deno_web/08_text_encoding.js";
|
||||
import { existsSync } from "ext:deno_node/_fs/_fs_exists.ts";
|
||||
import { mkdir, mkdirSync } from "ext:deno_node/_fs/_fs_mkdir.ts";
|
||||
import {
|
||||
ERR_INVALID_ARG_TYPE,
|
||||
ERR_INVALID_OPT_VALUE_ENCODING,
|
||||
} from "internal:deno_node/internal/errors.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
export type mkdtempCallback = (
|
||||
err: Error | null,
|
||||
|
|
|
@ -6,13 +6,13 @@ import {
|
|||
O_RDWR,
|
||||
O_TRUNC,
|
||||
O_WRONLY,
|
||||
} from "internal:deno_node/_fs/_fs_constants.ts";
|
||||
import { getOpenOptions } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
import { parseFileMode } from "internal:deno_node/internal/validators.mjs";
|
||||
import { ERR_INVALID_ARG_TYPE } from "internal:deno_node/internal/errors.ts";
|
||||
import { getValidatedPath } from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import type { Buffer } from "internal:deno_node/buffer.ts";
|
||||
} from "ext:deno_node/_fs/_fs_constants.ts";
|
||||
import { getOpenOptions } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
import { parseFileMode } from "ext:deno_node/internal/validators.mjs";
|
||||
import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts";
|
||||
import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import type { Buffer } from "ext:deno_node/buffer.ts";
|
||||
|
||||
function existsSync(filePath: string | URL): boolean {
|
||||
try {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
import Dir from "internal:deno_node/_fs/_fs_dir.ts";
|
||||
import { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import Dir from "ext:deno_node/_fs/_fs_dir.ts";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import {
|
||||
getOptions,
|
||||
getValidatedPath,
|
||||
} from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { denoErrorToNodeError } from "internal:deno_node/internal/errors.ts";
|
||||
} from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
|
||||
import {
|
||||
validateFunction,
|
||||
validateInteger,
|
||||
} from "internal:deno_node/internal/validators.mjs";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/internal/validators.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.
|
||||
* However, these values are still validated.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import { ERR_INVALID_ARG_TYPE } from "internal:deno_node/internal/errors.ts";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts";
|
||||
import {
|
||||
validateOffsetLengthRead,
|
||||
validatePosition,
|
||||
} from "internal:deno_node/internal/fs/utils.mjs";
|
||||
} from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import {
|
||||
validateBuffer,
|
||||
validateInteger,
|
||||
} from "internal:deno_node/internal/validators.mjs";
|
||||
} from "ext:deno_node/internal/validators.mjs";
|
||||
|
||||
type readOptions = {
|
||||
buffer: Buffer | Uint8Array;
|
||||
|
|
|
@ -4,15 +4,15 @@ import {
|
|||
FileOptionsArgument,
|
||||
getEncoding,
|
||||
TextOptionsArgument,
|
||||
} from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import { fromFileUrl } from "internal:deno_node/path.ts";
|
||||
} from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import { fromFileUrl } from "ext:deno_node/path.ts";
|
||||
import {
|
||||
BinaryEncodings,
|
||||
Encodings,
|
||||
TextEncodings,
|
||||
} from "internal:deno_node/_utils.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/_utils.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
function maybeDecode(data: Uint8Array, encoding: TextEncodings): string;
|
||||
function maybeDecode(
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
import {
|
||||
TextDecoder,
|
||||
TextEncoder,
|
||||
} from "internal:deno_web/08_text_encoding.js";
|
||||
import { asyncIterableToCallback } from "internal:deno_node/_fs/_fs_watch.ts";
|
||||
import Dirent from "internal:deno_node/_fs/_fs_dirent.ts";
|
||||
import { denoErrorToNodeError } from "internal:deno_node/internal/errors.ts";
|
||||
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";
|
||||
import { TextDecoder, TextEncoder } from "ext:deno_web/08_text_encoding.js";
|
||||
import { asyncIterableToCallback } from "ext:deno_node/_fs/_fs_watch.ts";
|
||||
import Dirent from "ext:deno_node/_fs/_fs_dirent.ts";
|
||||
import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
|
||||
import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
function toDirent(val: Deno.DirEntry): Dirent {
|
||||
return new Dirent(val);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// 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 {
|
||||
intoCallbackAPIWithIntercept,
|
||||
MaybeEmpty,
|
||||
notImplemented,
|
||||
} from "internal:deno_node/_utils.ts";
|
||||
import { fromFileUrl } from "internal:deno_node/path.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/_utils.ts";
|
||||
import { fromFileUrl } from "ext:deno_node/path.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
type ReadlinkCallback = (
|
||||
err: MaybeEmpty<Error>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// 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 Callback = (err: Error | null, path?: string) => void;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import { fromFileUrl } from "internal:deno_node/path.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
import { fromFileUrl } from "ext:deno_node/path.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
export function rename(
|
||||
oldPath: string | URL,
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
import {
|
||||
validateRmOptions,
|
||||
validateRmOptionsSync,
|
||||
} from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { denoErrorToNodeError } from "internal:deno_node/internal/errors.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
type rmOptions = {
|
||||
force?: boolean;
|
||||
|
|
|
@ -5,14 +5,14 @@ import {
|
|||
validateRmdirOptions,
|
||||
validateRmOptions,
|
||||
validateRmOptionsSync,
|
||||
} from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { toNamespacedPath } from "internal:deno_node/path.ts";
|
||||
} from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { toNamespacedPath } from "ext:deno_node/path.ts";
|
||||
import {
|
||||
denoErrorToNodeError,
|
||||
ERR_FS_RMDIR_ENOTDIR,
|
||||
} from "internal:deno_node/internal/errors.ts";
|
||||
import { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
type rmdirOptions = {
|
||||
maxRetries?: number;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import { denoErrorToNodeError } from "internal:deno_node/internal/errors.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
export type statOptions = {
|
||||
bigint: boolean;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { fromFileUrl } from "internal:deno_node/path.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { fromFileUrl } from "ext:deno_node/path.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
type SymlinkType = "file" | "dir";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { fromFileUrl } from "internal:deno_node/path.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { fromFileUrl } from "ext:deno_node/path.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
export function truncate(
|
||||
path: string | URL,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// 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) {
|
||||
if (!callback) throw new Error("No callback function supplied");
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
import type { CallbackWithError } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { fromFileUrl } from "internal:deno_node/path.ts";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { fromFileUrl } from "ext:deno_node/path.ts";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
function getValidTime(
|
||||
time: number | string | Date,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import { basename } from "internal:deno_node/path.ts";
|
||||
import { EventEmitter } from "internal:deno_node/events.ts";
|
||||
import { notImplemented } from "internal:deno_node/_utils.ts";
|
||||
import { promisify } from "internal:deno_node/util.ts";
|
||||
import { getValidatedPath } from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { validateFunction } from "internal:deno_node/internal/validators.mjs";
|
||||
import { stat, Stats } from "internal:deno_node/_fs/_fs_stat.ts";
|
||||
import { Stats as StatsClass } from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import { delay } from "internal:deno_node/_util/async.ts";
|
||||
import { basename } from "ext:deno_node/path.ts";
|
||||
import { EventEmitter } from "ext:deno_node/events.ts";
|
||||
import { notImplemented } from "ext:deno_node/_utils.ts";
|
||||
import { promisify } from "ext:deno_node/util.ts";
|
||||
import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { validateFunction } from "ext:deno_node/internal/validators.mjs";
|
||||
import { stat, Stats } from "ext:deno_node/_fs/_fs_stat.ts";
|
||||
import { Stats as StatsClass } from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import { delay } from "ext:deno_node/_util/async.ts";
|
||||
|
||||
const statPromisified = promisify(stat);
|
||||
const statAsync = async (filename: string): Promise<Stats | null> => {
|
||||
|
|
5
ext/node/polyfills/_fs/_fs_write.d.ts
vendored
5
ext/node/polyfills/_fs/_fs_write.d.ts
vendored
|
@ -1,10 +1,7 @@
|
|||
// 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
|
||||
|
||||
import {
|
||||
BufferEncoding,
|
||||
ErrnoException,
|
||||
} from "internal:deno_node/_global.d.ts";
|
||||
import { BufferEncoding, ErrnoException } from "ext:deno_node/_global.d.ts";
|
||||
|
||||
/**
|
||||
* Write `buffer` to the file specified by `fd`. If `buffer` is a normal object, it
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
// Copyright 2018-2023 the Deno authors. 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 { validateEncoding, validateInteger } from "internal:deno_node/internal/validators.mjs";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import { validateEncoding, validateInteger } from "ext:deno_node/internal/validators.mjs";
|
||||
import {
|
||||
getValidatedFd,
|
||||
showStringCoercionDeprecation,
|
||||
validateOffsetLengthWrite,
|
||||
validateStringAfterArrayBufferView,
|
||||
} from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { isArrayBufferView } from "internal:deno_node/internal/util/types.ts";
|
||||
import { maybeCallback } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
} from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { isArrayBufferView } from "ext:deno_node/internal/util/types.ts";
|
||||
import { maybeCallback } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
|
||||
export function writeSync(fd, buffer, offset, length, position) {
|
||||
fd = getValidatedFd(fd);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import { Encodings } from "internal:deno_node/_utils.ts";
|
||||
import { fromFileUrl } from "internal:deno_node/path.ts";
|
||||
import { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import { Encodings } from "ext:deno_node/_utils.ts";
|
||||
import { fromFileUrl } from "ext:deno_node/path.ts";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import {
|
||||
CallbackWithError,
|
||||
checkEncoding,
|
||||
|
@ -9,17 +9,17 @@ import {
|
|||
getOpenOptions,
|
||||
isFileOptions,
|
||||
WriteFileOptions,
|
||||
} from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { isWindows } from "internal:deno_node/_util/os.ts";
|
||||
} from "ext:deno_node/_fs/_fs_common.ts";
|
||||
import { isWindows } from "ext:deno_node/_util/os.ts";
|
||||
import {
|
||||
AbortError,
|
||||
denoErrorToNodeError,
|
||||
} from "internal:deno_node/internal/errors.ts";
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import {
|
||||
showStringCoercionDeprecation,
|
||||
validateStringAfterArrayBufferView,
|
||||
} from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { promisify } from "internal:deno_node/internal/util.mjs";
|
||||
} from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||
|
||||
interface Writer {
|
||||
write(p: Uint8Array): Promise<number>;
|
||||
|
|
2
ext/node/polyfills/_fs/_fs_writev.d.ts
vendored
2
ext/node/polyfills/_fs/_fs_writev.d.ts
vendored
|
@ -1,7 +1,7 @@
|
|||
// 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
|
||||
|
||||
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()`.
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright 2018-2023 the Deno authors. 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 { validateBufferArray } from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { getValidatedFd } from "internal:deno_node/internal/fs/utils.mjs";
|
||||
import { maybeCallback } from "internal:deno_node/_fs/_fs_common.ts";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import { validateBufferArray } from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { getValidatedFd } from "ext:deno_node/internal/fs/utils.mjs";
|
||||
import { maybeCallback } from "ext:deno_node/_fs/_fs_common.ts";
|
||||
|
||||
export function writev(fd, buffers, position, callback) {
|
||||
const innerWritev = async (fd, buffers, position) => {
|
||||
|
|
4
ext/node/polyfills/_global.d.ts
vendored
4
ext/node/polyfills/_global.d.ts
vendored
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import { EventEmitter } from "internal:deno_node/_events.d.ts";
|
||||
import { Buffer } from "internal:deno_node/buffer.ts";
|
||||
import { EventEmitter } from "ext:deno_node/_events.d.ts";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
|
||||
/** One of:
|
||||
* | "ascii"
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
// Copyright 2018-2023 the Deno authors. 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 EventEmitter from "internal:deno_node/events.ts";
|
||||
import { debuglog } from "internal:deno_node/internal/util/debuglog.ts";
|
||||
import * as net from "ext:deno_node/net.ts";
|
||||
import EventEmitter from "ext:deno_node/events.ts";
|
||||
import { debuglog } from "ext:deno_node/internal/util/debuglog.ts";
|
||||
let debug = debuglog("http", (fn) => {
|
||||
debug = fn;
|
||||
});
|
||||
import { AsyncResource } from "internal:deno_node/async_hooks.ts";
|
||||
import { symbols } from "internal:deno_node/internal/async_hooks.ts";
|
||||
import { AsyncResource } from "ext:deno_node/async_hooks.ts";
|
||||
import { symbols } from "ext:deno_node/internal/async_hooks.ts";
|
||||
// deno-lint-ignore camelcase
|
||||
const { async_id_symbol } = symbols;
|
||||
import { ERR_OUT_OF_RANGE } from "internal:deno_node/internal/errors.ts";
|
||||
import { once } from "internal:deno_node/internal/util.mjs";
|
||||
import { ERR_OUT_OF_RANGE } from "ext:deno_node/internal/errors.ts";
|
||||
import { once } from "ext:deno_node/internal/util.mjs";
|
||||
import {
|
||||
validateNumber,
|
||||
validateOneOf,
|
||||
validateString,
|
||||
} from "internal:deno_node/internal/validators.mjs";
|
||||
} from "ext:deno_node/internal/validators.mjs";
|
||||
|
||||
const kOnKeylog = Symbol("onkeylog");
|
||||
const kRequestOptions = Symbol("requestOptions");
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
// Copyright 2018-2023 the Deno authors. 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 assert from "internal:deno_node/internal/assert.mjs";
|
||||
import EE from "internal:deno_node/events.ts";
|
||||
import { Stream } from "internal:deno_node/stream.ts";
|
||||
import { deprecate } from "internal:deno_node/util.ts";
|
||||
import type { Socket } from "internal:deno_node/net.ts";
|
||||
import { getDefaultHighWaterMark } from "ext:deno_node/internal/streams/state.mjs";
|
||||
import assert from "ext:deno_node/internal/assert.mjs";
|
||||
import EE from "ext:deno_node/events.ts";
|
||||
import { Stream } from "ext:deno_node/stream.ts";
|
||||
import { deprecate } from "ext:deno_node/util.ts";
|
||||
import type { Socket } from "ext:deno_node/net.ts";
|
||||
import {
|
||||
kNeedDrain,
|
||||
kOutHeaders,
|
||||
utcDate,
|
||||
} from "internal:deno_node/internal/http.ts";
|
||||
import { Buffer } from "internal:deno_node/buffer.ts";
|
||||
} from "ext:deno_node/internal/http.ts";
|
||||
import { Buffer } from "ext:deno_node/buffer.ts";
|
||||
import {
|
||||
_checkInvalidHeaderChar as checkInvalidHeaderChar,
|
||||
_checkIsHttpToken as checkIsHttpToken,
|
||||
chunkExpression as RE_TE_CHUNKED,
|
||||
} from "internal:deno_node/_http_common.ts";
|
||||
} from "ext:deno_node/_http_common.ts";
|
||||
import {
|
||||
defaultTriggerAsyncIdScope,
|
||||
symbols,
|
||||
} from "internal:deno_node/internal/async_hooks.ts";
|
||||
} from "ext:deno_node/internal/async_hooks.ts";
|
||||
// deno-lint-ignore camelcase
|
||||
const { async_id_symbol } = symbols;
|
||||
import {
|
||||
|
@ -39,11 +39,11 @@ import {
|
|||
ERR_STREAM_NULL_VALUES,
|
||||
ERR_STREAM_WRITE_AFTER_END,
|
||||
hideStackFrames,
|
||||
} from "internal:deno_node/internal/errors.ts";
|
||||
import { validateString } from "internal:deno_node/internal/validators.mjs";
|
||||
import { isUint8Array } from "internal:deno_node/internal/util/types.ts";
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import { validateString } from "ext:deno_node/internal/validators.mjs";
|
||||
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) => {
|
||||
debug = fn;
|
||||
});
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
|
||||
import { core } from "internal:deno_node/_core.ts";
|
||||
import { validateFunction } from "internal:deno_node/internal/validators.mjs";
|
||||
import { _exiting } from "internal:deno_node/_process/exiting.ts";
|
||||
import { FixedQueue } from "internal:deno_node/internal/fixed_queue.ts";
|
||||
import { core } from "ext:deno_node/_core.ts";
|
||||
import { validateFunction } from "ext:deno_node/internal/validators.mjs";
|
||||
import { _exiting } from "ext:deno_node/_process/exiting.ts";
|
||||
import { FixedQueue } from "ext:deno_node/internal/fixed_queue.ts";
|
||||
|
||||
interface Tock {
|
||||
callback: (...args: Array<unknown>) => void;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
// 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 */
|
||||
|
||||
|
@ -418,7 +418,7 @@ const gen_bitlen = (s, desc) => // deflate_state *s;
|
|||
/* Now recompute all bit lengths, scanning in increasing frequency.
|
||||
* 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
|
||||
* 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--) {
|
||||
n = s.bl_count[bits];
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
// They have to be split this way to prevent a circular dependency
|
||||
|
||||
const core = globalThis.Deno.core;
|
||||
import { nextTick as _nextTick } from "internal:deno_node/_next_tick.ts";
|
||||
import { _exiting } from "internal:deno_node/_process/exiting.ts";
|
||||
import * as fs from "internal:deno_fs/30_fs.js";
|
||||
import { nextTick as _nextTick } from "ext:deno_node/_next_tick.ts";
|
||||
import { _exiting } from "ext:deno_node/_process/exiting.ts";
|
||||
import * as fs from "ext:deno_fs/30_fs.js";
|
||||
|
||||
/** Returns the operating system CPU architecture for which the Deno binary was compiled */
|
||||
export function arch(): string {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
// Copyright 2018-2023 the Deno authors. 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 {
|
||||
clearLine,
|
||||
clearScreenDown,
|
||||
cursorTo,
|
||||
moveCursor,
|
||||
} from "internal:deno_node/internal/readline/callbacks.mjs";
|
||||
import { Duplex, Readable, Writable } from "internal:deno_node/stream.ts";
|
||||
import { isWindows } from "internal:deno_node/_util/os.ts";
|
||||
import { fs as fsConstants } from "internal:deno_node/internal_binding/constants.ts";
|
||||
import * as io from "internal:deno_io/12_io.js";
|
||||
} from "ext:deno_node/internal/readline/callbacks.mjs";
|
||||
import { Duplex, Readable, Writable } from "ext:deno_node/stream.ts";
|
||||
import { isWindows } from "ext:deno_node/_util/os.ts";
|
||||
import { fs as fsConstants } from "ext:deno_node/internal_binding/constants.ts";
|
||||
import * as io from "ext:deno_io/12_io.js";
|
||||
|
||||
// https://github.com/nodejs/node/blob/00738314828074243c9a52a228ab4c68b04259ef/lib/internal/bootstrap/switches/is_main_thread.js#L41
|
||||
export function createWritableStdioStream(writer, name) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue