mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
Reverted in
95847f4e94
.
This commit is contained in:
parent
9114a2df69
commit
445e05a39d
11 changed files with 19 additions and 54 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -1342,9 +1342,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_core"
|
name = "deno_core"
|
||||||
version = "0.294.0"
|
version = "0.297.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e3e1883573cace82d1e826096c8c06bd5e4310ca3a4dba0eb1bf67468719c01"
|
checksum = "a9f288b405f91af8ea45dc74ce4391fc5f390531947e9fc8630fb0206d3f2c93"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
@ -1819,9 +1819,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_ops"
|
name = "deno_ops"
|
||||||
version = "0.170.0"
|
version = "0.173.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2534bce0346a6dbd6f892066b941a48297687d8755de135cef5dc15bed83214"
|
checksum = "46c1e18b32543405cde22a2b04b4d108c2f129cc2d34db0872d4a5bb378b43af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-rules",
|
"proc-macro-rules",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -5936,9 +5936,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_v8"
|
name = "serde_v8"
|
||||||
version = "0.203.0"
|
version = "0.206.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5edf75e70aeb4c6f14c606cfe2fc8b3bd43d4f79c781365c3f336f1fe4be508a"
|
checksum = "517f37bd74d2287bd9b5197f7dff77d1f1f960a7a1f6557b55dc39423e0372a8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -7556,9 +7556,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "v8"
|
name = "v8"
|
||||||
version = "0.98.1"
|
version = "0.98.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d03f42deef61349d31ae100e7bcdcc5d9293c1126cb8aff8fd56ba3cba18340b"
|
checksum = "e9b8009c63eec162cbcc41aa4db66b81974f641d32a35b1a3198ec2ce4712d6b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen",
|
"bindgen",
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
|
|
|
@ -44,7 +44,7 @@ repository = "https://github.com/denoland/deno"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
deno_ast = { version = "=0.40.0", features = ["transpiling"] }
|
deno_ast = { version = "=0.40.0", features = ["transpiling"] }
|
||||||
deno_core = { version = "0.294.0" }
|
deno_core = { version = "0.297.0" }
|
||||||
|
|
||||||
deno_bench_util = { version = "0.156.0", path = "./bench_util" }
|
deno_bench_util = { version = "0.156.0", path = "./bench_util" }
|
||||||
deno_lockfile = "0.20.0"
|
deno_lockfile = "0.20.0"
|
||||||
|
|
|
@ -55,7 +55,6 @@ use deno_core::ModuleType;
|
||||||
use deno_core::RequestedModuleType;
|
use deno_core::RequestedModuleType;
|
||||||
use deno_core::ResolutionKind;
|
use deno_core::ResolutionKind;
|
||||||
use deno_core::SourceCodeCacheInfo;
|
use deno_core::SourceCodeCacheInfo;
|
||||||
use deno_core::SourceMapGetter;
|
|
||||||
use deno_graph::source::ResolutionMode;
|
use deno_graph::source::ResolutionMode;
|
||||||
use deno_graph::source::Resolver;
|
use deno_graph::source::Resolver;
|
||||||
use deno_graph::GraphKind;
|
use deno_graph::GraphKind;
|
||||||
|
@ -294,8 +293,7 @@ impl CliModuleLoaderFactory {
|
||||||
shared: self.shared.clone(),
|
shared: self.shared.clone(),
|
||||||
})));
|
})));
|
||||||
ModuleLoaderAndSourceMapGetter {
|
ModuleLoaderAndSourceMapGetter {
|
||||||
module_loader: loader.clone(),
|
module_loader: loader,
|
||||||
source_map_getter: Some(loader),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -829,11 +827,7 @@ impl<TGraphContainer: ModuleGraphContainer> ModuleLoader
|
||||||
}
|
}
|
||||||
std::future::ready(()).boxed_local()
|
std::future::ready(()).boxed_local()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl<TGraphContainer: ModuleGraphContainer> SourceMapGetter
|
|
||||||
for CliModuleLoader<TGraphContainer>
|
|
||||||
{
|
|
||||||
fn get_source_map(&self, file_name: &str) -> Option<Vec<u8>> {
|
fn get_source_map(&self, file_name: &str) -> Option<Vec<u8>> {
|
||||||
let specifier = resolve_url(file_name).ok()?;
|
let specifier = resolve_url(file_name).ok()?;
|
||||||
match specifier.scheme() {
|
match specifier.scheme() {
|
||||||
|
@ -846,7 +840,7 @@ impl<TGraphContainer: ModuleGraphContainer> SourceMapGetter
|
||||||
source_map_from_code(source.code.as_bytes())
|
source_map_from_code(source.code.as_bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_source_line(
|
fn get_source_mapped_source_line(
|
||||||
&self,
|
&self,
|
||||||
file_name: &str,
|
file_name: &str,
|
||||||
line_number: usize,
|
line_number: usize,
|
||||||
|
|
|
@ -385,7 +385,6 @@ impl ModuleLoaderFactory for StandaloneModuleLoaderFactory {
|
||||||
root_permissions,
|
root_permissions,
|
||||||
dynamic_permissions,
|
dynamic_permissions,
|
||||||
}),
|
}),
|
||||||
source_map_getter: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +399,6 @@ impl ModuleLoaderFactory for StandaloneModuleLoaderFactory {
|
||||||
root_permissions,
|
root_permissions,
|
||||||
dynamic_permissions,
|
dynamic_permissions,
|
||||||
}),
|
}),
|
||||||
source_map_getter: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ use deno_core::ModuleId;
|
||||||
use deno_core::ModuleLoader;
|
use deno_core::ModuleLoader;
|
||||||
use deno_core::PollEventLoopOptions;
|
use deno_core::PollEventLoopOptions;
|
||||||
use deno_core::SharedArrayBufferStore;
|
use deno_core::SharedArrayBufferStore;
|
||||||
use deno_core::SourceMapGetter;
|
|
||||||
use deno_runtime::code_cache;
|
use deno_runtime::code_cache;
|
||||||
use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel;
|
use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel;
|
||||||
use deno_runtime::deno_fs;
|
use deno_runtime::deno_fs;
|
||||||
|
@ -55,7 +54,6 @@ use crate::version;
|
||||||
|
|
||||||
pub struct ModuleLoaderAndSourceMapGetter {
|
pub struct ModuleLoaderAndSourceMapGetter {
|
||||||
pub module_loader: Rc<dyn ModuleLoader>,
|
pub module_loader: Rc<dyn ModuleLoader>,
|
||||||
pub source_map_getter: Option<Rc<dyn SourceMapGetter>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ModuleLoaderFactory: Send + Sync {
|
pub trait ModuleLoaderFactory: Send + Sync {
|
||||||
|
@ -516,10 +514,7 @@ impl CliMainWorkerFactory {
|
||||||
(main_module, false)
|
(main_module, false)
|
||||||
};
|
};
|
||||||
|
|
||||||
let ModuleLoaderAndSourceMapGetter {
|
let ModuleLoaderAndSourceMapGetter { module_loader } = shared
|
||||||
module_loader,
|
|
||||||
source_map_getter,
|
|
||||||
} = shared
|
|
||||||
.module_loader_factory
|
.module_loader_factory
|
||||||
.create_for_main(PermissionsContainer::allow_all(), permissions.clone());
|
.create_for_main(PermissionsContainer::allow_all(), permissions.clone());
|
||||||
let maybe_inspector_server = shared.maybe_inspector_server.clone();
|
let maybe_inspector_server = shared.maybe_inspector_server.clone();
|
||||||
|
@ -596,7 +591,6 @@ impl CliMainWorkerFactory {
|
||||||
.clone(),
|
.clone(),
|
||||||
root_cert_store_provider: Some(shared.root_cert_store_provider.clone()),
|
root_cert_store_provider: Some(shared.root_cert_store_provider.clone()),
|
||||||
seed: shared.options.seed,
|
seed: shared.options.seed,
|
||||||
source_map_getter,
|
|
||||||
format_js_error_fn: Some(Arc::new(format_js_error)),
|
format_js_error_fn: Some(Arc::new(format_js_error)),
|
||||||
create_web_worker_cb,
|
create_web_worker_cb,
|
||||||
maybe_inspector_server,
|
maybe_inspector_server,
|
||||||
|
@ -730,13 +724,11 @@ fn create_web_worker_callback(
|
||||||
Arc::new(move |args| {
|
Arc::new(move |args| {
|
||||||
let maybe_inspector_server = shared.maybe_inspector_server.clone();
|
let maybe_inspector_server = shared.maybe_inspector_server.clone();
|
||||||
|
|
||||||
let ModuleLoaderAndSourceMapGetter {
|
let ModuleLoaderAndSourceMapGetter { module_loader } =
|
||||||
module_loader,
|
shared.module_loader_factory.create_for_worker(
|
||||||
source_map_getter,
|
args.parent_permissions.clone(),
|
||||||
} = shared.module_loader_factory.create_for_worker(
|
args.permissions.clone(),
|
||||||
args.parent_permissions.clone(),
|
);
|
||||||
args.permissions.clone(),
|
|
||||||
);
|
|
||||||
let create_web_worker_cb =
|
let create_web_worker_cb =
|
||||||
create_web_worker_callback(mode, shared.clone(), stdio.clone());
|
create_web_worker_callback(mode, shared.clone(), stdio.clone());
|
||||||
|
|
||||||
|
@ -802,7 +794,6 @@ fn create_web_worker_callback(
|
||||||
seed: shared.options.seed,
|
seed: shared.options.seed,
|
||||||
create_web_worker_cb,
|
create_web_worker_cb,
|
||||||
format_js_error_fn: Some(Arc::new(format_js_error)),
|
format_js_error_fn: Some(Arc::new(format_js_error)),
|
||||||
source_map_getter,
|
|
||||||
module_loader,
|
module_loader,
|
||||||
fs: shared.fs.clone(),
|
fs: shared.fs.clone(),
|
||||||
node_resolver: Some(shared.node_resolver.clone()),
|
node_resolver: Some(shared.node_resolver.clone()),
|
||||||
|
|
|
@ -33,7 +33,7 @@ extern "C" fn call_fn(info: *const v8::FunctionCallbackInfo) {
|
||||||
let mut rv = v8::ReturnValue::from_function_callback_info(callback_info);
|
let mut rv = v8::ReturnValue::from_function_callback_info(callback_info);
|
||||||
// SAFETY: create_function guarantees that the data is a CallbackInfo external.
|
// SAFETY: create_function guarantees that the data is a CallbackInfo external.
|
||||||
let info_ptr: *mut CallbackInfo = unsafe {
|
let info_ptr: *mut CallbackInfo = unsafe {
|
||||||
let external_value = v8::Local::<v8::External>::cast(args.data());
|
let external_value = v8::Local::<v8::External>::cast_unchecked(args.data());
|
||||||
external_value.value() as _
|
external_value.value() as _
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
import { core, primordials } from "ext:core/mod.js";
|
import { core, primordials } from "ext:core/mod.js";
|
||||||
const { BadResource, Interrupted } = core;
|
const { BadResource, Interrupted, PermissionDenied } = core;
|
||||||
const { Error } = primordials;
|
const { Error } = primordials;
|
||||||
|
|
||||||
class NotFound extends Error {
|
class NotFound extends Error {
|
||||||
|
@ -11,13 +11,6 @@ class NotFound extends Error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PermissionDenied extends Error {
|
|
||||||
constructor(msg) {
|
|
||||||
super(msg);
|
|
||||||
this.name = "PermissionDenied";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ConnectionRefused extends Error {
|
class ConnectionRefused extends Error {
|
||||||
constructor(msg) {
|
constructor(msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
|
|
|
@ -387,7 +387,6 @@ function formatException(error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
core.registerErrorClass("NotFound", errors.NotFound);
|
core.registerErrorClass("NotFound", errors.NotFound);
|
||||||
core.registerErrorClass("PermissionDenied", errors.PermissionDenied);
|
|
||||||
core.registerErrorClass("ConnectionRefused", errors.ConnectionRefused);
|
core.registerErrorClass("ConnectionRefused", errors.ConnectionRefused);
|
||||||
core.registerErrorClass("ConnectionReset", errors.ConnectionReset);
|
core.registerErrorClass("ConnectionReset", errors.ConnectionReset);
|
||||||
core.registerErrorClass("ConnectionAborted", errors.ConnectionAborted);
|
core.registerErrorClass("ConnectionAborted", errors.ConnectionAborted);
|
||||||
|
|
|
@ -38,7 +38,6 @@ use deno_core::ModuleSpecifier;
|
||||||
use deno_core::PollEventLoopOptions;
|
use deno_core::PollEventLoopOptions;
|
||||||
use deno_core::RuntimeOptions;
|
use deno_core::RuntimeOptions;
|
||||||
use deno_core::SharedArrayBufferStore;
|
use deno_core::SharedArrayBufferStore;
|
||||||
use deno_core::SourceMapGetter;
|
|
||||||
use deno_cron::local::LocalCronHandler;
|
use deno_cron::local::LocalCronHandler;
|
||||||
use deno_fs::FileSystem;
|
use deno_fs::FileSystem;
|
||||||
use deno_http::DefaultHttpPropertyExtractor;
|
use deno_http::DefaultHttpPropertyExtractor;
|
||||||
|
@ -369,7 +368,6 @@ pub struct WebWorkerOptions {
|
||||||
pub npm_resolver: Option<Arc<dyn deno_node::NpmResolver>>,
|
pub npm_resolver: Option<Arc<dyn deno_node::NpmResolver>>,
|
||||||
pub create_web_worker_cb: Arc<ops::worker_host::CreateWebWorkerCb>,
|
pub create_web_worker_cb: Arc<ops::worker_host::CreateWebWorkerCb>,
|
||||||
pub format_js_error_fn: Option<Arc<FormatJsErrorFn>>,
|
pub format_js_error_fn: Option<Arc<FormatJsErrorFn>>,
|
||||||
pub source_map_getter: Option<Rc<dyn SourceMapGetter>>,
|
|
||||||
pub worker_type: WebWorkerType,
|
pub worker_type: WebWorkerType,
|
||||||
pub maybe_inspector_server: Option<Arc<InspectorServer>>,
|
pub maybe_inspector_server: Option<Arc<InspectorServer>>,
|
||||||
pub get_error_class_fn: Option<GetErrorClassFn>,
|
pub get_error_class_fn: Option<GetErrorClassFn>,
|
||||||
|
@ -546,7 +544,6 @@ impl WebWorker {
|
||||||
let mut js_runtime = JsRuntime::new(RuntimeOptions {
|
let mut js_runtime = JsRuntime::new(RuntimeOptions {
|
||||||
module_loader: Some(options.module_loader.clone()),
|
module_loader: Some(options.module_loader.clone()),
|
||||||
startup_snapshot: options.startup_snapshot,
|
startup_snapshot: options.startup_snapshot,
|
||||||
source_map_getter: options.source_map_getter,
|
|
||||||
get_error_class_fn: options.get_error_class_fn,
|
get_error_class_fn: options.get_error_class_fn,
|
||||||
shared_array_buffer_store: options.shared_array_buffer_store.clone(),
|
shared_array_buffer_store: options.shared_array_buffer_store.clone(),
|
||||||
compiled_wasm_module_store: options.compiled_wasm_module_store.clone(),
|
compiled_wasm_module_store: options.compiled_wasm_module_store.clone(),
|
||||||
|
|
|
@ -33,7 +33,6 @@ use deno_core::PollEventLoopOptions;
|
||||||
use deno_core::RuntimeOptions;
|
use deno_core::RuntimeOptions;
|
||||||
use deno_core::SharedArrayBufferStore;
|
use deno_core::SharedArrayBufferStore;
|
||||||
use deno_core::SourceCodeCacheInfo;
|
use deno_core::SourceCodeCacheInfo;
|
||||||
use deno_core::SourceMapGetter;
|
|
||||||
use deno_cron::local::LocalCronHandler;
|
use deno_cron::local::LocalCronHandler;
|
||||||
use deno_fs::FileSystem;
|
use deno_fs::FileSystem;
|
||||||
use deno_http::DefaultHttpPropertyExtractor;
|
use deno_http::DefaultHttpPropertyExtractor;
|
||||||
|
@ -162,8 +161,6 @@ pub struct WorkerOptions {
|
||||||
pub create_web_worker_cb: Arc<ops::worker_host::CreateWebWorkerCb>,
|
pub create_web_worker_cb: Arc<ops::worker_host::CreateWebWorkerCb>,
|
||||||
pub format_js_error_fn: Option<Arc<FormatJsErrorFn>>,
|
pub format_js_error_fn: Option<Arc<FormatJsErrorFn>>,
|
||||||
|
|
||||||
/// Source map reference for errors.
|
|
||||||
pub source_map_getter: Option<Rc<dyn SourceMapGetter>>,
|
|
||||||
pub maybe_inspector_server: Option<Arc<InspectorServer>>,
|
pub maybe_inspector_server: Option<Arc<InspectorServer>>,
|
||||||
// If true, the worker will wait for inspector session and break on first
|
// If true, the worker will wait for inspector session and break on first
|
||||||
// statement of user code. Takes higher precedence than
|
// statement of user code. Takes higher precedence than
|
||||||
|
@ -226,7 +223,6 @@ impl Default for WorkerOptions {
|
||||||
origin_storage_dir: Default::default(),
|
origin_storage_dir: Default::default(),
|
||||||
cache_storage_dir: Default::default(),
|
cache_storage_dir: Default::default(),
|
||||||
broadcast_channel: Default::default(),
|
broadcast_channel: Default::default(),
|
||||||
source_map_getter: Default::default(),
|
|
||||||
root_cert_store_provider: Default::default(),
|
root_cert_store_provider: Default::default(),
|
||||||
node_resolver: Default::default(),
|
node_resolver: Default::default(),
|
||||||
npm_resolver: Default::default(),
|
npm_resolver: Default::default(),
|
||||||
|
@ -486,7 +482,6 @@ impl MainWorker {
|
||||||
module_loader: Some(options.module_loader.clone()),
|
module_loader: Some(options.module_loader.clone()),
|
||||||
startup_snapshot: options.startup_snapshot,
|
startup_snapshot: options.startup_snapshot,
|
||||||
create_params: options.create_params,
|
create_params: options.create_params,
|
||||||
source_map_getter: options.source_map_getter,
|
|
||||||
skip_op_registration: options.skip_op_registration,
|
skip_op_registration: options.skip_op_registration,
|
||||||
get_error_class_fn: options.get_error_class_fn,
|
get_error_class_fn: options.get_error_class_fn,
|
||||||
shared_array_buffer_store: options.shared_array_buffer_store.clone(),
|
shared_array_buffer_store: options.shared_array_buffer_store.clone(),
|
||||||
|
|
|
@ -107,7 +107,6 @@ fn standalone_error() {
|
||||||
// On Windows, we cannot assert the file path (because '\').
|
// On Windows, we cannot assert the file path (because '\').
|
||||||
// Instead we just check for relevant output.
|
// Instead we just check for relevant output.
|
||||||
assert_contains!(stderr, "error: Uncaught (in promise) Error: boom!");
|
assert_contains!(stderr, "error: Uncaught (in promise) Error: boom!");
|
||||||
assert_contains!(stderr, "throw new Error(\"boom!\");");
|
|
||||||
assert_contains!(stderr, "\n at boom (file://");
|
assert_contains!(stderr, "\n at boom (file://");
|
||||||
assert_contains!(stderr, "standalone_error.ts:2:9");
|
assert_contains!(stderr, "standalone_error.ts:2:9");
|
||||||
assert_contains!(stderr, "at foo (file://");
|
assert_contains!(stderr, "at foo (file://");
|
||||||
|
@ -147,7 +146,6 @@ fn standalone_error_module_with_imports() {
|
||||||
// On Windows, we cannot assert the file path (because '\').
|
// On Windows, we cannot assert the file path (because '\').
|
||||||
// Instead we just check for relevant output.
|
// Instead we just check for relevant output.
|
||||||
assert_contains!(stderr, "error: Uncaught (in promise) Error: boom!");
|
assert_contains!(stderr, "error: Uncaught (in promise) Error: boom!");
|
||||||
assert_contains!(stderr, "throw new Error(\"boom!\");");
|
|
||||||
assert_contains!(stderr, "\n at file://");
|
assert_contains!(stderr, "\n at file://");
|
||||||
assert_contains!(stderr, "standalone_error_module_with_imports_2.ts:2:7");
|
assert_contains!(stderr, "standalone_error_module_with_imports_2.ts:2:7");
|
||||||
output.assert_exit_code(1);
|
output.assert_exit_code(1);
|
||||||
|
|
Loading…
Reference in a new issue