feat: make setImmediate and clearImmediate as globals (#29877)
Some checks are pending
ci / build libs (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions

Follow up to https://github.com/denoland/deno/pull/29323 and
https://github.com/denoland/deno/pull/29416.

This effort is to reduce a number of different globals available to user
code and npm dependencies. Also improves performance when these globals
are used.
This brings the number of "managed globals" down to 6. 

Towards https://github.com/denoland/deno/issues/29703
This commit is contained in:
Bartek Iwańczuk 2025-06-25 15:21:10 +02:00 committed by GitHub
parent 002a18cf03
commit d4b02455df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 8 additions and 100 deletions

View file

@ -343,26 +343,6 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec<FixSuggestion> {
)),
FixSuggestion::hint(cstr!("Use <u>import.meta.dirname</> instead.")),
];
} else if msg.contains("clearImmediate is not defined") {
return vec![
FixSuggestion::info(cstr!(
"<u>clearImmediate</> is not available in the global scope in Deno."
)),
FixSuggestion::hint_multiline(&[
cstr!("Import it explicitly with <u>import { clearImmediate } from \"node:timers\";</>,"),
cstr!("or run again with <u>--unstable-node-globals</> flag to add this global."),
]),
];
} else if msg.contains("setImmediate is not defined") {
return vec![
FixSuggestion::info(cstr!(
"<u>setImmediate</> is not available in the global scope in Deno."
)),
FixSuggestion::hint_multiline(
&[cstr!("Import it explicitly with <u>import { setImmediate } from \"node:timers\";</>,"),
cstr!("or run again with <u>--unstable-node-globals</> flag to add this global."),
]),
];
} else if msg.contains("openKv is not a function") {
return vec![
FixSuggestion::info("Deno.openKv() is an unstable API."),