mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -05:00
feat: Change deprecation warning formatting (#22080)
Removes weird "frame like" characters and simplifies the output: ``` warning: Use of deprecated "Deno.isatty()" API. This API will be removed in Deno 2. Stack trace: at file:///Users/ib/dev/deno/foo.js:2:8 hint: Use `stdStream.isTerminal()` instead. warning: Use of deprecated "Deno.isatty()" API. This API will be removed in Deno 2. Stack trace: at file:///Users/ib/dev/deno/foo.js:7:8 hint: Use `stdStream.isTerminal()` instead. ``` https://github.com/denoland/deno/assets/13602871/7a6e24bf-44ec-4dbf-ac96-2af1db9f2ab9
This commit is contained in:
parent
62786cfebb
commit
50eaeabefb
2 changed files with 50 additions and 84 deletions
|
@ -1,49 +1,37 @@
|
|||
Download http://localhost:4545/run/warn_on_deprecated_api/mod.ts
|
||||
Warning
|
||||
├ Use of deprecated "Deno.run()" API.
|
||||
│
|
||||
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
|
||||
│
|
||||
├ Suggestion: Use "Deno.Command()" API instead.
|
||||
│
|
||||
└ Stack trace:
|
||||
└─ at [WILDCARD]warn_on_deprecated_api/main.js:3:16
|
||||
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
|
||||
|
||||
Stack trace:
|
||||
at [WILDCARD]warn_on_deprecated_api/main.js:3:16
|
||||
|
||||
hint: Use "Deno.Command()" API instead.
|
||||
|
||||
hello world
|
||||
Warning
|
||||
├ Use of deprecated "Deno.run()" API.
|
||||
│
|
||||
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
|
||||
│
|
||||
├ Suggestion: Use "Deno.Command()" API instead.
|
||||
│
|
||||
└ Stack trace:
|
||||
├─ at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
|
||||
└─ at [WILDCARD]warn_on_deprecated_api/main.js:25:7
|
||||
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
|
||||
|
||||
Stack trace:
|
||||
at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
|
||||
at [WILDCARD]warn_on_deprecated_api/main.js:25:7
|
||||
|
||||
hint: Use "Deno.Command()" API instead.
|
||||
|
||||
hello world
|
||||
Warning
|
||||
├ Use of deprecated "Deno.run()" API.
|
||||
│
|
||||
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
|
||||
│
|
||||
├ Suggestion: Use "Deno.Command()" API instead.
|
||||
│
|
||||
└ Stack trace:
|
||||
├─ at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
|
||||
└─ at [WILDCARD]warn_on_deprecated_api/main.js:26:7
|
||||
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
|
||||
|
||||
Stack trace:
|
||||
at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
|
||||
at [WILDCARD]warn_on_deprecated_api/main.js:26:7
|
||||
|
||||
hint: Use "Deno.Command()" API instead.
|
||||
|
||||
hello world
|
||||
Warning
|
||||
├ Use of deprecated "Deno.run()" API.
|
||||
│
|
||||
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
|
||||
│
|
||||
├ Suggestion: Use "Deno.Command()" API instead.
|
||||
│
|
||||
└ Stack trace:
|
||||
├─ at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
|
||||
└─ at [WILDCARD]warn_on_deprecated_api/main.js:29:9
|
||||
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
|
||||
|
||||
Stack trace:
|
||||
at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
|
||||
at [WILDCARD]warn_on_deprecated_api/main.js:29:9
|
||||
|
||||
hint: Use "Deno.Command()" API instead.
|
||||
|
||||
hello world
|
||||
hello world
|
||||
|
@ -55,18 +43,13 @@ hello world
|
|||
hello world
|
||||
hello world
|
||||
hello world
|
||||
Warning
|
||||
├ Use of deprecated "Deno.run()" API.
|
||||
│
|
||||
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
|
||||
│
|
||||
├ Suggestion: Use "Deno.Command()" API instead.
|
||||
│
|
||||
├ Suggestion: It appears this API is used by a remote dependency.
|
||||
│ Try upgrading to the latest version of that dependency.
|
||||
│
|
||||
└ Stack trace:
|
||||
├─ at runEcho (http://localhost:4545/run/warn_on_deprecated_api/mod.ts:2:18)
|
||||
└─ at [WILDCARD]warn_on_deprecated_api/main.js:32:7
|
||||
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
|
||||
|
||||
Stack trace:
|
||||
at runEcho (http://localhost:4545/run/warn_on_deprecated_api/mod.ts:2:18)
|
||||
at [WILDCARD]warn_on_deprecated_api/main.js:32:7
|
||||
|
||||
hint: Use "Deno.Command()" API instead.
|
||||
hint: It appears this API is used by a remote dependency. Try upgrading to the latest version of that dependency.
|
||||
|
||||
hello world
|
||||
|
|
|
@ -143,49 +143,32 @@ function warnOnDeprecatedApi(apiName, stack, ...suggestions) {
|
|||
|
||||
ALREADY_WARNED_DEPRECATED.add(apiName + stack);
|
||||
console.error(
|
||||
"%cWarning",
|
||||
"color: yellow; font-weight: bold;",
|
||||
);
|
||||
console.error(
|
||||
`%c\u251c Use of deprecated "${apiName}" API.`,
|
||||
"color: yellow;",
|
||||
);
|
||||
console.error("%c\u2502", "color: yellow;");
|
||||
console.error(
|
||||
"%c\u251c This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.",
|
||||
`%cwarning: %cUse of deprecated "${apiName}" API. This API will be removed in Deno 2.`,
|
||||
"color: yellow;",
|
||||
"font-weight: bold;",
|
||||
);
|
||||
|
||||
console.error();
|
||||
if (stackLines.length > 0) {
|
||||
console.error("Stack trace:");
|
||||
for (let i = 0; i < stackLines.length; i++) {
|
||||
console.error(` ${StringPrototypeTrim(stackLines[i])}`);
|
||||
}
|
||||
console.error();
|
||||
}
|
||||
|
||||
for (let i = 0; i < suggestions.length; i++) {
|
||||
const suggestion = suggestions[i];
|
||||
console.error("%c\u2502", "color: yellow;");
|
||||
console.error(
|
||||
`%c\u251c Suggestion: ${suggestion}`,
|
||||
"color: yellow;",
|
||||
`%chint: ${suggestion}`,
|
||||
"font-weight: bold;",
|
||||
);
|
||||
}
|
||||
if (isFromRemoteDependency) {
|
||||
console.error("%c\u2502", "color: yellow;");
|
||||
console.error(
|
||||
`%c\u251c Suggestion: It appears this API is used by a remote dependency.`,
|
||||
"color: yellow;",
|
||||
`%chint: It appears this API is used by a remote dependency. Try upgrading to the latest version of that dependency.`,
|
||||
"font-weight: bold;",
|
||||
);
|
||||
console.error(
|
||||
"%c\u2502 Try upgrading to the latest version of that dependency.",
|
||||
"color: yellow;",
|
||||
);
|
||||
}
|
||||
if (stackLines.length > 0) {
|
||||
console.error("%c\u2502", "color: yellow;");
|
||||
console.error("%c\u2514 Stack trace:", "color: yellow;");
|
||||
for (let i = 0; i < stackLines.length; i++) {
|
||||
console.error(
|
||||
`%c ${i == stackLines.length - 1 ? "\u2514" : "\u251c"}\u2500 ${
|
||||
StringPrototypeTrim(stackLines[i])
|
||||
}`,
|
||||
"color: yellow;",
|
||||
);
|
||||
}
|
||||
}
|
||||
console.error();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue