wxt 0.11.1 → 0.12.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 +2 -0
- package/dist/{chunk-65FJ5ESC.js → chunk-UY7NE73P.js} +145 -111
- package/dist/cli.js +3119 -0
- package/dist/client.d.ts +21 -13
- package/dist/client.js +1 -15
- package/dist/{external-PmmO6xnl.d.ts → external-TYmXqKVq.d.ts} +24 -11
- package/dist/{external-irU6kFSB.d.cts → external-tVP-84Pg.d.cts} +24 -11
- package/dist/{external-irU6kFSB.d.ts → external-tVP-84Pg.d.ts} +24 -11
- package/dist/index.cjs +190 -155
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/sandbox.d.ts +7 -2
- package/dist/sandbox.js +14 -0
- package/dist/testing.cjs +24 -15
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/virtual/{content-script-entrypoint.js → content-script-isolated-world-entrypoint.js} +3 -3
- package/dist/virtual/content-script-main-world-entrypoint.js +33 -0
- package/dist/virtual/mock-browser.js +3 -5
- package/package.json +2 -2
- package/bin/wxt.cjs +0 -2
- package/dist/cli.cjs +0 -5499
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './external-
|
|
2
|
-
export {
|
|
1
|
+
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './external-tVP-84Pg.cjs';
|
|
2
|
+
export { q as BackgroundDefinition, h as BackgroundEntrypoint, g as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, w as ConfigEnv, p as ContentScriptBaseDefinition, m as ContentScriptDefinition, C as ContentScriptEntrypoint, n as ContentScriptIsolatedWorldDefinition, o as ContentScriptMainWorldDefinition, j as Entrypoint, k as EntrypointGroup, t as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, l as OnContentScriptStopped, i as OptionsEntrypoint, c as OutputAsset, b as OutputChunk, O as OutputFile, s as PerBrowserOption, P as PopupEntrypoint, S as ServerInfo, T as TargetBrowser, e as TargetManifestVersion, r as UnlistedScriptDefinition, u as UserManifest, v as UserManifestFn, x as WxtBuilder, y as WxtBuilderServer, a as WxtViteConfig } from './external-tVP-84Pg.cjs';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
@@ -62,6 +62,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
|
|
|
62
62
|
*/
|
|
63
63
|
declare function zip(config?: InlineConfig): Promise<string[]>;
|
|
64
64
|
|
|
65
|
-
var version = "0.
|
|
65
|
+
var version = "0.12.0";
|
|
66
66
|
|
|
67
67
|
export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './external-
|
|
2
|
-
export {
|
|
1
|
+
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './external-tVP-84Pg.js';
|
|
2
|
+
export { q as BackgroundDefinition, h as BackgroundEntrypoint, g as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, w as ConfigEnv, p as ContentScriptBaseDefinition, m as ContentScriptDefinition, C as ContentScriptEntrypoint, n as ContentScriptIsolatedWorldDefinition, o as ContentScriptMainWorldDefinition, j as Entrypoint, k as EntrypointGroup, t as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, l as OnContentScriptStopped, i as OptionsEntrypoint, c as OutputAsset, b as OutputChunk, O as OutputFile, s as PerBrowserOption, P as PopupEntrypoint, S as ServerInfo, T as TargetBrowser, e as TargetManifestVersion, r as UnlistedScriptDefinition, u as UserManifest, v as UserManifestFn, x as WxtBuilder, y as WxtBuilderServer, a as WxtViteConfig } from './external-tVP-84Pg.js';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
@@ -62,6 +62,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
|
|
|
62
62
|
*/
|
|
63
63
|
declare function zip(config?: InlineConfig): Promise<string[]>;
|
|
64
64
|
|
|
65
|
-
var version = "0.
|
|
65
|
+
var version = "0.12.0";
|
|
66
66
|
|
|
67
67
|
export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
|
package/dist/index.js
CHANGED
package/dist/sandbox.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { U as UnlistedScriptDefinition } from './external-
|
|
1
|
+
import { U as UnlistedScriptDefinition, B as BackgroundDefinition, C as ContentScriptDefinition } from './external-TYmXqKVq.js';
|
|
2
2
|
import 'webextension-polyfill';
|
|
3
3
|
|
|
4
4
|
declare function defineUnlistedScript(main: () => void): UnlistedScriptDefinition;
|
|
5
5
|
declare function defineUnlistedScript(definition: UnlistedScriptDefinition): UnlistedScriptDefinition;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
declare function defineBackground(main: () => void): BackgroundDefinition;
|
|
8
|
+
declare function defineBackground(definition: BackgroundDefinition): BackgroundDefinition;
|
|
9
|
+
|
|
10
|
+
declare function defineContentScript(definition: ContentScriptDefinition): ContentScriptDefinition;
|
|
11
|
+
|
|
12
|
+
export { defineBackground, defineContentScript, defineUnlistedScript };
|
package/dist/sandbox.js
CHANGED
|
@@ -4,6 +4,20 @@ function defineUnlistedScript(arg) {
|
|
|
4
4
|
return { main: arg };
|
|
5
5
|
return arg;
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
// src/sandbox/define-background.ts
|
|
9
|
+
function defineBackground(arg) {
|
|
10
|
+
if (typeof arg === "function")
|
|
11
|
+
return { main: arg };
|
|
12
|
+
return arg;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// src/sandbox/define-content-script.ts
|
|
16
|
+
function defineContentScript(definition) {
|
|
17
|
+
return definition;
|
|
18
|
+
}
|
|
7
19
|
export {
|
|
20
|
+
defineBackground,
|
|
21
|
+
defineContentScript,
|
|
8
22
|
defineUnlistedScript
|
|
9
23
|
};
|
package/dist/testing.cjs
CHANGED
|
@@ -691,12 +691,10 @@ var PATH_GLOB_TO_TYPE_MAP = {
|
|
|
691
691
|
"options/index.html": "options",
|
|
692
692
|
"*.html": "unlisted-page",
|
|
693
693
|
"*/index.html": "unlisted-page",
|
|
694
|
-
"*.[jt]s": "unlisted-script",
|
|
695
|
-
"*/index.
|
|
694
|
+
"*.[jt]s?(x)": "unlisted-script",
|
|
695
|
+
"*/index.[jt]s?(x)": "unlisted-script",
|
|
696
696
|
[`*.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
|
|
697
|
-
[`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
|
|
698
|
-
// Don't warn about any files in subdirectories, like CSS or JS entrypoints for HTML files or tests
|
|
699
|
-
"*/**": "ignored"
|
|
697
|
+
[`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
|
|
700
698
|
};
|
|
701
699
|
|
|
702
700
|
// src/core/utils/building/generate-wxt-dir.ts
|
|
@@ -756,7 +754,8 @@ async function craeteViteBuilder(inlineConfig, userConfig, wxtConfig) {
|
|
|
756
754
|
devHtmlPrerender(wxtConfig),
|
|
757
755
|
unimport(wxtConfig),
|
|
758
756
|
virtualEntrypoint("background", wxtConfig),
|
|
759
|
-
virtualEntrypoint("content-script", wxtConfig),
|
|
757
|
+
virtualEntrypoint("content-script-isolated-world", wxtConfig),
|
|
758
|
+
virtualEntrypoint("content-script-main-world", wxtConfig),
|
|
760
759
|
virtualEntrypoint("unlisted-script", wxtConfig),
|
|
761
760
|
devServerGlobals(wxtConfig),
|
|
762
761
|
tsconfigPaths(wxtConfig),
|
|
@@ -770,12 +769,17 @@ async function craeteViteBuilder(inlineConfig, userConfig, wxtConfig) {
|
|
|
770
769
|
return config;
|
|
771
770
|
};
|
|
772
771
|
const getLibModeConfig = (entrypoint) => {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
"
|
|
776
|
-
"unlisted-script"
|
|
777
|
-
|
|
778
|
-
|
|
772
|
+
let virtualEntrypointType;
|
|
773
|
+
switch (entrypoint.type) {
|
|
774
|
+
case "background":
|
|
775
|
+
case "unlisted-script":
|
|
776
|
+
virtualEntrypointType = entrypoint.type;
|
|
777
|
+
break;
|
|
778
|
+
case "content-script":
|
|
779
|
+
virtualEntrypointType = entrypoint.options.world === "MAIN" ? "content-script-main-world" : "content-script-isolated-world";
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
const entry = virtualEntrypointType ? `virtual:wxt-${virtualEntrypointType}?${entrypoint.inputPath}` : entrypoint.inputPath;
|
|
779
783
|
const plugins = [
|
|
780
784
|
entrypointGroupGlobals(entrypoint)
|
|
781
785
|
];
|
|
@@ -936,7 +940,10 @@ async function getInternalConfig(inlineConfig, command, server) {
|
|
|
936
940
|
const { config: loadedConfig, ...metadata } = await (0, import_c12.loadConfig)({
|
|
937
941
|
name: "wxt",
|
|
938
942
|
cwd: inlineConfig.root ?? process.cwd(),
|
|
939
|
-
rcFile: false
|
|
943
|
+
rcFile: false,
|
|
944
|
+
jitiOptions: {
|
|
945
|
+
esmResolve: true
|
|
946
|
+
}
|
|
940
947
|
});
|
|
941
948
|
userConfig = loadedConfig ?? {};
|
|
942
949
|
userConfigMetadata = metadata;
|
|
@@ -1109,14 +1116,16 @@ function resolveInternalZipConfig(root, mergedConfig) {
|
|
|
1109
1116
|
var import_jiti = __toESM(require("jiti"), 1);
|
|
1110
1117
|
var import_unimport5 = require("unimport");
|
|
1111
1118
|
var import_fs_extra8 = __toESM(require("fs-extra"), 1);
|
|
1119
|
+
var import_node_path8 = require("path");
|
|
1112
1120
|
var import_esbuild = require("esbuild");
|
|
1121
|
+
var import_node_url = require("url");
|
|
1113
1122
|
|
|
1114
1123
|
// src/core/utils/building/internal-build.ts
|
|
1115
1124
|
var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
1116
1125
|
var import_fs_extra12 = __toESM(require("fs-extra"), 1);
|
|
1117
1126
|
|
|
1118
1127
|
// src/core/utils/log/printFileList.ts
|
|
1119
|
-
var
|
|
1128
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
1120
1129
|
var import_picocolors2 = __toESM(require("picocolors"), 1);
|
|
1121
1130
|
var import_fs_extra9 = __toESM(require("fs-extra"), 1);
|
|
1122
1131
|
var import_filesize = require("filesize");
|
|
@@ -1144,7 +1153,7 @@ var import_fast_glob3 = __toESM(require("fast-glob"), 1);
|
|
|
1144
1153
|
var import_fs_extra11 = __toESM(require("fs-extra"), 1);
|
|
1145
1154
|
|
|
1146
1155
|
// src/core/utils/package.ts
|
|
1147
|
-
var
|
|
1156
|
+
var import_node_path10 = require("path");
|
|
1148
1157
|
var import_fs_extra10 = __toESM(require("fs-extra"), 1);
|
|
1149
1158
|
|
|
1150
1159
|
// src/core/utils/manifest.ts
|
package/dist/testing.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
|
|
2
2
|
import * as vite from 'vite';
|
|
3
|
-
import { I as InlineConfig } from './external-
|
|
3
|
+
import { I as InlineConfig } from './external-tVP-84Pg.cjs';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
6
6
|
import 'consola';
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
|
|
2
2
|
import * as vite from 'vite';
|
|
3
|
-
import { I as InlineConfig } from './external-
|
|
3
|
+
import { I as InlineConfig } from './external-tVP-84Pg.js';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
6
6
|
import 'consola';
|
package/dist/testing.js
CHANGED
package/dist/virtual/{content-script-entrypoint.js → content-script-isolated-world-entrypoint.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// src/virtual/content-script-entrypoint.ts
|
|
2
|
-
import definition from "virtual:user-content-script";
|
|
1
|
+
// src/virtual/content-script-isolated-world-entrypoint.ts
|
|
2
|
+
import definition from "virtual:user-content-script-isolated-world";
|
|
3
3
|
|
|
4
4
|
// src/client/utils/logger.ts
|
|
5
5
|
function print(method, ...args) {
|
|
@@ -233,7 +233,7 @@ var ContentScriptContext = class _ContentScriptContext {
|
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
-
// src/virtual/content-script-entrypoint.ts
|
|
236
|
+
// src/virtual/content-script-isolated-world-entrypoint.ts
|
|
237
237
|
(async () => {
|
|
238
238
|
try {
|
|
239
239
|
const { main, ...options } = definition;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/virtual/content-script-main-world-entrypoint.ts
|
|
2
|
+
import definition from "virtual:user-content-script-main-world";
|
|
3
|
+
|
|
4
|
+
// src/client/utils/logger.ts
|
|
5
|
+
function print(method, ...args) {
|
|
6
|
+
if (import.meta.env.MODE === "production")
|
|
7
|
+
return;
|
|
8
|
+
if (typeof args[0] === "string") {
|
|
9
|
+
const message = args.shift();
|
|
10
|
+
method(`[wxt] ${message}`, ...args);
|
|
11
|
+
} else {
|
|
12
|
+
method("[wxt]", ...args);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
var logger = {
|
|
16
|
+
debug: (...args) => print(console.debug, ...args),
|
|
17
|
+
log: (...args) => print(console.log, ...args),
|
|
18
|
+
warn: (...args) => print(console.warn, ...args),
|
|
19
|
+
error: (...args) => print(console.error, ...args)
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/virtual/content-script-main-world-entrypoint.ts
|
|
23
|
+
(async () => {
|
|
24
|
+
try {
|
|
25
|
+
const { main } = definition;
|
|
26
|
+
await main();
|
|
27
|
+
} catch (err) {
|
|
28
|
+
logger.error(
|
|
29
|
+
`The content script "${__ENTRYPOINT__}" crashed on startup!`,
|
|
30
|
+
err
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
})();
|
|
@@ -75,12 +75,10 @@ var PATH_GLOB_TO_TYPE_MAP = {
|
|
|
75
75
|
"options/index.html": "options",
|
|
76
76
|
"*.html": "unlisted-page",
|
|
77
77
|
"*/index.html": "unlisted-page",
|
|
78
|
-
"*.[jt]s": "unlisted-script",
|
|
79
|
-
"*/index.
|
|
78
|
+
"*.[jt]s?(x)": "unlisted-script",
|
|
79
|
+
"*/index.[jt]s?(x)": "unlisted-script",
|
|
80
80
|
[`*.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
|
|
81
|
-
[`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
|
|
82
|
-
// Don't warn about any files in subdirectories, like CSS or JS entrypoints for HTML files or tests
|
|
83
|
-
"*/**": "ignored"
|
|
81
|
+
[`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
|
|
84
82
|
};
|
|
85
83
|
|
|
86
84
|
// src/core/utils/building/generate-wxt-dir.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"description": "Next gen framework for developing web extensions",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"bin",
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
|
-
"bin": "./bin/wxt.
|
|
33
|
+
"bin": "./bin/wxt.mjs",
|
|
34
34
|
"main": "./dist/index.cjs",
|
|
35
35
|
"module": "./dist/index.js",
|
|
36
36
|
"types": "./dist/index.d.ts",
|
package/bin/wxt.cjs
DELETED