Compare commits
115 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b7b3fc53eb | |||
| 4b44fb849d | |||
| 5d0a266e9c | |||
| 24667861db | |||
| 25cc403886 | |||
| 923312c482 | |||
| adeef6eb73 | |||
| 6f84d45960 | |||
| 938c25cab4 | |||
| 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 | |||
| b02001796e | |||
| 0d4d2fdd7e | |||
| b65e5446fa | |||
| f75fe3ce5b | |||
| 59ba2712cf | |||
| fefe601541 | |||
| 7291c60413 | |||
| bb679102b1 | |||
| 16027c8971 | |||
| 84405a33e3 | |||
| bdf795c3f2 | |||
| ab73084bb5 | |||
| e9fb4c5414 | |||
| bc54f525e4 | |||
| 9170159bc1 | |||
| fa657a0366 | |||
| 24920ddd52 | |||
| eb0b372113 | |||
| 8f5f4f674e | |||
| 38c1dae9c7 | |||
| f92bcd1d14 | |||
| df09b86d23 | |||
| bd5cfa10ad | |||
| 94914dd1ad | |||
| dfbb58a2f1 | |||
| 54a1c3576f | |||
| 9ddf73b4fe | |||
| 4ceec1a6ab | |||
| ba314d7434 | |||
| 55fed67067 | |||
| 852390092e | |||
| 067be3fed3 | |||
| 1aecdbb71c | |||
| d8e517cb7b | |||
| 9da5b4cacc | |||
| 84af32242b | |||
| 7a81472407 | |||
| 9399d8df42 | |||
| 459f73fd5c | |||
| c1c3d3b7c5 | |||
| 380a9630e5 | |||
| 984568e00c | |||
| 5fefd8e083 | |||
| a6eef643f6 | |||
| a01928e010 | |||
| d901db2316 | |||
| fdda812078 | |||
| 7c59e9d5b5 | |||
| c9b0c4da34 | |||
| 9f214141b4 | |||
| 4638e90f02 | |||
| d1c50ab6f8 | |||
| 489aa0ffd8 | |||
| ebcc605961 | |||
| bb630049d5 | |||
| 39321adfe1 | |||
| ea2b8df906 | |||
| 74a9b1aef4 | |||
| 8b3e35de94 |
@@ -4,12 +4,10 @@ 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:
|
||||
@@ -17,12 +15,12 @@ runs:
|
||||
|
||||
steps:
|
||||
- name: 🛠️ Setup PNPM
|
||||
uses: pnpm/action-setup@v4
|
||||
uses: pnpm/action-setup@f2b2b233b538f500472c7274c7012f57857d8ce0 # v4.1.0
|
||||
|
||||
- name: 🛠️ Setup NodeJS
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
|
||||
with:
|
||||
node-version: 18
|
||||
node-version: 20
|
||||
cache: pnpm
|
||||
|
||||
- name: 📦 Install Dependencies
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
name: 🔔 Notify Unreleased Commits
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 20 * * 1' # Weekly at 8 PM UTC (3 PM CT)
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.repository_owner == 'wxt-dev'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: List Commits
|
||||
id: list-commits
|
||||
run: |
|
||||
./scripts/list-unreleased-commits.sh > summary.txt
|
||||
|
||||
- name: Discord notification
|
||||
run: |
|
||||
PAYLOAD=$(jq -n --arg content "${{ env.MESSAGE }}" '{"content": $content}')
|
||||
curl -X POST \
|
||||
-F "payload_json=${PAYLOAD}" \
|
||||
-F "file1=@summary.txt" \
|
||||
$DISCORD_WEBHOOK
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_UNRELEASED_COMMITS }}
|
||||
MESSAGE: |
|
||||
If a package needs released, please [run the workflow](<https://github.com/wxt-dev/wxt/actions/workflows/release.yml>).
|
||||
|
||||
Before running, consider:
|
||||
- Are there any breaking changes? If so, prepare a list of breaking changes and update the changelog and release notes after the release.
|
||||
- Are there any PRs open that we wait to release after they're merged?
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
if: ${{ github.repository == 'wxt-dev/wxt' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
with:
|
||||
# Only fetch the config file from the repository
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
@@ -23,13 +23,13 @@ jobs:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Login to Docker Registry
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
with:
|
||||
registry: https://${{ secrets.DOCKER_REGISTRY_HOSTNAME }}
|
||||
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
|
||||
|
||||
@@ -31,16 +31,18 @@ jobs:
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
contents: write # Push version changes
|
||||
id-token: write # OIDC for NPM publishing
|
||||
needs:
|
||||
- validate
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ssh-key: ${{ secrets.DEPLOY_KEY }} # https://github.com/sbellone/release-workflow-example
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
@@ -60,9 +62,9 @@ jobs:
|
||||
- name: Publish to NPM
|
||||
working-directory: packages/${{ inputs.package }}
|
||||
run: |
|
||||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
|
||||
pnpm build
|
||||
pnpm publish
|
||||
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 }}
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
@@ -11,11 +11,15 @@ jobs:
|
||||
sync:
|
||||
name: 'Sync with @types/chrome'
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'wxt-dev'
|
||||
permissions:
|
||||
contents: write
|
||||
contents: write # Push version changes
|
||||
id-token: write # OIDC for NPM publishing
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
with:
|
||||
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
@@ -32,15 +36,16 @@ jobs:
|
||||
|
||||
- name: Commit Changes
|
||||
id: commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v6
|
||||
uses: stefanzweifel/git-auto-commit-action@01d77ca6cb089da1360e540865f7d035c95aa199 # v6.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
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: |
|
||||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
|
||||
pnpm publish
|
||||
pnpm pack
|
||||
sudo npm i -g npm@latest
|
||||
/usr/local/bin/npm publish *.tgz
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
@@ -68,13 +68,13 @@ jobs:
|
||||
coverage: false
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
uses: oven-sh/setup-bun@22457c87c1b161cf7dde222c3e82b2b5f8d2bed2 # v2.0.2
|
||||
|
||||
- name: Run Tests
|
||||
if: ${{ ! matrix.coverage }}
|
||||
@@ -86,7 +86,7 @@ jobs:
|
||||
|
||||
- name: Upload Coverage
|
||||
if: matrix.coverage
|
||||
uses: codecov/codecov-action@v5
|
||||
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
- vue
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
@@ -31,12 +31,12 @@ jobs:
|
||||
pnpm dlx wxt@latest --version
|
||||
|
||||
- name: Record VHS
|
||||
uses: charmbracelet/vhs-action@v2.1.0
|
||||
uses: charmbracelet/vhs-action@59641cdc7fadf3978db65eb8c6937ea2752f4ec3 # v2.1.0
|
||||
with:
|
||||
path: 'docs/tapes/init-demo.tape'
|
||||
|
||||
- name: Save recorded GIF
|
||||
uses: stefanzweifel/git-auto-commit-action@v6
|
||||
uses: stefanzweifel/git-auto-commit-action@01d77ca6cb089da1360e540865f7d035c95aa199 # v6.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
|
||||
+7
-3
@@ -146,13 +146,17 @@ Releases are done with GitHub actions:
|
||||
|
||||
## Upgrading Dependencies
|
||||
|
||||
Use [`taze`](https://www.npmjs.com/package/taze) to upgrade dependencies throughout the entire monorepo.
|
||||
WXT has custom rules around what dependencies can be upgraded. Use the `scripts/upgrade-deps.ts` script to upgrade dependencies and follow these rules.
|
||||
|
||||
```sh
|
||||
pnpm dlx taze -r
|
||||
pnpm tsx scripts/upgrade-deps.ts
|
||||
```
|
||||
|
||||
Configuration is in [`taze.config.ts`](./taze.config.ts).
|
||||
To see all the options, run:
|
||||
|
||||
```sh
|
||||
pnpm tsx scripts/upgrade-deps.ts --help
|
||||
```
|
||||
|
||||
## Install Unreleased Versions
|
||||
|
||||
|
||||
@@ -98,6 +98,20 @@ const chromeExtensionIds = [
|
||||
'kacblhilkacgfnkjfodalohcnllcgmjd', // Add QR Code Generator Icon Back To Address Bar
|
||||
'fkbdlogfdjmpfepbbbjcgcfbgbcfcnne', // Piwik PRO Tracking Helper
|
||||
'nkbikckldmljjiiajklecmgmajgapbfl', // PIPX - Take Control of Picture-in-Picture, Automatically
|
||||
'hgppdobcpkfkmiegekaglonjajeojmdd', // Browsely - AI-powered browser extension
|
||||
'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)';
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -591,6 +591,76 @@ 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`.
|
||||
:::
|
||||
|
||||
The `script` element can be modified just before it is added to the DOM by using the `modifyScript` option. This can be used to e.g. modify `script.async`/`script.defer`, add event listeners to the element, or pass data to the script via `script.dataset`. An example:
|
||||
|
||||
```ts
|
||||
// entrypoints/example.content.ts
|
||||
export default defineContentScript({
|
||||
matches: ['*://*/*'],
|
||||
async main() {
|
||||
await injectScript('/example-main-world.js', {
|
||||
modifyScript(script) {
|
||||
script.dataset['greeting'] = 'Hello there';
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
```ts
|
||||
// entrypoints/example-main-world.ts
|
||||
export default defineUnlistedScript(() => {
|
||||
console.log(document.currentScript?.dataset['greeting']);
|
||||
});
|
||||
```
|
||||
|
||||
`injectScript` returns the created script element. It can be used to e.g. send messages to the script in the form of custom events. The script can add an event listener for them via `document.currentScript`. An example of bidirectional communication:
|
||||
|
||||
```ts
|
||||
// entrypoints/example.content.ts
|
||||
export default defineContentScript({
|
||||
matches: ['*://*/*'],
|
||||
async main() {
|
||||
const { script } = await injectScript('/example-main-world.js', {
|
||||
modifyScript(script) {
|
||||
// Add a listener before the injected script is loaded.
|
||||
script.addEventListener('from-injected-script', (event) => {
|
||||
if (event instanceof CustomEvent) {
|
||||
console.log(`${event.type}:`, event.detail);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// Send an event after the injected script is loaded.
|
||||
script.dispatchEvent(
|
||||
new CustomEvent('from-content-script', {
|
||||
detail: 'General Kenobi',
|
||||
}),
|
||||
);
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
```ts
|
||||
// entrypoints/example-main-world.ts
|
||||
export default defineUnlistedScript(() => {
|
||||
const script = document.currentScript;
|
||||
|
||||
script?.addEventListener('from-content-script', (event) => {
|
||||
if (event instanceof CustomEvent) {
|
||||
console.log(`${event.type}:`, event.detail);
|
||||
}
|
||||
});
|
||||
|
||||
script?.dispatchEvent(
|
||||
new CustomEvent('from-injected-script', {
|
||||
detail: 'Hello there',
|
||||
}),
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
@@ -72,13 +72,13 @@ jobs:
|
||||
submit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
node-version: 22
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
|
||||
@@ -9,7 +9,7 @@ WXT provides first class support for Vitest for unit testing:
|
||||
```ts
|
||||
// vitest.config.ts
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import { WxtVitest } from 'wxt/testing';
|
||||
import { WxtVitest } from 'wxt/testing/vitest-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [WxtVitest()],
|
||||
@@ -36,7 +36,7 @@ This example demonstrates that you don't have to mock `browser.storage` (used by
|
||||
|
||||
```ts
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { fakeBrowser } from 'wxt/testing';
|
||||
import { fakeBrowser } from 'wxt/testing/fake-browser';
|
||||
|
||||
const accountStorage = storage.defineItem<Account>('local:account');
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ This is usually caused by one of two things (or both) when using `createShadowRo
|
||||
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/)
|
||||
|
||||
|
||||
@@ -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 />
|
||||
|
||||
@@ -54,7 +54,6 @@ See <https://github.com/wxt-dev/wxt/issues/784>
|
||||
To upgrade, you have two options:
|
||||
|
||||
1. **Stop using the polyfill**
|
||||
|
||||
- If you're already using `extensionApi: "chrome"`, then you're not using the polyfill and there is nothing to change!
|
||||
- Otherwise there is only one change: `browser.runtime.onMessage` no longer supports using promises to return a response:
|
||||
|
||||
@@ -71,7 +70,6 @@ To upgrade, you have two options:
|
||||
```
|
||||
|
||||
2. **Continue using the polyfill** - If you want to keep using the polyfill, you can! One less thing to worry about during this upgrade.
|
||||
|
||||
- Install `webextension-polyfill` and WXT's [new polyfill module](https://www.npmjs.com/package/@wxt-dev/webextension-polyfill):
|
||||
|
||||
```sh
|
||||
@@ -129,7 +127,6 @@ The default location for the `public/` and `modules/` directories have changed t
|
||||
|
||||
- If you follow the default folder structure, you don't need to make any changes.
|
||||
- If you set a custom `srcDir`, you have two options:
|
||||
|
||||
1. Move the your `public/` and `modules/` directories to the project root:
|
||||
<!-- prettier-ignore -->
|
||||
```html
|
||||
|
||||
+22
-30
@@ -4,7 +4,7 @@
|
||||
"engines": {
|
||||
"node": ">=18.20.3"
|
||||
},
|
||||
"packageManager": "pnpm@10.10.0",
|
||||
"packageManager": "pnpm@10.15.1",
|
||||
"scripts": {
|
||||
"check": "check && pnpm -r --sequential run check",
|
||||
"test": "pnpm -r --sequential run test run",
|
||||
@@ -17,34 +17,37 @@
|
||||
"docs:preview": "pnpm -s docs:gen && vitepress preview docs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/buildc": "^1.1.4",
|
||||
"@aklinker1/check": "^2.1.0",
|
||||
"@commitlint/config-conventional": "^19.8.0",
|
||||
"@commitlint/types": "^19.8.0",
|
||||
"@aklinker1/buildc": "^1.1.5",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@commitlint/config-conventional": "^19.8.1",
|
||||
"@commitlint/types": "^19.8.1",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@vitest/coverage-v8": "^3.1.2",
|
||||
"changelogen": "^0.6.1",
|
||||
"@types/semver": "^7.7.1",
|
||||
"@vitest/coverage-v8": "^4.0.16",
|
||||
"changelogen": "^0.6.2",
|
||||
"consola": "^3.4.2",
|
||||
"fast-glob": "^3.3.3",
|
||||
"feed": "^4.2.2",
|
||||
"fs-extra": "^11.3.0",
|
||||
"lint-staged": "^15.5.1",
|
||||
"feed": "^5.1.0",
|
||||
"fs-extra": "^11.3.2",
|
||||
"lint-staged": "^16.2.7",
|
||||
"markdown-it-footnote": "^4.0.0",
|
||||
"markdownlint-cli": "^0.45.0",
|
||||
"nano-spawn": "^0.2.0",
|
||||
"prettier": "^3.5.3",
|
||||
"simple-git-hooks": "^2.13.0",
|
||||
"tsx": "4.19.4",
|
||||
"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.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.8.3",
|
||||
"vitepress": "^1.6.3",
|
||||
"typescript": "^5.9.3",
|
||||
"vitepress": "^1.6.4",
|
||||
"vitepress-knowledge": "^0.4.1",
|
||||
"vitepress-plugin-group-icons": "^1.5.2",
|
||||
"vitepress-plugin-group-icons": "^1.6.5",
|
||||
"vitest-mock-extended": "^3.1.0",
|
||||
"vue": "^3.5.13",
|
||||
"vue": "^3.5.25",
|
||||
"wxt": "workspace:*"
|
||||
},
|
||||
"simple-git-hooks": {
|
||||
@@ -52,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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,34 @@
|
||||
# Changelog
|
||||
|
||||
## v0.5.1
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/analytics-v0.5.0...analytics-v0.5.1)
|
||||
|
||||
### 🚀 Enhancements
|
||||
|
||||
- Integrate latest measurement protocol changes ([#1767](https://github.com/wxt-dev/wxt/pull/1767))
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Use `@wxt-dev/browser` instead of `@types/chrome` ([#1645](https://github.com/wxt-dev/wxt/pull/1645))
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- Stop using PNPM catalog ([#1644](https://github.com/wxt-dev/wxt/pull/1644))
|
||||
- Upgrade `@aklinker1/check` to v2 ([#1647](https://github.com/wxt-dev/wxt/pull/1647))
|
||||
- Change browser workspace dependency to `^` ([c7335add](https://github.com/wxt-dev/wxt/commit/c7335add))
|
||||
- Fix auto-fixable `markdownlint` errors ([#1710](https://github.com/wxt-dev/wxt/pull/1710))
|
||||
- **deps:** Upgrade typescript from 5.8.3 to 5.9.2 ([a6eef643](https://github.com/wxt-dev/wxt/commit/a6eef643))
|
||||
- Create script for managing dependency upgrades ([#1875](https://github.com/wxt-dev/wxt/pull/1875))
|
||||
- **deps:** Upgrade all dev dependencies ([#1876](https://github.com/wxt-dev/wxt/pull/1876))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Tanishq-aggarwal ([@tanishq-aggarwal](https://github.com/tanishq-aggarwal))
|
||||
|
||||
## v0.5.0
|
||||
|
||||
[⚠️ breaking changes](https://wxt.dev/guide/resources/upgrading.html) • [compare changes](https://github.com/wxt-dev/wxt/compare/analytics-v0.4.1...analytics-v0.5.0)
|
||||
|
||||
### 🩹 Fixes
|
||||
@@ -9,4 +37,4 @@
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
@@ -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 }),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ export const googleAnalytics4 =
|
||||
ad_personalization: 'DENIED',
|
||||
},
|
||||
user_properties: mappedUserProperties,
|
||||
user_agent: navigator.userAgent,
|
||||
events: [
|
||||
{
|
||||
name: eventName,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wxt-dev/analytics",
|
||||
"version": "0.5.0",
|
||||
"version": "0.5.1",
|
||||
"description": "Add analytics to your web extension",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -51,11 +51,11 @@
|
||||
"wxt": ">=0.20.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@types/ua-parser-js": "^0.7.39",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"wxt": "workspace:*"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
# Changelog
|
||||
|
||||
## v1.1.0
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/auto-icons-v1.0.2...auto-icons-v1.1.0)
|
||||
|
||||
### 🚀 Enhancements
|
||||
|
||||
- Add overlay option for dev icons ([#1825](https://github.com/wxt-dev/wxt/pull/1825))
|
||||
|
||||
### 📖 Documentation
|
||||
|
||||
- Rewrite and restructure the documentation website ([#933](https://github.com/wxt-dev/wxt/pull/933))
|
||||
- Use full URLs in README so they work on the docs site ([d20793d5](https://github.com/wxt-dev/wxt/commit/d20793d5))
|
||||
- Add SVG compatibility note ([#1830](https://github.com/wxt-dev/wxt/pull/1830))
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- Add `oxlint` for linting ([#947](https://github.com/wxt-dev/wxt/pull/947))
|
||||
- **deps:** Bump sharp from 0.33.4 to 0.33.5 ([#959](https://github.com/wxt-dev/wxt/pull/959))
|
||||
- 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))
|
||||
- **deps:** Bump dev and non-breaking major dependencies ([#1167](https://github.com/wxt-dev/wxt/pull/1167))
|
||||
- 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))
|
||||
- Stop using PNPM catalog ([#1644](https://github.com/wxt-dev/wxt/pull/1644))
|
||||
- Upgrade `@aklinker1/check` to v2 ([#1647](https://github.com/wxt-dev/wxt/pull/1647))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Typed SIGTERM ([@typed-sigterm](https://github.com/typed-sigterm))
|
||||
- Kuba ([@zizzfizzix](https://github.com/zizzfizzix))
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
|
||||
## v1.0.2
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/auto-icons-v1.0.1...auto-icons-v1.0.2)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"version": "1.0.2",
|
||||
"version": "1.1.0",
|
||||
"type": "module",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -46,15 +46,15 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"defu": "^6.1.4",
|
||||
"fs-extra": "^11.3.0",
|
||||
"sharp": "^0.34.1"
|
||||
"fs-extra": "^11.3.2",
|
||||
"sharp": "^0.34.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"oxlint": "^0.16.8",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"@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.1",
|
||||
"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.1",
|
||||
"fs-extra": "^11.3.0",
|
||||
"nano-spawn": "^0.2.0",
|
||||
"tsx": "4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"vitest": "^3.1.2"
|
||||
"@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
|
||||
|
||||
|
||||
+2845
-2633
File diff suppressed because it is too large
Load Diff
@@ -24,10 +24,10 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/chrome": "{{chromeTypesVersion}}",
|
||||
"fs-extra": "^11.3.0",
|
||||
"nano-spawn": "^0.2.0",
|
||||
"tsx": "4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"vitest": "^3.1.2"
|
||||
"fs-extra": "^11.3.1",
|
||||
"nano-spawn": "^1.0.2",
|
||||
"tsx": "4.20.5",
|
||||
"typescript": "^5.9.2",
|
||||
"vitest": "^4.0.16"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,14 +40,14 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@types/node": "^20.17.6",
|
||||
"oxlint": "^0.16.8",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"vitest": "^3.1.2",
|
||||
"vitest-plugin-random-seed": "^1.1.1",
|
||||
"oxlint": "^1.33.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"vitest": "^4.0.16",
|
||||
"vitest-plugin-random-seed": "^1.1.2",
|
||||
"wxt": "workspace:*"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
|
||||
@@ -1,5 +1,43 @@
|
||||
# Changelog
|
||||
|
||||
## v1.1.5
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-react-v1.1.4...module-react-v1.1.5)
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- **deps:** Support @vitejs/plugin-react@5 ([9170159b](https://github.com/wxt-dev/wxt/commit/9170159b))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
|
||||
## v1.1.4
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-react-v1.1.3...module-react-v1.1.4)
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Add support for WXT v0.20.0 ([c9dca022](https://github.com/wxt-dev/wxt/commit/c9dca022))
|
||||
|
||||
### 🏡 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))
|
||||
- Stop using PNPM catalog ([#1644](https://github.com/wxt-dev/wxt/pull/1644))
|
||||
- Upgrade `@aklinker1/check` to v2 ([#1647](https://github.com/wxt-dev/wxt/pull/1647))
|
||||
- **deps:** Update all dependencies ([#1648](https://github.com/wxt-dev/wxt/pull/1648))
|
||||
- **deps:** Upgrade typescript from 5.8.3 to 5.9.2 ([a6eef643](https://github.com/wxt-dev/wxt/commit/a6eef643))
|
||||
- Create script for managing dependency upgrades ([#1875](https://github.com/wxt-dev/wxt/pull/1875))
|
||||
- **deps:** Upgrade all dev dependencies ([#1876](https://github.com/wxt-dev/wxt/pull/1876))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Okinea Dev <hi@okinea.dev>
|
||||
|
||||
## v1.1.3
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-react-v1.1.2...module-react-v1.1.3)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/wxt-dev",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
@@ -48,17 +48,17 @@
|
||||
"wxt": ">=0.19.16"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vitejs/plugin-react": "^4.4.1"
|
||||
"@vitejs/plugin-react": "^4.4.1 || ^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"@types/react": "^19.1.2",
|
||||
"@types/react-dom": "^19.1.3",
|
||||
"publint": "^0.3.12",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"@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:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
# Changelog
|
||||
|
||||
## v1.1.4
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-solid-v1.1.3...module-solid-v1.1.4)
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Add support for WXT v0.20.0 ([c9dca022](https://github.com/wxt-dev/wxt/commit/c9dca022))
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- **deps-dev:** Bump solid-js from 1.9.3 to 1.9.4 ([#1391](https://github.com/wxt-dev/wxt/pull/1391))
|
||||
- Add funding links to `package.json` files ([#1446](https://github.com/wxt-dev/wxt/pull/1446))
|
||||
- **deps:** Bump vite-plugin-solid from 2.10.2 to 2.11.6 ([#1491](https://github.com/wxt-dev/wxt/pull/1491))
|
||||
- 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))
|
||||
- Stop using PNPM catalog ([#1644](https://github.com/wxt-dev/wxt/pull/1644))
|
||||
- Upgrade `@aklinker1/check` to v2 ([#1647](https://github.com/wxt-dev/wxt/pull/1647))
|
||||
- **deps:** Update all dependencies ([#1648](https://github.com/wxt-dev/wxt/pull/1648))
|
||||
- **deps:** Upgrade typescript from 5.8.3 to 5.9.2 ([a6eef643](https://github.com/wxt-dev/wxt/commit/a6eef643))
|
||||
- Create script for managing dependency upgrades ([#1875](https://github.com/wxt-dev/wxt/pull/1875))
|
||||
- **deps:** Upgrade all dev dependencies ([#1876](https://github.com/wxt-dev/wxt/pull/1876))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Okinea Dev <hi@okinea.dev>
|
||||
|
||||
## v1.1.3
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-solid-v1.1.2...module-solid-v1.1.3)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/wxt-dev",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.4",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
@@ -48,14 +48,14 @@
|
||||
"wxt": ">=0.19.16"
|
||||
},
|
||||
"dependencies": {
|
||||
"vite-plugin-solid": "^2.11.6"
|
||||
"vite-plugin-solid": "^2.11.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"publint": "^0.3.12",
|
||||
"solid-js": "^1.9.6",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"publint": "^0.3.16",
|
||||
"solid-js": "^1.9.10",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"wxt": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,29 @@
|
||||
# Changelog
|
||||
|
||||
## v2.0.4
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-svelte-v2.0.3...module-svelte-v2.0.4)
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Add support for @sveltejs/vite-plugin-svelte@6 ([459f73fd](https://github.com/wxt-dev/wxt/commit/459f73fd))
|
||||
|
||||
### 🏡 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))
|
||||
- Stop using PNPM catalog ([#1644](https://github.com/wxt-dev/wxt/pull/1644))
|
||||
- Upgrade `@aklinker1/check` to v2 ([#1647](https://github.com/wxt-dev/wxt/pull/1647))
|
||||
- **deps:** Upgrade typescript from 5.8.3 to 5.9.2 ([a6eef643](https://github.com/wxt-dev/wxt/commit/a6eef643))
|
||||
- Create script for managing dependency upgrades ([#1875](https://github.com/wxt-dev/wxt/pull/1875))
|
||||
- **deps:** Upgrade all dev dependencies ([#1876](https://github.com/wxt-dev/wxt/pull/1876))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Okinea Dev <hi@okinea.dev>
|
||||
|
||||
## v2.0.3
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-svelte-v2.0.2...module-svelte-v2.0.3)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/wxt-dev",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
@@ -47,13 +47,13 @@
|
||||
"svelte": ">=5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.0 || ^5.0.0"
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.0 || ^5.0.0 || ^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"wxt": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# Changelog
|
||||
|
||||
## v1.0.3
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-vue-v1.0.2...module-vue-v1.0.3)
|
||||
|
||||
### 🏡 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))
|
||||
- Stop using PNPM catalog ([#1644](https://github.com/wxt-dev/wxt/pull/1644))
|
||||
- Upgrade `@aklinker1/check` to v2 ([#1647](https://github.com/wxt-dev/wxt/pull/1647))
|
||||
- Wxt & @wxt-dev/module-vue support Vite 7 ([#1771](https://github.com/wxt-dev/wxt/pull/1771))
|
||||
- **deps:** Upgrade typescript from 5.8.3 to 5.9.2 ([a6eef643](https://github.com/wxt-dev/wxt/commit/a6eef643))
|
||||
- Create script for managing dependency upgrades ([#1875](https://github.com/wxt-dev/wxt/pull/1875))
|
||||
- **deps:** Upgrade all dev dependencies ([#1876](https://github.com/wxt-dev/wxt/pull/1876))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Ayu ([@ayu-exorcist](https://github.com/ayu-exorcist))
|
||||
- Okinea Dev <hi@okinea.dev>
|
||||
|
||||
## v1.0.2
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/module-vue-v1.0.1...module-vue-v1.0.2)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/wxt-dev",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
@@ -49,10 +49,10 @@
|
||||
"@vitejs/plugin-vue": "^5.2.3 || ^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"wxt": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
# Changelog
|
||||
|
||||
## v0.1.2
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/runner-v0.1.1...runner-v0.1.2)
|
||||
|
||||
### 🚀 Enhancements
|
||||
|
||||
- **config:** Add browser path for Zen via Homebrew ([#1813](https://github.com/wxt-dev/wxt/pull/1813))
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Improve Chrome path search ([#1823](https://github.com/wxt-dev/wxt/pull/1823))
|
||||
- **paths:** Add browser paths for Arc & Dia on macos ([#1814](https://github.com/wxt-dev/wxt/pull/1814))
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- Fix auto-fixable `markdownlint` errors ([#1710](https://github.com/wxt-dev/wxt/pull/1710))
|
||||
- Manually fix markdownlint errors ([#1711](https://github.com/wxt-dev/wxt/pull/1711))
|
||||
- **deps:** Upgrade oxlint from 0.16.8 to 1.14.0 ([a01928e0](https://github.com/wxt-dev/wxt/commit/a01928e0))
|
||||
- **deps:** Upgrade typescript from 5.8.3 to 5.9.2 ([a6eef643](https://github.com/wxt-dev/wxt/commit/a6eef643))
|
||||
- Create script for managing dependency upgrades ([#1875](https://github.com/wxt-dev/wxt/pull/1875))
|
||||
- **deps:** Upgrade all dev dependencies ([#1876](https://github.com/wxt-dev/wxt/pull/1876))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Sam Carlton ([@ThatGuySam](https://github.com/ThatGuySam))
|
||||
- Alexander Kachkaev <alexander@kachkaev.ru>
|
||||
|
||||
## v0.1.1
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/runner-v0.1.0...runner-v0.1.1)
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@wxt-dev/runner",
|
||||
"description": "Launch Chrome and Firefox with a web extension installed",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -29,13 +29,13 @@
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"oxlint": "^0.16.8",
|
||||
"publint": "^0.3.12",
|
||||
"tsx": "4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"vitest": "^3.1.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": "^4.0.16"
|
||||
},
|
||||
"main": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,5 +1,60 @@
|
||||
# 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)
|
||||
|
||||
## v1.2.3
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/storage-v1.2.2...storage-v1.2.3)
|
||||
|
||||
## v1.2.2
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/storage-v1.2.1...storage-v1.2.2)
|
||||
|
||||
## v1.2.1
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/storage-v1.2.0...storage-v1.2.1)
|
||||
|
||||
## v1.2.0
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/storage-v1.1.1...storage-v1.2.0)
|
||||
|
||||
### 🚀 Enhancements
|
||||
|
||||
- **storage:** Add `onMigrationComplete` callback ([#1514](https://github.com/wxt-dev/wxt/pull/1514))
|
||||
- **storage:** Add `debug` option to enable migration logs ([#1513](https://github.com/wxt-dev/wxt/pull/1513))
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Fix typescript error on `defineItem` fallback ([#1601](https://github.com/wxt-dev/wxt/pull/1601))
|
||||
- Use `@wxt-dev/browser` instead of `@types/chrome` ([#1645](https://github.com/wxt-dev/wxt/pull/1645))
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- **deps:** Update all dependencies ([#1568](https://github.com/wxt-dev/wxt/pull/1568))
|
||||
- Stop using PNPM catalog ([#1644](https://github.com/wxt-dev/wxt/pull/1644))
|
||||
- Upgrade `@aklinker1/check` to v2 ([#1647](https://github.com/wxt-dev/wxt/pull/1647))
|
||||
- Change browser workspace dependency to `^` ([c7335add](https://github.com/wxt-dev/wxt/commit/c7335add))
|
||||
- **deps:** Upgrade oxlint from 0.16.8 to 1.14.0 ([a01928e0](https://github.com/wxt-dev/wxt/commit/a01928e0))
|
||||
- **deps:** Upgrade typescript from 5.8.3 to 5.9.2 ([a6eef643](https://github.com/wxt-dev/wxt/commit/a6eef643))
|
||||
- Create script for managing dependency upgrades ([#1875](https://github.com/wxt-dev/wxt/pull/1875))
|
||||
- **deps:** Upgrade all dev dependencies ([#1876](https://github.com/wxt-dev/wxt/pull/1876))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Anh71me ([@iyume](https://github.com/iyume))
|
||||
- Ergou <ma2808203259@hotmail.com>
|
||||
|
||||
## v1.1.1
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/storage-v1.1.0...storage-v1.1.1)
|
||||
@@ -69,4 +124,4 @@ It's still shipped inside WXT and accessible via `wxt/storage`, but now:
|
||||
|
||||
[Read the docs](https://wxt.dev/storage.html) for more details.
|
||||
|
||||
> This is apart of the v1.0 initiative for WXT.
|
||||
> This is apart of the v1.0 initiative for WXT.
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@wxt-dev/storage",
|
||||
"description": "Web extension storage API provided by WXT, supports all browsers.",
|
||||
"version": "1.1.1",
|
||||
"version": "1.2.6",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -35,13 +35,13 @@
|
||||
"dequal": "^2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"@aklinker1/check": "^2.2.0",
|
||||
"@webext-core/fake-browser": "^1.3.2",
|
||||
"oxlint": "^0.16.8",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"vitest": "^3.1.2"
|
||||
"oxlint": "^1.33.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"vitest": "^4.0.16"
|
||||
},
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
|
||||
@@ -1315,6 +1315,18 @@ describe('Storage Utils', () => {
|
||||
});
|
||||
expectTypeOf(item).toEqualTypeOf<WxtStorageItem<number | null, {}>>();
|
||||
});
|
||||
|
||||
it('should define a non-null value when options are passed with a non-null init function', () => {
|
||||
const item = storage.defineItem(`local:test`, {
|
||||
init: () => 123,
|
||||
});
|
||||
expectTypeOf(item).toEqualTypeOf<WxtStorageItem<number, {}>>();
|
||||
|
||||
const item2 = storage.defineItem(`local:test`, {
|
||||
init: () => Promise.resolve(123),
|
||||
});
|
||||
expectTypeOf(item2).toEqualTypeOf<WxtStorageItem<number, {}>>();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
@@ -749,6 +752,12 @@ export interface WxtStorage {
|
||||
key: StorageItemKey,
|
||||
options: WxtStorageItemOptions<TValue> & { defaultValue: TValue },
|
||||
): WxtStorageItem<TValue, TMetadata>;
|
||||
defineItem<TValue, TMetadata extends Record<string, unknown> = {}>(
|
||||
key: StorageItemKey,
|
||||
options: WxtStorageItemOptions<TValue> & {
|
||||
init: () => TValue | Promise<TValue>;
|
||||
},
|
||||
): WxtStorageItem<TValue, TMetadata>;
|
||||
defineItem<TValue, TMetadata extends Record<string, unknown> = {}>(
|
||||
key: StorageItemKey,
|
||||
options: WxtStorageItemOptions<TValue>,
|
||||
|
||||
@@ -40,11 +40,11 @@
|
||||
"wxt": ">=0.19.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"oxlint": "^0.16.8",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"@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,11 +45,11 @@
|
||||
"wxt": ">=0.20.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"@types/webextension-polyfill": "^0.12.3",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"@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.0",
|
||||
"react-dom": "^19.1.0"
|
||||
"react": "^19.2.3",
|
||||
"react-dom": "^19.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.1.2",
|
||||
"@types/react-dom": "^19.1.3",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@wxt-dev/auto-icons": "workspace:*",
|
||||
"@wxt-dev/unocss": "workspace:*",
|
||||
"sass": "^1.87.0",
|
||||
"typescript": "^5.8.3",
|
||||
"sass": "^1.97.0",
|
||||
"typescript": "^5.9.3",
|
||||
"unocss": "^0.64.0 || ^0.65.0 || ^65.0.0 || ^66.0.0",
|
||||
"vitest": "^3.1.2",
|
||||
"vitest-plugin-random-seed": "^1.1.1",
|
||||
"vitest": "^4.0.16",
|
||||
"vitest-plugin-random-seed": "^1.1.2",
|
||||
"wxt": "workspace:*"
|
||||
},
|
||||
"buildc": {
|
||||
|
||||
@@ -1,5 +1,119 @@
|
||||
# Changelog
|
||||
|
||||
## v0.20.13
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.20.12...wxt-v0.20.13)
|
||||
|
||||
### 🚀 Enhancements
|
||||
|
||||
- Remove script element immediately in injectScript ([#1761](https://github.com/wxt-dev/wxt/pull/1761))
|
||||
- Add `modifyScript` option to `injectScript` ([#1762](https://github.com/wxt-dev/wxt/pull/1762))
|
||||
- Make `injectScript` return the created script element ([#1838](https://github.com/wxt-dev/wxt/pull/1838))
|
||||
- Support `.wxtrc` config file ([#1833](https://github.com/wxt-dev/wxt/pull/1833))
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Make `injectScript` wait until script is actually loaded ([#1763](https://github.com/wxt-dev/wxt/pull/1763))
|
||||
- Don't return promises from unlisted scripts that do not have an async `main` function ([#1907](https://github.com/wxt-dev/wxt/pull/1907))
|
||||
|
||||
### 💅 Refactors
|
||||
|
||||
- Use `script.text` instead of `innerHTML` in `injectScript` ([#1764](https://github.com/wxt-dev/wxt/pull/1764))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Rxliuli ([@rxliuli](https://github.com/rxliuli))
|
||||
- Sebastian Landwehr <info@sebastianlandwehr.com>
|
||||
- Johan Kiviniemi ([@ion1](https://github.com/ion1))
|
||||
|
||||
## 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)
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- Split `wxt/testing` into separate modules to fix issues with `jsdom` and `happy-dom` ([#1844](https://github.com/wxt-dev/wxt/pull/1844))
|
||||
- `input_components` is supported by mv3 ([#1881](https://github.com/wxt-dev/wxt/pull/1881))
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- **deps:** Upgrade project subdependencies ([#1882](https://github.com/wxt-dev/wxt/pull/1882))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Qijia Liu <liumeo@pku.edu.cn>
|
||||
- Marcellino Ornelas ([@marcellino-ornelas](https://github.com/marcellino-ornelas))
|
||||
|
||||
## v0.20.10
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.20.9...wxt-v0.20.10)
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- **deps:** Upgrade non-breaking production dependencies ([#1877](https://github.com/wxt-dev/wxt/pull/1877))
|
||||
- **deps:** Upgrade web-ext-run to support CDP ([#1879](https://github.com/wxt-dev/wxt/pull/1879))
|
||||
- **deps:** `publish-browser-extension` upgrade ([#1880](https://github.com/wxt-dev/wxt/pull/1880))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
|
||||
## v0.20.9
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.20.8...wxt-v0.20.9)
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- **types:** Use TType for DocumentEventMap key in ctx.addEventListener ([#1863](https://github.com/wxt-dev/wxt/pull/1863))
|
||||
- Prevent Unlisted CSS from being excluded in the build when using CSS preprocessor ([#1590](https://github.com/wxt-dev/wxt/pull/1590))
|
||||
|
||||
### 🏡 Chore
|
||||
|
||||
- **deps:** Upgrade oxlint from 0.16.8 to 1.14.0 ([a01928e0](https://github.com/wxt-dev/wxt/commit/a01928e0))
|
||||
- **deps:** Upgrade typescript from 5.8.3 to 5.9.2 ([a6eef643](https://github.com/wxt-dev/wxt/commit/a6eef643))
|
||||
- Upgrade nano-spawn to v1 ([5fefd8e0](https://github.com/wxt-dev/wxt/commit/5fefd8e0))
|
||||
- Upgrade faker to v10 ([984568e0](https://github.com/wxt-dev/wxt/commit/984568e0))
|
||||
- Upgrade dotenv to v17.2.2 ([380a9630](https://github.com/wxt-dev/wxt/commit/380a9630))
|
||||
- Upgrade happy-dom to v18.0.1 ([c1c3d3b7](https://github.com/wxt-dev/wxt/commit/c1c3d3b7))
|
||||
- Create script for managing dependency upgrades ([#1875](https://github.com/wxt-dev/wxt/pull/1875))
|
||||
- **deps:** Upgrade all dev dependencies ([#1876](https://github.com/wxt-dev/wxt/pull/1876))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Aaron ([@aklinker1](https://github.com/aklinker1))
|
||||
- Kim Gyeongjae ([@PortalCube](https://github.com/PortalCube))
|
||||
- Atomie CHEN <atomic_cwh@163.com>
|
||||
|
||||
## v0.20.8
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/wxt-v0.20.7...wxt-v0.20.8)
|
||||
|
||||
@@ -220,6 +220,77 @@ describe('Output Directory Structure', () => {
|
||||
expect(await project.fileExists('.output/chrome-mv3/unlisted.js'));
|
||||
});
|
||||
|
||||
it('should support CSS entrypoints', async () => {
|
||||
const project = new TestProject();
|
||||
|
||||
project.addFile(
|
||||
'entrypoints/plain-one.css',
|
||||
`body {
|
||||
font: 100% Helvetica, sans-serif;
|
||||
color: #333;
|
||||
}`,
|
||||
);
|
||||
|
||||
project.addFile(
|
||||
'entrypoints/plain-two.content.css',
|
||||
`body {
|
||||
font: 100% Helvetica, sans-serif;
|
||||
color: #333;
|
||||
}`,
|
||||
);
|
||||
|
||||
project.addFile(
|
||||
'entrypoints/sass-one.scss',
|
||||
`$font-stack: Helvetica, sans-serif;
|
||||
$primary-color: #333;
|
||||
|
||||
body {
|
||||
font: 100% $font-stack;
|
||||
color: $primary-color;
|
||||
}`,
|
||||
);
|
||||
|
||||
project.addFile(
|
||||
'entrypoints/sass-two.content.scss',
|
||||
`$font-stack: Helvetica, sans-serif;
|
||||
$primary-color: #333;
|
||||
|
||||
body {
|
||||
font: 100% $font-stack;
|
||||
color: $primary-color;
|
||||
}`,
|
||||
);
|
||||
|
||||
await project.build();
|
||||
|
||||
expect(await project.serializeOutput(['.output/chrome-mv3/manifest.json']))
|
||||
.toMatchInlineSnapshot(`
|
||||
".output/chrome-mv3/assets/plain-one.css
|
||||
----------------------------------------
|
||||
body{font:100% Helvetica,sans-serif;color:#333}
|
||||
|
||||
================================================================================
|
||||
.output/chrome-mv3/assets/sass-one.css
|
||||
----------------------------------------
|
||||
body{font:100% Helvetica,sans-serif;color:#333}
|
||||
|
||||
================================================================================
|
||||
.output/chrome-mv3/content-scripts/plain-two.css
|
||||
----------------------------------------
|
||||
body{font:100% Helvetica,sans-serif;color:#333}
|
||||
|
||||
================================================================================
|
||||
.output/chrome-mv3/content-scripts/sass-two.css
|
||||
----------------------------------------
|
||||
body{font:100% Helvetica,sans-serif;color:#333}
|
||||
|
||||
================================================================================
|
||||
.output/chrome-mv3/manifest.json
|
||||
----------------------------------------
|
||||
<contents-ignored>"
|
||||
`);
|
||||
});
|
||||
|
||||
it("should output to a custom directory when overriding 'outDir'", async () => {
|
||||
const project = new TestProject();
|
||||
project.addFile('entrypoints/unlisted.html', '<html></html>');
|
||||
@@ -274,7 +345,6 @@ describe('Output Directory Structure', () => {
|
||||
.toMatchInlineSnapshot(`
|
||||
".output/chrome-mv3/background.js
|
||||
----------------------------------------
|
||||
var _a, _b;
|
||||
import { l as logHello, i as initPlugins } from "./chunks/_virtual_wxt-plugins-OjKtWpmY.js";
|
||||
function defineBackground(arg) {
|
||||
if (arg == null || typeof arg === "function") return { main: arg };
|
||||
@@ -286,7 +356,7 @@ describe('Output Directory Structure', () => {
|
||||
logHello("background");
|
||||
}
|
||||
});
|
||||
((_b = (_a = globalThis.browser) == null ? void 0 : _a.runtime) == null ? void 0 : _b.id) ? globalThis.browser : globalThis.chrome;
|
||||
globalThis.browser?.runtime?.id ? globalThis.browser : globalThis.chrome;
|
||||
function print(method, ...args) {
|
||||
return;
|
||||
}
|
||||
@@ -352,9 +422,8 @@ describe('Output Directory Structure', () => {
|
||||
.toMatchInlineSnapshot(`
|
||||
".output/chrome-mv3/background.js
|
||||
----------------------------------------
|
||||
var background = function() {
|
||||
var background = (function() {
|
||||
"use strict";
|
||||
var _a, _b;
|
||||
function defineBackground(arg) {
|
||||
if (arg == null || typeof arg === "function") return { main: arg };
|
||||
return arg;
|
||||
@@ -369,7 +438,7 @@ describe('Output Directory Structure', () => {
|
||||
});
|
||||
function initPlugins() {
|
||||
}
|
||||
((_b = (_a = globalThis.browser) == null ? void 0 : _a.runtime) == null ? void 0 : _b.id) ? globalThis.browser : globalThis.chrome;
|
||||
globalThis.browser?.runtime?.id ? globalThis.browser : globalThis.chrome;
|
||||
function print(method, ...args) {
|
||||
return;
|
||||
}
|
||||
@@ -394,7 +463,7 @@ describe('Output Directory Structure', () => {
|
||||
}
|
||||
const result$1 = result;
|
||||
return result$1;
|
||||
}();
|
||||
})();
|
||||
"
|
||||
`);
|
||||
});
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -139,17 +139,15 @@ describe('User Config', () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should throw error when config file not exist', async () => {
|
||||
it('should not throw error when config file not exist', async () => {
|
||||
const project = new TestProject();
|
||||
project.addFile(
|
||||
'src/entrypoints/background.ts',
|
||||
'entrypoints/background.ts',
|
||||
`export default defineBackground(
|
||||
() => console.log('Hello background'),
|
||||
);`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
project.build({ configFile: 'foo.config.ts' }),
|
||||
).rejects.toThrowError(/not found/);
|
||||
await project.build({ configFile: 'foo.config.ts' });
|
||||
});
|
||||
});
|
||||
|
||||
+36
-28
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "wxt",
|
||||
"type": "module",
|
||||
"version": "0.20.8",
|
||||
"version": "0.20.13",
|
||||
"description": "⚡ Next-gen Web Extension Framework",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
@@ -24,61 +24,61 @@
|
||||
"@wxt-dev/browser": "workspace:^",
|
||||
"@wxt-dev/storage": "workspace:^1.0.0",
|
||||
"async-mutex": "^0.5.0",
|
||||
"c12": "^3.0.3",
|
||||
"c12": "^3.3.2",
|
||||
"cac": "^6.7.14",
|
||||
"chokidar": "^4.0.3",
|
||||
"ci-info": "^4.2.0",
|
||||
"ci-info": "^4.3.1",
|
||||
"consola": "^3.4.2",
|
||||
"defu": "^6.1.4",
|
||||
"dotenv": "^16.5.0",
|
||||
"dotenv-expand": "^12.0.2",
|
||||
"esbuild": "^0.25.0",
|
||||
"dotenv": "^17.2.3",
|
||||
"dotenv-expand": "^12.0.3",
|
||||
"esbuild": "^0.27.1",
|
||||
"fast-glob": "^3.3.3",
|
||||
"filesize": "^10.1.6",
|
||||
"fs-extra": "^11.3.0",
|
||||
"get-port-please": "^3.1.2",
|
||||
"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",
|
||||
"import-meta-resolve": "^4.1.0",
|
||||
"import-meta-resolve": "^4.2.0",
|
||||
"is-wsl": "^3.1.0",
|
||||
"json5": "^2.2.3",
|
||||
"jszip": "^3.10.1",
|
||||
"linkedom": "^0.18.10",
|
||||
"linkedom": "^0.18.12",
|
||||
"magicast": "^0.3.5",
|
||||
"minimatch": "^10.0.1",
|
||||
"nano-spawn": "^0.2.0",
|
||||
"minimatch": "^10.1.1",
|
||||
"nano-spawn": "^1.0.3",
|
||||
"normalize-path": "^3.0.0",
|
||||
"nypm": "^0.6.0",
|
||||
"nypm": "^0.6.2",
|
||||
"ohash": "^2.0.11",
|
||||
"open": "^10.1.2",
|
||||
"open": "^10.2.0",
|
||||
"ora": "^8.2.0",
|
||||
"perfect-debounce": "^1.0.0",
|
||||
"perfect-debounce": "^2.0.0",
|
||||
"picocolors": "^1.1.1",
|
||||
"prompts": "^2.4.2",
|
||||
"publish-browser-extension": "^2.3.0 || ^3.0.0",
|
||||
"publish-browser-extension": "^2.3.0 || ^3.0.2",
|
||||
"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",
|
||||
"web-ext-run": "^0.2.3"
|
||||
"vite-node": "^3.2.4 || ^5.0.0",
|
||||
"web-ext-run": "^0.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aklinker1/check": "2.0.0",
|
||||
"@faker-js/faker": "^9.7.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": "^17.4.6",
|
||||
"happy-dom": "^20.0.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"oxlint": "^0.16.8",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"vitest": "^3.1.2",
|
||||
"vitest-plugin-random-seed": "^1.1.1"
|
||||
"oxlint": "^1.33.0",
|
||||
"publint": "^0.3.16",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"vitest": "^4.0.16",
|
||||
"vitest-plugin-random-seed": "^1.1.2"
|
||||
},
|
||||
"peerDependenciesMeta": {},
|
||||
"repository": {
|
||||
@@ -179,6 +179,14 @@
|
||||
"types": "./dist/browser.d.ts",
|
||||
"default": "./dist/browser.mjs"
|
||||
},
|
||||
"./testing/fake-browser": {
|
||||
"types": "./dist/testing/fake-browser.d.ts",
|
||||
"default": "./dist/testing/fake-browser.mjs"
|
||||
},
|
||||
"./testing/vitest-plugin": {
|
||||
"types": "./dist/testing/wxt-vitest-plugin.d.ts",
|
||||
"default": "./dist/testing/wxt-vitest-plugin.mjs"
|
||||
},
|
||||
"./testing": {
|
||||
"types": "./dist/testing/index.d.ts",
|
||||
"default": "./dist/testing/index.mjs"
|
||||
|
||||
@@ -308,7 +308,10 @@ export async function createViteBuilder(
|
||||
async build(group) {
|
||||
let entryConfig;
|
||||
if (Array.isArray(group)) entryConfig = getMultiPageConfig(group);
|
||||
else if (group.inputPath.endsWith('.css'))
|
||||
else if (
|
||||
group.type === 'content-script-style' ||
|
||||
group.type === 'unlisted-style'
|
||||
)
|
||||
entryConfig = getCssConfig(group);
|
||||
else entryConfig = getLibModeConfig(group);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -12,7 +12,7 @@ export function bundleAnalysis(config: ResolvedConfig): vite.Plugin {
|
||||
config.analysis.outputDir,
|
||||
`${config.analysis.outputName}-${increment++}.json`,
|
||||
),
|
||||
});
|
||||
}) as vite.Plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,7 @@ export function extensionApiMock(config: ResolvedConfig): vite.PluginOption {
|
||||
|
||||
const setupTemplate = `
|
||||
import { vi } from 'vitest';
|
||||
import { fakeBrowser } from 'wxt/testing';
|
||||
import { fakeBrowser } from 'wxt/testing/fake-browser';
|
||||
|
||||
vi.stubGlobal("chrome", fakeBrowser);
|
||||
vi.stubGlobal("browser", fakeBrowser);
|
||||
|
||||
@@ -50,11 +50,7 @@ export async function resolveConfig(
|
||||
configFile: inlineConfig.configFile,
|
||||
name: 'wxt',
|
||||
cwd: inlineConfig.root ?? process.cwd(),
|
||||
rcFile: false,
|
||||
});
|
||||
if (inlineConfig.configFile && metadata.layers?.length === 0) {
|
||||
throw Error(`Config file "${inlineConfig.configFile}" not found`);
|
||||
}
|
||||
userConfig = loadedConfig ?? {};
|
||||
userConfigMetadata = metadata;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ export function createWebExtRunner(): ExtensionRunner {
|
||||
),
|
||||
args: [
|
||||
'--unsafely-disable-devtools-self-xss-warnings',
|
||||
'--disable-features=DisableLoadExtensionCommandLineSwitch',
|
||||
...(wxtUserConfig?.chromiumArgs ?? []),
|
||||
],
|
||||
}),
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -1351,7 +1354,6 @@ describe('Manifest Utils', () => {
|
||||
event_rules: {},
|
||||
file_browser_handlers: {},
|
||||
file_system_provider_capabilities: {},
|
||||
input_components: {},
|
||||
nacl_modules: {},
|
||||
natively_connectable: {},
|
||||
offline_enabled: {},
|
||||
|
||||
@@ -8,6 +8,7 @@ import type { TargetBrowser } from '../../types';
|
||||
export function loadEnv(mode: string, browser: TargetBrowser) {
|
||||
return expand(
|
||||
config({
|
||||
quiet: true,
|
||||
// Files on top override files below
|
||||
path: [
|
||||
`.env.${mode}.${browser}.local`,
|
||||
|
||||
@@ -553,6 +553,7 @@ export function getContentScriptCssWebAccessibleResources(
|
||||
|
||||
resources.push({
|
||||
resources: [cssFile],
|
||||
use_dynamic_url: true,
|
||||
matches:
|
||||
script.options.matches?.map((matchPattern) =>
|
||||
stripPathFromMatchPattern(matchPattern),
|
||||
@@ -716,7 +717,6 @@ const mv2OnlyKeys = [
|
||||
'event_rules',
|
||||
'file_browser_handlers',
|
||||
'file_system_provider_capabilities',
|
||||
'input_components',
|
||||
'nacl_modules',
|
||||
'natively_connectable',
|
||||
'offline_enabled',
|
||||
|
||||
@@ -1 +1,11 @@
|
||||
/**
|
||||
* The fake browser is automatically used as a mock for the `wxt/browser` import
|
||||
* when using `wxt/testing/vitest-plugin` with Vitest. It is also setup to
|
||||
* reset all state before each test.
|
||||
*
|
||||
* This module is just a re-export of [@webext-core/fake-browser](https://webext-core.aklinker1.io/fake-browser/triggering-events).
|
||||
*
|
||||
* @module wxt/testing/fake-browser
|
||||
*/
|
||||
|
||||
export { fakeBrowser, type FakeBrowser } from '@webext-core/fake-browser';
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
/**
|
||||
* Utilities for unit testing WXT extensions.
|
||||
*
|
||||
* @deprecated Use `wxt/testing/*` instead to prevent issues with JSDOM or
|
||||
* HappyDOM environments. Will be removed in the next major version of WXT.
|
||||
*
|
||||
* @module wxt/testing
|
||||
*/
|
||||
export * from './fake-browser';
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* Contains a Vitest plugin that configures your test environment to work with
|
||||
* WXT projects.
|
||||
*
|
||||
* @module wxt/testing/vitest
|
||||
*/
|
||||
|
||||
import type * as vite from 'vite';
|
||||
import {
|
||||
download,
|
||||
@@ -16,7 +23,7 @@ import { registerWxt, wxt } from '../core/wxt';
|
||||
* ```ts
|
||||
* // vitest.config.ts
|
||||
* import { defineConfig } from 'vitest/config';
|
||||
* import { WxtVitest } from 'wxt/testing';
|
||||
* import { WxtVitest } from 'wxt/testing/vitest-plugin';
|
||||
*
|
||||
* export default defineConfig({
|
||||
* plugins: [WxtVitest()],
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
@@ -21,4 +21,22 @@ describe('defineUnlistedScript', () => {
|
||||
|
||||
expect(actual).toEqual({ main });
|
||||
});
|
||||
|
||||
it('should return the result without awaiting for synchronous main functions', () => {
|
||||
const main = vi.fn(() => 'test');
|
||||
|
||||
const actual = defineUnlistedScript(main);
|
||||
|
||||
expect(actual).toEqual({ main });
|
||||
expect(actual.main()).eq('test');
|
||||
});
|
||||
|
||||
it('should return a promise of a result for async main functions', async () => {
|
||||
const main = vi.fn(() => Promise.resolve('test'));
|
||||
|
||||
const actual = defineUnlistedScript(main);
|
||||
|
||||
expect(actual).toEqual({ main });
|
||||
await expect(actual.main()).resolves.toEqual('test');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -202,7 +202,7 @@ export class ContentScriptContext implements AbortController {
|
||||
): void;
|
||||
addEventListener<TType extends keyof DocumentEventMap>(
|
||||
target: Document,
|
||||
type: keyof DocumentEventMap,
|
||||
type: TType,
|
||||
handler: (event: DocumentEventMap[TType]) => void,
|
||||
options?: AddEventListenerOptions,
|
||||
): void;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -15,28 +15,62 @@ export type ScriptPublicPath = Extract<
|
||||
*
|
||||
* Make sure to add the injected script to your manifest's
|
||||
* `web_accessible_resources`.
|
||||
*
|
||||
* @returns A result object containing the created script element.
|
||||
*/
|
||||
export async function injectScript(
|
||||
path: ScriptPublicPath,
|
||||
options?: InjectScriptOptions,
|
||||
): Promise<void> {
|
||||
): Promise<InjectScriptResult> {
|
||||
// @ts-expect-error: getURL is defined per-project, but not inside the package
|
||||
const url = browser.runtime.getURL(path);
|
||||
const script = document.createElement('script');
|
||||
|
||||
if (browser.runtime.getManifest().manifest_version === 2) {
|
||||
// MV2 requires using an inline script
|
||||
script.innerHTML = await fetch(url).then((res) => res.text());
|
||||
script.text = await fetch(url).then((res) => res.text());
|
||||
} else {
|
||||
// MV3 requires using src
|
||||
script.src = url;
|
||||
}
|
||||
|
||||
if (!options?.keepInDom) {
|
||||
script.onload = () => script.remove();
|
||||
}
|
||||
const loadedPromise = makeLoadedPromise(script);
|
||||
|
||||
await options?.modifyScript?.(script);
|
||||
|
||||
(document.head ?? document.documentElement).append(script);
|
||||
|
||||
if (!options?.keepInDom) {
|
||||
script.remove();
|
||||
}
|
||||
|
||||
await loadedPromise;
|
||||
|
||||
return {
|
||||
script,
|
||||
};
|
||||
}
|
||||
|
||||
function makeLoadedPromise(script: HTMLScriptElement): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const onload = () => {
|
||||
resolve();
|
||||
cleanup();
|
||||
};
|
||||
|
||||
const onerror = () => {
|
||||
reject(new Error(`Failed to load script: ${script.src}`));
|
||||
cleanup();
|
||||
};
|
||||
|
||||
const cleanup = () => {
|
||||
script.removeEventListener('load', onload);
|
||||
script.removeEventListener('error', onerror);
|
||||
};
|
||||
|
||||
script.addEventListener('load', onload);
|
||||
script.addEventListener('error', onerror);
|
||||
});
|
||||
}
|
||||
|
||||
export interface InjectScriptOptions {
|
||||
@@ -45,4 +79,21 @@ export interface InjectScriptOptions {
|
||||
* injected. To disable this behavior, set this flag to true.
|
||||
*/
|
||||
keepInDom?: boolean;
|
||||
/**
|
||||
* Modify the script element just before it is added to the DOM.
|
||||
*
|
||||
* It can be used to e.g. modify `script.async`/`script.defer`, add event
|
||||
* listeners to the element, or pass data to the script via `script.dataset`
|
||||
* (which can be accessed by the script via `document.currentScript`).
|
||||
*/
|
||||
modifyScript?: (script: HTMLScriptElement) => Promise<void> | void;
|
||||
}
|
||||
|
||||
export interface InjectScriptResult {
|
||||
/**
|
||||
* The created script element. It can be used to e.g. send messages to the
|
||||
* script in the form of custom events. The script can add an event listener
|
||||
* for them via `document.currentScript`.
|
||||
*/
|
||||
script: HTMLScriptElement;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,10 +2,29 @@ import definition from 'virtual:user-unlisted-script-entrypoint';
|
||||
import { logger } from '../utils/internal/logger';
|
||||
import { initPlugins } from 'virtual:wxt-plugins';
|
||||
|
||||
const result = (async () => {
|
||||
const result = (() => {
|
||||
try {
|
||||
initPlugins();
|
||||
return await definition.main();
|
||||
} catch (err) {
|
||||
logger.error(
|
||||
`Failed to initialize plugins for "${import.meta.env.ENTRYPOINT}"`,
|
||||
err,
|
||||
);
|
||||
throw err;
|
||||
}
|
||||
let result;
|
||||
try {
|
||||
result = definition.main();
|
||||
|
||||
if (result instanceof Promise) {
|
||||
result = (result as Promise<any>).catch((err) => {
|
||||
logger.error(
|
||||
`The unlisted script "${import.meta.env.ENTRYPOINT}" crashed on startup!`,
|
||||
err,
|
||||
);
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(
|
||||
`The unlisted script "${import.meta.env.ENTRYPOINT}" crashed on startup!`,
|
||||
@@ -13,6 +32,7 @@ const result = (async () => {
|
||||
);
|
||||
throw err;
|
||||
}
|
||||
return result;
|
||||
})();
|
||||
|
||||
// Return the main function's result to the background when executed via the
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
"src/utils/split-shadow-root-css.ts",
|
||||
"src/utils/storage.ts",
|
||||
"src/testing/index.ts",
|
||||
"src/testing/fake-browser.ts",
|
||||
"src/testing/wxt-vitest-plugin.ts",
|
||||
"src/modules.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Generated
+3030
-3452
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
|
||||
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
PACKAGES_DIR="./packages"
|
||||
export GIT_PAGER=cat
|
||||
IGNORED_DIRS=("browser" "wxt-demo")
|
||||
|
||||
if [ ! -d "$PACKAGES_DIR" ]; then
|
||||
echo "Error: Directory '$PACKAGES_DIR' not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking for changes in packages since their last tag..."
|
||||
echo ""
|
||||
|
||||
for dir in "$PACKAGES_DIR"/*; do
|
||||
if [ -d "$dir" ]; then
|
||||
pkg_name=$(basename "$dir")
|
||||
|
||||
# Check if the package name is in the ignored directories list
|
||||
if [[ " ${IGNORED_DIRS[*]} " =~ " $pkg_name " ]]; then
|
||||
echo "Skipping ignored package: $pkg_name"
|
||||
continue # Skip to the next directory
|
||||
fi
|
||||
|
||||
echo "----------------------------------------"
|
||||
echo "Package: $pkg_name"
|
||||
|
||||
# Find the latest tag for the package, e.g., "my-package-v1.2.3"
|
||||
# Sorts tags by version and picks the most recent one.
|
||||
last_tag=$(git tag --list "${pkg_name}-v*" --sort=-v:refname | head -n 1)
|
||||
|
||||
if [ -n "$last_tag" ]; then
|
||||
# If a tag is found, show commits since that tag for the specific package directory
|
||||
echo "Commits since last tag ($last_tag):"
|
||||
git log "${last_tag}..HEAD" --oneline -- "$dir"
|
||||
else
|
||||
# If no tag is found, show all commits for that package directory
|
||||
echo "No tags found for this package. Listing all commits:"
|
||||
git log --oneline -- "$dir"
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
@@ -0,0 +1,361 @@
|
||||
import glob from 'fast-glob';
|
||||
import fs from 'fs-extra';
|
||||
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.
|
||||
|
||||
Usage:
|
||||
pnpm tsx scripts/upgrade-deps.ts [options]
|
||||
|
||||
Options:
|
||||
--write, -w Write changes to package.json files
|
||||
--major, -m Allow major version upgrades
|
||||
--dev-only, -d Only check/upgrade dev dependencies
|
||||
--prod-only, -p Only check/upgrade production dependencies
|
||||
--help, -h Display this help message
|
||||
`.slice(1, -1);
|
||||
|
||||
const IGNORED_PACKAGES = [
|
||||
// Very touchy, don't change:
|
||||
'typedoc',
|
||||
'typedoc-plugin-markdown',
|
||||
'typedoc-vitepress-theme',
|
||||
// Manually manage version so a single version is used:
|
||||
'esbuild',
|
||||
// Maintained manually to match min-node version
|
||||
'@types/node',
|
||||
// License changed in newer versions
|
||||
'ua-parser-js',
|
||||
];
|
||||
|
||||
await main();
|
||||
|
||||
async function main(): Promise<never> {
|
||||
const args = process.argv.slice(2);
|
||||
const isHelp = ['-h', '--help'].some((arg) => args.includes(arg));
|
||||
const isWrite = ['-w', '--write'].some((arg) => args.includes(arg));
|
||||
const isDevOnly = ['-d', '--dev-only'].some((arg) => args.includes(arg));
|
||||
const isProdOnly = ['-p', '--prod-only'].some((arg) => args.includes(arg));
|
||||
|
||||
if (isHelp) {
|
||||
console.log(HELP_MESSAGE);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const { packageJsonFiles, dependencyVersionsMap } =
|
||||
await getPackageJsonDependencies(isDevOnly, isProdOnly);
|
||||
const dependencyVersionMap = validateNoMultipleVersions(
|
||||
dependencyVersionsMap,
|
||||
);
|
||||
|
||||
consola.start(
|
||||
`Fetching ${Object.keys(dependencyVersionsMap).length} dependencies...`,
|
||||
);
|
||||
const dependencies = await fetchAllPackageInfos(dependencyVersionMap);
|
||||
consola.success('Done!');
|
||||
|
||||
const isMajor = ['-m', '--major'].some((arg) => args.includes(arg));
|
||||
const upgrades = await detectUpgrades(dependencies, isMajor);
|
||||
|
||||
if (upgrades.length === 0) {
|
||||
console.log();
|
||||
consola.info("No upgrades found, you're up to date!");
|
||||
console.log();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
printUpgrades(upgrades);
|
||||
|
||||
if (!isWrite) {
|
||||
consola.info('Run with `-w` to write changes to package.json files');
|
||||
console.log();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
consola.start('Writing new versions to package.json files...');
|
||||
await writeUpgrades(packageJsonFiles, upgrades);
|
||||
consola.success('Done!');
|
||||
console.log();
|
||||
consola.info('Run `pnpm i` to install new dependencies');
|
||||
console.log();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
type DependencyVersionsMap = Record<string, Set<string>>;
|
||||
type PackageJsonData = {
|
||||
content: any;
|
||||
path: string;
|
||||
folder: string;
|
||||
};
|
||||
|
||||
async function getPackageJsonDependencies(
|
||||
isDevOnly: boolean,
|
||||
isProdOnly: boolean,
|
||||
): Promise<{
|
||||
packageJsonFiles: string[];
|
||||
dependencyVersionsMap: DependencyVersionsMap;
|
||||
}> {
|
||||
const packageJsonFiles = await glob(
|
||||
['package.json', '*/*/package.json', '!**/node_modules'],
|
||||
{ onlyFiles: true },
|
||||
);
|
||||
const packageJsons: PackageJsonData[] = await Promise.all(
|
||||
packageJsonFiles.map(async (path) => ({
|
||||
content: await fs.readJson(path),
|
||||
path,
|
||||
folder: dirname(path),
|
||||
})),
|
||||
);
|
||||
|
||||
const dependencyVersionsMap = packageJsons.reduce<DependencyVersionsMap>(
|
||||
(map, { content }) => {
|
||||
const addToMap = ([name, version]: [string, any]) => {
|
||||
if (
|
||||
name === 'wxt' ||
|
||||
version.startsWith('workspace:') ||
|
||||
IGNORED_PACKAGES.includes(name)
|
||||
)
|
||||
return;
|
||||
|
||||
map[name] ||= new Set();
|
||||
map[name].add(version as string);
|
||||
};
|
||||
if (!isDevOnly)
|
||||
Object.entries(content.dependencies || {}).forEach(addToMap);
|
||||
if (!isProdOnly)
|
||||
Object.entries(content.devDependencies || {}).forEach(addToMap);
|
||||
return map;
|
||||
},
|
||||
{},
|
||||
);
|
||||
|
||||
return {
|
||||
packageJsonFiles,
|
||||
dependencyVersionsMap,
|
||||
};
|
||||
}
|
||||
|
||||
type DependencyVersionMap = Record<string, string>;
|
||||
|
||||
function validateNoMultipleVersions(
|
||||
dependencyVersionsMap: DependencyVersionsMap,
|
||||
): DependencyVersionMap {
|
||||
const depsWithMultipleVersions = Object.entries(dependencyVersionsMap).filter(
|
||||
([_, versions]) => versions.size > 1,
|
||||
);
|
||||
if (depsWithMultipleVersions.length === 0) {
|
||||
return Object.fromEntries(
|
||||
Object.entries(dependencyVersionsMap).map(([name, versions]) => [
|
||||
name,
|
||||
[...versions][0],
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
const maxWidth = Math.max(
|
||||
...depsWithMultipleVersions.map(([name]) => name.length),
|
||||
);
|
||||
console.log(maxWidth);
|
||||
const addCyan = (text: string) => `\x1b[36m${text}\x1b[0m`;
|
||||
|
||||
consola.info('Found multiple versions of:');
|
||||
for (const [name, versions] of depsWithMultipleVersions) {
|
||||
console.log(
|
||||
` \x1b[35m${name.padEnd(maxWidth)}\x1b[0m ${Array.from(versions)
|
||||
.map(addCyan)
|
||||
.join('\t')}`,
|
||||
);
|
||||
}
|
||||
consola.error(`${depsWithMultipleVersions.length} problem(s) found`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
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.stdout);
|
||||
}
|
||||
|
||||
type PackageInfo = {
|
||||
name: string;
|
||||
'dist-tags': {
|
||||
latest: string;
|
||||
[tag: string]: string;
|
||||
};
|
||||
versions: string[];
|
||||
time: {
|
||||
created: string;
|
||||
modified: string;
|
||||
[version: string]: string;
|
||||
};
|
||||
};
|
||||
|
||||
type DependencyInfo = {
|
||||
name: string;
|
||||
currentVersionRange: string;
|
||||
info: PackageInfo;
|
||||
};
|
||||
|
||||
async function fetchAllPackageInfos(
|
||||
deps: DependencyVersionMap,
|
||||
): Promise<DependencyInfo[]> {
|
||||
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));
|
||||
}
|
||||
|
||||
type UpgradeDetails = {
|
||||
name: string;
|
||||
rangePrefix: string;
|
||||
currentVersion: string;
|
||||
currentVersionReleasedAt: Date;
|
||||
currentRange: string;
|
||||
upgradeToVersion: string;
|
||||
upgradeToVersionReleasedAt: Date;
|
||||
upgradeToRange: string;
|
||||
diff: semver.ReleaseType | null;
|
||||
latestVersion: string;
|
||||
latestVersionReleasedAt: Date;
|
||||
};
|
||||
|
||||
async function detectUpgrades(
|
||||
deps: DependencyInfo[],
|
||||
isMajor: boolean,
|
||||
): Promise<UpgradeDetails[]> {
|
||||
const results: UpgradeDetails[] = [];
|
||||
|
||||
for (const dep of deps) {
|
||||
const currentRange = dep.currentVersionRange;
|
||||
if (currentRange === '*') continue;
|
||||
|
||||
const parts = currentRange.split(' || ').map((part) => part.trim());
|
||||
const lastRange = parts[parts.length - 1];
|
||||
const isUnion = parts.length > 1;
|
||||
|
||||
const rangePrefix = lastRange.match(/^(.?)(\d+\.\d+\.\d+)/)?.[1] ?? '';
|
||||
|
||||
const currentVersion = semver.minVersion(lastRange)?.version;
|
||||
if (currentVersion == null)
|
||||
throw Error(`Invalid version specifier: ${dep.name}@${currentRange}`);
|
||||
|
||||
const currentVersionReleasedAt = new Date(dep.info.time[currentVersion]);
|
||||
const isPre1 = currentVersion.startsWith('0.');
|
||||
|
||||
const latestVersion = dep.info['dist-tags'].latest;
|
||||
const latestVersionReleasedAt = new Date(dep.info.time[latestVersion]);
|
||||
|
||||
const upgradeToVersion = isMajor
|
||||
? // Always use the latest version for major upgrades
|
||||
latestVersion
|
||||
: // Otherwise use the last stable version greater than the current version that is not a major release
|
||||
(dep.info.versions.findLast(
|
||||
(v) =>
|
||||
semver.gt(v, currentVersion) &&
|
||||
(isPre1 ? ['patch'] : ['patch', 'minor']).includes(
|
||||
semver.diff(v, currentVersion)!,
|
||||
) &&
|
||||
semver.prerelease(v) == null,
|
||||
) ?? currentVersion);
|
||||
const upgradeToVersionReleasedAt = new Date(
|
||||
dep.info.time[upgradeToVersion],
|
||||
);
|
||||
|
||||
let upgradeToRange = `${rangePrefix}${upgradeToVersion}`;
|
||||
upgradeToRange = isUnion
|
||||
? semver.satisfies(upgradeToVersion, currentRange)
|
||||
? currentRange
|
||||
: `${currentRange} || ${upgradeToRange}`
|
||||
: upgradeToRange;
|
||||
|
||||
let diff = semver.diff(currentVersion, upgradeToVersion);
|
||||
if (isPre1) {
|
||||
if (diff === 'minor') diff = 'major';
|
||||
if (diff === 'patch') diff = 'minor';
|
||||
}
|
||||
|
||||
if (upgradeToRange === currentRange) continue;
|
||||
// if (currentVersion === latestVersion) continue;
|
||||
|
||||
results.push({
|
||||
name: dep.name,
|
||||
rangePrefix,
|
||||
diff,
|
||||
currentVersion,
|
||||
currentVersionReleasedAt,
|
||||
currentRange,
|
||||
upgradeToVersion,
|
||||
upgradeToVersionReleasedAt,
|
||||
upgradeToRange,
|
||||
latestVersion,
|
||||
latestVersionReleasedAt,
|
||||
});
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function printUpgrades(upgrades: UpgradeDetails[]): void {
|
||||
const namePadding = Math.max(...upgrades.map((u) => u.name.length));
|
||||
const currentVersionPadding = Math.max(
|
||||
...upgrades.map((u) => u.currentRange.length),
|
||||
);
|
||||
const upgradeToVersionPadding = Math.max(
|
||||
...upgrades.map((u) => u.upgradeToRange.length),
|
||||
);
|
||||
const numberPadding = String(upgrades.length + 1).length + 1;
|
||||
|
||||
consola.info(`Found ${upgrades.length} upgrades:`);
|
||||
console.log();
|
||||
for (let i = 0; i < upgrades.length; i++) {
|
||||
const upgrade = upgrades[i];
|
||||
const num = `\x1b[2m${(i + 1).toString().padStart(numberPadding)}.\x1b[0m`;
|
||||
const name = `\x1b[35m${upgrade.name.padEnd(namePadding)}\x1b[0m`;
|
||||
const color =
|
||||
upgrade.diff == null
|
||||
? '\x1b[2m'
|
||||
: upgrade.diff === 'patch'
|
||||
? '\x1b[32m'
|
||||
: upgrade.diff === 'minor'
|
||||
? '\x1b[33m'
|
||||
: '\x1b[31m';
|
||||
const currentVersion = `\x1b[2m${upgrade.currentRange.padEnd(currentVersionPadding)}\x1b[0m`;
|
||||
const upgradeToVersion = `${color}${upgrade.upgradeToRange.padEnd(upgradeToVersionPadding)}\x1b[0m`;
|
||||
const latest =
|
||||
upgrade.latestVersion !== upgrade.upgradeToVersion
|
||||
? ` \x1b[2m\x1b[31m(${upgrade.latestVersion} available)\x1b[0m`
|
||||
: '';
|
||||
console.log(
|
||||
` ${num} ${name} ${currentVersion} \x1b[2m→\x1b[0m ${upgradeToVersion}${latest}`,
|
||||
);
|
||||
}
|
||||
console.log();
|
||||
}
|
||||
|
||||
async function writeUpgrades(
|
||||
packageJsonFiles: string[],
|
||||
upgrades: UpgradeDetails[],
|
||||
) {
|
||||
for (const packageJsonFile of packageJsonFiles) {
|
||||
const oldText = await fs.readFile(packageJsonFile, 'utf8');
|
||||
let newText = oldText;
|
||||
for (const upgrade of upgrades) {
|
||||
const search = `"${upgrade.name}": "${upgrade.currentRange}"`;
|
||||
const replace = `"${upgrade.name}": "${upgrade.upgradeToRange}"`;
|
||||
newText = newText.replaceAll(search, replace);
|
||||
}
|
||||
if (newText !== oldText) {
|
||||
await fs.writeFile(packageJsonFile, newText, 'utf8');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// https://github.com/antfu-collective/taze?tab=readme-ov-file#config-file
|
||||
export default {
|
||||
exclude: [
|
||||
// Very touchy, don't change:
|
||||
'typedoc',
|
||||
'typedoc-plugin-markdown',
|
||||
'typedoc-vitepress-theme',
|
||||
// Manually manage version so a single version is used:
|
||||
'esbuild',
|
||||
// Maintained manually to match min-node version
|
||||
'@types/node',
|
||||
// License changed in newer versions
|
||||
'ua-parser-js',
|
||||
],
|
||||
};
|
||||
Vendored
+6
-6
@@ -15,14 +15,14 @@
|
||||
"postinstall": "wxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0"
|
||||
"react": "^19.2.3",
|
||||
"react-dom": "^19.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.1.2",
|
||||
"@types/react-dom": "^19.1.3",
|
||||
"@wxt-dev/module-react": "^1.1.3",
|
||||
"typescript": "^5.8.3",
|
||||
"@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.6"
|
||||
"solid-js": "^1.9.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wxt-dev/module-solid": "^1.1.3",
|
||||
"typescript": "^5.8.3",
|
||||
"@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.4",
|
||||
"@wxt-dev/module-svelte": "^2.0.3",
|
||||
"svelte": "^5.28.2",
|
||||
"svelte-check": "^4.1.6",
|
||||
"@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.8.3",
|
||||
"typescript": "^5.9.3",
|
||||
"wxt": "^0.20.6"
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
import './style.css';
|
||||
import typescriptLogo from '@/assets/typescript.svg';
|
||||
import viteLogo from '/wxt.svg';
|
||||
import wxtLogo from '/wxt.svg';
|
||||
import { setupCounter } from '@/components/counter';
|
||||
|
||||
document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
|
||||
<div>
|
||||
<a href="https://wxt.dev" target="_blank">
|
||||
<img src="${viteLogo}" class="logo" alt="WXT logo" />
|
||||
<img src="${wxtLogo}" class="logo" alt="WXT logo" />
|
||||
</a>
|
||||
<a href="https://www.typescriptlang.org/" target="_blank">
|
||||
<img src="${typescriptLogo}" class="logo vanilla" alt="TypeScript logo" />
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@
|
||||
"postinstall": "wxt prepare"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.8.3",
|
||||
"typescript": "^5.9.3",
|
||||
"wxt": "^0.20.6"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -15,12 +15,12 @@
|
||||
"postinstall": "wxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.5.13"
|
||||
"vue": "^3.5.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wxt-dev/module-vue": "^1.0.2",
|
||||
"typescript": "5.6.3",
|
||||
"vue-tsc": "^2.2.10",
|
||||
"@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