diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-08-19 21:36:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-19 22:36:35 +0200 |
commit | b5051e25c219c188f17d499ee4e101a64eb62e37 (patch) | |
tree | 88c6ab12aefd491d52e638c6e5043728412bca9b /runtime/worker.rs | |
parent | bf510544ef26b89d4c2ae935893eaf62995ed903 (diff) |
feat: Deprecate "import assertions" with a warning (#24743)
This commit deprecates "import assertions" proposal that has been
replaced with "import attributes".
Any time an import assertion is encountered a warning will be printed
to the terminal. This warning will be printed for both local and
remote files (ie. user code and dependencies).
Import assertions support will be removed in Deno 2.
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r-- | runtime/worker.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs index 696786b56..c1c918d08 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -476,6 +476,14 @@ impl MainWorker { } }); + let import_assertions_support = if options.bootstrap.future { + deno_core::ImportAssertionsSupport::Error + } else { + deno_core::ImportAssertionsSupport::CustomCallback(Box::new( + crate::shared::import_assertion_callback, + )) + }; + let mut js_runtime = JsRuntime::new(RuntimeOptions { module_loader: Some(options.module_loader.clone()), startup_snapshot: options.startup_snapshot, @@ -501,6 +509,7 @@ impl MainWorker { validate_import_attributes_cb: Some(Box::new( validate_import_attributes_callback, )), + import_assertions_support, eval_context_code_cache_cbs: options.v8_code_cache.map(|cache| { let cache_clone = cache.clone(); ( @@ -544,17 +553,6 @@ impl MainWorker { if let Some(op_summary_metrics) = op_summary_metrics { js_runtime.op_state().borrow_mut().put(op_summary_metrics); } - extern "C" fn message_handler( - _msg: v8::Local<v8::Message>, - _exception: v8::Local<v8::Value>, - ) { - // TODO(@littledivy): Propogate message to users. - } - - // Register message listener - js_runtime - .v8_isolate() - .add_message_listener(message_handler); if let Some(server) = options.maybe_inspector_server.clone() { server.register_inspector( |