diff options
Diffstat (limited to 'runtime/shared.rs')
-rw-r--r-- | runtime/shared.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/runtime/shared.rs b/runtime/shared.rs index 1b2136c63..c52521690 100644 --- a/runtime/shared.rs +++ b/runtime/shared.rs @@ -116,3 +116,26 @@ pub fn maybe_transpile_source( Ok((source_text.into(), maybe_source_map)) } + +pub fn import_assertion_callback( + args: deno_core::ImportAssertionsSupportCustomCallbackArgs, +) { + let mut msg = deno_terminal::colors::yellow("⚠️ Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.").to_string(); + if let Some(specifier) = args.maybe_specifier { + if let Some(source_line) = args.maybe_source_line { + msg.push_str("\n\n"); + msg.push_str(&source_line); + msg.push_str("\n\n"); + } + msg.push_str(&format!( + " at {}:{}:{}\n", + specifier, + args.maybe_line_number.unwrap(), + args.column_number + )); + #[allow(clippy::print_stderr)] + { + eprintln!("{}", msg); + } + } +} |