Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ac87bef44 | |||
| 4caaa1bc4d | |||
| e46920b6a0 | |||
| 6d4dae59c6 | |||
| 1f3616b056 | |||
| 78a146b1ca | |||
| 8447f9aa7c | |||
| ee768f84bb | |||
| cfd4979a7a | |||
| de5b4e16cd | |||
| 5c696da6e2 | |||
| 2363144bb6 | |||
| 9e2d11d8db | |||
| f2523c778f | |||
| 04a51581fc | |||
| bb40db78e3 |
@@ -1,13 +1,5 @@
|
||||
# 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",
|
||||
"version": "0.12.2-alpha2",
|
||||
"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 -p src/virtual",
|
||||
"compile:virtual": "tsc --noEmit",
|
||||
"test": "vitest",
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"prepare": "simple-git-hooks",
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": ["vite/client", "../types/globals.d.ts"]
|
||||
},
|
||||
"include": ["./*"]
|
||||
"types": ["vite/client", "../types/globals.d.ts"],
|
||||
"paths": {
|
||||
"wxt/*": ["../*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
import { browser } from 'wxt/browser';
|
||||
import { browser, Manifest } from 'wxt/browser';
|
||||
import { logger } from '../../sandbox/utils/logger';
|
||||
import { MatchPattern } from 'wxt/sandbox';
|
||||
|
||||
interface ContentScript {
|
||||
matches: string[];
|
||||
js?: string[];
|
||||
css?: string[];
|
||||
}
|
||||
|
||||
export function reloadContentScript(contentScript: ContentScript) {
|
||||
export function reloadContentScript(contentScript: Manifest.ContentScript) {
|
||||
const manifest = browser.runtime.getManifest();
|
||||
if (manifest.manifest_version == 2) {
|
||||
void reloadContentScriptMv2(contentScript);
|
||||
@@ -17,7 +11,9 @@ export function reloadContentScript(contentScript: ContentScript) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function reloadContentScriptMv3(contentScript: ContentScript) {
|
||||
export async function reloadContentScriptMv3(
|
||||
contentScript: Manifest.ContentScript,
|
||||
) {
|
||||
const id = `wxt:${contentScript.js![0]}`;
|
||||
logger.log('Reloading content script:', contentScript);
|
||||
const registered = await browser.scripting.getRegisteredContentScripts();
|
||||
@@ -45,6 +41,8 @@ export async function reloadContentScriptMv3(contentScript: ContentScript) {
|
||||
await Promise.all(matchingTabs.map((tab) => browser.tabs.reload(tab.id)));
|
||||
}
|
||||
|
||||
export async function reloadContentScriptMv2(contentScript: ContentScript) {
|
||||
export async function reloadContentScriptMv2(
|
||||
contentScript: Manifest.ContentScript,
|
||||
) {
|
||||
throw Error('TODO: reloadContentScriptMv2');
|
||||
}
|
||||
|
||||
+4
-22
@@ -1,39 +1,21 @@
|
||||
// Types required to make the virtual modules happy.
|
||||
|
||||
declare module 'virtual:user-background' {
|
||||
const definition: { main: () => void };
|
||||
const definition: import('wxt/types').BackgroundDefinition;
|
||||
export default definition;
|
||||
}
|
||||
|
||||
declare module 'virtual:user-content-script-isolated-world' {
|
||||
const definition: {
|
||||
main: (
|
||||
ctx: import('wxt/client').ContentScriptContext,
|
||||
) => void | Promise<void>;
|
||||
};
|
||||
const definition: import('wxt/types').ContentScriptIsolatedWorldDefinition;
|
||||
export default definition;
|
||||
}
|
||||
|
||||
declare module 'virtual:user-content-script-main-world' {
|
||||
const definition: { main: () => void | Promise<void> };
|
||||
const definition: import('wxt/types').ContentScriptMainWorldDefinition;
|
||||
export default definition;
|
||||
}
|
||||
|
||||
declare module 'virtual:user-unlisted-script' {
|
||||
const definition: { main: () => void | Promise<void> };
|
||||
const definition: import('wxt/types').UnlistedScriptDefinition;
|
||||
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,7 +20,6 @@ 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