Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7fd5752ef1 | |||
| 1a8b7ff635 |
@@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## v0.12.2
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/v0.12.1...v0.12.2)
|
||||
|
||||
### 🚀 Enhancements
|
||||
|
||||
- Support PNPM without hoisting dependencies ([#291](https://github.com/wxt-dev/wxt/pull/291))
|
||||
|
||||
## v0.12.1
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/v0.12.0...v0.12.1)
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "wxt",
|
||||
"type": "module",
|
||||
"version": "0.12.2-alpha2",
|
||||
"version": "0.12.2",
|
||||
"description": "Next gen framework for developing web extensions",
|
||||
"engines": {
|
||||
"node": ">=18",
|
||||
@@ -88,7 +88,7 @@
|
||||
"lint:package": "publint",
|
||||
"compile": "run-s -c compile:*",
|
||||
"compile:wxt": "tsc --noEmit",
|
||||
"compile:virtual": "tsc --noEmit",
|
||||
"compile:virtual": "tsc --noEmit -p src/virtual",
|
||||
"test": "vitest",
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"prepare": "simple-git-hooks",
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": ["vite/client", "../types/globals.d.ts"],
|
||||
"paths": {
|
||||
"wxt/*": ["../*"]
|
||||
}
|
||||
}
|
||||
"types": ["vite/client", "../types/globals.d.ts"]
|
||||
},
|
||||
"include": ["./*"]
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import { browser, Manifest } from 'wxt/browser';
|
||||
import { browser } from 'wxt/browser';
|
||||
import { logger } from '../../sandbox/utils/logger';
|
||||
import { MatchPattern } from 'wxt/sandbox';
|
||||
|
||||
export function reloadContentScript(contentScript: Manifest.ContentScript) {
|
||||
interface ContentScript {
|
||||
matches: string[];
|
||||
js?: string[];
|
||||
css?: string[];
|
||||
}
|
||||
|
||||
export function reloadContentScript(contentScript: ContentScript) {
|
||||
const manifest = browser.runtime.getManifest();
|
||||
if (manifest.manifest_version == 2) {
|
||||
void reloadContentScriptMv2(contentScript);
|
||||
@@ -11,9 +17,7 @@ export function reloadContentScript(contentScript: Manifest.ContentScript) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function reloadContentScriptMv3(
|
||||
contentScript: Manifest.ContentScript,
|
||||
) {
|
||||
export async function reloadContentScriptMv3(contentScript: ContentScript) {
|
||||
const id = `wxt:${contentScript.js![0]}`;
|
||||
logger.log('Reloading content script:', contentScript);
|
||||
const registered = await browser.scripting.getRegisteredContentScripts();
|
||||
@@ -41,8 +45,6 @@ export async function reloadContentScriptMv3(
|
||||
await Promise.all(matchingTabs.map((tab) => browser.tabs.reload(tab.id)));
|
||||
}
|
||||
|
||||
export async function reloadContentScriptMv2(
|
||||
contentScript: Manifest.ContentScript,
|
||||
) {
|
||||
export async function reloadContentScriptMv2(contentScript: ContentScript) {
|
||||
throw Error('TODO: reloadContentScriptMv2');
|
||||
}
|
||||
|
||||
+22
-4
@@ -1,21 +1,39 @@
|
||||
// Types required to make the virtual modules happy.
|
||||
|
||||
declare module 'virtual:user-background' {
|
||||
const definition: import('wxt/types').BackgroundDefinition;
|
||||
const definition: { main: () => void };
|
||||
export default definition;
|
||||
}
|
||||
|
||||
declare module 'virtual:user-content-script-isolated-world' {
|
||||
const definition: import('wxt/types').ContentScriptIsolatedWorldDefinition;
|
||||
const definition: {
|
||||
main: (
|
||||
ctx: import('wxt/client').ContentScriptContext,
|
||||
) => void | Promise<void>;
|
||||
};
|
||||
export default definition;
|
||||
}
|
||||
|
||||
declare module 'virtual:user-content-script-main-world' {
|
||||
const definition: import('wxt/types').ContentScriptMainWorldDefinition;
|
||||
const definition: { main: () => void | Promise<void> };
|
||||
export default definition;
|
||||
}
|
||||
|
||||
declare module 'virtual:user-unlisted-script' {
|
||||
const definition: import('wxt/types').UnlistedScriptDefinition;
|
||||
const definition: { main: () => void | Promise<void> };
|
||||
export default definition;
|
||||
}
|
||||
|
||||
declare module 'wxt/browser' {
|
||||
export const browser: import('webextension-polyfill').Browser;
|
||||
}
|
||||
|
||||
declare module 'wxt/client' {
|
||||
export class ContentScriptContext {
|
||||
constructor(name: string, options: any);
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'wxt/testing' {
|
||||
export const fakeBrowser: import('webextension-polyfill').Browser;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ const resolve = {
|
||||
alias: {
|
||||
'~': path.resolve('src'),
|
||||
'webextension-polyfill': path.resolve('src/virtual/mock-browser'),
|
||||
'wxt/testing': path.resolve('src/testing'),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user