Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 203a9cc234 | |||
| 5fcaf7c68b | |||
| c74e530d4a | |||
| 3f78be0c95 | |||
| 2a3d52045d | |||
| ea5b81d25e | |||
| cec9d7103a |
@@ -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';
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,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",
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user