Compare commits

...

7 Commits

Author SHA1 Message Date
GitHub Actions 203a9cc234 chore(release): v0.18.2 2024-05-08 15:50:03 +00:00
Aaron 5fcaf7c68b fix: Automatically detect and add "sidePanel" permission 2024-05-08 10:42:07 -05:00
Aaron c74e530d4a docs: Fix iframe typos 2024-05-08 10:34:34 -05:00
Edoan 3f78be0c95 feat(runner): Add keepProfileChanges option (#655) 2024-05-07 22:20:51 -05:00
Linus Norton 2a3d52045d docs: Correct event handler name in handling-updates.md (#653) 2024-05-07 04:31:28 -05:00
Jeffrey Zang ea5b81d25e docs: Fix spelling mistake in remote-code.md (#652) 2024-05-06 21:58:36 -05:00
Emmanuel Ferdman cec9d7103a docs: Fix wxt-vitest-plugin reference (#650)
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2024-05-05 08:30:40 -05:00
10 changed files with 43 additions and 9 deletions
+3 -3
View File
@@ -388,14 +388,14 @@ WXT provides a helper function, [`createIframeUi`](/api/wxt/client/functions/cre
export default defineContentScript({
matches: ['<all_urls>'],
async main(ctx) {
main(ctx) {
// Define the UI
const ui = await createIframeUi(ctx, {
const ui = createIframeUi(ctx, {
page: '/example-iframe.html',
position: 'inline',
onMount: (wrapper, iframe) => {
// Add styles to the iframe like width
iframe.width = 123;
iframe.width = '123';
},
});
+1 -1
View File
@@ -84,7 +84,7 @@ To validate this, you can create a third ZIP file with a rare permission like `g
You can setup a callback that runs after your extension updates like so:
```ts
browser.runtime.onInstalled.addEventListener(({ reason }) => {
browser.runtime.onInstalled.addListener(({ reason }) => {
if (reason === 'update') {
// Do something
}
+2 -2
View File
@@ -1,10 +1,10 @@
# Remote Code
WXT will automatically download and bundle imports with the `url:` prefix so the extension does not depend of remote code, [a requirement from Google for MV3](https://developer.chrome.com/docs/extensions/migrating/improve-security/#remove-remote-code).
WXT will automatically download and bundle imports with the `url:` prefix so the extension does not depend on remote code, [a requirement from Google for MV3](https://developer.chrome.com/docs/extensions/migrating/improve-security/#remove-remote-code).
## Google Analytics
For example, you can import google analytics:
For example, you can import Google Analytics:
```ts
// utils/google-analytics.ts
+1 -1
View File
@@ -22,4 +22,4 @@ If you want to try to use a different framework for unit tests, you will need to
- **Global Variables**: If you consume them, manually define globals provided by WXT (like `import.meta.env.BROWSER`) by adding them to the global scope before accessing them (`import.meta.env.BROWSER = "chrome"`)
- **Import paths**: If you use the `@/` or `~/` path aliases, add them to your test environment
[Here's how Vitest is configured](https://github.com/wxt-dev/wxt/blob/main/src/testing/wxt-vitest-plugin.ts) for reference.
[Here's how Vitest is configured](https://github.com/wxt-dev/wxt/blob/main/packages/wxt/src/testing/wxt-vitest-plugin.ts) for reference.
+26
View File
@@ -1,5 +1,31 @@
# Changelog
## v0.18.2
[compare changes](https://github.com/wxt-dev/wxt/compare/v0.18.1...v0.18.2)
### 🚀 Enhancements
- **runner:** Add `keepProfileChanges` option ([#655](https://github.com/wxt-dev/wxt/pull/655))
### 🩹 Fixes
- Automatically detect and add "sidePanel" permission ([5fcaf7c](https://github.com/wxt-dev/wxt/commit/5fcaf7c))
### 📖 Documentation
- Fix `wxt-vitest-plugin` reference ([#650](https://github.com/wxt-dev/wxt/pull/650))
- Fix spelling mistake in remote-code.md ([#652](https://github.com/wxt-dev/wxt/pull/652))
- Correct event handler name in handling-updates.md ([#653](https://github.com/wxt-dev/wxt/pull/653))
- Fix iframe typos ([c74e530](https://github.com/wxt-dev/wxt/commit/c74e530))
### ❤️ Contributors
- Edoan ([@EdoanR](http://github.com/EdoanR))
- Linus Norton ([@linusnorton](http://github.com/linusnorton))
- Jeffrey Zang ([@jeffrey-zang](http://github.com/jeffrey-zang))
- Emmanuel Ferdman <emmanuelferdman@gmail.com>
## v0.18.1
[compare changes](https://github.com/wxt-dev/wxt/compare/v0.18.0...v0.18.1)
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "wxt",
"type": "module",
"version": "0.18.1",
"version": "0.18.2",
"description": "Next gen framework for developing web extensions",
"repository": {
"type": "git",
+1
View File
@@ -35,6 +35,7 @@ export function createWebExtRunner(): ExtensionRunner {
console: wxtUserConfig?.openConsole,
devtools: wxtUserConfig?.openDevtools,
startUrl: wxtUserConfig?.startUrls,
keepProfileChanges: wxtUserConfig?.keepProfileChanges,
...(wxt.config.browser === 'firefox'
? {
firefox: wxtUserConfig?.binaries?.firefox,
@@ -897,7 +897,7 @@ describe('Manifest Utils', () => {
describe('sidepanel', () => {
it.each(['chrome', 'safari', 'edge'])(
'should include a side_panel ignoring all options for %s',
'should include the side_panel and permission, ignoring all options for %s',
async (browser) => {
const sidepanel = fakeSidepanelEntrypoint({
outputDir: outDir,
@@ -909,12 +909,14 @@ describe('Manifest Utils', () => {
manifestVersion: 3,
browser,
outDir,
command: 'build',
},
});
const expected = {
side_panel: {
default_path: 'sidepanel.html',
},
permissions: ['sidePanel'],
};
const { manifest: actual } = await generateManifest(
+1
View File
@@ -347,6 +347,7 @@ function addEntrypoints(
manifest.side_panel = {
default_path: page,
};
addPermission(manifest, 'sidePanel');
} else {
wxt.logger.warn(
'Side panel not supported by Chromium using MV2. side_panel.default_path was not added to the manifest',
+4
View File
@@ -927,6 +927,10 @@ export interface ExtensionRunnerConfig {
* @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#start-url
*/
startUrls?: string[];
/**
* @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#keep-profile-changes
*/
keepProfileChanges?: boolean;
}
export interface WxtBuilder {