diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/js/99_main.js | 18 | ||||
-rw-r--r-- | runtime/worker_bootstrap.rs | 5 |
2 files changed, 23 insertions, 0 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index c03ed2f8c..ac6161d8d 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -96,6 +96,7 @@ ObjectDefineProperties(Symbol, { let windowIsClosing = false; let globalThis_; +let verboseDeprecatedApiWarning = false; let deprecatedApiWarningDisabled = false; const ALREADY_WARNED_DEPRECATED = new SafeSet(); @@ -104,6 +105,19 @@ function warnOnDeprecatedApi(apiName, stack, ...suggestions) { return; } + if (!verboseDeprecatedApiWarning) { + if (ALREADY_WARNED_DEPRECATED.has(apiName)) { + return; + } + ALREADY_WARNED_DEPRECATED.add(apiName); + console.error( + `%cwarning: %cUse of deprecated "${apiName}" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.`, + "color: yellow;", + "font-weight: bold;", + ); + return; + } + if (ALREADY_WARNED_DEPRECATED.has(apiName + stack)) { return; } @@ -563,9 +577,11 @@ function bootstrapMainRuntime(runtimeOptions) { 5: hasNodeModulesDir, 6: maybeBinaryNpmCommandName, 7: shouldDisableDeprecatedApiWarning, + 8: shouldUseVerboseDeprecatedApiWarning, } = runtimeOptions; deprecatedApiWarningDisabled = shouldDisableDeprecatedApiWarning; + verboseDeprecatedApiWarning = shouldUseVerboseDeprecatedApiWarning; performance.setTimeOrigin(DateNow()); globalThis_ = globalThis; @@ -703,9 +719,11 @@ function bootstrapWorkerRuntime( 5: hasNodeModulesDir, 6: maybeBinaryNpmCommandName, 7: shouldDisableDeprecatedApiWarning, + 8: shouldUseVerboseDeprecatedApiWarning, } = runtimeOptions; deprecatedApiWarningDisabled = shouldDisableDeprecatedApiWarning; + verboseDeprecatedApiWarning = shouldUseVerboseDeprecatedApiWarning; performance.setTimeOrigin(DateNow()); globalThis_ = globalThis; diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index e3bfc13b9..519abf74c 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -61,6 +61,7 @@ pub struct BootstrapOptions { pub maybe_binary_npm_command_name: Option<String>, pub node_ipc_fd: Option<i64>, pub disable_deprecated_api_warning: bool, + pub verbose_deprecated_api_warning: bool, } impl Default for BootstrapOptions { @@ -90,6 +91,7 @@ impl Default for BootstrapOptions { maybe_binary_npm_command_name: None, node_ipc_fd: None, disable_deprecated_api_warning: false, + verbose_deprecated_api_warning: false, } } } @@ -121,6 +123,8 @@ struct BootstrapV8<'a>( Option<&'a str>, // disable_deprecated_api_warning, bool, + // verbose_deprecated_api_warning + bool, ); impl BootstrapOptions { @@ -141,6 +145,7 @@ impl BootstrapOptions { self.has_node_modules_dir, self.maybe_binary_npm_command_name.as_deref(), self.disable_deprecated_api_warning, + self.verbose_deprecated_api_warning, ); bootstrap.serialize(ser).unwrap() |