wxt 0.16.6 → 0.16.8-alpha1
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/dist/{chunk-7UFBHZ5F.js → chunk-7WFBUGKG.js} +94 -64
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +109 -65
- package/dist/{index-avHSnR0o.d.cts → index-sl22zA2Z.d.cts} +41 -3
- package/dist/{index-avHSnR0o.d.ts → index-sl22zA2Z.d.ts} +41 -3
- package/dist/index.cjs +128 -84
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +15 -1
- package/dist/testing.cjs +75 -59
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +3 -3
package/dist/testing.cjs
CHANGED
|
@@ -356,31 +356,6 @@ async function removeEmptyDirs(dir) {
|
|
|
356
356
|
|
|
357
357
|
// src/core/builders/vite/plugins/unimport.ts
|
|
358
358
|
var import_unimport = require("unimport");
|
|
359
|
-
|
|
360
|
-
// src/core/utils/unimport.ts
|
|
361
|
-
var import_defu = require("defu");
|
|
362
|
-
function getUnimportOptions(config) {
|
|
363
|
-
if (config.imports === false)
|
|
364
|
-
return false;
|
|
365
|
-
const defaultOptions = {
|
|
366
|
-
debugLog: config.logger.debug,
|
|
367
|
-
imports: [
|
|
368
|
-
{ name: "defineConfig", from: "wxt" },
|
|
369
|
-
{ name: "fakeBrowser", from: "wxt/testing" }
|
|
370
|
-
],
|
|
371
|
-
presets: [
|
|
372
|
-
{ package: "wxt/client" },
|
|
373
|
-
{ package: "wxt/browser" },
|
|
374
|
-
{ package: "wxt/sandbox" },
|
|
375
|
-
{ package: "wxt/storage" }
|
|
376
|
-
],
|
|
377
|
-
warn: config.logger.warn,
|
|
378
|
-
dirs: ["components", "composables", "hooks", "utils"]
|
|
379
|
-
};
|
|
380
|
-
return (0, import_defu.defu)(config.imports, defaultOptions);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// src/core/builders/vite/plugins/unimport.ts
|
|
384
359
|
var import_path = require("path");
|
|
385
360
|
var ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
386
361
|
".js",
|
|
@@ -391,7 +366,7 @@ var ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
391
366
|
".svelte"
|
|
392
367
|
]);
|
|
393
368
|
function unimport(config) {
|
|
394
|
-
const options =
|
|
369
|
+
const options = config.imports;
|
|
395
370
|
if (options === false)
|
|
396
371
|
return [];
|
|
397
372
|
const unimport2 = (0, import_unimport.createUnimport)(options);
|
|
@@ -738,13 +713,13 @@ var PATH_GLOB_TO_TYPE_MAP = {
|
|
|
738
713
|
};
|
|
739
714
|
|
|
740
715
|
// src/core/utils/building/generate-wxt-dir.ts
|
|
741
|
-
var
|
|
716
|
+
var import_unimport2 = require("unimport");
|
|
742
717
|
var import_fs_extra6 = __toESM(require("fs-extra"), 1);
|
|
743
718
|
var import_node_path7 = __toESM(require("path"), 1);
|
|
744
719
|
|
|
745
720
|
// src/core/utils/building/resolve-config.ts
|
|
746
721
|
var import_c12 = require("c12");
|
|
747
|
-
var
|
|
722
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
748
723
|
|
|
749
724
|
// src/core/utils/cache.ts
|
|
750
725
|
var import_fs_extra7 = __toESM(require("fs-extra"), 1);
|
|
@@ -987,7 +962,16 @@ function getRollupEntry(entrypoint) {
|
|
|
987
962
|
}
|
|
988
963
|
|
|
989
964
|
// src/core/utils/building/resolve-config.ts
|
|
990
|
-
var
|
|
965
|
+
var import_defu = __toESM(require("defu"), 1);
|
|
966
|
+
|
|
967
|
+
// src/core/utils/package.ts
|
|
968
|
+
var import_node_path8 = require("path");
|
|
969
|
+
var import_fs_extra8 = __toESM(require("fs-extra"), 1);
|
|
970
|
+
function isModuleInstalled(name) {
|
|
971
|
+
return import(name).then(() => true).catch(() => false);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
// src/core/utils/building/resolve-config.ts
|
|
991
975
|
async function resolveConfig(inlineConfig, command, server) {
|
|
992
976
|
let userConfig = {};
|
|
993
977
|
let userConfigMetadata;
|
|
@@ -1012,20 +996,20 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1012
996
|
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
1013
997
|
const mode = mergedConfig.mode ?? (command === "build" ? "production" : "development");
|
|
1014
998
|
const env = { browser, command, manifestVersion, mode };
|
|
1015
|
-
const root =
|
|
999
|
+
const root = import_node_path9.default.resolve(
|
|
1016
1000
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
1017
1001
|
);
|
|
1018
|
-
const wxtDir =
|
|
1019
|
-
const srcDir =
|
|
1020
|
-
const entrypointsDir =
|
|
1002
|
+
const wxtDir = import_node_path9.default.resolve(root, ".wxt");
|
|
1003
|
+
const srcDir = import_node_path9.default.resolve(root, mergedConfig.srcDir ?? root);
|
|
1004
|
+
const entrypointsDir = import_node_path9.default.resolve(
|
|
1021
1005
|
srcDir,
|
|
1022
1006
|
mergedConfig.entrypointsDir ?? "entrypoints"
|
|
1023
1007
|
);
|
|
1024
1008
|
const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
|
|
1025
|
-
const publicDir =
|
|
1026
|
-
const typesDir =
|
|
1027
|
-
const outBaseDir =
|
|
1028
|
-
const outDir =
|
|
1009
|
+
const publicDir = import_node_path9.default.resolve(srcDir, mergedConfig.publicDir ?? "public");
|
|
1010
|
+
const typesDir = import_node_path9.default.resolve(wxtDir, "types");
|
|
1011
|
+
const outBaseDir = import_node_path9.default.resolve(root, mergedConfig.outDir ?? ".output");
|
|
1012
|
+
const outDir = import_node_path9.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
|
|
1029
1013
|
const reloadCommand = mergedConfig.dev?.reloadCommand ?? "Alt+R";
|
|
1030
1014
|
const runnerConfig = await (0, import_c12.loadConfig)({
|
|
1031
1015
|
name: "web-ext",
|
|
@@ -1042,14 +1026,14 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1042
1026
|
"~": srcDir,
|
|
1043
1027
|
"@@": root,
|
|
1044
1028
|
"~~": root
|
|
1045
|
-
}).map(([key, value]) => [key,
|
|
1029
|
+
}).map(([key, value]) => [key, import_node_path9.default.resolve(root, value)])
|
|
1046
1030
|
);
|
|
1047
|
-
const analysisOutputFile =
|
|
1031
|
+
const analysisOutputFile = import_node_path9.default.resolve(
|
|
1048
1032
|
root,
|
|
1049
1033
|
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
1050
1034
|
);
|
|
1051
|
-
const analysisOutputDir =
|
|
1052
|
-
const analysisOutputName =
|
|
1035
|
+
const analysisOutputDir = import_node_path9.default.dirname(analysisOutputFile);
|
|
1036
|
+
const analysisOutputName = import_node_path9.default.parse(analysisOutputFile).name;
|
|
1053
1037
|
const finalConfig = {
|
|
1054
1038
|
browser,
|
|
1055
1039
|
command,
|
|
@@ -1058,7 +1042,7 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1058
1042
|
filterEntrypoints,
|
|
1059
1043
|
env,
|
|
1060
1044
|
fsCache: createFsCache(wxtDir),
|
|
1061
|
-
imports:
|
|
1045
|
+
imports: await getUnimportOptions(wxtDir, logger, mergedConfig),
|
|
1062
1046
|
logger,
|
|
1063
1047
|
manifest: await resolveManifestConfig(env, mergedConfig.manifest),
|
|
1064
1048
|
manifestVersion,
|
|
@@ -1115,22 +1099,22 @@ function mergeInlineConfig(inlineConfig, userConfig) {
|
|
|
1115
1099
|
} else if (userConfig.imports == null && inlineConfig.imports == null) {
|
|
1116
1100
|
imports = void 0;
|
|
1117
1101
|
} else {
|
|
1118
|
-
imports = (0,
|
|
1102
|
+
imports = (0, import_defu.default)(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
1119
1103
|
}
|
|
1120
1104
|
const manifest = async (env) => {
|
|
1121
1105
|
const user = await resolveManifestConfig(env, userConfig.manifest);
|
|
1122
1106
|
const inline = await resolveManifestConfig(env, inlineConfig.manifest);
|
|
1123
|
-
return (0,
|
|
1107
|
+
return (0, import_defu.default)(inline, user);
|
|
1124
1108
|
};
|
|
1125
|
-
const runner = (0,
|
|
1109
|
+
const runner = (0, import_defu.default)(
|
|
1126
1110
|
inlineConfig.runner ?? {},
|
|
1127
1111
|
userConfig.runner ?? {}
|
|
1128
1112
|
);
|
|
1129
|
-
const zip = (0,
|
|
1113
|
+
const zip = (0, import_defu.default)(
|
|
1130
1114
|
inlineConfig.zip ?? {},
|
|
1131
1115
|
userConfig.zip ?? {}
|
|
1132
1116
|
);
|
|
1133
|
-
const hooks = (0,
|
|
1117
|
+
const hooks = (0, import_defu.default)(
|
|
1134
1118
|
inlineConfig.hooks ?? {},
|
|
1135
1119
|
userConfig.hooks ?? {}
|
|
1136
1120
|
);
|
|
@@ -1194,12 +1178,50 @@ function resolveInternalZipConfig(root, mergedConfig) {
|
|
|
1194
1178
|
]
|
|
1195
1179
|
};
|
|
1196
1180
|
}
|
|
1181
|
+
async function getUnimportOptions(wxtDir, logger, config) {
|
|
1182
|
+
if (config.imports === false)
|
|
1183
|
+
return false;
|
|
1184
|
+
const enabledConfig = config.imports?.eslintrc?.enabled;
|
|
1185
|
+
let enabled;
|
|
1186
|
+
switch (enabledConfig) {
|
|
1187
|
+
case void 0:
|
|
1188
|
+
case "auto":
|
|
1189
|
+
enabled = await isModuleInstalled("eslint");
|
|
1190
|
+
break;
|
|
1191
|
+
default:
|
|
1192
|
+
enabled = enabledConfig;
|
|
1193
|
+
}
|
|
1194
|
+
const defaultOptions = {
|
|
1195
|
+
debugLog: logger.debug,
|
|
1196
|
+
imports: [
|
|
1197
|
+
{ name: "defineConfig", from: "wxt" },
|
|
1198
|
+
{ name: "fakeBrowser", from: "wxt/testing" }
|
|
1199
|
+
],
|
|
1200
|
+
presets: [
|
|
1201
|
+
{ package: "wxt/client" },
|
|
1202
|
+
{ package: "wxt/browser" },
|
|
1203
|
+
{ package: "wxt/sandbox" },
|
|
1204
|
+
{ package: "wxt/storage" }
|
|
1205
|
+
],
|
|
1206
|
+
warn: logger.warn,
|
|
1207
|
+
dirs: ["components", "composables", "hooks", "utils"],
|
|
1208
|
+
eslintrc: {
|
|
1209
|
+
enabled,
|
|
1210
|
+
filePath: import_node_path9.default.resolve(wxtDir, "eslintrc-auto-import.json"),
|
|
1211
|
+
globalsPropValue: true
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
return (0, import_defu.default)(
|
|
1215
|
+
config.imports ?? {},
|
|
1216
|
+
defaultOptions
|
|
1217
|
+
);
|
|
1218
|
+
}
|
|
1197
1219
|
|
|
1198
1220
|
// src/core/utils/building/import-entrypoint.ts
|
|
1199
1221
|
var import_jiti = __toESM(require("jiti"), 1);
|
|
1200
|
-
var
|
|
1201
|
-
var
|
|
1202
|
-
var
|
|
1222
|
+
var import_unimport3 = require("unimport");
|
|
1223
|
+
var import_fs_extra9 = __toESM(require("fs-extra"), 1);
|
|
1224
|
+
var import_node_path10 = require("path");
|
|
1203
1225
|
var import_esbuild = require("esbuild");
|
|
1204
1226
|
var import_node_url = require("url");
|
|
1205
1227
|
|
|
@@ -1208,9 +1230,9 @@ var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
|
1208
1230
|
var import_fs_extra12 = __toESM(require("fs-extra"), 1);
|
|
1209
1231
|
|
|
1210
1232
|
// src/core/utils/log/printFileList.ts
|
|
1211
|
-
var
|
|
1233
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
1212
1234
|
var import_picocolors3 = __toESM(require("picocolors"), 1);
|
|
1213
|
-
var
|
|
1235
|
+
var import_fs_extra10 = __toESM(require("fs-extra"), 1);
|
|
1214
1236
|
var import_filesize = require("filesize");
|
|
1215
1237
|
var DEFAULT_COLOR = import_picocolors3.default.blue;
|
|
1216
1238
|
var CHUNK_COLORS = {
|
|
@@ -1234,13 +1256,7 @@ var import_fast_glob3 = __toESM(require("fast-glob"), 1);
|
|
|
1234
1256
|
|
|
1235
1257
|
// src/core/utils/manifest.ts
|
|
1236
1258
|
var import_fs_extra11 = __toESM(require("fs-extra"), 1);
|
|
1237
|
-
|
|
1238
|
-
// src/core/utils/package.ts
|
|
1239
|
-
var import_node_path11 = require("path");
|
|
1240
|
-
var import_fs_extra10 = __toESM(require("fs-extra"), 1);
|
|
1241
|
-
|
|
1242
|
-
// src/core/utils/manifest.ts
|
|
1243
|
-
var import_defu3 = __toESM(require("defu"), 1);
|
|
1259
|
+
var import_defu2 = __toESM(require("defu"), 1);
|
|
1244
1260
|
|
|
1245
1261
|
// src/core/utils/building/internal-build.ts
|
|
1246
1262
|
var import_node_path13 = require("path");
|
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 './index-
|
|
3
|
+
import { I as InlineConfig } from './index-sl22zA2Z.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 './index-
|
|
3
|
+
import { I as InlineConfig } from './index-sl22zA2Z.js';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
6
6
|
import 'consola';
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.8-alpha1",
|
|
5
5
|
"description": "Next gen framework for developing web extensions",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"publish-browser-extension": "^2.1.2",
|
|
115
115
|
"rollup-plugin-visualizer": "^5.9.2",
|
|
116
116
|
"unimport": "^3.4.0",
|
|
117
|
-
"vite": "^5.
|
|
117
|
+
"vite": "^5.1.3",
|
|
118
118
|
"web-ext-run": "^0.2.0",
|
|
119
119
|
"webextension-polyfill": "^0.10.0",
|
|
120
120
|
"zip-dir": "^2.0.0"
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"typedoc-vitepress-theme": "1.0.0-next.3",
|
|
145
145
|
"typescript": "^5.3.2",
|
|
146
146
|
"vitepress": "1.0.0-rc.34",
|
|
147
|
-
"vitest": "^1.
|
|
147
|
+
"vitest": "^1.2.2",
|
|
148
148
|
"vitest-mock-extended": "^1.3.1",
|
|
149
149
|
"vue": "^3.3.10"
|
|
150
150
|
},
|