Skip to content

fix: publish source files referenced by source conditional exports - #10607

Open
Tyagiquamar wants to merge 8 commits into
adobe:mainfrom
Tyagiquamar:fix/source-export-resolution
Open

Tyagiquamar wants to merge 8 commits into
adobe:mainfrom
Tyagiquamar:fix/source-export-resolution

Conversation

@Tyagiquamar

@Tyagiquamar Tyagiquamar commented Sep 15, 2026 •

Copy link
Copy Markdown

Closes #10397.

Intent

The published react-aria, react-stately and react-aria-components packages exclude their source files but advertise source entries. Bundlers selecting the source condition can therefore resolve a file absent from the tarball.

Strip source references during packing and restore each local manifest exactly afterward. npm and Yarn use prepack/postpack; the direct Verdaccio seeder applies the same preparation and restores in a finally block. The publishConfig objects retain the repository's access-only convention.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (focused packaging tests; no storybook change applies).
  • Filled out test instructions.
  • Updated documentation (no component API change).
  • Looked at the Accessibility Practices for this feature - Aria Practices (no interaction change).
  • I understand every change in this PR and can explain why it's there.
  • If AI-assisted, I followed our AI contribution guidance and pointed my assistant at AGENTS.md.

AI assistance was used to implement and validate these review changes against AGENTS.md and the contribution guidance.

📝 Test Instructions:

Passed in Docker with Node 24 and the repository's Yarn 4.18.0:

  • Formatting check on all six changed files.
  • Oxlint on the three changed JavaScript files (0 warnings/errors).
  • yarn constraints.
  • Node syntax checks on the helper, seeder and regression test.
  • yarn jest packages/react-aria-components/test/packing.test.js --runInBand (7 passed).

The tests inspect npm and Yarn tarballs for all three packages and direct Verdaccio tarballs and registry metadata. They also verify exact restoration of local manifests. The full component build and test suite were not run locally.

🧢 Your Project:

Independent contributor.

@github-actions github-actions Bot added the RAC label Sep 15, 2026
@snowystinger snowystinger added the waiting on author Waiting on Issue Author label Oct 1, 2026
@Tyagiquamar

Copy link
Copy Markdown
Author

Updated in 146aef7:

  • Kept !src/** and !exports/** in files to ensure raw TypeScript sources are omitted from published packages.
  • Preserved local "source" export conditions for internal monorepo resolution.
  • Defined publishConfig.exports (with source: null) across react-aria-components, react-aria, and react-stately so that published packages generated by yarn pack/npm publish strip references to unbundled exports/*.ts source files.
  • Verified via yarn pack and inspected the packaged package.json and tarball archives.

@snowystinger

Copy link
Copy Markdown
Member

This is violating yarn constraints, those rules can be relaxed if it makes sense. However, right now, I don't think this works. I covers a couple cases, but we package and publish a couple different ways
nightlies publish using npm publish
verdaccio (in the CI) publishes via a custom setup
real npm publish I think frequently happens via lerna, I'm double checking this now

@snowystinger snowystinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like your new tests are failing?

"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you minimize the diff by restoring the original key order?

Comment thread scripts/verdaccio-seed.js

const files = await packlist({path: dir});
const buf = await tarballBuffer(dir, files);
const stripSource = manifest.files?.includes('!exports/**') && manifest.exports?.['.']?.source;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why were changes needed in this file? shouldn't the "prepareForPublish" handle it?

@Tyagiquamar

Copy link
Copy Markdown
Author

Thanks @snowystinger!

  1. Manifest Key Order: Restored the original key order in \packages/react-aria/package.json\ and \packages/react-stately/package.json\ to minimize the diff.
  2. **\scripts/verdaccio-seed.js**:
    pm pack\ and \yarn pack\ run the \prepack\ / \postpack\ lifecycle scripts automatically during standard publishing. However, \�erdaccio-seed.js\ directly calls
    pm-packlist\ + \ ar.create\ without invoking package lifecycle hooks, which is why it explicitly calls \prepare()\ and
    estore()\ to produce identical tarballs when seeding Verdaccio locally.

@snowystinger

Copy link
Copy Markdown
Member

Thanks, looks like tests are still failing

@Tyagiquamar

Copy link
Copy Markdown
Author

Thanks, looks like tests are still failing

CircleCI job 704079 fails in the packing test's beforeAll: Yarn enables immutable installs in CI, so the temporary fixture cannot create its initial lockfile (YN0028). Added YARN_ENABLE_IMMUTABLE_INSTALLS=false only to that fixture installation's environment.

Reproduced all seven failures before the change with CI=true in Docker. After the change, all seven npm/Yarn/Verdaccio packing cases passed with CI=true, Node 24.14.1, Yarn 4.18.0, and the lockfile's Jest 30.4.2/npm-packlist 1.4.8/tar 6.2.1. Oxfmt and JavaScript syntax checks passed. Used an isolated Node Jest configuration for this filesystem-only test; no component suite or Parcel build was run for this test-only change.

@snowystinger

Copy link
Copy Markdown
Member

@Tyagiquamar

Copy link
Copy Markdown
Author

@Tyagiquamar

Copy link
Copy Markdown
Author

done

@snowystinger

Copy link
Copy Markdown
Member

Closing and reopening to get CLA to take ahold

@snowystinger snowystinger reopened this Oct 9, 2026
@snowystinger snowystinger added ready for review and removed waiting on author Waiting on Issue Author labels Oct 9, 2026
@yihuiliao yihuiliao closed this Oct 29, 2026
@yihuiliao yihuiliao reopened this Oct 29, 2026
@yihuiliao

Copy link
Copy Markdown
Member

Seems like the CLA was not signed for whatever reason. Could you try again?

@Tyagiquamar

Copy link
Copy Markdown
Author

Seems like the CLA was not signed for whatever reason. Could you try again?

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

source conditional exports point to files omitted from npm packages

3 participants