Skip to content

fix: harden 6.7.0 packaging, RSC stylis cache, and client-reference Proxy handling - #5895

Merged
quantizor merged 4 commits into
6.xfrom
fix/6.7-release-hardening
Nov 24, 2026
Merged

quantizor merged 4 commits into
6.xfrom
fix/6.7-release-hardening

Conversation

@quantizor

Copy link
Copy Markdown
Contributor

Pre-release hardening pass ahead of 6.7.0 addressing packaging, React Server Components (RSC), build, and CI issues found across unreleased changes on 6.x.

Packaging and build

  • Exclude native/node_modules/ from the published npm tarball by replacing "native" in packages/styled-components/package.json files with "native/dist" and "native/package.json".
  • Stop emitting a duplicate native/dist/dist/**/*.d.ts declaration tree by passing ...basePlugins instead of ...commonPlugins in nativeConfig.plugins (dropping 68 duplicate .d.ts files from the tarball) and clearing native/dist in prebuild.
  • Move configureServerStyles out of src/base.ts into src/index.ts so the dead stub is omitted from standalone UMD bundles.

RSC and runtime safety

  • Construct nextStylis in StyleSheetManager before updating the RSC stylis cache fields, and avoid clobbering the cache in the else if (hasStylisOptions) path, so a throwing plugin or option setup cannot poison subsequent renders.
  • Guard client-reference Proxies before in checks in flatten.ts and dev-mode ComponentStyle.ts, and tighten hasStyledComponentBrand to require a non-empty string styledComponentId while keeping isStyledComponent compatible with React Native's boolean brand.

Docs, changesets, and CI

  • Fix CommonMark backtick formatting in .changeset/global-style-function-id.md.
  • Align docs/rsc-style-injection.md and AGENTS.md with the current RSC style-injection and configureServerStyles behavior.
  • Add pnpm check:type-resolution to .github/workflows/test.yml and remove the expired [email protected] block from pnpm-workspace.yaml.

@changeset-bot

changeset-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 21b6068

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes changesets to release 1 package
Name Type
styled-components Patch

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pullfrog pullfrog 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.

ℹ️ No critical issues — one minor documentation suggestion inline.

Approach: sound — each fix targets the mechanism that produced the defect (memo keys written only after the stylis instance builds, client-reference detection moved ahead of every trap-prone probe, the tarball narrowed to the subpath entry it actually needs) rather than the symptom.

Reviewed changes

  • Published tarball — files now lists native/dist and native/package.json instead of the whole native/ directory, so the workspace-installed native/node_modules no longer ships; a new npm pack --dry-run test locks the contents.
  • Duplicate native declarations — the native rollup config uses basePlugins instead of commonPlugins, dropping the second declaration emitter that wrote native/dist/dist/**, and prebuild clears native/dist.
  • configureServerStyles — moved from base.ts to index.ts, so the standalone UMD entry no longer carries the browser stub; treeshake assertions cover all three bundle families.
  • RSC stylis memo — nextStylis is built before any memo key is written and the options-only branch no longer overwrites the shared cache, so a throwing plugin keeps throwing instead of reusing a previous request's instance.
  • Client-reference proxies — flatten checks isClientReference before the brand/keyframes/plain-object probes, the dev-mode ComponentStyle check skips client references, and hasStyledComponentBrand requires a non-empty string id while isStyledComponent keeps React Native's boolean brand.
  • CI, docs, workspace — pnpm check:type-resolution added to the test job; AGENTS.md and docs/rsc-style-injection.md aligned with the per-gate server detection and stylisPlugins={[]} behavior; expired [email protected] release-age exclusions removed.

Verified at 34c4afb5: full web suite (1040), native suite (45), pnpm --filter styled-components build including test:build (40, with the new packaging block), tsc --noEmit, prettier, and pnpm check:type-resolution with and without dist. Reverting the native rollup plugin list to ...commonPlugins regenerates native/dist/dist/** and fails the new tarball test, so it genuinely guards that regression.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

Only one commit landed since the prior Pullfrog review, and it is documentation-only:

  • Brand-shape JSDoc — isStyledComponent and hasStyledComponentBrand now state that the string styledComponentId is the web brand while true is React Native's (no class selector), and why flatten must not accept the boolean form. The claims match the code: StyledNativeComponent.ts builds via React.forwardRef and sets styledComponentId = true, and flatten routes through hasStyledComponentBrand, so the described .true hazard is real. No behavior changed (+7/−4, comments only).

The one prior review thread (missing explanation of the boolean brand) is addressed by this commit and resolved.

ℹ️ GitHub took this as a comment because it requires explicit repository access to approve or block a pull request here.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@quantizor
quantizor merged commit 7e167a4 into 6.x Nov 24, 2026
8 checks passed
@quantizor
quantizor deleted the fix/6.7-release-hardening branch November 24, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant