summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/99_main.js18
1 files changed, 18 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;