wxt 0.18.7 → 0.18.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/{chunk-A3R6ZPUA.js → chunk-UA35R5HN.js} +215 -162
- package/dist/cli.js +216 -162
- package/dist/{index-D6lH9OkP.d.cts → index-B0efqfEK.d.cts} +9 -6
- package/dist/{index-D6lH9OkP.d.ts → index-B0efqfEK.d.ts} +9 -6
- package/dist/index.cjs +231 -177
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -1
- package/dist/modules.cjs +5 -6
- package/dist/modules.d.cts +1 -1
- package/dist/modules.d.ts +1 -1
- package/dist/modules.js +5 -6
- package/dist/testing.cjs +50 -47
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/virtual/background-entrypoint.js +44 -31
- package/dist/virtual/reload-html.js +37 -29
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-
|
|
2
|
-
export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, aa as ResolvedPublicFile, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ab as WxtPlugin, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-
|
|
1
|
+
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-B0efqfEK.cjs';
|
|
2
|
+
export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, aa as ResolvedPublicFile, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ab as WxtPlugin, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-B0efqfEK.cjs';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
@@ -65,6 +65,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
|
|
|
65
65
|
*/
|
|
66
66
|
declare function zip(config?: InlineConfig): Promise<string[]>;
|
|
67
67
|
|
|
68
|
-
var version = "0.18.
|
|
68
|
+
var version = "0.18.8";
|
|
69
69
|
|
|
70
70
|
export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-
|
|
2
|
-
export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, aa as ResolvedPublicFile, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ab as WxtPlugin, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-
|
|
1
|
+
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-B0efqfEK.js';
|
|
2
|
+
export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, aa as ResolvedPublicFile, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ab as WxtPlugin, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-B0efqfEK.js';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
@@ -65,6 +65,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
|
|
|
65
65
|
*/
|
|
66
66
|
declare function zip(config?: InlineConfig): Promise<string[]>;
|
|
67
67
|
|
|
68
|
-
var version = "0.18.
|
|
68
|
+
var version = "0.18.8";
|
|
69
69
|
|
|
70
70
|
export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
unnormalizePath,
|
|
20
20
|
version,
|
|
21
21
|
wxt
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-UA35R5HN.js";
|
|
23
23
|
import "./chunk-BERPNPEZ.js";
|
|
24
24
|
import {
|
|
25
25
|
consola
|
|
@@ -302,6 +302,7 @@ function createFileReloader(server) {
|
|
|
302
302
|
return async (event, path4) => {
|
|
303
303
|
await wxt.reloadConfig();
|
|
304
304
|
if (path4.startsWith(wxt.config.outBaseDir)) return;
|
|
305
|
+
if (path4.startsWith(wxt.config.wxtDir)) return;
|
|
305
306
|
changeQueue.push([event, path4]);
|
|
306
307
|
await fileChangedMutex.runExclusive(async () => {
|
|
307
308
|
if (server.currentOutput == null) return;
|
package/dist/modules.cjs
CHANGED
|
@@ -65,12 +65,11 @@ function addPublicAssets(wxt, dir) {
|
|
|
65
65
|
function addViteConfig(wxt, viteConfig) {
|
|
66
66
|
wxt.hooks.hook("ready", (wxt2) => {
|
|
67
67
|
const userVite = wxt2.config.vite;
|
|
68
|
-
wxt2.config.vite = (env) =>
|
|
69
|
-
|
|
70
|
-
viteConfig(env) ?? {}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
);
|
|
68
|
+
wxt2.config.vite = async (env) => {
|
|
69
|
+
const fromUser = await userVite(env);
|
|
70
|
+
const fromModule = viteConfig(env) ?? {};
|
|
71
|
+
return vite.mergeConfig(fromModule, fromUser);
|
|
72
|
+
};
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
75
|
function addWxtPlugin(wxt, plugin) {
|
package/dist/modules.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-
|
|
1
|
+
import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-B0efqfEK.cjs';
|
|
2
2
|
import * as vite from 'vite';
|
|
3
3
|
import { UnimportOptions } from 'unimport';
|
|
4
4
|
import 'webextension-polyfill';
|
package/dist/modules.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-
|
|
1
|
+
import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-B0efqfEK.js';
|
|
2
2
|
import * as vite from 'vite';
|
|
3
3
|
import { UnimportOptions } from 'unimport';
|
|
4
4
|
import 'webextension-polyfill';
|
package/dist/modules.js
CHANGED
|
@@ -28,12 +28,11 @@ function addPublicAssets(wxt, dir) {
|
|
|
28
28
|
function addViteConfig(wxt, viteConfig) {
|
|
29
29
|
wxt.hooks.hook("ready", (wxt2) => {
|
|
30
30
|
const userVite = wxt2.config.vite;
|
|
31
|
-
wxt2.config.vite = (env) =>
|
|
32
|
-
|
|
33
|
-
viteConfig(env) ?? {}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
);
|
|
31
|
+
wxt2.config.vite = async (env) => {
|
|
32
|
+
const fromUser = await userVite(env);
|
|
33
|
+
const fromModule = viteConfig(env) ?? {};
|
|
34
|
+
return vite.mergeConfig(fromModule, fromUser);
|
|
35
|
+
};
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
function addWxtPlugin(wxt, plugin) {
|
package/dist/testing.cjs
CHANGED
|
@@ -445,7 +445,7 @@ var init_core = __esm({
|
|
|
445
445
|
|
|
446
446
|
// ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/shared/consola.06ad8a64.mjs
|
|
447
447
|
function parseStack(stack) {
|
|
448
|
-
const cwd = process.cwd() +
|
|
448
|
+
const cwd = process.cwd() + import_node_path10.sep;
|
|
449
449
|
const lines = stack.split("\n").splice(1).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
|
|
450
450
|
return lines;
|
|
451
451
|
}
|
|
@@ -453,12 +453,12 @@ function writeStream(data, stream) {
|
|
|
453
453
|
const write = stream.__write || stream.write;
|
|
454
454
|
return write.call(stream, data);
|
|
455
455
|
}
|
|
456
|
-
var import_node_util,
|
|
456
|
+
var import_node_util, import_node_path10, bracket, BasicReporter;
|
|
457
457
|
var init_consola_06ad8a64 = __esm({
|
|
458
458
|
"../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/shared/consola.06ad8a64.mjs"() {
|
|
459
459
|
"use strict";
|
|
460
460
|
import_node_util = require("util");
|
|
461
|
-
|
|
461
|
+
import_node_path10 = require("path");
|
|
462
462
|
bracket = (x) => x ? `[${x}]` : "";
|
|
463
463
|
BasicReporter = class {
|
|
464
464
|
formatStack(stack, opts) {
|
|
@@ -861,7 +861,7 @@ async function prompt(message, opts = {}) {
|
|
|
861
861
|
}
|
|
862
862
|
throw new Error(`Unknown prompt type: ${opts.type}`);
|
|
863
863
|
}
|
|
864
|
-
var import_node_process, import_node_readline, import_node_tty, import_tty, import_node_util2,
|
|
864
|
+
var import_node_process, import_node_readline, import_node_tty, import_tty, import_node_util2, import_node_path11, ESC, CSI, beep, cursor, scroll, erase, src, picocolors, tty2, isColorSupported2, formatter, replaceClose2, createColors2, picocolorsExports, l, m, G, K, Y, v, L, M, T, r, Z, H, q, p, J, b, W, Q, I, w, N, j, X, _, DD, uD, R, V, tD, h, sD, iD, ED, oD, unicode, s, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR, S_BAR_END, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, symbol, text, confirm, select, multiselect;
|
|
865
865
|
var init_prompt = __esm({
|
|
866
866
|
"../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/chunks/prompt.mjs"() {
|
|
867
867
|
"use strict";
|
|
@@ -874,7 +874,7 @@ var init_prompt = __esm({
|
|
|
874
874
|
init_core();
|
|
875
875
|
init_consola_06ad8a64();
|
|
876
876
|
import_node_util2 = require("util");
|
|
877
|
-
|
|
877
|
+
import_node_path11 = require("path");
|
|
878
878
|
ESC = "\x1B";
|
|
879
879
|
CSI = `${ESC}[`;
|
|
880
880
|
beep = "\x07";
|
|
@@ -2154,6 +2154,11 @@ var import_nypm = require("nypm");
|
|
|
2154
2154
|
var import_node_path8 = __toESM(require("path"), 1);
|
|
2155
2155
|
var import_fs_extra3 = require("fs-extra");
|
|
2156
2156
|
|
|
2157
|
+
// src/core/builders/vite/index.ts
|
|
2158
|
+
var import_server = require("vite-node/server");
|
|
2159
|
+
var import_client = require("vite-node/client");
|
|
2160
|
+
var import_source_map = require("vite-node/source-map");
|
|
2161
|
+
|
|
2157
2162
|
// src/core/utils/fs.ts
|
|
2158
2163
|
async function writeFileIfDifferent(file, newContents) {
|
|
2159
2164
|
const existingContents = await import_fs_extra4.default.readFile(file, "utf-8").catch(() => void 0);
|
|
@@ -2167,22 +2172,12 @@ var import_fs_extra5 = __toESM(require("fs-extra"), 1);
|
|
|
2167
2172
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
2168
2173
|
|
|
2169
2174
|
// src/core/utils/building/find-entrypoints.ts
|
|
2170
|
-
var
|
|
2175
|
+
var import_fs_extra6 = __toESM(require("fs-extra"), 1);
|
|
2171
2176
|
var import_minimatch = require("minimatch");
|
|
2172
2177
|
var import_linkedom3 = require("linkedom");
|
|
2173
2178
|
var import_json5 = __toESM(require("json5"), 1);
|
|
2174
2179
|
var import_fast_glob2 = __toESM(require("fast-glob"), 1);
|
|
2175
2180
|
var import_picocolors2 = __toESM(require("picocolors"), 1);
|
|
2176
|
-
|
|
2177
|
-
// src/core/utils/building/import-entrypoint.ts
|
|
2178
|
-
var import_jiti = __toESM(require("jiti"), 1);
|
|
2179
|
-
var import_unimport2 = require("unimport");
|
|
2180
|
-
var import_fs_extra6 = __toESM(require("fs-extra"), 1);
|
|
2181
|
-
var import_node_path9 = require("path");
|
|
2182
|
-
var import_esbuild = require("esbuild");
|
|
2183
|
-
var import_node_url = require("url");
|
|
2184
|
-
|
|
2185
|
-
// src/core/utils/building/find-entrypoints.ts
|
|
2186
2181
|
var PATH_GLOB_TO_TYPE_MAP = {
|
|
2187
2182
|
"sandbox.html": "sandbox",
|
|
2188
2183
|
"sandbox/index.html": "sandbox",
|
|
@@ -2224,29 +2219,29 @@ var PATH_GLOB_TO_TYPE_MAP = {
|
|
|
2224
2219
|
};
|
|
2225
2220
|
|
|
2226
2221
|
// src/core/utils/building/generate-wxt-dir.ts
|
|
2227
|
-
var
|
|
2228
|
-
var
|
|
2229
|
-
var
|
|
2222
|
+
var import_unimport2 = require("unimport");
|
|
2223
|
+
var import_fs_extra7 = __toESM(require("fs-extra"), 1);
|
|
2224
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
2230
2225
|
|
|
2231
2226
|
// src/core/utils/building/resolve-config.ts
|
|
2232
2227
|
var import_c12 = require("c12");
|
|
2233
|
-
var
|
|
2228
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
2234
2229
|
|
|
2235
2230
|
// src/core/utils/cache.ts
|
|
2236
|
-
var
|
|
2231
|
+
var import_fs_extra8 = __toESM(require("fs-extra"), 1);
|
|
2237
2232
|
var import_path2 = require("path");
|
|
2238
2233
|
function createFsCache(wxtDir) {
|
|
2239
2234
|
const getPath = (key) => (0, import_path2.resolve)(wxtDir, "cache", encodeURIComponent(key));
|
|
2240
2235
|
return {
|
|
2241
2236
|
async set(key, value) {
|
|
2242
2237
|
const path8 = getPath(key);
|
|
2243
|
-
await (0,
|
|
2238
|
+
await (0, import_fs_extra8.ensureDir)((0, import_path2.dirname)(path8));
|
|
2244
2239
|
await writeFileIfDifferent(path8, value);
|
|
2245
2240
|
},
|
|
2246
2241
|
async get(key) {
|
|
2247
2242
|
const path8 = getPath(key);
|
|
2248
2243
|
try {
|
|
2249
|
-
return await
|
|
2244
|
+
return await import_fs_extra8.default.readFile(path8, "utf-8");
|
|
2250
2245
|
} catch {
|
|
2251
2246
|
return void 0;
|
|
2252
2247
|
}
|
|
@@ -2262,14 +2257,14 @@ var import_node_process3 = require("process");
|
|
|
2262
2257
|
init_utils();
|
|
2263
2258
|
var import_node_tty2 = require("tty");
|
|
2264
2259
|
var import_node_util3 = require("util");
|
|
2265
|
-
var
|
|
2260
|
+
var import_node_path12 = require("path");
|
|
2266
2261
|
|
|
2267
2262
|
// src/core/utils/building/resolve-config.ts
|
|
2268
2263
|
var import_defu = __toESM(require("defu"), 1);
|
|
2269
2264
|
|
|
2270
2265
|
// src/core/utils/package.ts
|
|
2271
|
-
var
|
|
2272
|
-
var
|
|
2266
|
+
var import_node_path13 = require("path");
|
|
2267
|
+
var import_fs_extra9 = __toESM(require("fs-extra"), 1);
|
|
2273
2268
|
function isModuleInstalled(name) {
|
|
2274
2269
|
return import(
|
|
2275
2270
|
/* @vite-ignore */
|
|
@@ -2278,7 +2273,7 @@ function isModuleInstalled(name) {
|
|
|
2278
2273
|
}
|
|
2279
2274
|
|
|
2280
2275
|
// src/core/utils/building/resolve-config.ts
|
|
2281
|
-
var
|
|
2276
|
+
var import_fs_extra10 = __toESM(require("fs-extra"), 1);
|
|
2282
2277
|
var import_fast_glob3 = __toESM(require("fast-glob"), 1);
|
|
2283
2278
|
var import_meta = {};
|
|
2284
2279
|
async function resolveConfig(inlineConfig, command) {
|
|
@@ -2305,28 +2300,28 @@ async function resolveConfig(inlineConfig, command) {
|
|
|
2305
2300
|
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
2306
2301
|
const mode = mergedConfig.mode ?? COMMAND_MODES[command];
|
|
2307
2302
|
const env2 = { browser, command, manifestVersion, mode };
|
|
2308
|
-
const root =
|
|
2303
|
+
const root = import_node_path14.default.resolve(
|
|
2309
2304
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
2310
2305
|
);
|
|
2311
|
-
const wxtDir =
|
|
2306
|
+
const wxtDir = import_node_path14.default.resolve(root, ".wxt");
|
|
2312
2307
|
const wxtModuleDir = await resolveWxtModuleDir();
|
|
2313
|
-
const srcDir =
|
|
2314
|
-
const entrypointsDir =
|
|
2308
|
+
const srcDir = import_node_path14.default.resolve(root, mergedConfig.srcDir ?? root);
|
|
2309
|
+
const entrypointsDir = import_node_path14.default.resolve(
|
|
2315
2310
|
srcDir,
|
|
2316
2311
|
mergedConfig.entrypointsDir ?? "entrypoints"
|
|
2317
2312
|
);
|
|
2318
|
-
const modulesDir =
|
|
2313
|
+
const modulesDir = import_node_path14.default.resolve(srcDir, mergedConfig.modulesDir ?? "modules");
|
|
2319
2314
|
if (await isDirMissing(entrypointsDir)) {
|
|
2320
2315
|
logMissingDir(logger, "Entrypoints", entrypointsDir);
|
|
2321
2316
|
}
|
|
2322
2317
|
const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
|
|
2323
|
-
const publicDir =
|
|
2318
|
+
const publicDir = import_node_path14.default.resolve(srcDir, mergedConfig.publicDir ?? "public");
|
|
2324
2319
|
if (await isDirMissing(publicDir)) {
|
|
2325
2320
|
logMissingDir(logger, "Public", publicDir);
|
|
2326
2321
|
}
|
|
2327
|
-
const typesDir =
|
|
2328
|
-
const outBaseDir =
|
|
2329
|
-
const outDir =
|
|
2322
|
+
const typesDir = import_node_path14.default.resolve(wxtDir, "types");
|
|
2323
|
+
const outBaseDir = import_node_path14.default.resolve(root, mergedConfig.outDir ?? ".output");
|
|
2324
|
+
const outDir = import_node_path14.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
|
|
2330
2325
|
const reloadCommand = mergedConfig.dev?.reloadCommand ?? "Alt+R";
|
|
2331
2326
|
const runnerConfig = await (0, import_c12.loadConfig)({
|
|
2332
2327
|
name: "web-ext",
|
|
@@ -2343,7 +2338,7 @@ async function resolveConfig(inlineConfig, command) {
|
|
|
2343
2338
|
"~": srcDir,
|
|
2344
2339
|
"@@": root,
|
|
2345
2340
|
"~~": root
|
|
2346
|
-
}).map(([key, value]) => [key,
|
|
2341
|
+
}).map(([key, value]) => [key, import_node_path14.default.resolve(root, value)])
|
|
2347
2342
|
);
|
|
2348
2343
|
let devServerConfig;
|
|
2349
2344
|
if (command === "serve") {
|
|
@@ -2395,7 +2390,7 @@ async function resolveConfig(inlineConfig, command) {
|
|
|
2395
2390
|
alias,
|
|
2396
2391
|
experimental: (0, import_defu.default)(mergedConfig.experimental, {
|
|
2397
2392
|
includeBrowserPolyfill: true,
|
|
2398
|
-
|
|
2393
|
+
entrypointImporter: "jiti"
|
|
2399
2394
|
}),
|
|
2400
2395
|
dev: {
|
|
2401
2396
|
server: devServerConfig,
|
|
@@ -2433,7 +2428,7 @@ async function mergeInlineConfig(inlineConfig, userConfig) {
|
|
|
2433
2428
|
};
|
|
2434
2429
|
}
|
|
2435
2430
|
function resolveZipConfig(root, mergedConfig) {
|
|
2436
|
-
const downloadedPackagesDir =
|
|
2431
|
+
const downloadedPackagesDir = import_node_path14.default.resolve(root, ".wxt/local_modules");
|
|
2437
2432
|
return {
|
|
2438
2433
|
name: void 0,
|
|
2439
2434
|
sourcesTemplate: "{{name}}-{{version}}-sources.zip",
|
|
@@ -2459,12 +2454,12 @@ function resolveZipConfig(root, mergedConfig) {
|
|
|
2459
2454
|
};
|
|
2460
2455
|
}
|
|
2461
2456
|
function resolveAnalysisConfig(root, mergedConfig) {
|
|
2462
|
-
const analysisOutputFile =
|
|
2457
|
+
const analysisOutputFile = import_node_path14.default.resolve(
|
|
2463
2458
|
root,
|
|
2464
2459
|
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
2465
2460
|
);
|
|
2466
|
-
const analysisOutputDir =
|
|
2467
|
-
const analysisOutputName =
|
|
2461
|
+
const analysisOutputDir = import_node_path14.default.dirname(analysisOutputFile);
|
|
2462
|
+
const analysisOutputName = import_node_path14.default.parse(analysisOutputFile).name;
|
|
2468
2463
|
return {
|
|
2469
2464
|
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
2470
2465
|
open: mergedConfig.analysis?.open ?? false,
|
|
@@ -2503,7 +2498,7 @@ async function getUnimportOptions(wxtDir, logger, config) {
|
|
|
2503
2498
|
dirs: ["components", "composables", "hooks", "utils"],
|
|
2504
2499
|
eslintrc: {
|
|
2505
2500
|
enabled,
|
|
2506
|
-
filePath:
|
|
2501
|
+
filePath: import_node_path14.default.resolve(wxtDir, "eslintrc-auto-import.json"),
|
|
2507
2502
|
globalsPropValue: true
|
|
2508
2503
|
}
|
|
2509
2504
|
};
|
|
@@ -2514,15 +2509,15 @@ async function getUnimportOptions(wxtDir, logger, config) {
|
|
|
2514
2509
|
}
|
|
2515
2510
|
async function resolveWxtModuleDir() {
|
|
2516
2511
|
const requireResolve = require?.resolve ?? (await import("module")).default.createRequire(import_meta.url).resolve;
|
|
2517
|
-
return
|
|
2512
|
+
return import_node_path14.default.resolve(requireResolve("wxt"), "../..");
|
|
2518
2513
|
}
|
|
2519
2514
|
async function isDirMissing(dir) {
|
|
2520
|
-
return !await
|
|
2515
|
+
return !await import_fs_extra10.default.exists(dir);
|
|
2521
2516
|
}
|
|
2522
2517
|
function logMissingDir(logger, name, expected) {
|
|
2523
2518
|
logger.warn(
|
|
2524
2519
|
`${name} directory not found: ./${normalizePath(
|
|
2525
|
-
|
|
2520
|
+
import_node_path14.default.relative(process.cwd(), expected)
|
|
2526
2521
|
)}`
|
|
2527
2522
|
);
|
|
2528
2523
|
}
|
|
@@ -2566,7 +2561,7 @@ async function resolveWxtModules(modulesDir, modules = []) {
|
|
|
2566
2561
|
}).catch(() => []);
|
|
2567
2562
|
const localModules = await Promise.all(
|
|
2568
2563
|
localModulePaths.map(async (file) => {
|
|
2569
|
-
const absolutePath = normalizePath(
|
|
2564
|
+
const absolutePath = normalizePath(import_node_path14.default.resolve(modulesDir, file));
|
|
2570
2565
|
const { config } = await (0, import_c12.loadConfig)({
|
|
2571
2566
|
configFile: absolutePath,
|
|
2572
2567
|
globalRc: false,
|
|
@@ -2590,6 +2585,14 @@ async function resolveWxtModules(modulesDir, modules = []) {
|
|
|
2590
2585
|
return [...npmModules, ...localModules];
|
|
2591
2586
|
}
|
|
2592
2587
|
|
|
2588
|
+
// src/core/utils/building/import-entrypoint.ts
|
|
2589
|
+
var import_jiti = __toESM(require("jiti"), 1);
|
|
2590
|
+
var import_unimport3 = require("unimport");
|
|
2591
|
+
var import_fs_extra11 = __toESM(require("fs-extra"), 1);
|
|
2592
|
+
var import_node_path15 = require("path");
|
|
2593
|
+
var import_esbuild = require("esbuild");
|
|
2594
|
+
var import_node_url = require("url");
|
|
2595
|
+
|
|
2593
2596
|
// src/core/utils/building/internal-build.ts
|
|
2594
2597
|
var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
2595
2598
|
var import_fs_extra14 = __toESM(require("fs-extra"), 1);
|
package/dist/testing.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
|
|
2
2
|
import * as vite from 'vite';
|
|
3
|
-
import { I as InlineConfig } from './index-
|
|
3
|
+
import { I as InlineConfig } from './index-B0efqfEK.cjs';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
6
6
|
import 'consola';
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
|
|
2
2
|
import * as vite from 'vite';
|
|
3
|
-
import { I as InlineConfig } from './index-
|
|
3
|
+
import { I as InlineConfig } from './index-B0efqfEK.js';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
6
6
|
import 'consola';
|
package/dist/testing.js
CHANGED
|
@@ -19,30 +19,41 @@ var logger = {
|
|
|
19
19
|
error: (...args) => print(console.error, ...args)
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
// src/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
logger.debug("
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
// src/sandbox/dev-server-websocket.ts
|
|
23
|
+
var ws;
|
|
24
|
+
function getDevServerWebSocket() {
|
|
25
|
+
if (import.meta.env.COMMAND !== "serve")
|
|
26
|
+
throw Error(
|
|
27
|
+
"Must be running WXT dev command to connect to call getDevServerWebSocket()"
|
|
28
|
+
);
|
|
29
|
+
if (ws == null) {
|
|
30
|
+
const serverUrl = `${__DEV_SERVER_PROTOCOL__}//${__DEV_SERVER_HOSTNAME__}:${__DEV_SERVER_PORT__}`;
|
|
31
|
+
logger.debug("Connecting to dev server @", serverUrl);
|
|
32
|
+
ws = new WebSocket(serverUrl, "vite-hmr");
|
|
33
|
+
ws.addWxtEventListener = ws.addEventListener.bind(ws);
|
|
34
|
+
ws.sendCustom = (event, payload) => ws?.send(JSON.stringify({ type: "custom", event, payload }));
|
|
35
|
+
ws.addEventListener("open", () => {
|
|
36
|
+
logger.debug("Connected to dev server");
|
|
37
|
+
});
|
|
38
|
+
ws.addEventListener("close", () => {
|
|
39
|
+
logger.debug("Disconnected from dev server");
|
|
40
|
+
});
|
|
41
|
+
ws.addEventListener("error", (event) => {
|
|
42
|
+
logger.error("Failed to connect to dev server", event);
|
|
43
|
+
});
|
|
44
|
+
ws.addEventListener("message", (e) => {
|
|
45
|
+
try {
|
|
46
|
+
const message = JSON.parse(e.data);
|
|
47
|
+
if (message.type === "custom") {
|
|
48
|
+
ws?.dispatchEvent(
|
|
49
|
+
new CustomEvent(message.event, { detail: message.data })
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
} catch (err) {
|
|
53
|
+
logger.error("Failed to handle message", err);
|
|
41
54
|
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
46
57
|
return ws;
|
|
47
58
|
}
|
|
48
59
|
|
|
@@ -131,16 +142,18 @@ async function reloadContentScriptMv2(_payload) {
|
|
|
131
142
|
// src/virtual/background-entrypoint.ts
|
|
132
143
|
if (import.meta.env.COMMAND === "serve") {
|
|
133
144
|
try {
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
145
|
+
const ws2 = getDevServerWebSocket();
|
|
146
|
+
ws2.addWxtEventListener("wxt:reload-extension", () => {
|
|
147
|
+
browser3.runtime.reload();
|
|
148
|
+
});
|
|
149
|
+
ws2.addWxtEventListener("wxt:reload-content-script", (event) => {
|
|
150
|
+
reloadContentScript(event.detail);
|
|
138
151
|
});
|
|
139
152
|
if (import.meta.env.MANIFEST_VERSION === 3) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
153
|
+
ws2.addEventListener(
|
|
154
|
+
"open",
|
|
155
|
+
() => ws2.sendCustom("wxt:background-initialized")
|
|
156
|
+
);
|
|
144
157
|
keepServiceWorkerAlive();
|
|
145
158
|
}
|
|
146
159
|
} catch (err) {
|
|
@@ -15,42 +15,50 @@ var logger = {
|
|
|
15
15
|
error: (...args) => print(console.error, ...args)
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
// src/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
logger.debug("
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
// src/sandbox/dev-server-websocket.ts
|
|
19
|
+
var ws;
|
|
20
|
+
function getDevServerWebSocket() {
|
|
21
|
+
if (import.meta.env.COMMAND !== "serve")
|
|
22
|
+
throw Error(
|
|
23
|
+
"Must be running WXT dev command to connect to call getDevServerWebSocket()"
|
|
24
|
+
);
|
|
25
|
+
if (ws == null) {
|
|
26
|
+
const serverUrl = `${__DEV_SERVER_PROTOCOL__}//${__DEV_SERVER_HOSTNAME__}:${__DEV_SERVER_PORT__}`;
|
|
27
|
+
logger.debug("Connecting to dev server @", serverUrl);
|
|
28
|
+
ws = new WebSocket(serverUrl, "vite-hmr");
|
|
29
|
+
ws.addWxtEventListener = ws.addEventListener.bind(ws);
|
|
30
|
+
ws.sendCustom = (event, payload) => ws?.send(JSON.stringify({ type: "custom", event, payload }));
|
|
31
|
+
ws.addEventListener("open", () => {
|
|
32
|
+
logger.debug("Connected to dev server");
|
|
33
|
+
});
|
|
34
|
+
ws.addEventListener("close", () => {
|
|
35
|
+
logger.debug("Disconnected from dev server");
|
|
36
|
+
});
|
|
37
|
+
ws.addEventListener("error", (event) => {
|
|
38
|
+
logger.error("Failed to connect to dev server", event);
|
|
39
|
+
});
|
|
40
|
+
ws.addEventListener("message", (e) => {
|
|
41
|
+
try {
|
|
42
|
+
const message = JSON.parse(e.data);
|
|
43
|
+
if (message.type === "custom") {
|
|
44
|
+
ws?.dispatchEvent(
|
|
45
|
+
new CustomEvent(message.event, { detail: message.data })
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
} catch (err) {
|
|
49
|
+
logger.error("Failed to handle message", err);
|
|
37
50
|
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
42
53
|
return ws;
|
|
43
54
|
}
|
|
44
55
|
|
|
45
56
|
// src/virtual/reload-html.ts
|
|
46
57
|
if (import.meta.env.COMMAND === "serve") {
|
|
47
58
|
try {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
location.reload();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
59
|
+
const ws2 = getDevServerWebSocket();
|
|
60
|
+
ws2.addWxtEventListener("wxt:reload-page", (event) => {
|
|
61
|
+
if (event.detail === location.pathname.substring(1)) location.reload();
|
|
54
62
|
});
|
|
55
63
|
} catch (err) {
|
|
56
64
|
logger.error("Failed to setup web socket connection with dev server", err);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.9",
|
|
5
5
|
"description": "Next gen framework for developing web extensions",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -128,6 +128,7 @@
|
|
|
128
128
|
"publish-browser-extension": "^2.1.3",
|
|
129
129
|
"unimport": "^3.7.2",
|
|
130
130
|
"vite": "^5.3.0",
|
|
131
|
+
"vite-node": "^1.6.0",
|
|
131
132
|
"web-ext-run": "^0.2.0",
|
|
132
133
|
"webextension-polyfill": "^0.10.0"
|
|
133
134
|
},
|