wxt 0.21.4 → 0.21.5
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 +1 -1
- package/dist/{core/build.d.mts → build.d.mts} +2 -2
- package/dist/{core/build.mjs → build.mjs} +3 -4
- package/dist/{core/clean.d.mts → clean.d.mts} +2 -2
- package/dist/{core/clean.mjs → clean.mjs} +3 -3
- package/dist/cli/cli-utils.mjs +6 -6
- package/dist/cli/commands.mjs +10 -9
- package/dist/{core/create-server.d.mts → create-server.d.mts} +2 -2
- package/dist/{core/create-server.mjs → create-server.mjs} +13 -14
- package/dist/define-config.d.mts +6 -0
- package/dist/{core/define-config.mjs → define-config.mjs} +1 -1
- package/dist/{core/define-web-ext-config.d.mts → define-web-ext-config.d.mts} +2 -2
- package/dist/{core/define-web-ext-config.mjs → define-web-ext-config.mjs} +1 -1
- package/dist/index.d.mts +12 -12
- package/dist/index.mjs +10 -11
- package/dist/{core/initialize.d.mts → initialize.d.mts} +2 -1
- package/dist/{core/initialize.mjs → initialize.mjs} +22 -7
- package/dist/inline/dotenv-expand/index.mjs +31 -0
- package/dist/{core/utils/building → internal}/build-entrypoints.mjs +5 -5
- package/dist/internal/builders/unknown.mjs +22 -0
- package/dist/{core → internal}/builders/vite/index.mjs +136 -138
- package/dist/internal/builders/vite/plugins/add-entrypoint-group-runtime-env-entries.mjs +16 -0
- package/dist/internal/builders/vite/plugins/add-runtime-env-entries.mjs +14 -0
- package/dist/{core/builders/vite/plugins/bundleAnalysis.mjs → internal/builders/vite/plugins/bundle-analysis.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/cssEntrypoints.mjs → internal/builders/vite/plugins/css-entrypoints.mjs} +2 -2
- package/dist/{core/builders/vite/plugins/defineImportMeta.mjs → internal/builders/vite/plugins/define-import-meta.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/devHtmlPrerender.mjs → internal/builders/vite/plugins/dev-html-prerender.mjs} +4 -5
- package/dist/{core/builders/vite/plugins/devServerGlobals.mjs → internal/builders/vite/plugins/dev-server-globals.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/extensionApiMock.mjs → internal/builders/vite/plugins/extension-api-mock.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/iifeAnonymous.mjs → internal/builders/vite/plugins/iife-anonymous.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/iifeFooter.mjs → internal/builders/vite/plugins/iife-footer.mjs} +1 -1
- package/dist/internal/builders/vite/plugins/index.mjs +17 -0
- package/dist/{core/builders/vite/plugins/noopBackground.mjs → internal/builders/vite/plugins/noop-background.mjs} +2 -2
- package/dist/{core/builders/vite/plugins/removeEntrypointMainFunction.mjs → internal/builders/vite/plugins/remove-entrypoint-main-function.mjs} +3 -4
- package/dist/{core/builders/vite/plugins/resolveAppConfig.mjs → internal/builders/vite/plugins/resolve-app-config.mjs} +2 -2
- package/dist/{core/builders/vite/plugins/resolveVirtualModules.mjs → internal/builders/vite/plugins/resolve-virtual-modules.mjs} +8 -6
- package/dist/{core/builders/vite/plugins/tsconfigPaths.mjs → internal/builders/vite/plugins/tsconfig-paths.mjs} +1 -1
- package/dist/internal/builders/vite/plugins/wxt-plugin-loader.mjs +77 -0
- package/dist/{builtin-modules → internal/builtin-modules}/escape-unicode.mjs +2 -2
- package/dist/{builtin-modules → internal/builtin-modules}/favicon-permission.mjs +2 -2
- package/dist/{builtin-modules → internal/builtin-modules}/index.mjs +4 -2
- package/dist/internal/builtin-modules/plugins.mjs +21 -0
- package/dist/{builtin-modules → internal/builtin-modules}/unimport.mjs +17 -6
- package/dist/{core/utils → internal}/constants.mjs +1 -1
- package/dist/internal/detect-builder.mjs +9 -0
- package/dist/{core/utils/building → internal}/detect-dev-changes.mjs +4 -4
- package/dist/internal/detect-runner.mjs +11 -0
- package/dist/internal/entrypoint-finders/flat.mjs +84 -0
- package/dist/internal/environments/browser-environment.mjs +48 -0
- package/dist/{core/utils → internal}/environments/environment.mjs +1 -1
- package/dist/{core/utils → internal}/environments/extension-environment.mjs +1 -1
- package/dist/{core/utils/create-file-reloader.mjs → internal/file-reloader.mjs} +10 -11
- package/dist/{core/utils/building → internal}/find-entrypoints.mjs +8 -73
- package/dist/{core → internal}/generate-wxt-dir.mjs +10 -10
- package/dist/internal/get-public-files.mjs +14 -0
- package/dist/{core/utils/building → internal}/group-entrypoints.mjs +1 -1
- package/dist/{core/utils → internal}/i18n.mjs +1 -1
- package/dist/{core/utils/building → internal}/internal-build.mjs +10 -10
- package/dist/{core → internal}/keyboard-shortcuts.mjs +1 -1
- package/dist/{core/utils → internal}/manifest.mjs +9 -9
- package/dist/{core → internal}/package-managers/bun.mjs +1 -1
- package/dist/{core → internal}/package-managers/deno.mjs +1 -1
- package/dist/{core → internal}/package-managers/index.mjs +1 -1
- package/dist/{core → internal}/package-managers/npm.mjs +1 -1
- package/dist/{core → internal}/package-managers/pnpm.mjs +1 -1
- package/dist/{core → internal}/package-managers/yarn.mjs +1 -1
- package/dist/{core/utils → internal}/package.mjs +3 -3
- package/dist/{core/utils/building → internal}/rebuild.mjs +5 -5
- package/dist/{core → internal}/resolve-config.mjs +14 -32
- package/dist/internal/runners/manual.mjs +22 -0
- package/dist/internal/runners/web-ext.mjs +79 -0
- package/dist/{core/utils/globals.mjs → internal/runtime-env-entries.mjs} +4 -4
- package/dist/{core/utils → internal}/spinner.mjs +1 -1
- package/dist/{core/utils → internal}/syntax-errors.mjs +2 -2
- package/dist/{core/utils → internal}/theme-icons.mjs +3 -3
- package/dist/{core/utils → internal}/transform.mjs +1 -1
- package/dist/{core/utils → internal}/validation.mjs +1 -1
- package/dist/{core → internal}/wxt.mjs +24 -7
- package/dist/{core/utils/arrays.mjs → internal-utils/array-utils.mjs} +1 -1
- package/dist/{core/utils/cache.mjs → internal-utils/cache-utils.mjs} +3 -3
- package/dist/{core/utils/content-scripts.mjs → internal-utils/content-script-utils.mjs} +2 -2
- package/dist/{core/utils/content-security-policy.mjs → internal-utils/csp-utils.mjs} +1 -1
- package/dist/{core/utils/entrypoints.d.mts → internal-utils/entrypoint-utils.d.mts} +2 -2
- package/dist/{core/utils/entrypoints.mjs → internal-utils/entrypoint-utils.mjs} +2 -2
- package/dist/{core/utils/env.mjs → internal-utils/env-utils.mjs} +3 -3
- package/dist/internal-utils/eslint-utils.mjs +8 -0
- package/dist/{core/utils/fs.mjs → internal-utils/fs-utils.mjs} +2 -12
- package/dist/internal-utils/log/index.mjs +6 -0
- package/dist/{core/utils/log/printBuildSummary.mjs → internal-utils/log/print-build-summary.mjs} +3 -3
- package/dist/{core/utils/log/printFileList.mjs → internal-utils/log/print-file-list.mjs} +7 -6
- package/dist/{core/utils/log/printHeader.mjs → internal-utils/log/print-header.mjs} +2 -2
- package/dist/{core/utils/log/printTable.mjs → internal-utils/log/print-table.mjs} +1 -1
- package/dist/{core/utils/log/wxtLogger.mjs → internal-utils/log/wxt-logger.mjs} +1 -1
- package/dist/internal-utils/module-utils.mjs +32 -0
- package/dist/{core/utils/number.mjs → internal-utils/number-utils.mjs} +1 -1
- package/dist/{core/utils/paths.d.mts → internal-utils/path-utils.d.mts} +1 -1
- package/dist/{core/utils/paths.mjs → internal-utils/path-utils.mjs} +2 -2
- package/dist/{core/utils/strings.mjs → internal-utils/string-utils.mjs} +2 -2
- package/dist/{core/utils/time.mjs → internal-utils/time-utils.mjs} +1 -1
- package/dist/{core/utils/types.d.mts → internal-utils/type-utils.d.mts} +2 -1
- package/dist/{modules.d.mts → modules/index.d.mts} +10 -4
- package/dist/{modules.mjs → modules/index.mjs} +14 -5
- package/dist/prepare.d.mts +6 -0
- package/dist/prepare.mjs +11 -0
- package/dist/testing/wxt-vitest-plugin.mjs +7 -7
- package/dist/types.d.mts +72 -19
- package/dist/utils/content-script-context.d.mts +1 -1
- package/dist/utils/content-script-ui/iframe.d.mts +5 -0
- package/dist/utils/content-script-ui/integrated.d.mts +5 -0
- package/dist/utils/content-script-ui/shadow-root.d.mts +5 -0
- package/dist/utils/content-script-ui/types.d.mts +23 -7
- package/dist/utils/internal/custom-events.d.mts +11 -1
- package/dist/utils/internal/custom-events.mjs +4 -0
- package/dist/version.mjs +1 -1
- package/dist/virtual/background-entrypoint.mjs +11 -0
- package/dist/{core/zip.d.mts → zip.d.mts} +2 -2
- package/dist/{core/zip.mjs → zip.mjs} +11 -13
- package/package.json +7 -7
- package/dist/core/builders/vite/plugins/entrypointGroupGlobals.mjs +0 -16
- package/dist/core/builders/vite/plugins/globals.mjs +0 -14
- package/dist/core/builders/vite/plugins/index.mjs +0 -17
- package/dist/core/builders/vite/plugins/wxtPluginLoader.mjs +0 -56
- package/dist/core/define-config.d.mts +0 -6
- package/dist/core/index.d.mts +0 -10
- package/dist/core/index.mjs +0 -12
- package/dist/core/prepare.d.mts +0 -6
- package/dist/core/prepare.mjs +0 -12
- package/dist/core/runners/manual.mjs +0 -11
- package/dist/core/runners/safari.mjs +0 -14
- package/dist/core/runners/web-ext.mjs +0 -63
- package/dist/core/runners/wsl.mjs +0 -14
- package/dist/core/utils/building/index.mjs +0 -7
- package/dist/core/utils/environments/browser-environment.mjs +0 -18
- package/dist/core/utils/eslint.mjs +0 -11
- package/dist/core/utils/index.d.mts +0 -2
- package/dist/core/utils/index.mjs +0 -3
- package/dist/core/utils/log/index.mjs +0 -6
- /package/dist/{core/utils → internal}/environments/index.mjs +0 -0
- /package/dist/{core/utils → internal}/virtual-modules.mjs +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Entrypoint, Wxt, WxtModule, WxtModuleOptions, WxtModuleSetup } from "
|
|
1
|
+
import { Entrypoint, Wxt, WxtModule, WxtModuleOptions, WxtModuleSetup } from "../types.mjs";
|
|
2
2
|
import { UnimportOptions } from "unimport";
|
|
3
3
|
import * as vite from "vite";
|
|
4
4
|
|
|
5
|
-
//#region src/modules.d.ts
|
|
5
|
+
//#region src/modules/index.d.ts
|
|
6
6
|
declare function defineWxtModule<TOptions extends WxtModuleOptions>(module: WxtModule<TOptions> | WxtModuleSetup<TOptions>): WxtModule<TOptions>;
|
|
7
7
|
/**
|
|
8
8
|
* Adds a TS/JS file as an entrypoint to the project. This file will be bundled
|
|
@@ -71,14 +71,20 @@ declare function addViteConfig(wxt: Wxt, viteConfig: (env: vite.ConfigEnv) => vi
|
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
73
73
|
* export default defineWxtModule((wxt) => {
|
|
74
|
-
* addWxtPlugin(
|
|
74
|
+
* addWxtPlugin(
|
|
75
|
+
* wxt,
|
|
76
|
+
* 'wxt-module-analytics/background-plugin',
|
|
77
|
+
* (entrypoint) => entrypoint.type === 'background',
|
|
78
|
+
* );
|
|
75
79
|
* });
|
|
76
80
|
*
|
|
77
81
|
* @param wxt The wxt instance provided by the module's setup function.
|
|
78
82
|
* @param plugin An import from an NPM module, or an absolute file path to the
|
|
79
83
|
* file to load at runtime.
|
|
84
|
+
* @param apply Optional. Return `true` to load the plugin in the given
|
|
85
|
+
* entrypoint. Defaults to loading the plugin in every entrypoint.
|
|
80
86
|
*/
|
|
81
|
-
declare function addWxtPlugin(wxt: Wxt, plugin: string): void;
|
|
87
|
+
declare function addWxtPlugin(wxt: Wxt, plugin: string, apply?: (entrypoint: Entrypoint) => boolean): void;
|
|
82
88
|
/**
|
|
83
89
|
* Add an Unimport preset
|
|
84
90
|
* ([built-in](https://github.com/unjs/unimport?tab=readme-ov-file#built-in-presets),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { glob } from "tinyglobby";
|
|
2
1
|
import { resolve } from "node:path";
|
|
3
|
-
|
|
2
|
+
import { glob } from "tinyglobby";
|
|
3
|
+
//#region src/modules/index.ts
|
|
4
4
|
function defineWxtModule(module) {
|
|
5
5
|
if (typeof module === "function") return { setup: module };
|
|
6
6
|
return module;
|
|
@@ -102,16 +102,25 @@ function addViteConfig(wxt, viteConfig) {
|
|
|
102
102
|
*
|
|
103
103
|
* @example
|
|
104
104
|
* export default defineWxtModule((wxt) => {
|
|
105
|
-
* addWxtPlugin(
|
|
105
|
+
* addWxtPlugin(
|
|
106
|
+
* wxt,
|
|
107
|
+
* 'wxt-module-analytics/background-plugin',
|
|
108
|
+
* (entrypoint) => entrypoint.type === 'background',
|
|
109
|
+
* );
|
|
106
110
|
* });
|
|
107
111
|
*
|
|
108
112
|
* @param wxt The wxt instance provided by the module's setup function.
|
|
109
113
|
* @param plugin An import from an NPM module, or an absolute file path to the
|
|
110
114
|
* file to load at runtime.
|
|
115
|
+
* @param apply Optional. Return `true` to load the plugin in the given
|
|
116
|
+
* entrypoint. Defaults to loading the plugin in every entrypoint.
|
|
111
117
|
*/
|
|
112
|
-
function addWxtPlugin(wxt, plugin) {
|
|
118
|
+
function addWxtPlugin(wxt, plugin, apply) {
|
|
113
119
|
wxt.hooks.hook("config:resolved", (wxt) => {
|
|
114
|
-
wxt.config.plugins.push(
|
|
120
|
+
wxt.config.plugins.push({
|
|
121
|
+
module: plugin,
|
|
122
|
+
apply
|
|
123
|
+
});
|
|
115
124
|
});
|
|
116
125
|
}
|
|
117
126
|
/**
|
package/dist/prepare.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { registerWxt, wxt } from "./internal/wxt.mjs";
|
|
2
|
+
import { findEntrypoints } from "./internal/find-entrypoints.mjs";
|
|
3
|
+
import { generateWxtDir } from "./internal/generate-wxt-dir.mjs";
|
|
4
|
+
//#region src/prepare.ts
|
|
5
|
+
async function prepare(config) {
|
|
6
|
+
await registerWxt("build", config);
|
|
7
|
+
wxt.logger.info("Generating types...");
|
|
8
|
+
await generateWxtDir(await findEntrypoints());
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { prepare };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import "../
|
|
6
|
-
import { registerWxt, wxt } from "../
|
|
1
|
+
import { addRuntimeEnvEntries } from "../internal/builders/vite/plugins/add-runtime-env-entries.mjs";
|
|
2
|
+
import { extensionApiMock } from "../internal/builders/vite/plugins/extension-api-mock.mjs";
|
|
3
|
+
import { resolveAppConfig } from "../internal/builders/vite/plugins/resolve-app-config.mjs";
|
|
4
|
+
import { tsconfigPaths } from "../internal/builders/vite/plugins/tsconfig-paths.mjs";
|
|
5
|
+
import "../internal/builders/vite/plugins/index.mjs";
|
|
6
|
+
import { registerWxt, wxt } from "../internal/wxt.mjs";
|
|
7
7
|
import UnimportPlugin from "unimport/unplugin";
|
|
8
8
|
//#region src/testing/wxt-vitest-plugin.ts
|
|
9
9
|
/**
|
|
@@ -26,7 +26,7 @@ import UnimportPlugin from "unimport/unplugin";
|
|
|
26
26
|
async function WxtVitest(inlineConfig) {
|
|
27
27
|
await registerWxt("serve", inlineConfig ?? {});
|
|
28
28
|
const plugins = [
|
|
29
|
-
|
|
29
|
+
addRuntimeEnvEntries(wxt.config),
|
|
30
30
|
tsconfigPaths(wxt.config),
|
|
31
31
|
resolveAppConfig(wxt.config),
|
|
32
32
|
extensionApiMock(wxt.config)
|
package/dist/types.d.mts
CHANGED
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
* });
|
|
20
20
|
* });
|
|
21
21
|
*/import { ContentScriptContext } from "./utils/content-script-context.mjs";
|
|
22
|
-
import { ManifestContentScript } from "./
|
|
22
|
+
import { ManifestContentScript } from "./internal-utils/type-utils.mjs";
|
|
23
23
|
import { Hookable, NestedHooks } from "hookable";
|
|
24
24
|
import { Import, UnimportOptions } from "unimport";
|
|
25
|
-
import { PluginVisualizerOptions } from "@aklinker1/rollup-plugin-visualizer";
|
|
26
25
|
import * as Nypm from "nypm";
|
|
27
26
|
import { ResolvedConfig } from "c12";
|
|
28
27
|
import { LogLevel } from "consola";
|
|
28
|
+
import { PluginVisualizerOptions } from "@aklinker1/rollup-plugin-visualizer";
|
|
29
29
|
import { Browser } from "@wxt-dev/browser";
|
|
30
30
|
import * as vite from "vite";
|
|
31
31
|
|
|
@@ -544,8 +544,8 @@ interface WxtHooks {
|
|
|
544
544
|
* Called when WXT has created Vite's config for the dev server. Useful if you
|
|
545
545
|
* want to add plugins or update the vite config per entrypoint group.
|
|
546
546
|
*
|
|
547
|
-
* @param
|
|
548
|
-
*
|
|
547
|
+
* @param config The config that will be used to build the entrypoints. Can be
|
|
548
|
+
* updated by reference.
|
|
549
549
|
*/
|
|
550
550
|
'vite:devServer:extendConfig': (config: vite.InlineConfig) => HookResult;
|
|
551
551
|
}
|
|
@@ -635,8 +635,8 @@ interface Logger {
|
|
|
635
635
|
level: LogLevel;
|
|
636
636
|
}
|
|
637
637
|
/**
|
|
638
|
-
* The logger available at `wxt.logger`. Extends
|
|
639
|
-
* which only logs a message once per process.
|
|
638
|
+
* The logger available at `wxt.logger` and `wxt.config.logger`. Extends
|
|
639
|
+
* {@link Logger} with a `warnOnce` which only logs a message once per process.
|
|
640
640
|
*/
|
|
641
641
|
interface WxtLogger extends Logger {
|
|
642
642
|
/**
|
|
@@ -683,7 +683,7 @@ interface BaseScriptEntrypointOptions extends BaseEntrypointOptions {
|
|
|
683
683
|
* the default IIFE variable name may conflict with an existing variable on
|
|
684
684
|
* the target page. This applies to content scripts with world=MAIN, and
|
|
685
685
|
* others, such as unlisted scripts, that could be dynamically injected into
|
|
686
|
-
* the page with a
|
|
686
|
+
* the page with a `<script>` tag.
|
|
687
687
|
*
|
|
688
688
|
* Available options:
|
|
689
689
|
*
|
|
@@ -1088,7 +1088,7 @@ interface ConfigEnv {
|
|
|
1088
1088
|
/**
|
|
1089
1089
|
* Manifest version passed in from the CLI via the `--mv2` or `--mv3` flags.
|
|
1090
1090
|
* When not passed, it depends on the target browser. See [the
|
|
1091
|
-
* guide](https://wxt.dev/guide/
|
|
1091
|
+
* guide](https://wxt.dev/guide/essentials/target-different-browsers.html#target-a-manifest-version)
|
|
1092
1092
|
* for more details.
|
|
1093
1093
|
*/
|
|
1094
1094
|
manifestVersion: 2 | 3;
|
|
@@ -1295,7 +1295,7 @@ interface WxtHooks {
|
|
|
1295
1295
|
* Called once all entrypoints have been grouped into their build groups.
|
|
1296
1296
|
*
|
|
1297
1297
|
* @param wxt The configured WXT object
|
|
1298
|
-
* @param
|
|
1298
|
+
* @param groups The list of groups to build in each build step
|
|
1299
1299
|
*/
|
|
1300
1300
|
'entrypoints:grouped': (wxt: Wxt, groups: EntrypointGroup[]) => HookResult;
|
|
1301
1301
|
/**
|
|
@@ -1303,7 +1303,7 @@ interface WxtHooks {
|
|
|
1303
1303
|
* reference to add or remove public files.
|
|
1304
1304
|
*
|
|
1305
1305
|
* @param wxt The configured WXT object
|
|
1306
|
-
* @param
|
|
1306
|
+
* @param files The list of files that will be copied into the output
|
|
1307
1307
|
* directory
|
|
1308
1308
|
*/
|
|
1309
1309
|
'build:publicAssets': (wxt: Wxt, files: ResolvedPublicFile[]) => HookResult;
|
|
@@ -1377,7 +1377,7 @@ interface Wxt {
|
|
|
1377
1377
|
hooks: Hookable<WxtHooks>;
|
|
1378
1378
|
/** Alias for `wxt.hooks.hook(...)`. */
|
|
1379
1379
|
hook: Hookable<WxtHooks>['hook'];
|
|
1380
|
-
/**
|
|
1380
|
+
/** Alias for `config.logger`. */
|
|
1381
1381
|
logger: WxtLogger;
|
|
1382
1382
|
/** Reload config file and update `wxt.config` with the result. */
|
|
1383
1383
|
reloadConfig: () => Promise<void>;
|
|
@@ -1385,8 +1385,39 @@ interface Wxt {
|
|
|
1385
1385
|
pm: WxtPackageManager;
|
|
1386
1386
|
/** If the dev server was started, it will be available. */
|
|
1387
1387
|
server?: WxtDevServer;
|
|
1388
|
-
/**
|
|
1388
|
+
/**
|
|
1389
|
+
* The module in charge of executing all the build steps.
|
|
1390
|
+
*
|
|
1391
|
+
* To override the entire builder process, set this value in a module's
|
|
1392
|
+
* `setup` function or during the `config:resolved` hook.
|
|
1393
|
+
*
|
|
1394
|
+
* ```ts
|
|
1395
|
+
* wxt.build = new MyBuilder(wxt.config);
|
|
1396
|
+
* ```
|
|
1397
|
+
*/
|
|
1389
1398
|
builder: WxtBuilder;
|
|
1399
|
+
/**
|
|
1400
|
+
* Service responsible for discovering entrypoints in a project.
|
|
1401
|
+
*
|
|
1402
|
+
* To override how entrypoints are discovered, set this value in a module's
|
|
1403
|
+
* `setup` function or during the `config:resolved` hook.
|
|
1404
|
+
*
|
|
1405
|
+
* ```ts
|
|
1406
|
+
* wxt.entrypointFinder = new MyEntrypointFinder(wxt.config);
|
|
1407
|
+
* ```
|
|
1408
|
+
*/
|
|
1409
|
+
entrypointFinder: EntrypointFinder;
|
|
1410
|
+
/**
|
|
1411
|
+
* Service responsible for opening the browser during dev mode.
|
|
1412
|
+
*
|
|
1413
|
+
* To override how the browser is opened, set this value in a module's `setup`
|
|
1414
|
+
* function or during the `config:resolved` hook.
|
|
1415
|
+
*
|
|
1416
|
+
* ```ts
|
|
1417
|
+
* wxt.runner = new MyRunner(wxt.config);
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1420
|
+
runner: ExtensionRunner;
|
|
1390
1421
|
}
|
|
1391
1422
|
interface ResolvedConfig$1 {
|
|
1392
1423
|
root: string;
|
|
@@ -1434,6 +1465,7 @@ interface ResolvedConfig$1 {
|
|
|
1434
1465
|
manifest: UserManifest;
|
|
1435
1466
|
fsCache: FsCache;
|
|
1436
1467
|
webExt: ResolvedConfig<WebExtConfig>;
|
|
1468
|
+
/** @deprecated Use `wxt.runner` instead of `wxt.config.runner` */
|
|
1437
1469
|
runner: ExtensionRunner;
|
|
1438
1470
|
zip: {
|
|
1439
1471
|
name?: string;
|
|
@@ -1503,13 +1535,27 @@ interface ResolvedConfig$1 {
|
|
|
1503
1535
|
builtinModules: WxtModule<any>[];
|
|
1504
1536
|
userModules: WxtModuleWithMetadata<any>[];
|
|
1505
1537
|
/**
|
|
1506
|
-
*
|
|
1507
|
-
* by vite, and
|
|
1538
|
+
* Plugins registered via `addWxtPlugin`. Each entry's `module` should be
|
|
1539
|
+
* resolvable by vite, and should `export default defineWxtPlugin(...)`. An
|
|
1540
|
+
* optional `apply` function restricts which entrypoints the plugin loads in.
|
|
1508
1541
|
*
|
|
1509
1542
|
* @example
|
|
1510
|
-
* ['@wxt-dev/module-vue/plugin'
|
|
1543
|
+
* [{ module: '@wxt-dev/module-vue/plugin' }];
|
|
1511
1544
|
*/
|
|
1512
|
-
plugins: string
|
|
1545
|
+
plugins: Array<string | WxtPluginEntry>;
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* A plugin registered via `addWxtPlugin`, along with an optional `apply`
|
|
1549
|
+
* function controlling which entrypoints it's loaded in.
|
|
1550
|
+
*/
|
|
1551
|
+
interface WxtPluginEntry {
|
|
1552
|
+
/** Import path or absolute file path to the plugin module. */
|
|
1553
|
+
module: string;
|
|
1554
|
+
/**
|
|
1555
|
+
* Return `true` to include the plugin in this entrypoint. When omitted, the
|
|
1556
|
+
* plugin is included in every entrypoint.
|
|
1557
|
+
*/
|
|
1558
|
+
apply?: (entrypoint: Entrypoint) => boolean;
|
|
1513
1559
|
}
|
|
1514
1560
|
interface FsCache {
|
|
1515
1561
|
set(key: string, value: string): Promise<void>;
|
|
@@ -1519,7 +1565,7 @@ interface ExtensionRunner {
|
|
|
1519
1565
|
openBrowser(): Promise<void>;
|
|
1520
1566
|
closeBrowser?(): Promise<void>;
|
|
1521
1567
|
/** Whether or not this runner actually opens the browser. */
|
|
1522
|
-
canOpen?(): boolean
|
|
1568
|
+
canOpen?(): Promise<boolean>;
|
|
1523
1569
|
}
|
|
1524
1570
|
type EslintGlobalsPropValue = boolean | 'readonly' | 'readable' | 'writable' | 'writeable';
|
|
1525
1571
|
type EslintConfigVersion = 8 | 9;
|
|
@@ -1564,7 +1610,7 @@ type WxtUnimportOptions = Partial<UnimportOptions> & {
|
|
|
1564
1610
|
* extended, fixes these lint errors.
|
|
1565
1611
|
*
|
|
1566
1612
|
* See
|
|
1567
|
-
* [https://wxt.dev/guide/
|
|
1613
|
+
* [https://wxt.dev/guide/essentials/config/auto-imports.html#eslint](https://wxt.dev/guide/essentials/config/auto-imports.html#eslint)
|
|
1568
1614
|
*/
|
|
1569
1615
|
eslintrc?: Eslintrc;
|
|
1570
1616
|
};
|
|
@@ -1697,5 +1743,12 @@ interface WxtDirFileEntry {
|
|
|
1697
1743
|
/** Set to `true` to add a reference to this file in `.wxt/wxt.d.ts`. */
|
|
1698
1744
|
tsReference?: boolean;
|
|
1699
1745
|
}
|
|
1746
|
+
interface EntrypointFinder {
|
|
1747
|
+
/**
|
|
1748
|
+
* @returns A list of file paths (absolute or relative to
|
|
1749
|
+
* `wxt.config.rootDir`) to load as entrypoints for.
|
|
1750
|
+
*/
|
|
1751
|
+
findEntrypoints(): Promise<EntrypointInfo[]> | EntrypointInfo[];
|
|
1752
|
+
}
|
|
1700
1753
|
//#endregion
|
|
1701
|
-
export { BackgroundDefinition, BackgroundEntrypoint, BackgroundEntrypointOptions, BaseContentScriptEntrypointOptions, BaseEntrypoint, BaseEntrypointOptions, BaseScriptEntrypointOptions, BuildOutput, BuildStepOutput, ConfigEnv, ContentScriptDefinition, ContentScriptEntrypoint, CopiedPublicFile, Dependency, Entrypoint, EntrypointGroup, EntrypointInfo, EslintConfigVersion, EslintGlobalsPropValue, Eslintrc, ExtensionRunner, FirefoxDataCollectionPermissions, FirefoxDataCollectionType, FsCache, GeneratedPublicFile, GenericEntrypoint, HookResult, InlineConfig, IsolatedWorldContentScriptDefinition, IsolatedWorldContentScriptEntrypointOptions, Logger, MainWorldContentScriptDefinition, MainWorldContentScriptEntrypointOptions, OnContentScriptStopped, OptionsEntrypoint, OptionsEntrypointOptions, OutputAsset, OutputChunk, OutputFile, PerBrowserMap, PerBrowserOption, PopupEntrypoint, PopupEntrypointOptions, PrepareTsconfigs, PublicPathEntry, ReloadContentScriptPayload, ResolvedBasePublicFile, ResolvedConfig$1 as ResolvedConfig, ResolvedEslintrc, ResolvedPerBrowserOptions, ResolvedPublicFile, ServerInfo, SidepanelEntrypoint, SidepanelEntrypointOptions, TargetBrowser, TargetManifestVersion, ThemeIcon, UnlistedScriptDefinition, UnlistedScriptEntrypoint, UserConfig, UserManifest, UserManifestFn, WebExtConfig, Wxt, WxtBuilder, WxtBuilderServer, WxtCommand, WxtDevServer, WxtDirEntry, WxtDirFileEntry, WxtDirTypeReferenceEntry, WxtHooks, WxtLogger, WxtModule, WxtModuleOptions, WxtModuleSetup, WxtModuleWithMetadata, WxtPackageManager, WxtPlugin, WxtResolvedUnimportOptions, WxtUnimportOptions, WxtViteConfig };
|
|
1754
|
+
export { BackgroundDefinition, BackgroundEntrypoint, BackgroundEntrypointOptions, BaseContentScriptEntrypointOptions, BaseEntrypoint, BaseEntrypointOptions, BaseScriptEntrypointOptions, BuildOutput, BuildStepOutput, ConfigEnv, ContentScriptDefinition, ContentScriptEntrypoint, CopiedPublicFile, Dependency, Entrypoint, EntrypointFinder, EntrypointGroup, EntrypointInfo, EslintConfigVersion, EslintGlobalsPropValue, Eslintrc, ExtensionRunner, FirefoxDataCollectionPermissions, FirefoxDataCollectionType, FsCache, GeneratedPublicFile, GenericEntrypoint, HookResult, InlineConfig, IsolatedWorldContentScriptDefinition, IsolatedWorldContentScriptEntrypointOptions, Logger, MainWorldContentScriptDefinition, MainWorldContentScriptEntrypointOptions, OnContentScriptStopped, OptionsEntrypoint, OptionsEntrypointOptions, OutputAsset, OutputChunk, OutputFile, PerBrowserMap, PerBrowserOption, PopupEntrypoint, PopupEntrypointOptions, PrepareTsconfigs, PublicPathEntry, ReloadContentScriptPayload, ResolvedBasePublicFile, ResolvedConfig$1 as ResolvedConfig, ResolvedEslintrc, ResolvedPerBrowserOptions, ResolvedPublicFile, ServerInfo, SidepanelEntrypoint, SidepanelEntrypointOptions, TargetBrowser, TargetManifestVersion, ThemeIcon, UnlistedScriptDefinition, UnlistedScriptEntrypoint, UserConfig, UserManifest, UserManifestFn, WebExtConfig, Wxt, WxtBuilder, WxtBuilderServer, WxtCommand, WxtDevServer, WxtDirEntry, WxtDirFileEntry, WxtDirTypeReferenceEntry, WxtHooks, WxtLogger, WxtModule, WxtModuleOptions, WxtModuleSetup, WxtModuleWithMetadata, WxtPackageManager, WxtPlugin, WxtPluginEntry, WxtResolvedUnimportOptions, WxtUnimportOptions, WxtViteConfig };
|
|
@@ -141,4 +141,4 @@ interface WxtWindowEventMap extends WindowEventMap {
|
|
|
141
141
|
'wxt:locationchange': WxtLocationChangeEvent;
|
|
142
142
|
}
|
|
143
143
|
//#endregion
|
|
144
|
-
export { ContentScriptContext, WxtWindowEventMap };
|
|
144
|
+
export { ContentScriptContext, type WxtLocationChangeEvent, WxtWindowEventMap };
|
|
@@ -17,6 +17,11 @@ interface IframeContentScriptUi<TMounted> extends ContentScriptUi<TMounted> {
|
|
|
17
17
|
/** A wrapper div that assists in positioning. */
|
|
18
18
|
wrapper: HTMLDivElement;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* {@inheritDoc wxt/utils/content-script-ui/types!ContentScriptUiOptions}
|
|
22
|
+
*
|
|
23
|
+
* @interface
|
|
24
|
+
*/
|
|
20
25
|
type IframeContentScriptUiOptions<TMounted> = ContentScriptUiOptions<TMounted> & {
|
|
21
26
|
/**
|
|
22
27
|
* The path to the HTML page that will be shown in the iframe. This string
|
|
@@ -19,6 +19,11 @@ interface IntegratedContentScriptUi<TMounted> extends ContentScriptUi<TMounted>
|
|
|
19
19
|
/** A wrapper div that assists in positioning. */
|
|
20
20
|
wrapper: HTMLElement;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* {@inheritDoc wxt/utils/content-script-ui/types!ContentScriptUiOptions}
|
|
24
|
+
*
|
|
25
|
+
* @interface
|
|
26
|
+
*/
|
|
22
27
|
type IntegratedContentScriptUiOptions<TMounted> = ContentScriptUiOptions<TMounted> & {
|
|
23
28
|
/**
|
|
24
29
|
* Tag used to create the wrapper element.
|
|
@@ -28,6 +28,11 @@ interface ShadowRootContentScriptUi<TMounted> extends ContentScriptUi<TMounted>
|
|
|
28
28
|
/** The shadow root performing the isolation. */
|
|
29
29
|
shadow: ShadowRoot;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* {@inheritDoc wxt/utils/content-script-ui/types!ContentScriptUiOptions}
|
|
33
|
+
*
|
|
34
|
+
* @interface
|
|
35
|
+
*/
|
|
31
36
|
type ShadowRootContentScriptUiOptions<TMounted> = ContentScriptUiOptions<TMounted> & {
|
|
32
37
|
/**
|
|
33
38
|
* The name of the custom component used to host the ShadowRoot. Must be
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
interface ContentScriptUi<TMounted> extends MountFunctions {
|
|
4
4
|
mounted: TMounted | undefined;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Options shared by integrated, shadow root, and iframe UIs.
|
|
8
|
+
*
|
|
9
|
+
* `position` selects `"inline"`, `"overlay"`, or `"modal"` positioning.
|
|
10
|
+
* `zIndex` controls the positioning element's stacking level for overlays and
|
|
11
|
+
* modals. `alignment` is available for overlays.
|
|
12
|
+
*/
|
|
6
13
|
type ContentScriptUiOptions<TMounted> = ContentScriptPositioningOptions & ContentScriptAnchoredOptions & {
|
|
7
14
|
/**
|
|
8
15
|
* Callback called before the UI is removed from the webpage. Use to cleanup
|
|
@@ -20,19 +27,24 @@ type ContentScriptOverlayAlignment = 'top-left' | 'top-right' | 'bottom-left' |
|
|
|
20
27
|
* modes](https://wxt.dev/content-script-ui-append.png)
|
|
21
28
|
*/
|
|
22
29
|
type ContentScriptAppendMode = 'last' | 'first' | 'replace' | 'before' | 'after' | ((anchor: Element, ui: Element) => void);
|
|
30
|
+
/** Inline positioning does not support `zIndex` or `alignment`. */
|
|
23
31
|
interface ContentScriptInlinePositioningOptions {
|
|
32
|
+
/** Choose between `"inline"`, `"overlay"`, or `"modal"` positioning. */
|
|
24
33
|
position: 'inline';
|
|
34
|
+
zIndex?: never;
|
|
35
|
+
alignment?: never;
|
|
25
36
|
}
|
|
26
37
|
interface ContentScriptOverlayPositioningOptions {
|
|
27
38
|
position: 'overlay';
|
|
28
39
|
/**
|
|
29
|
-
* The `z-index` used on the
|
|
40
|
+
* The `z-index` used on the positioning element. Set to a positive number to
|
|
30
41
|
* show your UI over website content.
|
|
31
42
|
*/
|
|
32
43
|
zIndex?: number;
|
|
33
44
|
/**
|
|
34
|
-
* When using `
|
|
35
|
-
* Alignment specifies which corner is aligned with that 0x0 pixel
|
|
45
|
+
* When using `position: "overlay"`, the mounted element is 0px by 0px in
|
|
46
|
+
* size. Alignment specifies which corner is aligned with that 0x0 pixel
|
|
47
|
+
* space.
|
|
36
48
|
*
|
|
37
49
|
* [Visualization of alignment
|
|
38
50
|
* options](https://wxt.dev/content-script-ui-alignment.png)
|
|
@@ -41,13 +53,17 @@ interface ContentScriptOverlayPositioningOptions {
|
|
|
41
53
|
*/
|
|
42
54
|
alignment?: ContentScriptOverlayAlignment;
|
|
43
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Modal positioning options.
|
|
58
|
+
*
|
|
59
|
+
* @property zIndex The `z-index` used on the `shadowHost` element. Set to a
|
|
60
|
+
* positive number to show your UI over website content.
|
|
61
|
+
* @property alignment Only available when `position` is `"overlay"`.
|
|
62
|
+
*/
|
|
44
63
|
interface ContentScriptModalPositioningOptions {
|
|
45
64
|
position: 'modal';
|
|
46
|
-
/**
|
|
47
|
-
* The `z-index` used on the `shadowHost`. Set to a positive number to show
|
|
48
|
-
* your UI over website content.
|
|
49
|
-
*/
|
|
50
65
|
zIndex?: number;
|
|
66
|
+
alignment?: never;
|
|
51
67
|
}
|
|
52
68
|
/**
|
|
53
69
|
* Choose between `"inline"`, `"overlay"`, or `"modal"` positions.
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
//#region src/utils/internal/custom-events.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Fired on `window` as `wxt:locationchange` when a content script detects a
|
|
4
|
+
* same-document URL change.
|
|
5
|
+
*/
|
|
2
6
|
declare class WxtLocationChangeEvent extends Event {
|
|
7
|
+
/** The URL after the change. */
|
|
3
8
|
readonly newUrl: URL;
|
|
9
|
+
/** The URL before the change. */
|
|
4
10
|
readonly oldUrl: URL;
|
|
5
11
|
static EVENT_NAME: string;
|
|
6
|
-
constructor(
|
|
12
|
+
constructor(/** The URL after the change. */
|
|
13
|
+
|
|
14
|
+
newUrl: URL, /** The URL before the change. */
|
|
15
|
+
|
|
16
|
+
oldUrl: URL);
|
|
7
17
|
}
|
|
8
18
|
//#endregion
|
|
9
19
|
export { WxtLocationChangeEvent };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { browser } from "wxt/browser";
|
|
2
2
|
//#region src/utils/internal/custom-events.ts
|
|
3
|
+
/**
|
|
4
|
+
* Fired on `window` as `wxt:locationchange` when a content script detects a
|
|
5
|
+
* same-document URL change.
|
|
6
|
+
*/
|
|
3
7
|
var WxtLocationChangeEvent = class WxtLocationChangeEvent extends Event {
|
|
4
8
|
static EVENT_NAME = getUniqueEventName("wxt:locationchange");
|
|
5
9
|
constructor(newUrl, oldUrl) {
|
package/dist/version.mjs
CHANGED
|
@@ -69,8 +69,19 @@ async function reloadContentScriptMv3({ registration, contentScript }) {
|
|
|
69
69
|
if (registration === "runtime") await reloadRuntimeContentScriptMv3(contentScript);
|
|
70
70
|
else await reloadManifestContentScriptMv3(contentScript);
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Reloads of one script run one after another. Two reloads that overlap can
|
|
74
|
+
* both read an empty registration list and both register, and the second
|
|
75
|
+
* registration throws "Duplicate script ID".
|
|
76
|
+
*/
|
|
77
|
+
const manifestReloads = /* @__PURE__ */ new Map();
|
|
72
78
|
async function reloadManifestContentScriptMv3(contentScript) {
|
|
73
79
|
const id = `wxt:${contentScript.js[0]}`;
|
|
80
|
+
const reload = (manifestReloads.get(id) ?? Promise.resolve()).then(() => reloadManifestContentScriptNow(id, contentScript));
|
|
81
|
+
manifestReloads.set(id, reload.catch(() => {}));
|
|
82
|
+
return reload;
|
|
83
|
+
}
|
|
84
|
+
async function reloadManifestContentScriptNow(id, contentScript) {
|
|
74
85
|
logger.log("Reloading content script:", contentScript);
|
|
75
86
|
const registered = await browser.scripting.getRegisteredContentScripts();
|
|
76
87
|
logger.debug("Existing scripts:", registered);
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { normalizePath } from "./utils/
|
|
2
|
-
import "./utils/
|
|
3
|
-
import {
|
|
4
|
-
import { registerWxt, wxt } from "./wxt.mjs";
|
|
5
|
-
import { findEntrypoints } from "./
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import "./
|
|
9
|
-
import {
|
|
10
|
-
import { internalBuild } from "./utils/building/internal-build.mjs";
|
|
11
|
-
import "./utils/building/index.mjs";
|
|
1
|
+
import { normalizePath } from "./internal-utils/path-utils.mjs";
|
|
2
|
+
import { safeFilename } from "./internal-utils/string-utils.mjs";
|
|
3
|
+
import { formatDuration } from "./internal-utils/time-utils.mjs";
|
|
4
|
+
import { registerWxt, wxt } from "./internal/wxt.mjs";
|
|
5
|
+
import { findEntrypoints } from "./internal/find-entrypoints.mjs";
|
|
6
|
+
import { printFileList } from "./internal-utils/log/print-file-list.mjs";
|
|
7
|
+
import "./internal-utils/log/index.mjs";
|
|
8
|
+
import { getPackageJson } from "./internal/package.mjs";
|
|
9
|
+
import { internalBuild } from "./internal/internal-build.mjs";
|
|
12
10
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
13
|
-
import { glob } from "tinyglobby";
|
|
14
11
|
import path from "node:path";
|
|
12
|
+
import { glob } from "tinyglobby";
|
|
15
13
|
import { createZip } from "@aklinker1/zero-zip";
|
|
16
|
-
//#region src/
|
|
14
|
+
//#region src/zip.ts
|
|
17
15
|
/**
|
|
18
16
|
* Build and zip the extension for distribution.
|
|
19
17
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.21.
|
|
4
|
+
"version": "0.21.5",
|
|
5
5
|
"description": "⚡ Next-gen Web Extension Framework",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"prepack": "bun run build"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@1natsu/wait-element": "^
|
|
18
|
+
"@1natsu/wait-element": "^5.0.0",
|
|
19
19
|
"@aklinker1/rollup-plugin-visualizer": "5.12.0",
|
|
20
20
|
"@aklinker1/zero-zip": "^1.0.1",
|
|
21
21
|
"@topcli/prompts": "^4.0.0",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"chokidar": "^5.0.0",
|
|
30
30
|
"consola": "^3.4.2",
|
|
31
31
|
"defu": "^6.1.4",
|
|
32
|
-
"dotenv-expand": "^13.0.0",
|
|
33
32
|
"filesize": "^11.0.17",
|
|
34
33
|
"giget": "^1.2.3 || ^2.0.0 || ^3.0.0",
|
|
35
34
|
"hookable": "^6.1.0",
|
|
@@ -38,7 +37,7 @@
|
|
|
38
37
|
"magicast": "^0.5.2",
|
|
39
38
|
"nypm": "^0.6.5",
|
|
40
39
|
"picomatch": "^4.0.3",
|
|
41
|
-
"publish-browser-extension": "^
|
|
40
|
+
"publish-browser-extension": "^6.0.0",
|
|
42
41
|
"superlock": "^1.3.2",
|
|
43
42
|
"tiny-open": "^1.3.0",
|
|
44
43
|
"tinyexec": "^1.2.4",
|
|
@@ -65,12 +64,13 @@
|
|
|
65
64
|
"devDependencies": {
|
|
66
65
|
"@aklinker1/buildc": "^1.1.7",
|
|
67
66
|
"@faker-js/faker": "^10.3.0",
|
|
68
|
-
"@types/bun": "^1.
|
|
67
|
+
"@types/bun": "^1.4.4",
|
|
69
68
|
"@types/lodash.merge": "^4.6.9",
|
|
70
69
|
"@types/node": "^22",
|
|
71
70
|
"@types/normalize-path": "^3.0.2",
|
|
72
71
|
"@types/picomatch": "^4.0.2",
|
|
73
72
|
"@types/prompts": "^2.4.9",
|
|
73
|
+
"dotenv-expand": "^13.0.0",
|
|
74
74
|
"eslint": "^10.1.0",
|
|
75
75
|
"extract-zip": "^2.0.1",
|
|
76
76
|
"get-port-please": "^3.2.0",
|
|
@@ -199,8 +199,8 @@
|
|
|
199
199
|
"types": "./dist/vite-builder-env.d.ts"
|
|
200
200
|
},
|
|
201
201
|
"./modules": {
|
|
202
|
-
"types": "./dist/modules.d.mts",
|
|
203
|
-
"default": "./dist/modules.mjs"
|
|
202
|
+
"types": "./dist/modules/index.d.mts",
|
|
203
|
+
"default": "./dist/modules/index.mjs"
|
|
204
204
|
}
|
|
205
205
|
},
|
|
206
206
|
"engines": {
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { getEntrypointGlobals } from "../../../utils/globals.mjs";
|
|
2
|
-
//#region src/core/builders/vite/plugins/entrypointGroupGlobals.ts
|
|
3
|
-
/** Define a set of global variables specific to an entrypoint. */
|
|
4
|
-
function entrypointGroupGlobals(entrypointGroup) {
|
|
5
|
-
return {
|
|
6
|
-
name: "wxt:entrypoint-group-globals",
|
|
7
|
-
config() {
|
|
8
|
-
const define = {};
|
|
9
|
-
let name = Array.isArray(entrypointGroup) ? "html" : entrypointGroup.name;
|
|
10
|
-
for (const global of getEntrypointGlobals(name)) define[`import.meta.env.${global.name}`] = JSON.stringify(global.value);
|
|
11
|
-
return { define };
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { entrypointGroupGlobals };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { getGlobals } from "../../../utils/globals.mjs";
|
|
2
|
-
//#region src/core/builders/vite/plugins/globals.ts
|
|
3
|
-
function globals(config) {
|
|
4
|
-
return {
|
|
5
|
-
name: "wxt:globals",
|
|
6
|
-
config() {
|
|
7
|
-
const define = {};
|
|
8
|
-
for (const global of getGlobals(config)) define[`import.meta.env.${global.name}`] = JSON.stringify(global.value);
|
|
9
|
-
return { define };
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { globals };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "./devHtmlPrerender.mjs";
|
|
2
|
-
import "./devServerGlobals.mjs";
|
|
3
|
-
import "./resolveVirtualModules.mjs";
|
|
4
|
-
import "./tsconfigPaths.mjs";
|
|
5
|
-
import "./noopBackground.mjs";
|
|
6
|
-
import "./cssEntrypoints.mjs";
|
|
7
|
-
import "./bundleAnalysis.mjs";
|
|
8
|
-
import "./globals.mjs";
|
|
9
|
-
import "./extensionApiMock.mjs";
|
|
10
|
-
import "./entrypointGroupGlobals.mjs";
|
|
11
|
-
import "./defineImportMeta.mjs";
|
|
12
|
-
import "./removeEntrypointMainFunction.mjs";
|
|
13
|
-
import "./wxtPluginLoader.mjs";
|
|
14
|
-
import "./resolveAppConfig.mjs";
|
|
15
|
-
import "./iifeFooter.mjs";
|
|
16
|
-
import "./iifeAnonymous.mjs";
|
|
17
|
-
export {};
|