Skip to content

Conversation

@AtofStryker
Copy link
Contributor

@AtofStryker AtofStryker commented Oct 15, 2025

  • Closes N/A

Additional details

Converts the @packages/socket to a bundled package. Because @packages/socket contains client (browser) and server (node) code, we need to have two separate bundles:

  • browser/client is 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 use vite inside packages/app, which is expecting ESM compatible code to bundle into the app.

    • The only exception right now is @packages/extension, which expects @packages/socket to be interpreted by ts-node into CommonJS and is failing the unit-tests for that specific job. webpack knows 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
Screenshot 2025-10-16 at 12 34 24 PM Screenshot 2025-10-16 at 12 34 19 PM Screenshot 2025-10-16 at 12 26 29 PM

#32680 converts the extension code from CommonJS/Mocha to TypeScript/Vitest and bundles the actual extension code (app directory as an ESM). Since the tests will then run in Vitest and ESM, the test failures no longer become an issue. The lib of the package, which is consumed by the modules themselves, will still be in CommonJS until further progress in the ESM migration.

  • cjs/node is 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


Note

Splits @packages/socket into browser/node bundles with new entrypoints and updates repo imports/tests/builds accordingly.

  • @packages/socket:
    • Bundle outputs for distinct targets: browser/ (client) and cjs/ + esm/ (node); add build scripts and main/module/browser fields.
    • New node API: export SocketIOServer, getPathToClientSource, getClientVersion, and CDPSocketServer from lib/node index.
    • Browser API consolidated under browser/client (client, createWebsocket, CDPBrowserSocket, and SocketShape).
    • Remove legacy index.js loader; add .gitignore/.eslintignore for new build dirs; update tests to new exports.
  • Repo-wide import updates:
    • Replace @packages/socket/lib/browser and @packages/socket/lib/types with @packages/socket/browser/client.
    • Replace @packages/socket/lib/cdp-socket with @packages/socket (node export) where applicable.
    • Migrate server/extension/tests to use new SocketIOServer(...) and updated client paths.
  • Server/runtime integration:
    • Update socket server creation and CDP socket wiring in socket-base, browsers (chrome/electron), and data-context server actions/types.
    • Adjust v8-snapshot entries to new built artifact paths (https-proxy and socket outputs).
  • Docs/Status:
    • ESM migration guide: mark packages/socket as completed and list packages using the workaround.
  • System tests/fixtures:
    • Update configs and tests (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.

@AtofStryker AtofStryker self-assigned this Oct 15, 2025
cursor[bot]

This comment was marked as outdated.

@AtofStryker AtofStryker force-pushed the chore/refactor-socket branch from 2fe22ee to f5946ef Compare October 15, 2025 15:54
Base automatically changed from chore/refactor-https-proxy to develop October 15, 2025 18:00
@cypress
Copy link

cypress bot commented Oct 15, 2025

cypress    Run #66506

Run Properties:  status check passed Passed #66506  •  git commit ddf369285f: chore: bundle the browser and node entry points for packages/socket
Project cypress
Branch Review chore/refactor-socket
Run status status check passed Passed #66506
Run duration 19m 33s
Commit git commit ddf369285f: chore: bundle the browser and node entry points for packages/socket
Committer Bill Glesias
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 10
Tests that did not run due to a developer annotating a test with .skip  Pending 1097
Tests that did not run due to a failure in a mocha hook  Skipped 4
Tests that passed  Passing 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%
  Untested elements 186  
  Tested elements 158  
Accessibility  97.97%
  Failed rules  4 critical   8 serious   2 moderate   2 minor
  Failed elements 101  

@AtofStryker AtofStryker force-pushed the chore/refactor-socket branch from cb1a70d to 226d473 Compare October 15, 2025 18:25
@AtofStryker AtofStryker changed the base branch from develop to chore/refactor-socket-and-extension October 15, 2025 18:26
@AtofStryker AtofStryker force-pushed the chore/refactor-socket branch from 226d473 to ddf3692 Compare October 16, 2025 01:30

// returns
{
server: require("socket.io"),
Copy link
Contributor Author

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

@AtofStryker AtofStryker changed the title chore (DRAFT): bundle the browser and node entry points for @packages/socket chore: bundle the browser and node entry points for @packages/socket Oct 16, 2025
@AtofStryker AtofStryker merged commit 246501c into chore/refactor-socket-and-extension Oct 16, 2025
83 of 87 checks passed
@AtofStryker AtofStryker deleted the chore/refactor-socket branch October 16, 2025 22:01
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.

3 participants