Compare commits

..

16 Commits

Author SHA1 Message Date
Aaron Klinker 4ac87bef44 Bump to alpha2 2023-12-17 11:31:17 -06:00
Aaron Klinker 4caaa1bc4d Update test snapshots 2023-12-17 11:31:11 -06:00
Aaron Klinker e46920b6a0 Fix sandbox exports 2023-12-17 11:28:33 -06:00
Aaron Klinker 6d4dae59c6 Update readme 2023-12-17 11:25:06 -06:00
Aaron Klinker 1f3616b056 Better organize and type the virtual modules to ensure PNP works 2023-12-17 11:18:35 -06:00
Aaron Klinker 78a146b1ca Remove NPMRC from init 2023-12-17 10:06:12 -06:00
Aaron Klinker 8447f9aa7c Release version for testing 2023-12-17 09:53:27 -06:00
Aaron Klinker ee768f84bb Remove wxt/client inline for vitest 2023-12-17 09:49:38 -06:00
Aaron Klinker cfd4979a7a Fix docs 2023-12-17 09:41:43 -06:00
Aaron Klinker de5b4e16cd cleanup 2023-12-17 09:32:55 -06:00
Aaron Klinker 5c696da6e2 Fix build 2023-12-17 09:30:28 -06:00
Aaron Klinker 2363144bb6 Cleanup 2023-12-17 09:15:05 -06:00
Aaron Klinker 9e2d11d8db List imports by hand 2023-12-16 12:37:13 -06:00
Aaron Klinker f2523c778f Only export types for polyfill 2023-12-16 12:29:15 -06:00
Aaron Klinker 04a51581fc Fix tests, don't auto-import WebextensionPolyfill namespace 2023-12-16 12:28:25 -06:00
Aaron Klinker bb40db78e3 Import all dependencies from WXT 2023-12-16 12:20:15 -06:00
6 changed files with 19 additions and 46 deletions
-8
View File
@@ -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
View File
@@ -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",
+5 -3
View File
@@ -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/*": ["../*"]
}
}
}
+8 -10
View File
@@ -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
View File
@@ -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;
}
-1
View File
@@ -20,7 +20,6 @@ const resolve = {
alias: {
'~': path.resolve('src'),
'webextension-polyfill': path.resolve('src/virtual/mock-browser'),
'wxt/testing': path.resolve('src/testing'),
},
};