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,53 @@
|
|
|
1
|
+
export function getGlobals(config) {
|
|
2
|
+
return [
|
|
3
|
+
{
|
|
4
|
+
name: "MANIFEST_VERSION",
|
|
5
|
+
value: config.manifestVersion,
|
|
6
|
+
type: `2 | 3`
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: "BROWSER",
|
|
10
|
+
value: config.browser,
|
|
11
|
+
type: `string`
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "CHROME",
|
|
15
|
+
value: config.browser === "chrome",
|
|
16
|
+
type: `boolean`
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "FIREFOX",
|
|
20
|
+
value: config.browser === "firefox",
|
|
21
|
+
type: `boolean`
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "SAFARI",
|
|
25
|
+
value: config.browser === "safari",
|
|
26
|
+
type: `boolean`
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "EDGE",
|
|
30
|
+
value: config.browser === "edge",
|
|
31
|
+
type: `boolean`
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "OPERA",
|
|
35
|
+
value: config.browser === "opera",
|
|
36
|
+
type: `boolean`
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "COMMAND",
|
|
40
|
+
value: config.command,
|
|
41
|
+
type: `"build" | "serve"`
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
export function getEntrypointGlobals(entrypointName) {
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
name: "ENTRYPOINT",
|
|
49
|
+
value: entrypointName,
|
|
50
|
+
type: `string`
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Message {
|
|
2
|
+
name: string;
|
|
3
|
+
message: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Get a list of all messages and their metadata from JSON file contents.
|
|
8
|
+
*
|
|
9
|
+
* @param messagesJson The contents of a `_locales/en/messages.json` file.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseI18nMessages(messagesJson: object): Message[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const predefinedMessages = {
|
|
2
|
+
"@@extension_id": {
|
|
3
|
+
message: "<browser.runtime.id>",
|
|
4
|
+
description: "The extension or app ID; you might use this string to construct URLs for resources inside the extension. Even unlocalized extensions can use this message.\nNote: You can't use this message in a manifest file."
|
|
5
|
+
},
|
|
6
|
+
"@@ui_locale": {
|
|
7
|
+
message: "<browser.i18n.getUiLocale()>",
|
|
8
|
+
description: ""
|
|
9
|
+
},
|
|
10
|
+
"@@bidi_dir": {
|
|
11
|
+
message: "<ltr|rtl>",
|
|
12
|
+
description: 'The text direction for the current locale, either "ltr" for left-to-right languages such as English or "rtl" for right-to-left languages such as Japanese.'
|
|
13
|
+
},
|
|
14
|
+
"@@bidi_reversed_dir": {
|
|
15
|
+
message: "<rtl|ltr>",
|
|
16
|
+
description: `If the @@bidi_dir is "ltr", then this is "rtl"; otherwise, it's "ltr".`
|
|
17
|
+
},
|
|
18
|
+
"@@bidi_start_edge": {
|
|
19
|
+
message: "<left|right>",
|
|
20
|
+
description: `If the @@bidi_dir is "ltr", then this is "left"; otherwise, it's "right".`
|
|
21
|
+
},
|
|
22
|
+
"@@bidi_end_edge": {
|
|
23
|
+
message: "<right|left>",
|
|
24
|
+
description: `If the @@bidi_dir is "ltr", then this is "right"; otherwise, it's "left".`
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export function parseI18nMessages(messagesJson) {
|
|
28
|
+
return Object.entries({
|
|
29
|
+
...predefinedMessages,
|
|
30
|
+
...messagesJson
|
|
31
|
+
}).map(([name, details]) => ({
|
|
32
|
+
name,
|
|
33
|
+
...details
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
import { printFileList } from "./printFileList.mjs";
|
|
3
|
+
import { wxt } from "../../wxt.mjs";
|
|
4
|
+
export async function printBuildSummary(log, header, output) {
|
|
5
|
+
const chunks = [
|
|
6
|
+
...output.steps.flatMap((step) => step.chunks),
|
|
7
|
+
...output.publicAssets
|
|
8
|
+
].sort((l, r) => {
|
|
9
|
+
const lWeight = getChunkSortWeight(l.fileName);
|
|
10
|
+
const rWeight = getChunkSortWeight(r.fileName);
|
|
11
|
+
const diff = lWeight - rWeight;
|
|
12
|
+
if (diff !== 0) return diff;
|
|
13
|
+
return l.fileName.localeCompare(r.fileName);
|
|
14
|
+
});
|
|
15
|
+
const files = chunks.map(
|
|
16
|
+
(chunk) => resolve(wxt.config.outDir, chunk.fileName)
|
|
17
|
+
);
|
|
18
|
+
await printFileList(log, header, wxt.config.outDir, files);
|
|
19
|
+
}
|
|
20
|
+
const DEFAULT_SORT_WEIGHT = 100;
|
|
21
|
+
const CHUNK_SORT_WEIGHTS = {
|
|
22
|
+
"manifest.json": 0,
|
|
23
|
+
".html": 1,
|
|
24
|
+
".js.map": 2,
|
|
25
|
+
".js": 2,
|
|
26
|
+
".css": 3
|
|
27
|
+
};
|
|
28
|
+
function getChunkSortWeight(filename) {
|
|
29
|
+
return Object.entries(CHUNK_SORT_WEIGHTS).find(
|
|
30
|
+
([key]) => filename.endsWith(key)
|
|
31
|
+
)?.[1] ?? DEFAULT_SORT_WEIGHT;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function printFileList(log: (message: string) => void, header: string, baseDir: string, files: string[]): Promise<void>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import pc from "picocolors";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { filesize } from "filesize";
|
|
5
|
+
import { printTable } from "./printTable.mjs";
|
|
6
|
+
export async function printFileList(log, header, baseDir, files) {
|
|
7
|
+
let totalSize = 0;
|
|
8
|
+
const fileRows = await Promise.all(
|
|
9
|
+
files.map(async (file, i) => {
|
|
10
|
+
const parts = [
|
|
11
|
+
path.relative(process.cwd(), baseDir) + path.sep,
|
|
12
|
+
path.relative(baseDir, file)
|
|
13
|
+
];
|
|
14
|
+
const prefix = i === files.length - 1 ? " \u2514\u2500" : " \u251C\u2500";
|
|
15
|
+
const color = getChunkColor(file);
|
|
16
|
+
const stats = await fs.lstat(file);
|
|
17
|
+
totalSize += stats.size;
|
|
18
|
+
const size = String(filesize(stats.size));
|
|
19
|
+
return [
|
|
20
|
+
`${pc.gray(prefix)} ${pc.dim(parts[0])}${color(parts[1])}`,
|
|
21
|
+
pc.dim(size)
|
|
22
|
+
];
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
fileRows.push([`${pc.cyan("\u03A3 Total size:")} ${String(filesize(totalSize))}`]);
|
|
26
|
+
printTable(log, header, fileRows);
|
|
27
|
+
}
|
|
28
|
+
const DEFAULT_COLOR = pc.blue;
|
|
29
|
+
const CHUNK_COLORS = {
|
|
30
|
+
".js.map": pc.gray,
|
|
31
|
+
".cjs.map": pc.gray,
|
|
32
|
+
".mjs.map": pc.gray,
|
|
33
|
+
".html": pc.green,
|
|
34
|
+
".css": pc.magenta,
|
|
35
|
+
".js": pc.cyan,
|
|
36
|
+
".cjs": pc.cyan,
|
|
37
|
+
".mjs": pc.cyan,
|
|
38
|
+
".zip": pc.yellow
|
|
39
|
+
};
|
|
40
|
+
function getChunkColor(filename) {
|
|
41
|
+
return Object.entries(CHUNK_COLORS).find(([key]) => filename.endsWith(key))?.[1] ?? DEFAULT_COLOR;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function printHeader(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function printTable(log: (message: string) => void, header: string, rows: string[][], gap?: number): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function printTable(log, header, rows, gap = 2) {
|
|
2
|
+
if (rows.length === 0) return;
|
|
3
|
+
const columnWidths = rows.reduce(
|
|
4
|
+
(widths, row) => {
|
|
5
|
+
for (let i = 0; i < Math.max(widths.length, row.length); i++) {
|
|
6
|
+
widths[i] = Math.max(row[i]?.length ?? 0, widths[i] ?? 0);
|
|
7
|
+
}
|
|
8
|
+
return widths;
|
|
9
|
+
},
|
|
10
|
+
rows[0].map((column) => column.length)
|
|
11
|
+
);
|
|
12
|
+
let str = "";
|
|
13
|
+
rows.forEach((row, i) => {
|
|
14
|
+
row.forEach((col, j) => {
|
|
15
|
+
str += col.padEnd(columnWidths[j], " ");
|
|
16
|
+
if (j !== row.length - 1) str += "".padEnd(gap, " ");
|
|
17
|
+
});
|
|
18
|
+
if (i !== rows.length - 1) str += "\n";
|
|
19
|
+
});
|
|
20
|
+
log(`${header}
|
|
21
|
+
${str}`);
|
|
22
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Manifest } from 'wxt/browser';
|
|
2
|
+
import { Entrypoint, BuildOutput, ContentScriptEntrypoint } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Writes the manifest to the output directory and the build output.
|
|
5
|
+
*/
|
|
6
|
+
export declare function writeManifest(manifest: Manifest.WebExtensionManifest, output: BuildOutput): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Generates the manifest based on the config and entrypoints.
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateManifest(entrypoints: Entrypoint[], buildOutput: Omit<BuildOutput, 'manifest'>): Promise<{
|
|
11
|
+
manifest: Manifest.WebExtensionManifest;
|
|
12
|
+
warnings: any[][];
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the bundle paths to CSS files associated with a list of content scripts, or undefined if
|
|
16
|
+
* there is no associated CSS.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getContentScriptCssFiles(contentScripts: ContentScriptEntrypoint[], contentScriptCssMap: Record<string, string | undefined>): string[] | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Content scripts configured with `cssInjectionMode: "ui"` need to add their CSS files to web
|
|
21
|
+
* accessible resources so they can be fetched as text and added to shadow roots that the UI is
|
|
22
|
+
* added to.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getContentScriptCssWebAccessibleResources(contentScripts: ContentScriptEntrypoint[], contentScriptCssMap: Record<string, string | undefined>): any[];
|
|
25
|
+
/**
|
|
26
|
+
* Based on the build output, return a Record of each content script's name to it CSS file if the
|
|
27
|
+
* script includes one.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getContentScriptsCssMap(buildOutput: Omit<BuildOutput, 'manifest'>, scripts: ContentScriptEntrypoint[]): Record<string, string | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* - "<all_urls>" → "<all_urls>"
|
|
32
|
+
* - "*://play.google.com/books/*" → "*://play.google.com/*"
|
|
33
|
+
*/
|
|
34
|
+
export declare function stripPathFromMatchPattern(pattern: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Converts all MV3 web accessible resources to their MV2 forms. MV3 web accessible resources are
|
|
37
|
+
* generated in this file, and may be defined by the user in their manifest. In both cases, when
|
|
38
|
+
* targetting MV2, automatically convert their definitions down to the basic MV2 array.
|
|
39
|
+
*/
|
|
40
|
+
export declare function convertWebAccessibleResourcesToMv2(manifest: Manifest.WebExtensionManifest): void;
|
|
41
|
+
/**
|
|
42
|
+
* Make sure all resources are in MV3 format. If not, add a wanring
|
|
43
|
+
*/
|
|
44
|
+
export declare function validateMv3WebAccessbileResources(manifest: Manifest.WebExtensionManifest): void;
|