Skip to content

feat(rsc): support configurable CSS link props#13945

Merged
SyMind merged 8 commits into
mainfrom
feat-link-props
May 8, 2026
Merged

feat(rsc): support configurable CSS link props#13945
SyMind merged 8 commits into
mainfrom
feat-link-props

Conversation

@SyMind

@SyMind SyMind commented May 8, 2026

Copy link
Copy Markdown
Member

Summary

  • add cssLink options to RSC ServerPlugin for configuring generated stylesheet <link> props
  • expose normalized CSS link props on the RSC runtime manifest as cssLinkProps
  • apply configured props when generating CSS resource link elements for client references
  • add a config case covering custom CSS link props and disabling default precedence
new ServerPlugin({
  cssLink: {
    precedence: false,
    props: {
      as: 'style',
      'data-rspack-rsc': 'enabled',
    },
  },
}),

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions Bot added release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack. labels May 8, 2026
@codspeed-hq

codspeed-hq Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 34 untouched benchmarks


Comparing feat-link-props (4a98b02) with main (3df6bb6)

Open in CodSpeed

@SyMind

SyMind commented May 8, 2026

Copy link
Copy Markdown
Member Author

@codex review

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 4a98b02 to ci: remove unused team label workflow (#13950) by neverland

❌ Size increased by 12.00KB from 61.90MB to 61.91MB (⬆️0.02%)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f00442b812

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/node_binding/napi-binding.d.ts Outdated
@SyMind SyMind force-pushed the feat-link-props branch from f00442b to c0cbee5 Compare May 8, 2026 06:35
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 6 projects in monorepo, 5 projects with changes.

📊 Quick Summary
Project Total Size Change
popular-libs 1.7 MB -289.0 B (-0.0%)
react-10k 5.7 MB -328.0 B (-0.0%)
react-1k 826.0 KB -328.0 B (-0.0%)
react-5k 2.7 MB -328.0 B (-0.0%)
rome 1.6 MB 0
ui-components 4.8 MB -328.0 B (-0.0%)
📋 Detailed Reports (Click to expand)

📁 popular-libs

Path: ../build-tools-performance/cases/popular-libs/dist/rsdoctor-data.json

📌 Baseline Commit: 3df6bb6652 | PR: #13950

Metric Current Baseline Change
📊 Total Size 1.7 MB 1.7 MB -289.0 B (-0.0%)
📄 JavaScript 1.7 MB 1.7 MB 0
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 289.0 B -289.0 B (-100.0%)
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: popular-libs Bundle Diff

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

📌 Baseline Commit: 3df6bb6652 | PR: #13950

Metric Current Baseline Change
📊 Total Size 5.7 MB 5.7 MB -328.0 B (-0.0%)
📄 JavaScript 5.7 MB 5.7 MB 0
🎨 CSS 21.0 B 21.0 B 0
🌐 HTML 0 B 328.0 B -328.0 B (-100.0%)
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-10k Bundle Diff

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

📌 Baseline Commit: 3df6bb6652 | PR: #13950

Metric Current Baseline Change
📊 Total Size 826.0 KB 826.3 KB -328.0 B (-0.0%)
📄 JavaScript 826.0 KB 826.0 KB 0
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 328.0 B -328.0 B (-100.0%)
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-1k Bundle Diff

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

📌 Baseline Commit: 3df6bb6652 | PR: #13950

Metric Current Baseline Change
📊 Total Size 2.7 MB 2.7 MB -328.0 B (-0.0%)
📄 JavaScript 2.7 MB 2.7 MB 0
🎨 CSS 21.0 B 21.0 B 0
🌐 HTML 0 B 328.0 B -328.0 B (-100.0%)
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-5k Bundle Diff

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

📌 Baseline Commit: 3df6bb6652 | PR: #13950

Metric Current Baseline Change
📊 Total Size 4.8 MB 4.8 MB -328.0 B (-0.0%)
📄 JavaScript 4.7 MB 4.7 MB 0
🎨 CSS 106.8 KB 106.8 KB 0
🌐 HTML 0 B 328.0 B -328.0 B (-100.0%)
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: ui-components Bundle Diff

Generated by Rsdoctor GitHub Action

@SyMind

SyMind commented May 8, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0cbee5861

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/rspack_loader_swc/src/rsc_transforms/to_client_ref.rs Outdated
@SyMind

SyMind commented May 8, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SyMind SyMind marked this pull request as ready for review May 8, 2026 08:10
@SyMind SyMind requested a review from hardfist as a code owner May 8, 2026 08:10
Copilot AI review requested due to automatic review settings May 8, 2026 08:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e0e0cb272

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/rspack_binding_api/src/plugins/rsc.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for configuring the props applied to generated CSS <link> elements in the RSC pipeline, and exposes the normalized props on the RSC runtime manifest.

Changes:

  • Plumb cssLink options through the JS plugin API → N-API binding → Rust plugin state.
  • Expose normalized cssLinkProps on the RSC runtime manifest and spread them onto generated stylesheet link elements.
  • Add a new RSC config case/test covering custom CSS link props and disabling default precedence.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/rspack-test/configCases/rsc-plugin/css-link-props/test.config.js Adds a new config case harness for the CSS link props scenario.
tests/rspack-test/configCases/rsc-plugin/css-link-props/src/framework/entry.ssr.js SSR entry wiring to consume the RSC stream for the test case.
tests/rspack-test/configCases/rsc-plugin/css-link-props/src/framework/entry.rsc.js Adds assertions verifying cssLinkProps exposure and <link> generation behavior.
tests/rspack-test/configCases/rsc-plugin/css-link-props/src/framework/entry.client.js Minimal client entry placeholder for the test case.
tests/rspack-test/configCases/rsc-plugin/css-link-props/src/Client.js Client component that imports CSS to trigger stylesheet emission.
tests/rspack-test/configCases/rsc-plugin/css-link-props/src/Client.css CSS asset used by the client component.
tests/rspack-test/configCases/rsc-plugin/css-link-props/src/App.js Server entry component that renders the client component.
tests/rspack-test/configCases/rsc-plugin/css-link-props/rspack.config.js Configures ServerPlugin cssLink options and build layers for the new case.
packages/rspack/src/builtin-plugin/rsc/RscServerPlugin.ts Adds cssLink option typing and forwards it into the builtin binding.
packages/rspack/src/builtin-plugin/rsc/RscClientPlugin.ts Replaces @ts-ignore with @ts-expect-error for binding access.
crates/rspack_plugin_rsc/src/server_plugin.rs Stores css link props in plugin state and passes them into manifest construction.
crates/rspack_plugin_rsc/src/reference_manifest.rs Adds RscCssLinkProps type and includes css link props in the entry manifest.
crates/rspack_plugin_rsc/src/plugin_state.rs Persists css link props in plugin state and clears them between compilations.
crates/rspack_plugin_rsc/src/manifest_runtime_module.rs Ensures runtime manifest generation receives css link props.
crates/rspack_plugin_rsc/src/lib.rs Re-exports RscCssLinkProps for use by the binding layer.
crates/rspack_loader_swc/src/rsc_transforms/to_client_ref.rs Spreads __rspack_rsc_manifest__.cssLinkProps into generated <link> props.
crates/rspack_binding_api/src/raw_options/raw_builtins/mod.rs Adjusts downcast ownership to support updated TryFrom conversion.
crates/rspack_binding_api/src/plugins/rsc.rs Adds N-API option parsing/normalization for css link options into RscCssLinkProps.
crates/node_binding/napi-binding.d.ts Exposes cssLink options and JsRscCssLinkOptions types to TS consumers.
Comments suppressed due to low confidence (1)

crates/rspack_plugin_rsc/src/reference_manifest.rs:1

  • css_link_props is added without an explicit serde rename. Unless the struct (or module) is already using rename_all = "camelCase", this will serialize as css_link_props, but the JS runtime/tests expect cssLinkProps. Add #[serde(rename = "cssLinkProps")] on this field (or ensure a camelCase rename policy applies here) so the manifest key matches the public API.
#![allow(clippy::ref_option_ref)]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/rspack_binding_api/src/plugins/rsc.rs Outdated
Comment thread crates/rspack_binding_api/src/plugins/rsc.rs Outdated
Comment thread crates/rspack_binding_api/src/plugins/rsc.rs
@SyMind

SyMind commented May 8, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SyMind SyMind merged commit 7fbf01d into main May 8, 2026
35 checks passed
@SyMind SyMind deleted the feat-link-props branch May 8, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants