wxt 0.19.10-alpha1 → 0.19.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -0
- package/dist/client/content-scripts/ui/index.d.ts +3 -3
- package/dist/core/create-server.mjs +6 -1
- package/dist/core/utils/building/resolve-config.mjs +5 -1
- package/dist/core/utils/env.d.ts +4 -0
- package/dist/core/utils/env.mjs +6 -0
- package/dist/core/utils/manifest.mjs +1 -1
- package/dist/core/utils/number.d.ts +1 -0
- package/dist/core/utils/number.mjs +4 -0
- package/dist/core/utils/testing/fake-objects.d.ts +2267 -23
- package/dist/modules.d.ts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.mjs +1 -1
- package/dist/types.d.ts +26 -3
- package/dist/version.mjs +1 -1
- package/package.json +4 -2
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!-- DO NOT EDIT, THIS FILE WAS GENERATED BY '../../scripts/generate-readmes.sh' -->
|
|
2
|
+
<h1 align="center">
|
|
3
|
+
<img align="top" width="44" src="https://raw.githubusercontent.com/wxt-dev/wxt/HEAD/docs/public/hero-logo.svg" alt="WXT Logo">
|
|
4
|
+
<span>WXT</span>
|
|
5
|
+
</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/wxt" target="_blank"><img alt="npm version" src="https://img.shields.io/npm/v/wxt?labelColor=black&color=%234fa048"></a>
|
|
9
|
+
<span> </span>
|
|
10
|
+
<a href="https://www.npmjs.com/package/wxt" target="_blank"><img alt="downloads" src="https://img.shields.io/npm/dm/wxt?labelColor=black&color=%234fa048"></a>
|
|
11
|
+
<span> </span>
|
|
12
|
+
<a href="https://github.com/wxt-dev/wxt/blob/main/LICENSE" target="_blank"><img alt="license | MIT" src="https://img.shields.io/npm/l/wxt?labelColor=black&color=%234fa048"></a>
|
|
13
|
+
<span> </span>
|
|
14
|
+
<a href="https://codecov.io/github/wxt-dev/wxt" target="_blank"><img alt="coverage" src="https://img.shields.io/codecov/c/github/wxt-dev/wxt?labelColor=black&color=%234fa048"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<span>Next-gen framework for developing web extensions.</span>
|
|
19
|
+
<br/>
|
|
20
|
+
<span>⚡</span>
|
|
21
|
+
<br/>
|
|
22
|
+
<q><i>It's like Nuxt, but for Web Extensions</i></q>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="https://wxt.dev/guide/installation.html" target="_blank">Get Started</a>
|
|
27
|
+
•
|
|
28
|
+
<a href="https://wxt.dev/api/config.html" target="_blank">Configuration</a>
|
|
29
|
+
•
|
|
30
|
+
<a href="https://wxt.dev/examples.html" target="_blank">Examples</a>
|
|
31
|
+
•
|
|
32
|
+
<a href="https://github.com/wxt-dev/wxt/blob/main/packages/wxt/CHANGELOG.md" target="_blank">Changelog</a>
|
|
33
|
+
•
|
|
34
|
+
<a href="https://discord.gg/ZFsZqGery9" target="_blank">Discord</a>
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+
## Demo
|
|
40
|
+
|
|
41
|
+
https://github.com/wxt-dev/wxt/assets/10101283/4d678939-1bdb-495c-9c36-3aa281d84c94
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
Bootstrap a new project:
|
|
46
|
+
|
|
47
|
+
<!-- automd:pm-x version="latest" name="wxt" args="init" -->
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
# npm
|
|
51
|
+
npx wxt@latest init
|
|
52
|
+
|
|
53
|
+
# pnpm
|
|
54
|
+
pnpm dlx wxt@latest init
|
|
55
|
+
|
|
56
|
+
# bun
|
|
57
|
+
bunx wxt@latest init
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
<!-- /automd -->
|
|
61
|
+
|
|
62
|
+
Or see the [installation guide](https://wxt.dev/guide/installation.html) to get started with WXT.
|
|
63
|
+
|
|
64
|
+
## Features
|
|
65
|
+
|
|
66
|
+
- 🌐 Supports all browsers
|
|
67
|
+
- ✅ Supports both MV2 and MV3
|
|
68
|
+
- ⚡ Dev mode with HMR & fast reload
|
|
69
|
+
- 📂 File based entrypoints
|
|
70
|
+
- 🚔 TypeScript
|
|
71
|
+
- 🦾 Auto-imports
|
|
72
|
+
- 🤖 Automated publishing
|
|
73
|
+
- 🎨 Frontend framework agnostic: works with Vue, React, Svelte, etc
|
|
74
|
+
- 📦 Modular architecture with [WXT modules](https://wxt.dev/guide/go-further/reusable-modules.html#overview)
|
|
75
|
+
- 🖍️ Quickly bootstrap a new project
|
|
76
|
+
- 📏 Bundle analysis
|
|
77
|
+
- ⬇️ Download and bundle remote URL imports
|
|
78
|
+
|
|
79
|
+
## Contributors
|
|
80
|
+
|
|
81
|
+
<!-- automd:contributors author="aklinker1" license="MIT" github="wxt-dev/wxt" -->
|
|
82
|
+
|
|
83
|
+
Published under the [MIT](https://github.com/wxt-dev/wxt/blob/main/LICENSE) license.
|
|
84
|
+
Made by [@aklinker1](https://github.com/aklinker1) and [community](https://github.com/wxt-dev/wxt/graphs/contributors) 💛
|
|
85
|
+
<br><br>
|
|
86
|
+
<a href="https://github.com/wxt-dev/wxt/graphs/contributors">
|
|
87
|
+
<img src="https://contrib.rocks/image?repo=wxt-dev/wxt" />
|
|
88
|
+
</a>
|
|
89
|
+
|
|
90
|
+
<!-- /automd -->
|
|
@@ -4,13 +4,13 @@ export * from './types';
|
|
|
4
4
|
/**
|
|
5
5
|
* Create a content script UI without any isolation.
|
|
6
6
|
*
|
|
7
|
-
* @see https://wxt.dev/guide/key-concepts/content-script-ui#integrated
|
|
7
|
+
* @see https://wxt.dev/guide/key-concepts/content-script-ui.html#integrated
|
|
8
8
|
*/
|
|
9
9
|
export declare function createIntegratedUi<TMounted>(ctx: ContentScriptContext, options: IntegratedContentScriptUiOptions<TMounted>): IntegratedContentScriptUi<TMounted>;
|
|
10
10
|
/**
|
|
11
11
|
* Create a content script UI using an iframe.
|
|
12
12
|
*
|
|
13
|
-
* @see https://wxt.dev/guide/key-concepts/content-script-ui#iframe
|
|
13
|
+
* @see https://wxt.dev/guide/key-concepts/content-script-ui.html#iframe
|
|
14
14
|
*/
|
|
15
15
|
export declare function createIframeUi<TMounted>(ctx: ContentScriptContext, options: IframeContentScriptUiOptions<TMounted>): IframeContentScriptUi<TMounted>;
|
|
16
16
|
/**
|
|
@@ -18,6 +18,6 @@ export declare function createIframeUi<TMounted>(ctx: ContentScriptContext, opti
|
|
|
18
18
|
*
|
|
19
19
|
* > This function is async because it has to load the CSS via a network call.
|
|
20
20
|
*
|
|
21
|
-
* @see https://wxt.dev/guide/key-concepts/content-script-ui#shadowroot
|
|
21
|
+
* @see https://wxt.dev/guide/key-concepts/content-script-ui.html#shadowroot
|
|
22
22
|
*/
|
|
23
23
|
export declare function createShadowRootUi<TMounted>(ctx: ContentScriptContext, options: ShadowRootContentScriptUiOptions<TMounted>): Promise<ShadowRootContentScriptUi<TMounted>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { debounce } from "perfect-debounce";
|
|
1
2
|
import { getEntrypointBundlePath, isHtmlEntrypoint } from "./utils/entrypoints.mjs";
|
|
2
3
|
import {
|
|
3
4
|
getContentScriptCssFiles,
|
|
@@ -98,7 +99,7 @@ export async function createServer(inlineConfig) {
|
|
|
98
99
|
function createFileReloader(server) {
|
|
99
100
|
const fileChangedMutex = new Mutex();
|
|
100
101
|
const changeQueue = [];
|
|
101
|
-
|
|
102
|
+
const cb = async (event, path) => {
|
|
102
103
|
changeQueue.push([event, path]);
|
|
103
104
|
await fileChangedMutex.runExclusive(async () => {
|
|
104
105
|
if (server.currentOutput == null) return;
|
|
@@ -151,6 +152,10 @@ function createFileReloader(server) {
|
|
|
151
152
|
}
|
|
152
153
|
});
|
|
153
154
|
};
|
|
155
|
+
return debounce(cb, wxt.config.dev.server.watchDebounce, {
|
|
156
|
+
leading: true,
|
|
157
|
+
trailing: false
|
|
158
|
+
});
|
|
154
159
|
}
|
|
155
160
|
function reloadContentScripts(steps, server) {
|
|
156
161
|
if (wxt.config.manifestVersion === 3) {
|
|
@@ -8,6 +8,8 @@ import { normalizePath } from "../paths.mjs";
|
|
|
8
8
|
import glob from "fast-glob";
|
|
9
9
|
import { builtinModules } from "../../../builtin-modules/index.mjs";
|
|
10
10
|
import { getEslintVersion } from "../eslint.mjs";
|
|
11
|
+
import { safeStringToNumber } from "../number.mjs";
|
|
12
|
+
import { loadEnv } from "../env.mjs";
|
|
11
13
|
export async function resolveConfig(inlineConfig, command) {
|
|
12
14
|
let userConfig = {};
|
|
13
15
|
let userConfigMetadata;
|
|
@@ -32,6 +34,7 @@ export async function resolveConfig(inlineConfig, command) {
|
|
|
32
34
|
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
33
35
|
const mode = mergedConfig.mode ?? COMMAND_MODES[command];
|
|
34
36
|
const env = { browser, command, manifestVersion, mode };
|
|
37
|
+
loadEnv(mode);
|
|
35
38
|
const root = path.resolve(
|
|
36
39
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
37
40
|
);
|
|
@@ -78,7 +81,8 @@ export async function resolveConfig(inlineConfig, command) {
|
|
|
78
81
|
}
|
|
79
82
|
devServerConfig = {
|
|
80
83
|
port,
|
|
81
|
-
hostname: mergedConfig.dev?.server?.hostname ?? "localhost"
|
|
84
|
+
hostname: mergedConfig.dev?.server?.hostname ?? "localhost",
|
|
85
|
+
watchDebounce: safeStringToNumber(process.env.WXT_WATCH_DEBOUNCE) ?? 800
|
|
82
86
|
};
|
|
83
87
|
}
|
|
84
88
|
const userModules = await resolveWxtUserModules(
|
|
@@ -27,7 +27,7 @@ export async function generateManifest(entrypoints, buildOutput) {
|
|
|
27
27
|
if (versionName == null) {
|
|
28
28
|
versionName = "0.0.0";
|
|
29
29
|
wxt.logger.warn(
|
|
30
|
-
'Extension version not found, defaulting to "0.0.0". Add a version to your `package.json` or `wxt.config.ts` file. For more details, see: https://wxt.dev/guide/key-concepts/manifest#version-and-version-name'
|
|
30
|
+
'Extension version not found, defaulting to "0.0.0". Add a version to your `package.json` or `wxt.config.ts` file. For more details, see: https://wxt.dev/guide/key-concepts/manifest.html#version-and-version-name'
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
const version = wxt.config.manifest.version ?? simplifyVersion(versionName);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function safeStringToNumber(str: string | undefined): number | null;
|