wxt 0.19.26 → 0.19.28
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/builtin-modules/unimport.d.ts +0 -3
- package/dist/builtin-modules/unimport.mjs +2 -24
- package/dist/core/builders/vite/index.mjs +2 -0
- package/dist/core/generate-wxt-dir.mjs +1 -1
- package/dist/core/resolve-config.d.ts +1 -1
- package/dist/core/resolve-config.mjs +13 -10
- package/dist/core/utils/building/detect-dev-changes.mjs +18 -7
- package/dist/core/utils/building/import-entrypoint.mjs +1 -2
- package/dist/core/utils/env.d.ts +1 -1
- package/dist/core/utils/env.mjs +16 -13
- package/dist/core/utils/manifest.mjs +6 -0
- package/dist/core/utils/testing/fake-objects.d.ts +48 -48
- package/dist/core/wxt.mjs +1 -1
- package/dist/testing/wxt-vitest-plugin.mjs +2 -5
- package/dist/types.d.ts +1 -2
- package/dist/version.mjs +1 -1
- package/dist/virtual/background-entrypoint.mjs +2 -4
- package/dist/virtual/content-script-isolated-world-entrypoint.mjs +1 -2
- package/dist/virtual/content-script-main-world-entrypoint.mjs +1 -2
- package/dist/virtual/reload-html.mjs +2 -4
- package/dist/virtual/unlisted-script-entrypoint.mjs +1 -2
- package/package.json +16 -14
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { EslintGlobalsPropValue, WxtDirFileEntry, WxtModule, WxtResolvedUnimportOptions } from '../types';
|
|
2
|
-
import { type Unimport } from 'unimport';
|
|
3
|
-
import { Plugin } from 'vite';
|
|
4
2
|
declare const _default: WxtModule<import("../types").WxtModuleOptions>;
|
|
5
3
|
export default _default;
|
|
6
|
-
export declare function vitePlugin(unimport: Unimport): Plugin;
|
|
7
4
|
export declare function getEslint8ConfigEntry(options: WxtResolvedUnimportOptions, globals: Record<string, EslintGlobalsPropValue>): WxtDirFileEntry;
|
|
8
5
|
export declare function getEslint9ConfigEntry(options: WxtResolvedUnimportOptions, globals: Record<string, EslintGlobalsPropValue>): WxtDirFileEntry;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { addViteConfig, defineWxtModule } from "../modules.mjs";
|
|
2
2
|
import { createUnimport } from "unimport";
|
|
3
|
-
import
|
|
3
|
+
import UnimportPlugin from "unimport/unplugin";
|
|
4
4
|
export default defineWxtModule({
|
|
5
5
|
name: "wxt:built-in:unimport",
|
|
6
6
|
setup(wxt) {
|
|
@@ -30,32 +30,10 @@ export default defineWxtModule({
|
|
|
30
30
|
);
|
|
31
31
|
});
|
|
32
32
|
addViteConfig(wxt, () => ({
|
|
33
|
-
plugins: [
|
|
33
|
+
plugins: [UnimportPlugin.vite(options)]
|
|
34
34
|
}));
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
export function vitePlugin(unimport) {
|
|
38
|
-
const ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
39
|
-
".js",
|
|
40
|
-
".jsx",
|
|
41
|
-
".ts",
|
|
42
|
-
".tsx",
|
|
43
|
-
".vue",
|
|
44
|
-
".svelte"
|
|
45
|
-
]);
|
|
46
|
-
return {
|
|
47
|
-
name: "wxt:unimport",
|
|
48
|
-
async transform(code, id) {
|
|
49
|
-
if (id.includes("node_modules")) return;
|
|
50
|
-
if (!ENABLED_EXTENSIONS.has(extname(id))) return;
|
|
51
|
-
const injected = await unimport.injectImports(code, id);
|
|
52
|
-
return {
|
|
53
|
-
code: injected.code,
|
|
54
|
-
map: injected.s.generateMap({ hires: "boundary", source: id })
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
37
|
async function getImportsDeclarationEntry(unimport) {
|
|
60
38
|
await unimport.init();
|
|
61
39
|
return {
|
|
@@ -35,6 +35,8 @@ export async function createViteBuilder(wxtConfig, hooks, getWxtDevServer) {
|
|
|
35
35
|
config.server.watch = {
|
|
36
36
|
ignored: [`${wxtConfig.outBaseDir}/**`, `${wxtConfig.wxtDir}/**`]
|
|
37
37
|
};
|
|
38
|
+
config.legacy ??= {};
|
|
39
|
+
config.legacy.skipWebSocketTokenCheck = true;
|
|
38
40
|
const server = getWxtDevServer?.();
|
|
39
41
|
config.plugins ??= [];
|
|
40
42
|
config.plugins.push(
|
|
@@ -162,7 +162,7 @@ function getMainDeclarationEntry(references) {
|
|
|
162
162
|
} else if (ref.tsReference) {
|
|
163
163
|
const absolutePath = resolve(wxt.config.wxtDir, ref.path);
|
|
164
164
|
const relativePath = relative(wxt.config.wxtDir, absolutePath);
|
|
165
|
-
lines.push(`/// <reference
|
|
165
|
+
lines.push(`/// <reference path="./${normalizePath(relativePath)}" />`);
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
return {
|
|
@@ -8,4 +8,4 @@ import { InlineConfig, ResolvedConfig, UserConfig, Logger, WxtCommand, WxtModule
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function resolveConfig(inlineConfig: InlineConfig, command: WxtCommand): Promise<ResolvedConfig>;
|
|
10
10
|
export declare function mergeBuilderConfig(logger: Logger, inlineConfig: InlineConfig, userConfig: UserConfig): Promise<Pick<InlineConfig, 'vite'>>;
|
|
11
|
-
export declare function resolveWxtUserModules(modulesDir: string, modules?: string[]): Promise<WxtModuleWithMetadata<any>[]>;
|
|
11
|
+
export declare function resolveWxtUserModules(root: string, modulesDir: string, modules?: string[]): Promise<WxtModuleWithMetadata<any>[]>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { loadConfig } from "c12";
|
|
2
|
+
import { resolve as esmResolve } from "import-meta-resolve";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { createFsCache } from "./utils/cache.mjs";
|
|
4
5
|
import consola, { LogLevels } from "consola";
|
|
@@ -11,6 +12,7 @@ import { getEslintVersion } from "./utils/eslint.mjs";
|
|
|
11
12
|
import { safeStringToNumber } from "./utils/number.mjs";
|
|
12
13
|
import { loadEnv } from "./utils/env.mjs";
|
|
13
14
|
import { getPort } from "get-port-please";
|
|
15
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
14
16
|
export async function resolveConfig(inlineConfig, command) {
|
|
15
17
|
let userConfig = {};
|
|
16
18
|
let userConfigMetadata;
|
|
@@ -19,10 +21,7 @@ export async function resolveConfig(inlineConfig, command) {
|
|
|
19
21
|
configFile: inlineConfig.configFile,
|
|
20
22
|
name: "wxt",
|
|
21
23
|
cwd: inlineConfig.root ?? process.cwd(),
|
|
22
|
-
rcFile: false
|
|
23
|
-
jitiOptions: {
|
|
24
|
-
esmResolve: true
|
|
25
|
-
}
|
|
24
|
+
rcFile: false
|
|
26
25
|
});
|
|
27
26
|
if (inlineConfig.configFile && metadata.layers?.length === 0) {
|
|
28
27
|
throw Error(`Config file "${inlineConfig.configFile}" not found`);
|
|
@@ -43,7 +42,7 @@ export async function resolveConfig(inlineConfig, command) {
|
|
|
43
42
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
44
43
|
);
|
|
45
44
|
const wxtDir = path.resolve(root, ".wxt");
|
|
46
|
-
const wxtModuleDir =
|
|
45
|
+
const wxtModuleDir = resolveWxtModuleDir();
|
|
47
46
|
const srcDir = path.resolve(root, mergedConfig.srcDir ?? root);
|
|
48
47
|
const entrypointsDir = path.resolve(
|
|
49
48
|
srcDir,
|
|
@@ -100,6 +99,7 @@ export async function resolveConfig(inlineConfig, command) {
|
|
|
100
99
|
};
|
|
101
100
|
}
|
|
102
101
|
const userModules = await resolveWxtUserModules(
|
|
102
|
+
root,
|
|
103
103
|
modulesDir,
|
|
104
104
|
mergedConfig.modules
|
|
105
105
|
);
|
|
@@ -300,9 +300,10 @@ async function getUnimportEslintOptions(wxtDir, options) {
|
|
|
300
300
|
globalsPropValue: true
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
|
|
303
|
+
function resolveWxtModuleDir() {
|
|
304
|
+
const importer = typeof __filename === "string" ? pathToFileURL(__filename).href : import.meta.url;
|
|
305
|
+
const url = esmResolve("wxt", importer);
|
|
306
|
+
return path.resolve(fileURLToPath(url), "../..");
|
|
306
307
|
}
|
|
307
308
|
async function isDirMissing(dir) {
|
|
308
309
|
return !await fs.exists(dir);
|
|
@@ -333,12 +334,14 @@ export async function mergeBuilderConfig(logger, inlineConfig, userConfig) {
|
|
|
333
334
|
}
|
|
334
335
|
throw Error("Builder not found. Make sure vite is installed.");
|
|
335
336
|
}
|
|
336
|
-
export async function resolveWxtUserModules(modulesDir, modules = []) {
|
|
337
|
+
export async function resolveWxtUserModules(root, modulesDir, modules = []) {
|
|
338
|
+
const importer = pathToFileURL(path.join(root, "index.js")).href;
|
|
337
339
|
const npmModules = await Promise.all(
|
|
338
340
|
modules.map(async (moduleId) => {
|
|
341
|
+
const resolvedModulePath = esmResolve(moduleId, importer);
|
|
339
342
|
const mod = await import(
|
|
340
343
|
/* @vite-ignore */
|
|
341
|
-
|
|
344
|
+
resolvedModulePath
|
|
342
345
|
);
|
|
343
346
|
if (mod.default == null) {
|
|
344
347
|
throw Error("Module missing default export: " + moduleId);
|
|
@@ -83,13 +83,24 @@ export function detectDevChanges(changedFiles, currentOutput) {
|
|
|
83
83
|
function findEffectedSteps(changedFile, currentOutput) {
|
|
84
84
|
const changes = [];
|
|
85
85
|
const changedPath = normalizePath(changedFile);
|
|
86
|
-
const isChunkEffected = (chunk) =>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
const isChunkEffected = (chunk) => {
|
|
87
|
+
switch (chunk.type) {
|
|
88
|
+
// If it's an HTML file with the same path, is is effected because HTML files need to be re-rendered
|
|
89
|
+
// - fileName is normalized, relative bundle path, "<entrypoint-name>.html"
|
|
90
|
+
case "asset": {
|
|
91
|
+
return changedPath.replace("/index.html", ".html").endsWith(chunk.fileName);
|
|
92
|
+
}
|
|
93
|
+
// If it's a chunk that depends on the changed file, it is effected
|
|
94
|
+
// - moduleIds are absolute, normalized paths
|
|
95
|
+
case "chunk": {
|
|
96
|
+
const modulePaths = chunk.moduleIds.map((path) => path.split("?")[0]);
|
|
97
|
+
return modulePaths.includes(changedPath);
|
|
98
|
+
}
|
|
99
|
+
default: {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
93
104
|
for (const step of currentOutput.steps) {
|
|
94
105
|
const effectedChunk = step.chunks.find((chunk) => isChunkEffected(chunk));
|
|
95
106
|
if (effectedChunk) changes.push(step);
|
|
@@ -27,7 +27,6 @@ export async function importEntrypointFile(path) {
|
|
|
27
27
|
{
|
|
28
28
|
cache: false,
|
|
29
29
|
debug: wxt.config.debug,
|
|
30
|
-
esmResolve: true,
|
|
31
30
|
alias: {
|
|
32
31
|
"webextension-polyfill": resolve(
|
|
33
32
|
wxt.config.wxtModuleDir,
|
|
@@ -43,7 +42,7 @@ export async function importEntrypointFile(path) {
|
|
|
43
42
|
},
|
|
44
43
|
// Continue using node to load TS files even if `bun run --bun` is detected. Jiti does not
|
|
45
44
|
// respect the custom transform function when using it's native bun option.
|
|
46
|
-
|
|
45
|
+
tryNative: false,
|
|
47
46
|
// List of extensions to transform with esbuild
|
|
48
47
|
extensions: [
|
|
49
48
|
".ts",
|
package/dist/core/utils/env.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import type { TargetBrowser } from '../../types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Load environment files based on the current mode and browser.
|
|
4
4
|
*/
|
|
5
|
-
export declare function loadEnv(mode: string, browser: TargetBrowser): import("dotenv").
|
|
5
|
+
export declare function loadEnv(mode: string, browser: TargetBrowser): import("dotenv-expand").DotenvExpandOutput;
|
package/dist/core/utils/env.mjs
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { config } from "dotenv";
|
|
2
|
+
import { expand } from "dotenv-expand";
|
|
2
3
|
export function loadEnv(mode, browser) {
|
|
3
|
-
return
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
return expand(
|
|
5
|
+
config({
|
|
6
|
+
// Files on top override files below
|
|
7
|
+
path: [
|
|
8
|
+
`.env.${mode}.${browser}.local`,
|
|
9
|
+
`.env.${mode}.${browser}`,
|
|
10
|
+
`.env.${browser}.local`,
|
|
11
|
+
`.env.${browser}`,
|
|
12
|
+
`.env.${mode}.local`,
|
|
13
|
+
`.env.${mode}`,
|
|
14
|
+
`.env.local`,
|
|
15
|
+
`.env`
|
|
16
|
+
]
|
|
17
|
+
})
|
|
18
|
+
);
|
|
16
19
|
}
|
|
@@ -41,6 +41,12 @@ export async function generateManifest(allEntrypoints, buildOutput) {
|
|
|
41
41
|
icons: discoverIcons(buildOutput)
|
|
42
42
|
};
|
|
43
43
|
const userManifest = wxt.config.manifest;
|
|
44
|
+
if (userManifest.manifest_version) {
|
|
45
|
+
delete userManifest.manifest_version;
|
|
46
|
+
wxt.logger.warn(
|
|
47
|
+
"`manifest.manifest_version` config was set, but ignored. To change the target manifest version, use the `manifestVersion` option or the `--mv2`/`--mv3` CLI flags.\nSee https://wxt.dev/guide/essentials/target-different-browsers.html#target-a-manifest-version"
|
|
48
|
+
);
|
|
49
|
+
}
|
|
44
50
|
let manifest = defu(
|
|
45
51
|
userManifest,
|
|
46
52
|
baseManifest
|
|
@@ -1376,6 +1376,13 @@ export declare const fakeResolvedConfig: (overrides?: {
|
|
|
1376
1376
|
} | undefined;
|
|
1377
1377
|
root?: string | undefined;
|
|
1378
1378
|
mode?: string | undefined;
|
|
1379
|
+
dev?: {
|
|
1380
|
+
server?: {
|
|
1381
|
+
port?: number | undefined;
|
|
1382
|
+
hostname?: string | undefined;
|
|
1383
|
+
} | undefined;
|
|
1384
|
+
reloadCommand?: (string | false) | undefined;
|
|
1385
|
+
} | undefined;
|
|
1379
1386
|
publicDir?: string | undefined;
|
|
1380
1387
|
experimental?: {} | undefined;
|
|
1381
1388
|
srcDir?: string | undefined;
|
|
@@ -1559,13 +1566,6 @@ export declare const fakeResolvedConfig: (overrides?: {
|
|
|
1559
1566
|
} | undefined;
|
|
1560
1567
|
extensionApi?: ("webextension-polyfill" | "chrome") | undefined;
|
|
1561
1568
|
entrypointLoader?: ("vite-node" | "jiti") | undefined;
|
|
1562
|
-
dev?: {
|
|
1563
|
-
server?: {
|
|
1564
|
-
port?: number | undefined;
|
|
1565
|
-
hostname?: string | undefined;
|
|
1566
|
-
} | undefined;
|
|
1567
|
-
reloadCommand?: (string | false) | undefined;
|
|
1568
|
-
} | undefined;
|
|
1569
1569
|
hooks?: {
|
|
1570
1570
|
'vite:build:extendConfig'?: {} | undefined;
|
|
1571
1571
|
'vite:devServer:extendConfig'?: {} | undefined;
|
|
@@ -2122,6 +2122,13 @@ export declare const fakeResolvedConfig: (overrides?: {
|
|
|
2122
2122
|
} | undefined;
|
|
2123
2123
|
root?: string | undefined;
|
|
2124
2124
|
mode?: string | undefined;
|
|
2125
|
+
dev?: {
|
|
2126
|
+
server?: {
|
|
2127
|
+
port?: number | undefined;
|
|
2128
|
+
hostname?: string | undefined;
|
|
2129
|
+
} | undefined;
|
|
2130
|
+
reloadCommand?: (string | false) | undefined;
|
|
2131
|
+
} | undefined;
|
|
2125
2132
|
publicDir?: string | undefined;
|
|
2126
2133
|
experimental?: {} | undefined;
|
|
2127
2134
|
srcDir?: string | undefined;
|
|
@@ -2305,13 +2312,6 @@ export declare const fakeResolvedConfig: (overrides?: {
|
|
|
2305
2312
|
} | undefined;
|
|
2306
2313
|
extensionApi?: ("webextension-polyfill" | "chrome") | undefined;
|
|
2307
2314
|
entrypointLoader?: ("vite-node" | "jiti") | undefined;
|
|
2308
|
-
dev?: {
|
|
2309
|
-
server?: {
|
|
2310
|
-
port?: number | undefined;
|
|
2311
|
-
hostname?: string | undefined;
|
|
2312
|
-
} | undefined;
|
|
2313
|
-
reloadCommand?: (string | false) | undefined;
|
|
2314
|
-
} | undefined;
|
|
2315
2315
|
hooks?: {
|
|
2316
2316
|
'vite:build:extendConfig'?: {} | undefined;
|
|
2317
2317
|
'vite:devServer:extendConfig'?: {} | undefined;
|
|
@@ -2894,6 +2894,13 @@ export declare const fakeResolvedConfig: (overrides?: {
|
|
|
2894
2894
|
} | undefined;
|
|
2895
2895
|
root?: string | undefined;
|
|
2896
2896
|
mode?: string | undefined;
|
|
2897
|
+
dev?: {
|
|
2898
|
+
server?: {
|
|
2899
|
+
port?: number | undefined;
|
|
2900
|
+
hostname?: string | undefined;
|
|
2901
|
+
} | undefined;
|
|
2902
|
+
reloadCommand?: (string | false) | undefined;
|
|
2903
|
+
} | undefined;
|
|
2897
2904
|
publicDir?: string | undefined;
|
|
2898
2905
|
experimental?: {} | undefined;
|
|
2899
2906
|
srcDir?: string | undefined;
|
|
@@ -3077,13 +3084,6 @@ export declare const fakeResolvedConfig: (overrides?: {
|
|
|
3077
3084
|
} | undefined;
|
|
3078
3085
|
extensionApi?: ("webextension-polyfill" | "chrome") | undefined;
|
|
3079
3086
|
entrypointLoader?: ("vite-node" | "jiti") | undefined;
|
|
3080
|
-
dev?: {
|
|
3081
|
-
server?: {
|
|
3082
|
-
port?: number | undefined;
|
|
3083
|
-
hostname?: string | undefined;
|
|
3084
|
-
} | undefined;
|
|
3085
|
-
reloadCommand?: (string | false) | undefined;
|
|
3086
|
-
} | undefined;
|
|
3087
3087
|
hooks?: {
|
|
3088
3088
|
'vite:build:extendConfig'?: {} | undefined;
|
|
3089
3089
|
'vite:devServer:extendConfig'?: {} | undefined;
|
|
@@ -5079,6 +5079,13 @@ export declare const fakeWxt: (overrides?: {
|
|
|
5079
5079
|
} | undefined;
|
|
5080
5080
|
root?: string | undefined;
|
|
5081
5081
|
mode?: string | undefined;
|
|
5082
|
+
dev?: {
|
|
5083
|
+
server?: {
|
|
5084
|
+
port?: number | undefined;
|
|
5085
|
+
hostname?: string | undefined;
|
|
5086
|
+
} | undefined;
|
|
5087
|
+
reloadCommand?: (string | false) | undefined;
|
|
5088
|
+
} | undefined;
|
|
5082
5089
|
publicDir?: string | undefined;
|
|
5083
5090
|
experimental?: {} | undefined;
|
|
5084
5091
|
srcDir?: string | undefined;
|
|
@@ -5262,13 +5269,6 @@ export declare const fakeWxt: (overrides?: {
|
|
|
5262
5269
|
} | undefined;
|
|
5263
5270
|
extensionApi?: ("webextension-polyfill" | "chrome") | undefined;
|
|
5264
5271
|
entrypointLoader?: ("vite-node" | "jiti") | undefined;
|
|
5265
|
-
dev?: {
|
|
5266
|
-
server?: {
|
|
5267
|
-
port?: number | undefined;
|
|
5268
|
-
hostname?: string | undefined;
|
|
5269
|
-
} | undefined;
|
|
5270
|
-
reloadCommand?: (string | false) | undefined;
|
|
5271
|
-
} | undefined;
|
|
5272
5272
|
hooks?: {
|
|
5273
5273
|
'vite:build:extendConfig'?: {} | undefined;
|
|
5274
5274
|
'vite:devServer:extendConfig'?: {} | undefined;
|
|
@@ -5825,6 +5825,13 @@ export declare const fakeWxt: (overrides?: {
|
|
|
5825
5825
|
} | undefined;
|
|
5826
5826
|
root?: string | undefined;
|
|
5827
5827
|
mode?: string | undefined;
|
|
5828
|
+
dev?: {
|
|
5829
|
+
server?: {
|
|
5830
|
+
port?: number | undefined;
|
|
5831
|
+
hostname?: string | undefined;
|
|
5832
|
+
} | undefined;
|
|
5833
|
+
reloadCommand?: (string | false) | undefined;
|
|
5834
|
+
} | undefined;
|
|
5828
5835
|
publicDir?: string | undefined;
|
|
5829
5836
|
experimental?: {} | undefined;
|
|
5830
5837
|
srcDir?: string | undefined;
|
|
@@ -6008,13 +6015,6 @@ export declare const fakeWxt: (overrides?: {
|
|
|
6008
6015
|
} | undefined;
|
|
6009
6016
|
extensionApi?: ("webextension-polyfill" | "chrome") | undefined;
|
|
6010
6017
|
entrypointLoader?: ("vite-node" | "jiti") | undefined;
|
|
6011
|
-
dev?: {
|
|
6012
|
-
server?: {
|
|
6013
|
-
port?: number | undefined;
|
|
6014
|
-
hostname?: string | undefined;
|
|
6015
|
-
} | undefined;
|
|
6016
|
-
reloadCommand?: (string | false) | undefined;
|
|
6017
|
-
} | undefined;
|
|
6018
6018
|
hooks?: {
|
|
6019
6019
|
'vite:build:extendConfig'?: {} | undefined;
|
|
6020
6020
|
'vite:devServer:extendConfig'?: {} | undefined;
|
|
@@ -6597,6 +6597,13 @@ export declare const fakeWxt: (overrides?: {
|
|
|
6597
6597
|
} | undefined;
|
|
6598
6598
|
root?: string | undefined;
|
|
6599
6599
|
mode?: string | undefined;
|
|
6600
|
+
dev?: {
|
|
6601
|
+
server?: {
|
|
6602
|
+
port?: number | undefined;
|
|
6603
|
+
hostname?: string | undefined;
|
|
6604
|
+
} | undefined;
|
|
6605
|
+
reloadCommand?: (string | false) | undefined;
|
|
6606
|
+
} | undefined;
|
|
6600
6607
|
publicDir?: string | undefined;
|
|
6601
6608
|
experimental?: {} | undefined;
|
|
6602
6609
|
srcDir?: string | undefined;
|
|
@@ -6780,13 +6787,6 @@ export declare const fakeWxt: (overrides?: {
|
|
|
6780
6787
|
} | undefined;
|
|
6781
6788
|
extensionApi?: ("webextension-polyfill" | "chrome") | undefined;
|
|
6782
6789
|
entrypointLoader?: ("vite-node" | "jiti") | undefined;
|
|
6783
|
-
dev?: {
|
|
6784
|
-
server?: {
|
|
6785
|
-
port?: number | undefined;
|
|
6786
|
-
hostname?: string | undefined;
|
|
6787
|
-
} | undefined;
|
|
6788
|
-
reloadCommand?: (string | false) | undefined;
|
|
6789
|
-
} | undefined;
|
|
6790
6790
|
hooks?: {
|
|
6791
6791
|
'vite:build:extendConfig'?: {} | undefined;
|
|
6792
6792
|
'vite:devServer:extendConfig'?: {} | undefined;
|
|
@@ -8133,13 +8133,13 @@ export declare const fakeWxt: (overrides?: {
|
|
|
8133
8133
|
pollInterval?: number | undefined;
|
|
8134
8134
|
} | undefined;
|
|
8135
8135
|
} | undefined;
|
|
8136
|
+
ref?: {} | undefined;
|
|
8137
|
+
unref?: {} | undefined;
|
|
8136
8138
|
add?: {} | undefined;
|
|
8137
8139
|
unwatch?: {} | undefined;
|
|
8138
8140
|
getWatched?: {} | undefined;
|
|
8139
8141
|
close?: {} | undefined;
|
|
8140
8142
|
on?: {} | undefined;
|
|
8141
|
-
ref?: {} | undefined;
|
|
8142
|
-
unref?: {} | undefined;
|
|
8143
8143
|
[EventEmitter.captureRejectionSymbol]?: {} | undefined;
|
|
8144
8144
|
addListener?: {} | undefined;
|
|
8145
8145
|
once?: {} | undefined;
|
|
@@ -8434,13 +8434,13 @@ export declare const fakeWxtDevServer: (overrides?: {
|
|
|
8434
8434
|
pollInterval?: number | undefined;
|
|
8435
8435
|
} | undefined;
|
|
8436
8436
|
} | undefined;
|
|
8437
|
+
ref?: {} | undefined;
|
|
8438
|
+
unref?: {} | undefined;
|
|
8437
8439
|
add?: {} | undefined;
|
|
8438
8440
|
unwatch?: {} | undefined;
|
|
8439
8441
|
getWatched?: {} | undefined;
|
|
8440
8442
|
close?: {} | undefined;
|
|
8441
8443
|
on?: {} | undefined;
|
|
8442
|
-
ref?: {} | undefined;
|
|
8443
|
-
unref?: {} | undefined;
|
|
8444
8444
|
[EventEmitter.captureRejectionSymbol]?: {} | undefined;
|
|
8445
8445
|
addListener?: {} | undefined;
|
|
8446
8446
|
once?: {} | undefined;
|
|
@@ -9109,13 +9109,13 @@ export declare const fakeDevServer: (overrides?: {
|
|
|
9109
9109
|
pollInterval?: number | undefined;
|
|
9110
9110
|
} | undefined;
|
|
9111
9111
|
} | undefined;
|
|
9112
|
+
ref?: {} | undefined;
|
|
9113
|
+
unref?: {} | undefined;
|
|
9112
9114
|
add?: {} | undefined;
|
|
9113
9115
|
unwatch?: {} | undefined;
|
|
9114
9116
|
getWatched?: {} | undefined;
|
|
9115
9117
|
close?: {} | undefined;
|
|
9116
9118
|
on?: {} | undefined;
|
|
9117
|
-
ref?: {} | undefined;
|
|
9118
|
-
unref?: {} | undefined;
|
|
9119
9119
|
[EventEmitter.captureRejectionSymbol]?: {} | undefined;
|
|
9120
9120
|
addListener?: {} | undefined;
|
|
9121
9121
|
once?: {} | undefined;
|
package/dist/core/wxt.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { builtinModules } from "../builtin-modules/index.mjs";
|
|
|
6
6
|
import { relative } from "path";
|
|
7
7
|
export let wxt;
|
|
8
8
|
export async function registerWxt(command, inlineConfig = {}) {
|
|
9
|
-
process.env.NODE_ENV ??= command === "serve" ? "development" : "production";
|
|
9
|
+
process.env.NODE_ENV ??= inlineConfig.mode ?? (command === "serve" ? "development" : "production");
|
|
10
10
|
const hooks = createHooks();
|
|
11
11
|
const config = await resolveConfig(inlineConfig, command);
|
|
12
12
|
const builder = await createViteBuilder(config, hooks, () => wxt.server);
|
|
@@ -5,8 +5,7 @@ import {
|
|
|
5
5
|
extensionApiMock,
|
|
6
6
|
resolveAppConfig
|
|
7
7
|
} from "../core/builders/vite/plugins/index.mjs";
|
|
8
|
-
import
|
|
9
|
-
import { createUnimport } from "unimport";
|
|
8
|
+
import UnimportPlugin from "unimport/unplugin";
|
|
10
9
|
import { registerWxt, wxt } from "../core/wxt.mjs";
|
|
11
10
|
export async function WxtVitest(inlineConfig) {
|
|
12
11
|
await registerWxt("serve", inlineConfig ?? {});
|
|
@@ -18,9 +17,7 @@ export async function WxtVitest(inlineConfig) {
|
|
|
18
17
|
extensionApiMock(wxt.config)
|
|
19
18
|
];
|
|
20
19
|
if (wxt.config.imports !== false) {
|
|
21
|
-
|
|
22
|
-
await unimport.init();
|
|
23
|
-
plugins.push(unimportPlugin(unimport));
|
|
20
|
+
plugins.push(UnimportPlugin.vite(wxt.config.imports));
|
|
24
21
|
}
|
|
25
22
|
return plugins;
|
|
26
23
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { UnimportOptions, Import } from 'unimport';
|
|
|
4
4
|
import { LogLevel } from 'consola';
|
|
5
5
|
import type { ContentScriptContext } from './client/content-scripts/content-script-context';
|
|
6
6
|
import type { PluginVisualizerOptions } from '@aklinker1/rollup-plugin-visualizer';
|
|
7
|
-
import type { FSWatcher } from 'chokidar';
|
|
8
7
|
import { ResolvedConfig as C12ResolvedConfig } from 'c12';
|
|
9
8
|
import { Hookable, NestedHooks } from 'hookable';
|
|
10
9
|
import type * as Nypm from 'nypm';
|
|
@@ -983,7 +982,7 @@ export interface WxtBuilderServer {
|
|
|
983
982
|
/**
|
|
984
983
|
* Chokidar file watcher instance.
|
|
985
984
|
*/
|
|
986
|
-
watcher:
|
|
985
|
+
watcher: vite.ViteDevServer['watcher'];
|
|
987
986
|
on?(event: string, callback: () => void): void;
|
|
988
987
|
}
|
|
989
988
|
export interface ServerInfo {
|
package/dist/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.19.
|
|
1
|
+
export const version = "0.19.28";
|
|
@@ -4,8 +4,7 @@ import { browser } from 'wxt/browser';
|
|
|
4
4
|
import { MatchPattern } from 'wxt/sandbox';
|
|
5
5
|
|
|
6
6
|
function print(method, ...args) {
|
|
7
|
-
if (import.meta.env.MODE === "production")
|
|
8
|
-
return;
|
|
7
|
+
if (import.meta.env.MODE === "production") return;
|
|
9
8
|
if (typeof args[0] === "string") {
|
|
10
9
|
const message = args.shift();
|
|
11
10
|
method(`[wxt] ${message}`, ...args);
|
|
@@ -122,8 +121,7 @@ async function reloadTabsForContentScript(contentScript) {
|
|
|
122
121
|
);
|
|
123
122
|
const matchingTabs = allTabs.filter((tab) => {
|
|
124
123
|
const url = tab.url;
|
|
125
|
-
if (!url)
|
|
126
|
-
return false;
|
|
124
|
+
if (!url) return false;
|
|
127
125
|
return !!matchPatterns.find((pattern) => pattern.includes(url));
|
|
128
126
|
});
|
|
129
127
|
await Promise.all(
|
|
@@ -3,8 +3,7 @@ import { ContentScriptContext } from 'wxt/client';
|
|
|
3
3
|
import { initPlugins } from 'virtual:wxt-plugins';
|
|
4
4
|
|
|
5
5
|
function print(method, ...args) {
|
|
6
|
-
if (import.meta.env.MODE === "production")
|
|
7
|
-
return;
|
|
6
|
+
if (import.meta.env.MODE === "production") return;
|
|
8
7
|
if (typeof args[0] === "string") {
|
|
9
8
|
const message = args.shift();
|
|
10
9
|
method(`[wxt] ${message}`, ...args);
|
|
@@ -2,8 +2,7 @@ import definition from 'virtual:user-content-script-main-world-entrypoint';
|
|
|
2
2
|
import { initPlugins } from 'virtual:wxt-plugins';
|
|
3
3
|
|
|
4
4
|
function print(method, ...args) {
|
|
5
|
-
if (import.meta.env.MODE === "production")
|
|
6
|
-
return;
|
|
5
|
+
if (import.meta.env.MODE === "production") return;
|
|
7
6
|
if (typeof args[0] === "string") {
|
|
8
7
|
const message = args.shift();
|
|
9
8
|
method(`[wxt] ${message}`, ...args);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
function print(method, ...args) {
|
|
2
|
-
if (import.meta.env.MODE === "production")
|
|
3
|
-
return;
|
|
2
|
+
if (import.meta.env.MODE === "production") return;
|
|
4
3
|
if (typeof args[0] === "string") {
|
|
5
4
|
const message = args.shift();
|
|
6
5
|
method(`[wxt] ${message}`, ...args);
|
|
@@ -56,8 +55,7 @@ if (import.meta.env.COMMAND === "serve") {
|
|
|
56
55
|
try {
|
|
57
56
|
const ws = getDevServerWebSocket();
|
|
58
57
|
ws.addWxtEventListener("wxt:reload-page", (event) => {
|
|
59
|
-
if (event.detail === location.pathname.substring(1))
|
|
60
|
-
location.reload();
|
|
58
|
+
if (event.detail === location.pathname.substring(1)) location.reload();
|
|
61
59
|
});
|
|
62
60
|
} catch (err) {
|
|
63
61
|
logger.error("Failed to setup web socket connection with dev server", err);
|
|
@@ -2,8 +2,7 @@ import definition from 'virtual:user-unlisted-script-entrypoint';
|
|
|
2
2
|
import { initPlugins } from 'virtual:wxt-plugins';
|
|
3
3
|
|
|
4
4
|
function print(method, ...args) {
|
|
5
|
-
if (import.meta.env.MODE === "production")
|
|
6
|
-
return;
|
|
5
|
+
if (import.meta.env.MODE === "production") return;
|
|
7
6
|
if (typeof args[0] === "string") {
|
|
8
7
|
const message = args.shift();
|
|
9
8
|
method(`[wxt] ${message}`, ...args);
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.19.
|
|
5
|
-
"description": "Next
|
|
4
|
+
"version": "0.19.28",
|
|
5
|
+
"description": "⚡ Next-gen Web Extension Framework",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/wxt-dev/wxt.git"
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"email": "aaronklinker1+wxt@gmail.com"
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
|
+
"funding": "https://github.com/sponsors/wxt-dev",
|
|
25
26
|
"files": [
|
|
26
27
|
"bin",
|
|
27
28
|
"dist"
|
|
@@ -79,22 +80,24 @@
|
|
|
79
80
|
"@webext-core/match-patterns": "^1.0.3",
|
|
80
81
|
"@wxt-dev/storage": "^1.0.0",
|
|
81
82
|
"async-mutex": "^0.5.0",
|
|
82
|
-
"c12": "^
|
|
83
|
+
"c12": "^3.0.2",
|
|
83
84
|
"cac": "^6.7.14",
|
|
84
|
-
"chokidar": "^
|
|
85
|
+
"chokidar": "^4.0.3",
|
|
85
86
|
"ci-info": "^4.1.0",
|
|
86
87
|
"consola": "^3.2.3",
|
|
87
88
|
"defu": "^6.1.4",
|
|
88
89
|
"dotenv": "^16.4.5",
|
|
89
|
-
"
|
|
90
|
+
"dotenv-expand": "^12.0.1",
|
|
91
|
+
"esbuild": "^0.25.0",
|
|
90
92
|
"fast-glob": "^3.3.2",
|
|
91
93
|
"filesize": "^10.1.6",
|
|
92
94
|
"fs-extra": "^11.2.0",
|
|
93
95
|
"get-port-please": "^3.1.2",
|
|
94
96
|
"giget": "^1.2.3",
|
|
95
97
|
"hookable": "^5.5.3",
|
|
98
|
+
"import-meta-resolve": "^4.1.0",
|
|
96
99
|
"is-wsl": "^3.1.0",
|
|
97
|
-
"jiti": "^
|
|
100
|
+
"jiti": "^2.4.2",
|
|
98
101
|
"json5": "^2.2.3",
|
|
99
102
|
"jszip": "^3.10.1",
|
|
100
103
|
"linkedom": "^0.18.5",
|
|
@@ -109,11 +112,11 @@
|
|
|
109
112
|
"perfect-debounce": "^1.0.0",
|
|
110
113
|
"picocolors": "^1.1.1",
|
|
111
114
|
"prompts": "^2.4.2",
|
|
112
|
-
"publish-browser-extension": "^2.
|
|
115
|
+
"publish-browser-extension": "^2.3.0 || ^3.0.0",
|
|
113
116
|
"scule": "^1.3.0",
|
|
114
117
|
"unimport": "^3.13.1",
|
|
115
|
-
"vite": "^5.0.0 ||
|
|
116
|
-
"vite-node": "^2.1.4",
|
|
118
|
+
"vite": "^5.0.0 || ^6.0.0",
|
|
119
|
+
"vite-node": "^2.1.4 || ^3.0.0",
|
|
117
120
|
"web-ext-run": "^0.2.1",
|
|
118
121
|
"webextension-polyfill": "^0.12.0"
|
|
119
122
|
},
|
|
@@ -126,15 +129,14 @@
|
|
|
126
129
|
"@types/normalize-path": "^3.0.2",
|
|
127
130
|
"@types/prompts": "^2.4.9",
|
|
128
131
|
"extract-zip": "^2.0.1",
|
|
129
|
-
"happy-dom": "^
|
|
132
|
+
"happy-dom": "^17.1.8",
|
|
130
133
|
"lodash.merge": "^4.6.2",
|
|
131
134
|
"oxlint": "^0.11.1",
|
|
132
135
|
"publint": "^0.2.12",
|
|
133
|
-
"tsx": "4.15.7",
|
|
134
136
|
"typescript": "^5.6.3",
|
|
135
|
-
"unbuild": "^
|
|
136
|
-
"vitest": "^
|
|
137
|
-
"vitest-plugin-random-seed": "^1.1.
|
|
137
|
+
"unbuild": "^3.5.0",
|
|
138
|
+
"vitest": "^3.0.7",
|
|
139
|
+
"vitest-plugin-random-seed": "^1.1.1"
|
|
138
140
|
},
|
|
139
141
|
"peerDependenciesMeta": {
|
|
140
142
|
"@types/chrome": {
|