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

feat: download browsers as TAR #34033

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Dec 16, 2024

Some of our browsers are already available as .tar.br. Compared to the current .zip archives, the brotli tarballs are ~10-30% smaller. This PR makes us download brotli files for chromium and webkit.

@Skn0tt Skn0tt self-assigned this Dec 16, 2024

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@Skn0tt Skn0tt marked this pull request as ready for review December 18, 2024 14:28

This comment has been minimized.

@@ -10,6 +10,7 @@
},
"dependencies": {
"extract-zip": "2.0.1",
"tar-fs": "^3.0.6",
Copy link
Member

Choose a reason for hiding this comment

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

I understand the library is popular, but its deps list seem to be excessive for what it does a little. Did we consider alternatives?

Copy link
Member

Choose a reason for hiding this comment

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

Oh wow, "tar" is even more...

Copy link
Member Author

@Skn0tt Skn0tt Dec 19, 2024

Choose a reason for hiding this comment

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

Yes, we considered tar-fs, tar and writing our own. Writing our own turned out more complex than imagined, because webkit has very long path names and the format becomes tricky when that's involved. Of the three, tar-fs seemed the most focused.

@@ -48,8 +48,8 @@
"revision": "1011",
"installByDefault": true,
"revisionOverrides": {
"mac12": "1010",
"mac12-arm64": "1010"
"mac12": "1011",
Copy link
Member

Choose a reason for hiding this comment

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

whats the motivation for changing this?

Copy link
Member Author

Choose a reason for hiding this comment

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

1010 doesn't have .tar.br, and 1010 is identical to 1011 in functionality

This comment has been minimized.

@@ -1229,6 +2813,6 @@ END OF [email protected] AND INFORMATION

SUMMARY BEGIN HERE
=========================================
Total Packages: 48
Total Packages: 60
Copy link
Member

Choose a reason for hiding this comment

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

We are paying a 25% bump in # of deps for a feature that does not link to a user report linked. Usually not a very good sign.

Copy link
Member Author

Choose a reason for hiding this comment

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

True. It also increases the zip bundle size from 112kb to 202kb. We had this attempt of writing our own tar parser, maybe we should give it another try.

@pavelfeldman
Copy link
Member

Just as an idea, can we utilize extract-zip's non-compression mode for tar? That way we use zip for tar and don't need all this extra code? i.e. the files will be .zip.br, not .tar.br.

@Skn0tt
Copy link
Member Author

Skn0tt commented Jan 6, 2025

Just as an idea, can we utilize extract-zip's non-compression mode for tar?

That'd save some dependencies, but would result in slightly larger bundles1 and it'd prevent streaming extraction. I'd prefer to stick with TAR, gonna take a stab at reducing the bundle size for that.

Footnotes

  1. tested on firefox-mac: .zip is 92mb, .zip.br is 67.2mb and .tar.br is 65.36mb

@Skn0tt
Copy link
Member Author

Skn0tt commented Jan 6, 2025

Alright, i've vendored tar-fs and replaced all of its dependencies with the built-in equivalents. (fun fact: pump, one of the deps, ended up landing in Node.js core as stream.pipeline)

That way we're using a tried & tested tar parser, but don't pay the download price. Let me know if you like that approach, and where's the best place for a vendored module to live / any license specifics we need to follow.

Copy link
Contributor

github-actions bot commented Jan 6, 2025

Test results for "tests 1"

3 failed
❌ [installation tests] › playwright-electron-should-work.spec.ts:21:5 › electron should work @package-installations-ubuntu-latest
❌ [installation tests] › playwright-electron-should-work.spec.ts:31:5 › electron should work with special characters in path @package-installations-ubuntu-latest
❌ [installation tests] › playwright-electron-should-work.spec.ts:44:5 › should work when wrapped inside @playwright/test and trace is enabled @package-installations-ubuntu-latest

6 flaky ⚠️ [firefox-page] › page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [chromium-library] › library/popup.spec.ts:264:3 › should not throw when click closes popup @ubuntu-20.04-chromium-tip-of-tree
⚠️ [webkit-library] › library/browsercontext-clearcookies.spec.ts:146:3 › should remove cookies by name and domain @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › library/browsertype-connect.spec.ts:198:5 › run-server › should be able to connect two browsers at the same time @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:685:7 › cli codegen › should await popup @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › library/proxy.spec.ts:238:3 › should use socks proxy in second page @webkit-ubuntu-22.04-node18

37513 passed, 654 skipped
✔️✔️✔️

Merge workflow run.

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