From 8e67bf829aa110c6318d2043e6f4f9d4c97f1a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 24 Jan 2024 20:43:31 +0100 Subject: Revert "feat: deprecate `window` global (#22057)" (#22084) This reverts commit 930ce2087051b4e45b2026ce7a77c14360a6993f. This is producing false-positives that are not actionable to users. We're gonna address this in another release. --- runtime/js/98_global_scope_window.js | 12 ++---------- runtime/js/99_main.js | 1 + 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'runtime/js') diff --git a/runtime/js/98_global_scope_window.js b/runtime/js/98_global_scope_window.js index 3188c4b4c..63b346dd5 100644 --- a/runtime/js/98_global_scope_window.js +++ b/runtime/js/98_global_scope_window.js @@ -1,6 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { core, internals, primordials } from "ext:core/mod.js"; +import { core, primordials } from "ext:core/mod.js"; const { op_bootstrap_language, op_bootstrap_numcpus, @@ -108,15 +108,7 @@ const mainRuntimeGlobalProperties = { Location: location.locationConstructorDescriptor, location: location.locationDescriptor, Window: globalInterfaces.windowConstructorDescriptor, - window: util.getterOnly(() => { - internals.warnOnDeprecatedApi( - "window", - new Error().stack, - "Use `globalThis` or `self` instead.", - "You can provide `window` in the current scope with: `const window = globalThis`.", - ); - return globalThis; - }), + window: util.getterOnly(() => globalThis), self: util.getterOnly(() => globalThis), Navigator: util.nonEnumerable(Navigator), navigator: util.getterOnly(() => navigator), diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 0cfcafbd2..c03ed2f8c 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -164,6 +164,7 @@ function warnOnDeprecatedApi(apiName, stack, ...suggestions) { "font-weight: bold;", ); } + if (isFromRemoteDependency) { console.error( `%chint: It appears this API is used by a remote dependency. Try upgrading to the latest version of that dependency.`, -- cgit v1.2.3