Skip to content
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

chore: extract rsc to separate package #5542

Merged
merged 7 commits into from
Apr 8, 2025
Merged

chore: extract rsc to separate package #5542

merged 7 commits into from
Apr 8, 2025

Conversation

samdenty
Copy link
Member

@samdenty samdenty commented Apr 3, 2025

This removes & moves over the ai/rsc bundle to instead be in @ai-sdk/react/rsc. And also removes the dependency on react from the ai package

  • create separate ai/internal bundle with the newly needed exports (does duplication for now, separate PR will fix that)
  • update references in docs
    • subtask - add migration guide TBD in future closer to release
  • remove react & other dependencies from ai package
  • move tests to rsc package (✅ confirmed to all be running in new package)

Sorry, something went wrong.

@samdenty samdenty marked this pull request as draft April 3, 2025 23:26
package.json Outdated
Comment on lines 13 to 14
"type-check": "tsc --build",
"type-check:full": "tsc --build tsconfig.with-examples.json",
Copy link
Collaborator

Choose a reason for hiding this comment

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

which one will run in CI? important that we keep full checks there

Copy link
Member Author

Choose a reason for hiding this comment

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

i've updated it to run type-check:full in CI. I made type-checking faster in the IDE that uses the default tsconfig (including examples in it makes it way slower)

@@ -9,6 +9,7 @@
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"module": "ESNext",
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a risk that this breaks common js usage of the ai sdk?

Copy link
Collaborator

Choose a reason for hiding this comment

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

needed for the rsc move?

Copy link
Member Author

@samdenty samdenty Apr 4, 2025

Choose a reason for hiding this comment

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

i think this was required for one of the builds to work when moving to the react package cause it's got a different config, so i added it to the base since it's best practise to set the module to ESNext when you're targeting a bundler, to make sure it can do dead code removal correctly. But I can also set it in the react tsconfig itself if we want to

This just affects how typescript compiles to JS - but we pass it through tsup so it converted at later stage back to commonjs

Copy link
Member Author

Choose a reason for hiding this comment

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

it should have no effect - but i'm going to thoroughly inspect the compiled package to ensure this next

@samdenty samdenty marked this pull request as ready for review April 4, 2025 18:18
@samdenty samdenty changed the title chore: move rsc to react package chore(rsc): move rsc to react package Apr 4, 2025
@samdenty samdenty changed the title chore(rsc): move rsc to react package chore(rsc): remove & move rsc to react package Apr 4, 2025
@samdenty samdenty changed the title chore(rsc): remove & move rsc to react package chore: remove ai/rsc Apr 4, 2025
@samdenty samdenty changed the title chore: remove ai/rsc chore: remove deprecated ai/rsc Apr 4, 2025
@samdenty samdenty changed the base branch from samd/project-references to v5 April 7, 2025 15:39
@@ -1,5 +1,5 @@
{
"extends": "./node_modules/@vercel/ai-tsconfig/react-library.json",
"extends": "./node_modules/@vercel/ai-tsconfig/base.json",
"compilerOptions": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can the dom, dom.iterable libs be removed below? (worth a try)

Copy link
Member Author

Choose a reason for hiding this comment

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

i just tried and if i remove them I get this error:

CleanShot 2025-04-08 at 16 20 20@2x

@samdenty samdenty changed the title chore: move rsc to react package chore: extract rsc to separate package Apr 8, 2025
Copy link
Collaborator

@lgrammel lgrammel left a comment

Choose a reason for hiding this comment

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

Please add a changeset for ai and @ai-sdk/rsc

@samdenty samdenty merged commit e1cbf8a into v5 Apr 8, 2025
6 of 7 checks passed
@samdenty samdenty deleted the samd/update-rsc branch April 8, 2025 17:18
samdenty added a commit that referenced this pull request Apr 8, 2025
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.

None yet

2 participants