Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0404637da8 | |||
| 98d95e4b7f | |||
| 2687a35781 | |||
| 886dae28fa | |||
| 8c9bc8cdbc | |||
| 5414a0aa34 | |||
| 223cf8613b | |||
| 4f1776befc | |||
| 38473b9f6c | |||
| 41b428c75f | |||
| d8d754658f | |||
| e52ebf1d53 | |||
| 535c7a5f92 | |||
| 99b2bd784a | |||
| 31ebf966fd | |||
| 6036c6e8e0 | |||
| 597151b5dd | |||
| 29aeaed223 | |||
| edf87952c7 | |||
| 78f8434a06 | |||
| 7eaccad683 | |||
| bfa9c1e1c8 | |||
| a2d6577579 | |||
| 0e8191488f | |||
| a1510bb081 | |||
| 1eaca30f97 | |||
| bc79987ed5 | |||
| 36a501506e | |||
| e1d47f5f63 | |||
| 7faa9b5a64 | |||
| 295bee708c | |||
| 9e917481c4 | |||
| c5a8b9fb3d | |||
| 3f4e32f8da | |||
| f630098f1d | |||
| 608d6e2b54 | |||
| fad5ab6c44 | |||
| d4cb7997fe | |||
| 28364b8be1 | |||
| d28a5c7d5e | |||
| df707aef4c | |||
| 77af2e58ec | |||
| f738e56337 | |||
| f2fe2584e0 | |||
| 02673ae017 | |||
| 8dd294a163 | |||
| 469e735d53 |
@@ -18,7 +18,7 @@ runs:
|
||||
uses: pnpm/action-setup@f2b2b233b538f500472c7274c7012f57857d8ce0 # v4.1.0
|
||||
|
||||
- name: 🛠️ Setup NodeJS
|
||||
uses: actions/setup-node@b7234cc9fe124f0f4932554b4e5284543083ae7b # v4.4.0
|
||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
|
||||
with:
|
||||
node-version: 20
|
||||
cache: pnpm
|
||||
|
||||
@@ -7,6 +7,7 @@ on:
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.repository_owner == 'wxt-dev'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Post Thank You Comment
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
env:
|
||||
comment: Thanks for helping make WXT better!
|
||||
with:
|
||||
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Login to Docker Registry
|
||||
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
with:
|
||||
registry: https://${{ secrets.DOCKER_REGISTRY_HOSTNAME }}
|
||||
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
|
||||
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write # Push version changes
|
||||
id-token: write # OIDC for NPM publishing
|
||||
@@ -47,12 +47,6 @@ jobs:
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Update NPM
|
||||
run: sudo npm i -g npm@latest
|
||||
|
||||
- name: Print NPM Version
|
||||
run: npm --version
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name 'github-actions[bot]'
|
||||
@@ -67,7 +61,10 @@ jobs:
|
||||
|
||||
- name: Publish to NPM
|
||||
working-directory: packages/${{ inputs.package }}
|
||||
run: npm publish
|
||||
run: |
|
||||
pnpm pack
|
||||
sudo npm i -g npm@latest
|
||||
/usr/local/bin/npm publish *.tgz
|
||||
|
||||
- name: Create GitHub release
|
||||
run: pnpm tsx scripts/create-github-release.ts ${{ inputs.package }}
|
||||
|
||||
@@ -11,21 +11,21 @@ jobs:
|
||||
sync:
|
||||
name: 'Sync with @types/chrome'
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'wxt-dev'
|
||||
permissions:
|
||||
contents: write # Push version changes
|
||||
id-token: write # OIDC for NPM publishing
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
with:
|
||||
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
installArgs: --ignore-scripts
|
||||
|
||||
- name: Update NPM
|
||||
run: sudo npm i -g npm@latest
|
||||
|
||||
- name: Generate Latest Code
|
||||
working-directory: packages/browser
|
||||
run: pnpm gen
|
||||
@@ -42,7 +42,10 @@ jobs:
|
||||
with:
|
||||
commit_message: 'fix: Upgrade `@wxt-dev/browser` to latest `@types/chrome` version'
|
||||
|
||||
- name: Publish Package
|
||||
- name: Publish to NPM
|
||||
if: steps.commit.outputs.changes_detected == 'true'
|
||||
working-directory: packages/browser
|
||||
run: npm publish
|
||||
run: |
|
||||
pnpm pack
|
||||
sudo npm i -g npm@latest
|
||||
/usr/local/bin/npm publish *.tgz
|
||||
|
||||
@@ -86,7 +86,7 @@ jobs:
|
||||
|
||||
- name: Upload Coverage
|
||||
if: matrix.coverage
|
||||
uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0
|
||||
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
|
||||
@@ -102,6 +102,16 @@ const chromeExtensionIds = [
|
||||
'ehmoihnjgkdimihkhokkmfjdgomohjgm', // Filmbudd Pro - Simple, private – and synced ratings and watch notes across all your devices
|
||||
'alglchohmdikgdjhafiicilegegieafa', // MultiField CopyCat - Copy, Paste & Autofill Web Forms Instantly
|
||||
'aamihahiiogceidpbnfgehacgiecephe', // ChatSight - Add Table of Contents to ChatGPT
|
||||
'cndibmoanboadcifjkjbdpjgfedanolh', // BetterCampus (prev. BetterCanvas)
|
||||
'hinfimgacobnellbncbcpdlpaapcofaa', // Leetcode Fonts - Change fonts in leetcode effortlessly
|
||||
'kbkbfefhhabpkibojinapkkgciiacggg', // TranslateManga - Manga Translator & Manga Tracker
|
||||
'emeakbgdecgmdjgegnejpppcnkcnoaen', // SiteData - Free Website Traffic Checker & Reverse AdSense Tool
|
||||
'gpnckbhgpnjciklpoehkmligeaebigaa', // Livestream Chat Reader - Text-to-Speech for YouTube/Twitch chat
|
||||
'fjlalaedpfcojcfpkgkglbjjbbkofgnl', // ChatGPT Token Counter - Count tokens in real time on chatgpt conversation
|
||||
'fbgblmjbeebanackldpbmpacppflgmlj', // LinuxDo Scripts - 为 linux.do 用户提供了一些增强功能
|
||||
'dfacnjidgbagicaekenjgclfnhdnjjdi', // Zen Virtual Piano - https://zen-piano.web.app/
|
||||
'naeibcegmgpofimedkmfgjgphfhfhlab', // Crypto Pulse price tracker - https://get-crypto-pulse.web.app/
|
||||
'ffglckbhfbfmdkefdmjbhpnffkcmlhdh', // Redirect Web - Automatically redirect pages or open them in another app
|
||||
];
|
||||
|
||||
const { data, err, isLoading } = useListExtensionDetails(chromeExtensionIds);
|
||||
|
||||
@@ -41,6 +41,18 @@ export default defineWebExtConfig({
|
||||
});
|
||||
```
|
||||
|
||||
```ts [wxt.config.ts]
|
||||
export default defineConfig({
|
||||
webExt: {
|
||||
binaries: {
|
||||
chrome: '/path/to/chrome-beta', // Use Chrome Beta instead of regular Chrome
|
||||
firefox: 'firefoxdeveloperedition', // Use Firefox Developer Edition instead of regular Firefox
|
||||
edge: '/path/to/edge', // Open MS Edge when running "wxt -b edge"
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
@@ -11,7 +11,7 @@ export default defineConfig({
|
||||
hooks: {
|
||||
'build:manifestGenerated': (wxt, manifest) => {
|
||||
if (wxt.config.mode === 'development') {
|
||||
manifest.title += ' (DEV)';
|
||||
manifest.name += ' (DEV)';
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -15,6 +15,11 @@ cd path/to/your/project
|
||||
pnpm dlx wxt@latest init example-wxt --template vanilla
|
||||
```
|
||||
|
||||
:::tip
|
||||
We recommend reviewing [project structure](/guide/essentials/project-structure.md) before you get started.
|
||||
You can customize directory names in `wxt.config.ts` to match your project's needs.
|
||||
:::
|
||||
|
||||
In general, you'll need to:
|
||||
|
||||
 <input type="checkbox" /> Install `wxt`<br />
|
||||
|
||||
+13
-23
@@ -18,35 +18,36 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/buildc": "^1.1.5",
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@commitlint/config-conventional": "^19.8.1",
|
||||
"@commitlint/types": "^19.8.1",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/semver": "^7.7.1",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"@vitest/coverage-v8": "^4.0.16",
|
||||
"changelogen": "^0.6.2",
|
||||
"consola": "^3.4.2",
|
||||
"fast-glob": "^3.3.3",
|
||||
"feed": "^5.1.0",
|
||||
"fs-extra": "^11.3.1",
|
||||
"lint-staged": "^16.1.6",
|
||||
"fs-extra": "^11.3.2",
|
||||
"lint-staged": "^16.2.7",
|
||||
"markdown-it-footnote": "^4.0.0",
|
||||
"markdownlint-cli": "^0.45.0",
|
||||
"nano-spawn": "^1.0.2",
|
||||
"prettier": "^3.6.2",
|
||||
"semver": "^7.7.2",
|
||||
"nano-spawn": "^1.0.3",
|
||||
"p-map": "^7.0.4",
|
||||
"prettier": "^3.7.4",
|
||||
"semver": "^7.7.3",
|
||||
"simple-git-hooks": "^2.13.1",
|
||||
"tsx": "4.20.5",
|
||||
"tsx": "4.21.0",
|
||||
"typedoc": "^0.25.4",
|
||||
"typedoc-plugin-frontmatter": "^1.3.0",
|
||||
"typedoc-plugin-frontmatter": "^1.3.1",
|
||||
"typedoc-plugin-markdown": "4.0.0-next.23",
|
||||
"typedoc-vitepress-theme": "1.0.0-next.3",
|
||||
"typescript": "^5.9.2",
|
||||
"typescript": "^5.9.3",
|
||||
"vitepress": "^1.6.4",
|
||||
"vitepress-knowledge": "^0.4.1",
|
||||
"vitepress-plugin-group-icons": "^1.6.3",
|
||||
"vitepress-plugin-group-icons": "^1.6.5",
|
||||
"vitest-mock-extended": "^3.1.0",
|
||||
"vue": "^3.5.21",
|
||||
"vue": "^3.5.25",
|
||||
"wxt": "workspace:*"
|
||||
},
|
||||
"simple-git-hooks": {
|
||||
@@ -54,16 +55,5 @@
|
||||
},
|
||||
"lint-staged": {
|
||||
"*": "prettier --ignore-unknown --write"
|
||||
},
|
||||
"pnpm": {
|
||||
"peerDependencyRules": {
|
||||
"ignoreMissing": [
|
||||
"@algolia/client-search",
|
||||
"search-insights"
|
||||
]
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"markdown-it-footnote": "patches/markdown-it-footnote.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +253,8 @@ function defineStorageItem<T>(
|
||||
): AnalyticsStorageItem<T> {
|
||||
return {
|
||||
getValue: async () =>
|
||||
(await browser.storage.local.get(key))[key] ?? defaultValue,
|
||||
(await browser.storage.local.get<Record<string, any>>(key))[key] ??
|
||||
defaultValue,
|
||||
setValue: (newValue) => browser.storage.local.set({ [key]: newValue }),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -51,10 +51,10 @@
|
||||
"wxt": ">=0.20.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@types/ua-parser-js": "^0.7.39",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.9.2",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"wxt": "workspace:*"
|
||||
},
|
||||
|
||||
@@ -46,14 +46,14 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"defu": "^6.1.4",
|
||||
"fs-extra": "^11.3.1",
|
||||
"sharp": "^0.34.3"
|
||||
"fs-extra": "^11.3.2",
|
||||
"sharp": "^0.34.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"oxlint": "^1.14.0",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.9.2",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"oxlint": "^1.33.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"wxt": "workspace:*"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@wxt-dev/browser",
|
||||
"description": "Provides a cross-browser API for using extension APIs and types based on @types/chrome",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.32",
|
||||
"type": "module",
|
||||
"main": "src/index.mjs",
|
||||
"types": "src/index.d.ts",
|
||||
@@ -23,12 +23,12 @@
|
||||
"src"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/chrome": "0.1.6",
|
||||
"fs-extra": "^11.3.1",
|
||||
"nano-spawn": "^1.0.2",
|
||||
"tsx": "4.20.5",
|
||||
"typescript": "^5.9.2",
|
||||
"vitest": "^3.2.4"
|
||||
"@types/chrome": "0.1.32",
|
||||
"fs-extra": "^11.3.2",
|
||||
"nano-spawn": "^1.0.3",
|
||||
"tsx": "4.21.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vitest": "^4.0.16"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/filesystem": "*",
|
||||
|
||||
@@ -60,9 +60,7 @@ for (const { file, srcPath, destPath } of declarationFileMapping) {
|
||||
|
||||
// Done!
|
||||
|
||||
console.log(
|
||||
'\x1b[32m✔\x1b[0m Done in ' + performance.now().toFixed(0) + ' ms',
|
||||
);
|
||||
console.log('\x1b[32m✔\x1b[0m Done in ' + performance.now().toFixed(0) + ' ms');
|
||||
|
||||
// Transformations
|
||||
|
||||
|
||||
+2645
-2390
File diff suppressed because it is too large
Load Diff
@@ -26,8 +26,8 @@
|
||||
"@types/chrome": "{{chromeTypesVersion}}",
|
||||
"fs-extra": "^11.3.1",
|
||||
"nano-spawn": "^1.0.2",
|
||||
"tsx": "4.19.4",
|
||||
"tsx": "4.20.5",
|
||||
"typescript": "^5.9.2",
|
||||
"vitest": "^3.1.2"
|
||||
"vitest": "^4.0.16"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,14 +40,14 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@types/node": "^20.17.6",
|
||||
"oxlint": "^1.14.0",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.9.2",
|
||||
"oxlint": "^1.33.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"vitest": "^3.2.4",
|
||||
"vitest-plugin-random-seed": "^1.1.1",
|
||||
"vitest": "^4.0.16",
|
||||
"vitest-plugin-random-seed": "^1.1.2",
|
||||
"wxt": "workspace:*"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
|
||||
@@ -51,13 +51,13 @@
|
||||
"@vitejs/plugin-react": "^4.4.1 || ^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"@types/react": "^19.1.12",
|
||||
"@types/react-dom": "^19.1.9",
|
||||
"publint": "^0.3.12",
|
||||
"react": "^19.1.1",
|
||||
"react-dom": "^19.1.1",
|
||||
"typescript": "^5.9.2",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"publint": "^0.3.16",
|
||||
"react": "^19.2.3",
|
||||
"react-dom": "^19.2.3",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"wxt": "workspace:*"
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@
|
||||
"wxt": ">=0.19.16"
|
||||
},
|
||||
"dependencies": {
|
||||
"vite-plugin-solid": "^2.11.8"
|
||||
"vite-plugin-solid": "^2.11.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"publint": "^0.3.12",
|
||||
"solid-js": "^1.9.9",
|
||||
"typescript": "^5.9.2",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"publint": "^0.3.16",
|
||||
"solid-js": "^1.9.10",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"wxt": "workspace:*"
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.0 || ^5.0.0 || ^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.9.2",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"wxt": "workspace:*"
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
"@vitejs/plugin-vue": "^5.2.3 || ^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.9.2",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"wxt": "workspace:*"
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"oxlint": "^1.14.0",
|
||||
"publint": "^0.3.12",
|
||||
"tsx": "4.20.5",
|
||||
"typescript": "^5.9.2",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"oxlint": "^1.33.0",
|
||||
"publint": "^0.3.16",
|
||||
"tsx": "4.21.0",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"vitest": "^3.2.4"
|
||||
"vitest": "^4.0.16"
|
||||
},
|
||||
"main": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## v1.2.6
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/storage-v1.2.5...storage-v1.2.6)
|
||||
|
||||
## v1.2.5
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/storage-v1.2.4...storage-v1.2.5)
|
||||
|
||||
## v1.2.4
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/storage-v1.2.3...storage-v1.2.4)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@wxt-dev/storage",
|
||||
"description": "Web extension storage API provided by WXT, supports all browsers.",
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.6",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -35,13 +35,13 @@
|
||||
"dequal": "^2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@webext-core/fake-browser": "^1.3.2",
|
||||
"oxlint": "^1.14.0",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.9.2",
|
||||
"oxlint": "^1.33.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"vitest": "^3.2.4"
|
||||
"vitest": "^4.0.16"
|
||||
},
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
|
||||
@@ -519,7 +519,7 @@ function createDriver(storageArea: StorageArea): WxtStorageDriver {
|
||||
const watchListeners = new Set<(changes: StorageAreaChanges) => void>();
|
||||
return {
|
||||
getItem: async (key) => {
|
||||
const res = await getStorageArea().get(key);
|
||||
const res = await getStorageArea().get<Record<string, any>>(key);
|
||||
return res[key];
|
||||
},
|
||||
getItems: async (keys) => {
|
||||
@@ -560,7 +560,10 @@ function createDriver(storageArea: StorageArea): WxtStorageDriver {
|
||||
},
|
||||
watch(key, cb) {
|
||||
const listener = (changes: StorageAreaChanges) => {
|
||||
const change = changes[key];
|
||||
const change = changes[key] as {
|
||||
newValue?: any;
|
||||
oldValue?: any | null;
|
||||
} | null;
|
||||
if (change == null) return;
|
||||
if (dequal(change.newValue, change.oldValue)) return;
|
||||
cb(change.newValue ?? null, change.oldValue ?? null);
|
||||
|
||||
@@ -40,10 +40,10 @@
|
||||
"wxt": ">=0.19.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"oxlint": "^1.14.0",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.9.2",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"oxlint": "^1.33.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"unocss": "^0.64.0 || ^0.65.0 || ^65.0.0 || ^66.0.0",
|
||||
"wxt": "workspace:*"
|
||||
|
||||
@@ -45,10 +45,10 @@
|
||||
"wxt": ">=0.20.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"@types/webextension-polyfill": "^0.12.3",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.9.2",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@types/webextension-polyfill": "^0.12.4",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"webextension-polyfill": "^0.12.0",
|
||||
"wxt": "workspace:*"
|
||||
|
||||
@@ -18,19 +18,19 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@wxt-dev/i18n": "workspace:*",
|
||||
"react": "^19.1.1",
|
||||
"react-dom": "^19.1.1"
|
||||
"react": "^19.2.3",
|
||||
"react-dom": "^19.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.1.12",
|
||||
"@types/react-dom": "^19.1.9",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@wxt-dev/auto-icons": "workspace:*",
|
||||
"@wxt-dev/unocss": "workspace:*",
|
||||
"sass": "^1.92.0",
|
||||
"typescript": "^5.9.2",
|
||||
"sass": "^1.97.0",
|
||||
"typescript": "^5.9.3",
|
||||
"unocss": "^0.64.0 || ^0.65.0 || ^65.0.0 || ^66.0.0",
|
||||
"vitest": "^3.2.4",
|
||||
"vitest-plugin-random-seed": "^1.1.1",
|
||||
"vitest": "^4.0.16",
|
||||
"vitest-plugin-random-seed": "^1.1.2",
|
||||
"wxt": "workspace:*"
|
||||
},
|
||||
"buildc": {
|
||||
|
||||
@@ -1,5 +1,34 @@
|
||||
# Changelog
|
||||
|
||||
## v0.20.12
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.20.11...wxt-v0.20.12)
|
||||
|
||||
### 🚀 Enhancements
|
||||
|
||||
- Remove `data-wxt-*` attributes ([#1913](https://github.com/wxt-dev/wxt/pull/1913))
|
||||
- Default to using `use_dynamic_url: true` for content script css files ([#1993](https://github.com/wxt-dev/wxt/pull/1993))
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Wxt normal logs are drowned by `dotenv@17.0.0` ads ([#1883](https://github.com/wxt-dev/wxt/pull/1883))
|
||||
- Optimize `splitShadowRootCss` ([#1934](https://github.com/wxt-dev/wxt/pull/1934))
|
||||
- `wxt prepare` fails with the error "__vite_ssr_exportName__ is not defined" when using Vite 7 ([#1884](https://github.com/wxt-dev/wxt/pull/1884))
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- Use `linkedom` a test instead of `happy-dom` ([#1957](https://github.com/wxt-dev/wxt/pull/1957))
|
||||
- Add support for `vite-node` v5 ([#2001](https://github.com/wxt-dev/wxt/pull/2001))
|
||||
- Upgrade dev and non-major prod dependencies ([#2000](https://github.com/wxt-dev/wxt/pull/2000))
|
||||
- **dev-deps:** Upgrade `happy-dom` to address CVE-2025-61927 ([#2002](https://github.com/wxt-dev/wxt/pull/2002))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Jaguar Zhou ([@aiktb](https://github.com/aiktb))
|
||||
- Alexander Harding <noreply@harding.dev>
|
||||
- Florian Kühne ([@ZerGo0](https://github.com/ZerGo0))
|
||||
|
||||
## v0.20.11
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.20.10...wxt-v0.20.11)
|
||||
|
||||
@@ -16,7 +16,7 @@ describe('Remote Code', () => {
|
||||
const output = await project.serializeFile('.output/chrome-mv3/popup.js');
|
||||
expect(output).toContain(
|
||||
// Some text that will hopefully be in future versions of this script
|
||||
'lodash.com',
|
||||
'__lodash_placeholder__',
|
||||
);
|
||||
expect(output).not.toContain(url);
|
||||
expect(
|
||||
|
||||
+19
-19
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "wxt",
|
||||
"type": "module",
|
||||
"version": "0.20.11",
|
||||
"version": "0.20.12",
|
||||
"description": "⚡ Next-gen Web Extension Framework",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
@@ -24,18 +24,18 @@
|
||||
"@wxt-dev/browser": "workspace:^",
|
||||
"@wxt-dev/storage": "workspace:^1.0.0",
|
||||
"async-mutex": "^0.5.0",
|
||||
"c12": "^3.2.0",
|
||||
"c12": "^3.3.2",
|
||||
"cac": "^6.7.14",
|
||||
"chokidar": "^4.0.3",
|
||||
"ci-info": "^4.3.0",
|
||||
"ci-info": "^4.3.1",
|
||||
"consola": "^3.4.2",
|
||||
"defu": "^6.1.4",
|
||||
"dotenv": "^17.2.2",
|
||||
"dotenv": "^17.2.3",
|
||||
"dotenv-expand": "^12.0.3",
|
||||
"esbuild": "^0.25.0",
|
||||
"esbuild": "^0.27.1",
|
||||
"fast-glob": "^3.3.3",
|
||||
"filesize": "^11.0.2",
|
||||
"fs-extra": "^11.3.1",
|
||||
"filesize": "^11.0.13",
|
||||
"fs-extra": "^11.3.2",
|
||||
"get-port-please": "^3.2.0",
|
||||
"giget": "^1.2.3 || ^2.0.0",
|
||||
"hookable": "^5.5.3",
|
||||
@@ -45,10 +45,10 @@
|
||||
"jszip": "^3.10.1",
|
||||
"linkedom": "^0.18.12",
|
||||
"magicast": "^0.3.5",
|
||||
"minimatch": "^10.0.3",
|
||||
"nano-spawn": "^1.0.2",
|
||||
"minimatch": "^10.1.1",
|
||||
"nano-spawn": "^1.0.3",
|
||||
"normalize-path": "^3.0.0",
|
||||
"nypm": "^0.6.1",
|
||||
"nypm": "^0.6.2",
|
||||
"ohash": "^2.0.11",
|
||||
"open": "^10.2.0",
|
||||
"ora": "^8.2.0",
|
||||
@@ -59,26 +59,26 @@
|
||||
"scule": "^1.3.0",
|
||||
"unimport": "^3.13.1 || ^4.0.0 || ^5.0.0",
|
||||
"vite": "^5.4.19 || ^6.3.4 || ^7.0.0",
|
||||
"vite-node": "^2.1.4 || ^3.1.2",
|
||||
"vite-node": "^3.2.4 || ^5.0.0",
|
||||
"web-ext-run": "^0.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"@faker-js/faker": "^10.0.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@faker-js/faker": "^10.1.0",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/lodash.merge": "^4.6.9",
|
||||
"@types/node": "^20.17.6",
|
||||
"@types/normalize-path": "^3.0.2",
|
||||
"@types/prompts": "^2.4.9",
|
||||
"extract-zip": "^2.0.1",
|
||||
"happy-dom": "^18.0.1",
|
||||
"happy-dom": "^20.0.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"oxlint": "^1.14.0",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.9.2",
|
||||
"oxlint": "^1.33.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"vitest": "^3.2.4",
|
||||
"vitest-plugin-random-seed": "^1.1.1"
|
||||
"vitest": "^4.0.16",
|
||||
"vitest-plugin-random-seed": "^1.1.2"
|
||||
},
|
||||
"peerDependenciesMeta": {},
|
||||
"repository": {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { Window } from 'happy-dom';
|
||||
import { pointToDevServer } from '../devHtmlPrerender';
|
||||
import {
|
||||
fakeDevServer,
|
||||
@@ -7,6 +6,7 @@ import {
|
||||
} from '../../../../utils/testing/fake-objects';
|
||||
import { normalizePath } from '../../../../utils/paths';
|
||||
import { resolve } from 'node:path';
|
||||
import { parseHTML } from 'linkedom';
|
||||
|
||||
describe('Dev HTML Prerender Plugin', () => {
|
||||
describe('pointToDevServer', () => {
|
||||
@@ -32,9 +32,7 @@ describe('Dev HTML Prerender Plugin', () => {
|
||||
// URLs should not be changed
|
||||
['https://example.com/style.css', 'https://example.com/style.css'],
|
||||
])('should transform "%s" into "%s"', (input, expected) => {
|
||||
const { document } = new Window({
|
||||
url: 'http://localhost',
|
||||
});
|
||||
const { document } = parseHTML('<html></html>');
|
||||
const root = '/some/root';
|
||||
const config = fakeResolvedConfig({
|
||||
root,
|
||||
@@ -55,7 +53,7 @@ describe('Dev HTML Prerender Plugin', () => {
|
||||
const id = root + '/entrypoints/popup/index.html';
|
||||
|
||||
document.head.innerHTML = `<link rel="stylesheet" href="${input}" />`;
|
||||
pointToDevServer(config, server, id, document as any, 'link', 'href');
|
||||
pointToDevServer(config, server, id, document, 'link', 'href');
|
||||
|
||||
const actual = document.querySelector('link')!;
|
||||
expect(actual.getAttribute('href')).toBe(expected);
|
||||
|
||||
@@ -747,6 +747,7 @@ describe('Manifest Utils', () => {
|
||||
{
|
||||
matches: ['*://google.com/*'],
|
||||
resources: ['content-scripts/one.css'],
|
||||
use_dynamic_url: true,
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -830,6 +831,7 @@ describe('Manifest Utils', () => {
|
||||
{
|
||||
matches: ['*://play.google.com/*'],
|
||||
resources: ['content-scripts/one.css'],
|
||||
use_dynamic_url: true,
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -993,6 +995,7 @@ describe('Manifest Utils', () => {
|
||||
{
|
||||
resources: ['content-scripts/one.css'],
|
||||
matches: ['*://google.com/*'],
|
||||
use_dynamic_url: true,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -553,6 +553,7 @@ export function getContentScriptCssWebAccessibleResources(
|
||||
|
||||
resources.push({
|
||||
resources: [cssFile],
|
||||
use_dynamic_url: true,
|
||||
matches:
|
||||
script.options.matches?.map((matchPattern) =>
|
||||
stripPathFromMatchPattern(matchPattern),
|
||||
|
||||
+11
-16
@@ -200,7 +200,7 @@ export interface InlineConfig {
|
||||
*
|
||||
* @example
|
||||
* [
|
||||
* "coverage", // Ignore the coverage directory in the `sourcesRoot`
|
||||
* "coverage", // Include the coverage directory in the `sourcesRoot`
|
||||
* ]
|
||||
*/
|
||||
includeSources?: string[];
|
||||
@@ -213,7 +213,7 @@ export interface InlineConfig {
|
||||
*
|
||||
* @example
|
||||
* [
|
||||
* "coverage", // Include the coverage directory in the `sourcesRoot`
|
||||
* "coverage", // Ignore the coverage directory in the `sourcesRoot`
|
||||
* ]
|
||||
*/
|
||||
excludeSources?: string[];
|
||||
@@ -462,8 +462,7 @@ export interface BuildStepOutput {
|
||||
}
|
||||
|
||||
export interface WxtDevServer
|
||||
extends Omit<WxtBuilderServer, 'listen' | 'close'>,
|
||||
ServerInfo {
|
||||
extends Omit<WxtBuilderServer, 'listen' | 'close'>, ServerInfo {
|
||||
/**
|
||||
* Stores the current build output of the server.
|
||||
*/
|
||||
@@ -567,8 +566,7 @@ export interface BackgroundEntrypointOptions extends BaseEntrypointOptions {
|
||||
type?: PerBrowserOption<'module'>;
|
||||
}
|
||||
|
||||
export interface BaseContentScriptEntrypointOptions
|
||||
extends BaseEntrypointOptions {
|
||||
export interface BaseContentScriptEntrypointOptions extends BaseEntrypointOptions {
|
||||
matches?: PerBrowserOption<NonNullable<ManifestContentScript['matches']>>;
|
||||
/**
|
||||
* See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
|
||||
@@ -635,16 +633,14 @@ export interface BaseContentScriptEntrypointOptions
|
||||
registration?: PerBrowserOption<'manifest' | 'runtime'>;
|
||||
}
|
||||
|
||||
export interface MainWorldContentScriptEntrypointOptions
|
||||
extends BaseContentScriptEntrypointOptions {
|
||||
export interface MainWorldContentScriptEntrypointOptions extends BaseContentScriptEntrypointOptions {
|
||||
/**
|
||||
* See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
|
||||
*/
|
||||
world: 'MAIN';
|
||||
}
|
||||
|
||||
export interface IsolatedWorldContentScriptEntrypointOptions
|
||||
extends BaseContentScriptEntrypointOptions {
|
||||
export interface IsolatedWorldContentScriptEntrypointOptions extends BaseContentScriptEntrypointOptions {
|
||||
/**
|
||||
* See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
|
||||
* @default "ISOLATED"
|
||||
@@ -780,8 +776,7 @@ export type EntrypointGroup = Entrypoint | Entrypoint[];
|
||||
|
||||
export type OnContentScriptStopped = (cb: () => void) => void;
|
||||
|
||||
export interface IsolatedWorldContentScriptDefinition
|
||||
extends IsolatedWorldContentScriptEntrypointOptions {
|
||||
export interface IsolatedWorldContentScriptDefinition extends IsolatedWorldContentScriptEntrypointOptions {
|
||||
/**
|
||||
* Main function executed when the content script is loaded.
|
||||
*
|
||||
@@ -792,8 +787,7 @@ export interface IsolatedWorldContentScriptDefinition
|
||||
main(ctx: ContentScriptContext): any | Promise<any>;
|
||||
}
|
||||
|
||||
export interface MainWorldContentScriptDefinition
|
||||
extends MainWorldContentScriptEntrypointOptions {
|
||||
export interface MainWorldContentScriptDefinition extends MainWorldContentScriptEntrypointOptions {
|
||||
/**
|
||||
* Main function executed when the content script is loaded.
|
||||
*
|
||||
@@ -1544,8 +1538,9 @@ export interface WxtModule<TOptions extends WxtModuleOptions> {
|
||||
setup?: WxtModuleSetup<TOptions>;
|
||||
}
|
||||
|
||||
export interface WxtModuleWithMetadata<TOptions extends WxtModuleOptions>
|
||||
extends WxtModule<TOptions> {
|
||||
export interface WxtModuleWithMetadata<
|
||||
TOptions extends WxtModuleOptions,
|
||||
> extends WxtModule<TOptions> {
|
||||
type: 'local' | 'node_module';
|
||||
id: string;
|
||||
}
|
||||
|
||||
@@ -63,9 +63,7 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector('div[data-wxt-integrated]'),
|
||||
).not.toBeNull();
|
||||
expect(document.body.children).toContain(ui.wrapper);
|
||||
expect(document.querySelector('app')).not.toBeNull();
|
||||
});
|
||||
|
||||
@@ -77,9 +75,7 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector('pre[data-wxt-integrated]'),
|
||||
).not.toBeNull();
|
||||
expect(document.querySelector('pre')).toBe(ui.wrapper);
|
||||
expect(document.querySelector('app')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -92,7 +88,7 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(document.querySelector('div[data-wxt-iframe]')).toBeDefined();
|
||||
expect(document.body.children).toContain(ui.wrapper);
|
||||
expect(document.querySelector('iframe')).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -108,9 +104,7 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector('test-component[data-wxt-shadow-root]'),
|
||||
).not.toBeNull();
|
||||
expect(document.querySelector('test-component')).toBe(ui.shadowHost);
|
||||
expect(ui.shadow.querySelector('app')).not.toBeNull();
|
||||
});
|
||||
|
||||
@@ -143,7 +137,7 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
|
||||
expect(ui.wrapper.outerHTML).toMatchInlineSnapshot(
|
||||
`"<div data-wxt-iframe=""><iframe src="chrome-extension://test-extension-id/page.html"></iframe></div>"`,
|
||||
`"<div><iframe src="chrome-extension://test-extension-id/page.html"></iframe></div>"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -157,7 +151,7 @@ describe('Content Script UIs', () => {
|
||||
ui.mount();
|
||||
|
||||
expect(ui.wrapper.outerHTML).toMatchInlineSnapshot(
|
||||
`"<div data-wxt-iframe="" style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: absolute; top: 0px; left: 0px;"></iframe></div>"`,
|
||||
`"<div style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: absolute; top: 0px; left: 0px;"></iframe></div>"`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -170,7 +164,7 @@ describe('Content Script UIs', () => {
|
||||
ui.mount();
|
||||
|
||||
expect(ui.wrapper.outerHTML).toMatchInlineSnapshot(
|
||||
`"<div data-wxt-iframe="" style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: absolute; top: 0px; left: 0px;"></iframe></div>"`,
|
||||
`"<div style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: absolute; top: 0px; left: 0px;"></iframe></div>"`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -183,7 +177,7 @@ describe('Content Script UIs', () => {
|
||||
ui.mount();
|
||||
|
||||
expect(ui.wrapper.outerHTML).toMatchInlineSnapshot(
|
||||
`"<div data-wxt-iframe="" style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: absolute; top: 0px; right: 0px;"></iframe></div>"`,
|
||||
`"<div style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: absolute; top: 0px; right: 0px;"></iframe></div>"`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -196,7 +190,7 @@ describe('Content Script UIs', () => {
|
||||
ui.mount();
|
||||
|
||||
expect(ui.wrapper.outerHTML).toMatchInlineSnapshot(
|
||||
`"<div data-wxt-iframe="" style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: absolute; bottom: 0px; right: 0px;"></iframe></div>"`,
|
||||
`"<div style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: absolute; bottom: 0px; right: 0px;"></iframe></div>"`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -209,7 +203,7 @@ describe('Content Script UIs', () => {
|
||||
ui.mount();
|
||||
|
||||
expect(ui.wrapper.outerHTML).toMatchInlineSnapshot(
|
||||
`"<div data-wxt-iframe="" style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: absolute; bottom: 0px; left: 0px;"></iframe></div>"`,
|
||||
`"<div style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: absolute; bottom: 0px; left: 0px;"></iframe></div>"`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -235,7 +229,7 @@ describe('Content Script UIs', () => {
|
||||
ui.mount();
|
||||
|
||||
expect(ui.wrapper.outerHTML).toMatchInlineSnapshot(
|
||||
`"<div data-wxt-iframe="" style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: fixed; top: 0px; bottom: 0px; left: 0px; right: 0px;"></iframe></div>"`,
|
||||
`"<div style="overflow: visible; position: relative; width: 0px; height: 0px; display: block;"><iframe src="chrome-extension://test-extension-id/page.html" style="position: fixed; top: 0px; bottom: 0px; left: 0px; right: 0px;"></iframe></div>"`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -262,9 +256,7 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector('body > div[data-wxt-integrated]'),
|
||||
).not.toBeNull();
|
||||
expect(document.body.children).toContain(ui.wrapper);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -277,9 +269,9 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector('#parent > div[data-wxt-integrated]'),
|
||||
).not.toBeNull();
|
||||
expect(document.querySelector('#parent')!.children).toContain(
|
||||
ui.wrapper,
|
||||
);
|
||||
});
|
||||
|
||||
it('should append the element using an XPath string', () => {
|
||||
@@ -295,9 +287,7 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector('#three > div[data-wxt-integrated]'),
|
||||
).not.toBeNull();
|
||||
expect(document.querySelector('#three')!.children[0]).toBe(ui.wrapper);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -310,9 +300,9 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector('#parent > div[data-wxt-integrated]'),
|
||||
).not.toBeNull();
|
||||
expect(document.querySelector('#parent')!.children).toContain(
|
||||
ui.wrapper,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -325,9 +315,9 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector('#parent > div[data-wxt-integrated]'),
|
||||
).not.toBeNull();
|
||||
expect(document.querySelector('#parent')!.children).toContain(
|
||||
ui.wrapper,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -354,9 +344,7 @@ describe('Content Script UIs', () => {
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector(
|
||||
'#parent > div[data-wxt-integrated]:last-child',
|
||||
),
|
||||
document.querySelector('#parent')!.lastElementChild,
|
||||
).not.toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -372,9 +360,7 @@ describe('Content Script UIs', () => {
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector(
|
||||
'#parent > div[data-wxt-integrated]:first-child',
|
||||
),
|
||||
document.querySelector('#parent')!.children[0].firstElementChild,
|
||||
).not.toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -389,9 +375,7 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector('body > div[data-wxt-integrated]'),
|
||||
).not.toBeNull();
|
||||
expect(document.body.children).toContain(ui.wrapper);
|
||||
expect(document.querySelector('#parent')).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -406,11 +390,9 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector(
|
||||
'#parent > div[data-wxt-integrated]:first-child',
|
||||
),
|
||||
).not.toBeNull();
|
||||
expect(document.querySelector('#parent')!.firstElementChild).toBe(
|
||||
ui.wrapper,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -424,11 +406,9 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector(
|
||||
'#parent > div[data-wxt-integrated]:last-child',
|
||||
),
|
||||
).not.toBeNull();
|
||||
expect(document.querySelector('#parent')!.lastElementChild).toBe(
|
||||
ui.wrapper,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -444,9 +424,8 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
ui.mount();
|
||||
|
||||
expect(
|
||||
document.querySelector('body > div[data-wxt-integrated]'),
|
||||
).not.toBeNull();
|
||||
expect(document.body.children).toContain(ui.wrapper);
|
||||
|
||||
expect(document.querySelector('#parent')).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -529,23 +508,29 @@ describe('Content Script UIs', () => {
|
||||
{
|
||||
name: 'integrated',
|
||||
createUiFunction: createIntegratedUi,
|
||||
uiSelector: 'div[data-wxt-integrated]',
|
||||
uiSelector: '[data-wrapper-name="integrated"]',
|
||||
},
|
||||
{
|
||||
name: 'iframe',
|
||||
createUiFunction: createIframeUi,
|
||||
uiSelector: 'div[data-wxt-iframe]',
|
||||
uiSelector: `[data-wrapper-name="iframe"]`,
|
||||
},
|
||||
{
|
||||
name: 'shadow-root',
|
||||
createUiFunction: createShadowRootUi,
|
||||
uiSelector: 'test-component[data-wxt-shadow-root]',
|
||||
uiSelector: 'test-component',
|
||||
},
|
||||
] as const)(
|
||||
'built-in UI type: $name',
|
||||
({ name, createUiFunction, uiSelector }) => {
|
||||
const onMount = vi.fn((wrapper: HTMLElement) => {
|
||||
if (name === 'shadow-root') return;
|
||||
|
||||
wrapper.setAttribute('data-wrapper-name', name);
|
||||
appendTestApp(wrapper);
|
||||
});
|
||||
|
||||
it('should mount if an anchor already exists at the initialization', async () => {
|
||||
const onMount = vi.fn(appendTestApp);
|
||||
ui = await createUiFunction(ctx, {
|
||||
position: 'inline',
|
||||
onMount,
|
||||
@@ -555,6 +540,7 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
|
||||
appendTestElement({ id: DYNAMIC_CHILD_ID });
|
||||
|
||||
ui.autoMount();
|
||||
await runMicrotasks();
|
||||
|
||||
@@ -564,7 +550,6 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
|
||||
it('should mount when an anchor is dynamically added and unmount when an anchor is removed', async () => {
|
||||
const onMount = vi.fn(appendTestApp);
|
||||
const onRemove = vi.fn();
|
||||
ui = await createUiFunction(ctx, {
|
||||
position: 'inline',
|
||||
@@ -599,7 +584,6 @@ describe('Content Script UIs', () => {
|
||||
|
||||
describe('options', () => {
|
||||
it('should auto-mount only once mount and remove when the `once` option is true', async () => {
|
||||
const onMount = vi.fn(appendTestApp);
|
||||
const onRemove = vi.fn();
|
||||
ui = await createUiFunction(ctx, {
|
||||
position: 'inline',
|
||||
@@ -644,7 +628,7 @@ describe('Content Script UIs', () => {
|
||||
it('should throw when anchor is set as type Element', async () => {
|
||||
ui = await createUiFunction(ctx, {
|
||||
position: 'inline',
|
||||
onMount: appendTestApp,
|
||||
onMount,
|
||||
anchor: document.documentElement,
|
||||
page: name === 'iframe' ? '/page.html' : undefined,
|
||||
name: 'test-component',
|
||||
@@ -657,7 +641,7 @@ describe('Content Script UIs', () => {
|
||||
it('should throw when anchor is set as type `() => Element`', async () => {
|
||||
ui = await createUiFunction(ctx, {
|
||||
position: 'inline',
|
||||
onMount: appendTestApp,
|
||||
onMount,
|
||||
anchor: () => document.documentElement,
|
||||
page: name === 'iframe' ? '/page.html' : undefined,
|
||||
name: 'test-component',
|
||||
@@ -670,7 +654,6 @@ describe('Content Script UIs', () => {
|
||||
|
||||
describe('StopAutoMount', () => {
|
||||
it('should stop auto-mounting and remove ui when `ui.remove` is called', async () => {
|
||||
const onMount = vi.fn(appendTestApp);
|
||||
const onRemove = vi.fn();
|
||||
ui = await createUiFunction(ctx, {
|
||||
position: 'inline',
|
||||
@@ -705,7 +688,6 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
|
||||
it('should call internal StopAutoMount when `ui.remove` is called', async () => {
|
||||
const onMount = vi.fn(appendTestApp);
|
||||
const onRemove = vi.fn();
|
||||
const onStop = vi.fn();
|
||||
ui = await createUiFunction(ctx, {
|
||||
@@ -723,7 +705,6 @@ describe('Content Script UIs', () => {
|
||||
});
|
||||
|
||||
it('should allow calling automount again after internal StopAutoMount is called', async () => {
|
||||
const onMount = vi.fn(appendTestApp);
|
||||
ui = await createUiFunction(ctx, {
|
||||
position: 'inline',
|
||||
onMount,
|
||||
|
||||
@@ -14,7 +14,6 @@ export function createIframeUi<TMounted>(
|
||||
options: IframeContentScriptUiOptions<TMounted>,
|
||||
): IframeContentScriptUi<TMounted> {
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.setAttribute('data-wxt-iframe', '');
|
||||
const iframe = document.createElement('iframe');
|
||||
// @ts-expect-error: getURL is defined per-project, but not inside the package
|
||||
iframe.src = browser.runtime.getURL(options.page);
|
||||
@@ -46,8 +45,9 @@ export function createIframeUi<TMounted>(
|
||||
};
|
||||
}
|
||||
|
||||
export interface IframeContentScriptUi<TMounted>
|
||||
extends ContentScriptUi<TMounted> {
|
||||
export interface IframeContentScriptUi<
|
||||
TMounted,
|
||||
> extends ContentScriptUi<TMounted> {
|
||||
/**
|
||||
* The iframe added to the DOM.
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,6 @@ export function createIntegratedUi<TMounted>(
|
||||
options: IntegratedContentScriptUiOptions<TMounted>,
|
||||
): IntegratedContentScriptUi<TMounted> {
|
||||
const wrapper = document.createElement(options.tag || 'div');
|
||||
wrapper.setAttribute('data-wxt-integrated', '');
|
||||
|
||||
let mounted: TMounted | undefined = undefined;
|
||||
const mount = () => {
|
||||
@@ -51,8 +50,9 @@ export function createIntegratedUi<TMounted>(
|
||||
* Shared types for the different `wxt/utils/content-script-ui/*` modules.
|
||||
* @module wxt/utils/content-script-ui/types
|
||||
*/
|
||||
export interface IntegratedContentScriptUi<TMounted>
|
||||
extends ContentScriptUi<TMounted> {
|
||||
export interface IntegratedContentScriptUi<
|
||||
TMounted,
|
||||
> extends ContentScriptUi<TMounted> {
|
||||
/**
|
||||
* A wrapper div that assists in positioning.
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,6 @@ export async function createShadowRootUi<TMounted>(
|
||||
mode: options.mode ?? 'open',
|
||||
isolateEvents: options.isolateEvents,
|
||||
});
|
||||
shadowHost.setAttribute('data-wxt-shadow-root', '');
|
||||
|
||||
let mounted: TMounted | undefined;
|
||||
|
||||
@@ -135,8 +134,9 @@ async function loadCss(): Promise<string> {
|
||||
}
|
||||
}
|
||||
|
||||
export interface ShadowRootContentScriptUi<TMounted>
|
||||
extends ContentScriptUi<TMounted> {
|
||||
export interface ShadowRootContentScriptUi<
|
||||
TMounted,
|
||||
> extends ContentScriptUi<TMounted> {
|
||||
/**
|
||||
* The `HTMLElement` hosting the shadow root used to isolate the UI's styles. This is the element
|
||||
* that get's added to the DOM. This element's style is not isolated from the webpage.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/** @module wxt/utils/split-shadow-root-css */
|
||||
|
||||
const AT_RULE_BLOCKS = /(\s*@(property|font-face)[\s\S]*?{[\s\S]*?})/gm;
|
||||
|
||||
/**
|
||||
* Given a CSS string that will be loaded into a shadow root, split it into two parts:
|
||||
* - `documentCss`: CSS that needs to be applied to the document (like `@property`)
|
||||
@@ -10,18 +12,13 @@ export function splitShadowRootCss(css: string): {
|
||||
documentCss: string;
|
||||
shadowCss: string;
|
||||
} {
|
||||
let shadowCss = css;
|
||||
let documentCss = '';
|
||||
|
||||
const rulesRegex = /(\s*@(property|font-face)[\s\S]*?{[\s\S]*?})/gm;
|
||||
let match;
|
||||
while ((match = rulesRegex.exec(css)) !== null) {
|
||||
documentCss += match[1];
|
||||
shadowCss = shadowCss.replace(match[1], '');
|
||||
}
|
||||
const documentCss = Array.from(css.matchAll(AT_RULE_BLOCKS), (m) => m[0])
|
||||
.join('')
|
||||
.trim();
|
||||
const shadowCss = css.replace(AT_RULE_BLOCKS, '').trim();
|
||||
|
||||
return {
|
||||
documentCss: documentCss.trim(),
|
||||
shadowCss: shadowCss.trim(),
|
||||
documentCss: documentCss,
|
||||
shadowCss: shadowCss,
|
||||
};
|
||||
}
|
||||
|
||||
Generated
+1277
-1053
File diff suppressed because it is too large
Load Diff
@@ -8,3 +8,11 @@ onlyBuiltDependencies:
|
||||
- sharp
|
||||
- simple-git-hooks
|
||||
- spawn-sync
|
||||
autoInstallPeers: false
|
||||
patchedDependencies:
|
||||
markdown-it-footnote: patches/markdown-it-footnote.patch
|
||||
peerDependencyRules:
|
||||
ignoreMissing:
|
||||
- '@algolia/client-search'
|
||||
- search-insights
|
||||
- svelte
|
||||
|
||||
@@ -4,6 +4,7 @@ import * as semver from 'semver';
|
||||
import { dirname } from 'node:path';
|
||||
import consola from 'consola';
|
||||
import spawn from 'nano-spawn';
|
||||
import pMap from 'p-map';
|
||||
|
||||
const HELP_MESSAGE = `
|
||||
Upgrades dependencies throughout WXT using custom rules.
|
||||
@@ -177,7 +178,7 @@ function validateNoMultipleVersions(
|
||||
async function fetchPackageInfo(name: string): Promise<PackageInfo> {
|
||||
// Use PNPM instead of API in case dependencies don't come from NPM
|
||||
const res = await spawn('pnpm', ['view', name, '--json']);
|
||||
return JSON.parse(res.output);
|
||||
return JSON.parse(res.stdout);
|
||||
}
|
||||
|
||||
type PackageInfo = {
|
||||
@@ -203,12 +204,13 @@ type DependencyInfo = {
|
||||
async function fetchAllPackageInfos(
|
||||
deps: DependencyVersionMap,
|
||||
): Promise<DependencyInfo[]> {
|
||||
const infos = await Promise.all(
|
||||
Object.entries(deps).map(async ([name, currentVersionRange]) => ({
|
||||
name,
|
||||
currentVersionRange,
|
||||
info: await fetchPackageInfo(name),
|
||||
})),
|
||||
const infos: DependencyInfo[] = await pMap(
|
||||
Object.entries(deps),
|
||||
async ([name, currentVersionRange]) => {
|
||||
const info = await fetchPackageInfo(name);
|
||||
return { name, currentVersionRange, info };
|
||||
},
|
||||
{ concurrency: 20 },
|
||||
);
|
||||
return infos.toSorted((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
@@ -253,7 +255,6 @@ async function detectUpgrades(
|
||||
const latestVersion = dep.info['dist-tags'].latest;
|
||||
const latestVersionReleasedAt = new Date(dep.info.time[latestVersion]);
|
||||
|
||||
semver.RELEASE_TYPES;
|
||||
const upgradeToVersion = isMajor
|
||||
? // Always use the latest version for major upgrades
|
||||
latestVersion
|
||||
|
||||
Vendored
+6
-6
@@ -15,14 +15,14 @@
|
||||
"postinstall": "wxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^19.1.1",
|
||||
"react-dom": "^19.1.1"
|
||||
"react": "^19.2.3",
|
||||
"react-dom": "^19.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.1.12",
|
||||
"@types/react-dom": "^19.1.9",
|
||||
"@wxt-dev/module-react": "^1.1.3",
|
||||
"typescript": "^5.9.2",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@wxt-dev/module-react": "^1.1.5",
|
||||
"typescript": "^5.9.3",
|
||||
"wxt": "^0.20.6"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -15,11 +15,11 @@
|
||||
"postinstall": "wxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"solid-js": "^1.9.9"
|
||||
"solid-js": "^1.9.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wxt-dev/module-solid": "^1.1.3",
|
||||
"typescript": "^5.9.2",
|
||||
"@wxt-dev/module-solid": "^1.1.4",
|
||||
"typescript": "^5.9.3",
|
||||
"wxt": "^0.20.6"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
-5
@@ -15,12 +15,12 @@
|
||||
"postinstall": "wxt prepare"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/svelte": "^5.0.5",
|
||||
"@wxt-dev/module-svelte": "^2.0.3",
|
||||
"svelte": "^5.38.6",
|
||||
"svelte-check": "^4.3.1",
|
||||
"@tsconfig/svelte": "^5.0.6",
|
||||
"@wxt-dev/module-svelte": "^2.0.4",
|
||||
"svelte": "^5.46.0",
|
||||
"svelte-check": "^4.3.4",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.9.2",
|
||||
"typescript": "^5.9.3",
|
||||
"wxt": "^0.20.6"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@
|
||||
"postinstall": "wxt prepare"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.9.2",
|
||||
"typescript": "^5.9.3",
|
||||
"wxt": "^0.20.6"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -15,12 +15,12 @@
|
||||
"postinstall": "wxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.5.21"
|
||||
"vue": "^3.5.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wxt-dev/module-vue": "^1.0.2",
|
||||
"typescript": "^5.9.2",
|
||||
"vue-tsc": "^3.0.6",
|
||||
"@wxt-dev/module-vue": "^1.0.3",
|
||||
"typescript": "^5.9.3",
|
||||
"vue-tsc": "^3.1.8",
|
||||
"wxt": "^0.20.6"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user