wxt 0.19.7 → 0.19.9
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/browser/chrome.d.ts +4 -8
- package/dist/core/builders/vite/index.mjs +5 -4
- package/dist/core/create-server.mjs +1 -1
- package/dist/core/initialize.mjs +34 -19
- 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 +4 -4
- 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/types.d.ts +35 -2
- package/dist/version.mjs +1 -1
- package/package.json +8 -9
|
@@ -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/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
|
/**
|
|
@@ -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.9";
|
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.9",
|
|
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
|