Skip to content

feat: add @vitejs/plugin-rsc #521

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 40 commits into from
Jul 6, 2025
Merged

feat: add @vitejs/plugin-rsc #521

merged 40 commits into from
Jul 6, 2025

Conversation

hi-ogawa
Copy link
Collaborator

@hi-ogawa hi-ogawa commented Jul 3, 2025

Description

This PR adds @vitejs/plugin-rsc, which is an exact copy of @hiogawa/vite-rsc but simply the package is renamed.

From my own development perspective, having the code in this repo doesn't seem to have any downside at least. Though the code added here is substantially large, its scope is limited to do nothing but enabling "React feature" on Vite, so I think including it here isn't too stretch. Please let me know what you think.

todo

  • ci
    • basic
      • Macos and Windows are considered flaky. Originally on my repo, only ubuntu-latest / chromium CI is required for PR merge.
    • refine trigger to reduce run depending on changes
    • release setup
  • rename @hiogawa/vite-rsc to @vitejs/plugin-rsc
  • chore
    • adjust README.md and CHANGELOG.md
    • publish first one v0.4.10-alpha.1

todo (follow up)

@hi-ogawa hi-ogawa added the trigger: preview Trigger pkg.pr.new label Jul 4, 2025
package.json Outdated
@@ -51,7 +51,7 @@
"tsx": "^4.20.3",
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.1",
"vite": "^6.3.3",
"vite": "^7.0.1",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made a PR for Vite 7 bump separately #522

@hi-ogawa hi-ogawa marked this pull request as ready for review July 4, 2025 02:12
Comment on lines +23 to +24
if (pkgName === 'plugin-rsc') return

Copy link
Member

Choose a reason for hiding this comment

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

This change will be removed later on, right? (and the one below)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure yet if I switch to ## Unreleased convention. For now, I'll let this skip and use my convention.

Copy link
Member

@sapphi-red sapphi-red Jul 4, 2025

Choose a reason for hiding this comment

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

I'm fine with that. Instead, could we have a small comment in generateChangelog method so that it's easier to find how the changelog is generated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added a comment. Probably the release flow will be to create a PR to just update CHANGELOG.md, then merge it and then run pnpm release on main.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe calling run('pnpm', ['changelog']) here would make it a bit easier? (run function: https://github.com/vitejs/vite/blob/4fc9b6424c27aca8004c368b69991a56264e4fdb/scripts/releaseUtils.ts#L8-L14)
Or the generateChangelog function I added recently can be used if you are fine with a slightly different output.
https://github.com/vitejs/vite/blob/41e83f62b1adb65f5af4c1ec006de1c845437edc/scripts/release.ts#L16-L19

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

generateChangelog probably works. Let's try that 👍

Copy link

pkg-pr-new bot commented Jul 4, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/plugin-react@521
npm i https://pkg.pr.new/@vitejs/plugin-react-oxc@521
npm i https://pkg.pr.new/@vitejs/plugin-rsc@521
npm i https://pkg.pr.new/@vitejs/plugin-react-swc@521

commit: 3557764

@hi-ogawa hi-ogawa requested a review from Copilot July 4, 2025 07:40
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new @vitejs/plugin-rsc package—a copy of @hiogawa/vite-rsc renamed and integrated into this monorepo.
Key changes:

  • Included plugin-rsc in workspace, release scripts, and CI workflow
  • Added build and test configs (vitest.config.ts, tsdown.config.ts, tsconfig*.json) for plugin-rsc
  • Introduced all source files under packages/plugin-rsc, including utilities, transforms, core logic, examples, and E2E setup

Reviewed Changes

Copilot reviewed 192 out of 208 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/release.ts Added plugin-rsc to release pipeline and changelog generation
pnpm-workspace.yaml Included packages/plugin-rsc/examples/* in workspace
packages/plugin-rsc/vitest.config.ts Vitest setup for plugin-rsc
packages/plugin-rsc/tsdown.config.ts Documentation generator config for plugin-rsc
packages/plugin-rsc/tsconfig*.json TypeScript configuration for plugin-rsc
packages/plugin-rsc/src/** All plugin runtime, transform, and core implementation
packages/plugin-rsc/examples/** Starter example and configuration files
Comments suppressed due to low confidence (1)

packages/plugin-rsc/src/vite-utils.ts:3

  • The vite-utils.ts file provides many path and URL helpers but has no accompanying unit tests; adding tests for edge cases (Windows paths, query injection, ID wrapping) will help ensure reliability.
import fs from 'node:fs'

Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

I think we should remove this line in the future. But that can be done in a separate PR.
https://github.com/hi-ogawa/vite-plugin-react/blob/35577644c85c606015d4c23b866b34386424fb9c/eslint.config.js#L16

@hi-ogawa hi-ogawa merged commit 0318334 into vitejs:main Jul 6, 2025
21 of 23 checks passed
@hi-ogawa hi-ogawa deleted the feat-rsc branch July 6, 2025 01:09
@hi-ogawa hi-ogawa mentioned this pull request Jul 6, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
trigger: preview Trigger pkg.pr.new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants