wxt 0.18.11 → 0.18.12
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 +6 -6
- package/dist/{chunk-XNTIBS6O.js → chunk-6QN6UXBH.js} +63 -34
- package/dist/cli.js +63 -31
- package/dist/client.d.ts +4 -2
- package/dist/client.js +8 -1
- package/dist/{index-Bk-a0SkY.d.ts → define-app-config-bg54F_lV.d.ts} +21 -1
- package/dist/{index-CER9SLWP.d.ts → index-1N-eQJJh.d.cts} +4 -0
- package/dist/{index-CER9SLWP.d.cts → index-1N-eQJJh.d.ts} +4 -0
- package/dist/index.cjs +172 -140
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +13 -9
- package/dist/modules.d.cts +1 -1
- package/dist/modules.d.ts +1 -1
- package/dist/sandbox.d.ts +2 -1
- package/dist/sandbox.js +6 -0
- package/dist/testing.cjs +75 -54
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +4 -2
- package/package.json +2 -2
- package/dist/cli.d.ts +0 -2
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, ac as CopiedPublicFile, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, ad as GeneratedPublicFile, 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, ab as ResolvedBasePublicFile, 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, af as WxtDirEntry, ah as WxtDirFileEntry, ag as WxtDirTypeReferenceEntry, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ae 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-1N-eQJJh.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, ac as CopiedPublicFile, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, ad as GeneratedPublicFile, 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, ab as ResolvedBasePublicFile, 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, af as WxtDirEntry, ah as WxtDirFileEntry, ag as WxtDirTypeReferenceEntry, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ae as WxtPlugin, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-1N-eQJJh.cjs';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
@@ -76,6 +76,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
|
|
|
76
76
|
*/
|
|
77
77
|
declare function zip(config?: InlineConfig): Promise<string[]>;
|
|
78
78
|
|
|
79
|
-
var version = "0.18.
|
|
79
|
+
var version = "0.18.11";
|
|
80
80
|
|
|
81
81
|
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, ac as CopiedPublicFile, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, ad as GeneratedPublicFile, 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, ab as ResolvedBasePublicFile, 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, af as WxtDirEntry, ah as WxtDirFileEntry, ag as WxtDirTypeReferenceEntry, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ae 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-1N-eQJJh.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, ac as CopiedPublicFile, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, ad as GeneratedPublicFile, 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, ab as ResolvedBasePublicFile, 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, af as WxtDirEntry, ah as WxtDirFileEntry, ag as WxtDirTypeReferenceEntry, b as WxtHooks, a8 as WxtModule, a6 as WxtModuleOptions, a7 as WxtModuleSetup, a9 as WxtModuleWithMetadata, a4 as WxtPackageManager, ae as WxtPlugin, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-1N-eQJJh.js';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
@@ -76,6 +76,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
|
|
|
76
76
|
*/
|
|
77
77
|
declare function zip(config?: InlineConfig): Promise<string[]>;
|
|
78
78
|
|
|
79
|
-
var version = "0.18.
|
|
79
|
+
var version = "0.18.11";
|
|
80
80
|
|
|
81
81
|
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-6QN6UXBH.js";
|
|
23
23
|
import "./chunk-BERPNPEZ.js";
|
|
24
24
|
import "./chunk-6XSIWUWF.js";
|
|
25
25
|
import {
|
|
@@ -141,6 +141,9 @@ function createWebExtRunner() {
|
|
|
141
141
|
...userConfig,
|
|
142
142
|
target: wxt.config.browser === "firefox" ? "firefox-desktop" : "chromium",
|
|
143
143
|
sourceDir: wxt.config.outDir,
|
|
144
|
+
// Don't add a "Reload Manager" extension alongside dev extension, WXT
|
|
145
|
+
// already handles reloads intenrally.
|
|
146
|
+
noReloadManagerExtension: true,
|
|
144
147
|
// WXT handles reloads, so disable auto-reload behaviors in web-ext
|
|
145
148
|
noReload: true,
|
|
146
149
|
noInput: true
|
|
@@ -632,14 +635,15 @@ async function zipDir(directory, outputPath, options) {
|
|
|
632
635
|
}
|
|
633
636
|
}
|
|
634
637
|
await options?.additionalWork?.(archive);
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
compression: "
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
638
|
+
await new Promise(
|
|
639
|
+
(resolve, reject) => archive.generateNodeStream({
|
|
640
|
+
type: "nodebuffer",
|
|
641
|
+
...wxt.config.zip.compressionLevel === 0 ? { compression: "STORE" } : {
|
|
642
|
+
compression: "DEFLATE",
|
|
643
|
+
compressionOptions: { level: wxt.config.zip.compressionLevel }
|
|
644
|
+
}
|
|
645
|
+
}).pipe(fs3.createWriteStream(outputPath)).on("error", reject).on("close", resolve)
|
|
646
|
+
);
|
|
643
647
|
}
|
|
644
648
|
async function downloadPrivatePackages() {
|
|
645
649
|
const overrides = {};
|
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-1N-eQJJh.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-1N-eQJJh.js';
|
|
2
2
|
import * as vite from 'vite';
|
|
3
3
|
import { UnimportOptions } from 'unimport';
|
|
4
4
|
import 'webextension-polyfill';
|
package/dist/sandbox.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { U as UnlistedScriptDefinition, B as BackgroundDefinition, C as ContentScriptDefinition, W as WxtPlugin } from './
|
|
1
|
+
import { U as UnlistedScriptDefinition, B as BackgroundDefinition, C as ContentScriptDefinition, W as WxtPlugin } from './define-app-config-bg54F_lV.js';
|
|
2
|
+
export { a as WxtAppConfig, d as defineAppConfig } from './define-app-config-bg54F_lV.js';
|
|
2
3
|
export * from '@webext-core/match-patterns';
|
|
3
4
|
import 'webextension-polyfill';
|
|
4
5
|
|
package/dist/sandbox.js
CHANGED
|
@@ -20,9 +20,15 @@ function defineWxtPlugin(plugin) {
|
|
|
20
20
|
return plugin;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// src/sandbox/define-app-config.ts
|
|
24
|
+
function defineAppConfig(config) {
|
|
25
|
+
return config;
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
// src/sandbox/index.ts
|
|
24
29
|
export * from "@webext-core/match-patterns";
|
|
25
30
|
export {
|
|
31
|
+
defineAppConfig,
|
|
26
32
|
defineBackground,
|
|
27
33
|
defineContentScript,
|
|
28
34
|
defineUnlistedScript,
|
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_path14.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_path14, 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_path14 = 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_path15, 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_path15 = require("path");
|
|
878
878
|
ESC = "\x1B";
|
|
879
879
|
CSI = `${ESC}[`;
|
|
880
880
|
beep = "\x07";
|
|
@@ -2108,8 +2108,27 @@ var import_node_path7 = require("path");
|
|
|
2108
2108
|
// src/core/builders/vite/plugins/wxtPluginLoader.ts
|
|
2109
2109
|
var import_linkedom2 = require("linkedom");
|
|
2110
2110
|
|
|
2111
|
+
// src/core/builders/vite/plugins/resolveAppConfig.ts
|
|
2112
|
+
var import_fs_extra3 = require("fs-extra");
|
|
2113
|
+
var import_node_path8 = require("path");
|
|
2114
|
+
function resolveAppConfig(config) {
|
|
2115
|
+
const virtualModuleId = "virtual:app-config";
|
|
2116
|
+
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
2117
|
+
const appConfigFile = (0, import_node_path8.resolve)(config.srcDir, "app.config.ts");
|
|
2118
|
+
return {
|
|
2119
|
+
name: "wxt:resolve-app-config",
|
|
2120
|
+
async resolveId(id) {
|
|
2121
|
+
if (id !== virtualModuleId) return;
|
|
2122
|
+
return await (0, import_fs_extra3.exists)(appConfigFile) ? appConfigFile : resolvedVirtualModuleId;
|
|
2123
|
+
},
|
|
2124
|
+
load(id) {
|
|
2125
|
+
if (id === resolvedVirtualModuleId) return `export default {}`;
|
|
2126
|
+
}
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2111
2130
|
// src/core/utils/fs.ts
|
|
2112
|
-
var
|
|
2131
|
+
var import_fs_extra5 = __toESM(require("fs-extra"), 1);
|
|
2113
2132
|
var import_fast_glob2 = __toESM(require("fast-glob"), 1);
|
|
2114
2133
|
|
|
2115
2134
|
// src/core/wxt.ts
|
|
@@ -2119,8 +2138,8 @@ var import_hookable = require("hookable");
|
|
|
2119
2138
|
var import_nypm = require("nypm");
|
|
2120
2139
|
|
|
2121
2140
|
// src/core/package-managers/npm.ts
|
|
2122
|
-
var
|
|
2123
|
-
var
|
|
2141
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
2142
|
+
var import_fs_extra4 = require("fs-extra");
|
|
2124
2143
|
|
|
2125
2144
|
// src/core/builders/vite/index.ts
|
|
2126
2145
|
var import_server = require("vite-node/server");
|
|
@@ -2130,7 +2149,7 @@ var import_source_map = require("vite-node/source-map");
|
|
|
2130
2149
|
// src/modules.ts
|
|
2131
2150
|
var vite = __toESM(require("vite"), 1);
|
|
2132
2151
|
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
2133
|
-
var
|
|
2152
|
+
var import_node_path10 = require("path");
|
|
2134
2153
|
function defineWxtModule(module2) {
|
|
2135
2154
|
if (typeof module2 === "function") return { setup: module2 };
|
|
2136
2155
|
return module2;
|
|
@@ -2148,7 +2167,7 @@ function addViteConfig(wxt2, viteConfig) {
|
|
|
2148
2167
|
|
|
2149
2168
|
// src/builtin-modules/unimport.ts
|
|
2150
2169
|
var import_unimport = require("unimport");
|
|
2151
|
-
var
|
|
2170
|
+
var import_node_path11 = require("path");
|
|
2152
2171
|
var unimport_default = defineWxtModule({
|
|
2153
2172
|
name: "wxt:built-in:unimport",
|
|
2154
2173
|
setup(wxt2) {
|
|
@@ -2195,7 +2214,7 @@ function vitePlugin(unimport) {
|
|
|
2195
2214
|
name: "wxt:unimport",
|
|
2196
2215
|
async transform(code, id) {
|
|
2197
2216
|
if (id.includes("node_modules")) return;
|
|
2198
|
-
if (!ENABLED_EXTENSIONS.has((0,
|
|
2217
|
+
if (!ENABLED_EXTENSIONS.has((0, import_node_path11.extname)(id))) return;
|
|
2199
2218
|
const injected = await unimport.injectImports(code, id);
|
|
2200
2219
|
return {
|
|
2201
2220
|
code: injected.code,
|
|
@@ -2236,6 +2255,7 @@ function getEslint9ConfigEntry(options, globals2) {
|
|
|
2236
2255
|
text: `const globals = ${JSON.stringify(globals2, null, 2)}
|
|
2237
2256
|
|
|
2238
2257
|
export default {
|
|
2258
|
+
name: "wxt/auto-imports",
|
|
2239
2259
|
languageOptions: {
|
|
2240
2260
|
globals,
|
|
2241
2261
|
sourceType: "module",
|
|
@@ -2250,18 +2270,18 @@ var builtinModules = [unimport_default];
|
|
|
2250
2270
|
|
|
2251
2271
|
// src/core/utils/fs.ts
|
|
2252
2272
|
async function writeFileIfDifferent(file, newContents) {
|
|
2253
|
-
const existingContents = await
|
|
2273
|
+
const existingContents = await import_fs_extra5.default.readFile(file, "utf-8").catch(() => void 0);
|
|
2254
2274
|
if (existingContents !== newContents) {
|
|
2255
|
-
await
|
|
2275
|
+
await import_fs_extra5.default.writeFile(file, newContents);
|
|
2256
2276
|
}
|
|
2257
2277
|
}
|
|
2258
2278
|
|
|
2259
2279
|
// src/core/utils/building/build-entrypoints.ts
|
|
2260
|
-
var
|
|
2280
|
+
var import_fs_extra6 = __toESM(require("fs-extra"), 1);
|
|
2261
2281
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
2262
2282
|
|
|
2263
2283
|
// src/core/utils/building/find-entrypoints.ts
|
|
2264
|
-
var
|
|
2284
|
+
var import_fs_extra7 = __toESM(require("fs-extra"), 1);
|
|
2265
2285
|
var import_minimatch = require("minimatch");
|
|
2266
2286
|
var import_linkedom3 = require("linkedom");
|
|
2267
2287
|
var import_json5 = __toESM(require("json5"), 1);
|
|
@@ -2308,29 +2328,29 @@ var PATH_GLOB_TO_TYPE_MAP = {
|
|
|
2308
2328
|
};
|
|
2309
2329
|
|
|
2310
2330
|
// src/core/utils/building/generate-wxt-dir.ts
|
|
2311
|
-
var
|
|
2312
|
-
var
|
|
2313
|
-
var
|
|
2331
|
+
var import_fs_extra8 = __toESM(require("fs-extra"), 1);
|
|
2332
|
+
var import_node_path12 = require("path");
|
|
2333
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
2314
2334
|
|
|
2315
2335
|
// src/core/utils/building/resolve-config.ts
|
|
2316
2336
|
var import_c12 = require("c12");
|
|
2317
|
-
var
|
|
2337
|
+
var import_node_path17 = __toESM(require("path"), 1);
|
|
2318
2338
|
|
|
2319
2339
|
// src/core/utils/cache.ts
|
|
2320
|
-
var
|
|
2340
|
+
var import_fs_extra9 = __toESM(require("fs-extra"), 1);
|
|
2321
2341
|
var import_path = require("path");
|
|
2322
2342
|
function createFsCache(wxtDir) {
|
|
2323
2343
|
const getPath = (key) => (0, import_path.resolve)(wxtDir, "cache", encodeURIComponent(key));
|
|
2324
2344
|
return {
|
|
2325
2345
|
async set(key, value) {
|
|
2326
2346
|
const path8 = getPath(key);
|
|
2327
|
-
await (0,
|
|
2347
|
+
await (0, import_fs_extra9.ensureDir)((0, import_path.dirname)(path8));
|
|
2328
2348
|
await writeFileIfDifferent(path8, value);
|
|
2329
2349
|
},
|
|
2330
2350
|
async get(key) {
|
|
2331
2351
|
const path8 = getPath(key);
|
|
2332
2352
|
try {
|
|
2333
|
-
return await
|
|
2353
|
+
return await import_fs_extra9.default.readFile(path8, "utf-8");
|
|
2334
2354
|
} catch {
|
|
2335
2355
|
return void 0;
|
|
2336
2356
|
}
|
|
@@ -2346,11 +2366,11 @@ var import_node_process3 = require("process");
|
|
|
2346
2366
|
init_utils();
|
|
2347
2367
|
var import_node_tty2 = require("tty");
|
|
2348
2368
|
var import_node_util3 = require("util");
|
|
2349
|
-
var
|
|
2369
|
+
var import_node_path16 = require("path");
|
|
2350
2370
|
|
|
2351
2371
|
// src/core/utils/building/resolve-config.ts
|
|
2352
2372
|
var import_defu = __toESM(require("defu"), 1);
|
|
2353
|
-
var
|
|
2373
|
+
var import_fs_extra10 = __toESM(require("fs-extra"), 1);
|
|
2354
2374
|
var import_fast_glob4 = __toESM(require("fast-glob"), 1);
|
|
2355
2375
|
|
|
2356
2376
|
// src/core/utils/eslint.ts
|
|
@@ -2393,28 +2413,28 @@ async function resolveConfig(inlineConfig, command) {
|
|
|
2393
2413
|
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
2394
2414
|
const mode = mergedConfig.mode ?? COMMAND_MODES[command];
|
|
2395
2415
|
const env2 = { browser, command, manifestVersion, mode };
|
|
2396
|
-
const root =
|
|
2416
|
+
const root = import_node_path17.default.resolve(
|
|
2397
2417
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
2398
2418
|
);
|
|
2399
|
-
const wxtDir =
|
|
2419
|
+
const wxtDir = import_node_path17.default.resolve(root, ".wxt");
|
|
2400
2420
|
const wxtModuleDir = await resolveWxtModuleDir();
|
|
2401
|
-
const srcDir =
|
|
2402
|
-
const entrypointsDir =
|
|
2421
|
+
const srcDir = import_node_path17.default.resolve(root, mergedConfig.srcDir ?? root);
|
|
2422
|
+
const entrypointsDir = import_node_path17.default.resolve(
|
|
2403
2423
|
srcDir,
|
|
2404
2424
|
mergedConfig.entrypointsDir ?? "entrypoints"
|
|
2405
2425
|
);
|
|
2406
|
-
const modulesDir =
|
|
2426
|
+
const modulesDir = import_node_path17.default.resolve(srcDir, mergedConfig.modulesDir ?? "modules");
|
|
2407
2427
|
if (await isDirMissing(entrypointsDir)) {
|
|
2408
2428
|
logMissingDir(logger, "Entrypoints", entrypointsDir);
|
|
2409
2429
|
}
|
|
2410
2430
|
const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
|
|
2411
|
-
const publicDir =
|
|
2431
|
+
const publicDir = import_node_path17.default.resolve(srcDir, mergedConfig.publicDir ?? "public");
|
|
2412
2432
|
if (await isDirMissing(publicDir)) {
|
|
2413
2433
|
logMissingDir(logger, "Public", publicDir);
|
|
2414
2434
|
}
|
|
2415
|
-
const typesDir =
|
|
2416
|
-
const outBaseDir =
|
|
2417
|
-
const outDir =
|
|
2435
|
+
const typesDir = import_node_path17.default.resolve(wxtDir, "types");
|
|
2436
|
+
const outBaseDir = import_node_path17.default.resolve(root, mergedConfig.outDir ?? ".output");
|
|
2437
|
+
const outDir = import_node_path17.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
|
|
2418
2438
|
const reloadCommand = mergedConfig.dev?.reloadCommand ?? "Alt+R";
|
|
2419
2439
|
const runnerConfig = await (0, import_c12.loadConfig)({
|
|
2420
2440
|
name: "web-ext",
|
|
@@ -2431,7 +2451,7 @@ async function resolveConfig(inlineConfig, command) {
|
|
|
2431
2451
|
"~": srcDir,
|
|
2432
2452
|
"@@": root,
|
|
2433
2453
|
"~~": root
|
|
2434
|
-
}).map(([key, value]) => [key,
|
|
2454
|
+
}).map(([key, value]) => [key, import_node_path17.default.resolve(root, value)])
|
|
2435
2455
|
);
|
|
2436
2456
|
let devServerConfig;
|
|
2437
2457
|
if (command === "serve") {
|
|
@@ -2528,7 +2548,7 @@ async function mergeInlineConfig(inlineConfig, userConfig) {
|
|
|
2528
2548
|
};
|
|
2529
2549
|
}
|
|
2530
2550
|
function resolveZipConfig(root, outBaseDir, mergedConfig) {
|
|
2531
|
-
const downloadedPackagesDir =
|
|
2551
|
+
const downloadedPackagesDir = import_node_path17.default.resolve(root, ".wxt/local_modules");
|
|
2532
2552
|
return {
|
|
2533
2553
|
name: void 0,
|
|
2534
2554
|
sourcesTemplate: "{{name}}-{{version}}-sources.zip",
|
|
@@ -2547,7 +2567,7 @@ function resolveZipConfig(root, outBaseDir, mergedConfig) {
|
|
|
2547
2567
|
"**/__tests__/**",
|
|
2548
2568
|
"**/*.+(test|spec).?(c|m)+(j|t)s?(x)",
|
|
2549
2569
|
// Output directory
|
|
2550
|
-
`${
|
|
2570
|
+
`${import_node_path17.default.relative(root, outBaseDir)}/**`,
|
|
2551
2571
|
// From user
|
|
2552
2572
|
...mergedConfig.zip?.excludeSources ?? []
|
|
2553
2573
|
],
|
|
@@ -2556,12 +2576,12 @@ function resolveZipConfig(root, outBaseDir, mergedConfig) {
|
|
|
2556
2576
|
};
|
|
2557
2577
|
}
|
|
2558
2578
|
function resolveAnalysisConfig(root, mergedConfig) {
|
|
2559
|
-
const analysisOutputFile =
|
|
2579
|
+
const analysisOutputFile = import_node_path17.default.resolve(
|
|
2560
2580
|
root,
|
|
2561
2581
|
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
2562
2582
|
);
|
|
2563
|
-
const analysisOutputDir =
|
|
2564
|
-
const analysisOutputName =
|
|
2583
|
+
const analysisOutputDir = import_node_path17.default.dirname(analysisOutputFile);
|
|
2584
|
+
const analysisOutputName = import_node_path17.default.parse(analysisOutputFile).name;
|
|
2565
2585
|
return {
|
|
2566
2586
|
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
2567
2587
|
open: mergedConfig.analysis?.open ?? false,
|
|
@@ -2617,7 +2637,7 @@ async function getUnimportEslintOptions(wxtDir, options) {
|
|
|
2617
2637
|
}
|
|
2618
2638
|
return {
|
|
2619
2639
|
enabled: eslintEnabled,
|
|
2620
|
-
filePath:
|
|
2640
|
+
filePath: import_node_path17.default.resolve(
|
|
2621
2641
|
wxtDir,
|
|
2622
2642
|
eslintEnabled === 9 ? "eslint-auto-imports.mjs" : "eslintrc-auto-import.json"
|
|
2623
2643
|
),
|
|
@@ -2626,15 +2646,15 @@ async function getUnimportEslintOptions(wxtDir, options) {
|
|
|
2626
2646
|
}
|
|
2627
2647
|
async function resolveWxtModuleDir() {
|
|
2628
2648
|
const requireResolve = require?.resolve ?? (await import("module")).default.createRequire(import_meta2.url).resolve;
|
|
2629
|
-
return
|
|
2649
|
+
return import_node_path17.default.resolve(requireResolve("wxt"), "../..");
|
|
2630
2650
|
}
|
|
2631
2651
|
async function isDirMissing(dir) {
|
|
2632
|
-
return !await
|
|
2652
|
+
return !await import_fs_extra10.default.exists(dir);
|
|
2633
2653
|
}
|
|
2634
2654
|
function logMissingDir(logger, name, expected) {
|
|
2635
2655
|
logger.warn(
|
|
2636
2656
|
`${name} directory not found: ./${normalizePath(
|
|
2637
|
-
|
|
2657
|
+
import_node_path17.default.relative(process.cwd(), expected)
|
|
2638
2658
|
)}`
|
|
2639
2659
|
);
|
|
2640
2660
|
}
|
|
@@ -2678,7 +2698,7 @@ async function resolveWxtUserModules(modulesDir, modules = []) {
|
|
|
2678
2698
|
}).catch(() => []);
|
|
2679
2699
|
const localModules = await Promise.all(
|
|
2680
2700
|
localModulePaths.map(async (file) => {
|
|
2681
|
-
const absolutePath = normalizePath(
|
|
2701
|
+
const absolutePath = normalizePath(import_node_path17.default.resolve(modulesDir, file));
|
|
2682
2702
|
const { config } = await (0, import_c12.loadConfig)({
|
|
2683
2703
|
configFile: absolutePath,
|
|
2684
2704
|
globalRc: false,
|
|
@@ -2705,19 +2725,19 @@ async function resolveWxtUserModules(modulesDir, modules = []) {
|
|
|
2705
2725
|
// src/core/utils/building/import-entrypoint.ts
|
|
2706
2726
|
var import_jiti = __toESM(require("jiti"), 1);
|
|
2707
2727
|
var import_unimport3 = require("unimport");
|
|
2708
|
-
var
|
|
2709
|
-
var
|
|
2728
|
+
var import_fs_extra11 = __toESM(require("fs-extra"), 1);
|
|
2729
|
+
var import_node_path18 = require("path");
|
|
2710
2730
|
var import_esbuild = require("esbuild");
|
|
2711
2731
|
var import_node_url = require("url");
|
|
2712
2732
|
|
|
2713
2733
|
// src/core/utils/building/internal-build.ts
|
|
2714
2734
|
var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
2715
|
-
var
|
|
2735
|
+
var import_fs_extra15 = __toESM(require("fs-extra"), 1);
|
|
2716
2736
|
|
|
2717
2737
|
// src/core/utils/log/printFileList.ts
|
|
2718
|
-
var
|
|
2738
|
+
var import_node_path19 = __toESM(require("path"), 1);
|
|
2719
2739
|
var import_picocolors3 = __toESM(require("picocolors"), 1);
|
|
2720
|
-
var
|
|
2740
|
+
var import_fs_extra12 = __toESM(require("fs-extra"), 1);
|
|
2721
2741
|
var import_filesize = require("filesize");
|
|
2722
2742
|
var DEFAULT_COLOR = import_picocolors3.default.blue;
|
|
2723
2743
|
var CHUNK_COLORS = {
|
|
@@ -2739,17 +2759,17 @@ var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
|
2739
2759
|
var import_fast_glob5 = __toESM(require("fast-glob"), 1);
|
|
2740
2760
|
|
|
2741
2761
|
// src/core/utils/manifest.ts
|
|
2742
|
-
var
|
|
2762
|
+
var import_fs_extra14 = __toESM(require("fs-extra"), 1);
|
|
2743
2763
|
|
|
2744
2764
|
// src/core/utils/package.ts
|
|
2745
|
-
var
|
|
2746
|
-
var
|
|
2765
|
+
var import_node_path20 = require("path");
|
|
2766
|
+
var import_fs_extra13 = __toESM(require("fs-extra"), 1);
|
|
2747
2767
|
|
|
2748
2768
|
// src/core/utils/manifest.ts
|
|
2749
2769
|
var import_defu2 = __toESM(require("defu"), 1);
|
|
2750
2770
|
|
|
2751
2771
|
// src/core/utils/building/internal-build.ts
|
|
2752
|
-
var
|
|
2772
|
+
var import_node_path21 = require("path");
|
|
2753
2773
|
var import_rollup_plugin_visualizer2 = require("@aklinker1/rollup-plugin-visualizer");
|
|
2754
2774
|
var import_ci_info = require("ci-info");
|
|
2755
2775
|
|
|
@@ -2761,7 +2781,8 @@ function WxtVitest(inlineConfig) {
|
|
|
2761
2781
|
webextensionPolyfillMock(config),
|
|
2762
2782
|
globals(config),
|
|
2763
2783
|
download(config),
|
|
2764
|
-
tsconfigPaths(config)
|
|
2784
|
+
tsconfigPaths(config),
|
|
2785
|
+
resolveAppConfig(config)
|
|
2765
2786
|
];
|
|
2766
2787
|
if (config.imports !== false) {
|
|
2767
2788
|
const unimport = (0, import_unimport5.createUnimport)(config.imports);
|
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-1N-eQJJh.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-1N-eQJJh.js';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
6
6
|
import 'consola';
|
package/dist/testing.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
download,
|
|
3
3
|
globals,
|
|
4
|
+
resolveAppConfig,
|
|
4
5
|
resolveConfig,
|
|
5
6
|
tsconfigPaths,
|
|
6
7
|
vitePlugin,
|
|
7
8
|
webextensionPolyfillMock
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6QN6UXBH.js";
|
|
9
10
|
import "./chunk-BERPNPEZ.js";
|
|
10
11
|
import "./chunk-6XSIWUWF.js";
|
|
11
12
|
import "./chunk-BM6QYGAW.js";
|
|
@@ -22,7 +23,8 @@ function WxtVitest(inlineConfig) {
|
|
|
22
23
|
webextensionPolyfillMock(config),
|
|
23
24
|
globals(config),
|
|
24
25
|
download(config),
|
|
25
|
-
tsconfigPaths(config)
|
|
26
|
+
tsconfigPaths(config),
|
|
27
|
+
resolveAppConfig(config)
|
|
26
28
|
];
|
|
27
29
|
if (config.imports !== false) {
|
|
28
30
|
const unimport = createUnimport(config.imports);
|
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.12",
|
|
5
5
|
"description": "Next gen framework for developing web extensions",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"unimport": "^3.7.2",
|
|
130
130
|
"vite": "^5.3.2",
|
|
131
131
|
"vite-node": "^1.6.0",
|
|
132
|
-
"web-ext-run": "^0.2.
|
|
132
|
+
"web-ext-run": "^0.2.1",
|
|
133
133
|
"webextension-polyfill": "^0.10.0"
|
|
134
134
|
},
|
|
135
135
|
"devDependencies": {
|
package/dist/cli.d.ts
DELETED