Compare commits

...

230 Commits

Author SHA1 Message Date
github-actions[bot] d8a8202e63 chore(release): wxt v0.19.28
📼 VHS / Create VHS (push) Waiting to run
2025-03-04 00:26:31 +00:00
Aaron c9eb3b0ca9 fix: Allow vite 6.0.9+ (#1497) 2025-03-03 18:21:18 -06:00
Aaron 665f5a52c4 chore: Fix typo 2025-03-03 17:57:45 -06:00
Aaron 798f3b8e47 chore(deps): Upgrade to Vite 6 and related dependencies (#1496) 2025-03-03 17:52:52 -06:00
Aaron a886ab28e1 chore(deps-dev): bump happy-dom from 15.11.4 to 17.1.8 (#1495) 2025-03-03 15:06:42 -06:00
Aaron 28cff9c90a chore: Move production dependencies to PNPM 10 catelog (#1494) 2025-03-03 14:57:28 -06:00
Aaron 8ce197b023 chore: Use PNPM 10's new catelog feature (#1493) 2025-03-03 14:50:05 -06:00
dependabot[bot] a5553457c6 chore(deps): bump vite-plugin-solid from 2.10.2 to 2.11.6 (#1491)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 14:26:55 -06:00
Saksham Kushwaha 7d9ed777fb docs: Added monochromate to the homepage (#1486)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2025-03-03 14:26:09 -06:00
Aaron 59362e7274 chore: Upgrade to PNPM 10 (#1492) 2025-03-03 14:23:11 -06:00
Aaron d32d17952c chore: Update workflow emoji 2025-03-03 14:14:03 -06:00
Aaron 6630bca73f chore: Update dependabot config 2025-03-03 14:02:14 -06:00
Okinea Dev befd442075 ci: fix pr-closed.yml workflow (#1470) 2025-03-02 10:50:04 -06:00
Aaron da885ff6c8 docs: Update browser-startup.md 2025-02-27 09:59:29 -06:00
Aaron 349b216439 docs: Update entrypoints.md 2025-02-27 09:58:19 -06:00
Aaron 47b78d66cf docs: Fix typo in auto-imports.md 2025-02-27 09:45:39 -06:00
Aaron fe2baef2b1 chore: Upgrade vitepress-knowledge 2025-02-26 22:01:15 -06:00
Aaron 357bbdaec9 docs: Add AI assistant to https://wxt.dev (#1453) 2025-02-20 23:52:04 -06:00
Stefan Maric a38e3c2733 fix: regression on variable expansion in dotenv files (#1449) 2025-02-18 21:47:47 -06:00
Okinea Dev f17e527d72 chore: improve .gitattributes (#1447) 2025-02-18 07:59:31 -06:00
Okinea Dev e20de4ca0d chore: Add funding links to package.json files (#1446) 2025-02-17 15:35:01 -06:00
Aaron 16ac53e0a1 docs: Fix link to knowledge file index 2025-02-17 11:46:03 -06:00
skube fee978bf25 docs: Uses correct grammar (#1445) 2025-02-16 16:39:21 -06:00
Aaron f80909d63e docs: Host pre-aggregated LLM knowledge files (#1355) 2025-02-16 14:03:18 -06:00
Aaron d5b2503155 ci: Update pkg.pr.new workflow names 2025-02-16 12:40:54 -06:00
Aaron 80ca5760e2 docs: Fix bad alias usage in assets examples (#1443) 2025-02-16 10:12:21 -06:00
Okinea Dev 44dab3726f ci: Add PR title checker workflow and thank-you comment on merge (#1385)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2025-02-15 18:38:43 -06:00
Aaron c4295a4f4b ci: Improve main check step name 2025-02-15 10:40:51 -06:00
1natsu a6a91250d1 fix: Properly detect and reload changed files when using Vite's ?suffix imports (#1432) 2025-02-13 22:45:52 -06:00
Okinea Dev 1db50ed7a9 ci: Enhance GitHub Actions workflows (#1370)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2025-02-13 16:06:46 -06:00
Alec Larson 342057b3f5 fix: resolve wxt modules from the root (#1417) 2025-02-12 22:12:48 -06:00
John Wu 151b1392c6 docs: Add comctx to community page (#1422) 2025-02-12 21:37:37 -06:00
John Wu 1d5d0663ac docs: Add comctx to messaging docs (#1421) 2025-02-12 21:36:37 -06:00
Aaron 30b8ba495d fix: Ignore manifest.manifest_version option and warn about incorrect usage (#1419) 2025-02-12 08:43:44 -06:00
Andy Cloke 5775c9ce0f docs: Add "Python Code Runner" to homepage (#1420) 2025-02-12 02:40:59 -06:00
GitHub Actions 4f82dd87fc chore(release): wxt v0.19.27
vhs / vhs (push) Waiting to run
2025-02-12 06:31:38 +00:00
Aaron fab9fa81d1 ci: Add missing permission to release workflow 2025-02-11 23:52:15 -06:00
Jaguar Zhou d6ee4560d8 fix: auto-import does not work when using @vitejs/plugin-vue alone (#1412) 2025-02-11 23:49:59 -06:00
Alec Larson 655ba863a0 fix: respect inlineConfig.mode when setting NODE_ENV (#1416) 2025-02-11 23:44:29 -06:00
Aaron ac92d4019f fix: Support publish-browser-extension v3.0.0 2025-02-11 23:36:49 -06:00
Andy Nguyen 0ff964a04b docs: fix typo you're -> your (#1414) 2025-02-09 15:35:31 -06:00
Malix 89459f0a4d docs: Add "maintenance" to the comparison (#1404) 2025-02-08 13:58:36 -06:00
Aaron 0d56100abb docs: Fix wording around ESM background scripts 2025-02-07 23:28:24 -06:00
Aaron dc770b5952 docs: Update ESM docs to clearify that it covers configuring ESM at runtime 2025-02-07 23:24:00 -06:00
Aaron 8cd2bff67a revert: #1382 - migrate feature request template to YAML form (#1410) 2025-02-07 21:56:28 -06:00
Okinea Dev 11e55e2499 chore: Migrate feature request template to YAML form (#1382) 2025-02-07 21:52:21 -06:00
Okinea Dev 4cab3a5593 chore: Add vscode configuration (#1399) 2025-02-07 21:33:50 -06:00
st3h3n daa0eed851 fix: Use path triple slash directive for types that are referenced via path (#1407)
Co-authored-by: Stefan Hensel <stefan.hensel@varia.media>
2025-02-07 12:00:08 -06:00
Aabid 868a347d40 docs: Fixed an external link in FAQs (#1402) 2025-02-07 02:40:14 -06:00
daichan132 48a87aa352 docs: Add "Youtube Live Chat Fullscreen" to homepage (#1398) 2025-02-04 19:54:54 +01:00
Aaron dfec8a3608 chore: Cleanup CODEOWNERS file, add myself to .github dir 2025-02-01 14:31:30 -06:00
dependabot[bot] 9a71231436 chore(deps-dev): bump solid-js from 1.9.3 to 1.9.4 (#1391)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-01 14:12:44 -06:00
Aaron db4592fbb3 docs: Add community page (#1381) 2025-02-01 14:11:35 -06:00
Solaiman Islam Naiem 8551d6071e docs: Add "Walmart WFS Profit Calculator" to homepage (#1380) 2025-01-30 08:15:09 -06:00
Florian Metz c40285f750 chore(repo): add CODEOWNERS (#1377) 2025-01-29 17:32:34 -06:00
Eli 9238f9fd85 fix: Allow vite-node@^3.0.0 (#1378) 2025-01-29 17:32:14 -06:00
GitHub Actions ba3d8838e3 chore(release): @wxt-dev/module-svelte v2.0.3
vhs / vhs (push) Waiting to run
2025-01-28 21:17:33 +00:00
Eli e9b6f5f97c fix: Upgrade vite-plugin-svelte to support Vite 6 (#1375)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2025-01-28 15:09:01 -06:00
Aaron 5b6c82d38f chore: Fix formatting 2025-01-28 14:43:38 -06:00
Aaron 5b41b70abe docs: Add SECURITY.md 2025-01-28 14:41:56 -06:00
Okinea Dev 93f624610f chore: add pull request template (#1372)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2025-01-28 08:03:26 -06:00
Okinea Dev 73bdd49471 chore: simplify FUNDING.yml (#1371) 2025-01-28 07:32:59 -06:00
GitHub Actions 635f3f0898 chore(release): wxt v0.19.26
vhs / vhs (push) Waiting to run
2025-01-28 06:46:49 +00:00
Deniz Uğur a53ee6d590 fix(context): Deduplicate wxt:content-script-started (#1364)
Co-authored-by: DenizUgur <DenizUgur@users.noreply.github.com>
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2025-01-28 00:41:12 -06:00
GitHub Actions 665b9194cf chore(release): @wxt-dev/storage v1.1.0
vhs / vhs (push) Waiting to run
2025-01-28 06:40:20 +00:00
Gabriel Roldán 4690418c94 Fix: Remove duplicated css rule from vue template (#1369) 2025-01-27 16:00:09 -06:00
Chengxi 20eea2a7d1 feat: Add storage.clear (#1368)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2025-01-27 07:22:19 -06:00
rxliuli ac7b6760f2 docs: Add missing bracket in example (#1367) 2025-01-25 01:14:48 -06:00
GitHub Actions a593cfbbb6 chore(release): wxt v0.19.25
vhs / vhs (push) Waiting to run
2025-01-22 05:08:46 +00:00
Aaron a205f2a0a8 chore: Update lockfile 2025-01-21 23:03:09 -06:00
Aaron 8e2badc92b fix: Drop support for vite 6.0.9+ until websocket fix is finished 2025-01-21 23:02:22 -06:00
redwoodlid 7c18d9c0b8 docs: Add react language ID to README (#1347) 2025-01-15 10:25:40 -06:00
Aaron 55a1f39450 Update changelog 2025-01-15 10:23:36 -06:00
GitHub Actions d708eca78e chore(release): wxt v0.19.24
vhs / vhs (push) Waiting to run
2025-01-12 22:48:50 +00:00
1natsu 5d7e2516b6 fix: autoMount not working if anchor is already present (#1350) 2025-01-12 16:43:07 -06:00
Eric fb6a29872b docs: Add "HTML to Markdown" to the homepage (#1345) 2025-01-10 11:28:27 -06:00
rxliuli 187206062e docs: Update content script UI examples to use Svelte v5 (#1342) 2025-01-07 23:51:46 -06:00
Aaron 2615e29e52 docs: Add section to FAQ about teleports/portals 2025-01-07 23:37:53 -06:00
Aaron 8ca176d37e docs: Update i18n.md 2025-01-06 17:40:57 -06:00
Aaron cb2bf43f30 docs: Update content-scripts.md 2025-01-06 17:36:43 -06:00
Aaron 1719d17cff docs: Fix typo 2025-01-06 17:28:31 -06:00
Aaron 32afb8d97c docs: Improve manifest docs, mention entrypoint-specific options 2025-01-06 17:28:09 -06:00
Aaron 72b8a29d76 docs: Improve entrypoint docs 2025-01-06 17:09:20 -06:00
Aaron af0a32d478 docs: Add missing tabs in project structure 2025-01-06 16:59:23 -06:00
Nikolay Ponomarev 060e85f90e docs: Add missing web_accessible_resources to injectScript example (#1337) 2025-01-06 16:23:41 -06:00
Aaron 654a54ac79 docs: Update link 2025-01-05 10:14:49 -06:00
ntnyq ef24358942 docs: Fix unocss readme (#1329)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2025-01-04 17:01:43 -06:00
Aaron e5e67e39bd docs: Add paragraph on browser binary auto-discovery 2025-01-01 17:23:04 -06:00
Ahmed Dinar 228304bef9 docs: Added "Blync" to the homepage (#1319) 2025-01-01 08:56:07 -06:00
Paulo Pinto 78f97f32a2 fix(web-ext): Correctly pass browserConsole option to open devtools in Firefox (#1308) 2024-12-29 12:35:38 -06:00
Abhigyan Trips 459662a6c1 docs: Added "ZenGram" to the homepage (#1313) 2024-12-29 12:26:14 -06:00
Aaron b150a52471 fix(init): Remove "experimental" from bun package manager 2024-12-25 12:52:13 -06:00
Aaron 028c601515 chore: Fix typo in CLI docs 2024-12-25 12:51:41 -06:00
Aaron af382ef065 Fix changelog 2024-12-25 09:47:41 -06:00
GitHub Actions 91ef7f2ab5 chore(release): wxt v0.19.23
vhs / vhs (push) Waiting to run
2024-12-25 15:44:50 +00:00
Aaron 0bf7279c8f fix: Properly close readline instance on close (#1278) 2024-12-25 09:40:39 -06:00
Aaron 62525d33c6 fix: Allow runtime registered content scripts to not have matches (#1306) 2024-12-25 09:39:37 -06:00
Aaron 88ff40e301 docs: Fix typo in FAQ 2024-12-23 09:09:08 -06:00
Aaron 1a72a0cdc6 docs: Add paragraph on adding permissions 2024-12-22 09:14:31 -06:00
Amit Yadav 2b07b4bc12 docs: Fix invalid CSS color (#1299) 2024-12-22 09:09:49 -06:00
Abhigyan Trips 06c09e7c87 feat(hooks): Move entrypoints:resolved before debug logs and add entrypoints:found (#1292)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-12-20 21:09:31 -06:00
Amit Yadav 30b96ac87c docs: Added "Strong Password Generator" to the homepage (#1290) 2024-12-19 00:20:09 -06:00
Amit Yadav 2e9b5cffe8 docs: Added "Show IP Extension" to the homepage (#1289) 2024-12-18 17:13:11 -06:00
Aaron 3e1641a6ec docs: Add more comments on entrypoint options 2024-12-17 14:05:37 -06:00
GitHub Actions d64ca52bb0 chore(release): @wxt-dev/module-react v1.1.3
vhs / vhs (push) Waiting to run
2024-12-17 19:07:47 +00:00
Aaron 8c645fa1ce fix: Use react 19 in @wxt-dev/module-react and templates/react (#1285) 2024-12-17 12:57:50 -06:00
Nishu 79c9c89923 chore: Upgrade React to v19 in demo (#1280) 2024-12-17 12:30:48 -06:00
Aaron 11d93fe724 docs: Add pkg.pr.new docs to CONTRIBUTING.md 2024-12-17 12:05:47 -06:00
Aaron 039c561a80 chore: Simplify keyboard shortcuts (#1284) 2024-12-17 11:55:50 -06:00
GitHub Actions 64a704fc72 chore(release): @wxt-dev/module-svelte v2.0.2
vhs / vhs (push) Waiting to run
2024-12-17 16:41:07 +00:00
Aaron 4fbf137d15 fix: Svelte production errors and warnings on resolve conditions (#1283) 2024-12-17 10:35:39 -06:00
Luca Dalli ff065ab88b docs: Added "Cursorful" to the homepage (#1282) 2024-12-17 10:29:43 -06:00
Aaron 7fdf3fb968 docs: Add missing brackets to example 2024-12-16 16:12:00 -06:00
Aaron 7ebd451409 docs: Document how to use WASM 2024-12-16 16:07:16 -06:00
Aaron a7a48a8a75 docs: Add sponsors to wxt.dev homepage 2024-12-16 14:38:30 -06:00
Aaron 27298b7f22 docs: Sync READMEs 2024-12-16 14:35:16 -06:00
Aaron 565ce93a9a docs: Add sponsors section to README 2024-12-16 14:32:46 -06:00
Aaron 0bc6088b6a chore: Fix formatting 2024-12-16 13:48:41 -06:00
Aaron 2fb99e8fbb docs: Add netlify badge to homepage 2024-12-16 13:48:17 -06:00
Aaron cd2050c534 chore: Add code of conduct 2024-12-16 11:25:19 -06:00
aklinker1 5b557d0224 docs: Update wxt init GIF 2024-12-13 00:38:13 +00:00
Aaron 0137d79ba0 docs: Update colors to improve contrast ratio (#1275)
Co-authored-by: aklinker1 <aklinker1@users.noreply.github.com>
2024-12-12 18:36:24 -06:00
GitHub Actions e05fbf4fb5 chore(release): wxt v0.19.22
vhs / vhs (push) Waiting to run
2024-12-10 23:11:47 +00:00
Aaron 72e6ca5063 fix: Exclude entire import.meta.env object from content script output (#1267) 2024-12-10 17:06:25 -06:00
GitHub Actions af9e842fe0 chore(release): wxt v0.19.21
vhs / vhs (push) Waiting to run
2024-12-10 18:05:17 +00:00
Aaron 230962686f fix: Exclude skipped entrypoints from manifest (#1265) 2024-12-10 11:59:44 -06:00
GitHub Actions 413cd9354f chore(release): wxt v0.19.20
vhs / vhs (push) Waiting to run
2024-12-09 20:12:43 +00:00
不游 64a42de31f docs: fix colored-diff in es-modules.md (#1264) 2024-12-09 07:42:54 -06:00
Aaron f7f03e2669 fix: Import entrypoint improvements (#1207) 2024-12-08 12:10:05 -06:00
Aaron 1dc7c34bfd fix: Only show reopen browser shortcut when it can be done (#1263) 2024-12-08 08:55:01 -06:00
Aaron 0fd5c3846c docs: Fix gramar 2024-12-07 08:57:17 -06:00
Aaron e42e92f9df docs: Update "Using WXT" instructions 2024-12-07 08:56:13 -06:00
Kepi e45c91f941 docs: Add "EyeDropper" to homepage (#1260)
Co-authored-by: Aaron Klinker <aaronklinker1@gmail.com>
2024-12-07 08:47:33 -06:00
1natsu 8f71d80f94 feat: autoMount content script UIs (#1210)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-12-07 08:21:52 -06:00
Aaron Klinker 78e896e5fb docs: Remove duplicate section from upgrade docs 2024-12-07 01:12:23 -06:00
GitHub Actions a643852387 chore(release): wxt v0.19.19
vhs / vhs (push) Waiting to run
2024-12-06 00:28:20 +00:00
Nishu e221252325 fix: Exclude skipped entrypoints from Firefox sources zip (#1238)
Co-authored-by: Aaron Klinker <aaronklinker1@gmail.com>
2024-12-05 18:23:00 -06:00
Aaron 88f126e658 fix: Ensure content scripts are registered immediately in dev mode (#1253) 2024-12-05 18:16:38 -06:00
Aaron 17af05acc8 fix: Prevent changing dev server port when reloading config (#1241) 2024-12-05 11:48:49 -06:00
Jeremie Corpinot fd436a0d63 docs: Add "aesthetic Notion, styled" to homepage (#1247) 2024-12-04 16:00:23 -06:00
Nishu 0d796b63c2 feat: Keyboard shortcut to reopen the browser without restarting the dev command (#1211)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
Co-authored-by: Florian Metz <me@timeraa.dev>
2024-12-03 21:42:44 -06:00
GitHub Actions cb143d2bbc chore(release): wxt v0.19.18
vhs / vhs (push) Waiting to run
2024-12-03 23:00:59 +00:00
Aaron f3e7758521 types: Add overloads to ContentScriptContext#addEventListener for different targets (#1245) 2024-12-03 16:55:33 -06:00
Aaron 23ef101954 chore: Refactor findEntrypoints to return all entrypoints with skipped set properly (#1244) 2024-12-03 12:36:11 -06:00
spookyuser c2f5efbde4 docs: Update injectScript docs to match example from examples repo (#1240)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-12-03 12:23:33 -06:00
Takuya HARA 4ce178c592 docs: Changed "Chrome Extension" to "web extension" (#1229)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-12-03 11:07:46 -06:00
dependabot[bot] 7aa30afa7f chore(deps): bump codecov/codecov-action from 4 to 5 (#1237)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 16:13:47 -06:00
GitHub Actions 90aaed202c chore(release): @wxt-dev/module-svelte v2.0.1
vhs / vhs (push) Waiting to run
2024-12-01 15:33:52 +00:00
Aaron c92ed13d66 fix: Modify dev vite.resolve.conditions to support Vite 6 + Svelte 5 (#1230) 2024-12-01 09:28:30 -06:00
Jaguar Zhou 0e4953fbfc fix: correct dev.reloadCommand restriction to consider only commands with suggested keys (#1226) 2024-11-29 12:07:09 -06:00
roechsli 799d687061 docs: Add "QA Compass" to homepage (#1223) 2024-11-28 10:34:20 -06:00
Aaron 866eb0694c Cleanup changelog 2024-11-28 08:48:40 -06:00
GitHub Actions e5723aab03 chore(release): wxt v0.19.17
vhs / vhs (push) Waiting to run
2024-11-28 14:42:49 +00:00
Jaguar Zhou f51f5dd19f doc: remove dead links generated by typedoc (#1222) 2024-11-28 08:33:11 -06:00
Aaron aae5f0789d fix: Make content script matches optional (#1220) 2024-11-28 00:00:18 -06:00
1natsu 586fe3950c fix: Correctly remove child elements with integrated UI remove (#1219) 2024-11-27 22:39:25 -06:00
Aaron 241c907c65 fix: Automatically convert MV3 content_security_policy to MV2 (#1168)
Co-authored-by: windmillcode0 <michaelodumosu57@gmail.com>
Co-authored-by: windmillcode0 <shieldmousetower734@gmail.com>
2024-11-27 10:14:32 -06:00
Aaron aab4244d84 fix: Update vite dependency range to support v6 (#1215) 2024-11-26 14:26:11 -06:00
Aaron 767a3a987c chore(vue-template): Fix incompatible typescript and vue-tsc versions (#1208) 2024-11-25 15:25:42 -06:00
Aaron a2924d872a fix: Revert "Validate entrypoints after hooks have modified them (54baf21)"
This reverts commit 54baf21490.
2024-11-25 15:08:55 -06:00
Aaron 54baf21490 fix: Validate entrypoints after hooks have modified them 2024-11-25 09:29:46 -06:00
Nishu 5a3790a7d3 fix: ESLint config being generated when ESLint is not installed. (#1198)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-11-22 08:54:05 -06:00
Aaron 236e099b81 docs: Update windows config for persisting browser profile 2024-11-22 08:53:16 -06:00
GitHub Actions 9b54bc4704 chore(release): @wxt-dev/storage v1.0.1
vhs / vhs (push) Waiting to run
2024-11-22 14:41:52 +00:00
Aaron ffb99af719 fix: use browser for mv2 storage (#1200) 2024-11-22 08:36:29 -06:00
Jaguar Zhou 90bb145d91 chore(vue-template): remove references to Vetur and TypeScript Vue Plugin (Volar) (#1197) 2024-11-22 08:21:06 -06:00
Mira Dobrovolskaya 190c87d120 docs: fix typo in entrypoints options example (#1194) 2024-11-21 11:15:10 -06:00
Tran Ngoc Tan 4c511d5728 docs: Add "YouTube Hider" to homepage (#1193) 2024-11-21 03:07:45 +01:00
Florian Metz b8ecbc5a54 docs: fix analyze typo in type (#1187) 2024-11-20 08:46:42 -06:00
Nithur 8c3d756187 docs: Add "Wandpen" to homepage (#1191)
Co-authored-by: Florian Metz <me@timeraa.dev>
2024-11-20 10:18:15 +01:00
Patato cfdc6b3e6b chore: Update Svelte template to Svelte 5 (#1184)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-11-17 14:58:09 -06:00
Aaron 226e6c9fbe docs: Add FAQ around configuring browser startup 2024-11-16 11:33:58 -06:00
Aaron db41f27072 feat: New server:created, server:started, and server:closed hooks (#1179) 2024-11-16 09:29:32 -06:00
Aaron db025cd3a2 fix: Re-initialize WXT modules correctly during development (#1176) 2024-11-16 08:56:08 -06:00
GitHub Actions 57229c69c1 chore(release): @wxt-dev/module-solid v1.1.3
vhs / vhs (push) Waiting to run
2024-11-15 15:46:51 +00:00
GitHub Actions 8f3a90eeb2 chore(release): @wxt-dev/module-react v1.1.2
vhs / vhs (push) Waiting to run
2024-11-15 15:38:36 +00:00
GitHub Actions a360965d92 chore(release): @wxt-dev/module-vue v1.0.2
vhs / vhs (push) Waiting to run
2024-11-15 15:28:53 +00:00
Aaron eb1ace6d20 fix: Use config:resolved hook to update config instead of ready (#1178) 2024-11-15 09:08:14 -06:00
GitHub Actions 497c902283 chore(release): wxt v0.19.16
vhs / vhs (push) Waiting to run
2024-11-15 14:57:29 +00:00
Aaron 4d4453b830 feat(hooks): Add new config:resolved hook (#1177) 2024-11-15 08:52:22 -06:00
GitHub Actions ef53580ed1 chore(release): wxt v0.19.15
vhs / vhs (push) Waiting to run
2024-11-14 16:41:09 +00:00
Aaron 52e5387d47 fix: Add extension ID to event used to invalidate ContentScriptContext (#1175) 2024-11-14 10:30:51 -06:00
Aaron f5b7f7e0e5 docs: Cleanup changelog 2024-11-14 10:11:39 -06:00
Aaron 592bdbe4d9 chore: Speed up sync-releases workflow by not building packages 2024-11-14 10:09:40 -06:00
Aaron 6fc227bad6 chore: Init changelog for storage package 2024-11-14 10:03:55 -06:00
Aaron d74f6b0735 feat: Extract wxt/storage to its own package, @wxt-dev/storage (#1129)
vhs / vhs (push) Waiting to run
2024-11-14 10:00:08 -06:00
dsrrlldr 62ea796045 docs: Add "Invoice Generator" and "Monthly Bill Tracker" to homepage (#1174) 2024-11-14 08:01:11 -06:00
Nishu 064704c9b7 fix: Add "/" to PublicPath and browser.runtime.getURL (#1171)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-11-14 02:02:00 -06:00
Qiwei Yang c846a1febf docs: Add "Text Search Pro" to homepage (#1172) 2024-11-14 01:07:53 -06:00
Aaron c3959e8427 fix: Respect configOrPath for dev server (#1169) 2024-11-13 16:25:03 -06:00
GitHub Actions e770f9b6b7 chore(release): wxt v0.19.14
vhs / vhs (push) Waiting to run
2024-11-13 15:06:31 +00:00
Aaron 67f35615a2 chore(deps): Bump dev and non-breaking major dependencies (#1167) 2024-11-13 08:32:29 -06:00
Aaron 5c7b6098a2 chore(deps): Upgrade all non-major dependencies (#1164) 2024-11-13 08:19:40 -06:00
Willow f7d12b7486 docs: add missing cd command (#1163) 2024-11-13 08:08:32 -06:00
rxliuli 3481313859 feat: automatically disable 'Show warning about Self-XSS when pasing code' in new chrome (#1159) 2024-11-13 08:07:37 -06:00
Aaron 2f23556893 Update changelog 2024-11-13 08:07:15 -06:00
GitHub Actions 330e39159a chore(release): @wxt-dev/module-svelte v2.0.0
vhs / vhs (push) Waiting to run
2024-11-13 14:04:41 +00:00
kongmoumou aa14676f91 fix: Throw when config file does not exist (#1156)
Co-authored-by: kongmoumou <kongmoumou@users.noreply.github.com>
2024-11-13 07:59:49 -06:00
Goran Nikic 199f330324 docs: Add "propbar.co.uk" to homepage (#1149)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-11-13 07:59:14 -06:00
jasonbla 63dee97ac3 docs: fix incorrect syntax for MatchPattern (#1148) 2024-11-13 07:56:58 -06:00
nirtamir2 b121ed2fe2 docs: Fix solid-js example (#1145) 2024-11-13 07:56:34 -06:00
Johnson Towoju 607e1162e5 docs: Add "YouTube Simple View" to homepage (#1142)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-11-13 07:55:41 -06:00
dsrrlldr b4d569a915 docs: Add "Keyword Rank Checker" to homepage (#1141) 2024-11-13 07:52:30 -06:00
Aaron 4fac364542 feat!: Svelte 5 support (#1104) 2024-11-13 07:48:57 -06:00
Aaron 51c7ee5fa8 chore: Update FUNDING.yml 2024-11-11 17:19:20 -06:00
Aaron 9b780f2d00 docs: Add FAQ about component library styles in content scripts 2024-11-11 16:36:04 -06:00
Aaron f5aec7ec9b chore: Create FUNDING.yml 2024-11-11 15:29:36 -06:00
Florian Metz 5d991eda31 feat(storage): Support storage items in batch functions (#990)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-10-30 23:36:24 -05:00
Bread Grocery 0318a34046 docs: Fix typo in popup and options EntrypointOptions (#1121) 2024-10-29 08:05:13 -05:00
1natsu e7c66304d3 chore: add "@types/chrome" to templates (#1119) 2024-10-28 14:33:21 -05:00
Ayub Kokabi 4603ebb511 docs: Add missing closing bracket (#1112)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-10-28 14:33:10 -05:00
GitHub Actions ea570c12b7 chore(release): @wxt-dev/i18n v0.2.3
vhs / vhs (push) Waiting to run
2024-10-28 13:48:20 +00:00
Bread Grocery c17ce34a27 fix: Prevent app crashes from parse errors due to incomplete file saves (#1114) 2024-10-28 08:43:21 -05:00
Berkin Anik 0e4d3ad8ab docs: fix typo in introduction page (#1117) 2024-10-28 08:30:23 -05:00
Aaron 4304f71df2 docs: Add section about env vars in the manifest 2024-10-23 09:05:07 -05:00
Aaron bb5ea34396 docs: Cleanup typos and broken links 2024-10-23 09:04:43 -05:00
GitHub Actions c30adb409c chore(release): @wxt-dev/i18n v0.2.2
vhs / vhs (push) Waiting to run
2024-10-23 13:44:57 +00:00
Bread Grocery ab83031462 feat: Add support for configuring the locales directory (#1109) 2024-10-23 08:39:30 -05:00
imnaK cd7285c3ef docs: fix wrong anchor to "Environment Variables" (#1107) 2024-10-22 22:58:22 -05:00
Aaron bdb775c88d Update changelog 2024-10-22 09:58:51 -05:00
Aaron d20793d5e6 docs: Use full URLs in README so they work on the docs site 2024-10-22 09:50:57 -05:00
GitHub Actions ae1e276577 chore(release): wxt v0.19.13
vhs / vhs (push) Waiting to run
2024-10-22 13:45:03 +00:00
Craig Slusher c031c6e82e feat(env): Load env from .env.[browser] variants (#1078)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-10-22 08:36:24 -05:00
Malix d06f8128f5 enhance(docs): comparison to real footnotes (#1096)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-10-22 08:35:23 -05:00
Florian Metz 6ba12e9736 feat: unocss module (#1043)
vhs / vhs (push) Waiting to run
Co-authored-by: Aaron <aaronklinker1@gmail.com>
2024-10-22 08:28:02 -05:00
Aaron 0092556c1a fix: Don't use #private member variables in ContentScriptContext (#1103) 2024-10-22 08:04:50 -05:00
Semro 9721bca5a1 docs: Add "Sync Watch" extension to homepage (#1098) 2024-10-21 19:48:03 -05:00
Aaron 1b138f86b9 docs: Remove duplicate env data 2024-10-21 08:48:52 -05:00
GitHub Actions e839671f13 chore(release): wxt v0.19.12
vhs / vhs (push) Waiting to run
2024-10-19 19:02:32 +00:00
Aaron 842c158f96 chore: Enable extensionApi: chrome in template projects (#1083) 2024-10-19 02:38:45 -05:00
166 changed files with 9444 additions and 4224 deletions
+10
View File
@@ -0,0 +1,10 @@
extends:
- '@commitlint/config-conventional'
rules:
subject-case:
- 0
- always
- - sentence-case
- start-case
- pascal-case
- upper-case
+8
View File
@@ -1,5 +1,13 @@
# See https://git-scm.com/docs/gitattributes#_pattern_format for more about `.gitattributes`.
# Normalize EOL for all files that Git considers text files
* text=auto eol=lf
# Mark lock files as generated to avoid diffing
pnpm-lock.yaml linguist-generated
package-lock.json linguist-generated
bun.lockb linguist-generated
yarn.lock linguist-generated
# Exclude templates from language statistics
templates/**/* linguist-vendored
+9
View File
@@ -0,0 +1,9 @@
# Set default
* @aklinker1 @Timeraa
# Secure Directories
/.github/ @aklinker1
# Creator of specific wxt modules
/packages/auto-icons/ @Timeraa
/packages/unocss/ @Timeraa
+3
View File
@@ -0,0 +1,3 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository#about-funding-files
github: wxt-dev
+15 -4
View File
@@ -1,20 +1,31 @@
name: Basic Setup
description: Install PNPM, Node, and dependencies
inputs:
install:
default: 'true'
type: boolean
description: Whether or not to run 'pnpm install'
installArgs:
default: ''
type: string
description: Additional args to append to "pnpm install"
runs:
using: composite
steps:
- name: Setup PNPM
- name: 🛠️ Setup PNPM
uses: pnpm/action-setup@v4
- name: Setup NodeJS
- name: 🛠️ Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
- name: Install Dependencies
- name: 📦 Install Dependencies
if: ${{ inputs.install == 'true' }}
shell: bash
run: pnpm install
run: pnpm install ${{ inputs.installArgs }}
+1 -3
View File
@@ -6,9 +6,7 @@
version: 2
updates:
- package-ecosystem: npm
directories:
- /
- packages/*
directory: /
schedule:
interval: 'monthly'
- package-ecosystem: 'github-actions'
+13
View File
@@ -0,0 +1,13 @@
### Overview
<!-- Describe your changes and why you made them -->
### Manual Testing
<!-- Describe how to test your changes to make sure the PR works as intended -->
### Related Issue
<!-- If this PR is related to an issue, please link it here -->
This PR closes #<issue_number>
+16 -5
View File
@@ -1,4 +1,4 @@
name: Continuous Publish
name: ✨ pkg.pr.new
on:
push:
branches:
@@ -7,11 +7,22 @@ on:
branches:
- main
permissions:
contents: read
jobs:
build:
name: Publish Test Packages
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: pnpm buildc all
- run: pnpx pkg-pr-new publish --compact './packages/*'
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Build All Packages
run: pnpm buildc all
- name: Publish
run: pnpx pkg-pr-new publish --compact --pnpm './packages/*'
+29
View File
@@ -0,0 +1,29 @@
name: 🎉 PR closed
on:
pull_request_target:
types:
- closed
permissions:
contents: read
pull-requests: write
jobs:
thank-you:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Post Thank You Comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
comment: Thanks for helping make WXT better!
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.comment
})
+26
View File
@@ -0,0 +1,26 @@
name: 🛡️ Check PR Title
on:
pull_request:
types: [opened, edited]
jobs:
lint-pr-title:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# Only fetch the config file from the repository
sparse-checkout-cone-mode: false
sparse-checkout: .commitlintrc.yml
- name: Install dependencies
run: npm install --global @commitlint/config-conventional commitlint
- name: Check PR title with commitlint
env:
PR_TITLE: ${{ github.event.pull_request.title }}
HELP_URL: https://github.com/wxt-dev/wxt/blob/main/CONTRIBUTING.md#conventional-pr-titles
run: echo "$PR_TITLE" | npx commitlint --help-url $HELP_URL
+26 -8
View File
@@ -1,4 +1,4 @@
name: Publish Docs
name: 📝 Publish Docs
on:
push:
branches:
@@ -10,20 +10,38 @@ on:
required: true
default: latest
permissions:
contents: read
jobs:
publish:
# Only run if it's the upstream repository, not forks
if: github.repository == 'wxt-dev/wxt'
name: Publish Docs
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- uses: docker/login-action@v3
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: https://${{ secrets.DOCKER_REGISTRY_HOSTNAME }}
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- run: pnpm docs:build
- run: docker build docs/.vitepress -t ${{ secrets.DOCKER_REGISTRY_HOSTNAME }}/wxt/docs:${{ github.event.inputs.tag || 'latest' }}
- run: docker push ${{ secrets.DOCKER_REGISTRY_HOSTNAME }}/wxt/docs:${{ github.event.inputs.tag || 'latest' }}
- run: curl -X POST -i ${{ secrets.UPDATE_DOCS_WEBHOOK }}
- name: Build docs
run: |
pnpm docs:build
docker build docs/.vitepress -t ${{ secrets.DOCKER_REGISTRY_HOSTNAME }}/wxt/docs:${{ github.event.inputs.tag || 'latest' }}
- name: Push Image
run: docker push ${{ secrets.DOCKER_REGISTRY_HOSTNAME }}/wxt/docs:${{ github.event.inputs.tag || 'latest' }}
- name: Deploy
run: curl -X POST -i ${{ secrets.UPDATE_DOCS_WEBHOOK }}
+23 -8
View File
@@ -1,4 +1,4 @@
name: Release
name: 🚀 Release
on:
workflow_dispatch:
inputs:
@@ -13,40 +13,55 @@ on:
- module-solid
- module-svelte
- module-vue
- storage
- unocss
- wxt
permissions:
contents: read
jobs:
validate:
name: Validate
uses: './.github/workflows/validate.yml'
secrets: inherit
publish:
name: Publish
runs-on: ubuntu-22.04
permissions:
contents: write
needs:
- validate
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- name: Setup
uses: ./.github/actions/setup
- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git config --global push.followTags true
- name: Bump and Tag
run: |
git config user.email "github-actions@users.noreply.github.com"
git config user.name "GitHub Actions"
pnpm tsx scripts/bump-package-version.ts ${{ inputs.package }}
git push
git push --tags
- name: NPM
- name: Publish to NPM
working-directory: packages/${{ inputs.package }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
pnpm build
pnpm publish
working-directory: packages/${{ inputs.package }}
- name: GitHub Release
- name: Create GitHub release
run: pnpm tsx scripts/create-github-release.ts ${{ inputs.package }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+23 -9
View File
@@ -1,4 +1,4 @@
name: Sync Releases
name: 🔄 Sync Releases
on:
workflow_dispatch:
inputs:
@@ -7,20 +7,34 @@ on:
default: wxt
type: choice
options:
- wxt
- module-react
- module-vue
- module-svelte
- module-solid
- auto-icons
- i18n
- module-react
- module-solid
- module-svelte
- module-vue
- storage
- wxt
permissions:
contents: read
jobs:
sync:
name: Sync Releases
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: pnpm tsx scripts/sync-releases.ts ${{ inputs.package }}
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
with:
installArgs: --ignore-scripts
- name: Sync Releases
run: pnpm tsx scripts/sync-releases.ts ${{ inputs.package }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+86 -27
View File
@@ -1,4 +1,4 @@
name: Validate
name: 🛡️ Validate
on:
workflow_call:
pull_request:
@@ -6,46 +6,90 @@ on:
branches:
- main
permissions:
contents: read
jobs:
checks:
name: Checks
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: pnpm check
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Basic Checks
run: pnpm check
builds:
name: Builds
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: pnpm buildc all
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Build All Packages
run: pnpm buildc all
build-demo:
name: Build Demo
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: pnpm build:all
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Build
run: pnpm build:all
working-directory: packages/wxt-demo
- run: pnpm wxt zip
- name: ZIP
run: pnpm wxt zip
working-directory: packages/wxt-demo
tests:
name: Tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- uses: oven-sh/setup-bun@v2
- name: pnpm test:coverage
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Run Tests
run: pnpm test:coverage -- --reporter=default --reporter=hanging-process
- uses: codecov/codecov-action@v4
- name: Upload Coverage
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
windows-tests:
name: Windows Tests
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: pnpm test
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Run Tests
run: pnpm test
template:
name: Template
runs-on: ubuntu-22.04
strategy:
fail-fast: false
@@ -57,19 +101,34 @@ jobs:
- vanilla
- vue
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: pnpm pack
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Pack WXT package
run: pnpm pack
working-directory: packages/wxt
- run: npm i
- name: Install Dependencies
run: npm i
working-directory: templates/${{ matrix.template }}
- run: npm i -D ../../packages/wxt/wxt-*.tgz
- name: Install Packed WXT
run: npm i -D ../../packages/wxt/wxt-*.tgz
working-directory: templates/${{ matrix.template }}
- run: pnpm compile
- name: Type Check Template
run: pnpm compile
if: matrix.template != 'svelte'
working-directory: templates/${{ matrix.template }}
- run: pnpm check
- name: Type Check Template
run: pnpm check
if: matrix.template == 'svelte'
working-directory: templates/${{ matrix.template }}
- run: pnpm build
- name: Build Template
run: pnpm build
working-directory: templates/${{ matrix.template }}
+22 -7
View File
@@ -1,26 +1,41 @@
name: vhs
name: 📼 VHS
on:
push:
paths:
- 'docs/tapes/*.tape'
workflow_dispatch:
permissions:
contents: read
jobs:
vhs:
name: Create VHS
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
with:
install: 'false'
- name: Preinstall WXT
install: false
# This prevents pnpm dlx from downloading WXT in the video
- name: Pre-install WXT
run: |
pnpm store add wxt@latest
pnpm dlx wxt@latest --version
- uses: charmbracelet/vhs-action@v2.1.0
- name: Record VHS
uses: charmbracelet/vhs-action@v2.1.0
with:
path: 'docs/tapes/init-demo.tape'
- uses: stefanzweifel/git-auto-commit-action@v5
- name: Save recorded GIF
uses: stefanzweifel/git-auto-commit-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
-1
View File
@@ -6,7 +6,6 @@
.webextrc
.wxt
*.log
/.vscode/
/docs/.vitepress/cache
coverage
dist
+7
View File
@@ -0,0 +1,7 @@
{
"recommendations": [
"davidanson.vscode-markdownlint",
"esbenp.prettier-vscode",
"github.vscode-github-actions"
]
}
+14
View File
@@ -0,0 +1,14 @@
{
// Set default formatter
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[yaml]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
// Additional guidelines for Copilot
"github.copilot.chat.codeGeneration.instructions": [
{ "file": "CONTRIBUTING.md" }
]
}
+128
View File
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
aaronklinker1@gmail.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
+32 -2
View File
@@ -8,9 +8,17 @@ If you want to add a new feature, please create an issue or discussion first so
## Conventional Commits
This project uses [Conventional Commits](https://www.conventionalcommits.org/en) to automate versioning. If you're a new contributor, don't worry about this. When you open a PR, a maintainer will change the PR's title so it's in the style of conventional commits, but that's all.
This project uses [Conventional Commit format](https://www.conventionalcommits.org/en/v1.0.0/) to automatically generate a changelog and better understand the changes in the project
Maintainers, commits to the `main` branch (either directly or via PRs) must be valid conventional commits.
Here are some examples of conventional commit messages:
- `feat: add new functionality`
- `fix: correct typos in code`
- `ci: add GitHub Actions for automated testing`
## Conventional PR Titles
The title of your pull request should follow the [conventional commit format](#conventional-commits). When a pull request is merged to the main branch, all changes are going to be squashed into a single commit. The message of this commit will be the title of the pull request. And for every release, the commit messages are used to generate the changelog.
## Setup
@@ -32,6 +40,7 @@ Here are some helpful commands:
```sh
# Build WXT package
cd packages/wxt
pnpm build
```
@@ -144,3 +153,24 @@ pnpm dlx taze -r
```
Configuration is in [`taze.config.ts`](./taze.config.ts).
## Install Unreleased Versions
This repo uses https://pkg.pr.new to publish versions of all it's packages for almost every commit. You can install them via:
```sh
npm i https://pkg.pr.new/[package-name]@[ref]
```
Or use one of the shorthands:
```sh
# Install the latest build of `wxt` from a PR:
npm i https://pkg.pr.new/wxt@1283
# Install the latest build of `@wxt-dev/module-react` on the `main` branch
npm i https://pkg.pr.new/@wxt-dev/module-react@main
# Install `@wxt-dev/storage` from a specific commit:
npm i https://pkg.pr.new/@wxt-dev/module-react@426f907
```
+6
View File
@@ -75,6 +75,12 @@ Or see the [installation guide](https://wxt.dev/guide/installation.html) to get
- 📏 Bundle analysis
- ⬇️ Download and bundle remote URL imports
## Sponsors
WXT is a [MIT-licensed](https://github.com/wxt-dev/wxt/blob/main/LICENSE) open source project with its ongoing development made possible entirely by the support of these awesome backers. If you'd like to join them, please consider [sponsoring WXT's development](https://github.com/sponsors/wxt-dev).
<a href="https://github.com/sponsors/wxt-dev"><img alt="WXT Sponsors" src="https://raw.githubusercontent.com/wxt-dev/static/refs/heads/main/sponsorkit/sponsors.svg"></a>
## Contributors
<!-- automd:contributors author="aklinker1" license="MIT" github="wxt-dev/wxt" -->
+15
View File
@@ -0,0 +1,15 @@
# Security Policy
While WXT is in prerelease, only the latest version will receive security updates. The latest version is:
<img alt="npm version" src="https://img.shields.io/npm/v/wxt?labelColor=black&color=%234fa048">
<!--
## Reporting a Vulnerability
Use this section to tell people how to report a vulnerability.
Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
-->
+25 -6
View File
@@ -4,11 +4,8 @@ import useListExtensionDetails, {
ChromeExtension,
} from '../composables/useListExtensionDetails';
// Add extension IDs here. Order doesn't matter, will be sorted by weekly active users
// During the transition from chrome.google.com/webstore to
// chromewebstore.google.com, queue.wxt.dev might return null for your
// extension. If it does, use "<slug>/<id>" instead of just the ID. The slug
// can be retrieved from the URL of the item on chromewebstore.google.com
// Add extension IDs here. Order doesn't matter, will be sorted by a combination of weekly active users and rating.
// Change the commit message or PR title to: "docs: Added "[extension name]" to the homepage"
const chromeExtensionIds = [
'ocfdgncpifmegplaglcnglhioflaimkd', // GitHub: Better Line Counts
'mgmdkjcljneegjfajchedjpdhbadklcf', // Anime Skip Player
@@ -16,7 +13,7 @@ const chromeExtensionIds = [
'elfaihghhjjoknimpccccmkioofjjfkf', // StayFree - Website Blocker & Web Analytics
'okifoaikfmpfcamplcfjkpdnhfodpkil', // Doozy: Ai Made Easy
'lknmjhcajhfbbglglccadlfdjbaiifig', // tl;dv - Record, Transcribe & ChatGPT for Google Meet
'youtube中文配音/oglffgiaiekgeicdgkdlnlkhliajdlja', // Youtube中文配音
'oglffgiaiekgeicdgkdlnlkhliajdlja', // Youtube中文配音
'agjnjboanicjcpenljmaaigopkgdnihi', // PreMiD
'aiakblgmlabokilgljkglggnpflljdgp', // Markdown Sticky Notes
'nomnkbngkijpffepcgbbofhcnafpkiep', // DocVersionRedirector
@@ -49,6 +46,28 @@ const chromeExtensionIds = [
'cpaedhbidlpnbdfegakhiamfpndhjpgf', // WebChat: Chat with anyone on any website
'fcphghnknhkimeagdglkljinmpbagone', // YouTube Auto HD + FPS
'lpomjgbicdemjkgmbnkjncgdebogkhlb', // MultiViewer Companion
'ggiafipgeeaaahnjamgpjcgkdpanhddg', // Sync Watch - Watch videos together on any site
'nmldnjcblcihmegipecakhmnieiofmgl', // Keyword Rank Checker
'gppllamhaciichleihemgilcpledblpn', // YouTube Simple View - Hide distractions & more
'pccbghdfdnnkkbcdcibchpbffdgednkf', // Propbar - Property Data Enhancer
'lfknakglefggmdkjdfhhofkjnnolffkh', // Text Search Pro - Search by case and whole-word match!
'mbenhbocjckkbaojacmaepiameldglij', // Invoice Generator
'phlfhkmdofajnbhgmbmjkbkdgppgoppb', // Monthly Bill Tracker
'macmkmchfoclhpbncclinhjflmdkaoom', // Wandpen - Instantly improve your writing with AI
'lhmgechokhmdekdpgkkemoeecelcaonm', // YouTube Hider - Remove Comments By Keywords, Usernames & Tools
'imgheieooppmahcgniieddodaliodeeg', // QA Compass - Record standardized bug reports easily
'npgghjedpchajflknnbngajkjkdhncdo', // aesthetic Notion, styled
'hmdcmlfkchdmnmnmheododdhjedfccka', // Eye Dropper
'eihpmapodnppeemkhkbhikmggfojdkjd', // Cursorful - Screen Recorder with Auto Zoom
'hjjkgbibknbahijglkffklflidncplkn', // Show IP Live View of Website IPs for Developers
'ilbikcehnpkmldojkcmlldkoelofnbde', // Strong Password Generator
'ocllfkhcdopiafndigclebelbecaiocp', // ZenGram: Mindful Instagram, Your Way
'odffpjnpocjfcaclnenaaaddghkgijdb', // Blync: Preview Links, Selection Search, AI Assistant
'kofbbilhmnkcmibjbioafflgmpkbnmme', // HTML to Markdown - Convert webpages to markdown
'boecmgggeigllcdocgioijmleimjbfkg', // Walmart WFS Profit Calculator
'dlnjcbkmomenmieechnmgglgcljhoepd', // Youtube Live Chat Fullscreen
'keiealdacakpnbbljlmhfgcebmaadieg', // Python Code Runner
'hafcajcllbjnoolpfngclfmmgpikdhlm', // Monochromate
];
const { data, err, isLoading } = useListExtensionDetails(chromeExtensionIds);
+35 -2
View File
@@ -8,20 +8,35 @@ import {
prepareTypedocSidebar,
} from './utils/menus';
import { meta, script } from './utils/head';
import footnote from 'markdown-it-footnote';
import { version as wxtVersion } from '../../packages/wxt/package.json';
import { version as i18nVersion } from '../../packages/i18n/package.json';
import { version as autoIconsVersion } from '../../packages/auto-icons/package.json';
import { version as unocssVersion } from '../../packages/unocss/package.json';
import { version as storageVersion } from '../../packages/storage/package.json';
import knowledge from 'vitepress-knowledge';
const title = 'Next-gen Web Extension Framework';
const titleSuffix = ' WXT';
const description =
"WXT provides the best developer experience, making it quick, easy, and fun to develop chrome extensions for all browsers. With built-in utilities for building, zipping, and publishing your extension, it's easy to get started.";
"WXT provides the best developer experience, making it quick, easy, and fun to develop web extensions. With built-in utilities for building, zipping, and publishing your extension, it's easy to get started.";
const ogTitle = `${title}${titleSuffix}`;
const ogUrl = 'https://wxt.dev';
const ogImage = 'https://wxt.dev/social-preview.png';
// https://vitepress.dev/reference/site-config
export default defineConfig({
extends: knowledge({
serverUrl: 'https://knowledge.wxt.dev',
paths: {
'/': 'docs',
'/api/': 'api-reference',
},
pageSelectors: {
'examples.md': '#VPContent > .VPPage',
},
}),
titleTemplate: `:title${titleSuffix}`,
title: 'WXT',
description,
@@ -46,6 +61,12 @@ export default defineConfig({
}),
],
markdown: {
config: (md) => {
md.use(footnote);
},
},
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
logo: {
@@ -53,6 +74,16 @@ export default defineConfig({
alt: 'WXT logo',
},
footer: {
message: [
'<a class="light-netlify" href="https://www.netlify.com"> <img src="https://www.netlify.com/v3/img/components/netlify-color-bg.svg" alt="Deploys by Netlify" style="display: inline;" /></a>',
'<a class="dark-netlify" href="https://www.netlify.com"> <img src="https://www.netlify.com/v3/img/components/netlify-color-accent.svg" alt="Deploys by Netlify" style="display: inline;" /></a>',
'Released under the <a href="https://github.com/wxt-dev/wxt/blob/main/LICENSE">MIT License</a>.',
].join('<br/>'),
copyright:
'Copyright © 2023-present <a href="https://github.com/aklinker1">Aaron Klinker</a>',
},
editLink: {
pattern: 'https://github.com/wxt-dev/wxt/edit/main/docs/:path',
},
@@ -79,9 +110,10 @@ export default defineConfig({
),
]),
navItem('Other Packages', [
navItem(`wxt/storage — ${wxtVersion}`, '/storage'),
navItem(`@wxt-dev/storage — ${storageVersion}`, '/storage'),
navItem(`@wxt-dev/auto-icons — ${autoIconsVersion}`, '/auto-icons'),
navItem(`@wxt-dev/i18n — ${i18nVersion}`, '/i18n'),
navItem(`@wxt-dev/unocss — ${unocssVersion}`, '/unocss'),
]),
]),
],
@@ -132,6 +164,7 @@ export default defineConfig({
menuGroup('Resources', '/guide/resources/', [
menuItem('Compare', 'compare.md'),
menuItem('FAQ', 'faq.md'),
menuItem('Community', 'community.md'),
menuItem('Upgrading WXT', 'upgrading.md'),
menuItem('Migrate to WXT', 'migrate.md'),
menuItem('How WXT Works', 'how-wxt-works.md'),
+25 -56
View File
@@ -1,72 +1,28 @@
/* Colors */
:root {
--wxt-c-green: #53bc4a;
--wxt-c-green-1: #0b8a00;
--wxt-c-green-2: #096600;
--wxt-c-green-3: #096600;
--wxt-c-green-soft: rgba(11, 138, 0, 0.14);
}
.dark {
--wxt-c-green-1: #67d45e;
--wxt-c-green-2: #4fa048;
--wxt-c-green-3: #447e3f;
--wxt-c-green-2: #329929;
--wxt-c-green-3: #21651b;
--wxt-c-green-soft: rgba(103, 212, 94, 0.14);
}
/* https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css */
:root {
--vp-c-brand: var(--wxt-c-green);
--vp-c-brand-1: var(--wxt-c-green-1);
--vp-c-brand-2: var(--wxt-c-green-2);
--vp-c-brand-3: var(--wxt-c-green-3);
--vp-button-brand-bg: var(--wxt-c-green);
--vp-button-brand-hover-bg: var(--wxt-c-green-2);
--vp-button-brand-active-bg: var(--wxt-c-green-3);
--vp-code-link-color: var(--wxt-c-green);
/* --vp-c-text-1: var(--wxt-c-green-1); */
--vp-button-brand-text: var(--vp-c-black);
--vp-button-brand-hover-text: var(--vp-c-black);
--vp-button-brand-active-text: var(--vp-c-black);
--vp-custom-block-tip-border: var(--wxt-c-green);
--vp-custom-block-tip-text: var(--wxt-c-green);
/* --vp-code-block-bg: #222422;
--vp-code-copy-code-bg: #313431;
--vp-code-copy-code-hover-bg: #3c403c; */
--vp-custom-block-tip-bg: var(--vp-code-block-bg);
--vp-custom-block-info-bg: var(--vp-code-block-bg);
--vp-code-color: #476582;
--vp-c-brand-soft: var(--wxt-c-green-soft);
}
.vp-doc a {
color: var(--wxt-c-green);
}
.dark {
--vp-c-bg: #131413;
--vp-c-bg-soft: #1a1b1a;
--vp-c-bg-soft-up: #1f201f;
--vp-c-bg-soft-down: #262926;
--vp-c-bg-soft-mute: #242424;
--vp-c-bg-alt: #171817;
--vp-c-default: #313136;
--vp-c-default-1: #3a3a3c;
--vp-c-default-2: #505053;
--vp-c-default-3: #2c2c30;
--vp-c-default-soft: #252529;
--vp-code-block-bg: #191a19;
--vp-code-copy-code-bg: #212321;
--vp-code-copy-code-hover-bg: #292d29;
--vp-custom-block-info-bg: #191a19;
--vp-code-color: #c9def1;
}
/* Customize Individual Components */
.vp-doc .no-vertical-dividers th,
.vp-doc .no-vertical-dividers td {
@@ -97,3 +53,16 @@ body {
vertical-align: middle;
background-color: var(--vp-c-default-2);
}
.light-netlify {
display: inline;
}
.dark .light-netlify {
display: none;
}
.dark-netlify {
display: none;
}
.dark .dark-netlify {
display: inline;
}
+2 -2
View File
@@ -28,13 +28,13 @@ export function menuRoot(items: SidebarItem[]) {
export function menuGroup(
text: string,
items: SidebarItem[],
collapsable?: boolean,
collapsible?: boolean,
): SidebarItem;
export function menuGroup(
text: string,
base: string,
items: SidebarItem[],
collapsable?: boolean,
collapsible?: boolean,
): SidebarItem;
export function menuGroup(
text: string,
Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 132 KiB

+109 -4
View File
@@ -16,7 +16,8 @@ img.src = imageUrl;
```
```html [HTML]
<img src="~/assets/image.png" />
<!-- In HTML tags, you must use the relative path --->
<img src="../assets/image.png" />
```
```css [CSS]
@@ -25,6 +26,22 @@ img.src = imageUrl;
}
```
```vue [Vue]
<script>
import image from '~/assets/image.png';
</script>
<template>
<img :src="image" />
</template>
```
```jsx [JSX]
import image from '~/assets/image.png';
<img src={image} />;
```
:::
## `/public` Directory
@@ -52,6 +69,16 @@ img.src = imageUrl;
}
```
```vue [Vue]
<template>
<img src="/image.png" />
</template>
```
```jsx [JSX]
<img src="/image.png" />
```
:::
## Inside Content Scripts
@@ -77,6 +104,84 @@ export default defineContentScript({
## WASM
:::warning 🚧 Under construction
These docs will be coming soon!
:::
How a `.wasm` file is loaded varies greatly between packages, but most follow a basic setup: Use a JS API to load and execute the `.wasm` file.
For an extension, that means two things:
1. The `.wasm` file needs to be present in output folder so it can be loaded.
2. You must import the JS API to load and initialize the `.wasm` file, usually provided by the NPM package.
For an example, let's say you have a content script needs to parse TS code into AST. We'll use [`@oxc-parser/wasm`](https://www.npmjs.com/package/@oxc-parser/wasm) to do it!
First, we need to copy the `.wasm` file to the output directory. We'll do it with a [WXT module](/guide/essentials/wxt-modules):
```ts
// modules/oxc-parser-wasm.ts
import { resolve } from 'node:path';
export default defineWxtModule((wxt) => {
wxt.hook('build:publicAssets', (_, assets) => {
assets.push({
absoluteSrc: resolve(
'node_modules/@oxc-parser/wasm/web/oxc_parser_wasm_bg.wasm',
),
relativeDest: 'oxc_parser_wasm_bg.wasm',
});
});
});
```
Run `wxt build`, and you should see the WASM file copied into your `.output/chrome-mv3` folder!
Next, since this is in a content script and we'll be fetching the WASM file over the network to load it, we need to add the file to the `web_accessible_resources`:
```ts
// wxt.config.ts
export default defineConfig({
manifest: {
web_accessible_resources: [
{
// We'll use this matches in the content script as well
matches: ['*://*.github.com/*'],
// Use the same path as `relativeDest` from the WXT module
resources: ['/oxc_parser_wasm_bg.wasm'],
},
],
},
});
```
And finally, we need to load and initialize the `.wasm` file inside the content script to use it:
```ts
// entrypoints/content.ts
import initWasm, { parseSync } from '@oxc-parser/wasm';
export default defineContentScript({
matches: '*://*.github.com/*',
async main(ctx) {
if (!location.pathname.endsWith('.ts')) return;
// Get text from GitHub
const code = document.getElementById(
'read-only-cursor-text-area',
)?.textContent;
if (!code) return;
const sourceFilename = document.getElementById('file-name-id')?.textContent;
if (!sourceFilename) return;
// Load the WASM file:
await initWasm({
module_or_path: browser.runtime.getURL('/oxc_parser_wasm_bg.wasm'),
});
// Once loaded, we can use `parseSync`!
const ast = parseSync(code, { sourceFilename });
console.log(ast);
},
});
```
This code is taken directly from `@oxc-parser/wasm` docs with one exception: We manually pass in a file path. In a standard NodeJS or web project, the default path works just fine so you don't have to pass anything in. However, extensions are different. You should always explicitly pass in the full URL to the WASM file in your output directory, which is what `browser.runtime.getURL` returns.
Run your extension, and you should see OXC parse the TS file!
+1 -1
View File
@@ -11,7 +11,7 @@ export default defineConfig({
});
```
By default, WXT automatically setups up auto-imports for all of it's own APIs:
By default, WXT sets up auto-imports for all of it's own APIs:
- [`browser`](/api/reference/wxt/browser/variables/browser) from `wxt/browser`
- [`defineContentScript`](/api/reference/wxt/sandbox/functions/defineContentScript) from `wxt/sandbox`
@@ -6,7 +6,7 @@ outline: deep
> See the [API Reference](/api/reference/wxt/interfaces/ExtensionRunnerConfig) for a full list of config.
During development WXT uses [`web-ext` by Mozilla](https://www.npmjs.com/package/web-ext) to automatically open a browser window with your extension installed.
During development, WXT uses [`web-ext` by Mozilla](https://www.npmjs.com/package/web-ext) to automatically open a browser window with your extension installed.
## Config Files
@@ -41,6 +41,8 @@ export default defineRunnerConfig({
});
```
By default, WXT will try to automatically discover where Chrome/Firefox are installed. However, if you have chrome installed in a non-standard location, you need to set it manually as shown above.
### Persist Data
By default, to keep from modifying your browser's existing profiles, `web-ext` creates a brand new profile every time you run the `dev` script.
@@ -62,7 +64,8 @@ import { resolve } from 'node:path';
export default defineRunnerConfig({
// On Windows, the path must be absolute
chromiumArgs: [`--user-data-dir="${resolve(".wxt/chrome-data")}"`
chromiumProfile: resolve('.wxt/chrome-data'),
keepProfileChanges: true,
});
```
@@ -71,7 +74,7 @@ export default defineRunnerConfig({
Now, next time you run the `dev` script, a persistent profile will be created in `.wxt/chrome-data/{profile-name}`. With a persistent profile, you can install devtools extensions to help with development, allow the browser to remember logins, etc, without worrying about the profile being reset the next time you run the `dev` script.
:::tip
You can use any directory you'd like for `--user-data-dir`, the examples above create a persistent profile for each WXT project. To create a profile for all WXT projects, you can put the `chrome-data` directory inside you're user's home directory.
You can use any directory you'd like for `--user-data-dir`, the examples above create a persistent profile for each WXT project. To create a profile for all WXT projects, you can put the `chrome-data` directory inside your user's home directory.
:::
### Disable Opening Browser
@@ -9,6 +9,10 @@ WXT supports [dotenv files the same way as Vite](https://vite.dev/guide/env-and-
.env.local
.env.[mode]
.env.[mode].local
.env.[browser]
.env.[browser].local
.env.[mode].[browser]
.env.[mode].[browser].local
```
And any environment variables listed inside them will be available at runtime:
@@ -52,3 +56,26 @@ Vite provides two other environment variables, but they aren't useful in WXT pro
- `import.meta.env.BASE_URL`: Use `browser.runtime.getURL` instead.
- `import.meta.env.SSR`: Always `false`.
:::
## Manifest
To use environment variables in the manifest, you need to use the function syntax:
```ts
export default defineConfig({
extensionApi: 'chrome',
modules: ['@wxt-dev/module-vue'],
manifest: { // [!code --]
oauth2: { // [!code --]
client_id: import.meta.env.WXT_APP_CLIENT_ID // [!code --]
} // [!code --]
} // [!code --]
manifest: () => ({ // [!code ++]
oauth2: { // [!code ++]
client_id: import.meta.env.WXT_APP_CLIENT_ID // [!code ++]
} // [!code ++]
}), // [!code ++]
});
```
WXT can't load your `.env` files until after the config file has been loaded. So by using the function syntax for `manifest`, it defers creating the object until after the `.env` files are loaded into the process.
+17 -20
View File
@@ -1,10 +1,17 @@
# Manifest
In WXT, there is no `manifest.json` file in your source code. Instead, WXT generates it during the build process based off files in your project.
In WXT, there is no `manifest.json` file in your source code. Instead, WXT generates the manifest from multiple sources:
## Manifest Config
- Global options [defined in your `wxt.config.ts` file](#global-options)
- Entrypoint-specific options [defined in your entrypoints](/guide/essentials/entrypoints#defining-manifest-options)
- [WXT Modules](/guide/essentials/wxt-modules) added to your project can modify your manifest
- [Hooks](/guide/essentials/config/hooks) defined in your project can modify your manifest
To manually add a property to the `manifest.json` output during builds, use the `manifest` config inside `wxt.config.ts`:
Your extension's `manifest.json` will be output to `.output/{target}/manifest.json` when running `wxt build`.
## Global Options
To add a property to your manifest, use the `manifest` config inside your `wxt.config.ts`:
```ts
export default defineConfig({
@@ -130,7 +137,7 @@ public/
└─ icon-128.png
```
Specifically, if an icon must match one of these regex to be discovered:
Specifically, an icon must match one of these regex to be discovered:
<<< @/../packages/wxt/src/core/utils/manifest.ts#snippet
@@ -156,6 +163,11 @@ Alternatively, you can use [`@wxt-dev/auto-icons`](https://www.npmjs.com/package
> [Chrome docs](https://developer.chrome.com/docs/extensions/reference/permissions/)
Most of the time, you need to manually add permissions to your manifest. Only in a few specific situations are permissions added automatically:
- During development: the `tabs` and `scripting` permissions will be added to enable hot reloading.
- When a `sidepanel` entrypoint is present: The `sidepanel` permission is added.
```ts
export default defineConfig({
manifest: {
@@ -211,22 +223,7 @@ By default, whenever an `action` is generated, WXT falls back to `browser_action
### Action With Popup
To generate a manifest where a UI appears after clicking the icon, just create a [Popup entrypoint](/guide/essentials/entrypoints#popup).
```ts
export default defineConfig({
hooks: {
build: {
manifestGenerated(manifest) {
// Update the manifest variable by reference
manifest.name = 'Overriden name';
},
},
},
});
```
If you want to use a `page_action` for MV2, add the following meta tag to the HTML document's head:
To generate a manifest where a UI appears after clicking the icon, just create a [Popup entrypoint](/guide/essentials/entrypoints#popup). If you want to use a `page_action` for MV2, add the following meta tag to the HTML document's head:
```html
<meta name="manifest.type" content="page_action" />
+1 -1
View File
@@ -14,7 +14,7 @@ At a minimum, you need to create a TSConfig in your root directory that looks li
Or if you're in a monorepo, you may not want to extend the config. If you don't extend it, you need to add `.wxt/wxt.d.ts` to the TypeScript project:
```ts
/// <reference types="./.wxt/wxt.d.ts" />
/// <reference path="./.wxt/wxt.d.ts" />
```
## Compiler Options
+78 -23
View File
@@ -4,12 +4,14 @@ outline: deep
# Content Scripts
> To create a content script, see [Entrypoint Types](/guide/essentials/entrypoints#content-scripts).
## Context
The first argument to a content script's `main` function is it's "context".
The first argument to a content script's `main` function is its "context".
```ts
// entrypoints/content.ts
// entrypoints/example.content.ts
export default defineContentScript({
main(ctx) {},
});
@@ -62,7 +64,7 @@ In regular web extensions, CSS for content scripts is usually a separate CSS fil
In WXT, to add CSS to a content script, simply import the CSS file into your JS entrypoint, and WXT will automatically add the bundled CSS output to the `css` array.
```ts
// entrypoints/content/index.ts
// entrypoints/example.content/index.ts
import './style.css';
export default defineContentScript({
@@ -78,16 +80,16 @@ To create a standalone content script that only includes a CSS file:
// wxt.config.ts
export default defineConfig({
hooks: {
"build:manifestGenerated": (wxt, manifest) => {
'build:manifestGenerated': (wxt, manifest) => {
manifest.content_scripts ??= [];
manifest.content_scripts.push({
// Build extension once to see where your CSS get's written to
css: ["content-scripts/example.css"],
matches: ["*://*/*"]
)
}
}
})
css: ['content-scripts/example.css'],
matches: ['*://*/*'],
});
},
},
});
```
## UI
@@ -198,6 +200,7 @@ export default defineContentScript({
```ts [Svelte]
// entrypoints/example-ui.content/index.ts
import App from './App.svelte';
import { mount, unmount } from 'svelte';
export default defineContentScript({
matches: ['<all_urls>'],
@@ -208,14 +211,13 @@ export default defineContentScript({
anchor: 'body',
onMount: (container) => {
// Create the Svelte app inside the UI container
const app = new App({
mount(App, {
target: container,
});
return app;
},
onRemove: (app) => {
// Destroy the app when the UI is removed
app.$destroy();
unmount(app);
},
});
@@ -239,6 +241,7 @@ export default defineContentScript({
onMount: (container) => {
// Render your app to the UI container
const unmount = render(() => <div>...</div>, container);
return unmount;
},
onRemove: (unmount) => {
// Unmount the app when the UI is removed
@@ -378,6 +381,7 @@ export default defineContentScript({
// 1. Import the style
import './style.css';
import App from './App.svelte';
import { mount, unmount } from 'svelte';
export default defineContentScript({
matches: ['<all_urls>'],
@@ -392,14 +396,13 @@ export default defineContentScript({
anchor: 'body',
onMount: (container) => {
// Create the Svelte app inside the UI container
const app = new App({
mount(App, {
target: container,
});
return app;
},
onRemove: (app) => {
onRemove: () => {
// Destroy the app when the UI is removed
app?.$destroy();
unmount(app);
},
});
@@ -547,16 +550,35 @@ To use `injectScript`, we need two entrypoints, one content script and one unlis
```ts
// entrypoints/example-main-world.ts
export default defineUnlistedScript(() => {
console.log('Hello from the main world!');
console.log('Hello from the main world');
});
```
```ts
// entrypoints/example.content.ts
export default defineContentScript(async () => {
await injectScript('/example-main-world.js', {
keepInDom: true,
});
export default defineContentScript({
matches: ['*://*/*'],
async main() {
console.log('Injecting script...');
await injectScript('/example-main-world.js', {
keepInDom: true,
});
console.log('Done!');
},
});
```
```json
export default defineConfig({
manifest: {
// ...
web_accessible_resources: [
{
resources: ["example-main-world.js"],
matches: ["*://*/*"],
}
]
}
});
```
@@ -570,6 +592,39 @@ For MV3, `injectScript` is synchronous and the injected script will be evaluated
However for MV2, `injectScript` has to `fetch` the script's text content and create an inline `<script>` block. This means for MV2, your script is injected asynchronously and it will not be evaluated at the same time as your content script's `run_at`.
:::
## Mounting UI to dynamic element
In many cases, you may need to mount a UI to a DOM element that does not exist at the time the web page is initially loaded. To handle this, use the `autoMount` API to automatically mount the UI when the target element appears dynamically and unmount it when the element disappears. In WXT, the `anchor` option is used to target the element, enabling automatic mounting and unmounting based on its appearance and removal.
```ts
export default defineContentScript({
matches: ['<all_urls>'],
main(ctx) {
const ui = createIntegratedUi(ctx, {
position: 'inline',
// It observes the anchor
anchor: '#your-target-dynamic-element',
onMount: (container) => {
// Append children to the container
const app = document.createElement('p');
app.textContent = '...';
container.append(app);
},
});
// Call autoMount to observe anchor element for add/remove.
ui.autoMount();
},
});
```
:::tip
When the `ui.remove` is called, `autoMount` also stops.
:::
See the [API Reference](/api/reference/wxt/client/interfaces/ContentScriptUi.html#automount) for the complete list of options.
## Dealing with SPAs
It is difficult to write content scripts for SPAs (single page applications) and websites using HTML5 history mode for navigation because content scripts are only ran on full page reloads. SPAs and websites that take advantage of HTML5 history mode **_do not perform a full reload when changing paths_**, and thus your content script isn't going to be ran when you expect it to be.
@@ -602,7 +657,7 @@ export default defineContentScript({
matches: ['*://*.youtube.com/*'],
main(ctx) {
ctx.addEventListener(window, 'wxt:locationchange', ({ newUrl }) => {
if (watchPattern.matches(newUrl)) mainWatch(ctx);
if (watchPattern.includes(newUrl)) mainWatch(ctx);
});
},
});
+29 -8
View File
@@ -28,7 +28,7 @@ For web extensions, there are two types of entrypoints:
- **Listed**: Referenced in the `manifest.json`
- **Unlisted**: Not referenced in the `manifest.json`
Throughout the rest of WXT's documentation, listed files are referred to by name. For example:
Throughout the rest of WXT's documentation, listed entrypoints are referred to by name. For example:
- Popup
- Options
@@ -42,7 +42,7 @@ Some examples of "unlisted" entrypoints:
- JS files injected by content scripts into the page's main world
:::tip
Regardless of whether a entrypoint is listed or unlisted, it will still be bundled into your extension and be available at runtime.
Regardless of whether an entrypoint is listed or unlisted, it will still be bundled into your extension and be available at runtime.
:::
## Adding Entrypoints
@@ -72,7 +72,7 @@ Refer to the [Entrypoint Types](#entrypoint-types) section for the full list of
## Defining Manifest Options
Most listed entrypoints have options that need to be added to the `manifest.json`. With WXT however, instead of defining the options in a separate file, _you define these options inside the entrypoint file itself_.
Most listed entrypoints have options that need to be added to the `manifest.json`. However with WXT, instead of defining the options in a separate file, _you define these options inside the entrypoint file itself_.
For example, here's how to define `matches` for content scripts:
@@ -86,6 +86,17 @@ export default defineContentScript({
});
```
For HTML entrypoints, options are configured as `<meta>` tags. For example, to use a `page_action` for your MV2 popup:
```html
<!doctype html>
<html lang="en">
<head>
<meta name="manifest.type" content="page_action" />
</head>
</html>
```
> Refer to the [Entrypoint Types](#entrypoint-types) sections for a list of options configurable inside each entrypoint, and how to define them.
When building your extension, WXT will look at the options defined in your entrypoints, and generate the manifest accordingly.
@@ -304,14 +315,14 @@ Follow the [Devtools Example](https://github.com/wxt-dev/examples/tree/main/exam
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewportYou are responsible for loading/running these scripts where needed. If necessary, don't forget to add the script and/or any related stylesheets to web_accessible_resources."
content="width=device-width, initial-scale=1.0"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Options Title</title>
<!-- Customize the manifest options -->
<meta name="manifest.open_in_tab" content="true|false" />
<meta name="manifest.chrome_style" content="true|false" />
<meta name="manifest.browser_style" content="true|false" />
<!-- Set include/exclude if the page should be removed from some builds -->
<meta name="manifest.include" content="['chrome', ...]" />
<meta name="manifest.exclude" content="['chrome', ...]" />
@@ -339,7 +350,11 @@ Follow the [Devtools Example](https://github.com/wxt-dev/examples/tree/main/exam
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Set the `action.default_title` in the manifest -->
<title>Default Popup Title</title>
<!-- Customize the manifest options -->
<meta
name="manifest.default_icon"
content="{
@@ -350,6 +365,7 @@ Follow the [Devtools Example](https://github.com/wxt-dev/examples/tree/main/exam
/>
<meta name="manifest.type" content="page_action|browser_action" />
<meta name="manifest.browser_style" content="true|false" />
<!-- Set include/exclude if the page should be removed from some builds -->
<meta name="manifest.include" content="['chrome', ...]" />
<meta name="manifest.exclude" content="['chrome', ...]" />
@@ -384,6 +400,7 @@ Firefox does not support sandboxed pages.
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title</title>
<!-- Set include/exclude if the page should be removed from some builds -->
<meta name="manifest.include" content="['chrome', ...]" />
<meta name="manifest.exclude" content="['chrome', ...]" />
@@ -416,6 +433,8 @@ In Chrome, side panels use the `side_panel` API, while Firefox uses the `sidebar
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Default Side Panel Title</title>
<!-- Customize the manifest options -->
<meta
name="manifest.default_icon"
content="{
@@ -426,6 +445,7 @@ In Chrome, side panels use the `side_panel` API, while Firefox uses the `sidebar
/>
<meta name="manifest.open_at_install" content="true|false" />
<meta name="manifest.browser_style" content="true|false" />
<!-- Set include/exclude if the page should be removed from some builds -->
<meta name="manifest.include" content="['chrome', ...]" />
<meta name="manifest.exclude" content="['chrome', ...]" />
@@ -475,6 +495,7 @@ body {
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title</title>
<!-- Set include/exclude if the page should be removed from some builds -->
<meta name="manifest.include" content="['chrome', ...]" />
<meta name="manifest.exclude" content="['chrome', ...]" />
@@ -532,4 +553,4 @@ const url = browser.runtime.getURL('/<name>.js');
console.log(url); // "chrome-extension://<id>/<name>.js"
```
You are responsible for loading/running these scripts where needed. If necessary, don't forget to add the script and/or any related stylesheets to [`web_accessible_resources`](https://developer.chrome.com/docs/extensions/reference/manifest/web-accessible-resources).
You are responsible for loading/running these scripts where needed. If necessary, don't forget to add the script and/or any related assets to [`web_accessible_resources`](https://developer.chrome.com/docs/extensions/reference/manifest/web-accessible-resources).
+8 -8
View File
@@ -1,12 +1,10 @@
# ES Modules
Currently, ESM entrypoints are opt-in, so you must configure each entrypoint with that in mind.
You source code should always be written as ESM. However, you have some control whether an entrypoint is bundled as ESM.
## HTML Pages <Badge type="warning" text="≥0.0.1" />
In general, you should always make HTML pages import ESM scripts, unless you need to support old browsers.
To make a script ESM, add `type="module"`:
Vite only supports bundling JS from HTML pages as ESM. Ensure you have added `type="module"` to your `<script>` tags:
<!-- prettier-ignore -->
```html
@@ -16,23 +14,25 @@ To make a script ESM, add `type="module"`:
## Background <Badge type="warning" text="≥0.16.0" />
In your background script, set `type: "module"`:
By default, your background will be bundled into a single file as IIFE. You can change this by setting `type: "module"` in your background entrypoint:
```ts
export default defineBackground({
type: 'module', // !code ++
type: 'module', // [!code ++]
main() {
// ...
},
});
```
This will change the output format to ESM, enable code-spliting between your background script and HTML pages, and set `"type": "module"` in your manifest.
:::warning
Only MV3 supports ESM background scripts/service workers. When targeting MV2, the `type` option is ignored and the background is always bundled into a single file as IIFE.
:::
## Content Scripts
WXT does not yet include built-in support for ESM content scripts. The plan is to add support for chunking to reduce bundle size, but not support HMR for now. There are several technical issues that make implementing a generic solution for HMR impossible. See [Content Script ESM Support #357](https://github.com/wxt-dev/wxt/issues/357) for details.
WXT does not yet include built-in support for bundling content scripts as ESM. The plan is to add support for chunking to reduce bundle size, but not support HMR for now. There are several technical issues that make implementing a generic solution for HMR impossible. See [Content Script ESM Support #357](https://github.com/wxt-dev/wxt/issues/357) for details.
If you can't wait, and need ESM support right now, you can implement ESM support manually. See the [ESM Content Script UI](https://github.com/wxt-dev/examples/tree/main/examples/esm-content-script-ui) example to get started.
If you can't wait, and need ESM support right now, you can implement ESM support manually. See the [ESM Content Script UI](https://github.com/wxt-dev/examples/tree/main/examples/esm-content-script-ui) example to learn how.
+4
View File
@@ -81,6 +81,10 @@ However, it is recommended you stick with the vanilla API (or a package based on
- Translations are not bundled multiple times, keeping your extension small
- Zero configuration
However, there is one major downside to the vanilla API and any packages built on top of it:
- Language cannot be changed without changing your browser/system language
Here are some examples of how to setup a third party i18n library:
- [vue-i18n](https://github.com/wxt-dev/wxt-examples/tree/main/examples/vue-i18n)
+1
View File
@@ -14,3 +14,4 @@ Here are some popular messaging libraries that support all browsers and work wit
- [`webext-bridge`](https://www.npmjs.com/package/webext-bridge) - Messaging in WebExtensions made super easy. Out of the box.
- [`@webext-core/messaging`](https://www.npmjs.com/package/@webext-core/messaging) - Light weight, type-safe wrapper around the web extension messaging APIs
- [`@webext-core/proxy-service`](https://www.npmjs.com/package/@webext-core/proxy-service) - A type-safe wrapper around the web extension messaging APIs that lets you call a function from anywhere, but execute it in the background.
- [`Comctx`](https://github.com/molvqingtai/comctx) - Cross-context RPC solution with type safety and flexible adapters.
+19 -19
View File
@@ -35,7 +35,7 @@ Here's a brief summary of each of these files and directories:
- `hooks/`: Auto-imported by default, contains hooks for React and Solid
- `public/`: Contains any files you want to copy into the output folder as-is, without being processed by WXT
- `utils/`: Auto-imported by default, contains generic utilities used throughout your project
- `.env`: Contains [Environment Variables](/guide/essentials/config/runtime#environment-variables)
- `.env`: Contains [Environment Variables](/guide/essentials/config/environment-variables)
- `.env.publish`: Contains Environment Variables for [publishing](/guide/essentials/publishing)
- `app.config.ts`: Contains [Runtime Config](/guide/essentials/config/runtime)
- `package.json`: The standard file used by your package manager
@@ -59,24 +59,24 @@ After enabling it, your project structure should look like this:
<!-- prettier-ignore -->
```html
📂 {rootDir}/
📁 .output/
📁 .wxt/
📂 src/
📁 assets/
📁 components/
📁 composables/
📁 entrypoints/
📁 hooks/
📁 modules/
📁 public/
📁 utils/
📄 app.config.ts
📄 .env
📄 .env.publish
📄 package.json
📄 tsconfig.json
📄 web-ext.config.ts
📄 wxt.config.ts
📁 .output/
📁 .wxt/
📂 src/
📁 assets/
📁 components/
📁 composables/
📁 entrypoints/
📁 hooks/
📁 modules/
📁 public/
📁 utils/
📄 app.config.ts
📄 .env
📄 .env.publish
📄 package.json
📄 tsconfig.json
📄 web-ext.config.ts
📄 wxt.config.ts
```
## Customizing Other Directories
+1 -1
View File
@@ -129,7 +129,7 @@ wxt zip
Firefox requires you to upload a ZIP of your source code. This allows them to rebuild your extension and review the code in a readable way. More details can be found in [Firefox's docs](https://extensionworkshop.com/documentation/publish/source-code-submission/).
When running `wxt zip -b firefox`, WXT will zip both your extension and sources. Certain files (such as config files, hidden files, and tests) are automatically excluded from your sources. However, it's important to manually check the ZIP to ensure it only contains the files necessary to rebuild your extension.
When running `wxt zip -b firefox`, WXT will zip both your extension and sources. Certain files (such as config files, hidden files, tests, and excluded entrypoints) are automatically excluded from your sources. However, it's important to manually check the ZIP to ensure it only contains the files necessary to rebuild your extension.
To customize which files are zipped, add the `zip` option to your config file.
+8 -5
View File
@@ -12,15 +12,18 @@ When using `browser.scripting.executeScript`, you can execute content scripts or
// entrypoints/background.ts
const res = await browser.scripting.executeScript({
target: { tabId },
files: ['injected.js'],
files: ['content-scripts/example.js'],
});
console.log(res); // "Hello John!"
```
```ts
// entrypoints/injected.js
export default defineUnlistedScript(() => {
console.log('Script was injected!');
return 'Hello John!';
// entrypoints/example.content.ts
export default defineContentScript({
registration: 'runtime',
main(ctx) {
console.log('Script was executed!');
return 'Hello John!';
},
});
```
@@ -4,7 +4,7 @@ When building an extension with WXT, you can create multiple builds of your exte
## Target a Browser
Use the `-b` CLI flag to create a separate build of your extension for a specific browser. By default, `chrome` is targetted.
Use the `-b` CLI flag to create a separate build of your extension for a specific browser. By default, `chrome` is targeted.
```sh
wxt # same as: wxt -b chrome
@@ -12,36 +12,44 @@ wxt -b firefox
wxt -b custom
```
Targeting a browser has several effects:
During development, if you target Firefox, Firefox will open. All other strings open Chrome by default. To customize which browsers open, see [Set Browser Binaries](/guide/essentials/config/browser-startup#set-browser-binaries).
1. During development, when passing `firefox`, WXT will automatically open Firefox with the extension installed. For all other browsers, it will open Chrome/Chromium
2. Changes build-time constants provided by WXT:
- `import.meta.env.BROWSER`: A string, the targeted browser
- `import.meta.env.CHROME`: A boolean equivalent to `import.meta.env.BROWSER === "chrome"`
- `import.meta.env.FIREFOX`: A boolean equivalent to `import.meta.env.BROWSER === "firefox"`
- `import.meta.env.EDGE`: A boolean equivalent to `import.meta.env.BROWSER === "edge"`
- `import.meta.env.SAFARI`: A boolean equivalent to `import.meta.env.BROWSER === "safari"`
- `import.meta.env.OPERA`: A boolean equivalent to `import.meta.env.BROWSER === "opera"`
Additionally, WXT defines several constants you can use at runtime to detect which browser is in use:
```ts
if (import.meta.env.BROWSER === 'firefox') {
console.log('Do something only in Firefox builds');
}
if (import.meta.env.FIREFOX) {
// Shorthand, equivalent to the if-statement above
}
```
Read about [Built-in Environment Variables](/guide/essentials/config/environment-variables.html#built-in-environment-variables) for more details.
## Target a Manifest Version
To target specific manifest versions, use the `--mv2` or `--mv3` CLI flags.
:::tip Default Manifest Version
By default, WXT will target MV2 for Safari and Firefox and MV3 for all other browers.
By default, WXT will target MV2 for Safari and Firefox and MV3 for all other browsers.
:::
To get the target manifest version at runtime, use the built-time constant provided by WXT:
Similar to the browser, you can get the target manifest version at runtime using the [built-in environment variable](/guide/essentials/config/environment-variables.html#built-in-environment-variables):
- `import.meta.env.MANIFEST_VERSION`: A number, either `2` or `3`
```ts
if (import.meta.env.MANIFEST_VERSION === 2) {
console.log('Do something only in MV2 builds');
}
```
## Filtering Entrypoints
Every entrypoint can be included or excluded when targetting specific browsers via the `include` and `exclude` options.
Every entrypoint can be included or excluded when targeting specific browsers via the `include` and `exclude` options.
Here are some examples:
- Content script only built when targetting `firefox`:
- Content script only built when targeting `firefox`:
```ts
export default defineContentScript({
@@ -67,3 +75,5 @@ Here are some examples:
</body>
</html>
```
Alternatively, you can use the [`filterEntrypoints` config](/api/reference/wxt/interfaces/InlineConfig#filterentrypoints) to list all the entrypoints you want to build.
+26 -1
View File
@@ -75,7 +75,7 @@ import { defineWxtModule } from 'wxt/modules';
export default defineWxtModule({
setup(wxt) {
wxt.hook('ready', () => {
wxt.hook('config:resolved', () => {
wxt.config.outDir = 'dist';
});
},
@@ -167,6 +167,31 @@ This file could then be loaded at runtime:
const res = await fetch(browser.runtime.getURL('/some-text.txt'));
```
#### Add custom entrypoints
Once the existing files under the `entrypoints/` directory have been discovered, the `entrypoints:found` hook can be used to add custom entrypoints.
:::info
The `entrypoints:found` hook is triggered before validation is carried out on the list of entrypoints. Thus, any custom entrypoints will still be checked for duplicate names and logged during debugging.
:::
```ts
import { defineWxtModule } from 'wxt/modules';
export default defineWxtModule({
setup(wxt) {
wxt.hook('entrypoints:found', (_, entrypointInfos) => {
// Add your new entrypoint
entrypointInfos.push({
name: 'my-custom-script',
inputPath: 'path/to/custom-script.js',
type: 'content-script',
});
});
},
});
```
#### Generate runtime module
Create a file in `.wxt`, add an alias to import it, and add auto-imports for exported variables.
+1
View File
@@ -121,3 +121,4 @@ Once you've run the `dev` command, continue to [Next Steps](#next-steps)!
- Keep reading on about WXT's [Project Structure](/guide/essentials/project-structure) and other essential concepts to learn
- Configure [automatic browser startup](/guide/essentials/config/browser-startup) during dev mode
- Explore [WXT's example library](/examples) to see how to use specific APIs or perform common tasks
- Checkout the [community page](/guide/resources/community) for a list of resources made by the community!
+2 -2
View File
@@ -5,11 +5,11 @@ WXT is a modern, open-source framework for building web extensions. Inspired by
- Provide an awesome [DX](https://about.gitlab.com/topics/devops/what-is-developer-experience/)
- Provide first-class support for all major browsers
Check out the [comparison](/guide/resources/compare) to see how WXT compares to other tools for building web extnesions.
Check out the [comparison](/guide/resources/compare) to see how WXT compares to other tools for building web extensions.
## Prerequisites
These docs assume you have a basic knowledge of how Chrome extensions are structured and how you access the extension APIs.
These docs assume you have a basic knowledge of how web extensions are structured and how you access the extension APIs.
:::warning New to extension development?
If you have never written an extension before, follow Chrome's [Hello World tutorial](https://developer.chrome.com/docs/extensions/get-started/tutorial/hello-world) to first **_create an extension without WXT_**, then come back here.
+14
View File
@@ -0,0 +1,14 @@
# Community
This page is dedicated to all the awesome people how have made something for WXT or that works with WXT. Blog posts, YouTube videos, NPM packages, etc. If a section doesn't exist for the thing you made, add one!
[[toc]]
## Blog Posts
- [Building Modern Cross Browser Web Extensions](https://aabidk.dev/tags/wxt/) by Aabid ([@aabidk20](https://github.com/aabidk20))
## NPM Packages
- [`@webext-core/*`](https://webext-core.aklinker1.io/): Easy-to-use utilities for writing and testing web extensions that work on all browsers.
- [`Comctx`](https://github.com/molvqingtai/comctx): Cross-context RPC solution with type safety and flexible adapters.
+60 -46
View File
@@ -8,50 +8,64 @@ Lets compare the features of WXT vs [Plasmo](https://docs.plasmo.com/framework)
- 🟡 - Partial support
- ❌ - No support
| Features | WXT | Plasmo | CRXJS |
| ------------------------------------------------------- | :--------------: | :-------------: | :--------------: |
| Supports all browsers | | | 🟡 <sup>10</sup> |
| MV2 Support | | ✅ | 🟡 <sup>1</sup> |
| MV3 Support | ✅ | ✅ | 🟡 <sup>1</sup> |
| Create Extension ZIPs | ✅ | ✅ | ❌ |
| Create Firefox Sources ZIP | | ❌ | ❌ |
| First-class TypeScript support | | ✅ | |
| Entrypoint discovery | ✅ <sup>2</sup> | ✅ <sup>2</sup> | |
| Inline entrypoint config | ✅ | ✅ |<sup>9</sup> |
| Auto-imports | ✅ | ❌ | |
| Reusable module system | ✅ | ❌ | |
| Supports all frontend frameworks | ✅ | 🟡 <sup>3</sup> | |
| Framework specific entrypoints (like `Popup.tsx`) | 🟡 <sup>4</sup> | ✅ <sup>5</sup> | |
| Automated publishing | ✅ | ✅ | ❌ |
| Remote Code Bundling (Google Analytics) | ✅ | ✅ | |
| Unlisted HTML Pages | | ✅ | ✅ |
| Unlisted Scripts | | ❌ | ❌ |
| ESM Content Scripts | ❌ <sup>12</sup> | ❌ | |
| <strong style="opacity: 50%">Dev Mode</strong> | | |
| `.env` Files | | ✅ | ✅ |
| Opens browser with extension installed | | | |
| HMR for UIs | ✅ | 🟡 <sup>6</sup> | |
| Reload HTML Files on Change | | 🟡 <sup>7</sup> | ✅ |
| Reload Content Scripts on Change | | 🟡 <sup>7</sup> | ✅ |
| Reload Background on Change | 🟡 <sup>7</sup> | 🟡 <sup>7</sup> | 🟡 <sup>7</sup> |
| Respects Content Script `run_at` | | ✅ | ❌ <sup>8</sup> |
| <strong style="opacity: 50%">Built-in Wrappers</strong> | | | |
| Storage | | ✅ | ❌ <sup>11</sup> |
| Messaging | ❌ <sup>11</sup> | | ❌ <sup>11</sup> |
| Content Script UI | ✅ | ✅ | ❌ <sup>11</sup> |
| I18n | | ❌ | ❌ |
| Features | WXT | Plasmo | CRXJS |
| ------------------------------------------------------- | :-----: | :-----: | :-----: |
| Maintained || 🟡 [^n] | 🟡 [^m] |
| Supports all browsers | ✅ | ✅ | 🟡 [^j] |
| MV2 Support | ✅ | ✅ | 🟡 [^a] |
| MV3 Support | ✅ | ✅ | 🟡 [^a] |
| Create Extension ZIPs | | ✅ | ❌ |
| Create Firefox Sources ZIP | ✅ | | |
| First-class TypeScript support | ✅ | | |
| Entrypoint discovery | ✅ [^b] | ✅ [^b] | |
| Inline entrypoint config | ✅ | ✅ | ❌ [^i] |
| Auto-imports | ✅ | | |
| Reusable module system | ✅ | | ❌ |
| Supports all frontend frameworks | | 🟡 [^c] | |
| Framework specific entrypoints (like `Popup.tsx`) | 🟡 [^d] | ✅ [^e] | ❌ |
| Automated publishing | ✅ | | |
| Remote Code Bundling (Google Analytics) | | ✅ | ❌ |
| Unlisted HTML Pages | | ✅ | ✅ |
| Unlisted Scripts | ✅ | | |
| ESM Content Scripts | ❌ [^l] | | |
| <strong style="opacity: 50%">Dev Mode</strong> | | | |
| `.env` Files | | | |
| Opens browser with extension installed | ✅ | | |
| HMR for UIs | ✅ | 🟡 [^f] | |
| Reload HTML Files on Change | ✅ | 🟡 [^g] | ✅ |
| Reload Content Scripts on Change | ✅ | 🟡 [^g] | ✅ |
| Reload Background on Change | 🟡 [^g] | 🟡 [^g] | 🟡 [^g] |
| Respects Content Script `run_at` | | | ❌ [^h] |
| <strong style="opacity: 50%">Built-in Wrappers</strong> | | | |
| Storage | | | ❌ [^k] |
| Messaging | ❌ [^k] | ✅ | ❌ [^k] |
| Content Script UI | | ✅ | ❌ [^k] |
| I18n | ✅ | ❌ | ❌ |
<small>
<sup>1</sup>: Either MV2 or MV3, not both.
<br/><sup>2</sup>: File based.
<br/><sup>3</sup>: Only React, Vue, and Svelte.
<br/><sup>4</sup>: <code>.html</code> <code>.ts</code> <code>.tsx</code>.
<br/><sup>5</sup>: <code>.html</code> <code>.ts</code> <code>.tsx</code>. <code>.vue</code> <code>.svelte</code>.
<br/><sup>6</sup>: React only.
<br/><sup>7</sup>: Reloads entire extension.
<br/><sup>8</sup>: ESM-style loaders run asynchronously.
<br/><sup>9</sup>: Entrypoint options all configured in <code>manifest.json</code>.
<br/><sup>10</sup>: As of <code>v2.0.0-beta.23</code>, but v2 stable hasn't been released yet.
<br/><sup>11</sup>: There is no built-in wrapper around this API. However, you can still access the standard APIs via <code>chrome</code>/<code>browser</code> globals or use any 3rd party NPM package.
<br/><sup>12</sup>: WIP, moving very slowly. Follow <a href="https://github.com/wxt-dev/wxt/issues/357" target="_blank"><code>wxt-dev/wxt#357</code></a> for updates.
</small>
[^a]: Either MV2 or MV3, not both.
[^b]: File based.
[^c]: Only React, Vue, and Svelte.
[^d]: `.html`, `.ts`, `.tsx`.
[^e]: `.html`, `.ts`, `.tsx`, `.vue`, `.svelte`.
[^f]: React only.
[^g]: Reloads entire extension.
[^h]: ESM-style loaders run asynchronously.
[^i]: Entrypoint options all configured in `manifest.json`.
[^j]: As of `v2.0.0-beta.23`, but v2 stable hasn't been released yet.
[^k]: There is no built-in wrapper around this API. However, you can still access the standard APIs via `chrome`/`browser` globals or use any 3rd party NPM package.
[^l]: WIP, moving very slowly. Follow [wxt-dev/wxt#357](https://github.com/wxt-dev/wxt/issues/357) for updates.
[^m]: See [crxjs/chrome-extension-tools#974](https://github.com/crxjs/chrome-extension-tools/discussions/974)
[^n]: Appears to be in maintenance mode with little to no maintainers nor feature development happening and _(see [wxt-dev/wxt#1404 (comment)](https://github.com/wxt-dev/wxt/pull/1404#issuecomment-2643089518))_
+156 -3
View File
@@ -8,9 +8,7 @@ Commonly asked questions about how to use WXT or why it behaves the way it does.
[[toc]]
---
### Why are content scripts not showing up in the manifest?
## Why aren't content scripts added to the manifest?
During development, WXT registers content scripts dynamically so they can be reloaded individually when a file is saved without reloading your entire extension.
@@ -19,3 +17,158 @@ To list the content scripts registered during development, open the service work
```js
await chrome.scripting.getRegisteredContentScripts();
```
## How do I disable opening the browser automatically during development?
See https://wxt.dev/guide/essentials/config/browser-startup.html#disable-opening-browser
## How do I stay logged into a website during development?
See https://wxt.dev/guide/essentials/config/browser-startup.html#persist-data
## My component library doesn't work in content scripts!
This is usually caused by one of two things (or both) when using `createShadowRootUi`:
1. Styles are added outside the `ShadowRoot`
:::details
Some component libraries manually add CSS to the page by adding a `<style>` or `<link>` element. They place this element in the document's `<head>` by default. This causes your styles to be placed outside the `ShadowRoot` and it's isolation blocks the styles from being applied to your UI.
When a library does this, **you need to tell the library where to put its styles**. Here's the documentation for a few popular component libraries:
- Ant Design: [`StyleProvider`](https://ant.design/docs/react/compatible-style#shadow-dom-usage)
- Mantine: [`MantineProvider#getRootElement` and `MantineProvider#cssVariablesSelector`](https://mantine.dev/theming/mantine-provider/)
> If your library isn't listed above, try searching it's docs/issues for "shadow root", "shadow dom", or "css container". Not all libraries support shadow DOMs, you may have to open an issue to request this feature.
Here's an example of configuring Antd's styles:
```tsx
import { StyleProvider } from '@ant-design/cssinjs';
import ReactDOM from 'react-dom/client';
import App from './App.tsx';
const ui = await create`ShadowRoot`Ui(ctx, {
// ...
onMount: (container, shadow) => {
const cssContainer = shadow.querySelector('head')!;
const root = ReactDOM.createRoot(container);
root.render(
<StyleProvider container={cssContainer}>
<App />
</StyleProvider>,
);
return root;
},
});
```
:::
2. UI elements are added outside the `ShadowRoot`
::::::details
This is mostly caused by `Teleport` or `Portal` components that render an element somewhere else in the DOM, usually in the document's `<body>`. This is usually done for dialogs or popover components. This renders the element is outside the `ShadowRoot`, so styles are not applied to it.
To fix this, **you need to both provide a target to your app AND pass the target to the `Teleport`/`Portal`**.
First, store the reference to the `ShadowRoot`'s `<body>` element (not the document's `<body>`):
:::code-group
```ts [Vue]
import { createApp } from 'vue';
import App from './App.vue';
const ui = await create`ShadowRoot`Ui(ctx, {
// ...
onMount: (container, shadow) => {
const teleportTarget = shadow.querySelector('body')!;
const app = createApp(App)
.provide('TeleportTarget', teleportTarget)
.mount(container);
return app;
},
});
ui.mount();
```
```tsx [React]
// hooks/PortalTargetContext.ts
import { createContext } from 'react';
export const PortalTargetContext = createContext<HTMLElement>();
// entrypoints/example.content.ts
import ReactDOM from 'react-dom/client';
import App from './App.tsx';
import PortalTargetContext from '~/hooks/PortalTargetContext';
const ui = await create`ShadowRoot`Ui(ctx, {
// ...
onMount: (container, shadow) => {
const portalTarget = shadow.querySelector('body')!;
const root = ReactDOM.createRoot(container);
root.render(
<PortalTargetContext.Provider value={portalTarget}>
<App />
</PortalTargetContext.Provider>,
);
return root;
},
});
ui.mount();
```
:::
Then use the reference when teleporting/portaling part of your UI to a different place in the DOM:
:::code-group
```vue [Vue]
<script lang="ts" setup>
import { Teleport } from 'vue';
const teleportTarget = inject('TeleportTarget');
</script>
<template>
<div>
<Teleport :to="teleportTarget">
<dialog>My dialog</dialog>
</Teleport>
</div>
</template>
```
```tsx [React]
import { useContext } from 'react';
import { createPortal } from 'react-dom';
import PortalTargetContext from '~/hooks/PortalTargetContext';
const MyComponent = () => {
const portalTarget = useContext(PortalTargetContext);
return <div>{createPortal(<dialog>My dialog</dialog>, portalTarget)}</div>;
};
```
:::
If you use ShadCN, [see this blog post](https://aabidk.dev/blog/building-modern-cross-browser-web-extensions-content-scripts-and-ui/#using-radixui-portals-to-move-the-dialog-to-shadow-dom).
::::::
Both issues have the same cause: the library puts something outside the `ShadowRoot`, and the `ShadowRoot`'s isolation prevents CSS from being applied to your UI.
Both issues have the same fix: tell the library to put elements inside the `ShadowRoot`, not outside it. See the details above for more information and example fixes for each problem.
## Is there an LLM trained on WXT's docs that I chat with?
Not yet, but we're working on it. For now, https://wxt.dev hosts pre-aggregated and pre-formatted knowledge files containing all the docs from this website:
- Index listing available knowledge files: https://wxt.dev/knowledge/index.json
You don't need to crawl the entire website, these files already contain all the relevant docs for training a LLM on WXT. But feel free to crawl it and generate your own files if you want!
-21
View File
@@ -109,27 +109,6 @@ You have two options:
```
2. Rename your `modules` directory to something else.
## v0.18.0 &rarr; v0.18.5
> When this version was released, it was not considered a breaking change... but it should have been.
### New `modules/` Directory
WXT now recognizes the `modules/` directory as a folder containing [WXT modules](/guide/essentials/wxt-modules).
If you already have `<srcDir>/modules` or `<srcDir>/Modules` directory, `wxt prepare` and other commands will fail.
You have two options:
1. [Recommended] Keep your files where they are and tell WXT to look in a different folder:
```ts
// wxt.config.ts
export default defineConfig({
modulesDir: 'wxt-modules', // defaults to "modules"
});
```
2. Rename your `modules` directory to something else.
## v0.17.0 &rarr; v0.18.0
### Automatic MV3 `host_permissions` to MV2 `permissions`
+9 -3
View File
@@ -6,7 +6,7 @@ title: Next-gen Web Extension Framework
hero:
name: WXT
text: Next-gen Web Extension Framework
tagline: An open source tool that makes Chrome Extension development faster than ever before.
tagline: An open source tool that makes web extension development faster than ever before.
image:
src: /hero-logo.svg
alt: WXT
@@ -73,9 +73,15 @@ features:
linkText: Read docs
---
## Sponsors
WXT is a [MIT-licensed](https://github.com/wxt-dev/wxt/blob/main/LICENSE) open source project with its ongoing development made possible entirely by the support of these awesome backers. If you'd like to join them, please consider [sponsoring WXT's development](https://github.com/sponsors/wxt-dev).
<a href="https://github.com/sponsors/wxt-dev"><img alt="WXT Sponsors" src="https://raw.githubusercontent.com/wxt-dev/static/refs/heads/main/sponsorkit/sponsors-wide.svg"></a>
## Put <span style="color: var(--vp-c-brand-1)">Developer Experience</span> First
WXT simplifies the chrome extension development process by providing tools for zipping and publishing, the best-in-class dev mode, an opinionated project structure, and more. Iterate faster, develop features not build scripts, and use everything the JS ecosystem has to offer.
WXT simplifies the web extension development process by providing tools for zipping and publishing, the best-in-class dev mode, an opinionated project structure, and more. Iterate faster, develop features not build scripts, and use everything the JS ecosystem has to offer.
<div style="margin: auto; width: 100%; max-width: 900px; text-align: center">
<video src="https://github.com/wxt-dev/wxt/assets/10101283/4d678939-1bdb-495c-9c36-3aa281d84c94" controls></video>
@@ -87,7 +93,7 @@ WXT simplifies the chrome extension development process by providing tools for z
## Who's Using WXT?
Battle tested and ready for production. Explore chrome extensions made with WXT.
Battle tested and ready for production. Explore web extensions made with WXT.
<ClientOnly>
<UsingWxtSection />
+69 -22
View File
@@ -6,23 +6,47 @@ outline: deep
[Changelog](https://github.com/wxt-dev/wxt/blob/main/packages/wxt/CHANGELOG.md)
WXT provides a simplified API to replace the `browser.storage.*` APIs. Use the `storage` auto-import from `wxt/storage` or import it manually to get started:
A simplified wrapper around the extension storage APIs.
## Installation
### With WXT
This module is built-in to WXT, so you don't need to install anything.
```ts
import { storage } from 'wxt/storage';
```
> [!IMPORTANT]
> To use the `wxt/storage` API, the `"storage"` permission must be added to the manifest:
>
> ```ts
> // wxt.config.ts
> export default defineConfig({
> manifest: {
> permissions: ['storage'],
> },
> });
> ```
If you use auto-imports, `storage` is auto-imported for you, so you don't even need to import it!
### Without WXT
Install the NPM package:
```sh
npm i @wxt-dev/storage
pnpm add @wxt-dev/storage
yarn add @wxt-dev/storage
bun add @wxt-dev/storage
```
```ts
import { storage } from '@wxt-dev/storage';
```
## Storage Permission
To use the `wxt/storage` API, the `"storage"` permission must be added to the manifest:
```ts
// wxt.config.ts
export default defineConfig({
manifest: {
permissions: ['storage'],
},
});
```
## Basic Usage
@@ -51,11 +75,11 @@ await storage.watch<number>(
await storage.getMeta<{ v: number }>('local:installDate');
```
For a full list of methods available, see the [API reference](/api/reference/wxt/storage/interfaces/WxtStorage).
For a full list of methods available, see the [API reference](/api/reference/@wxt-dev/storage/interfaces/WxtStorage).
## Watchers
To listen for storage changes, use the `storage.watch` function. It lets you setup a listener for a single key:
To listen for storage changes, use the `storage.watch` function. It lets you set up a listener for a single key:
```ts
const unwatch = storage.watch<number>('local:counter', (newCount, oldCount) => {
@@ -100,7 +124,7 @@ You can remove all metadata associated with a key, or just specific properties:
// Remove all properties
await storage.removeMeta('local:preference');
// Remove one property
// Remove only the "lastModified" property
await storage.removeMeta('local:preference', 'lastModified');
// Remove multiple properties
@@ -134,7 +158,7 @@ const unwatch = showChangelogOnUpdate.watch((newValue) => {
});
```
For a full list of properties and methods available, see the [API reference](/api/reference/wxt/storage/interfaces/WxtStorageItem).
For a full list of properties and methods available, see the [API reference](/api/reference/@wxt-dev/storage/interfaces/WxtStorageItem).
### Versioning
@@ -225,13 +249,13 @@ export const ignoredWebsites = storage.defineItem<IgnoredWebsiteV3[]>( // [!code
Internally, this uses a metadata property called `v` to track the value's current version.
:::
In this case, we thought that the ignored website list might change in the future, and were able to setup a versioned storage item from the start.
In this case, we thought that the ignored website list might change in the future, and were able to set up a versioned storage item from the start.
Realistically, you won't know a item needs versioned until you need to change it's schema. Thankfully, it's simple to add versioning to an unversioned storage item.
Realistically, you won't know an item needs versioning until you need to change its schema. Thankfully, it's simple to add versioning to an unversioned storage item.
When a previous version isn't found, WXT assumes the version was `1`. That means you just need to set `version: 2` and add a migration for `2`, and it will just work!
Lets look at the same ignored websites example from before, but start with an unversioned item this time:
Let's look at the same ignored websites example from before, but start with an unversioned item this time:
:::code-group
@@ -275,13 +299,13 @@ export const ignoredWebsites = storage.defineItem<IgnoredWebsiteV2[]>( // [!code
### Running Migrations
As soon as `storage.defineItem` is called, WXT checks if migrations need to be ran, and if so, runs them. Calls to get or update the storage item's value or metadata (`getValue`, `setValue`, `removeValue`, `getMeta`, etc) will automatically wait for the migration process to finish before actually reading or writing values.
As soon as `storage.defineItem` is called, WXT checks if migrations need to be run, and if so, runs them. Calls to get or update the storage item's value or metadata (`getValue`, `setValue`, `removeValue`, `getMeta`, etc.) will automatically wait for the migration process to finish before actually reading or writing values.
### Default Values
With `storage.defineItem`, there are multiple ways of defining default values:
1. `fallback` - Return this value from `getValue` instead of `null` if the value is missing.
1. **`fallback`** - Return this value from `getValue` instead of `null` if the value is missing.
This option is great for providing default values for settings:
@@ -294,7 +318,7 @@ With `storage.defineItem`, there are multiple ways of defining default values:
});
```
2. `init` - Initialize and save a value in storage if it is not already saved.
2. **`init`** - Initialize and save a value in storage if it is not already saved.
This is great for values that need to be initialized or set once:
@@ -308,3 +332,26 @@ With `storage.defineItem`, there are multiple ways of defining default values:
```
The value is initialized in storage immediately.
## Bulk Operations
When getting or setting multiple values in storage, you can perform bulk operations to improve performance by reducing the number of individual storage calls. The `storage` API provides several methods for performing bulk operations:
- **`getItems`** - Get multiple values at once.
- **`getMetas`** - Get metadata for multiple items at once.
- **`setItems`** - Set multiple values at once.
- **`setMetas`** - Set metadata for multiple items at once.
- **`removeItems`** - Remove multiple values (and optionally metadata) at once.
All these APIs support both string keys and defined storage items:
```ts
const userId = storage.defineItem('local:userId');
await storage.setItems([
{ key: 'local:installDate', value: Date.now() },
{ item: userId, value: generateUserId() },
]);
```
Refer to the [API Reference](/api/reference/@wxt-dev/storage/interfaces/WxtStorage) for types and examples of how to use all the bulk APIs.
+1 -1
View File
@@ -20,7 +20,7 @@ Set Framerate 50
# Terminal theme with WXT brand colors (which was taken from the website)
# Based on the standard charmbracelet/vhs theme:
# https://github.com/charmbracelet/vhs/blob/88e634f4a10bbe305b6aea9a12b4d8dc3dd7f31c/style.go#L7-L28
Set Theme {"background": "#1a1b1a", "foreground": "#dddddd", "black": "#282a2e", "brightBlack": "#4d4d4d", "red": "#D74E6F", "brightRed": "#FE5F86", "green": "#67d45e", "brightGreen": "#67d45e", "yellow": "#D3E561", "brightYellow": "#EBFF71", "blue": "#8056FF", "brightBlue": "#9B79FF", "magenta": "#ED61D7", "brightMagenta": "#FF7AEA", "cyan": "#04D7D7", "brightCyan": "#00FEFE", "white": "#bfbfbf", "brightWhite": "#e6e6e6", "indigo": "#5B56E0"}
Set Theme {"background": "#161618", "foreground": "#dddddd", "black": "#282a2e", "brightBlack": "#4d4d4d", "red": "#D74E6F", "brightRed": "#FE5F86", "green": "#67d45e", "brightGreen": "#67d45e", "yellow": "#D3E561", "brightYellow": "#EBFF71", "blue": "#8056FF", "brightBlue": "#9B79FF", "magenta": "#ED61D7", "brightMagenta": "#FF7AEA", "cyan": "#04D7D7", "brightCyan": "#00FEFE", "white": "#bfbfbf", "brightWhite": "#e6e6e6", "indigo": "#5B56E0"}
Set FontSize 32
# Terminal settings
+9 -2
View File
@@ -2,11 +2,18 @@
"$schema": "https://typedoc.org/schema.json",
"entryPointStrategy": "packages",
"entryPoints": ["../packages/wxt"],
"plugin": ["typedoc-plugin-markdown", "typedoc-vitepress-theme"],
"plugin": [
"typedoc-plugin-markdown",
"typedoc-vitepress-theme",
"typedoc-plugin-frontmatter"
],
"out": "./api/reference",
"githubPages": false,
"excludePrivate": true,
"excludeProtected": true,
"excludeInternal": true,
"readme": "none"
"readme": "none",
"frontmatterGlobals": {
"editLink": false
}
}
+1
View File
@@ -0,0 +1 @@
<!--@include: ../packages/unocss/README.md-->
+29 -21
View File
@@ -4,7 +4,7 @@
"engines": {
"node": ">=18.20.3"
},
"packageManager": "pnpm@9.12.0",
"packageManager": "pnpm@10.5.2",
"scripts": {
"check": "check && pnpm -r --sequential run check",
"test": "pnpm -r --sequential run test run",
@@ -17,26 +17,31 @@
"docs:preview": "pnpm -s docs:gen && vitepress preview docs"
},
"devDependencies": {
"@aklinker1/buildc": "^1.1.4",
"@aklinker1/check": "^1.4.5",
"@types/fs-extra": "^11.0.4",
"@vitest/coverage-v8": "^2.1.2",
"changelogen": "^0.5.7",
"consola": "^3.2.3",
"fast-glob": "^3.3.2",
"fs-extra": "^11.2.0",
"lint-staged": "^15.2.10",
"nano-spawn": "^0.1.0",
"prettier": "^3.3.3",
"simple-git-hooks": "^2.11.1",
"tsx": "4.15.7",
"typedoc": "^0.25.4",
"typedoc-plugin-markdown": "4.0.0-next.23",
"typedoc-vitepress-theme": "1.0.0-next.3",
"typescript": "^5.6.2",
"vitepress": "^1.3.4",
"vitest-mock-extended": "^2.0.2",
"vue": "^3.5.11",
"@aklinker1/buildc": "catalog:",
"@aklinker1/check": "catalog:",
"@commitlint/config-conventional": "catalog:",
"@commitlint/types": "catalog:",
"@types/fs-extra": "catalog:",
"@vitest/coverage-v8": "catalog:",
"changelogen": "catalog:",
"consola": "catalog:",
"fast-glob": "catalog:",
"fs-extra": "catalog:",
"lint-staged": "catalog:",
"markdown-it-footnote": "catalog:",
"nano-spawn": "catalog:",
"prettier": "catalog:",
"simple-git-hooks": "catalog:",
"tsx": "catalog:",
"typedoc": "catalog:",
"typedoc-plugin-frontmatter": "catalog:",
"typedoc-plugin-markdown": "catalog:",
"typedoc-vitepress-theme": "catalog:",
"typescript": "catalog:",
"vitepress": "catalog:",
"vitepress-knowledge": "catalog:",
"vitest-mock-extended": "catalog:",
"vue": "catalog:",
"wxt": "workspace:*"
},
"simple-git-hooks": {
@@ -51,6 +56,9 @@
"@algolia/client-search",
"search-insights"
]
},
"patchedDependencies": {
"markdown-it-footnote": "patches/markdown-it-footnote.patch"
}
}
}
+1 -1
View File
@@ -41,4 +41,4 @@ export default defineConfig({
});
```
Options have JSDocs available in your editor, or you can read them in the source code: [`AutoIconsOptions`](./src/index.ts).
Options have JSDocs available in your editor, or you can read them in the source code: [`AutoIconsOptions`](https://github.com/wxt-dev/wxt/blob/main/packages/auto-icons/src/index.ts).
+11 -11
View File
@@ -44,17 +44,17 @@
"peerDependencies": {
"wxt": ">=0.19.0"
},
"devDependencies": {
"@aklinker1/check": "^1.4.5",
"oxlint": "^0.9.9",
"publint": "^0.2.11",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"wxt": "workspace:*"
},
"dependencies": {
"defu": "^6.1.4",
"fs-extra": "^11.2.0",
"sharp": "^0.33.5"
"defu": "catalog:",
"fs-extra": "catalog:",
"sharp": "catalog:"
},
"devDependencies": {
"@aklinker1/check": "catalog:",
"oxlint": "catalog:",
"publint": "catalog:",
"typescript": "catalog:",
"unbuild": "catalog:",
"wxt": "workspace:*"
}
}
+29
View File
@@ -1,5 +1,34 @@
# Changelog
## v0.2.3
[compare changes](https://github.com/wxt-dev/wxt/compare/i18n-v0.2.2...i18n-v0.2.3)
### 🩹 Fixes
- Prevent app crashes from parse errors due to incomplete file saves ([#1114](https://github.com/wxt-dev/wxt/pull/1114))
### 📖 Documentation
- Cleanup typos and broken links ([bb5ea34](https://github.com/wxt-dev/wxt/commit/bb5ea34))
### ❤️ Contributors
- Bread Grocery <breadgrocery@gmail.com>
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v0.2.2
[compare changes](https://github.com/wxt-dev/wxt/compare/i18n-v0.2.1...i18n-v0.2.2)
### 🚀 Enhancements
- Add support for configuring the `locales` directory ([#1109](https://github.com/wxt-dev/wxt/pull/1109))
### ❤️ Contributors
- Bread Grocery <breadgrocery@gmail.com>
## v0.2.1
[compare changes](https://github.com/wxt-dev/wxt/compare/i18n-v0.2.0...i18n-v0.2.1)
+19 -3
View File
@@ -98,6 +98,21 @@ And you're done! Using WXT, you get type-safety out of the box.
i18n.t('helloWorld'); // "Hello world!";
```
## Configuration
The module can be configured via the `i18n` config:
```ts
export default defineConfig({
modules: ['@wxt-dev/i18n'],
i18n: {
// ...
},
});
```
Options have JSDocs available in your editor, or you can read them in the source code: [`I18nOptions`](https://github.com/wxt-dev/wxt/blob/main/packages/i18n/src/module.ts).
## Messages File Format
> [!DANGER]
@@ -225,11 +240,11 @@ A key is treated as "verbose" when it is:
{
"appName": {
"message": "GitHub - Better Line Counts",
"description": "The app's name, should not be translated",
"description": "The app's name, should not be translated"
},
"ok": "OK",
"deleteConfirmation": {
"title": "Delete XYZ?"
"title": "Delete XYZ?",
"message": "You cannot undo this action once taken."
}
}
@@ -289,7 +304,7 @@ const messages = {
// ...
};
// Generate JSON files for the browser
// Generate JSON files for the extension
await generateChromeMessagesFile('dist/_locales/en/messages.json', messages.en);
await generateChromeMessagesFile('dist/_locales/de/messages.json', messages.de);
// ...
@@ -339,6 +354,7 @@ You'll need to configure it the extension so it knows where your localization fi
# You can check available language ids here: https://code.visualstudio.com/docs/languages/identifiers
languageIds:
- typescript
- typescriptreact
# Look for t("...")
usageMatchRegex:
+14 -13
View File
@@ -1,7 +1,7 @@
{
"name": "@wxt-dev/i18n",
"description": "Type-safe wrapper around browser.i18n.getMessage with additional features",
"version": "0.2.1",
"version": "0.2.3",
"type": "module",
"repository": {
"type": "git",
@@ -19,15 +19,16 @@
"email": "aaronklinker1+wxt@gmail.com"
},
"license": "MIT",
"funding": "https://github.com/sponsors/wxt-dev",
"scripts": {
"build": "buildc -- unbuild",
"check": "buildc --deps-only -- check",
"test": "buildc --deps-only -- vitest"
},
"dependencies": {
"chokidar": "^3.6.0",
"confbox": "^0.1.7",
"fast-glob": "^3.3.2"
"chokidar": "catalog:",
"confbox": "catalog:",
"fast-glob": "catalog:"
},
"peerDependencies": {
"wxt": ">=0.19.7"
@@ -38,15 +39,15 @@
}
},
"devDependencies": {
"@aklinker1/check": "^1.4.5",
"@types/chrome": "^0.0.268",
"@types/node": "^20.16.10",
"oxlint": "^0.9.9",
"publint": "^0.2.11",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"vitest": "^2.0.0",
"vitest-plugin-random-seed": "^1.1.0",
"@aklinker1/check": "catalog:",
"@types/chrome": "catalog:",
"@types/node": "catalog:",
"oxlint": "catalog:",
"publint": "catalog:",
"typescript": "catalog:",
"unbuild": "catalog:",
"vitest": "catalog:",
"vitest-plugin-random-seed": "catalog:",
"wxt": "workspace:*"
},
"main": "./dist/index.cjs",
+30 -8
View File
@@ -23,11 +23,11 @@ import { watch } from 'chokidar';
import { GeneratedPublicFile, WxtDirFileEntry } from 'wxt';
import { writeFile } from 'node:fs/promises';
export default defineWxtModule({
export default defineWxtModule<I18nOptions>({
name: '@wxt-dev/i18n',
configKey: 'i18n',
imports: [{ from: '#i18n', name: 'i18n' }],
setup(wxt) {
setup(wxt, options) {
if (wxt.config.manifest.default_locale == null) {
wxt.logger.warn(
`\`[i18n]\` manifest.default_locale not set, \`@wxt-dev/i18n\` disabled.`,
@@ -38,9 +38,12 @@ export default defineWxtModule({
'`[i18n]` Default locale: ' + wxt.config.manifest.default_locale,
);
const { localesDir = resolve(wxt.config.srcDir, 'locales') } =
options ?? {};
const getLocalizationFiles = async () => {
const files = await glob('locales/*', {
cwd: wxt.config.srcDir,
const files = await glob('*.{json,json5,yml,yaml,toml}', {
cwd: localesDir,
absolute: true,
});
return files.map((file) => ({
@@ -71,7 +74,7 @@ export default defineWxtModule({
)!;
if (defaultLocaleFile == null) {
throw Error(
`\`[i18n]\` Required localization file does not exist: \`<srcDir>/locales/${wxt.config.manifest.default_locale}.{json|json5|yml|yaml|toml}\``,
`\`[i18n]\` Required localization file does not exist: \`<localesDir>/${wxt.config.manifest.default_locale}.{json|json5|yml|yaml|toml}\``,
);
}
@@ -154,9 +157,28 @@ export { type GeneratedI18nStructure }
if (wxt.config.command === 'serve') {
wxt.hooks.hookOnce('build:done', () => {
const watcher = watch(resolve(wxt.config.srcDir, 'locales'));
watcher.on('change', updateLocalizations);
const watcher = watch(localesDir);
watcher.on('change', (path) => {
updateLocalizations(path).catch(wxt.logger.error);
});
});
}
},
});
/**
* Options for the i18n module
*/
export interface I18nOptions {
/**
* Directory containing files that define the translations.
* @default "${config.srcDir}/locales"
*/
localesDir?: string;
}
declare module 'wxt' {
export interface InlineConfig {
i18n?: I18nOptions;
}
}
+30
View File
@@ -1,5 +1,35 @@
# Changelog
## v1.1.3
[compare changes](https://github.com/wxt-dev/wxt/compare/module-react-v1.1.2...module-react-v1.1.3)
### 🩹 Fixes
- Use react 19 in `@wxt-dev/module-react` and `templates/react` ([#1285](https://github.com/wxt-dev/wxt/pull/1285))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v1.1.2
[compare changes](https://github.com/wxt-dev/wxt/compare/module-react-v1.1.1...module-react-v1.1.2)
### 🩹 Fixes
- Use `config:resolved` hook to update config instead of `ready` ([#1178](https://github.com/wxt-dev/wxt/pull/1178))
### 🏡 Chore
- Add `oxlint` for linting ([#947](https://github.com/wxt-dev/wxt/pull/947))
- Upgrade all non-major dependencies ([#1040](https://github.com/wxt-dev/wxt/pull/1040))
- **deps:** Upgrade all non-major dependencies ([#1164](https://github.com/wxt-dev/wxt/pull/1164))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v1.1.1
[compare changes](https://github.com/wxt-dev/wxt/compare/module-react-v1.1.0...module-react-v1.1.1)
+1 -1
View File
@@ -2,7 +2,7 @@ import { defineBuildConfig } from 'unbuild';
import { resolve } from 'node:path';
export default defineBuildConfig({
rootDir: 'modules',
rootDir: resolve(__dirname, 'modules'),
outDir: resolve(__dirname, 'dist'),
entries: [{ input: 'react.ts', name: 'index' }],
rollup: {
+1 -1
View File
@@ -15,7 +15,7 @@ export default defineWxtModule<ReactModuleOptions>({
addImportPreset(wxt, 'react');
// Enable auto-imports for JSX files
wxt.hooks.hook('ready', (wxt) => {
wxt.hook('config:resolved', (wxt) => {
if (wxt.config.imports === false) return;
wxt.config.imports.dirsScanOptions ??= {};
+12 -11
View File
@@ -17,7 +17,8 @@
"email": "aaronklinker1+wxt@gmail.com"
},
"license": "MIT",
"version": "1.1.1",
"funding": "https://github.com/sponsors/wxt-dev",
"version": "1.1.3",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
@@ -44,20 +45,20 @@
"prepare": "buildc --deps-only -- wxt prepare"
},
"peerDependencies": {
"wxt": ">=0.18.6"
"wxt": ">=0.19.16"
},
"dependencies": {
"@vitejs/plugin-react": "^4.3.2"
"@vitejs/plugin-react": "catalog:"
},
"devDependencies": {
"@aklinker1/check": "^1.4.5",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"publint": "^0.2.11",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"@aklinker1/check": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"publint": "catalog:",
"react": "catalog:",
"react-dom": "catalog:",
"typescript": "catalog:",
"unbuild": "catalog:",
"wxt": "workspace:*"
}
}
+18
View File
@@ -1,5 +1,23 @@
# Changelog
## v1.1.3
[compare changes](https://github.com/wxt-dev/wxt/compare/module-solid-v1.1.2...module-solid-v1.1.3)
### 🩹 Fixes
- Use `config:resolved` hook to update config instead of `ready` ([#1178](https://github.com/wxt-dev/wxt/pull/1178))
### 🏡 Chore
- Add `oxlint` for linting ([#947](https://github.com/wxt-dev/wxt/pull/947))
- Upgrade all non-major dependencies ([#1040](https://github.com/wxt-dev/wxt/pull/1040))
- **deps:** Upgrade all non-major dependencies ([#1164](https://github.com/wxt-dev/wxt/pull/1164))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v1.1.2
[compare changes](https://github.com/wxt-dev/wxt/compare/module-solid-v1.1.1...module-solid-v1.1.2)
+1 -1
View File
@@ -2,7 +2,7 @@ import { defineBuildConfig } from 'unbuild';
import { resolve } from 'node:path';
export default defineBuildConfig({
rootDir: 'modules',
rootDir: resolve(__dirname, 'modules'),
outDir: resolve(__dirname, 'dist'),
entries: [{ input: 'solid.ts', name: 'index' }],
rollup: {
+1 -1
View File
@@ -18,7 +18,7 @@ export default defineWxtModule<SolidModuleOptions>({
addImportPreset(wxt, 'solid-js');
// Enable auto-imports for JSX files
wxt.hooks.hook('ready', (wxt) => {
wxt.hook('config:resolved', (wxt) => {
if (wxt.config.imports === false) return;
wxt.config.imports.dirsScanOptions ??= {};
+9 -8
View File
@@ -17,7 +17,8 @@
"email": "aaronklinker1+wxt@gmail.com"
},
"license": "MIT",
"version": "1.1.2",
"funding": "https://github.com/sponsors/wxt-dev",
"version": "1.1.3",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
@@ -44,17 +45,17 @@
"prepare": "buildc --deps-only -- wxt prepare"
},
"peerDependencies": {
"wxt": ">=0.18.6"
"wxt": ">=0.19.16"
},
"dependencies": {
"vite-plugin-solid": "^2.10.2"
"vite-plugin-solid": "catalog:"
},
"devDependencies": {
"@aklinker1/check": "^1.4.5",
"publint": "^0.2.11",
"solid-js": "^1.9.1",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"@aklinker1/check": "catalog:",
"publint": "catalog:",
"solid-js": "catalog:",
"typescript": "catalog:",
"unbuild": "catalog:",
"wxt": "workspace:*"
}
}
+63
View File
@@ -1,5 +1,68 @@
# Changelog
## v2.0.3
[compare changes](https://github.com/wxt-dev/wxt/compare/module-svelte-v2.0.2...module-svelte-v2.0.3)
### 🩹 Fixes
- Upgrade `vite-plugin-svelte` to support Vite 6 ([#1375](https://github.com/wxt-dev/wxt/pull/1375))
### ❤️ Contributors
- Eli ([@lishaduck](http://github.com/lishaduck))
## v2.0.2
[compare changes](https://github.com/wxt-dev/wxt/compare/module-svelte-v2.0.1...module-svelte-v2.0.2)
### 🩹 Fixes
- Svelte production errors and warnings on resolve conditions ([#1283](https://github.com/wxt-dev/wxt/pull/1283))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v2.0.1
[compare changes](https://github.com/wxt-dev/wxt/compare/module-svelte-v2.0.0...module-svelte-v2.0.1)
### 🩹 Fixes
- Modify dev `vite.resolve.conditions` to support Vite 6 + Svelte 5 ([#1230](https://github.com/wxt-dev/wxt/pull/1230))
### 🏡 Chore
- **deps:** Upgrade all non-major dependencies ([#1164](https://github.com/wxt-dev/wxt/pull/1164))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v2.0.0
[⚠️ breaking changes](https://wxt.dev/guide/upgrade-guide/wxt) &bull; [compare changes](https://github.com/wxt-dev/wxt/compare/module-svelte-v1.0.1...module-svelte-v2.0.0)
### 🚀 Enhancements
- ⚠️ Svelte 5 support ([#1104](https://github.com/wxt-dev/wxt/pull/1104))
### 🏡 Chore
- Add `oxlint` for linting ([#947](https://github.com/wxt-dev/wxt/pull/947))
- Upgrade all non-major dependencies ([#1040](https://github.com/wxt-dev/wxt/pull/1040))
#### ⚠️ Breaking Changes
Upgraded `@sveltejs/vite-plugin-svelte` from v3 to v4. This drops support for Svelte 4 and below. To continue using older versions of Svelte, use v1 of this module.
To upgrade to svelte 5, just install `svelte@5`.
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v1.0.1
[compare changes](https://github.com/wxt-dev/wxt/compare/module-svelte-v1.0.0...module-svelte-v1.0.1)
+9 -7
View File
@@ -17,7 +17,8 @@
"email": "aaronklinker1+wxt@gmail.com"
},
"license": "MIT",
"version": "1.0.1",
"funding": "https://github.com/sponsors/wxt-dev",
"version": "2.0.3",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
@@ -42,16 +43,17 @@
"check": "pnpm build && check"
},
"peerDependencies": {
"wxt": ">=0.18.6"
"wxt": ">=0.18.6",
"svelte": ">=5"
},
"dependencies": {
"@sveltejs/vite-plugin-svelte": "^3.1.2"
"@sveltejs/vite-plugin-svelte": "catalog:"
},
"devDependencies": {
"@aklinker1/check": "^1.4.5",
"publint": "^0.2.11",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"@aklinker1/check": "catalog:",
"publint": "catalog:",
"typescript": "catalog:",
"unbuild": "catalog:",
"wxt": "workspace:*"
}
}
+4 -1
View File
@@ -12,7 +12,7 @@ export default defineWxtModule<SvelteModuleOptions>({
setup(wxt, options) {
const { vite } = options ?? {};
addViteConfig(wxt, () => ({
addViteConfig(wxt, ({ mode }) => ({
plugins: [
svelte({
// Using a svelte.config.js file causes a segmentation fault when importing the file
@@ -21,6 +21,9 @@ export default defineWxtModule<SvelteModuleOptions>({
...vite,
}),
],
resolve: {
conditions: ['browser', mode],
},
}));
addImportPreset(wxt, 'svelte');
+19
View File
@@ -1,5 +1,24 @@
# Changelog
## v1.0.2
[compare changes](https://github.com/wxt-dev/wxt/compare/module-vue-v1.0.1...module-vue-v1.0.2)
### 🩹 Fixes
- Use `config:resolved` hook to update config instead of `ready` ([#1178](https://github.com/wxt-dev/wxt/pull/1178))
### 🏡 Chore
- Add `oxlint` for linting ([#947](https://github.com/wxt-dev/wxt/pull/947))
- **deps:** Bump @vitejs/plugin-vue from 5.1.1 to 5.1.4 ([#1020](https://github.com/wxt-dev/wxt/pull/1020))
- Upgrade all non-major dependencies ([#1040](https://github.com/wxt-dev/wxt/pull/1040))
- **deps:** Upgrade all non-major dependencies ([#1164](https://github.com/wxt-dev/wxt/pull/1164))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v1.0.1
[compare changes](https://github.com/wxt-dev/wxt/compare/module-vue-v1.0.0...module-vue-v1.0.1)
+8 -7
View File
@@ -17,7 +17,8 @@
"email": "aaronklinker1+wxt@gmail.com"
},
"license": "MIT",
"version": "1.0.1",
"funding": "https://github.com/sponsors/wxt-dev",
"version": "1.0.2",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
@@ -42,16 +43,16 @@
"check": "pnpm build && check"
},
"peerDependencies": {
"wxt": ">=0.18.6"
"wxt": ">=0.19.16"
},
"dependencies": {
"@vitejs/plugin-vue": "^5.1.4"
"@vitejs/plugin-vue": "catalog:"
},
"devDependencies": {
"@aklinker1/check": "^1.4.5",
"publint": "^0.2.11",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"@aklinker1/check": "catalog:",
"publint": "catalog:",
"typescript": "catalog:",
"unbuild": "catalog:",
"wxt": "workspace:*"
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ export default defineWxtModule<VueModuleOptions>({
}));
// Enable auto-imports in template files
wxt.hooks.hook('ready', (wxt) => {
wxt.hook('config:resolved', (wxt) => {
if (!wxt.config.imports) return;
wxt.config.imports.addons ??= {};
+51
View File
@@ -0,0 +1,51 @@
# Changelog
## v1.1.0
[compare changes](https://github.com/wxt-dev/wxt/compare/storage-v1.0.1...storage-v1.1.0)
### 🚀 Enhancements
- Add `storage.clear` ([#1368](https://github.com/wxt-dev/wxt/pull/1368))
### 📖 Documentation
- Update link ([654a54a](https://github.com/wxt-dev/wxt/commit/654a54a))
### ❤️ Contributors
- Chengxi ([@chengxilo](http://github.com/chengxilo))
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v1.0.1
[compare changes](https://github.com/wxt-dev/wxt/compare/storage-v1.0.0...storage-v1.0.1)
### 🩹 Fixes
- Use `browser` for mv2 storage ([#1200](https://github.com/wxt-dev/wxt/pull/1200))
### 📖 Documentation
- Cleanup changelog ([f5b7f7e](https://github.com/wxt-dev/wxt/commit/f5b7f7e))
### 🏡 Chore
- Init changelog for storage package ([6fc227b](https://github.com/wxt-dev/wxt/commit/6fc227b))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v1.0.0
Extracted `wxt/storage` into it's own package, `@wxt-dev/storage`!
It's still shipped inside WXT and accessible via `wxt/storage`, but now:
- Non-WXT projects can use the storage wrapper.
- We can make breaking changes to the API separately.
[Read the docs](https://wxt.dev/storage.html) for more details.
> This is apart of the v1.0 initiative for WXT.
+36
View File
@@ -0,0 +1,36 @@
# WXT Storage
[Changelog](https://github.com/wxt-dev/wxt/blob/main/packages/storage/CHANGELOG.md) &bull; [Docs](https://wxt.dev/storage.html)
A simplified wrapper around the extension storage APIs.
## Installation
### With WXT
This module is built-in to WXT, so you don't need to install anything.
```ts
import { storage } from 'wxt/storage';
```
If you use auto-imports, `storage` is auto-imported for you, so you don't even need to import it!
### Without WXT
Install the NPM package:
```sh
npm i @wxt-dev/storage
pnpm add @wxt-dev/storage
yarn add @wxt-dev/storage
bun add @wxt-dev/storage
```
```ts
import { storage } from '@wxt-dev/storage';
```
## Usage
Read full docs on the [documentation website](https://wxt.dev/storage.html).
+57
View File
@@ -0,0 +1,57 @@
{
"name": "@wxt-dev/storage",
"description": "Web extension storage API provided by WXT, supports all browsers.",
"version": "1.1.0",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/wxt-dev/wxt.git",
"directory": "packages/storage"
},
"homepage": "https://wxt.dev/storage.html",
"keywords": [
"wxt",
"storage",
"extension",
"addon",
"chrome",
"firefox",
"edge"
],
"author": {
"name": "Aaron Klinker",
"email": "aaronklinker1+wxt@gmail.com"
},
"license": "MIT",
"funding": "https://github.com/sponsors/wxt-dev",
"scripts": {
"build": "buildc -- unbuild",
"check": "buildc --deps-only -- check",
"test": "buildc --deps-only -- vitest"
},
"dependencies": {
"async-mutex": "catalog:",
"dequal": "catalog:"
},
"devDependencies": {
"@aklinker1/check": "catalog:",
"@types/chrome": "catalog:",
"@webext-core/fake-browser": "catalog:",
"oxlint": "catalog:",
"publint": "catalog:",
"typescript": "catalog:",
"unbuild": "catalog:",
"vitest": "catalog:"
},
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.mts",
"import": "./dist/index.mjs"
}
},
"files": [
"dist"
]
}
@@ -1,7 +1,6 @@
import { fakeBrowser } from '@webext-core/fake-browser';
import { describe, it, expect, beforeEach, vi, expectTypeOf } from 'vitest';
import { browser } from 'wxt/browser';
import { WxtStorageItem, storage } from '../storage';
import { MigrationError, type WxtStorageItem, storage } from '../index';
/**
* This works because fakeBrowser is synchronous, and is will finish any number of chained
@@ -38,7 +37,7 @@ describe('Storage Utils', () => {
expect(actual).toBe(expected);
});
it('should return the value if multiple : are use in the key', async () => {
it('should return the value if multiple : are used in the key', async () => {
const expected = 'value';
await fakeBrowser.storage[storageArea].set({ 'some:key': expected });
@@ -64,27 +63,97 @@ describe('Storage Utils', () => {
});
describe('getItems', () => {
it('should return an array of values', async () => {
const expected = [
{ key: `${storageArea}:count`, value: 234 },
{ key: `${storageArea}:installDate`, value: null },
{ key: `${storageArea}:otherValue`, value: 345 },
] as const;
const params = [
expected[0].key,
expected[1].key,
{
key: expected[2].key,
options: { defaultValue: expected[2].value },
},
];
it('should get values from multiple storage keys', async () => {
const item1 = {
key: `${storageArea}:one`,
expectedValue: 1,
} as const;
const item2 = {
key: `${storageArea}:two`,
expectedValue: null,
} as const;
await fakeBrowser.storage[storageArea].set({
count: expected[0].value,
one: item1.expectedValue,
});
const actual = await storage.getItems(params);
const actual = await storage.getItems([item1.key, item2.key]);
expect(actual).toEqual(expected);
expect(actual).toEqual([
{ key: item1.key, value: item1.expectedValue },
{ key: item2.key, value: item2.expectedValue },
]);
});
it('should get values from multiple storage items', async () => {
const item1 = storage.defineItem(`${storageArea}:one`);
const expectedValue1 = 1;
const item2 = storage.defineItem(`${storageArea}:two`);
const expectedValue2 = null;
await fakeBrowser.storage[storageArea].set({
one: expectedValue1,
});
const actual = await storage.getItems([item1, item2]);
expect(actual).toEqual([
{ key: item1.key, value: expectedValue1 },
{ key: item2.key, value: expectedValue2 },
]);
});
it('should get values for a combination of different input types', async () => {
const key1 = `${storageArea}:one` as const;
const expectedValue1 = 1;
const item2 = storage.defineItem<number>(`${storageArea}:two`);
const expectedValue2 = 2;
await fakeBrowser.storage[storageArea].set({
one: expectedValue1,
two: expectedValue2,
});
const actual = await storage.getItems([key1, item2]);
expect(actual).toEqual([
{ key: key1, value: expectedValue1 },
{ key: item2.key, value: expectedValue2 },
]);
});
it('should return fallback values for keys when provided', async () => {
const key1 = `${storageArea}:one` as const;
const expectedValue1 = null;
const key2 = `${storageArea}:two` as const;
const fallback2 = 2;
const expectedValue2 = fallback2;
const actual = await storage.getItems([
key1,
{ key: key2, options: { fallback: fallback2 } },
]);
expect(actual).toEqual([
{ key: key1, value: expectedValue1 },
{ key: key2, value: expectedValue2 },
]);
});
it('should return fallback values for items when provided', async () => {
const item1 = storage.defineItem<number>(`${storageArea}:one`);
const expectedValue1 = null;
const item2 = storage.defineItem(`${storageArea}:two`, {
fallback: 2,
});
const expectedValue2 = item2.fallback;
const actual = await storage.getItems([item1, item2]);
expect(actual).toEqual([
{ key: item1.key, value: expectedValue1 },
{ key: item2.key, value: expectedValue2 },
]);
});
});
@@ -153,7 +222,7 @@ describe('Storage Utils', () => {
describe('setMeta', () => {
it('should set metadata at key+$', async () => {
const existing = { v: 1 };
await browser.storage[storageArea].set({ count$: existing });
await chrome.storage[storageArea].set({ count$: existing });
const newValues = {
date: Date.now(),
};
@@ -169,7 +238,7 @@ describe('Storage Utils', () => {
'should remove any properties set to %s',
async (version) => {
const existing = { v: 1 };
await browser.storage[storageArea].set({ count$: existing });
await chrome.storage[storageArea].set({ count$: existing });
const expected = {};
await storage.setMeta(`${storageArea}:count`, { v: version });
@@ -180,6 +249,74 @@ describe('Storage Utils', () => {
);
});
describe('setMetas', () => {
it('should set key metadata correctly', async () => {
const key1 = `${storageArea}:one` as const;
const initialMeta1 = {};
const setMeta1 = { v: 1 };
const expectedMeta1 = setMeta1;
const key2 = `${storageArea}:two` as const;
const initialMeta2 = { v: 1 };
const setMeta2 = { v: 2 };
const expectedMeta2 = setMeta2;
const key3 = `${storageArea}:three` as const;
const initialMeta3 = { v: 1 };
const setMeta3 = { d: Date.now() };
const expectedMeta3 = { ...initialMeta3, ...setMeta3 };
await fakeBrowser.storage[storageArea].set({
one$: initialMeta1,
two$: initialMeta2,
three$: initialMeta3,
});
await storage.setMetas([
{ key: key1, meta: setMeta1 },
{ key: key2, meta: setMeta2 },
{ key: key3, meta: setMeta3 },
]);
expect(await storage.getMeta(key1)).toEqual(expectedMeta1);
expect(await storage.getMeta(key2)).toEqual(expectedMeta2);
expect(await storage.getMeta(key3)).toEqual(expectedMeta3);
});
it('should set item metadata correctly', async () => {
const item1 = storage.defineItem(`${storageArea}:one`);
const initialMeta1 = {};
const setMeta1 = { v: 1 };
const expectedMeta1 = setMeta1;
const item2 = storage.defineItem(`${storageArea}:two`);
const initialMeta2 = { v: 1 };
const setMeta2 = { v: 2 };
const expectedMeta2 = setMeta2;
const item3 = storage.defineItem(`${storageArea}:three`);
const initialMeta3 = { v: 1 };
const setMeta3 = { d: Date.now() };
const expectedMeta3 = { ...initialMeta3, ...setMeta3 };
await fakeBrowser.storage[storageArea].set({
one$: initialMeta1,
two$: initialMeta2,
three$: initialMeta3,
});
await storage.setMetas([
{ item: item1, meta: setMeta1 },
{ item: item2, meta: setMeta2 },
{ item: item3, meta: setMeta3 },
]);
expect(await item1.getMeta()).toEqual(expectedMeta1);
expect(await item2.getMeta()).toEqual(expectedMeta2);
expect(await item3.getMeta()).toEqual(expectedMeta3);
});
});
describe('removeItem', () => {
it('should remove the key from storage', async () => {
await fakeBrowser.storage[storageArea].set({ count: 456 });
@@ -219,29 +356,148 @@ describe('Storage Utils', () => {
});
describe('removeItems', () => {
it('should remove multiple items', async () => {
it('should remove multiple keys', async () => {
const key1 = `${storageArea}:one` as const;
const key2 = `${storageArea}:two` as const;
const key3 = `${storageArea}:three` as const;
await fakeBrowser.storage[storageArea].set({
['one']: '1',
['two']: null,
['two$']: { v: 1 },
['three']: '1',
['three$']: { v: 1 },
one: 1,
two: 2,
});
await storage.removeItems([key1, key2]);
expect(await storage.getItem(key1)).toBeNull();
expect(await storage.getItem(key2)).toBeNull();
});
it('should remove multiple keys and metadata when requested', async () => {
const key1 = `${storageArea}:one` as const;
const key2 = `${storageArea}:two` as const;
await fakeBrowser.storage[storageArea].set({
one: 1,
one$: { v: 1 },
two: 2,
two$: { v: 1 },
});
await storage.removeItems([
key1,
key2,
{ key: key3, options: { removeMeta: true } },
{ key: key2, options: { removeMeta: true } },
]);
expect(await storage.getItem(key1)).toBeNull();
expect(await storage.getMeta(key1)).toEqual({ v: 1 });
expect(await storage.getItem(key2)).toBeNull();
expect(await storage.getMeta(key2)).toEqual({ v: 1 });
expect(await storage.getItem(key3)).toBeNull();
expect(await storage.getMeta(key3)).toEqual({});
expect(await storage.getMeta(key2)).toEqual({});
});
it('should remove multiple items', async () => {
const item1 = storage.defineItem(`${storageArea}:one`);
const item2 = storage.defineItem(`${storageArea}:two`);
await fakeBrowser.storage[storageArea].set({
one: 1,
two: 2,
});
await storage.removeItems([item1, item2]);
expect(await item1.getValue()).toBeNull();
expect(await item2.getValue()).toBeNull();
});
it('should remove multiple items and metadata when requested', async () => {
const item1 = storage.defineItem(`${storageArea}:one`);
const item2 = storage.defineItem(`${storageArea}:two`);
await fakeBrowser.storage[storageArea].set({
one: 1,
one$: { v: 1 },
two: 2,
two$: { v: 1 },
});
await storage.removeItems([
item1,
{ item: item2, options: { removeMeta: true } },
]);
expect(await item1.getValue()).toBeNull();
expect(await item1.getMeta()).toEqual({ v: 1 });
expect(await item2.getValue()).toBeNull();
expect(await item2.getMeta()).toEqual({});
});
it('should remove multiple items', async () => {
const item1 = storage.defineItem(`${storageArea}:one`);
const item2 = storage.defineItem(`${storageArea}:two`);
await fakeBrowser.storage.local.set({
one: 1,
two: 2,
});
await storage.removeItems([item1, item2]);
expect(await item1.getValue()).toBeNull();
expect(await item2.getValue()).toBeNull();
});
it('should remove items using { item: WxtStorageItem, options?: RemoveItemOptions } objects', async () => {
const item1 = storage.defineItem('local:item1');
const item2 = storage.defineItem('session:item2');
await item1.setValue('value1');
await item1.setMeta({ v: 1 });
await item2.setValue('value2');
await item2.setMeta({ v: 1 });
await storage.removeItems([
{ item: item1, options: { removeMeta: true } },
{ item: item2, options: { removeMeta: false } },
]);
expect(await item1.getValue()).toBeNull();
expect(await item1.getMeta()).toEqual({});
expect(await item2.getValue()).toBeNull();
expect(await item2.getMeta()).toEqual({ v: 1 });
});
it('should handle a mix of different input types', async () => {
const item1 = storage.defineItem('local:item1');
const item2 = storage.defineItem('session:item2');
const item3 = storage.defineItem('local:item3');
await item1.setValue('value1');
await item2.setValue('value2');
await item3.setValue('value3');
await storage.removeItems([
'local:item1',
item2,
{ key: 'local:item3', options: { removeMeta: true } },
]);
expect(await storage.getItem('local:item1')).toBeNull();
expect(await item2.getValue()).toBeNull();
expect(await item3.getValue()).toBeNull();
expect(await item3.getMeta()).toEqual({});
});
it('should not throw an error when removing non-existent items', async () => {
const item = storage.defineItem('local:non_existent');
await expect(storage.removeItems([item])).resolves.not.toThrow();
});
});
describe('clear', () => {
it('should remove all items', async () => {
await fakeBrowser.storage[storageArea].set({
one: 1,
two: 2,
});
await storage.clear(storageArea);
expect(await fakeBrowser.storage[storageArea].get()).toEqual({});
});
});
@@ -400,6 +656,22 @@ describe('Storage Utils', () => {
},
);
describe('Invalid storage areas', () => {
it('should not accept keys without a valid storage area prefix', async () => {
// @ts-expect-error
await storage.getItem('test').catch(() => {});
// @ts-expect-error
await storage.getItem('loca:test').catch(() => {});
});
it('should throw an error when using an invalid storage area', async () => {
// @ts-expect-error: Test passes if there is a type error here
await expect(storage.getItem('invalidArea:key')).rejects.toThrow(
'Invalid area',
);
});
});
describe('defineItem', () => {
describe('versioning', () => {
it('should migrate values to the latest when a version upgrade is detected', async () => {
@@ -553,6 +825,28 @@ describe('Storage Utils', () => {
'Version downgrade detected (v2 -> v1) for "local:count"',
);
});
it('should throw an error when defining an item with an invalid version', () => {
expect(() => storage.defineItem('local:key', { version: 0 })).toThrow(
'Storage item version cannot be less than 1',
);
});
it('should handle errors in migration functions', async () => {
const cause = Error('Some error');
const expectedError = new MigrationError('local:key', 2, { cause });
const item = storage.defineItem<number>('local:key', {
version: 3,
migrations: {
2: () => {
throw cause;
},
},
});
await fakeBrowser.storage.local.set({ key: 1, key$: { v: 1 } });
await expect(item.migrate()).rejects.toThrow(expectedError);
});
});
describe('getValue', () => {
@@ -872,6 +1166,24 @@ describe('Storage Utils', () => {
await expect(storage.getItem('local:test')).resolves.toBe(expected);
});
it("should re-initialize a value on the next call to getValue if it's been removed", async () => {
const init = vi.fn().mockImplementation(Math.random);
const item = storage.defineItem<number>('local:key', { init });
await waitForInit();
await item.removeValue();
// Make sure it's actually blank before running the test
expect(await chrome.storage.local.get()).toEqual({});
init.mockClear();
const [value1, value2] = await Promise.all([
item.getValue(),
item.getValue(),
]);
expect(init).toBeCalledTimes(1);
expect(value1).toBe(value2);
});
});
describe('types', () => {
@@ -896,12 +1208,173 @@ describe('Storage Utils', () => {
});
});
describe('types', () => {
it('should not accept keys without a valid storage area prefix', async () => {
// @ts-expect-error: Test passes if there is a type error here
await storage.getItem('test').catch(() => {});
// @ts-expect-error
await storage.getItem('loca:test').catch(() => {});
describe('Multiple Storage Areas', () => {
describe('getItems', () => {
it('should get the values of multiple storage items efficiently', async () => {
const item1 = storage.defineItem<number>('local:item1');
const item2 = storage.defineItem<string>('session:item2');
const item3 = storage.defineItem<boolean>('local:item3');
await item1.setValue(42);
await item2.setValue('hello');
await item3.setValue(false);
const localGetSpy = vi.spyOn(fakeBrowser.storage.local, 'get');
const sessionGetSpy = vi.spyOn(fakeBrowser.storage.session, 'get');
const values = await storage.getItems([item1, item2, item3]);
expect(values).toEqual([
{
key: 'local:item1',
value: 42,
},
{
key: 'session:item2',
value: 'hello',
},
{
key: 'local:item3',
value: false,
},
]);
expect(localGetSpy).toBeCalledTimes(1);
expect(localGetSpy).toBeCalledWith(['item1', 'item3']);
expect(sessionGetSpy).toBeCalledTimes(1);
expect(sessionGetSpy).toBeCalledWith(['item2']);
});
it('should return values in the same order as input', async () => {
const item1 = storage.defineItem<number>('local:item1');
const item2 = storage.defineItem<string>('session:item2');
const item3 = storage.defineItem<boolean>('local:item3');
expect(await storage.getItems([item1, item2, item3])).toEqual([
{ key: item1.key, value: null },
{ key: item2.key, value: null },
{ key: item3.key, value: null },
]);
expect(await storage.getItems([item3, item2, item1])).toEqual([
{ key: item3.key, value: null },
{ key: item2.key, value: null },
{ key: item1.key, value: null },
]);
});
});
describe('getMetas', () => {
it('should get the metadata of multiple storage items efficiently', async () => {
const item1 = storage.defineItem<number, { v: number }>('local:item1');
const item2 = storage.defineItem<string, { date: number }>(
'session:item2',
);
const item3 = storage.defineItem<boolean, { flag: boolean }>(
'local:item3',
);
await item1.setMeta({ v: 1 });
await item2.setMeta({ date: 1234567890 });
// item3 has no meta
const localGetSpy = vi.spyOn(fakeBrowser.storage.local, 'get');
const sessionGetSpy = vi.spyOn(fakeBrowser.storage.session, 'get');
const metas = await storage.getMetas([item1, item2, item3]);
expect(metas).toEqual([
{ key: item1.key, meta: { v: 1 } },
{ key: item2.key, meta: { date: 1234567890 } },
{ key: item3.key, meta: {} },
]);
expect(localGetSpy).toBeCalledTimes(1);
expect(localGetSpy).toBeCalledWith(['item1$', 'item3$']);
expect(sessionGetSpy).toBeCalledTimes(1);
expect(sessionGetSpy).toBeCalledWith(['item2$']);
});
it('should return the metadata in the same order as input', async () => {
const item1 = storage.defineItem<number, { v: number }>('local:item1');
const item2 = storage.defineItem<string, { date: number }>(
'session:item2',
);
const item3 = storage.defineItem<boolean, { flag: boolean }>(
'local:item3',
);
expect(await storage.getMetas([item1, item2, item3])).toEqual([
{ key: item1.key, meta: {} },
{ key: item2.key, meta: {} },
{ key: item3.key, meta: {} },
]);
expect(await storage.getMetas([item3, item2, item1])).toEqual([
{ key: item3.key, meta: {} },
{ key: item2.key, meta: {} },
{ key: item1.key, meta: {} },
]);
});
});
describe('setItems', () => {
it('should set the values of multiple storage items efficiently', async () => {
const item1 = storage.defineItem<number>('local:item1');
const value1 = 100;
const item2 = storage.defineItem<string>('session:item2');
const value2 = 'test';
const item3 = storage.defineItem<boolean>('local:item3');
const value3 = true;
const localSetSpy = vi.spyOn(fakeBrowser.storage.local, 'set');
const sessionSetSpy = vi.spyOn(fakeBrowser.storage.session, 'set');
await storage.setItems([
{ item: item1, value: value1 },
{ item: item2, value: value2 },
{ item: item3, value: value3 },
]);
expect(localSetSpy).toBeCalledTimes(1);
expect(localSetSpy).toBeCalledWith({ item1: value1, item3: value3 });
expect(sessionSetSpy).toBeCalledTimes(1);
expect(sessionSetSpy).toBeCalledWith({ item2: value2 });
});
});
describe('setMetas', () => {
it('should set metadata efficiently', async () => {
const item1 = storage.defineItem<number, { v: number }>('local:one');
const item2 = storage.defineItem<string, { v: number }>('session:two');
const item3 = storage.defineItem<boolean, { v: number }>('local:three');
await waitForInit();
const localGetSpy = vi.spyOn(fakeBrowser.storage.local, 'get');
const sessionGetSpy = vi.spyOn(fakeBrowser.storage.session, 'get');
const localSetSpy = vi.spyOn(fakeBrowser.storage.local, 'set');
const sessionSetSpy = vi.spyOn(fakeBrowser.storage.session, 'set');
await storage.setMetas([
{ item: item1, meta: { v: 1 } },
{ item: item2, meta: { v: 2 } },
{ item: item3, meta: { v: 3 } },
]);
console.log(localGetSpy.mock.calls);
expect(localGetSpy).toBeCalledTimes(1);
expect(localGetSpy).toBeCalledWith(['one$', 'three$']);
expect(sessionGetSpy).toBeCalledTimes(1);
expect(sessionGetSpy).toBeCalledWith(['two$']);
expect(localSetSpy).toBeCalledTimes(1);
expect(localSetSpy).toBeCalledWith({
one$: { v: 1 },
three$: { v: 3 },
});
expect(sessionSetSpy).toBeCalledTimes(1);
expect(sessionSetSpy).toBeCalledWith({
two$: { v: 2 },
});
});
});
it('should return a nullable type when getItem is called without a fallback', async () => {
+892
View File
@@ -0,0 +1,892 @@
/// <reference types="chrome" />
/**
* Simplified storage APIs with support for versioned fields, snapshots, metadata, and item definitions.
*
* See [the guide](https://wxt.dev/storage.html) for more information.
* @module @wxt-dev/storage
*/
import { dequal } from 'dequal/lite';
import { Mutex } from 'async-mutex';
const browser: typeof chrome =
// @ts-expect-error
globalThis.browser?.runtime?.id == null
? globalThis.chrome
: // @ts-expect-error
globalThis.browser;
export const storage = createStorage();
function createStorage(): WxtStorage {
const drivers: Record<StorageArea, WxtStorageDriver> = {
local: createDriver('local'),
session: createDriver('session'),
sync: createDriver('sync'),
managed: createDriver('managed'),
};
const getDriver = (area: StorageArea) => {
const driver = drivers[area];
if (driver == null) {
const areaNames = Object.keys(drivers).join(', ');
throw Error(`Invalid area "${area}". Options: ${areaNames}`);
}
return driver;
};
const resolveKey = (key: StorageItemKey) => {
const deliminatorIndex = key.indexOf(':');
const driverArea = key.substring(0, deliminatorIndex) as StorageArea;
const driverKey = key.substring(deliminatorIndex + 1);
if (driverKey == null)
throw Error(
`Storage key should be in the form of "area:key", but received "${key}"`,
);
return {
driverArea,
driverKey,
driver: getDriver(driverArea),
};
};
const getMetaKey = (key: string) => key + '$';
const mergeMeta = (oldMeta: any, newMeta: any): any => {
const newFields = { ...oldMeta };
Object.entries(newMeta).forEach(([key, value]) => {
if (value == null) delete newFields[key];
else newFields[key] = value;
});
return newFields;
};
const getValueOrFallback = (value: any, fallback: any) =>
value ?? fallback ?? null;
const getMetaValue = (properties: any) =>
typeof properties === 'object' && !Array.isArray(properties)
? properties
: {};
const getItem = async (
driver: WxtStorageDriver,
driverKey: string,
opts: GetItemOptions<any> | undefined,
) => {
const res = await driver.getItem<any>(driverKey);
return getValueOrFallback(res, opts?.fallback ?? opts?.defaultValue);
};
const getMeta = async (driver: WxtStorageDriver, driverKey: string) => {
const metaKey = getMetaKey(driverKey);
const res = await driver.getItem<any>(metaKey);
return getMetaValue(res);
};
const setItem = async (
driver: WxtStorageDriver,
driverKey: string,
value: any,
) => {
await driver.setItem(driverKey, value ?? null);
};
const setMeta = async (
driver: WxtStorageDriver,
driverKey: string,
properties: any | undefined,
) => {
const metaKey = getMetaKey(driverKey);
const existingFields = getMetaValue(await driver.getItem(metaKey));
await driver.setItem(metaKey, mergeMeta(existingFields, properties));
};
const removeItem = async (
driver: WxtStorageDriver,
driverKey: string,
opts: RemoveItemOptions | undefined,
) => {
await driver.removeItem(driverKey);
if (opts?.removeMeta) {
const metaKey = getMetaKey(driverKey);
await driver.removeItem(metaKey);
}
};
const removeMeta = async (
driver: WxtStorageDriver,
driverKey: string,
properties: string | string[] | undefined,
) => {
const metaKey = getMetaKey(driverKey);
if (properties == null) {
await driver.removeItem(metaKey);
} else {
const newFields = getMetaValue(await driver.getItem(metaKey));
[properties].flat().forEach((field) => delete newFields[field]);
await driver.setItem(metaKey, newFields);
}
};
const watch = (
driver: WxtStorageDriver,
driverKey: string,
cb: WatchCallback<any>,
) => {
return driver.watch(driverKey, cb);
};
const storage: WxtStorage = {
getItem: async (key, opts) => {
const { driver, driverKey } = resolveKey(key);
return await getItem(driver, driverKey, opts);
},
getItems: async (keys) => {
const areaToKeyMap = new Map<StorageArea, string[]>();
const keyToOptsMap = new Map<string, GetItemOptions<any> | undefined>();
const orderedKeys: StorageItemKey[] = [];
keys.forEach((key) => {
let keyStr: StorageItemKey;
let opts: GetItemOptions<any> | undefined;
if (typeof key === 'string') {
// key: string
keyStr = key;
} else if ('getValue' in key) {
// key: WxtStorageItem
keyStr = key.key;
opts = { fallback: key.fallback };
} else {
// key: { key, options }
keyStr = key.key;
opts = key.options;
}
orderedKeys.push(keyStr);
const { driverArea, driverKey } = resolveKey(keyStr);
const areaKeys = areaToKeyMap.get(driverArea) ?? [];
areaToKeyMap.set(driverArea, areaKeys.concat(driverKey));
keyToOptsMap.set(keyStr, opts);
});
const resultsMap = new Map<StorageItemKey, any>();
await Promise.all(
Array.from(areaToKeyMap.entries()).map(async ([driverArea, keys]) => {
const driverResults = await drivers[driverArea].getItems(keys);
driverResults.forEach((driverResult) => {
const key = `${driverArea}:${driverResult.key}` as StorageItemKey;
const opts = keyToOptsMap.get(key);
const value = getValueOrFallback(
driverResult.value,
opts?.fallback ?? opts?.defaultValue,
);
resultsMap.set(key, value);
});
}),
);
return orderedKeys.map((key) => ({
key,
value: resultsMap.get(key),
}));
},
getMeta: async (key) => {
const { driver, driverKey } = resolveKey(key);
return await getMeta(driver, driverKey);
},
getMetas: async (args) => {
const keys = args.map((arg) => {
const key = typeof arg === 'string' ? arg : arg.key;
const { driverArea, driverKey } = resolveKey(key);
return {
key,
driverArea,
driverKey,
driverMetaKey: getMetaKey(driverKey),
};
});
const areaToDriverMetaKeysMap = keys.reduce<
Partial<Record<StorageArea, (typeof keys)[number][]>>
>((map, key) => {
map[key.driverArea] ??= [];
map[key.driverArea]!.push(key);
return map;
}, {});
const resultsMap: Record<string, any> = {};
await Promise.all(
Object.entries(areaToDriverMetaKeysMap).map(async ([area, keys]) => {
const areaRes = await browser.storage[area as StorageArea].get(
keys.map((key) => key.driverMetaKey),
);
keys.forEach((key) => {
resultsMap[key.key] = areaRes[key.driverMetaKey] ?? {};
});
}),
);
return keys.map((key) => ({
key: key.key,
meta: resultsMap[key.key],
}));
},
setItem: async (key, value) => {
const { driver, driverKey } = resolveKey(key);
await setItem(driver, driverKey, value);
},
setItems: async (items) => {
const areaToKeyValueMap: Partial<
Record<StorageArea, Array<{ key: string; value: any }>>
> = {};
items.forEach((item) => {
const { driverArea, driverKey } = resolveKey(
'key' in item ? item.key : item.item.key,
);
areaToKeyValueMap[driverArea] ??= [];
areaToKeyValueMap[driverArea].push({
key: driverKey,
value: item.value,
});
});
await Promise.all(
Object.entries(areaToKeyValueMap).map(async ([driverArea, values]) => {
const driver = getDriver(driverArea as StorageArea);
await driver.setItems(values);
}),
);
},
setMeta: async (key, properties) => {
const { driver, driverKey } = resolveKey(key);
await setMeta(driver, driverKey, properties);
},
setMetas: async (items) => {
const areaToMetaUpdatesMap: Partial<
Record<StorageArea, { key: string; properties: any }[]>
> = {};
items.forEach((item) => {
const { driverArea, driverKey } = resolveKey(
'key' in item ? item.key : item.item.key,
);
areaToMetaUpdatesMap[driverArea] ??= [];
areaToMetaUpdatesMap[driverArea].push({
key: driverKey,
properties: item.meta,
});
});
await Promise.all(
Object.entries(areaToMetaUpdatesMap).map(
async ([storageArea, updates]) => {
const driver = getDriver(storageArea as StorageArea);
const metaKeys = updates.map(({ key }) => getMetaKey(key));
console.log(storageArea, metaKeys);
const existingMetas = await driver.getItems(metaKeys);
const existingMetaMap = Object.fromEntries(
existingMetas.map(({ key, value }) => [key, getMetaValue(value)]),
);
const metaUpdates = updates.map(({ key, properties }) => {
const metaKey = getMetaKey(key);
return {
key: metaKey,
value: mergeMeta(existingMetaMap[metaKey] ?? {}, properties),
};
});
await driver.setItems(metaUpdates);
},
),
);
},
removeItem: async (key, opts) => {
const { driver, driverKey } = resolveKey(key);
await removeItem(driver, driverKey, opts);
},
removeItems: async (keys) => {
const areaToKeysMap: Partial<Record<StorageArea, string[]>> = {};
keys.forEach((key) => {
let keyStr: StorageItemKey;
let opts: RemoveItemOptions | undefined;
if (typeof key === 'string') {
// key: string
keyStr = key;
} else if ('getValue' in key) {
// key: WxtStorageItem
keyStr = key.key;
} else if ('item' in key) {
// key: { item, options }
keyStr = key.item.key;
opts = key.options;
} else {
// key: { key, options }
keyStr = key.key;
opts = key.options;
}
const { driverArea, driverKey } = resolveKey(keyStr);
areaToKeysMap[driverArea] ??= [];
areaToKeysMap[driverArea].push(driverKey);
if (opts?.removeMeta) {
areaToKeysMap[driverArea].push(getMetaKey(driverKey));
}
});
await Promise.all(
Object.entries(areaToKeysMap).map(async ([driverArea, keys]) => {
const driver = getDriver(driverArea as StorageArea);
await driver.removeItems(keys);
}),
);
},
clear: async (base) => {
const driver = getDriver(base);
await driver.clear();
},
removeMeta: async (key, properties) => {
const { driver, driverKey } = resolveKey(key);
await removeMeta(driver, driverKey, properties);
},
snapshot: async (base, opts) => {
const driver = getDriver(base);
const data = await driver.snapshot();
opts?.excludeKeys?.forEach((key) => {
delete data[key];
delete data[getMetaKey(key)];
});
return data;
},
restoreSnapshot: async (base, data) => {
const driver = getDriver(base);
await driver.restoreSnapshot(data);
},
watch: (key, cb) => {
const { driver, driverKey } = resolveKey(key);
return watch(driver, driverKey, cb);
},
unwatch() {
Object.values(drivers).forEach((driver) => {
driver.unwatch();
});
},
defineItem: (key, opts?: WxtStorageItemOptions<any>) => {
const { driver, driverKey } = resolveKey(key);
const { version: targetVersion = 1, migrations = {} } = opts ?? {};
if (targetVersion < 1) {
throw Error(
'Storage item version cannot be less than 1. Initial versions should be set to 1, not 0.',
);
}
const migrate = async () => {
const driverMetaKey = getMetaKey(driverKey);
const [{ value }, { value: meta }] = await driver.getItems([
driverKey,
driverMetaKey,
]);
if (value == null) return;
const currentVersion = meta?.v ?? 1;
if (currentVersion > targetVersion) {
throw Error(
`Version downgrade detected (v${currentVersion} -> v${targetVersion}) for "${key}"`,
);
}
console.debug(
`[@wxt-dev/storage] Running storage migration for ${key}: v${currentVersion} -> v${targetVersion}`,
);
const migrationsToRun = Array.from(
{ length: targetVersion - currentVersion },
(_, i) => currentVersion + i + 1,
);
let migratedValue = value;
for (const migrateToVersion of migrationsToRun) {
try {
migratedValue =
(await migrations?.[migrateToVersion]?.(migratedValue)) ??
migratedValue;
} catch (err) {
throw new MigrationError(key, migrateToVersion, {
cause: err,
});
}
}
await driver.setItems([
{ key: driverKey, value: migratedValue },
{ key: driverMetaKey, value: { ...meta, v: targetVersion } },
]);
console.debug(
`[@wxt-dev/storage] Storage migration completed for ${key} v${targetVersion}`,
{ migratedValue },
);
};
const migrationsDone =
opts?.migrations == null
? Promise.resolve()
: migrate().catch((err) => {
console.error(
`[@wxt-dev/storage] Migration failed for ${key}`,
err,
);
});
const initMutex = new Mutex();
const getFallback = () => opts?.fallback ?? opts?.defaultValue ?? null;
const getOrInitValue = () =>
initMutex.runExclusive(async () => {
const value = await driver.getItem<any>(driverKey);
// Don't init value if it already exists or the init function isn't provided
if (value != null || opts?.init == null) return value;
const newValue = await opts.init();
await driver.setItem<any>(driverKey, newValue);
return newValue;
});
// Initialize the value once migrations have finished
migrationsDone.then(getOrInitValue);
return {
key,
get defaultValue() {
return getFallback();
},
get fallback() {
return getFallback();
},
getValue: async () => {
await migrationsDone;
if (opts?.init) {
return await getOrInitValue();
} else {
return await getItem(driver, driverKey, opts);
}
},
getMeta: async () => {
await migrationsDone;
return await getMeta(driver, driverKey);
},
setValue: async (value) => {
await migrationsDone;
return await setItem(driver, driverKey, value);
},
setMeta: async (properties) => {
await migrationsDone;
return await setMeta(driver, driverKey, properties);
},
removeValue: async (opts) => {
await migrationsDone;
return await removeItem(driver, driverKey, opts);
},
removeMeta: async (properties) => {
await migrationsDone;
return await removeMeta(driver, driverKey, properties);
},
watch: (cb) =>
watch(driver, driverKey, (newValue, oldValue) =>
cb(newValue ?? getFallback(), oldValue ?? getFallback()),
),
migrate,
};
},
};
return storage;
}
function createDriver(storageArea: StorageArea): WxtStorageDriver {
const getStorageArea = () => {
if (browser.runtime == null) {
throw Error(
[
"'wxt/storage' must be loaded in a web extension environment",
'\n - If thrown during a build, see https://github.com/wxt-dev/wxt/issues/371',
" - If thrown during tests, mock 'wxt/browser' correctly. See https://wxt.dev/guide/go-further/testing.html\n",
].join('\n'),
);
}
if (browser.storage == null) {
throw Error(
"You must add the 'storage' permission to your manifest to use 'wxt/storage'",
);
}
const area = browser.storage[storageArea];
if (area == null)
throw Error(`"browser.storage.${storageArea}" is undefined`);
return area;
};
const watchListeners = new Set<(changes: StorageAreaChanges) => void>();
return {
getItem: async (key) => {
const res = await getStorageArea().get(key);
return res[key];
},
getItems: async (keys) => {
const result = await getStorageArea().get(keys);
return keys.map((key) => ({ key, value: result[key] ?? null }));
},
setItem: async (key, value) => {
if (value == null) {
await getStorageArea().remove(key);
} else {
await getStorageArea().set({ [key]: value });
}
},
setItems: async (values) => {
const map = values.reduce<Record<string, unknown>>(
(map, { key, value }) => {
map[key] = value;
return map;
},
{},
);
await getStorageArea().set(map);
},
removeItem: async (key) => {
await getStorageArea().remove(key);
},
removeItems: async (keys) => {
await getStorageArea().remove(keys);
},
clear: async () => {
await getStorageArea().clear();
},
snapshot: async () => {
return await getStorageArea().get();
},
restoreSnapshot: async (data) => {
await getStorageArea().set(data);
},
watch(key, cb) {
const listener = (changes: StorageAreaChanges) => {
const change = changes[key];
if (change == null) return;
if (dequal(change.newValue, change.oldValue)) return;
cb(change.newValue ?? null, change.oldValue ?? null);
};
getStorageArea().onChanged.addListener(listener);
watchListeners.add(listener);
return () => {
getStorageArea().onChanged.removeListener(listener);
watchListeners.delete(listener);
};
},
unwatch() {
watchListeners.forEach((listener) => {
getStorageArea().onChanged.removeListener(listener);
});
watchListeners.clear();
},
};
}
export interface WxtStorage {
/**
* Get an item from storage, or return `null` if it doesn't exist.
*
* @example
* await storage.getItem<number>("local:installDate");
*/
getItem<TValue>(
key: StorageItemKey,
opts: GetItemOptions<TValue> & { fallback: TValue },
): Promise<TValue>;
getItem<TValue>(
key: StorageItemKey,
opts?: GetItemOptions<TValue>,
): Promise<TValue | null>;
/**
* Get multiple items from storage. The return order is guaranteed to be the same as the order
* requested.
*
* @example
* await storage.getItems(["local:installDate", "session:someCounter"]);
*/
getItems(
keys: Array<
| StorageItemKey
| WxtStorageItem<any, any>
| { key: StorageItemKey; options?: GetItemOptions<any> }
>,
): Promise<Array<{ key: StorageItemKey; value: any }>>;
/**
* Return an object containing metadata about the key. Object is stored at `key + "$"`. If value
* is not an object, it returns an empty object.
*
* @example
* await storage.getMeta("local:installDate");
*/
getMeta<T extends Record<string, unknown>>(key: StorageItemKey): Promise<T>;
/**
* Get the metadata of multiple storage items.
*
* @param items List of keys or items to get the metadata of.
* @returns An array containing storage keys and their metadata.
*/
getMetas(
keys: Array<StorageItemKey | WxtStorageItem<any, any>>,
): Promise<Array<{ key: StorageItemKey; meta: any }>>;
/**
* Set a value in storage. Setting a value to `null` or `undefined` is equivalent to calling
* `removeItem`.
*
* @example
* await storage.setItem<number>("local:installDate", Date.now());
*/
setItem<T>(key: StorageItemKey, value: T | null): Promise<void>;
/**
* Set multiple values in storage. If a value is set to `null` or `undefined`, the key is removed.
*
* @example
* await storage.setItem([
* { key: "local:installDate", value: Date.now() },
* { key: "session:someCounter, value: 5 },
* ]);
*/
setItems(
values: Array<
| { key: StorageItemKey; value: any }
| { item: WxtStorageItem<any, any>; value: any }
>,
): Promise<void>;
/**
* Sets metadata properties. If some properties are already set, but are not included in the
* `properties` parameter, they will not be removed.
*
* @example
* await storage.setMeta("local:installDate", { appVersion });
*/
setMeta<T extends Record<string, unknown>>(
key: StorageItemKey,
properties: T | null,
): Promise<void>;
/**
* Set the metadata of multiple storage items.
*
* @param items List of storage keys or items and metadata to set for each.
*/
setMetas(
metas: Array<
| { key: StorageItemKey; meta: Record<string, any> }
| { item: WxtStorageItem<any, any>; meta: Record<string, any> }
>,
): Promise<void>;
/**
* Removes an item from storage.
*
* @example
* await storage.removeItem("local:installDate");
*/
removeItem(key: StorageItemKey, opts?: RemoveItemOptions): Promise<void>;
/**
* Remove a list of keys from storage.
*/
removeItems(
keys: Array<
| StorageItemKey
| WxtStorageItem<any, any>
| { key: StorageItemKey; options?: RemoveItemOptions }
| { item: WxtStorageItem<any, any>; options?: RemoveItemOptions }
>,
): Promise<void>;
/**
* Removes all items from the provided storage area.
*/
clear(base: StorageArea): Promise<void>;
/**
* Remove the entire metadata for a key, or specific properties by name.
*
* @example
* // Remove all metadata properties from the item
* await storage.removeMeta("local:installDate");
*
* // Remove only specific the "v" field
* await storage.removeMeta("local:installDate", "v")
*/
removeMeta(
key: StorageItemKey,
properties?: string | string[],
): Promise<void>;
/**
* Return all the items in storage.
*/
snapshot(
base: StorageArea,
opts?: SnapshotOptions,
): Promise<Record<string, unknown>>;
/**
* Restores the results of `snapshot`. If new properties have been saved since the snapshot, they are
* not overridden. Only values existing in the snapshot are overridden.
*/
restoreSnapshot(base: StorageArea, data: any): Promise<void>;
/**
* Watch for changes to a specific key in storage.
*/
watch<T>(key: StorageItemKey, cb: WatchCallback<T | null>): Unwatch;
/**
* Remove all watch listeners.
*/
unwatch(): void;
/**
* Define a storage item with a default value, type, or versioning.
*
* Read full docs: https://wxt.dev/storage.html#defining-storage-items
*/
defineItem<TValue, TMetadata extends Record<string, unknown> = {}>(
key: StorageItemKey,
): WxtStorageItem<TValue | null, TMetadata>;
defineItem<TValue, TMetadata extends Record<string, unknown> = {}>(
key: StorageItemKey,
options: WxtStorageItemOptions<TValue>,
): WxtStorageItem<TValue, TMetadata>;
}
interface WxtStorageDriver {
getItem<T>(key: string): Promise<T | null>;
getItems(keys: string[]): Promise<{ key: string; value: any }[]>;
setItem<T>(key: string, value: T | null): Promise<void>;
setItems(values: Array<{ key: string; value: any }>): Promise<void>;
removeItem(key: string): Promise<void>;
removeItems(keys: string[]): Promise<void>;
clear(): Promise<void>;
snapshot(): Promise<Record<string, unknown>>;
restoreSnapshot(data: Record<string, unknown>): Promise<void>;
watch<T>(key: string, cb: WatchCallback<T | null>): Unwatch;
unwatch(): void;
}
export interface WxtStorageItem<
TValue,
TMetadata extends Record<string, unknown>,
> {
/**
* The storage key passed when creating the storage item.
*/
key: StorageItemKey;
/**
* @deprecated Renamed to fallback, use it instead.
*/
defaultValue: TValue;
/**
* The value provided by the `fallback` option.
*/
fallback: TValue;
/**
* Get the latest value from storage.
*/
getValue(): Promise<TValue>;
/**
* Get metadata.
*/
getMeta(): Promise<NullablePartial<TMetadata>>;
/**
* Set the value in storage.
*/
setValue(value: TValue): Promise<void>;
/**
* Set metadata properties.
*/
setMeta(properties: NullablePartial<TMetadata>): Promise<void>;
/**
* Remove the value from storage.
*/
removeValue(opts?: RemoveItemOptions): Promise<void>;
/**
* Remove all metadata or certain properties from metadata.
*/
removeMeta(properties?: string[]): Promise<void>;
/**
* Listen for changes to the value in storage.
*/
watch(cb: WatchCallback<TValue>): Unwatch;
/**
* If there are migrations defined on the storage item, migrate to the latest version.
*
* **This function is ran automatically whenever the extension updates**, so you don't have to call it
* manually.
*/
migrate(): Promise<void>;
}
export type StorageArea = 'local' | 'session' | 'sync' | 'managed';
export type StorageItemKey = `${StorageArea}:${string}`;
export interface GetItemOptions<T> {
/**
* @deprecated Renamed to `fallback`, use it instead.
*/
defaultValue?: T;
/**
* Default value returned when `getItem` would otherwise return `null`.
*/
fallback?: T;
}
export interface RemoveItemOptions {
/**
* Optionally remove metadata when deleting a key.
*
* @default false
*/
removeMeta?: boolean;
}
export interface SnapshotOptions {
/**
* Exclude a list of keys. The storage area prefix should be removed since the snapshot is for a
* specific storage area already.
*/
excludeKeys?: string[];
}
export interface WxtStorageItemOptions<T> {
/**
* @deprecated Renamed to `fallback`, use it instead.
*/
defaultValue?: T;
/**
* Default value returned when `getValue` would otherwise return `null`.
*/
fallback?: T;
/**
* If passed, a value in storage will be initialized immediately after
* defining the storage item. This function returns the value that will be
* saved to storage during the initialization process if a value doesn't
* already exist.
*/
init?: () => T | Promise<T>;
/**
* Provide a version number for the storage item to enable migrations. When changing the version
* in the future, migration functions will be ran on application startup.
*/
version?: number;
/**
* A map of version numbers to the functions used to migrate the data to that version.
*/
migrations?: Record<number, (oldValue: any) => any>;
}
export type StorageAreaChanges = {
[key: string]: chrome.storage.StorageChange;
};
/**
* Same as `Partial`, but includes `| null`. It makes all the properties of an object optional and
* nullable.
*/
type NullablePartial<T> = {
[key in keyof T]+?: T[key] | undefined | null;
};
/**
* Callback called when a value in storage is changed.
*/
export type WatchCallback<T> = (newValue: T, oldValue: T) => void;
/**
* Call to remove a watch listener
*/
export type Unwatch = () => void;
export class MigrationError extends Error {
constructor(
public key: string,
public version: number,
options?: ErrorOptions,
) {
super(`v${version} migration failed for "${key}"`, options);
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"verbatimModuleSyntax": true,
"types": ["chrome"]
},
"exclude": ["node_modules/**", "dist/**"]
}
+9
View File
@@ -0,0 +1,9 @@
import { defineProject } from 'vitest/config';
export default defineProject({
test: {
mockReset: true,
restoreMocks: true,
setupFiles: ['vitest.setup.ts'],
},
});
+4
View File
@@ -0,0 +1,4 @@
import { fakeBrowser } from '@webext-core/fake-browser';
import { vi } from 'vitest';
vi.stubGlobal('chrome', fakeBrowser);
+47
View File
@@ -0,0 +1,47 @@
# WXT UnoCSS
Use UnoCSS in your WXT extension!
## Usage
Install the package:
```sh
npm i --save-dev @wxt-dev/unocss unocss
pnpm i -D @wxt-dev/unocss unocss
yarn add --dev @wxt-dev/unocss unocss
bun i -D @wxt-dev/unocss unocss
```
Add the module to `wxt.config.ts`:
```ts
export default defineConfig({
modules: ['@wxt-dev/unocss'],
});
```
Now in your entrypoint, import UnoCSS:
```ts
import 'uno.css';
```
> [!IMPORTANT]
> While in dev mode, you may see a warning about `uno.css` not being found. This is because in development, we don't know which files should be injected with UnoCSS styles. The warning can be safely ignored as the styles will be properly applied during the build process.
## Configuration
The module can be configured via the `unocss` config:
```ts
export default defineConfig({
modules: ['@wxt-dev/unocss'],
unocss: {
// Exclude unocss from running for the background
excludeEntrypoints: ['background'],
},
});
```
Options have JSDocs available in your editor, or you can read them in the source code: [`UnoCSSOptions`](https://github.com/wxt-dev/wxt/blob/main/packages/unocss/src/index.ts).
+55
View File
@@ -0,0 +1,55 @@
{
"name": "@wxt-dev/unocss",
"description": "UnoCSS integration for WXT",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "git+https://github.com/wxt-dev/wxt.git",
"directory": "packages/unocss"
},
"homepage": "http://wxt.dev/guide/unocss.html",
"keywords": [
"wxt",
"module",
"unocss",
"css"
],
"author": {
"name": "Florian Metz",
"email": "me@timeraa.dev"
},
"license": "MIT",
"type": "module",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
}
},
"files": [
"dist"
],
"scripts": {
"build": "buildc -- unbuild",
"check": "buildc --deps-only -- check"
},
"peerDependencies": {
"unocss": ">=0.60.0",
"wxt": ">=0.19.0"
},
"devDependencies": {
"@aklinker1/check": "catalog:",
"oxlint": "catalog:",
"publint": "catalog:",
"typescript": "catalog:",
"unbuild": "catalog:",
"unocss": "catalog:",
"wxt": "workspace:*"
},
"dependencies": {
"defu": "catalog:",
"fast-glob": "catalog:"
}
}
+68
View File
@@ -0,0 +1,68 @@
import 'wxt';
import { defineWxtModule } from 'wxt/modules';
import defu from 'defu';
import UnoCSS from 'unocss/vite';
export default defineWxtModule<UnoCSSOptions>({
name: '@wxt-dev/unocss',
configKey: 'unocss',
async setup(wxt, options) {
const resolvedOptions = defu<Required<UnoCSSOptions>, UnoCSSOptions[]>(
options,
{
enabled: true,
excludeEntrypoints: ['background'],
configOrPath: undefined,
},
);
if (!resolvedOptions.enabled)
return wxt.logger.warn(`\`[unocss]\` ${this.name} disabled`);
const excludedEntrypoints = new Set(resolvedOptions.excludeEntrypoints);
if (wxt.config.debug) {
wxt.logger.debug(
`\`[unocss]\` Excluded entrypoints:`,
[...excludedEntrypoints].join(', '),
);
}
wxt.hooks.hook('vite:devServer:extendConfig', (config) => {
config.plugins?.push(UnoCSS(resolvedOptions.configOrPath));
});
wxt.hooks.hook('vite:build:extendConfig', async (entries, config) => {
if (entries.every((entry) => excludedEntrypoints.has(entry.name))) return;
config.plugins?.push(UnoCSS(resolvedOptions.configOrPath));
});
},
});
/**
* Options for the UnoCSS module
*/
export interface UnoCSSOptions<Theme extends object = object> {
/**
* Enable UnoCSS
* @default true
*/
enabled?: boolean;
/**
* List of entrypoint names that UnoCSS is not used in. By default, the UnoCSS
* vite plugin is added to all build steps, but this option is used to exclude
* it from specific builds.
* @example ["popup", "options"]
* @default []
*/
excludeEntrypoints?: string[];
/**
* The path to your `unocss.config.ts` file, relative to <rootDir>, or inline configuration.
*/
configOrPath?: Parameters<typeof UnoCSS<Theme>>[0];
}
declare module 'wxt' {
export interface InlineConfig {
unocss?: UnoCSSOptions;
}
}
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"exclude": ["node_modules/**", "dist/**"]
}
+11 -9
View File
@@ -18,18 +18,20 @@
},
"dependencies": {
"@wxt-dev/i18n": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react": "catalog:",
"react-dom": "catalog:"
},
"devDependencies": {
"@types/chrome": "^0.0.269",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/chrome": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@wxt-dev/auto-icons": "workspace:*",
"sass": "^1.79.4",
"typescript": "^5.6.2",
"vitest": "^2.1.2",
"vitest-plugin-random-seed": "^1.1.0",
"@wxt-dev/unocss": "workspace:*",
"sass": "catalog:",
"typescript": "catalog:",
"unocss": "catalog:",
"vitest": "catalog:",
"vitest-plugin-random-seed": "catalog:",
"wxt": "workspace:*"
},
"buildc": {
-4
View File
@@ -1,4 +0,0 @@
body {
margin: 0;
padding: 0;
}
@@ -0,0 +1,76 @@
import 'uno.css';
import './style.css';
export default defineContentScript({
matches: ['https://*.duckduckgo.com/*'],
cssInjectionMode: 'manifest',
async main(ctx) {
const dynamicUI = createIntegratedUi(ctx, {
position: 'inline',
append: 'after',
anchor: 'form[role=search]',
onMount: (container) => {
const app = document.createElement('div');
container.id = 'automount-anchor';
app.classList.add('m-4', 'text-center', 'text-red-500');
app.textContent = i18n.t('prompt_for_name');
container.append(app);
return { container, app };
},
onRemove() {
console.log('dynamicUI removed');
},
});
const autoMountUi = createIntegratedUi(ctx, {
position: 'inline',
append: 'after',
anchor: '#automount-anchor',
onMount: (container) => {
const app = document.createElement('div');
app.id = 'automount-ui';
app.classList.add('m-0', 'text-center', 'text-blue-500');
app.textContent = `Hello, I'm automount UI.`;
container.append(app);
},
onRemove() {
console.log('autoMountUi removed');
},
});
autoMountUi.autoMount({
onStop: () => {
console.log('Auto mount stopped.');
},
});
const stopAutoMountButton = createIntegratedUi(ctx, {
position: 'inline',
append: 'last',
anchor: 'form[role=search]',
onMount: (container) => {
const app = document.createElement('button');
container.classList.add('flex', 'flex-justify-center');
app.classList.add('mt-4', 'p-2');
app.textContent = 'Stop auto-mount';
app.onclick = (e) => {
e.preventDefault();
autoMountUi.remove();
};
container.append(app);
return { container, app };
},
});
stopAutoMountButton.mount();
setInterval(() => {
if (dynamicUI.mounted) {
dynamicUI.remove();
} else {
dynamicUI.mount();
}
}, 2000);
},
});
@@ -0,0 +1,3 @@
:root {
color-scheme: dark;
}
@@ -14,12 +14,13 @@ export default defineBackground({
console.log(useAppConfig());
// @ts-expect-error: should only accept entrypoints or public assets
browser.runtime.getURL('/');
browser.runtime.getURL('/background.js');
browser.runtime.getURL('/icons/128.png');
browser.runtime.getURL('/example.html#hash');
browser.runtime.getURL('/example.html?query=param');
// @ts-expect-error: should only accept entrypoints or public assets
browser.runtime.getURL('/unknown');
// @ts-expect-error: should only allow hashes/query params on HTML files
browser.runtime.getURL('/icon-128.png?query=param');
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Popup</title>
<link rel="stylesheet" href="../common/style.css" />
<link rel="stylesheet" href="uno.css" />
</head>
<body>
<p>Hello popup!</p>
@@ -1,11 +1,16 @@
import '../../common/style.css';
import 'uno.css';
import './style.css';
import manualStyle from './manual-style.css?inline';
export default defineContentScript({
matches: ['https://*.duckduckgo.com/*'],
cssInjectionMode: 'ui',
async main(ctx) {
const style = document.createElement('style');
style.textContent = manualStyle;
document.head.append(style);
const ui = await createShadowRootUi(ctx, {
name: 'demo-ui',
position: 'inline',
@@ -13,6 +18,7 @@ export default defineContentScript({
anchor: 'form[role=search]',
onMount: (container) => {
const app = document.createElement('div');
app.classList.add('m-4', 'text-red-500');
app.textContent = i18n.t('prompt_for_name');
container.append(app);
},
@@ -0,0 +1,4 @@
body {
padding: 2rem;
background-color: blanchedalmond;
}
@@ -1,11 +1,6 @@
:root {
color-scheme: dark;
color: indianred;
}
html {
background-color: black;
}
div {
padding: 16px;
}
+1
View File
@@ -0,0 +1 @@
export { default } from '@wxt-dev/unocss';
+30 -1
View File
@@ -1,4 +1,5 @@
import { defineConfig } from 'wxt';
import { presetUno } from 'unocss';
export default defineConfig({
srcDir: 'src',
@@ -24,7 +25,35 @@ export default defineConfig({
},
example: {
a: 'a',
// @ts-expect-error: c is not defined, this should error out
// @ts-expect-error: c is not defined, this should be a type error, but it should show up in the module
c: 'c',
},
unocss: {
excludeEntrypoints: [
'example',
'iframe-src',
'injected',
'example-tsx',
'example-2',
'iframe',
'location-change',
'main-world',
'sandbox',
'sidepanel',
'unlisted',
],
configOrPath: {
content: {
pipeline: {
include: [
// the default
/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
// include js/ts files
'src/entrypoints/**/*.{js,ts}',
],
},
},
presets: [presetUno()],
},
},
});
+349
View File
@@ -1,5 +1,354 @@
# Changelog
## v0.19.28
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.27...wxt-v0.19.28)
### 🩹 Fixes
- Ignore `manifest.manifest_version` option and warn about incorrect usage ([#1419](https://github.com/wxt-dev/wxt/pull/1419))
- Resolve wxt modules from the root ([#1417](https://github.com/wxt-dev/wxt/pull/1417))
- Properly detect and reload changed files when using Vite's `?suffix` imports ([#1432](https://github.com/wxt-dev/wxt/pull/1432))
- Regression on variable expansion in dotenv files ([#1449](https://github.com/wxt-dev/wxt/pull/1449))
- Allow vite 6.0.9+ ([#1497](https://github.com/wxt-dev/wxt/pull/1497))
### 📖 Documentation
- Host pre-aggregated LLM knowledge files ([#1355](https://github.com/wxt-dev/wxt/pull/1355))
### 🏡 Chore
- Add funding links to `package.json` files ([#1446](https://github.com/wxt-dev/wxt/pull/1446))
- Use PNPM 10's new catelog feature ([#1493](https://github.com/wxt-dev/wxt/pull/1493))
- Move production dependencies to PNPM 10 catelog ([#1494](https://github.com/wxt-dev/wxt/pull/1494))
- **deps:** Upgrade to Vite 6 and related dependencies ([#1496](https://github.com/wxt-dev/wxt/pull/1496))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
- Stefan Maric <me@stefanmaric.com>
- Okinea Dev ([@okineadev](http://github.com/okineadev))
- 1natsu ([@1natsu172](http://github.com/1natsu172))
- Alec Larson ([@aleclarson](http://github.com/aleclarson))
## v0.19.27
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.26...wxt-v0.19.27)
### 🩹 Fixes
- Allow `vite-node@^3.0.0` ([#1378](https://github.com/wxt-dev/wxt/pull/1378))
- Use path triple slash directive for types that are referenced via path ([#1407](https://github.com/wxt-dev/wxt/pull/1407))
- Support `publish-browser-extension` v3.0.0 ([ac92d40](https://github.com/wxt-dev/wxt/commit/ac92d40))
- Respect `inlineConfig.mode` when setting NODE_ENV ([#1416](https://github.com/wxt-dev/wxt/pull/1416))
- Auto-import does not work when using `@vitejs/plugin-vue` alone ([#1412](https://github.com/wxt-dev/wxt/pull/1412))
### ❤️ Contributors
- Jaguar Zhou ([@aiktb](http://github.com/aiktb))
- Alec Larson ([@aleclarson](http://github.com/aleclarson))
- Aaron ([@aklinker1](http://github.com/aklinker1))
- St3h3n <st3h3n@gmail.com>
- Eli ([@lishaduck](http://github.com/lishaduck))
## v0.19.26
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.25...wxt-v0.19.26)
### 🩹 Fixes
- **context:** Deduplicate `wxt:content-script-started` ([#1364](https://github.com/wxt-dev/wxt/pull/1364))
### ❤️ Contributors
- Deniz Uğur ([@DenizUgur](http://github.com/DenizUgur))
## v0.19.25
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.24...wxt-v0.19.25)
### 🩹 Fixes
- Drop support for vite 6.0.9+ until websocket fix is finished ([8e2badc](https://github.com/wxt-dev/wxt/commit/8e2badc))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v0.19.24
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.23...wxt-v0.19.24)
### 🩹 Fixes
- **init:** Remove "experimental" from bun package manager ([b150a52](https://github.com/wxt-dev/wxt/commit/b150a52))
- **web-ext:** Correctly pass `browserConsole` option to open devtools in Firefox ([#1308](https://github.com/wxt-dev/wxt/pull/1308))
- `autoMount` not working if anchor is already present ([#1350](https://github.com/wxt-dev/wxt/pull/1350))
### 🏡 Chore
- Fix typo in CLI docs ([028c601](https://github.com/wxt-dev/wxt/commit/028c601))
### ❤️ Contributors
- 1natsu ([@1natsu172](http://github.com/1natsu172))
- Paulo Pinto ([@psrpinto](https://github.com/psrpinto))
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v0.19.23
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.22...wxt-v0.19.23)
### 🚀 Enhancements
- **hooks:** Move `entrypoints:resolved` before debug logs and add `entrypoints:found` ([#1292](https://github.com/wxt-dev/wxt/pull/1292))
### 🩹 Fixes
- Allow runtime registered content scripts to not have `matches` ([#1306](https://github.com/wxt-dev/wxt/pull/1306))
- Properly close readline instance on close ([#1278](https://github.com/wxt-dev/wxt/pull/1278))
### 📖 Documentation
- Sync READMEs ([27298b7](https://github.com/wxt-dev/wxt/commit/27298b7))
### 🏡 Chore
- Simplify keyboard shortcuts ([#1284](https://github.com/wxt-dev/wxt/pull/1284))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
- Abhigyan Trips ([@abhigyantrips](http://github.com/abhigyantrips))
## v0.19.22
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.21...wxt-v0.19.22)
### 🩹 Fixes
- Exclude entire `import.meta.env` object from content script output ([#1267](https://github.com/wxt-dev/wxt/pull/1267))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v0.19.21
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.20...wxt-v0.19.21)
### 🩹 Fixes
- Exclude skipped entrypoints from manifest ([#1265](https://github.com/wxt-dev/wxt/pull/1265))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v0.19.20
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.19...wxt-v0.19.20)
### 🚀 Enhancements
- `autoMount` content script UIs ([#1210](https://github.com/wxt-dev/wxt/pull/1210))
### 🩹 Fixes
- Only show reopen browser shortcut when it can be done ([#1263](https://github.com/wxt-dev/wxt/pull/1263))
- Import entrypoint improvements ([#1207](https://github.com/wxt-dev/wxt/pull/1207))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
- 1natsu ([@1natsu172](http://github.com/1natsu172))
## v0.19.19
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.18...wxt-v0.19.19)
### 🚀 Enhancements
- Keyboard shortcut to reopen the browser without restarting the dev command ([#1211](https://github.com/wxt-dev/wxt/pull/1211))
### 🩹 Fixes
- Prevent changing dev server port when reloading config ([#1241](https://github.com/wxt-dev/wxt/pull/1241))
- Ensure content scripts are registered immediately in dev mode ([#1253](https://github.com/wxt-dev/wxt/pull/1253))
- Exclude skipped entrypoints from Firefox sources zip ([#1238](https://github.com/wxt-dev/wxt/pull/1238))
### ❤️ Contributors
- Nishu ([@nishu-murmu](http://github.com/nishu-murmu))
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v0.19.18
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.17...wxt-v0.19.18)
### 🩹 Fixes
- Correct `dev.reloadCommand` restriction to consider only commands with suggested keys ([#1226](https://github.com/wxt-dev/wxt/pull/1226))
### 🌊 Types
- Add overloads to `ContentScriptContext#addEventListener` for different targets ([#1245](https://github.com/wxt-dev/wxt/pull/1245))
### 🏡 Chore
- Refactor `findEntrypoints` to return all entrypoints with `skipped` set properly ([#1244](https://github.com/wxt-dev/wxt/pull/1244))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
- Jaguar Zhou ([@aiktb](http://github.com/aiktb))
## v0.19.17
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.16...wxt-v0.19.17)
### 🚀 Enhancements
- New `server:created`, `server:started`, and `server:closed` hooks ([#1179](https://github.com/wxt-dev/wxt/pull/1179))
### 🩹 Fixes
- Re-initialize WXT modules correctly during development ([#1176](https://github.com/wxt-dev/wxt/pull/1176))
- ESLint config being generated when ESLint is not installed. ([#1198](https://github.com/wxt-dev/wxt/pull/1198))
- Update `vite` dependency range to support v6 ([#1215](https://github.com/wxt-dev/wxt/pull/1215))
- Automatically convert MV3 `content_security_policy` to MV2 ([#1168](https://github.com/wxt-dev/wxt/pull/1168))
- Correctly remove child elements with integrated UI remove ([#1219](https://github.com/wxt-dev/wxt/pull/1219))
- Make content script `matches` optional ([#1220](https://github.com/wxt-dev/wxt/pull/1220))
### 📖 Documentation
- Fix analyze typo in type ([#1187](https://github.com/wxt-dev/wxt/pull/1187))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
- 1natsu ([@1natsu172](http://github.com/1natsu172))
- Nishu ([@nishu-murmu](https://github.com/nishu-murmu))
- Florian Metz ([@Timeraa](http://github.com/Timeraa))
## v0.19.16
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.15...wxt-v0.19.16)
### 🚀 Enhancements
- **hooks:** Add new `config:resolved` hook ([#1177](https://github.com/wxt-dev/wxt/pull/1177))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
## v0.19.15
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.14...wxt-v0.19.15)
### 🚀 Enhancements
- Extract `wxt/storage` to its own package, `@wxt-dev/storage` ([#1129](https://github.com/wxt-dev/wxt/pull/1129))
### 🩹 Fixes
- Add "/" to `PublicPath` and `browser.runtime.getURL` ([#1171](https://github.com/wxt-dev/wxt/pull/1171))
- Add extension ID to event used to invalidate `ContentScriptContext` ([#1175](https://github.com/wxt-dev/wxt/pull/1175))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
- Nishu ([@nishu-murmu](http://github.com/nishu-murmu))
## v0.19.14
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.13...wxt-v0.19.14)
### 🚀 Enhancements
- **storage:** Support storage items in batch functions ([#990](https://github.com/wxt-dev/wxt/pull/990))
- Automatically disable 'Show warning about Self-XSS when pasing code' in new chrome ([#1159](https://github.com/wxt-dev/wxt/pull/1159))
### 🩹 Fixes
- Throw when config file does not exist ([#1156](https://github.com/wxt-dev/wxt/pull/1156))
### 📖 Documentation
- Cleanup typos and broken links ([bb5ea34](https://github.com/wxt-dev/wxt/commit/bb5ea34))
- Fix typo in `popup` and `options` EntrypointOptions ([#1121](https://github.com/wxt-dev/wxt/pull/1121))
### 🏡 Chore
- **deps:** Upgrade all non-major dependencies ([#1164](https://github.com/wxt-dev/wxt/pull/1164))
- **deps:** Bump dev and non-breaking major dependencies ([#1167](https://github.com/wxt-dev/wxt/pull/1167))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
- Rxliuli ([@rxliuli](http://github.com/rxliuli))
- Kongmoumou ([@kongmoumou](http://github.com/kongmoumou))
- Florian Metz ([@Timeraa](http://github.com/Timeraa))
- Bread Grocery <breadgrocery@gmail.com>
## v0.19.13
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.12...wxt-v0.19.13)
### 🚀 Enhancements
- **env:** Load env from `.env.[browser]` variants ([#1078](https://github.com/wxt-dev/wxt/pull/1078))
### 🩹 Fixes
- Don't use `#private` member variables in `ContentScriptContext` ([#1103](https://github.com/wxt-dev/wxt/pull/1103))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
- Craig Slusher ([@sleekslush](http://github.com/sleekslush))
## v0.19.12
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.11...wxt-v0.19.12)
### 🚀 Enhancements
- Add support for `WXT_` environment variable prefix ([#1076](https://github.com/wxt-dev/wxt/pull/1076))
- **config:** Add `outDirTemplate` for customizing output directory structure ([#1074](https://github.com/wxt-dev/wxt/pull/1074))
### 🔥 Performance
- Replace `execa` with `nano-spawn` for smaller package size ([#1042](https://github.com/wxt-dev/wxt/pull/1042))
- Downgrade `esbuild` so a single version is shared between sub-dependencies ([#1045](https://github.com/wxt-dev/wxt/pull/1045))
### 🩹 Fixes
- Use directory name when `zip.name` and `package.json#name` are not provided ([#1028](https://github.com/wxt-dev/wxt/pull/1028))
- Ensure consistent hook execution order and add docs ([#1081](https://github.com/wxt-dev/wxt/pull/1081))
### 📖 Documentation
- Rewrite and restructure the documentation website ([#933](https://github.com/wxt-dev/wxt/pull/933))
### 🏡 Chore
- Remove email from changelog ([#1027](https://github.com/wxt-dev/wxt/pull/1027))
- **deps:** Bump magicast from 0.3.4 to 0.3.5 ([#1017](https://github.com/wxt-dev/wxt/pull/1017))
- **deps:** Bump esbuild from 0.23.0 to 0.24.0 ([#1018](https://github.com/wxt-dev/wxt/pull/1018))
- **deps:** Bump linkedom from 0.18.4 to 0.18.5 ([#1034](https://github.com/wxt-dev/wxt/pull/1034))
- **deps:** Bump execa from 9.3.1 to 9.4.0 ([#1031](https://github.com/wxt-dev/wxt/pull/1031))
- Upgrade all non-major dependencies ([#1040](https://github.com/wxt-dev/wxt/pull/1040))
- Shrink down on dependencies ([#1050](https://github.com/wxt-dev/wxt/pull/1050))
- Enable `extensionApi: chrome` in template projects ([#1083](https://github.com/wxt-dev/wxt/pull/1083))
### ❤️ Contributors
- Aaron ([@aklinker1](http://github.com/aklinker1))
- Florian Metz ([@Timeraa](http://github.com/Timeraa))
- Mezannic ([@mezannic](http://github.com/mezannic))
## v0.19.11
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.19.10...wxt-v0.19.11)
+6
View File
@@ -76,6 +76,12 @@ Or see the [installation guide](https://wxt.dev/guide/installation.html) to get
- 📏 Bundle analysis
- ⬇️ Download and bundle remote URL imports
## Sponsors
WXT is a [MIT-licensed](https://github.com/wxt-dev/wxt/blob/main/LICENSE) open source project with its ongoing development made possible entirely by the support of these awesome backers. If you'd like to join them, please consider [sponsoring WXT's development](https://github.com/sponsors/wxt-dev).
<a href="https://github.com/sponsors/wxt-dev"><img alt="WXT Sponsors" src="https://raw.githubusercontent.com/wxt-dev/static/refs/heads/main/sponsorkit/sponsors.svg"></a>
## Contributors
<!-- automd:contributors author="aklinker1" license="MIT" github="wxt-dev/wxt" -->

Some files were not shown because too many files have changed in this diff Show More