summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/js/99_main.js128
-rw-r--r--runtime/worker_bootstrap.rs10
2 files changed, 9 insertions, 129 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index 578bde668..550304af1 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -26,8 +26,6 @@ const {
ArrayPrototypeFilter,
ArrayPrototypeIncludes,
ArrayPrototypeMap,
- ArrayPrototypePop,
- ArrayPrototypeShift,
DateNow,
Error,
ErrorPrototype,
@@ -43,11 +41,7 @@ const {
ObjectValues,
PromisePrototypeThen,
PromiseResolve,
- SafeSet,
- StringPrototypeIncludes,
StringPrototypePadEnd,
- StringPrototypeSplit,
- StringPrototypeTrim,
Symbol,
SymbolIterator,
TypeError,
@@ -116,104 +110,8 @@ ObjectDefineProperties(Symbol, {
let windowIsClosing = false;
let globalThis_;
-let verboseDeprecatedApiWarning = false;
-let deprecatedApiWarningDisabled = false;
-const ALREADY_WARNED_DEPRECATED = new SafeSet();
-
-function warnOnDeprecatedApi(apiName, stack, ...suggestions) {
- if (deprecatedApiWarningDisabled) {
- return;
- }
-
- // deno-lint-ignore no-console
- const logError = console.error;
-
- if (!verboseDeprecatedApiWarning) {
- if (ALREADY_WARNED_DEPRECATED.has(apiName)) {
- return;
- }
- ALREADY_WARNED_DEPRECATED.add(apiName);
- logError(
- `%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;
- }
-
- // If we haven't warned yet, let's do some processing of the stack trace
- // to make it more useful.
- const stackLines = StringPrototypeSplit(stack, "\n");
- ArrayPrototypeShift(stackLines);
- while (stackLines.length > 0) {
- // Filter out internal frames at the top of the stack - they are not useful
- // to the user.
- if (
- StringPrototypeIncludes(stackLines[0], "(ext:") ||
- StringPrototypeIncludes(stackLines[0], "(node:") ||
- StringPrototypeIncludes(stackLines[0], "<anonymous>")
- ) {
- ArrayPrototypeShift(stackLines);
- } else {
- break;
- }
- }
- // Now remove the last frame if it's coming from "ext:core" - this is most likely
- // event loop tick or promise handler calling a user function - again not
- // useful to the user.
- if (
- stackLines.length > 0 &&
- StringPrototypeIncludes(stackLines[stackLines.length - 1], "(ext:core/")
- ) {
- ArrayPrototypePop(stackLines);
- }
-
- let isFromRemoteDependency = false;
- const firstStackLine = stackLines[0];
- if (firstStackLine && !StringPrototypeIncludes(firstStackLine, "file:")) {
- isFromRemoteDependency = true;
- }
-
- ALREADY_WARNED_DEPRECATED.add(apiName + stack);
- logError(
- `%cwarning: %cUse of deprecated "${apiName}" API. This API will be removed in Deno 2.`,
- "color: yellow;",
- "font-weight: bold;",
- );
-
- logError();
- logError(
- "See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations",
- );
- logError();
- if (stackLines.length > 0) {
- logError("Stack trace:");
- for (let i = 0; i < stackLines.length; i++) {
- logError(` ${StringPrototypeTrim(stackLines[i])}`);
- }
- logError();
- }
-
- for (let i = 0; i < suggestions.length; i++) {
- const suggestion = suggestions[i];
- logError(
- `%chint: ${suggestion}`,
- "font-weight: bold;",
- );
- }
-
- if (isFromRemoteDependency) {
- logError(
- `%chint: It appears this API is used by a remote dependency. Try upgrading to the latest version of that dependency.`,
- "font-weight: bold;",
- );
- }
- logError();
-}
+// TODO(2.0): remove once all deprecated APIs are removed.
+function warnOnDeprecatedApi() {}
function windowClose() {
if (!windowIsClosing) {
@@ -699,14 +597,12 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
6: hasNodeModulesDir,
7: argv0,
8: nodeDebug,
- 9: shouldDisableDeprecatedApiWarning,
- 10: shouldUseVerboseDeprecatedApiWarning,
- 11: future,
- 12: mode,
- 13: servePort,
- 14: serveHost,
- 15: serveIsMain,
- 16: serveWorkerCount,
+ 9: future,
+ 10: mode,
+ 11: servePort,
+ 12: serveHost,
+ 13: serveIsMain,
+ 14: serveWorkerCount,
} = runtimeOptions;
if (mode === executionModes.serve) {
@@ -797,8 +693,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
removeImportedOps();
- deprecatedApiWarningDisabled = shouldDisableDeprecatedApiWarning;
- verboseDeprecatedApiWarning = shouldUseVerboseDeprecatedApiWarning;
performance.setTimeOrigin(DateNow());
globalThis_ = globalThis;
@@ -980,9 +874,7 @@ function bootstrapWorkerRuntime(
6: hasNodeModulesDir,
7: argv0,
8: nodeDebug,
- 9: shouldDisableDeprecatedApiWarning,
- 10: shouldUseVerboseDeprecatedApiWarning,
- 11: future,
+ 9: future,
} = runtimeOptions;
// TODO(iuioiua): remove in Deno v2. This allows us to dynamically delete
@@ -990,8 +882,6 @@ function bootstrapWorkerRuntime(
// within the Deno namespace.
internals.future = future;
- deprecatedApiWarningDisabled = shouldDisableDeprecatedApiWarning;
- verboseDeprecatedApiWarning = shouldUseVerboseDeprecatedApiWarning;
performance.setTimeOrigin(DateNow());
globalThis_ = globalThis;
diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs
index b04a337a6..b6ede466e 100644
--- a/runtime/worker_bootstrap.rs
+++ b/runtime/worker_bootstrap.rs
@@ -116,8 +116,6 @@ pub struct BootstrapOptions {
pub argv0: Option<String>,
pub node_debug: Option<String>,
pub node_ipc_fd: Option<i64>,
- pub disable_deprecated_api_warning: bool,
- pub verbose_deprecated_api_warning: bool,
pub future: bool,
pub mode: WorkerExecutionMode,
// Used by `deno serve`
@@ -155,8 +153,6 @@ impl Default for BootstrapOptions {
argv0: None,
node_debug: None,
node_ipc_fd: None,
- disable_deprecated_api_warning: false,
- verbose_deprecated_api_warning: false,
future: false,
mode: WorkerExecutionMode::None,
serve_port: Default::default(),
@@ -194,10 +190,6 @@ struct BootstrapV8<'a>(
Option<&'a str>,
// node_debug
Option<&'a str>,
- // disable_deprecated_api_warning,
- bool,
- // verbose_deprecated_api_warning
- bool,
// future
bool,
// mode
@@ -232,8 +224,6 @@ impl BootstrapOptions {
self.has_node_modules_dir,
self.argv0.as_deref(),
self.node_debug.as_deref(),
- self.disable_deprecated_api_warning,
- self.verbose_deprecated_api_warning,
self.future,
self.mode.discriminant() as _,
self.serve_port.unwrap_or_default(),