mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
refactor: remove environment variable functionality notice in warnOnDeprecatedApi()
(#4227)
This commit is contained in:
parent
88b5f471ed
commit
f5547f4b2d
@ -8,7 +8,7 @@ const ALREADY_WARNED_DEPRECATED = new Set<string>();
|
|||||||
const ENV_VAR_KEY = "DENO_NO_DEPRECATION_WARNINGS";
|
const ENV_VAR_KEY = "DENO_NO_DEPRECATION_WARNINGS";
|
||||||
const shouldDisableDeprecatedApiWarning =
|
const shouldDisableDeprecatedApiWarning =
|
||||||
Deno?.permissions.querySync?.({ name: "env", variable: ENV_VAR_KEY })
|
Deno?.permissions.querySync?.({ name: "env", variable: ENV_VAR_KEY })
|
||||||
.state === "granted" && Deno?.env.get(ENV_VAR_KEY) === "1";
|
.state === "granted" && Deno?.env.has(ENV_VAR_KEY);
|
||||||
|
|
||||||
interface WarnDeprecatedApiConfig {
|
interface WarnDeprecatedApiConfig {
|
||||||
/** The name of the deprecated API. */
|
/** The name of the deprecated API. */
|
||||||
@ -78,11 +78,6 @@ export function warnOnDeprecatedApi(config: WarnDeprecatedApiConfig) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("%c\u2502", "color: yellow;");
|
|
||||||
console.log(
|
|
||||||
"%c\u251c Set `DENO_NO_DEPRECATION_WARNINGS=1` to disable these deprecation warnings.",
|
|
||||||
"color: yellow;",
|
|
||||||
);
|
|
||||||
console.log("%c\u2502", "color: yellow;");
|
console.log("%c\u2502", "color: yellow;");
|
||||||
console.log("%c\u2514 Stack trace:", "color: yellow;");
|
console.log("%c\u2514 Stack trace:", "color: yellow;");
|
||||||
for (let i = 0; i < stackLines.length; i++) {
|
for (let i = 0; i < stackLines.length; i++) {
|
||||||
|
@ -20,11 +20,9 @@ Deno.test("warnDeprecatedApi()", async () => {
|
|||||||
│
|
│
|
||||||
├ Suggestion: Do something else instead.
|
├ Suggestion: Do something else instead.
|
||||||
│
|
│
|
||||||
├ Set \`DENO_NO_DEPRECATION_WARNINGS=1\` to disable these deprecation warnings.
|
|
||||||
│
|
|
||||||
└ Stack trace:
|
└ Stack trace:
|
||||||
├─ at fn (${import.meta.url}:39:12)
|
├─ at fn (${import.meta.url}:37:12)
|
||||||
└─ at ${import.meta.url}:47:31
|
└─ at ${import.meta.url}:45:31
|
||||||
|
|
||||||
Hello, world!
|
Hello, world!
|
||||||
Hello, world!
|
Hello, world!
|
||||||
|
Loading…
Reference in New Issue
Block a user