wxt 0.21.3 → 0.21.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{core/build.d.mts → build.d.mts} +2 -2
- package/dist/{core/build.mjs → build.mjs} +3 -4
- package/dist/{core/clean.d.mts → clean.d.mts} +2 -2
- package/dist/{core/clean.mjs → clean.mjs} +3 -3
- package/dist/cli/cli-utils.mjs +11 -8
- package/dist/cli/commands.mjs +10 -9
- package/dist/{core/create-server.d.mts → create-server.d.mts} +2 -2
- package/dist/{core/create-server.mjs → create-server.mjs} +13 -14
- package/dist/define-config.d.mts +6 -0
- package/dist/{core/define-config.mjs → define-config.mjs} +1 -1
- package/dist/{core/define-web-ext-config.d.mts → define-web-ext-config.d.mts} +2 -2
- package/dist/{core/define-web-ext-config.mjs → define-web-ext-config.mjs} +1 -1
- package/dist/index.d.mts +12 -12
- package/dist/index.mjs +10 -11
- package/dist/{core/initialize.d.mts → initialize.d.mts} +2 -1
- package/dist/{core/initialize.mjs → initialize.mjs} +22 -7
- package/dist/inline/dotenv-expand/index.mjs +31 -0
- package/dist/inline/get-port-please/index.mjs +196 -0
- package/dist/inline/is-wsl/index.mjs +44 -0
- package/dist/inline/normalize-path/index.mjs +23 -0
- package/dist/inline/ohash/index.mjs +113 -0
- package/dist/inline/scule/index.mjs +50 -0
- package/dist/{core/utils/building → internal}/build-entrypoints.mjs +5 -5
- package/dist/internal/builders/unknown.mjs +22 -0
- package/dist/{core → internal}/builders/vite/index.mjs +144 -139
- package/dist/internal/builders/vite/plugins/add-entrypoint-group-runtime-env-entries.mjs +16 -0
- package/dist/internal/builders/vite/plugins/add-runtime-env-entries.mjs +14 -0
- package/dist/{core/builders/vite/plugins/bundleAnalysis.mjs → internal/builders/vite/plugins/bundle-analysis.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/cssEntrypoints.mjs → internal/builders/vite/plugins/css-entrypoints.mjs} +2 -2
- package/dist/{core/builders/vite/plugins/defineImportMeta.mjs → internal/builders/vite/plugins/define-import-meta.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/devHtmlPrerender.mjs → internal/builders/vite/plugins/dev-html-prerender.mjs} +6 -7
- package/dist/{core/builders/vite/plugins/devServerGlobals.mjs → internal/builders/vite/plugins/dev-server-globals.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/extensionApiMock.mjs → internal/builders/vite/plugins/extension-api-mock.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/iifeAnonymous.mjs → internal/builders/vite/plugins/iife-anonymous.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/iifeFooter.mjs → internal/builders/vite/plugins/iife-footer.mjs} +1 -1
- package/dist/internal/builders/vite/plugins/index.mjs +17 -0
- package/dist/{core/builders/vite/plugins/noopBackground.mjs → internal/builders/vite/plugins/noop-background.mjs} +2 -2
- package/dist/{core/builders/vite/plugins/removeEntrypointMainFunction.mjs → internal/builders/vite/plugins/remove-entrypoint-main-function.mjs} +3 -4
- package/dist/{core/builders/vite/plugins/resolveAppConfig.mjs → internal/builders/vite/plugins/resolve-app-config.mjs} +2 -2
- package/dist/{core/builders/vite/plugins/resolveVirtualModules.mjs → internal/builders/vite/plugins/resolve-virtual-modules.mjs} +8 -6
- package/dist/{core/builders/vite/plugins/tsconfigPaths.mjs → internal/builders/vite/plugins/tsconfig-paths.mjs} +1 -1
- package/dist/internal/builders/vite/plugins/wxt-plugin-loader.mjs +77 -0
- package/dist/{builtin-modules → internal/builtin-modules}/escape-unicode.mjs +2 -2
- package/dist/{builtin-modules → internal/builtin-modules}/favicon-permission.mjs +2 -2
- package/dist/{builtin-modules → internal/builtin-modules}/index.mjs +4 -2
- package/dist/internal/builtin-modules/plugins.mjs +21 -0
- package/dist/{builtin-modules → internal/builtin-modules}/unimport.mjs +20 -9
- package/dist/{core/utils → internal}/constants.mjs +1 -1
- package/dist/internal/detect-builder.mjs +9 -0
- package/dist/{core/utils/building → internal}/detect-dev-changes.mjs +4 -4
- package/dist/internal/detect-runner.mjs +11 -0
- package/dist/internal/entrypoint-finders/flat.mjs +84 -0
- package/dist/internal/environments/browser-environment.mjs +48 -0
- package/dist/{core/utils → internal}/environments/environment.mjs +1 -1
- package/dist/{core/utils → internal}/environments/extension-environment.mjs +1 -1
- package/dist/{core/utils/create-file-reloader.mjs → internal/file-reloader.mjs} +10 -11
- package/dist/{core/utils/building → internal}/find-entrypoints.mjs +10 -75
- package/dist/{core → internal}/generate-wxt-dir.mjs +10 -10
- package/dist/internal/get-public-files.mjs +14 -0
- package/dist/{core/utils/building → internal}/group-entrypoints.mjs +1 -1
- package/dist/{core/utils → internal}/i18n.mjs +1 -1
- package/dist/{core/utils/building → internal}/internal-build.mjs +10 -10
- package/dist/{core → internal}/keyboard-shortcuts.mjs +2 -1
- package/dist/{core/utils → internal}/manifest.mjs +14 -14
- package/dist/internal/package-managers/bun.mjs +22 -0
- package/dist/{core → internal}/package-managers/deno.mjs +1 -1
- package/dist/{core → internal}/package-managers/index.mjs +1 -1
- package/dist/{core → internal}/package-managers/npm.mjs +11 -5
- package/dist/{core → internal}/package-managers/pnpm.mjs +6 -3
- package/dist/{core → internal}/package-managers/yarn.mjs +6 -3
- package/dist/{core/utils → internal}/package.mjs +3 -3
- package/dist/{core/utils/building → internal}/rebuild.mjs +5 -5
- package/dist/{core → internal}/resolve-config.mjs +22 -42
- package/dist/internal/runners/manual.mjs +22 -0
- package/dist/internal/runners/web-ext.mjs +79 -0
- package/dist/{core/utils/globals.mjs → internal/runtime-env-entries.mjs} +4 -4
- package/dist/internal/spinner.mjs +69 -0
- package/dist/{core/utils → internal}/syntax-errors.mjs +2 -2
- package/dist/{core/utils → internal}/theme-icons.mjs +3 -3
- package/dist/{core/utils → internal}/transform.mjs +1 -1
- package/dist/{core/utils → internal}/validation.mjs +1 -1
- package/dist/{core → internal}/wxt.mjs +24 -7
- package/dist/{core/utils/arrays.mjs → internal-utils/array-utils.mjs} +1 -1
- package/dist/{core/utils/cache.mjs → internal-utils/cache-utils.mjs} +3 -3
- package/dist/{core/utils/content-scripts.mjs → internal-utils/content-script-utils.mjs} +2 -2
- package/dist/{core/utils/content-security-policy.mjs → internal-utils/csp-utils.mjs} +1 -1
- package/dist/{core/utils/entrypoints.d.mts → internal-utils/entrypoint-utils.d.mts} +2 -2
- package/dist/{core/utils/entrypoints.mjs → internal-utils/entrypoint-utils.mjs} +2 -2
- package/dist/{core/utils/env.mjs → internal-utils/env-utils.mjs} +3 -3
- package/dist/internal-utils/eslint-utils.mjs +8 -0
- package/dist/{core/utils/fs.mjs → internal-utils/fs-utils.mjs} +6 -11
- package/dist/internal-utils/log/index.mjs +6 -0
- package/dist/{core/utils/log/printBuildSummary.mjs → internal-utils/log/print-build-summary.mjs} +3 -3
- package/dist/{core/utils/log/printFileList.mjs → internal-utils/log/print-file-list.mjs} +9 -8
- package/dist/{core/utils/log/printHeader.mjs → internal-utils/log/print-header.mjs} +2 -2
- package/dist/{core/utils/log/printTable.mjs → internal-utils/log/print-table.mjs} +1 -1
- package/dist/internal-utils/log/wxt-logger.mjs +32 -0
- package/dist/internal-utils/module-utils.mjs +32 -0
- package/dist/{core/utils/number.mjs → internal-utils/number-utils.mjs} +1 -1
- package/dist/{core/utils/paths.d.mts → internal-utils/path-utils.d.mts} +1 -1
- package/dist/{core/utils/paths.mjs → internal-utils/path-utils.mjs} +3 -3
- package/dist/{core/utils/strings.mjs → internal-utils/string-utils.mjs} +3 -3
- package/dist/{core/utils/time.mjs → internal-utils/time-utils.mjs} +1 -1
- package/dist/{core/utils/types.d.mts → internal-utils/type-utils.d.mts} +2 -1
- package/dist/{modules.d.mts → modules/index.d.mts} +10 -4
- package/dist/{modules.mjs → modules/index.mjs} +14 -5
- package/dist/prepare.d.mts +6 -0
- package/dist/prepare.mjs +11 -0
- package/dist/testing/wxt-vitest-plugin.mjs +7 -7
- package/dist/types.d.mts +97 -47
- package/dist/utils/content-script-context.d.mts +1 -1
- package/dist/utils/content-script-ui/iframe.d.mts +7 -0
- package/dist/utils/content-script-ui/iframe.mjs +2 -0
- package/dist/utils/content-script-ui/integrated.d.mts +7 -0
- package/dist/utils/content-script-ui/integrated.mjs +2 -0
- package/dist/utils/content-script-ui/shadow-root.d.mts +7 -0
- package/dist/utils/content-script-ui/shadow-root.mjs +2 -0
- package/dist/utils/content-script-ui/types.d.mts +23 -7
- package/dist/utils/internal/custom-events.d.mts +11 -1
- package/dist/utils/internal/custom-events.mjs +4 -0
- package/dist/version.mjs +1 -1
- package/dist/virtual/background-entrypoint.mjs +11 -0
- package/dist/{core/zip.d.mts → zip.d.mts} +2 -2
- package/dist/{core/zip.mjs → zip.mjs} +11 -13
- package/package.json +14 -15
- package/dist/core/builders/vite/plugins/entrypointGroupGlobals.mjs +0 -16
- package/dist/core/builders/vite/plugins/globals.mjs +0 -14
- package/dist/core/builders/vite/plugins/index.mjs +0 -17
- package/dist/core/builders/vite/plugins/wxtPluginLoader.mjs +0 -56
- package/dist/core/define-config.d.mts +0 -6
- package/dist/core/index.d.mts +0 -10
- package/dist/core/index.mjs +0 -12
- package/dist/core/package-managers/bun.mjs +0 -19
- package/dist/core/prepare.d.mts +0 -6
- package/dist/core/prepare.mjs +0 -12
- package/dist/core/runners/manual.mjs +0 -11
- package/dist/core/runners/safari.mjs +0 -14
- package/dist/core/runners/web-ext.mjs +0 -63
- package/dist/core/runners/wsl.mjs +0 -14
- package/dist/core/utils/building/index.mjs +0 -7
- package/dist/core/utils/environments/browser-environment.mjs +0 -18
- package/dist/core/utils/eslint.mjs +0 -11
- package/dist/core/utils/index.d.mts +0 -2
- package/dist/core/utils/index.mjs +0 -3
- package/dist/core/utils/log/index.mjs +0 -5
- /package/dist/{core/utils → internal}/environments/index.mjs +0 -0
- /package/dist/{core/utils → internal}/virtual-modules.mjs +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.21.
|
|
4
|
+
"version": "0.21.5",
|
|
5
5
|
"description": "⚡ Next-gen Web Extension Framework",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -15,39 +15,32 @@
|
|
|
15
15
|
"prepack": "bun run build"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@1natsu/wait-element": "^
|
|
18
|
+
"@1natsu/wait-element": "^5.0.0",
|
|
19
19
|
"@aklinker1/rollup-plugin-visualizer": "5.12.0",
|
|
20
20
|
"@aklinker1/zero-zip": "^1.0.1",
|
|
21
21
|
"@topcli/prompts": "^4.0.0",
|
|
22
22
|
"@webext-core/fake-browser": "^2.0.1",
|
|
23
23
|
"@webext-core/isolated-element": "^1.1.3 || ^2 || ^3",
|
|
24
24
|
"@webext-core/match-patterns": "^2.0.0",
|
|
25
|
-
"@wxt-dev/browser": "
|
|
25
|
+
"@wxt-dev/browser": ">=0.1",
|
|
26
26
|
"@wxt-dev/storage": "^1.0.0",
|
|
27
27
|
"c12": "^3.3.4",
|
|
28
28
|
"cac": "^6.7.14 || ^7.0.0",
|
|
29
29
|
"chokidar": "^5.0.0",
|
|
30
30
|
"consola": "^3.4.2",
|
|
31
31
|
"defu": "^6.1.4",
|
|
32
|
-
"dotenv-expand": "^13.0.0",
|
|
33
32
|
"filesize": "^11.0.17",
|
|
34
|
-
"get-port-please": "^3.2.0",
|
|
35
33
|
"giget": "^1.2.3 || ^2.0.0 || ^3.0.0",
|
|
36
34
|
"hookable": "^6.1.0",
|
|
37
|
-
"is-wsl": "^3.1.1",
|
|
38
35
|
"json5": "^2.2.3",
|
|
39
36
|
"linkedom": "^0.18.12",
|
|
40
37
|
"magicast": "^0.5.2",
|
|
41
|
-
"nano-spawn": "^2.0.0",
|
|
42
|
-
"nanospinner": "^1.2.2",
|
|
43
|
-
"normalize-path": "^3.0.0",
|
|
44
38
|
"nypm": "^0.6.5",
|
|
45
|
-
"ohash": "^2.0.11",
|
|
46
39
|
"picomatch": "^4.0.3",
|
|
47
|
-
"publish-browser-extension": "^
|
|
48
|
-
"scule": "^1.3.0",
|
|
40
|
+
"publish-browser-extension": "^6.0.0",
|
|
49
41
|
"superlock": "^1.3.2",
|
|
50
42
|
"tiny-open": "^1.3.0",
|
|
43
|
+
"tinyexec": "^1.2.4",
|
|
51
44
|
"tinyglobby": "^0.2.16",
|
|
52
45
|
"unimport": "^3.13.1 || ^4.0.0 || ^5.0.0 || ^6.0.0"
|
|
53
46
|
},
|
|
@@ -71,18 +64,24 @@
|
|
|
71
64
|
"devDependencies": {
|
|
72
65
|
"@aklinker1/buildc": "^1.1.7",
|
|
73
66
|
"@faker-js/faker": "^10.3.0",
|
|
74
|
-
"@types/bun": "^1.
|
|
67
|
+
"@types/bun": "^1.4.4",
|
|
75
68
|
"@types/lodash.merge": "^4.6.9",
|
|
76
69
|
"@types/node": "^22",
|
|
77
70
|
"@types/normalize-path": "^3.0.2",
|
|
78
71
|
"@types/picomatch": "^4.0.2",
|
|
79
72
|
"@types/prompts": "^2.4.9",
|
|
73
|
+
"dotenv-expand": "^13.0.0",
|
|
80
74
|
"eslint": "^10.1.0",
|
|
81
75
|
"extract-zip": "^2.0.1",
|
|
76
|
+
"get-port-please": "^3.2.0",
|
|
82
77
|
"happy-dom": "^20.8.3",
|
|
78
|
+
"is-wsl": "^3.1.1",
|
|
83
79
|
"lodash.merge": "^4.6.2",
|
|
80
|
+
"normalize-path": "^3.0.0",
|
|
81
|
+
"ohash": "^2.0.11",
|
|
84
82
|
"oxlint": "^1.63.0",
|
|
85
83
|
"publint": "^0.3.18",
|
|
84
|
+
"scule": "^1.3.0",
|
|
86
85
|
"tsdown": "^0.21.0",
|
|
87
86
|
"typescript": "^6.0.3",
|
|
88
87
|
"vite": "^8.2.0",
|
|
@@ -200,8 +199,8 @@
|
|
|
200
199
|
"types": "./dist/vite-builder-env.d.ts"
|
|
201
200
|
},
|
|
202
201
|
"./modules": {
|
|
203
|
-
"types": "./dist/modules.d.mts",
|
|
204
|
-
"default": "./dist/modules.mjs"
|
|
202
|
+
"types": "./dist/modules/index.d.mts",
|
|
203
|
+
"default": "./dist/modules/index.mjs"
|
|
205
204
|
}
|
|
206
205
|
},
|
|
207
206
|
"engines": {
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { getEntrypointGlobals } from "../../../utils/globals.mjs";
|
|
2
|
-
//#region src/core/builders/vite/plugins/entrypointGroupGlobals.ts
|
|
3
|
-
/** Define a set of global variables specific to an entrypoint. */
|
|
4
|
-
function entrypointGroupGlobals(entrypointGroup) {
|
|
5
|
-
return {
|
|
6
|
-
name: "wxt:entrypoint-group-globals",
|
|
7
|
-
config() {
|
|
8
|
-
const define = {};
|
|
9
|
-
let name = Array.isArray(entrypointGroup) ? "html" : entrypointGroup.name;
|
|
10
|
-
for (const global of getEntrypointGlobals(name)) define[`import.meta.env.${global.name}`] = JSON.stringify(global.value);
|
|
11
|
-
return { define };
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { entrypointGroupGlobals };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { getGlobals } from "../../../utils/globals.mjs";
|
|
2
|
-
//#region src/core/builders/vite/plugins/globals.ts
|
|
3
|
-
function globals(config) {
|
|
4
|
-
return {
|
|
5
|
-
name: "wxt:globals",
|
|
6
|
-
config() {
|
|
7
|
-
const define = {};
|
|
8
|
-
for (const global of getGlobals(config)) define[`import.meta.env.${global.name}`] = JSON.stringify(global.value);
|
|
9
|
-
return { define };
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { globals };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "./devHtmlPrerender.mjs";
|
|
2
|
-
import "./devServerGlobals.mjs";
|
|
3
|
-
import "./resolveVirtualModules.mjs";
|
|
4
|
-
import "./tsconfigPaths.mjs";
|
|
5
|
-
import "./noopBackground.mjs";
|
|
6
|
-
import "./cssEntrypoints.mjs";
|
|
7
|
-
import "./bundleAnalysis.mjs";
|
|
8
|
-
import "./globals.mjs";
|
|
9
|
-
import "./extensionApiMock.mjs";
|
|
10
|
-
import "./entrypointGroupGlobals.mjs";
|
|
11
|
-
import "./defineImportMeta.mjs";
|
|
12
|
-
import "./removeEntrypointMainFunction.mjs";
|
|
13
|
-
import "./wxtPluginLoader.mjs";
|
|
14
|
-
import "./resolveAppConfig.mjs";
|
|
15
|
-
import "./iifeFooter.mjs";
|
|
16
|
-
import "./iifeAnonymous.mjs";
|
|
17
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { normalizePath } from "../../../utils/paths.mjs";
|
|
2
|
-
import "../../../utils/index.mjs";
|
|
3
|
-
import { parseHTML } from "linkedom";
|
|
4
|
-
//#region src/core/builders/vite/plugins/wxtPluginLoader.ts
|
|
5
|
-
/**
|
|
6
|
-
* Resolve and load plugins for each entrypoint. This handles both JS
|
|
7
|
-
* entrypoints via the `virtual:wxt-plugins` import, and HTML files by adding
|
|
8
|
-
* `virtual:wxt-html-plugins` to the document's `<head>`
|
|
9
|
-
*/
|
|
10
|
-
function wxtPluginLoader(config) {
|
|
11
|
-
const virtualModuleId = "virtual:wxt-plugins";
|
|
12
|
-
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
13
|
-
const virtualHtmlModuleId = "virtual:wxt-html-plugins";
|
|
14
|
-
const resolvedVirtualHtmlModuleId = "\0" + virtualHtmlModuleId;
|
|
15
|
-
return {
|
|
16
|
-
name: "wxt:plugin-loader",
|
|
17
|
-
resolveId: {
|
|
18
|
-
filter: { id: [new RegExp(`^${virtualModuleId}$`), new RegExp(`^${virtualHtmlModuleId}$`)] },
|
|
19
|
-
handler(id) {
|
|
20
|
-
if (id === virtualModuleId) return resolvedVirtualModuleId;
|
|
21
|
-
return resolvedVirtualHtmlModuleId;
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
load: {
|
|
25
|
-
filter: { id: [new RegExp(`^${resolvedVirtualModuleId}$`), new RegExp(`^${resolvedVirtualHtmlModuleId}$`)] },
|
|
26
|
-
handler(id) {
|
|
27
|
-
if (id === resolvedVirtualModuleId) return `${config.plugins.map((plugin, i) => `import initPlugin${i} from '${normalizePath(plugin)}';`).join("\n")}\n\nexport function initPlugins() {\n${config.plugins.map((_, i) => ` initPlugin${i}();`).join("\n")}\n}`;
|
|
28
|
-
else return `import { initPlugins } from '${virtualModuleId}';
|
|
29
|
-
try {
|
|
30
|
-
initPlugins();
|
|
31
|
-
} catch (err) {
|
|
32
|
-
console.error("[wxt] Failed to initialize plugins", err);
|
|
33
|
-
}`;
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
transformIndexHtml: {
|
|
37
|
-
order: "pre",
|
|
38
|
-
handler(html, _ctx) {
|
|
39
|
-
const src = config.command === "serve" ? `${config.dev.server?.origin}/@id/${virtualHtmlModuleId}` : virtualHtmlModuleId;
|
|
40
|
-
const { document } = parseHTML(html);
|
|
41
|
-
if (document.querySelector(`script[src='${src}']`)) return;
|
|
42
|
-
const script = document.createElement("script");
|
|
43
|
-
script.type = "module";
|
|
44
|
-
script.src = src;
|
|
45
|
-
if (document.head == null) {
|
|
46
|
-
const newHead = document.createElement("head");
|
|
47
|
-
document.documentElement.prepend(newHead);
|
|
48
|
-
}
|
|
49
|
-
document.head?.prepend(script);
|
|
50
|
-
return document.toString();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
56
|
-
export { wxtPluginLoader };
|
package/dist/core/index.d.mts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { build } from "./build.mjs";
|
|
2
|
-
import { clean } from "./clean.mjs";
|
|
3
|
-
import { defineConfig } from "./define-config.mjs";
|
|
4
|
-
import { defineWebExtConfig } from "./define-web-ext-config.mjs";
|
|
5
|
-
import { createServer } from "./create-server.mjs";
|
|
6
|
-
import { initialize } from "./initialize.mjs";
|
|
7
|
-
import { prepare } from "./prepare.mjs";
|
|
8
|
-
import { zip } from "./zip.mjs";
|
|
9
|
-
import { normalizePath } from "./utils/paths.mjs";
|
|
10
|
-
import { getEntrypointBundlePath } from "./utils/entrypoints.mjs";
|
package/dist/core/index.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "./utils/paths.mjs";
|
|
2
|
-
import "./utils/entrypoints.mjs";
|
|
3
|
-
import "./utils/index.mjs";
|
|
4
|
-
import "./build.mjs";
|
|
5
|
-
import "./clean.mjs";
|
|
6
|
-
import "./define-config.mjs";
|
|
7
|
-
import "./define-web-ext-config.mjs";
|
|
8
|
-
import "./create-server.mjs";
|
|
9
|
-
import "./initialize.mjs";
|
|
10
|
-
import "./prepare.mjs";
|
|
11
|
-
import "./zip.mjs";
|
|
12
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { dedupeDependencies, npm } from "./npm.mjs";
|
|
2
|
-
import spawn from "nano-spawn";
|
|
3
|
-
//#region src/core/package-managers/bun.ts
|
|
4
|
-
const bun = {
|
|
5
|
-
overridesKey: "overrides",
|
|
6
|
-
downloadDependency(...args) {
|
|
7
|
-
return npm.downloadDependency(...args);
|
|
8
|
-
},
|
|
9
|
-
async listDependencies(options) {
|
|
10
|
-
const args = ["pm", "ls"];
|
|
11
|
-
if (options?.all) args.push("--all");
|
|
12
|
-
return dedupeDependencies((await spawn("bun", args, { cwd: options?.cwd })).stdout.split("\n").slice(1).map((line) => line.trim()).map((line) => /.* (@?\S+)@(\S+)$/.exec(line)).filter((match) => !!match).map(([_, name, version]) => ({
|
|
13
|
-
name,
|
|
14
|
-
version
|
|
15
|
-
})));
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
//#endregion
|
|
19
|
-
export { bun };
|
package/dist/core/prepare.d.mts
DELETED
package/dist/core/prepare.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { registerWxt, wxt } from "./wxt.mjs";
|
|
2
|
-
import { findEntrypoints } from "./utils/building/find-entrypoints.mjs";
|
|
3
|
-
import { generateWxtDir } from "./generate-wxt-dir.mjs";
|
|
4
|
-
import "./utils/building/index.mjs";
|
|
5
|
-
//#region src/core/prepare.ts
|
|
6
|
-
async function prepare(config) {
|
|
7
|
-
await registerWxt("build", config);
|
|
8
|
-
wxt.logger.info("Generating types...");
|
|
9
|
-
await generateWxtDir(await findEntrypoints());
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { prepare };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { wxt } from "../wxt.mjs";
|
|
2
|
-
import { relative } from "node:path";
|
|
3
|
-
//#region src/core/runners/manual.ts
|
|
4
|
-
/** The manual runner tells the user to load the unpacked extension manually. */
|
|
5
|
-
function createManualRunner() {
|
|
6
|
-
return { async openBrowser() {
|
|
7
|
-
wxt.logger.info(`Load "${relative(process.cwd(), wxt.config.outDir)}" as an unpacked extension manually`);
|
|
8
|
-
} };
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { createManualRunner };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { wxt } from "../wxt.mjs";
|
|
2
|
-
import { relative } from "node:path";
|
|
3
|
-
//#region src/core/runners/safari.ts
|
|
4
|
-
/**
|
|
5
|
-
* The Safari runner just logs a warning message because `web-ext` doesn't work
|
|
6
|
-
* with Safari.
|
|
7
|
-
*/
|
|
8
|
-
function createSafariRunner() {
|
|
9
|
-
return { async openBrowser() {
|
|
10
|
-
wxt.logger.warn(`Cannot Safari using web-ext. Load "${relative(process.cwd(), wxt.config.outDir)}" as an unpacked extension manually`);
|
|
11
|
-
} };
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { createSafariRunner };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { wxt } from "../wxt.mjs";
|
|
2
|
-
import { formatDuration } from "../utils/time.mjs";
|
|
3
|
-
import defu from "defu";
|
|
4
|
-
import webExt from "web-ext";
|
|
5
|
-
import { consoleStream } from "web-ext/util/logger";
|
|
6
|
-
//#region src/core/runners/web-ext.ts
|
|
7
|
-
/** Create an `ExtensionRunner` backed by `web-ext`. */
|
|
8
|
-
function createWebExtRunner() {
|
|
9
|
-
let runner;
|
|
10
|
-
return {
|
|
11
|
-
canOpen() {
|
|
12
|
-
return true;
|
|
13
|
-
},
|
|
14
|
-
async openBrowser() {
|
|
15
|
-
const startTime = Date.now();
|
|
16
|
-
consoleStream.write = ({ level, msg, name }) => {
|
|
17
|
-
if (level >= ERROR_LOG_LEVEL) wxt.logger.error(name, msg);
|
|
18
|
-
if (level >= WARN_LOG_LEVEL) wxt.logger.warn(msg);
|
|
19
|
-
};
|
|
20
|
-
const wxtUserConfig = wxt.config.webExt.config;
|
|
21
|
-
const finalConfig = {
|
|
22
|
-
browserConsole: wxtUserConfig?.openConsole,
|
|
23
|
-
devtools: wxtUserConfig?.openDevtools,
|
|
24
|
-
startUrl: wxtUserConfig?.startUrls,
|
|
25
|
-
keepProfileChanges: wxtUserConfig?.keepProfileChanges,
|
|
26
|
-
chromiumPort: wxtUserConfig?.chromiumPort,
|
|
27
|
-
...wxt.config.browser === "firefox" ? {
|
|
28
|
-
firefox: wxtUserConfig?.binaries?.firefox,
|
|
29
|
-
firefoxProfile: wxtUserConfig?.firefoxProfile,
|
|
30
|
-
pref: wxtUserConfig?.firefoxPref,
|
|
31
|
-
args: wxtUserConfig?.firefoxArgs
|
|
32
|
-
} : {
|
|
33
|
-
chromiumBinary: wxtUserConfig?.binaries?.[wxt.config.browser],
|
|
34
|
-
chromiumProfile: wxtUserConfig?.chromiumProfile,
|
|
35
|
-
chromiumPref: defu(wxtUserConfig?.chromiumPref, DEFAULT_CHROMIUM_PREFS),
|
|
36
|
-
args: ["--unsafely-disable-devtools-self-xss-warnings", ...wxtUserConfig?.chromiumArgs ?? []]
|
|
37
|
-
},
|
|
38
|
-
target: wxt.config.browser === "firefox" ? "firefox-desktop" : "chromium",
|
|
39
|
-
sourceDir: wxt.config.outDir,
|
|
40
|
-
noReloadManagerExtension: true,
|
|
41
|
-
noReload: true,
|
|
42
|
-
noInput: true
|
|
43
|
-
};
|
|
44
|
-
const options = { shouldExitProgram: false };
|
|
45
|
-
wxt.logger.debug("web-ext config:", finalConfig);
|
|
46
|
-
wxt.logger.debug("web-ext options:", options);
|
|
47
|
-
runner = await webExt.cmd.run(finalConfig, options);
|
|
48
|
-
const duration = Date.now() - startTime;
|
|
49
|
-
wxt.logger.success(`Opened browser in ${formatDuration(duration)}`);
|
|
50
|
-
},
|
|
51
|
-
async closeBrowser() {
|
|
52
|
-
await runner?.exit();
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
const WARN_LOG_LEVEL = 40;
|
|
57
|
-
const ERROR_LOG_LEVEL = 50;
|
|
58
|
-
const DEFAULT_CHROMIUM_PREFS = { devtools: { synced_preferences_sync_disabled: {
|
|
59
|
-
skipContentScripts: false,
|
|
60
|
-
"skip-content-scripts": false
|
|
61
|
-
} } };
|
|
62
|
-
//#endregion
|
|
63
|
-
export { createWebExtRunner };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { wxt } from "../wxt.mjs";
|
|
2
|
-
import { relative } from "node:path";
|
|
3
|
-
//#region src/core/runners/wsl.ts
|
|
4
|
-
/**
|
|
5
|
-
* The WSL runner just logs a warning message because `web-ext` doesn't work in
|
|
6
|
-
* WSL.
|
|
7
|
-
*/
|
|
8
|
-
function createWslRunner() {
|
|
9
|
-
return { async openBrowser() {
|
|
10
|
-
wxt.logger.warn(`Cannot open browser when using WSL. Load "${relative(process.cwd(), wxt.config.outDir)}" as an unpacked extension manually`);
|
|
11
|
-
} };
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { createWslRunner };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { parseHTML } from "linkedom";
|
|
2
|
-
//#region src/core/utils/environments/browser-environment.ts
|
|
3
|
-
function getBrowserEnvironmentGlobals() {
|
|
4
|
-
const { window, document, global } = parseHTML(`
|
|
5
|
-
<html>
|
|
6
|
-
<head></head>
|
|
7
|
-
<body></body>
|
|
8
|
-
</html>
|
|
9
|
-
`);
|
|
10
|
-
return {
|
|
11
|
-
...global,
|
|
12
|
-
window,
|
|
13
|
-
document,
|
|
14
|
-
self: global
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { getBrowserEnvironmentGlobals };
|
|
File without changes
|
|
File without changes
|