-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Start warning on each use of a deprecated API #21939
Merged
bartlomieju
merged 17 commits into
denoland:main
from
bartlomieju:warn_on_deprecated_api
Jan 18, 2024
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
21969fa
feat: Start warning on each use of a deprecated API
bartlomieju 4332d9f
lint
bartlomieju 663da9d
change where deprecation happens
bartlomieju c6759ac
Merge branch 'main' into warn_on_deprecated_api
bartlomieju e4d9f12
improve the warning
bartlomieju 7a8e0c8
improve message further
bartlomieju 6dea3f8
Merge branch 'main' into warn_on_deprecated_api
bartlomieju f4d7b93
make storage more efficient, eye-candy
bartlomieju a62e36b
Merge branch 'main' into warn_on_deprecated_api
bartlomieju 4ba7120
revert some changes for now
bartlomieju 42fb12a
add a test
bartlomieju 6732f0b
primordials :)))
bartlomieju 6facb4f
Merge branch 'main' into warn_on_deprecated_api
bartlomieju 92ea4ba
Merge branch 'main' into warn_on_deprecated_api
bartlomieju 7ceda6d
allow to ignore warnings
bartlomieju 226a212
add more tests
bartlomieju a717727
Merge branch 'main' into warn_on_deprecated_api
bartlomieju File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { runEcho as runEcho2 } from "http://localhost:4545/run/warn_on_deprecated_api/mod.ts"; | ||
|
||
const p = Deno.run({ | ||
cmd: [ | ||
Deno.execPath(), | ||
"eval", | ||
"console.log('hello world')", | ||
], | ||
}); | ||
await p.status(); | ||
p.close(); | ||
|
||
async function runEcho() { | ||
const p = Deno.run({ | ||
cmd: [ | ||
Deno.execPath(), | ||
"eval", | ||
"console.log('hello world')", | ||
], | ||
}); | ||
await p.status(); | ||
p.close(); | ||
} | ||
|
||
await runEcho(); | ||
await runEcho(); | ||
|
||
for (let i = 0; i < 10; i++) { | ||
await runEcho(); | ||
} | ||
|
||
await runEcho2(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
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 | ||
|
||
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 | ||
|
||
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 | ||
|
||
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 | ||
|
||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
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 | ||
|
||
hello world |
15 changes: 15 additions & 0 deletions
15
cli/tests/testdata/run/warn_on_deprecated_api/main_disabled_env.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Download http://localhost:4545/run/warn_on_deprecated_api/mod.ts | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world |
14 changes: 14 additions & 0 deletions
14
cli/tests/testdata/run/warn_on_deprecated_api/main_disabled_flag.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world | ||
hello world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export async function runEcho() { | ||
const p = Deno.run({ | ||
cmd: [ | ||
Deno.execPath(), | ||
"eval", | ||
"console.log('hello world')", | ||
], | ||
}); | ||
await p.status(); | ||
p.close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, this accepts
DENO_NO_DEPRECATION_WARNINGS=0
. Is that deliberate?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed this comment - yeah this is deliberate. We don't want to announce and encourage use of this env var - let's consider it for internal testing purposes. We want to "force" users to move away from these APIs.