Skip to content
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

refactor!: plugin hooks ssr param to object #5253

Merged
merged 7 commits into from
Oct 27, 2021

Conversation

patak-dev
Copy link
Member

@patak-dev patak-dev commented Oct 11, 2021

Description

See discussion at #5109 (comment).

This PR modifies the way Vite informs ssr mode to plugin hooks from a positional param to a prop in the options object of resolveId, transform and load. This was already discussed by the team and the plugin authors.

export interface Plugin extends RollupPlugin {
    // ... other hooks
    resolveId?(this: PluginContext, source: string, importer: string | undefined, options: {
        custom?: CustomPluginOptions;
        ssr?: boolean;
    }): Promise<ResolveIdResult> | ResolveIdResult;
    load?(this: PluginContext, id: string, options?: {
        ssr?: boolean;
    }): Promise<LoadResult> | LoadResult;
    transform?(this: TransformPluginContext, code: string, id: string, options?: {
        ssr?: boolean;
    }): Promise<TransformResult> | TransformResult;
}

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@brillout
Copy link
Contributor

LGTM (Superficial review. Neat comprehensive docs update 👌.), and vite-plugin-ssr is not using server.pluginContainer.

brillout
brillout previously approved these changes Oct 11, 2021
Shinigami92
Shinigami92 previously approved these changes Oct 12, 2021
Copy link
Member

@Shinigami92 Shinigami92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to release this with 2.7, or before?
You could add this PR to the milestone dependant on the answer 🙂

@patak-dev
Copy link
Member Author

I didnt add it yet because I dont know if we are targetting 2.7 or 2.8. But given the way the ecosystem reacted, it is probably going to be in the next minor

@patak-dev patak-dev dismissed stale reviews from Shinigami92 and brillout via f57c50c October 12, 2021 20:31
@patak-dev patak-dev removed the on hold label Oct 14, 2021
@patak-dev patak-dev added this to the 2.7 milestone Oct 14, 2021
@patak-dev patak-dev added the p2-nice-to-have Not breaking anything but nice to have (priority) label Oct 14, 2021
@patak-dev patak-dev merged commit d5e51f4 into main Oct 27, 2021
@patak-dev patak-dev deleted the refactor-plugin-hooks-ssr-param branch October 27, 2021 14:06
sfriedel added a commit to nubolab-ffwd/svelte-fluent that referenced this pull request Dec 13, 2021
Adds backwards compatible handling of the plugin API changes from
Vite 2.7 (vitejs/vite#5253)
aleclarson pushed a commit to aleclarson/vite that referenced this pull request Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: ssr p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants