wxt 0.19.8 → 0.19.10-alpha1
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/dist/client/content-scripts/ui/index.d.ts +3 -3
- package/dist/core/create-server.mjs +1 -1
- package/dist/core/utils/building/generate-wxt-dir.mjs +0 -1
- package/dist/core/utils/building/rebuild.mjs +4 -10
- package/dist/core/utils/building/resolve-config.mjs +1 -1
- package/dist/core/utils/entrypoints.mjs +1 -1
- package/dist/core/utils/environments/environment.mjs +1 -1
- package/dist/core/utils/eslint.mjs +1 -1
- package/dist/core/utils/manifest.mjs +5 -5
- package/dist/core/utils/package.mjs +2 -1
- package/dist/core/utils/strings.d.ts +4 -0
- package/dist/core/utils/strings.mjs +7 -1
- package/dist/core/utils/testing/fake-objects.d.ts +779 -19
- package/dist/core/utils/testing/fake-objects.mjs +1 -0
- package/dist/core/utils/transform.mjs +1 -3
- package/dist/core/wxt.mjs +1 -0
- package/dist/core/zip.mjs +2 -4
- package/dist/modules.d.ts +9 -5
- package/dist/storage.d.ts +1 -1
- package/dist/storage.mjs +1 -1
- package/dist/types.d.ts +36 -3
- package/dist/version.mjs +1 -1
- package/package.json +8 -9
- package/README.md +0 -71
|
@@ -118,9 +118,7 @@ function getSimpleAstJson(ast) {
|
|
|
118
118
|
return ast.map(getSimpleAstJson);
|
|
119
119
|
} else if (typeof ast === "object") {
|
|
120
120
|
return Object.fromEntries(
|
|
121
|
-
Object.entries(ast).filter(
|
|
122
|
-
([key, value]) => key !== "loc" && key !== "start" && key !== "end"
|
|
123
|
-
).map(([key, value]) => [key, getSimpleAstJson(value)])
|
|
121
|
+
Object.entries(ast).filter(([key]) => key !== "loc" && key !== "start" && key !== "end").map(([key, value]) => [key, getSimpleAstJson(value)])
|
|
124
122
|
);
|
|
125
123
|
} else {
|
|
126
124
|
return ast;
|
package/dist/core/wxt.mjs
CHANGED
package/dist/core/zip.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
|
-
import {
|
|
3
|
+
import { safeFilename } from "./utils/strings.mjs";
|
|
4
4
|
import { getPackageJson } from "./utils/package.mjs";
|
|
5
5
|
import { minimatch } from "minimatch";
|
|
6
6
|
import { formatDuration } from "./utils/time.mjs";
|
|
@@ -16,9 +16,7 @@ export async function zip(config) {
|
|
|
16
16
|
const start = Date.now();
|
|
17
17
|
wxt.logger.info("Zipping extension...");
|
|
18
18
|
const zipFiles = [];
|
|
19
|
-
const projectName = wxt.config.zip.name ??
|
|
20
|
-
(await getPackageJson())?.name || path.dirname(process.cwd())
|
|
21
|
-
);
|
|
19
|
+
const projectName = wxt.config.zip.name ?? safeFilename((await getPackageJson())?.name || path.dirname(process.cwd()));
|
|
22
20
|
const applyTemplate = (template) => template.replaceAll("{{name}}", projectName).replaceAll("{{browser}}", wxt.config.browser).replaceAll(
|
|
23
21
|
"{{version}}",
|
|
24
22
|
output.manifest.version_name ?? output.manifest.version
|
package/dist/modules.d.ts
CHANGED
|
@@ -17,17 +17,21 @@ export declare function defineWxtModule<TOptions extends WxtModuleOptions>(modul
|
|
|
17
17
|
* the output directory. This will speed up project builds since it just has to
|
|
18
18
|
* copy some files instead of bundling them.
|
|
19
19
|
*
|
|
20
|
+
* To extract entrypoint options from a JS/TS file, use
|
|
21
|
+
* `wxt.builder.importEntrypoint` (see example).
|
|
22
|
+
*
|
|
20
23
|
* @param wxt The wxt instance provided by the module's setup function.
|
|
21
24
|
* @param entrypoint The entrypoint to be bundled along with the extension.
|
|
22
25
|
*
|
|
23
26
|
* @example
|
|
24
|
-
* export default defineWxtModule((wxt, options) => {
|
|
27
|
+
* export default defineWxtModule(async (wxt, options) => {
|
|
28
|
+
* const entrypointPath = "/path/to/my-entrypoint.ts";
|
|
25
29
|
* addEntrypoint(wxt, {
|
|
26
|
-
* type: "
|
|
27
|
-
* name: "
|
|
28
|
-
* inputPath:
|
|
30
|
+
* type: "content-script",
|
|
31
|
+
* name: "some-name",
|
|
32
|
+
* inputPath: entrypointPath,
|
|
29
33
|
* outputDir: wxt.config.outputDir,
|
|
30
|
-
* options:
|
|
34
|
+
* options: await wxt.builder.importEntrypoint(entrypointPath),
|
|
31
35
|
* });
|
|
32
36
|
* });
|
|
33
37
|
*/
|
package/dist/storage.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export interface WxtStorage {
|
|
|
103
103
|
/**
|
|
104
104
|
* Define a storage item with a default value, type, or versioning.
|
|
105
105
|
*
|
|
106
|
-
* Read full docs: https://wxt.dev/guide/extension-apis/storage
|
|
106
|
+
* Read full docs: https://wxt.dev/guide/extension-apis/storage#defining-storage-items
|
|
107
107
|
*/
|
|
108
108
|
defineItem<TValue, TMetadata extends Record<string, unknown> = {}>(key: StorageItemKey): WxtStorageItem<TValue | null, TMetadata>;
|
|
109
109
|
defineItem<TValue, TMetadata extends Record<string, unknown> = {}>(key: StorageItemKey, options: WxtStorageItemOptions<TValue>): WxtStorageItem<TValue, TMetadata>;
|
package/dist/storage.mjs
CHANGED
|
@@ -313,7 +313,7 @@ function createDriver(storageArea) {
|
|
|
313
313
|
[
|
|
314
314
|
"'wxt/storage' must be loaded in a web extension environment",
|
|
315
315
|
"\n - If thrown during a build, see https://github.com/wxt-dev/wxt/issues/371",
|
|
316
|
-
" - If thrown during tests, mock 'wxt/browser' correctly. See https://wxt.dev/guide/go-further/testing
|
|
316
|
+
" - If thrown during tests, mock 'wxt/browser' correctly. See https://wxt.dev/guide/go-further/testing\n"
|
|
317
317
|
].join("\n")
|
|
318
318
|
);
|
|
319
319
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -747,7 +747,33 @@ export type ResolvedPerBrowserOptions<T, TOmitted extends keyof T = never> = {
|
|
|
747
747
|
* Manifest customization available in the `wxt.config.ts` file. You cannot configure entrypoints
|
|
748
748
|
* here, they are configured inline.
|
|
749
749
|
*/
|
|
750
|
-
export type UserManifest = Partial<Omit<
|
|
750
|
+
export type UserManifest = Partial<Omit<chrome.runtime.ManifestV3, 'action' | 'background' | 'chrome_url_overrides' | 'devtools_page' | 'manifest_version' | 'options_page' | 'options_ui' | 'sandbox'>> & {
|
|
751
|
+
action?: chrome.runtime.ManifestV3['action'] & {
|
|
752
|
+
browser_style?: boolean;
|
|
753
|
+
};
|
|
754
|
+
browser_action?: chrome.runtime.ManifestV2['browser_action'] & {
|
|
755
|
+
browser_style?: boolean;
|
|
756
|
+
};
|
|
757
|
+
page_action?: chrome.runtime.ManifestV2['page_action'] & {
|
|
758
|
+
browser_style?: boolean;
|
|
759
|
+
};
|
|
760
|
+
browser_specific_settings?: {
|
|
761
|
+
gecko?: {
|
|
762
|
+
id?: string;
|
|
763
|
+
strict_min_version?: string;
|
|
764
|
+
strict_max_version?: string;
|
|
765
|
+
update_url?: string;
|
|
766
|
+
};
|
|
767
|
+
gecko_android?: {
|
|
768
|
+
strict_min_version?: string;
|
|
769
|
+
strict_max_version?: string;
|
|
770
|
+
};
|
|
771
|
+
safari?: {
|
|
772
|
+
strict_min_version?: string;
|
|
773
|
+
strict_max_version?: string;
|
|
774
|
+
};
|
|
775
|
+
};
|
|
776
|
+
};
|
|
751
777
|
export type UserManifestFn = (env: ConfigEnv) => UserManifest | Promise<UserManifest>;
|
|
752
778
|
export interface ConfigEnv {
|
|
753
779
|
/**
|
|
@@ -765,7 +791,7 @@ export interface ConfigEnv {
|
|
|
765
791
|
browser: TargetBrowser;
|
|
766
792
|
/**
|
|
767
793
|
* Manifest version passed in from the CLI via the `--mv2` or `--mv3` flags. When not passed, it depends on the target browser. See
|
|
768
|
-
* [the guide](https://wxt.dev/guide/key-concepts/multiple-browsers
|
|
794
|
+
* [the guide](https://wxt.dev/guide/key-concepts/multiple-browsers#target-manifest-version) for more
|
|
769
795
|
* details.
|
|
770
796
|
*/
|
|
771
797
|
manifestVersion: 2 | 3;
|
|
@@ -995,6 +1021,9 @@ export interface WxtHooks {
|
|
|
995
1021
|
'build:manifestGenerated': (wxt: Wxt, manifest: Manifest.WebExtensionManifest) => HookResult;
|
|
996
1022
|
/**
|
|
997
1023
|
* Called once all entrypoints have been loaded from the `entrypointsDir`.
|
|
1024
|
+
* Use `wxt.builder.importEntrypoint` to load entrypoint options from the
|
|
1025
|
+
* file, or manually define them.
|
|
1026
|
+
*
|
|
998
1027
|
* @param wxt The configured WXT object
|
|
999
1028
|
* @param entrypoints The list of entrypoints to be built
|
|
1000
1029
|
*/
|
|
@@ -1016,6 +1045,10 @@ export interface WxtHooks {
|
|
|
1016
1045
|
export interface Wxt {
|
|
1017
1046
|
config: ResolvedConfig;
|
|
1018
1047
|
hooks: Hookable<WxtHooks>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Alias for `wxt.hooks.hook(...)`.
|
|
1050
|
+
*/
|
|
1051
|
+
hook: Hookable<WxtHooks>['hook'];
|
|
1019
1052
|
/**
|
|
1020
1053
|
* Alias for config.logger
|
|
1021
1054
|
*/
|
|
@@ -1241,7 +1274,7 @@ export interface WxtModule<TOptions extends WxtModuleOptions> {
|
|
|
1241
1274
|
* Alternative to adding hooks in setup function with `wxt.hooks`. Hooks are
|
|
1242
1275
|
* added before the `setup` function is called.
|
|
1243
1276
|
*/
|
|
1244
|
-
hooks?:
|
|
1277
|
+
hooks?: NestedHooks<WxtHooks>;
|
|
1245
1278
|
/**
|
|
1246
1279
|
* A custom function that can be used to setup hooks and call module-specific
|
|
1247
1280
|
* APIs.
|
package/dist/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.19.
|
|
1
|
+
export const version = "0.19.10-alpha1";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.19.
|
|
4
|
+
"version": "0.19.10-alpha1",
|
|
5
5
|
"description": "Next gen framework for developing web extensions",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
+
"@types/chrome": "^0.0.269",
|
|
73
74
|
"@aklinker1/rollup-plugin-visualizer": "5.12.0",
|
|
74
75
|
"@types/webextension-polyfill": "^0.10.7",
|
|
75
76
|
"@webext-core/fake-browser": "^1.3.1",
|
|
@@ -84,7 +85,7 @@
|
|
|
84
85
|
"defu": "^6.1.4",
|
|
85
86
|
"dequal": "^2.0.3",
|
|
86
87
|
"esbuild": "^0.23.0",
|
|
87
|
-
"execa": "^9.3.
|
|
88
|
+
"execa": "^9.3.1",
|
|
88
89
|
"fast-glob": "^3.3.2",
|
|
89
90
|
"filesize": "^10.1.4",
|
|
90
91
|
"fs-extra": "^11.2.0",
|
|
@@ -103,20 +104,20 @@
|
|
|
103
104
|
"nypm": "^0.3.9",
|
|
104
105
|
"ohash": "^1.1.3",
|
|
105
106
|
"open": "^10.1.0",
|
|
106
|
-
"ora": "^8.0
|
|
107
|
+
"ora": "^8.1.0",
|
|
107
108
|
"picocolors": "^1.0.1",
|
|
108
109
|
"prompts": "^2.4.2",
|
|
109
110
|
"publish-browser-extension": "^2.1.3",
|
|
110
|
-
"
|
|
111
|
+
"scule": "^1.3.0",
|
|
112
|
+
"unimport": "^3.11.1",
|
|
111
113
|
"vite": "^5.3.5",
|
|
112
114
|
"vite-node": "^2.0.4",
|
|
113
115
|
"web-ext-run": "^0.2.1",
|
|
114
116
|
"webextension-polyfill": "^0.12.0"
|
|
115
117
|
},
|
|
116
118
|
"devDependencies": {
|
|
117
|
-
"@aklinker1/check": "^1.
|
|
119
|
+
"@aklinker1/check": "^1.4.5",
|
|
118
120
|
"@faker-js/faker": "^8.4.1",
|
|
119
|
-
"@types/chrome": "^0.0.269",
|
|
120
121
|
"@types/fs-extra": "^11.0.4",
|
|
121
122
|
"@types/lodash.merge": "^4.6.9",
|
|
122
123
|
"@types/natural-compare": "^1.4.3",
|
|
@@ -126,6 +127,7 @@
|
|
|
126
127
|
"extract-zip": "^2.0.1",
|
|
127
128
|
"happy-dom": "^14.12.3",
|
|
128
129
|
"lodash.merge": "^4.6.2",
|
|
130
|
+
"oxlint": "^0.9.1",
|
|
129
131
|
"p-map": "^7.0.2",
|
|
130
132
|
"publint": "^0.2.9",
|
|
131
133
|
"tsx": "4.15.7",
|
|
@@ -134,9 +136,6 @@
|
|
|
134
136
|
"vitest": "^2.0.4",
|
|
135
137
|
"vitest-plugin-random-seed": "^1.1.0"
|
|
136
138
|
},
|
|
137
|
-
"peerDependencies": {
|
|
138
|
-
"@types/chrome": "*"
|
|
139
|
-
},
|
|
140
139
|
"peerDependenciesMeta": {
|
|
141
140
|
"@types/chrome": {
|
|
142
141
|
"optional": true
|
package/README.md
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<h1 align="center">
|
|
2
|
-
<img style="vertical-align:middle" width="44" src="https://raw.githubusercontent.com/wxt-dev/wxt/HEAD/docs/public/hero-logo.svg" alt="WXT Logo">
|
|
3
|
-
<span>WXT</span>
|
|
4
|
-
</h1>
|
|
5
|
-
|
|
6
|
-
<p align="center">
|
|
7
|
-
<a href="https://www.npmjs.com/package/wxt" target="_blank"><img alt="npm" src="https://img.shields.io/npm/v/wxt?labelColor=black&color=%234fa048"></a>
|
|
8
|
-
<span> </span>
|
|
9
|
-
<a href="https://www.npmjs.com/package/wxt" target="_blank"><img alt="npm" src="https://img.shields.io/npm/dm/wxt?labelColor=black&color=%234fa048"></a>
|
|
10
|
-
<span> </span>
|
|
11
|
-
<a href="https://github.com/wxt-dev/wxt/blob/main/LICENSE" target="_blank"><img alt="NPM" src="https://img.shields.io/npm/l/wxt?labelColor=black&color=%234fa048"></a>
|
|
12
|
-
<span> </span>
|
|
13
|
-
<a href="https://codecov.io/github/wxt-dev/wxt" target="_blank"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/wxt-dev/wxt?labelColor=black&color=%234fa048"></a>
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
<p align="center">
|
|
17
|
-
<span>Next-gen framework for developing web extensions.</span>
|
|
18
|
-
<br/>
|
|
19
|
-
<span>⚡</span>
|
|
20
|
-
<br/>
|
|
21
|
-
<q><i>It's like Nuxt, but for Chrome Extensions</i></q>
|
|
22
|
-
</p>
|
|
23
|
-
|
|
24
|
-
<p align="center">
|
|
25
|
-
<a href="https://wxt.dev/guide/installation.html" target="_blank">Get Started</a>
|
|
26
|
-
•
|
|
27
|
-
<a href="https://wxt.dev/api/config.html" target="_blank">Configuration</a>
|
|
28
|
-
•
|
|
29
|
-
<a href="https://wxt.dev/examples.html" target="_blank">Examples</a>
|
|
30
|
-
•
|
|
31
|
-
<a href="https://github.com/wxt-dev/wxt/blob/main/packages/wxt/CHANGELOG.md" target="_blank">Changelog</a>
|
|
32
|
-
•
|
|
33
|
-
<a href="https://discord.gg/ZFsZqGery9" target="_blank">Discord</a>
|
|
34
|
-
</p>
|
|
35
|
-
|
|
36
|
-

|
|
37
|
-
|
|
38
|
-
## Demo
|
|
39
|
-
|
|
40
|
-
https://github.com/wxt-dev/wxt/assets/10101283/4d678939-1bdb-495c-9c36-3aa281d84c94
|
|
41
|
-
|
|
42
|
-
## Quick Start
|
|
43
|
-
|
|
44
|
-
Bootstrap a new project:
|
|
45
|
-
|
|
46
|
-
```sh
|
|
47
|
-
pnpm dlx wxt@latest init <project-name>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Or see the [installation guide](https://wxt.dev/guide/installation.html) to get started with WXT.
|
|
51
|
-
|
|
52
|
-
## Features
|
|
53
|
-
|
|
54
|
-
- 🌐 Supports all browsers
|
|
55
|
-
- ✅ Supports both MV2 and MV3
|
|
56
|
-
- ⚡ Dev mode with HMR & fast reload
|
|
57
|
-
- 📂 File based entrypoints
|
|
58
|
-
- 🚔 TypeScript
|
|
59
|
-
- 🦾 Auto-imports
|
|
60
|
-
- 🤖 Automated publishing
|
|
61
|
-
- 🎨 Frontend framework agnostic: works with Vue, React, Svelte, etc
|
|
62
|
-
- 📦 Modular architecture with [WXT modules](https://wxt.dev/guide/go-further/reusable-modules.html#overview)
|
|
63
|
-
- 🖍️ Quickly bootstrap a new project
|
|
64
|
-
- 📏 Bundle analysis
|
|
65
|
-
- ⬇️ Download and bundle remote URL imports
|
|
66
|
-
|
|
67
|
-
## Contributors
|
|
68
|
-
|
|
69
|
-
<a href="https://github.com/wxt-dev/wxt/graphs/contributors">
|
|
70
|
-
<img src="https://contrib.rocks/image?repo=wxt-dev/wxt" />
|
|
71
|
-
</a>
|