Skip to content

[pull] canary from vercel:canary #84

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

Merged
merged 8 commits into from
Apr 22, 2025
Merged

[pull] canary from vercel:canary #84

merged 8 commits into from
Apr 22, 2025

Conversation

pull[bot]
Copy link

@pull pull bot commented Apr 22, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

vercel-release-bot and others added 8 commits April 22, 2025 07:48
missing required tags error is a general error now, we don't need to have these custom type anymore
…78237)

PR #77213 introduced replacing the
custom language service and host with the `@typescript/vfs` package. It
did improve performance for large codebases, but it is still a problem
when the plugin is initialized multiple times with multiple virtual
language services from multiple apps, resulting in **freezing the IDE**.

Why did we need the "virtual language service" in the first place? It
was to support features like providing completions and diagnostics for
metadata export without explicitly setting the type. To achieve this, we
stored a copy of the file in the virtual language service with the
additional type:

```diff
- export const metadata = {}
+ export const metadata: Metadata | null = {}
```

However, the trade-off loss is big compared to the win, and it can
easily be replaced by importing the actual type — which is rational. We
should carefully reconsider the support details and revisit the
improvement. It could be a combination of semantic suggestion/warning to
add type and auto-importing.

As the first step, this PR removes the `@typescript/vfs` package and the
metadata plugin features that depend on it.
Follow up of #78237

Auto import the `Metadata` type when completing the `metadata` and
`generateMetadata` option.

- If there is a `'use ...'` top directive, add import below the
directive.
- If there is an existing Metadata import, do not add another import.
  - This includes aliases as well.


https://github.com/user-attachments/assets/5ea1ce7e-2320-41f0-ba33-af7568bbdd11
Follow up of #78237,
#78258

If the exports of metadata options are missing types, warn them to
import type to prevent breaking the app from invalid metadata.

The warning covers:

- `metadata` export
- `generateMetadata` export
  - as function
  - as async function
  - as arrow function
  - as async arrow function
  - as function expression
  - as async function expression
- all of the above as `export { ... }`


https://github.com/user-attachments/assets/a25f9734-0d36-4592-a6fb-71faa7c00dbd

---------

Co-authored-by: Sebastian "Sebbie" Silbermann <sebastian.silbermann@vercel.com>
@pull pull bot added the ⤵️ pull label Apr 22, 2025
@pull pull bot merged commit 1083e8e into code:canary Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants