wxt 0.18.15 → 0.19.0
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/bin/wxt.mjs +1 -1
- package/dist/browser/chrome.d.ts +17 -0
- package/dist/browser/chrome.mjs +7 -0
- package/dist/browser/index.d.ts +18 -0
- package/dist/browser/index.mjs +2 -0
- package/dist/builtin-modules/index.d.ts +2 -0
- package/dist/builtin-modules/index.mjs +2 -0
- package/dist/builtin-modules/unimport.d.ts +8 -0
- package/dist/builtin-modules/unimport.mjs +99 -0
- package/dist/cli/cli-utils.d.ts +25 -0
- package/dist/cli/cli-utils.mjs +58 -0
- package/dist/cli/commands.d.ts +2 -0
- package/dist/cli/commands.mjs +104 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.mjs +11 -0
- package/dist/client/app-config.d.ts +2 -0
- package/dist/client/app-config.mjs +4 -0
- package/dist/client/content-scripts/content-script-context.d.ts +114 -0
- package/dist/client/content-scripts/content-script-context.mjs +169 -0
- package/dist/client/content-scripts/custom-events.d.ts +10 -0
- package/dist/client/content-scripts/custom-events.mjs +13 -0
- package/dist/client/content-scripts/index.d.ts +2 -0
- package/dist/client/content-scripts/index.mjs +2 -0
- package/dist/client/content-scripts/location-watcher.d.ts +12 -0
- package/dist/client/content-scripts/location-watcher.mjs +22 -0
- package/dist/client/content-scripts/ui/index.d.ts +23 -0
- package/dist/client/content-scripts/ui/index.mjs +188 -0
- package/dist/{client.d.ts → client/content-scripts/ui/types.d.ts} +17 -45
- package/dist/client/content-scripts/ui/types.mjs +0 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.mjs +2 -0
- package/dist/core/build.d.ts +15 -0
- package/dist/core/build.mjs +6 -0
- package/dist/core/builders/vite/index.d.ts +3 -0
- package/dist/core/builders/vite/index.mjs +285 -0
- package/dist/core/builders/vite/plugins/bundleAnalysis.d.ts +7 -0
- package/dist/core/builders/vite/plugins/bundleAnalysis.mjs +15 -0
- package/dist/core/builders/vite/plugins/cssEntrypoints.d.ts +13 -0
- package/dist/core/builders/vite/plugins/cssEntrypoints.mjs +22 -0
- package/dist/core/builders/vite/plugins/defineImportMeta.d.ts +14 -0
- package/dist/core/builders/vite/plugins/defineImportMeta.mjs +13 -0
- package/dist/core/builders/vite/plugins/devHtmlPrerender.d.ts +7 -0
- package/dist/core/builders/vite/plugins/devHtmlPrerender.mjs +140 -0
- package/dist/core/builders/vite/plugins/devServerGlobals.d.ts +6 -0
- package/dist/core/builders/vite/plugins/devServerGlobals.mjs +15 -0
- package/dist/core/builders/vite/plugins/download.d.ts +10 -0
- package/dist/core/builders/vite/plugins/download.mjs +14 -0
- package/dist/core/builders/vite/plugins/entrypointGroupGlobals.d.ts +6 -0
- package/dist/core/builders/vite/plugins/entrypointGroupGlobals.mjs +16 -0
- package/dist/core/builders/vite/plugins/extensionApiMock.d.ts +11 -0
- package/dist/core/builders/vite/plugins/extensionApiMock.mjs +26 -0
- package/dist/core/builders/vite/plugins/globals.d.ts +3 -0
- package/dist/core/builders/vite/plugins/globals.mjs +15 -0
- package/dist/core/builders/vite/plugins/index.d.ts +17 -0
- package/dist/core/builders/vite/plugins/index.mjs +17 -0
- package/dist/core/builders/vite/plugins/multipageMove.d.ts +20 -0
- package/dist/core/builders/vite/plugins/multipageMove.mjs +59 -0
- package/dist/core/builders/vite/plugins/noopBackground.d.ts +6 -0
- package/dist/core/builders/vite/plugins/noopBackground.mjs +17 -0
- package/dist/core/builders/vite/plugins/removeEntrypointMainFunction.d.ts +6 -0
- package/dist/core/builders/vite/plugins/removeEntrypointMainFunction.mjs +12 -0
- package/dist/core/builders/vite/plugins/resolveAppConfig.d.ts +6 -0
- package/dist/core/builders/vite/plugins/resolveAppConfig.mjs +26 -0
- package/dist/core/builders/vite/plugins/resolveExtensionApi.d.ts +10 -0
- package/dist/core/builders/vite/plugins/resolveExtensionApi.mjs +15 -0
- package/dist/core/builders/vite/plugins/resolveVirtualModules.d.ts +6 -0
- package/dist/core/builders/vite/plugins/resolveVirtualModules.mjs +30 -0
- package/dist/core/builders/vite/plugins/tsconfigPaths.d.ts +3 -0
- package/dist/core/builders/vite/plugins/tsconfigPaths.mjs +12 -0
- package/dist/core/builders/vite/plugins/wxtPluginLoader.d.ts +6 -0
- package/dist/core/builders/vite/plugins/wxtPluginLoader.mjs +56 -0
- package/dist/core/clean.d.ts +21 -0
- package/dist/core/clean.mjs +38 -0
- package/dist/core/create-server.d.ts +11 -0
- package/dist/core/create-server.mjs +206 -0
- package/dist/core/define-config.d.ts +2 -0
- package/dist/core/define-config.mjs +3 -0
- package/dist/core/define-runner-config.d.ts +2 -0
- package/dist/core/define-runner-config.mjs +3 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.mjs +8 -0
- package/dist/core/initialize.d.ts +5 -0
- package/dist/core/initialize.mjs +128 -0
- package/dist/core/package-managers/bun.d.ts +2 -0
- package/dist/core/package-managers/bun.mjs +19 -0
- package/dist/core/package-managers/index.d.ts +2 -0
- package/dist/core/package-managers/index.mjs +65 -0
- package/dist/core/package-managers/npm.d.ts +17 -0
- package/dist/core/package-managers/npm.mjs +58 -0
- package/dist/core/package-managers/pnpm.d.ts +2 -0
- package/dist/core/package-managers/pnpm.mjs +21 -0
- package/dist/core/package-managers/types.d.ts +2 -0
- package/dist/core/package-managers/types.mjs +0 -0
- package/dist/core/package-managers/yarn.d.ts +2 -0
- package/dist/core/package-managers/yarn.mjs +31 -0
- package/dist/core/prepare.d.ts +2 -0
- package/dist/core/prepare.mjs +8 -0
- package/dist/core/runners/index.d.ts +2 -0
- package/dist/core/runners/index.mjs +12 -0
- package/dist/core/runners/manual.d.ts +5 -0
- package/dist/core/runners/manual.mjs +16 -0
- package/dist/core/runners/safari.d.ts +5 -0
- package/dist/core/runners/safari.mjs +16 -0
- package/dist/core/runners/web-ext.d.ts +5 -0
- package/dist/core/runners/web-ext.mjs +78 -0
- package/dist/core/runners/wsl.d.ts +5 -0
- package/dist/core/runners/wsl.mjs +16 -0
- package/dist/core/utils/arrays.d.ts +13 -0
- package/dist/{chunk-BERPNPEZ.js → core/utils/arrays.mjs} +6 -10
- package/dist/core/utils/building/build-entrypoints.d.ts +3 -0
- package/dist/core/utils/building/build-entrypoints.mjs +47 -0
- package/dist/core/utils/building/detect-dev-changes.d.ts +57 -0
- package/dist/core/utils/building/detect-dev-changes.mjs +93 -0
- package/dist/core/utils/building/find-entrypoints.d.ts +5 -0
- package/dist/core/utils/building/find-entrypoints.mjs +385 -0
- package/dist/core/utils/building/generate-wxt-dir.d.ts +5 -0
- package/dist/core/utils/building/generate-wxt-dir.mjs +192 -0
- package/dist/core/utils/building/group-entrypoints.d.ts +8 -0
- package/dist/core/utils/building/group-entrypoints.mjs +37 -0
- package/dist/core/utils/building/import-entrypoint.d.ts +16 -0
- package/dist/core/utils/building/import-entrypoint.mjs +97 -0
- package/dist/core/utils/building/index.d.ts +9 -0
- package/dist/core/utils/building/index.mjs +9 -0
- package/dist/core/utils/building/internal-build.d.ts +12 -0
- package/dist/core/utils/building/internal-build.mjs +112 -0
- package/dist/core/utils/building/rebuild.d.ts +23 -0
- package/dist/core/utils/building/rebuild.mjs +39 -0
- package/dist/core/utils/building/resolve-config.d.ts +11 -0
- package/dist/core/utils/building/resolve-config.mjs +364 -0
- package/dist/core/utils/cache.d.ts +8 -0
- package/dist/core/utils/cache.mjs +21 -0
- package/dist/core/utils/cli.d.ts +3 -0
- package/dist/core/utils/cli.mjs +26 -0
- package/dist/core/utils/constants.d.ts +5 -0
- package/dist/core/utils/constants.mjs +1 -0
- package/dist/core/utils/content-scripts.d.ts +11 -0
- package/dist/core/utils/content-scripts.mjs +60 -0
- package/dist/core/utils/content-security-policy.d.ts +14 -0
- package/dist/core/utils/content-security-policy.mjs +39 -0
- package/dist/core/utils/entrypoints.d.ts +25 -0
- package/dist/core/utils/entrypoints.mjs +31 -0
- package/dist/core/utils/eslint.d.ts +1 -0
- package/dist/core/utils/eslint.mjs +11 -0
- package/dist/core/utils/fs.d.ts +13 -0
- package/dist/core/utils/fs.mjs +15 -0
- package/dist/core/utils/globals.d.ts +11 -0
- package/dist/core/utils/globals.mjs +53 -0
- package/dist/core/utils/i18n.d.ts +11 -0
- package/dist/core/utils/i18n.mjs +35 -0
- package/dist/core/utils/log/index.d.ts +4 -0
- package/dist/core/utils/log/index.mjs +4 -0
- package/dist/core/utils/log/printBuildSummary.d.ts +2 -0
- package/dist/core/utils/log/printBuildSummary.mjs +32 -0
- package/dist/core/utils/log/printFileList.d.ts +1 -0
- package/dist/core/utils/log/printFileList.mjs +42 -0
- package/dist/core/utils/log/printHeader.d.ts +1 -0
- package/dist/core/utils/log/printHeader.mjs +7 -0
- package/dist/core/utils/log/printTable.d.ts +1 -0
- package/dist/core/utils/log/printTable.mjs +22 -0
- package/dist/core/utils/manifest.d.ts +44 -0
- package/dist/core/utils/manifest.mjs +512 -0
- package/dist/core/utils/network.d.ts +7 -0
- package/dist/core/utils/network.mjs +38 -0
- package/dist/core/utils/package.d.ts +6 -0
- package/dist/core/utils/package.mjs +14 -0
- package/dist/core/utils/paths.d.ts +11 -0
- package/dist/core/utils/paths.mjs +10 -0
- package/dist/core/utils/strings.d.ts +14 -0
- package/dist/core/utils/strings.mjs +18 -0
- package/dist/core/utils/testing/fake-objects.d.ts +4556 -0
- package/dist/core/utils/testing/fake-objects.mjs +322 -0
- package/dist/core/utils/time.d.ts +9 -0
- package/dist/core/utils/time.mjs +17 -0
- package/dist/core/utils/transform.d.ts +9 -0
- package/dist/core/utils/transform.mjs +17 -0
- package/dist/core/utils/types.d.ts +10 -0
- package/dist/core/utils/types.mjs +0 -0
- package/dist/core/utils/validation.d.ts +15 -0
- package/dist/core/utils/validation.mjs +55 -0
- package/dist/core/utils/virtual-modules.d.ts +22 -0
- package/dist/core/utils/virtual-modules.mjs +14 -0
- package/dist/core/utils/wsl.d.ts +4 -0
- package/dist/core/utils/wsl.mjs +4 -0
- package/dist/core/wxt.d.ts +19 -0
- package/dist/core/wxt.mjs +41 -0
- package/dist/core/zip.d.ts +7 -0
- package/dist/core/zip.mjs +137 -0
- package/dist/index.d.ts +4 -79
- package/dist/index.mjs +3 -0
- package/dist/modules.d.ts +10 -20
- package/dist/{chunk-6XSIWUWF.js → modules.mjs} +7 -16
- package/dist/sandbox/define-app-config.d.ts +19 -0
- package/dist/sandbox/define-app-config.mjs +3 -0
- package/dist/sandbox/define-background.d.ts +3 -0
- package/dist/sandbox/define-background.mjs +4 -0
- package/dist/sandbox/define-content-script.d.ts +2 -0
- package/dist/sandbox/define-content-script.mjs +3 -0
- package/dist/sandbox/define-unlisted-script.d.ts +3 -0
- package/dist/sandbox/define-unlisted-script.mjs +4 -0
- package/dist/sandbox/define-wxt-plugin.d.ts +2 -0
- package/dist/sandbox/define-wxt-plugin.mjs +3 -0
- package/dist/sandbox/dev-server-websocket.d.ts +21 -0
- package/dist/sandbox/dev-server-websocket.mjs +37 -0
- package/dist/sandbox/index.d.ts +11 -0
- package/dist/sandbox/index.mjs +6 -0
- package/dist/sandbox/utils/logger.d.ts +9 -0
- package/dist/sandbox/utils/logger.mjs +15 -0
- package/dist/storage.d.ts +39 -16
- package/dist/{storage.js → storage.mjs} +30 -41
- package/dist/testing/fake-browser.d.ts +1 -0
- package/dist/testing/fake-browser.mjs +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.mjs +2 -0
- package/dist/{testing.d.ts → testing/wxt-vitest-plugin.d.ts} +3 -15
- package/dist/testing/wxt-vitest-plugin.mjs +26 -0
- package/dist/{index-nWRfwAJi.d.cts → types.d.ts} +150 -264
- package/dist/types.mjs +0 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.mjs +1 -0
- package/dist/virtual/{background-entrypoint.js → background-entrypoint.mjs} +31 -40
- package/dist/virtual/{content-script-isolated-world-entrypoint.js → content-script-isolated-world-entrypoint.mjs} +9 -13
- package/dist/virtual/{content-script-main-world-entrypoint.js → content-script-main-world-entrypoint.mjs} +9 -14
- package/dist/virtual/mock-browser.mjs +6 -0
- package/dist/virtual/{reload-html.js → reload-html.mjs} +8 -9
- package/dist/virtual/{unlisted-script-entrypoint.js → unlisted-script-entrypoint.mjs} +8 -12
- package/package.json +47 -57
- package/dist/browser.d.ts +0 -18
- package/dist/browser.js +0 -6
- package/dist/chunk-BM6QYGAW.js +0 -1063
- package/dist/chunk-FNTE2L27.js +0 -7
- package/dist/chunk-FP7RYLVL.js +0 -3617
- package/dist/chunk-KPD5J7PZ.js +0 -1065
- package/dist/chunk-QGM4M3NI.js +0 -37
- package/dist/chunk-SGKCDMVR.js +0 -38
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -4438
- package/dist/client.js +0 -424
- package/dist/define-app-config-bg54F_lV.d.ts +0 -294
- package/dist/execa-4UBDUBJZ.js +0 -7244
- package/dist/execa-QLUM2B3W.js +0 -7245
- package/dist/index-nWRfwAJi.d.ts +0 -1401
- package/dist/index.cjs +0 -14473
- package/dist/index.d.cts +0 -81
- package/dist/index.js +0 -696
- package/dist/modules.cjs +0 -96
- package/dist/modules.d.cts +0 -119
- package/dist/modules.js +0 -17
- package/dist/prompt-25QIVJDC.js +0 -755
- package/dist/prompt-7BMKNSWS.js +0 -754
- package/dist/sandbox.d.ts +0 -16
- package/dist/sandbox.js +0 -36
- package/dist/storage.cjs +0 -439
- package/dist/storage.d.cts +0 -200
- package/dist/testing.cjs +0 -2815
- package/dist/testing.d.cts +0 -30
- package/dist/testing.js +0 -40
- package/dist/virtual/mock-browser.js +0 -6
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './devHtmlPrerender';
|
|
2
|
+
export * from './devServerGlobals';
|
|
3
|
+
export * from './download';
|
|
4
|
+
export * from './multipageMove';
|
|
5
|
+
export * from './resolveVirtualModules';
|
|
6
|
+
export * from './tsconfigPaths';
|
|
7
|
+
export * from './noopBackground';
|
|
8
|
+
export * from './cssEntrypoints';
|
|
9
|
+
export * from './bundleAnalysis';
|
|
10
|
+
export * from './globals';
|
|
11
|
+
export * from './extensionApiMock';
|
|
12
|
+
export * from './resolveExtensionApi';
|
|
13
|
+
export * from './entrypointGroupGlobals';
|
|
14
|
+
export * from './defineImportMeta';
|
|
15
|
+
export * from './removeEntrypointMainFunction';
|
|
16
|
+
export * from './wxtPluginLoader';
|
|
17
|
+
export * from './resolveAppConfig';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./devHtmlPrerender.mjs";
|
|
2
|
+
export * from "./devServerGlobals.mjs";
|
|
3
|
+
export * from "./download.mjs";
|
|
4
|
+
export * from "./multipageMove.mjs";
|
|
5
|
+
export * from "./resolveVirtualModules.mjs";
|
|
6
|
+
export * from "./tsconfigPaths.mjs";
|
|
7
|
+
export * from "./noopBackground.mjs";
|
|
8
|
+
export * from "./cssEntrypoints.mjs";
|
|
9
|
+
export * from "./bundleAnalysis.mjs";
|
|
10
|
+
export * from "./globals.mjs";
|
|
11
|
+
export * from "./extensionApiMock.mjs";
|
|
12
|
+
export * from "./resolveExtensionApi.mjs";
|
|
13
|
+
export * from "./entrypointGroupGlobals.mjs";
|
|
14
|
+
export * from "./defineImportMeta.mjs";
|
|
15
|
+
export * from "./removeEntrypointMainFunction.mjs";
|
|
16
|
+
export * from "./wxtPluginLoader.mjs";
|
|
17
|
+
export * from "./resolveAppConfig.mjs";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type * as vite from 'vite';
|
|
2
|
+
import { Entrypoint, ResolvedConfig } from '../../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Ensures the HTML files output by a multipage build are in the correct location. This does two
|
|
5
|
+
* things:
|
|
6
|
+
*
|
|
7
|
+
* 1. Moves the HMTL files to their final location at `<outDir>/<entrypoint.name>.html`.
|
|
8
|
+
* 2. Updates the bundle so it summarizes the files correctly in the returned build output.
|
|
9
|
+
*
|
|
10
|
+
* Assets (JS and CSS) are output to the `<outDir>/assets` directory, and don't need to be modified.
|
|
11
|
+
* HTML files access them via absolute URLs, so we don't need to update any import paths in the HTML
|
|
12
|
+
* files either.
|
|
13
|
+
*
|
|
14
|
+
* THIS PLUGIN SHOULD ONLY BE APPLIED TO MULTIPAGE BUILDS. It should not be added to every build.
|
|
15
|
+
*/
|
|
16
|
+
export declare function multipageMove(entrypoints: Entrypoint[], config: ResolvedConfig): vite.Plugin;
|
|
17
|
+
/**
|
|
18
|
+
* Recursively remove all directories that are empty/
|
|
19
|
+
*/
|
|
20
|
+
export declare function removeEmptyDirs(dir: string): Promise<void>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { dirname, extname, resolve, join } from "node:path";
|
|
2
|
+
import { getEntrypointBundlePath } from "../../../utils/entrypoints.mjs";
|
|
3
|
+
import fs, { ensureDir } from "fs-extra";
|
|
4
|
+
import { normalizePath } from "../../../utils/paths.mjs";
|
|
5
|
+
export function multipageMove(entrypoints, config) {
|
|
6
|
+
return {
|
|
7
|
+
name: "wxt:multipage-move",
|
|
8
|
+
async writeBundle(_, bundle) {
|
|
9
|
+
for (const oldBundlePath in bundle) {
|
|
10
|
+
const entrypoint = entrypoints.find(
|
|
11
|
+
(entry) => !!normalizePath(entry.inputPath).endsWith(oldBundlePath)
|
|
12
|
+
);
|
|
13
|
+
if (entrypoint == null) {
|
|
14
|
+
config.logger.debug(
|
|
15
|
+
`No entrypoint found for ${oldBundlePath}, leaving in chunks directory`
|
|
16
|
+
);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const newBundlePath = getEntrypointBundlePath(
|
|
20
|
+
entrypoint,
|
|
21
|
+
config.outDir,
|
|
22
|
+
extname(oldBundlePath)
|
|
23
|
+
);
|
|
24
|
+
if (newBundlePath === oldBundlePath) {
|
|
25
|
+
config.logger.debug(
|
|
26
|
+
"HTML file is already in the correct location",
|
|
27
|
+
oldBundlePath
|
|
28
|
+
);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const oldAbsPath = resolve(config.outDir, oldBundlePath);
|
|
32
|
+
const newAbsPath = resolve(config.outDir, newBundlePath);
|
|
33
|
+
await ensureDir(dirname(newAbsPath));
|
|
34
|
+
await fs.move(oldAbsPath, newAbsPath, { overwrite: true });
|
|
35
|
+
const renamedChunk = {
|
|
36
|
+
...bundle[oldBundlePath],
|
|
37
|
+
fileName: newBundlePath
|
|
38
|
+
};
|
|
39
|
+
delete bundle[oldBundlePath];
|
|
40
|
+
bundle[newBundlePath] = renamedChunk;
|
|
41
|
+
}
|
|
42
|
+
removeEmptyDirs(config.outDir);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export async function removeEmptyDirs(dir) {
|
|
47
|
+
const files = await fs.readdir(dir);
|
|
48
|
+
for (const file of files) {
|
|
49
|
+
const filePath = join(dir, file);
|
|
50
|
+
const stats = await fs.stat(filePath);
|
|
51
|
+
if (stats.isDirectory()) {
|
|
52
|
+
await removeEmptyDirs(filePath);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
await fs.rmdir(dir);
|
|
57
|
+
} catch {
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* In dev mode, if there's not a background script listed, we need to add one so that the web socket
|
|
4
|
+
* connection is setup and the extension reloads HTML pages and content scripts correctly.
|
|
5
|
+
*/
|
|
6
|
+
export declare function noopBackground(): Plugin;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VIRTUAL_NOOP_BACKGROUND_MODULE_ID } from "../../../utils/constants.mjs";
|
|
2
|
+
export function noopBackground() {
|
|
3
|
+
const virtualModuleId = VIRTUAL_NOOP_BACKGROUND_MODULE_ID;
|
|
4
|
+
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
5
|
+
return {
|
|
6
|
+
name: "wxt:noop-background",
|
|
7
|
+
resolveId(id) {
|
|
8
|
+
if (id === virtualModuleId) return resolvedVirtualModuleId;
|
|
9
|
+
},
|
|
10
|
+
load(id) {
|
|
11
|
+
if (id === resolvedVirtualModuleId) {
|
|
12
|
+
return `import { defineBackground } from 'wxt/sandbox';
|
|
13
|
+
export default defineBackground(() => void 0)`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ResolvedConfig } from '../../../../types';
|
|
2
|
+
import * as vite from 'vite';
|
|
3
|
+
/**
|
|
4
|
+
* Transforms entrypoints, removing the main function from the entrypoint if it exists.
|
|
5
|
+
*/
|
|
6
|
+
export declare function removeEntrypointMainFunction(config: ResolvedConfig, path: string): vite.Plugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { normalizePath } from "../../../utils/paths.mjs";
|
|
2
|
+
import { removeMainFunctionCode } from "../../../utils/transform.mjs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
export function removeEntrypointMainFunction(config, path) {
|
|
5
|
+
const absPath = normalizePath(resolve(config.root, path));
|
|
6
|
+
return {
|
|
7
|
+
name: "wxt:remove-entrypoint-main-function",
|
|
8
|
+
transform(code, id) {
|
|
9
|
+
if (id === absPath) return removeMainFunctionCode(code);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as vite from 'vite';
|
|
2
|
+
import { ResolvedConfig } from '../../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* When importing `virtual:app-config`, resolve it to the `app.config.ts` file in the project.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveAppConfig(config: ResolvedConfig): vite.Plugin;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { exists } from "fs-extra";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
export function resolveAppConfig(config) {
|
|
4
|
+
const virtualModuleId = "virtual:app-config";
|
|
5
|
+
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
6
|
+
const appConfigFile = resolve(config.srcDir, "app.config.ts");
|
|
7
|
+
return {
|
|
8
|
+
name: "wxt:resolve-app-config",
|
|
9
|
+
config() {
|
|
10
|
+
return {
|
|
11
|
+
optimizeDeps: {
|
|
12
|
+
// Prevent ESBuild from attempting to resolve the virtual module
|
|
13
|
+
// while optimizing WXT.
|
|
14
|
+
exclude: [virtualModuleId]
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
async resolveId(id) {
|
|
19
|
+
if (id !== virtualModuleId) return;
|
|
20
|
+
return await exists(appConfigFile) ? appConfigFile : resolvedVirtualModuleId;
|
|
21
|
+
},
|
|
22
|
+
load(id) {
|
|
23
|
+
if (id === resolvedVirtualModuleId) return `export default {}`;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ResolvedConfig } from '../../../../types';
|
|
2
|
+
import type * as vite from 'vite';
|
|
3
|
+
/**
|
|
4
|
+
* Apply the experimental config for which extension API is used. This only
|
|
5
|
+
* effects the extension API included at RUNTIME - during development, types
|
|
6
|
+
* depend on the import.
|
|
7
|
+
*
|
|
8
|
+
* NOTE: this only works if we import `wxt/browser` instead of using the relative path.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveExtensionApi(config: ResolvedConfig): vite.Plugin;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function resolveExtensionApi(config) {
|
|
2
|
+
return {
|
|
3
|
+
name: "wxt:resolve-extension-api",
|
|
4
|
+
config() {
|
|
5
|
+
if (config.extensionApi === "webextension-polyfill") return;
|
|
6
|
+
return {
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: [
|
|
9
|
+
{ find: /^wxt\/browser$/, replacement: "wxt/browser/chrome" }
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { normalizePath } from "../../../utils/paths.mjs";
|
|
2
|
+
import {
|
|
3
|
+
virtualModuleNames
|
|
4
|
+
} from "../../../utils/virtual-modules.mjs";
|
|
5
|
+
import fs from "fs-extra";
|
|
6
|
+
import { resolve } from "path";
|
|
7
|
+
export function resolveVirtualModules(config) {
|
|
8
|
+
return virtualModuleNames.map((name) => {
|
|
9
|
+
const virtualId = `virtual:wxt-${name}?`;
|
|
10
|
+
const resolvedVirtualId = "\0" + virtualId;
|
|
11
|
+
return {
|
|
12
|
+
name: `wxt:resolve-virtual-${name}`,
|
|
13
|
+
resolveId(id) {
|
|
14
|
+
const index = id.indexOf(virtualId);
|
|
15
|
+
if (index === -1) return;
|
|
16
|
+
const inputPath = normalizePath(id.substring(index + virtualId.length));
|
|
17
|
+
return resolvedVirtualId + inputPath;
|
|
18
|
+
},
|
|
19
|
+
async load(id) {
|
|
20
|
+
if (!id.startsWith(resolvedVirtualId)) return;
|
|
21
|
+
const inputPath = id.replace(resolvedVirtualId, "");
|
|
22
|
+
const template = await fs.readFile(
|
|
23
|
+
resolve(config.wxtModuleDir, `dist/virtual/${name}.mjs`),
|
|
24
|
+
"utf-8"
|
|
25
|
+
);
|
|
26
|
+
return template.replace(`virtual:user-${name}`, inputPath);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as vite from 'vite';
|
|
2
|
+
import { ResolvedConfig } from '../../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve and load plugins for each entrypoint. This handles both JS entrypoints via the `virtual:wxt-plugins` import, and HTML files by adding `virtual:wxt-html-plugins` to the document's `<head>`
|
|
5
|
+
*/
|
|
6
|
+
export declare function wxtPluginLoader(config: ResolvedConfig): vite.Plugin;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { parseHTML } from "linkedom";
|
|
2
|
+
import { normalizePath } from "../../../utils/paths.mjs";
|
|
3
|
+
export function wxtPluginLoader(config) {
|
|
4
|
+
const virtualModuleId = "virtual:wxt-plugins";
|
|
5
|
+
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
6
|
+
const virtualHtmlModuleId = "virtual:wxt-html-plugins";
|
|
7
|
+
const resolvedVirtualHtmlModuleId = "\0" + virtualHtmlModuleId;
|
|
8
|
+
return {
|
|
9
|
+
name: "wxt:plugin-loader",
|
|
10
|
+
resolveId(id) {
|
|
11
|
+
if (id === virtualModuleId) return resolvedVirtualModuleId;
|
|
12
|
+
if (id === virtualHtmlModuleId) return resolvedVirtualHtmlModuleId;
|
|
13
|
+
},
|
|
14
|
+
load(id) {
|
|
15
|
+
if (id === resolvedVirtualModuleId) {
|
|
16
|
+
const imports = config.plugins.map(
|
|
17
|
+
(plugin, i) => `import initPlugin${i} from '${normalizePath(plugin)}';`
|
|
18
|
+
).join("\n");
|
|
19
|
+
const initCalls = config.plugins.map((_, i) => ` initPlugin${i}();`).join("\n");
|
|
20
|
+
return `${imports}
|
|
21
|
+
|
|
22
|
+
export function initPlugins() {
|
|
23
|
+
${initCalls}
|
|
24
|
+
}`;
|
|
25
|
+
}
|
|
26
|
+
if (id === resolvedVirtualHtmlModuleId) {
|
|
27
|
+
return `import { initPlugins } from '${virtualModuleId}';
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
initPlugins();
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.error("[wxt] Failed to initialize plugins", err);
|
|
33
|
+
}`;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
transformIndexHtml: {
|
|
37
|
+
// Use "pre" so the new script is added before vite bundles all the scripts
|
|
38
|
+
order: "pre",
|
|
39
|
+
handler(html, _ctx) {
|
|
40
|
+
const src = config.command === "serve" ? `http://${config.dev.server?.hostname}:${config.dev.server?.port}/@id/${virtualHtmlModuleId}` : virtualHtmlModuleId;
|
|
41
|
+
const { document } = parseHTML(html);
|
|
42
|
+
const existing = document.querySelector(`script[src='${src}']`);
|
|
43
|
+
if (existing) return;
|
|
44
|
+
const script = document.createElement("script");
|
|
45
|
+
script.type = "module";
|
|
46
|
+
script.src = src;
|
|
47
|
+
if (document.head == null) {
|
|
48
|
+
const newHead = document.createElement("head");
|
|
49
|
+
document.documentElement.prepend(newHead);
|
|
50
|
+
}
|
|
51
|
+
document.head.prepend(script);
|
|
52
|
+
return document.toString();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InlineConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Remove generated/temp files from the directory.
|
|
4
|
+
*
|
|
5
|
+
* @param config Optional config that will override your `<root>/wxt.config.ts`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* await clean();
|
|
9
|
+
*/
|
|
10
|
+
export declare function clean(config?: InlineConfig): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Remove generated/temp files from the directory.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated
|
|
15
|
+
*
|
|
16
|
+
* @param root The directory to look for generated/temp files in. Defaults to `process.cwd()`. Can be relative to `process.cwd()` or absolute.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* await clean();
|
|
20
|
+
*/
|
|
21
|
+
export declare function clean(root?: string): Promise<void>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import glob from "fast-glob";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import pc from "picocolors";
|
|
5
|
+
import { registerWxt, wxt } from "./wxt.mjs";
|
|
6
|
+
export async function clean(config) {
|
|
7
|
+
if (typeof config === "string") {
|
|
8
|
+
config = { root: config };
|
|
9
|
+
}
|
|
10
|
+
await registerWxt("build", config);
|
|
11
|
+
wxt.logger.info("Cleaning Project");
|
|
12
|
+
const root = wxt.config.root;
|
|
13
|
+
const tempDirs = [
|
|
14
|
+
"node_modules/.vite",
|
|
15
|
+
"node_modules/.cache",
|
|
16
|
+
"**/.wxt",
|
|
17
|
+
`${path.relative(root, wxt.config.outBaseDir)}/*`
|
|
18
|
+
];
|
|
19
|
+
wxt.logger.debug("Looking for:", tempDirs.map(pc.cyan).join(", "));
|
|
20
|
+
const directories = await glob(tempDirs, {
|
|
21
|
+
cwd: root,
|
|
22
|
+
absolute: true,
|
|
23
|
+
onlyDirectories: true,
|
|
24
|
+
deep: 2
|
|
25
|
+
});
|
|
26
|
+
if (directories.length === 0) {
|
|
27
|
+
wxt.logger.debug("No generated files found.");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
wxt.logger.debug(
|
|
31
|
+
"Found:",
|
|
32
|
+
directories.map((dir) => pc.cyan(path.relative(root, dir))).join(", ")
|
|
33
|
+
);
|
|
34
|
+
for (const directory of directories) {
|
|
35
|
+
await fs.rm(directory, { force: true, recursive: true });
|
|
36
|
+
wxt.logger.debug("Deleted " + pc.cyan(path.relative(root, directory)));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InlineConfig, WxtDevServer } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a dev server and pre-builds all the files that need to exist before loading the extension.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const server = await wxt.createServer({
|
|
7
|
+
* // Enter config...
|
|
8
|
+
* });
|
|
9
|
+
* await server.start();
|
|
10
|
+
*/
|
|
11
|
+
export declare function createServer(inlineConfig?: InlineConfig): Promise<WxtDevServer>;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { getEntrypointBundlePath, isHtmlEntrypoint } from "./utils/entrypoints.mjs";
|
|
2
|
+
import {
|
|
3
|
+
getContentScriptCssFiles,
|
|
4
|
+
getContentScriptsCssMap
|
|
5
|
+
} from "./utils/manifest.mjs";
|
|
6
|
+
import {
|
|
7
|
+
internalBuild,
|
|
8
|
+
detectDevChanges,
|
|
9
|
+
rebuild,
|
|
10
|
+
findEntrypoints
|
|
11
|
+
} from "./utils/building/index.mjs";
|
|
12
|
+
import { createExtensionRunner } from "./runners/index.mjs";
|
|
13
|
+
import { Mutex } from "async-mutex";
|
|
14
|
+
import pc from "picocolors";
|
|
15
|
+
import { relative } from "node:path";
|
|
16
|
+
import { registerWxt, wxt } from "./wxt.mjs";
|
|
17
|
+
import { unnormalizePath } from "./utils/paths.mjs";
|
|
18
|
+
import {
|
|
19
|
+
getContentScriptJs,
|
|
20
|
+
mapWxtOptionsToRegisteredContentScript
|
|
21
|
+
} from "./utils/content-scripts.mjs";
|
|
22
|
+
export async function createServer(inlineConfig) {
|
|
23
|
+
await registerWxt("serve", inlineConfig, async (config) => {
|
|
24
|
+
const { port, hostname } = config.dev.server;
|
|
25
|
+
const serverInfo = {
|
|
26
|
+
port,
|
|
27
|
+
hostname,
|
|
28
|
+
origin: `http://${hostname}:${port}`
|
|
29
|
+
};
|
|
30
|
+
const server2 = {
|
|
31
|
+
...serverInfo,
|
|
32
|
+
get watcher() {
|
|
33
|
+
return builderServer.watcher;
|
|
34
|
+
},
|
|
35
|
+
get ws() {
|
|
36
|
+
return builderServer.ws;
|
|
37
|
+
},
|
|
38
|
+
currentOutput: void 0,
|
|
39
|
+
async start() {
|
|
40
|
+
await builderServer.listen();
|
|
41
|
+
wxt.logger.success(`Started dev server @ ${serverInfo.origin}`);
|
|
42
|
+
await buildAndOpenBrowser();
|
|
43
|
+
},
|
|
44
|
+
async stop() {
|
|
45
|
+
await runner.closeBrowser();
|
|
46
|
+
await builderServer.close();
|
|
47
|
+
},
|
|
48
|
+
async restart() {
|
|
49
|
+
await closeAndRecreateRunner();
|
|
50
|
+
await buildAndOpenBrowser();
|
|
51
|
+
},
|
|
52
|
+
transformHtml(url, html, originalUrl) {
|
|
53
|
+
return builderServer.transformHtml(url, html, originalUrl);
|
|
54
|
+
},
|
|
55
|
+
reloadContentScript(payload) {
|
|
56
|
+
server2.ws.send("wxt:reload-content-script", payload);
|
|
57
|
+
},
|
|
58
|
+
reloadPage(path) {
|
|
59
|
+
server2.ws.send("wxt:reload-page", path);
|
|
60
|
+
},
|
|
61
|
+
reloadExtension() {
|
|
62
|
+
server2.ws.send("wxt:reload-extension");
|
|
63
|
+
},
|
|
64
|
+
async restartBrowser() {
|
|
65
|
+
await closeAndRecreateRunner();
|
|
66
|
+
await runner.openBrowser();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return server2;
|
|
70
|
+
});
|
|
71
|
+
const server = wxt.server;
|
|
72
|
+
let [runner, builderServer] = await Promise.all([
|
|
73
|
+
createExtensionRunner(),
|
|
74
|
+
wxt.builder.createServer(server)
|
|
75
|
+
]);
|
|
76
|
+
const buildAndOpenBrowser = async () => {
|
|
77
|
+
server.currentOutput = await internalBuild();
|
|
78
|
+
try {
|
|
79
|
+
server.watcher.add(getExternalOutputDependencies(server));
|
|
80
|
+
} catch (err) {
|
|
81
|
+
wxt.config.logger.warn("Failed to register additional file paths:", err);
|
|
82
|
+
}
|
|
83
|
+
await runner.openBrowser();
|
|
84
|
+
};
|
|
85
|
+
const closeAndRecreateRunner = async () => {
|
|
86
|
+
await runner.closeBrowser();
|
|
87
|
+
await wxt.reloadConfig();
|
|
88
|
+
runner = await createExtensionRunner();
|
|
89
|
+
};
|
|
90
|
+
server.ws.on("wxt:background-initialized", () => {
|
|
91
|
+
if (server.currentOutput == null) return;
|
|
92
|
+
reloadContentScripts(server.currentOutput.steps, server);
|
|
93
|
+
});
|
|
94
|
+
const reloadOnChange = createFileReloader(server);
|
|
95
|
+
server.watcher.on("all", reloadOnChange);
|
|
96
|
+
return server;
|
|
97
|
+
}
|
|
98
|
+
function createFileReloader(server) {
|
|
99
|
+
const fileChangedMutex = new Mutex();
|
|
100
|
+
const changeQueue = [];
|
|
101
|
+
return async (event, path) => {
|
|
102
|
+
await wxt.reloadConfig();
|
|
103
|
+
if (path.startsWith(wxt.config.outBaseDir)) return;
|
|
104
|
+
if (path.startsWith(wxt.config.wxtDir)) return;
|
|
105
|
+
changeQueue.push([event, path]);
|
|
106
|
+
await fileChangedMutex.runExclusive(async () => {
|
|
107
|
+
if (server.currentOutput == null) return;
|
|
108
|
+
const fileChanges = changeQueue.splice(0, changeQueue.length).map(([_, file]) => file);
|
|
109
|
+
if (fileChanges.length === 0) return;
|
|
110
|
+
const changes = detectDevChanges(fileChanges, server.currentOutput);
|
|
111
|
+
if (changes.type === "no-change") return;
|
|
112
|
+
if (changes.type === "full-restart") {
|
|
113
|
+
wxt.logger.info("Config changed, restarting server...");
|
|
114
|
+
server.restart();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (changes.type === "browser-restart") {
|
|
118
|
+
wxt.logger.info("Runner config changed, restarting browser...");
|
|
119
|
+
server.restartBrowser();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
wxt.logger.info(
|
|
123
|
+
`Changed: ${Array.from(new Set(fileChanges)).map((file) => pc.dim(relative(wxt.config.root, file))).join(", ")}`
|
|
124
|
+
);
|
|
125
|
+
const allEntrypoints = await findEntrypoints();
|
|
126
|
+
try {
|
|
127
|
+
const { output: newOutput } = await rebuild(
|
|
128
|
+
allEntrypoints,
|
|
129
|
+
// TODO: this excludes new entrypoints, so they're not built until the dev command is restarted
|
|
130
|
+
changes.rebuildGroups,
|
|
131
|
+
changes.cachedOutput
|
|
132
|
+
);
|
|
133
|
+
server.currentOutput = newOutput;
|
|
134
|
+
switch (changes.type) {
|
|
135
|
+
case "extension-reload":
|
|
136
|
+
server.reloadExtension();
|
|
137
|
+
wxt.logger.success(`Reloaded extension`);
|
|
138
|
+
break;
|
|
139
|
+
case "html-reload":
|
|
140
|
+
const { reloadedNames } = reloadHtmlPages(
|
|
141
|
+
changes.rebuildGroups,
|
|
142
|
+
server
|
|
143
|
+
);
|
|
144
|
+
wxt.logger.success(`Reloaded: ${getFilenameList(reloadedNames)}`);
|
|
145
|
+
break;
|
|
146
|
+
case "content-script-reload":
|
|
147
|
+
reloadContentScripts(changes.changedSteps, server);
|
|
148
|
+
const rebuiltNames = changes.rebuildGroups.flat().map((entry) => entry.name);
|
|
149
|
+
wxt.logger.success(`Reloaded: ${getFilenameList(rebuiltNames)}`);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
} catch (err) {
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function reloadContentScripts(steps, server) {
|
|
158
|
+
if (wxt.config.manifestVersion === 3) {
|
|
159
|
+
steps.forEach((step) => {
|
|
160
|
+
if (server.currentOutput == null) return;
|
|
161
|
+
const entry = step.entrypoints;
|
|
162
|
+
if (Array.isArray(entry) || entry.type !== "content-script") return;
|
|
163
|
+
const js = getContentScriptJs(wxt.config, entry);
|
|
164
|
+
const cssMap = getContentScriptsCssMap(server.currentOutput, [entry]);
|
|
165
|
+
const css = getContentScriptCssFiles([entry], cssMap);
|
|
166
|
+
server.reloadContentScript({
|
|
167
|
+
registration: entry.options.registration,
|
|
168
|
+
contentScript: mapWxtOptionsToRegisteredContentScript(
|
|
169
|
+
entry.options,
|
|
170
|
+
js,
|
|
171
|
+
css
|
|
172
|
+
)
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
} else {
|
|
176
|
+
server.reloadExtension();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function reloadHtmlPages(groups, server) {
|
|
180
|
+
const htmlEntries = groups.flat().filter(isHtmlEntrypoint);
|
|
181
|
+
htmlEntries.forEach((entry) => {
|
|
182
|
+
const path = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
|
|
183
|
+
server.reloadPage(path);
|
|
184
|
+
});
|
|
185
|
+
return {
|
|
186
|
+
reloadedNames: htmlEntries.map((entry) => entry.name)
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function getFilenameList(names) {
|
|
190
|
+
return names.map((name) => {
|
|
191
|
+
return pc.cyan(name);
|
|
192
|
+
}).join(pc.dim(", "));
|
|
193
|
+
}
|
|
194
|
+
function getExternalOutputDependencies(server) {
|
|
195
|
+
return server.currentOutput?.steps.flatMap((step, i) => {
|
|
196
|
+
if (Array.isArray(step.entrypoints) && i === 0) {
|
|
197
|
+
return [];
|
|
198
|
+
}
|
|
199
|
+
return step.chunks.flatMap((chunk) => {
|
|
200
|
+
if (chunk.type === "asset") return [];
|
|
201
|
+
return chunk.moduleIds;
|
|
202
|
+
});
|
|
203
|
+
}).filter(
|
|
204
|
+
(file) => !file.includes("node_modules") && !file.startsWith("\0")
|
|
205
|
+
).map(unnormalizePath).filter((file) => !file.startsWith(wxt.config.root)) ?? [];
|
|
206
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./build.mjs";
|
|
2
|
+
export * from "./clean.mjs";
|
|
3
|
+
export * from "./define-config.mjs";
|
|
4
|
+
export * from "./define-runner-config.mjs";
|
|
5
|
+
export * from "./create-server.mjs";
|
|
6
|
+
export * from "./initialize.mjs";
|
|
7
|
+
export * from "./prepare.mjs";
|
|
8
|
+
export * from "./zip.mjs";
|