Skip to content

build(core): make @stylexjs/stylex a required peerDependency - #3313

Merged
cixzhang merged 1 commit into
mainfrom
build/stylex-peer-dependency
Jul 4, 2026
Merged

cixzhang merged 1 commit into
mainfrom
build/stylex-peer-dependency

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Moves @stylexjs/stylex from dependencies to a required peerDependency (^0.18.3) for
@astryxdesign/core, so a StyleX-authoring consumer dedupes to a single shared runtime and gets a
version guardrail.

⚠️ Follow-up correction: see #3691. This peer-only declaration assumed package managers
auto-install peer dependencies. That holds for npm 7+ and pnpm, but not for Yarn (neither Yarn 1
nor Yarn Berry auto-installs peers), which leaves the StyleX runtime absent for Yarn consumers — a
hard render failure. #3691 re-adds @stylexjs/stylex to dependencies (keeping the peer) to
guarantee runtime presence on every package manager.

What merged here

Move @stylexjs/stylex from `dependencies` to a required `peerDependency`
(^0.18.3) so a consumer who authors their own StyleX shares a single
runtime with astryx (resolution dedupes to their own install, browser +
Node) instead of silently getting a second copy on version drift, and an
incompatible version is flagged at install (npm errors, pnpm/yarn warn).
Consumers who don't author StyleX are unaffected: the runtime is required
to render astryx components and is auto-installed by npm 7+ and pnpm.

Not added to devDependencies: like react/react-dom (also peers here), the
runtime resolves from the hoisted workspace for our own build/test.

Test plan:
- rm -rf all node_modules && pnpm install: @stylexjs/[email protected] at root;
  core resolves it; lockfile unchanged vs main.
- pnpm -F @astryxdesign/core build: green (esm + tsc + css + umd).
- core tests: 5038 passed; the 42 failures are pre-existing on main
  (verified on a pristine tree) and unrelated (no stylex-resolution errors).
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: astryx.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

github-actions Bot added a commit that referenced this pull request Jul 1, 2026
@imdreamrunner
imdreamrunner marked this pull request as ready for review July 1, 2026 19:12
@cixzhang
cixzhang merged commit 41cdf33 into main Jul 4, 2026
13 of 14 checks passed
@imdreamrunner imdreamrunner changed the title build(core): make @stylexjs/stylex a required peerDependency build(core): ship @stylexjs/stylex as dependency + peerDependency Jul 8, 2026
@imdreamrunner imdreamrunner changed the title build(core): ship @stylexjs/stylex as dependency + peerDependency build(core): make @stylexjs/stylex a required peerDependency Jul 8, 2026
imdreamrunner added a commit that referenced this pull request Jul 28, 2026
Follow-up to #3313, which moved @stylexjs/stylex to a peer-only
declaration. Consumer research shows the astryx base predominantly uses
Yarn, and neither Yarn 1 nor Yarn Berry auto-installs peer dependencies
(verified) — so peer-only leaves the StyleX runtime ABSENT for those
consumers, a hard render failure since every component calls
stylex.props().

Declare @stylexjs/stylex in BOTH dependencies and peerDependencies
(^0.18.3): dependencies guarantees the runtime is present on every
package manager (incl. Yarn 1/Berry); peerDependencies keeps the version
guardrail and dedupes a StyleX-authoring consumer to a single shared
runtime (browser + Node).

Test plan:
- pnpm install + pnpm -F @astryxdesign/core build: green.
- Verified: peer-only leaves the runtime absent on Yarn 1 and Yarn Berry
  4.9.2 (warning only); adding dependencies restores presence.
imdreamrunner added a commit that referenced this pull request Jul 29, 2026
Follow-up to #3313, which moved @stylexjs/stylex to a peer-only
declaration. Consumer research shows the astryx base predominantly uses
Yarn, and neither Yarn 1 nor Yarn Berry auto-installs peer dependencies
(verified) — so peer-only leaves the StyleX runtime ABSENT for those
consumers, a hard render failure since every component calls
stylex.props().

Declare @stylexjs/stylex in BOTH dependencies and peerDependencies
(^0.18.3): dependencies guarantees the runtime is present on every
package manager (incl. Yarn 1/Berry); peerDependencies keeps the version
guardrail and dedupes a StyleX-authoring consumer to a single shared
runtime (browser + Node).

Test plan:
- pnpm install + pnpm -F @astryxdesign/core build: green.
- Verified: peer-only leaves the runtime absent on Yarn 1 and Yarn Berry
  4.9.2 (warning only); adding dependencies restores presence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants