-
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: Deprecate "import assertions" with a warning #24743
feat: Deprecate "import assertions" with a warning #24743
Conversation
Should this be a linting rule so that users can call |
I'm not sure if that's feasible, I don't see anything in SWC's AST that would indicate that; see https://swc-ast.vercel.app/ and paste |
Also, @lucacasonato wants us to warn on usage of "assert" in the dependencies, which I'm currently fighting with V8 though, it appears that if V8 code cache is used then the warning is not printed - ie. only the first time you execute the warning is printed. |
Did more digging and the problem with message appearing only once is indeed the V8 code cache. So to land this PR we need to do a few things:
|
154e7cf
to
59a518b
Compare
Blocker for landing: this still only prints warning once, after that if V8 cache is used the warning will not be printed again. |
Blocked on denoland/deno_core#873. |
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.
LGTM
// NOTE(bartlomieju): this is temporary, for deprecated import assertions. | ||
// Should be removed in Deno 2. | ||
// Modules stored here should not be V8 code-cached. | ||
prevent_v8_code_cache: Arc<Mutex<HashSet<String>>>, |
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.
Does this need to be an in Arc? Maybe use DashSet
instead?
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.
I don't think it's a big deal? This code is gonna be gone in a few days anyway.
This commit deprecates "import assertions" proposal that has been
replaced with "import attributes".
Any time an import assertion is encountered a warning will be printed
to the terminal. This warning will be printed for both local and
remote files (ie. user code and dependencies).
Import assertions support will be removed in Deno 2.