Repository navigation
feat: resolve the actual browser for browser-specific code generation - #2687
devtechedge wants to merge 3 commits into
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
@devtechedge Let's resolve conflicts, yeah again 😆 I'll visit this PR, this week |
|
Thanks, Patryk, for checking in on this. I merged the latest main into the branch and resolved the conflict in resolve-config.test.ts. The PR is mergeable again now, and I have run the full test suite plus the lint and type checks locally, all of which pass. The Validate and pkg.pr.new workflow runs are still waiting on first-time contributor approval, so they have not run yet. Happy to adjust anything once you have had a chance to look at the branch. |
@wxt-dev/analytics
@wxt-dev/auto-icons
@wxt-dev/browser
@wxt-dev/i18n
@wxt-dev/is-background
@wxt-dev/module-react
@wxt-dev/module-solid
@wxt-dev/module-svelte
@wxt-dev/module-vue
@wxt-dev/runner
@wxt-dev/storage
@wxt-dev/unocss
@wxt-dev/webextension-polyfill
wxt
commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2687 +/- ##
==========================================
+ Coverage 80.44% 80.66% +0.21%
==========================================
Files 139 140 +1
Lines 4162 4173 +11
Branches 961 967 +6
==========================================
+ Hits 3348 3366 +18
+ Misses 716 710 -6
+ Partials 98 97 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Reopening #2622, which was closed by accident when my fork was deleted. Rebased onto current main.
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(571 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.