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,192 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import { dirname, relative, resolve } from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
getEntrypointBundlePath,
|
|
5
|
+
isHtmlEntrypoint
|
|
6
|
+
} from "../../utils/entrypoints.mjs";
|
|
7
|
+
import { getEntrypointGlobals, getGlobals } from "../../utils/globals.mjs";
|
|
8
|
+
import { normalizePath } from "../../utils/paths.mjs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { parseI18nMessages } from "../../utils/i18n.mjs";
|
|
11
|
+
import { writeFileIfDifferent, getPublicFiles } from "../../utils/fs.mjs";
|
|
12
|
+
import { wxt } from "../../wxt.mjs";
|
|
13
|
+
export async function generateTypesDir(entrypoints) {
|
|
14
|
+
await fs.ensureDir(wxt.config.typesDir);
|
|
15
|
+
const entries = [
|
|
16
|
+
// Hard-coded entries
|
|
17
|
+
{ module: "wxt/vite-builder-env" }
|
|
18
|
+
];
|
|
19
|
+
wxt.config.userModules.forEach((module) => {
|
|
20
|
+
if (module.type === "node_module") entries.push({ module: module.id });
|
|
21
|
+
});
|
|
22
|
+
entries.push(await getPathsDeclarationEntry(entrypoints));
|
|
23
|
+
entries.push(await getI18nDeclarationEntry());
|
|
24
|
+
entries.push(await getGlobalsDeclarationEntry());
|
|
25
|
+
if (wxt.config.extensionApi === "chrome") {
|
|
26
|
+
entries.push({ module: "@types/chrome" });
|
|
27
|
+
}
|
|
28
|
+
entries.push(await getTsConfigEntry());
|
|
29
|
+
await wxt.hooks.callHook("prepare:types", wxt, entries);
|
|
30
|
+
entries.push(getMainDeclarationEntry(entries));
|
|
31
|
+
const absoluteFileEntries = entries.filter((entry) => "path" in entry).map((entry) => ({
|
|
32
|
+
...entry,
|
|
33
|
+
path: resolve(wxt.config.wxtDir, entry.path)
|
|
34
|
+
}));
|
|
35
|
+
await Promise.all(
|
|
36
|
+
absoluteFileEntries.map(async (file) => {
|
|
37
|
+
await fs.ensureDir(dirname(file.path));
|
|
38
|
+
await writeFileIfDifferent(file.path, file.text);
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
async function getPathsDeclarationEntry(entrypoints) {
|
|
43
|
+
const paths = entrypoints.map(
|
|
44
|
+
(entry) => getEntrypointBundlePath(
|
|
45
|
+
entry,
|
|
46
|
+
wxt.config.outDir,
|
|
47
|
+
isHtmlEntrypoint(entry) ? ".html" : ".js"
|
|
48
|
+
)
|
|
49
|
+
).concat(await getPublicFiles());
|
|
50
|
+
await wxt.hooks.callHook("prepare:publicPaths", wxt, paths);
|
|
51
|
+
const unions = paths.map(normalizePath).sort().map((path2) => ` | "/${path2}"`).join("\n");
|
|
52
|
+
const template = `// Generated by wxt
|
|
53
|
+
import "${wxt.config.browserModule}";
|
|
54
|
+
|
|
55
|
+
declare module "${wxt.config.browserModule}" {
|
|
56
|
+
export type PublicPath =
|
|
57
|
+
{{ union }}
|
|
58
|
+
type HtmlPublicPath = Extract<PublicPath, \`\${string}.html\`>
|
|
59
|
+
export interface WxtRuntime {
|
|
60
|
+
getURL(path: PublicPath): string;
|
|
61
|
+
getURL(path: \`\${HtmlPublicPath}\${string}\`): string;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
return {
|
|
66
|
+
path: "types/paths.d.ts",
|
|
67
|
+
text: template.replace("{{ union }}", unions || " | never"),
|
|
68
|
+
tsReference: true
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async function getI18nDeclarationEntry() {
|
|
72
|
+
const defaultLocale = wxt.config.manifest.default_locale;
|
|
73
|
+
const template = `// Generated by wxt
|
|
74
|
+
import "${wxt.config.browserModule}";
|
|
75
|
+
|
|
76
|
+
declare module "${wxt.config.browserModule}" {
|
|
77
|
+
/**
|
|
78
|
+
* See https://developer.chrome.com/docs/extensions/reference/i18n/#method-getMessage
|
|
79
|
+
*/
|
|
80
|
+
interface GetMessageOptions {
|
|
81
|
+
/**
|
|
82
|
+
* See https://developer.chrome.com/docs/extensions/reference/i18n/#method-getMessage
|
|
83
|
+
*/
|
|
84
|
+
escapeLt?: boolean
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface WxtI18n extends I18n.Static {
|
|
88
|
+
{{ overrides }}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
const defaultLocalePath = path.resolve(
|
|
93
|
+
wxt.config.publicDir,
|
|
94
|
+
"_locales",
|
|
95
|
+
defaultLocale ?? "",
|
|
96
|
+
"messages.json"
|
|
97
|
+
);
|
|
98
|
+
let messages;
|
|
99
|
+
if (await fs.exists(defaultLocalePath)) {
|
|
100
|
+
const content = JSON.parse(await fs.readFile(defaultLocalePath, "utf-8"));
|
|
101
|
+
messages = parseI18nMessages(content);
|
|
102
|
+
} else {
|
|
103
|
+
messages = parseI18nMessages({});
|
|
104
|
+
}
|
|
105
|
+
const overrides = messages.map((message) => {
|
|
106
|
+
return ` /**
|
|
107
|
+
* ${message.description || "No message description."}
|
|
108
|
+
*
|
|
109
|
+
* "${message.message}"
|
|
110
|
+
*/
|
|
111
|
+
getMessage(
|
|
112
|
+
messageName: "${message.name}",
|
|
113
|
+
substitutions?: string | string[],
|
|
114
|
+
options?: GetMessageOptions,
|
|
115
|
+
): string;`;
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
path: "types/i18n.d.ts",
|
|
119
|
+
text: template.replace("{{ overrides }}", overrides.join("\n")),
|
|
120
|
+
tsReference: true
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
async function getGlobalsDeclarationEntry() {
|
|
124
|
+
const globals = [...getGlobals(wxt.config), ...getEntrypointGlobals("")];
|
|
125
|
+
return {
|
|
126
|
+
path: "types/globals.d.ts",
|
|
127
|
+
text: [
|
|
128
|
+
"// Generated by wxt",
|
|
129
|
+
"export {}",
|
|
130
|
+
"interface ImportMetaEnv {",
|
|
131
|
+
...globals.map((global) => ` readonly ${global.name}: ${global.type};`),
|
|
132
|
+
"}",
|
|
133
|
+
"interface ImportMeta {",
|
|
134
|
+
" readonly env: ImportMetaEnv",
|
|
135
|
+
"}",
|
|
136
|
+
""
|
|
137
|
+
].join("\n"),
|
|
138
|
+
tsReference: true
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function getMainDeclarationEntry(references) {
|
|
142
|
+
const lines = ["// Generated by wxt"];
|
|
143
|
+
references.forEach((ref) => {
|
|
144
|
+
if ("module" in ref) {
|
|
145
|
+
return lines.push(`/// <reference types="${ref.module}" />`);
|
|
146
|
+
} else if (ref.tsReference) {
|
|
147
|
+
const absolutePath = resolve(wxt.config.wxtDir, ref.path);
|
|
148
|
+
const relativePath = relative(wxt.config.wxtDir, absolutePath);
|
|
149
|
+
lines.push(`/// <reference types="./${normalizePath(relativePath)}" />`);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
return {
|
|
153
|
+
path: "wxt.d.ts",
|
|
154
|
+
text: lines.join("\n") + "\n"
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
async function getTsConfigEntry() {
|
|
158
|
+
const dir = wxt.config.wxtDir;
|
|
159
|
+
const getTsconfigPath = (path2) => normalizePath(relative(dir, path2));
|
|
160
|
+
const paths = Object.entries(wxt.config.alias).flatMap(([alias, absolutePath]) => {
|
|
161
|
+
const aliasPath = getTsconfigPath(absolutePath);
|
|
162
|
+
return [
|
|
163
|
+
` "${alias}": ["${aliasPath}"]`,
|
|
164
|
+
` "${alias}/*": ["${aliasPath}/*"]`
|
|
165
|
+
];
|
|
166
|
+
}).join(",\n");
|
|
167
|
+
const text = `{
|
|
168
|
+
"compilerOptions": {
|
|
169
|
+
"target": "ESNext",
|
|
170
|
+
"module": "ESNext",
|
|
171
|
+
"moduleResolution": "Bundler",
|
|
172
|
+
"noEmit": true,
|
|
173
|
+
"esModuleInterop": true,
|
|
174
|
+
"forceConsistentCasingInFileNames": true,
|
|
175
|
+
"resolveJsonModule": true,
|
|
176
|
+
"strict": true,
|
|
177
|
+
"skipLibCheck": true,
|
|
178
|
+
"paths": {
|
|
179
|
+
${paths}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"include": [
|
|
183
|
+
"${getTsconfigPath(wxt.config.root)}/**/*",
|
|
184
|
+
"./wxt.d.ts"
|
|
185
|
+
],
|
|
186
|
+
"exclude": ["${getTsconfigPath(wxt.config.outBaseDir)}"]
|
|
187
|
+
}`;
|
|
188
|
+
return {
|
|
189
|
+
path: "tsconfig.json",
|
|
190
|
+
text
|
|
191
|
+
};
|
|
192
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Entrypoint, EntrypointGroup } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Entrypoints can be build in groups. HTML pages can all be built together in a single step, while
|
|
4
|
+
* content scripts must be build individually.
|
|
5
|
+
*
|
|
6
|
+
* This function returns the entrypoints put into these types of groups.
|
|
7
|
+
*/
|
|
8
|
+
export declare function groupEntrypoints(entrypoints: Entrypoint[]): EntrypointGroup[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function groupEntrypoints(entrypoints) {
|
|
2
|
+
const groupIndexMap = {};
|
|
3
|
+
const groups = [];
|
|
4
|
+
for (const entry of entrypoints) {
|
|
5
|
+
let group = ENTRY_TYPE_TO_GROUP_MAP[entry.type];
|
|
6
|
+
if (entry.type === "background" && entry.options.type === "module") {
|
|
7
|
+
group = "esm";
|
|
8
|
+
}
|
|
9
|
+
if (group === "individual") {
|
|
10
|
+
groups.push(entry);
|
|
11
|
+
} else {
|
|
12
|
+
let groupIndex = groupIndexMap[group];
|
|
13
|
+
if (groupIndex == null) {
|
|
14
|
+
groupIndex = groups.push([]) - 1;
|
|
15
|
+
groupIndexMap[group] = groupIndex;
|
|
16
|
+
}
|
|
17
|
+
groups[groupIndex].push(entry);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return groups;
|
|
21
|
+
}
|
|
22
|
+
const ENTRY_TYPE_TO_GROUP_MAP = {
|
|
23
|
+
sandbox: "sandboxed-esm",
|
|
24
|
+
popup: "esm",
|
|
25
|
+
newtab: "esm",
|
|
26
|
+
history: "esm",
|
|
27
|
+
options: "esm",
|
|
28
|
+
devtools: "esm",
|
|
29
|
+
bookmarks: "esm",
|
|
30
|
+
sidepanel: "esm",
|
|
31
|
+
"unlisted-page": "esm",
|
|
32
|
+
background: "individual",
|
|
33
|
+
"content-script": "individual",
|
|
34
|
+
"unlisted-script": "individual",
|
|
35
|
+
"unlisted-style": "individual",
|
|
36
|
+
"content-script-style": "individual"
|
|
37
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the value from the default export of a `path`.
|
|
3
|
+
*
|
|
4
|
+
* It works by:
|
|
5
|
+
*
|
|
6
|
+
* 1. Reading the file text
|
|
7
|
+
* 2. Stripping all imports from it via regex
|
|
8
|
+
* 3. Auto-import only the client helper functions
|
|
9
|
+
*
|
|
10
|
+
* This prevents resolving imports of imports, speeding things up and preventing "xxx is not
|
|
11
|
+
* defined" errors.
|
|
12
|
+
*
|
|
13
|
+
* Downside is that code cannot be executed outside of the main fucntion for the entrypoint,
|
|
14
|
+
* otherwise you will see "xxx is not defined" errors for any imports used outside of main function.
|
|
15
|
+
*/
|
|
16
|
+
export declare function importEntrypointFile<T>(path: string): Promise<T>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import createJITI from "jiti";
|
|
2
|
+
import { createUnimport } from "unimport";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { relative, resolve } from "node:path";
|
|
5
|
+
import { removeProjectImportStatements } from "../../utils/strings.mjs";
|
|
6
|
+
import { normalizePath } from "../../utils/paths.mjs";
|
|
7
|
+
import { transformSync } from "esbuild";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { wxt } from "../../wxt.mjs";
|
|
10
|
+
export async function importEntrypointFile(path) {
|
|
11
|
+
wxt.logger.debug("Loading file metadata:", path);
|
|
12
|
+
const normalPath = normalizePath(path);
|
|
13
|
+
const unimport = createUnimport({
|
|
14
|
+
...wxt.config.imports,
|
|
15
|
+
// Only allow specific imports, not all from the project
|
|
16
|
+
dirs: []
|
|
17
|
+
});
|
|
18
|
+
await unimport.init();
|
|
19
|
+
const text = await fs.readFile(path, "utf-8");
|
|
20
|
+
const textNoImports = removeProjectImportStatements(text);
|
|
21
|
+
const { code } = await unimport.injectImports(textNoImports);
|
|
22
|
+
wxt.logger.debug(
|
|
23
|
+
["Text:", text, "No imports:", textNoImports, "Code:", code].join("\n")
|
|
24
|
+
);
|
|
25
|
+
const jiti = createJITI(
|
|
26
|
+
typeof __filename !== "undefined" ? __filename : fileURLToPath(import.meta.url),
|
|
27
|
+
{
|
|
28
|
+
cache: false,
|
|
29
|
+
debug: wxt.config.debug,
|
|
30
|
+
esmResolve: true,
|
|
31
|
+
alias: {
|
|
32
|
+
"webextension-polyfill": resolve(
|
|
33
|
+
wxt.config.wxtModuleDir,
|
|
34
|
+
"dist/virtual/mock-browser.mjs"
|
|
35
|
+
),
|
|
36
|
+
// TODO: Resolve this virtual module to some file with
|
|
37
|
+
// `export default {}` instead of this hack of using another file with
|
|
38
|
+
// a default export.
|
|
39
|
+
"virtual:app-config": resolve(
|
|
40
|
+
wxt.config.wxtModuleDir,
|
|
41
|
+
"dist/virtual/mock-browser.mjs"
|
|
42
|
+
)
|
|
43
|
+
},
|
|
44
|
+
// Continue using node to load TS files even if `bun run --bun` is detected. Jiti does not
|
|
45
|
+
// respect the custom transform function when using it's native bun option.
|
|
46
|
+
experimentalBun: false,
|
|
47
|
+
// List of extensions to transform with esbuild
|
|
48
|
+
extensions: [
|
|
49
|
+
".ts",
|
|
50
|
+
".cts",
|
|
51
|
+
".mts",
|
|
52
|
+
".tsx",
|
|
53
|
+
".js",
|
|
54
|
+
".cjs",
|
|
55
|
+
".mjs",
|
|
56
|
+
".jsx"
|
|
57
|
+
],
|
|
58
|
+
transform(opts) {
|
|
59
|
+
const isEntrypoint = opts.filename === normalPath;
|
|
60
|
+
return transformSync(
|
|
61
|
+
// Use modified source code for entrypoints
|
|
62
|
+
isEntrypoint ? code : opts.source,
|
|
63
|
+
getEsbuildOptions(opts)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
try {
|
|
69
|
+
const res = await jiti(path);
|
|
70
|
+
return res.default;
|
|
71
|
+
} catch (err) {
|
|
72
|
+
const filePath = relative(wxt.config.root, path);
|
|
73
|
+
if (err instanceof ReferenceError) {
|
|
74
|
+
const variableName = err.message.replace(" is not defined", "");
|
|
75
|
+
throw Error(
|
|
76
|
+
`${filePath}: Cannot use imported variable "${variableName}" outside the main function. See https://wxt.dev/guide/go-further/entrypoint-side-effects.html`,
|
|
77
|
+
{ cause: err }
|
|
78
|
+
);
|
|
79
|
+
} else {
|
|
80
|
+
wxt.logger.error(err);
|
|
81
|
+
throw Error(`Failed to load entrypoint: ${filePath}`, { cause: err });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function getEsbuildOptions(opts) {
|
|
86
|
+
const isJsx = opts.filename?.endsWith("x");
|
|
87
|
+
return {
|
|
88
|
+
format: "cjs",
|
|
89
|
+
loader: isJsx ? "tsx" : "ts",
|
|
90
|
+
...isJsx ? {
|
|
91
|
+
// `h` and `Fragment` are undefined, but that's OK because JSX is never evaluated while
|
|
92
|
+
// grabbing the entrypoint's options.
|
|
93
|
+
jsxFactory: "h",
|
|
94
|
+
jsxFragment: "Fragment"
|
|
95
|
+
} : void 0
|
|
96
|
+
};
|
|
97
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './build-entrypoints';
|
|
2
|
+
export * from './detect-dev-changes';
|
|
3
|
+
export * from './find-entrypoints';
|
|
4
|
+
export * from './generate-wxt-dir';
|
|
5
|
+
export * from './resolve-config';
|
|
6
|
+
export * from './group-entrypoints';
|
|
7
|
+
export * from './import-entrypoint';
|
|
8
|
+
export * from './internal-build';
|
|
9
|
+
export * from './rebuild';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./build-entrypoints.mjs";
|
|
2
|
+
export * from "./detect-dev-changes.mjs";
|
|
3
|
+
export * from "./find-entrypoints.mjs";
|
|
4
|
+
export * from "./generate-wxt-dir.mjs";
|
|
5
|
+
export * from "./resolve-config.mjs";
|
|
6
|
+
export * from "./group-entrypoints.mjs";
|
|
7
|
+
export * from "./import-entrypoint.mjs";
|
|
8
|
+
export * from "./internal-build.mjs";
|
|
9
|
+
export * from "./rebuild.mjs";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BuildOutput } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the extension based on an internal config. No more config discovery is performed, the
|
|
4
|
+
* build is based on exactly what is passed in.
|
|
5
|
+
*
|
|
6
|
+
* This function:
|
|
7
|
+
* 1. Cleans the output directory
|
|
8
|
+
* 2. Executes the rebuild function with a blank previous output so everything is built (see
|
|
9
|
+
* `rebuild` for more details)
|
|
10
|
+
* 3. Prints the summary
|
|
11
|
+
*/
|
|
12
|
+
export declare function internalBuild(): Promise<BuildOutput>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { findEntrypoints } from "./find-entrypoints.mjs";
|
|
2
|
+
import pc from "picocolors";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { groupEntrypoints } from "./group-entrypoints.mjs";
|
|
5
|
+
import { formatDuration } from "../../utils/time.mjs";
|
|
6
|
+
import { printBuildSummary } from "../../utils/log/index.mjs";
|
|
7
|
+
import glob from "fast-glob";
|
|
8
|
+
import { unnormalizePath } from "../../utils/paths.mjs";
|
|
9
|
+
import { rebuild } from "./rebuild.mjs";
|
|
10
|
+
import { relative } from "node:path";
|
|
11
|
+
import {
|
|
12
|
+
ValidationError,
|
|
13
|
+
validateEntrypoints
|
|
14
|
+
} from "../validation.mjs";
|
|
15
|
+
import { wxt } from "../../wxt.mjs";
|
|
16
|
+
import { mergeJsonOutputs } from "@aklinker1/rollup-plugin-visualizer";
|
|
17
|
+
import { isCI } from "ci-info";
|
|
18
|
+
export async function internalBuild() {
|
|
19
|
+
await wxt.hooks.callHook("build:before", wxt);
|
|
20
|
+
const verb = wxt.config.command === "serve" ? "Pre-rendering" : "Building";
|
|
21
|
+
const target = `${wxt.config.browser}-mv${wxt.config.manifestVersion}`;
|
|
22
|
+
wxt.logger.info(
|
|
23
|
+
`${verb} ${pc.cyan(target)} for ${pc.cyan(wxt.config.mode)} with ${pc.green(
|
|
24
|
+
`${wxt.builder.name} ${wxt.builder.version}`
|
|
25
|
+
)}`
|
|
26
|
+
);
|
|
27
|
+
const startTime = Date.now();
|
|
28
|
+
await fs.rm(wxt.config.outDir, { recursive: true, force: true });
|
|
29
|
+
await fs.ensureDir(wxt.config.outDir);
|
|
30
|
+
const entrypoints = await findEntrypoints();
|
|
31
|
+
wxt.logger.debug("Detected entrypoints:", entrypoints);
|
|
32
|
+
const validationResults = validateEntrypoints(entrypoints);
|
|
33
|
+
if (validationResults.errorCount + validationResults.warningCount > 0) {
|
|
34
|
+
printValidationResults(validationResults);
|
|
35
|
+
}
|
|
36
|
+
if (validationResults.errorCount > 0) {
|
|
37
|
+
throw new ValidationError(`Entrypoint validation failed`, {
|
|
38
|
+
cause: validationResults
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const groups = groupEntrypoints(entrypoints);
|
|
42
|
+
await wxt.hooks.callHook("entrypoints:grouped", wxt, groups);
|
|
43
|
+
const { output, warnings } = await rebuild(entrypoints, groups, void 0);
|
|
44
|
+
await wxt.hooks.callHook("build:done", wxt, output);
|
|
45
|
+
await printBuildSummary(
|
|
46
|
+
wxt.logger.success,
|
|
47
|
+
`Built extension in ${formatDuration(Date.now() - startTime)}`,
|
|
48
|
+
output
|
|
49
|
+
);
|
|
50
|
+
for (const warning of warnings) {
|
|
51
|
+
wxt.logger.warn(...warning);
|
|
52
|
+
}
|
|
53
|
+
if (wxt.config.analysis.enabled) {
|
|
54
|
+
await combineAnalysisStats();
|
|
55
|
+
const statsPath = relative(wxt.config.root, wxt.config.analysis.outputFile);
|
|
56
|
+
wxt.logger.info(
|
|
57
|
+
`Analysis complete:
|
|
58
|
+
${pc.gray("\u2514\u2500")} ${pc.yellow(statsPath)}`
|
|
59
|
+
);
|
|
60
|
+
if (wxt.config.analysis.open) {
|
|
61
|
+
if (isCI) {
|
|
62
|
+
wxt.logger.debug(`Skipped opening ${pc.yellow(statsPath)} in CI`);
|
|
63
|
+
} else {
|
|
64
|
+
wxt.logger.info(`Opening ${pc.yellow(statsPath)} in browser...`);
|
|
65
|
+
const { default: open } = await import("open");
|
|
66
|
+
open(wxt.config.analysis.outputFile);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return output;
|
|
71
|
+
}
|
|
72
|
+
async function combineAnalysisStats() {
|
|
73
|
+
const unixFiles = await glob(`${wxt.config.analysis.outputName}-*.json`, {
|
|
74
|
+
cwd: wxt.config.analysis.outputDir,
|
|
75
|
+
absolute: true
|
|
76
|
+
});
|
|
77
|
+
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
78
|
+
await mergeJsonOutputs({
|
|
79
|
+
inputs: absolutePaths,
|
|
80
|
+
template: wxt.config.analysis.template,
|
|
81
|
+
filename: wxt.config.analysis.outputFile
|
|
82
|
+
});
|
|
83
|
+
if (!wxt.config.analysis.keepArtifacts) {
|
|
84
|
+
await Promise.all(absolutePaths.map((statsFile) => fs.remove(statsFile)));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function printValidationResults({
|
|
88
|
+
errorCount,
|
|
89
|
+
errors,
|
|
90
|
+
warningCount
|
|
91
|
+
}) {
|
|
92
|
+
(errorCount > 0 ? wxt.logger.error : wxt.logger.warn)(
|
|
93
|
+
`Entrypoint validation failed: ${errorCount} error${errorCount === 1 ? "" : "s"}, ${warningCount} warning${warningCount === 1 ? "" : "s"}`
|
|
94
|
+
);
|
|
95
|
+
const cwd = process.cwd();
|
|
96
|
+
const entrypointErrors = errors.reduce((map, error) => {
|
|
97
|
+
const entryErrors = map.get(error.entrypoint) ?? [];
|
|
98
|
+
entryErrors.push(error);
|
|
99
|
+
map.set(error.entrypoint, entryErrors);
|
|
100
|
+
return map;
|
|
101
|
+
}, /* @__PURE__ */ new Map());
|
|
102
|
+
Array.from(entrypointErrors.entries()).forEach(([entrypoint, errors2]) => {
|
|
103
|
+
wxt.logger.log(relative(cwd, entrypoint.inputPath));
|
|
104
|
+
console.log();
|
|
105
|
+
errors2.forEach((err) => {
|
|
106
|
+
const type = err.type === "error" ? pc.red("ERROR") : pc.yellow("WARN");
|
|
107
|
+
const recieved = pc.dim(`(recieved: ${JSON.stringify(err.value)})`);
|
|
108
|
+
wxt.logger.log(` - ${type} ${err.message} ${recieved}`);
|
|
109
|
+
});
|
|
110
|
+
console.log();
|
|
111
|
+
});
|
|
112
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Manifest } from 'wxt/browser';
|
|
2
|
+
import { BuildOutput, Entrypoint, EntrypointGroup } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Given a configuration, list of entrypoints, and an existing, partial output, build the
|
|
5
|
+
* entrypoints and merge the new output with the existing output.
|
|
6
|
+
*
|
|
7
|
+
* This function will:
|
|
8
|
+
* 1. Generate the .wxt directory's types
|
|
9
|
+
* 2. Build the `entrypointGroups` (and copies public files)
|
|
10
|
+
* 3. Generate the latest manifest for all entrypoints
|
|
11
|
+
* 4. Write the new manifest to the file system
|
|
12
|
+
*
|
|
13
|
+
* @param config Internal config containing all the project information.
|
|
14
|
+
* @param allEntrypoints List of entrypoints used to generate the types inside .wxt directory.
|
|
15
|
+
* @param entrypointGroups The list of entrypoint groups to build.
|
|
16
|
+
* @param existingOutput The previous output to combine the rebuild results into. An emptry array if
|
|
17
|
+
* this is the first build.
|
|
18
|
+
*/
|
|
19
|
+
export declare function rebuild(allEntrypoints: Entrypoint[], entrypointGroups: EntrypointGroup[], existingOutput?: Omit<BuildOutput, 'manifest'>): Promise<{
|
|
20
|
+
output: BuildOutput;
|
|
21
|
+
manifest: Manifest.WebExtensionManifest;
|
|
22
|
+
warnings: any[][];
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { generateTypesDir } from "./generate-wxt-dir.mjs";
|
|
2
|
+
import { buildEntrypoints } from "./build-entrypoints.mjs";
|
|
3
|
+
import { generateManifest, writeManifest } from "../../utils/manifest.mjs";
|
|
4
|
+
import { wxt } from "../../wxt.mjs";
|
|
5
|
+
export async function rebuild(allEntrypoints, entrypointGroups, existingOutput = {
|
|
6
|
+
steps: [],
|
|
7
|
+
publicAssets: []
|
|
8
|
+
}) {
|
|
9
|
+
const { default: ora } = await import("ora");
|
|
10
|
+
const spinner = ora(`Preparing...`).start();
|
|
11
|
+
await generateTypesDir(allEntrypoints).catch((err) => {
|
|
12
|
+
wxt.logger.warn("Failed to update .wxt directory:", err);
|
|
13
|
+
if (wxt.config.command === "build") throw err;
|
|
14
|
+
});
|
|
15
|
+
const newOutput = await buildEntrypoints(entrypointGroups, spinner);
|
|
16
|
+
const mergedOutput = {
|
|
17
|
+
steps: [...existingOutput.steps, ...newOutput.steps],
|
|
18
|
+
publicAssets: [...existingOutput.publicAssets, ...newOutput.publicAssets]
|
|
19
|
+
};
|
|
20
|
+
const { manifest: newManifest, warnings: manifestWarnings } = await generateManifest(allEntrypoints, mergedOutput);
|
|
21
|
+
const finalOutput = {
|
|
22
|
+
manifest: newManifest,
|
|
23
|
+
...newOutput
|
|
24
|
+
};
|
|
25
|
+
await writeManifest(newManifest, finalOutput);
|
|
26
|
+
spinner.clear().stop();
|
|
27
|
+
return {
|
|
28
|
+
output: {
|
|
29
|
+
manifest: newManifest,
|
|
30
|
+
steps: [...existingOutput.steps, ...finalOutput.steps],
|
|
31
|
+
publicAssets: [
|
|
32
|
+
...existingOutput.publicAssets,
|
|
33
|
+
...finalOutput.publicAssets
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
manifest: newManifest,
|
|
37
|
+
warnings: manifestWarnings
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InlineConfig, ResolvedConfig, UserConfig, Logger, WxtCommand, WxtModuleWithMetadata } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Given an inline config, discover the config file if necessary, merge the results, resolve any
|
|
4
|
+
* relative paths, and apply any defaults.
|
|
5
|
+
*
|
|
6
|
+
* Inline config always has priority over user config. Cli flags are passed as inline config if set.
|
|
7
|
+
* If unset, undefined is passed in, letting this function decide default values.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveConfig(inlineConfig: InlineConfig, command: WxtCommand): Promise<ResolvedConfig>;
|
|
10
|
+
export declare function mergeBuilderConfig(logger: Logger, inlineConfig: InlineConfig, userConfig: UserConfig): Promise<Pick<InlineConfig, 'vite'>>;
|
|
11
|
+
export declare function resolveWxtUserModules(modulesDir: string, modules?: string[]): Promise<WxtModuleWithMetadata<any>[]>;
|