mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
feat: make 'Buffer' and 'global' available as globals (#29416)
Follow up to https://github.com/denoland/deno/pull/29323. 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. Towards https://github.com/denoland/deno/issues/29703
This commit is contained in:
parent
38f6720185
commit
ed0c77edb3
9 changed files with 8 additions and 60 deletions
|
@ -343,16 +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("Buffer is not defined") {
|
||||
return vec![
|
||||
FixSuggestion::info(cstr!(
|
||||
"<u>Buffer</> is not available in the global scope in Deno."
|
||||
)),
|
||||
FixSuggestion::hint_multiline(&[
|
||||
cstr!("Import it explicitly with <u>import { Buffer } from \"node:buffer\";</>,"),
|
||||
cstr!("or run again with <u>--unstable-node-globals</> flag to add this global."),
|
||||
]),
|
||||
];
|
||||
} else if msg.contains("clearImmediate is not defined") {
|
||||
return vec![
|
||||
FixSuggestion::info(cstr!(
|
||||
|
@ -373,16 +363,6 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec<FixSuggestion> {
|
|||
cstr!("or run again with <u>--unstable-node-globals</> flag to add this global."),
|
||||
]),
|
||||
];
|
||||
} else if msg.contains("global is not defined") {
|
||||
return vec![
|
||||
FixSuggestion::info(cstr!(
|
||||
"<u>global</> is not available in the global scope in Deno."
|
||||
)),
|
||||
FixSuggestion::hint_multiline(&[
|
||||
cstr!("Use <u>globalThis</> instead, or assign <u>globalThis.global = globalThis</>,"),
|
||||
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."),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue