Repository navigation
feat: resolve the actual browser for browser-specific code generation - #2622
devtechedge wants to merge 1 commit into
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi - gentle follow-up on the actual-browser resolution work whenever it fits your queue. Builds keyed as This adds Tests in Validate / pkg.pr.new / Check PR Title are still waiting on first-contribution approval; Netlify preview and a few pages checks already completed successfully. Happy to reshape the default map, tighten types, or add another fixture if that would make review easier. No rush at all - still ready from my end whenever bandwidth allows. |
|
@devtechedge Closed by mistake or you don't want to go on with that? |
|
Closed by mistake, sorry about that! The PR closed when I cleaned up my forks. I'd still love to get this in. I'm rebasing it onto current |
|
Fresh PR is up: #2687 (rebased onto current main, all tests passing). |
No problem, i'll take a look on that, when i'll find some time, thanks :) |
|
Thanks Patryk, I appreciate you taking the time. No rush at all, whenever it works for you is great. Just to make it easy, the work is now in #2687, rebased onto current main with all tests passing locally. If any part of the targetBrowserMap / actualBrowser shape feels awkward when you look at it, I'm glad to adjust it or split it into smaller pieces. Happy to walk through the design decisions or add more fixtures if that helps. Looking forward to your thoughts whenever you get to it. |
I've been going through notification mailbox today. |
Overview
Fixes #2588.
Right now every build-time browser check compares
wxt.config.browseragainst a literal like"firefox"or"safari". Aniosbuild therefore misses every Safari check and generates the wrong manifest, even though it runs in Safari.This PR implements the three changes proposed in the issue:
InlineConfig#browserkeeps working exactly as before: it still drives the output directory template,import.meta.env.BROWSER, theCHROME/FIREFOX/SAFARI/EDGE/OPERAenv constants, the zip artifact name, and browser launching. Nothing changes for existing labels.InlineConfig#targetBrowserMapmaps--browserstrings to the actual browser. It defaults to:--browservaluechrome,edge,brave,opera,chromiumchromiumfirefoxfirefoxsafari,iossafariUnknown labels are not mapped to anything by default. They resolve to themselves until the project adds an entry for them, so their behavior is unchanged.
ResolvedConfig#actualBrowser: "chromium" | "firefox" | "safari"is resolved through that map and is now used for the manifest generation checks:use_dynamic_url(introduced in fix: don't set use_dynamic_url on browsers that don't support it #2581), MV2/MV3 key stripping, background/background scripts,version_name,browser_style/chrome_style,options_uiin Safari, side panels, and the Firefox warnings. The default manifest version (MV2 for Firefox and Safari) is also resolved off the actual browser now, so aniosbuild gets the same manifest as asafaribuild.The per-entrypoint
include/excludelists and per-browser entrypoint options still key off the raw--browserlabel, since those are user-authored values keyed by label.Manual Testing
resolve-config.test.ts: every default mapping resolves correctly, a customtargetBrowserMapentry wins over the defaults, unknown labels resolve to themselves,actualBrowserappears on the resolved config, and the output directory still uses the raw label while the default manifest version keys off the actual browser.iosbuild withactualBrowser: "safari"skips the Chrome-onlyuse_dynamic_urlfield.bun run checkpasses at the repo root,bun run testpasses inpackages/wxt(559 tests, one pre-existing flaky e2e that passes on re-run and is unrelated to this change).Related Issue
This PR closes #2588. Related discussion: #2581 (comment) and #2301.