-
Couldn't load subscription status.
- Fork 3.4k
chore: bundle the browser and node entry points for @packages/socket
#32726
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: bundle the browser and node entry points for @packages/socket
#32726
Conversation
2fe22ee to
f5946ef
Compare
cypress
|
||||||||||||||||||||||||||||||||||||||||
| Project |
cypress
|
| Branch Review |
chore/refactor-socket
|
| Run status |
|
| Run duration | 19m 33s |
| Commit |
|
| Committer | Bill Glesias |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
10
|
|
|
1097
|
|
|
4
|
|
|
26251
|
| View all changes introduced in this branch ↗︎ | |
Warning
Partial Report: The results for the Application Quality reports may be incomplete.
UI Coverage
45.27%
|
|
|---|---|
|
|
186
|
|
|
158
|
Accessibility
97.97%
|
|
|---|---|
|
|
4 critical
8 serious
2 moderate
2 minor
|
|
|
101
|
cb1a70d to
226d473
Compare
226d473 to
ddf3692
Compare
|
|
||
| // returns | ||
| { | ||
| server: require("socket.io"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we only use the socket.io server export in once place and thats the extension tests in background_spec.js. Our SocketIOServer is close enough to use so instead the test will now use that implementation class
@packages/socket@packages/socket
246501c
into
chore/refactor-socket-and-extension
Additional details
Converts the
@packages/socketto a bundled package. Because@packages/socketcontains client (browser) and server (node) code, we need to have two separate bundles:browser/clientis for the browser and is compiled down to ESM. The dependencies are NOT bundled with the package and will still need a bundler. This is fine because we useviteinsidepackages/app, which is expecting ESM compatible code to bundle into the app.@packages/extension, which expects@packages/socketto be interpreted byts-nodeinto CommonJS and is failing theunit-testsfor that specific job.webpackknows how to handle this so it actually doesn't break the extension. The problem is solely with the tests.Evidence of the extension bundle working though test is failing
#32680 converts the extension code from CommonJS/Mocha to TypeScript/Vitest and bundles the actual extension code (
appdirectory as an ESM). Since the tests will then run in Vitest and ESM, the test failures no longer become an issue. Thelibof the package, which is consumed by the modules themselves, will still be in CommonJS until further progress in the ESM migration.cjs/nodeis for the node process and is compiled down to CommonJS. This will eventually change when the package is ESM-only but for now to consume the server socket the package needs to have CJS support.Steps to test
Should be able to run/build the project as well as the binary. Nothing should have significantly changed except the package is bundled and now ships with declaration types/compiled code
How has the user experience changed?
PR Tasks
cypress-documentation?type definitions?Note
Splits @packages/socket into browser/node bundles with new entrypoints and updates repo imports/tests/builds accordingly.
browser/(client) andcjs/+esm/(node); add build scripts andmain/module/browserfields.SocketIOServer,getPathToClientSource,getClientVersion, andCDPSocketServerfromlib/nodeindex.browser/client(client,createWebsocket,CDPBrowserSocket, andSocketShape).index.jsloader; add .gitignore/.eslintignore for new build dirs; update tests to new exports.@packages/socket/lib/browserand@packages/socket/lib/typeswith@packages/socket/browser/client.@packages/socket/lib/cdp-socketwith@packages/socket(node export) where applicable.new SocketIOServer(...)and updated client paths.socket-base, browsers (chrome/electron), and data-context server actions/types.packages/socketas completed and list packages using the workaround.network,server,extension, system-tests) to new client import and behavior.Written by Cursor Bugbot for commit 226d473. This will update automatically on new commits. Configure here.