wxt 0.17.0 → 0.17.2-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/bin/wxt-publish-extension.mjs +2 -0
- package/bin/wxt-rollup-plugin-visualizer.mjs +2 -0
- package/dist/{chunk-FD7GO6WM.js → chunk-5I3RQIJ6.js} +4 -18
- package/dist/cli.js +10 -23
- package/dist/index.cjs +40 -54
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/storage.cjs +1 -1
- package/dist/storage.d.cts +2 -2
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +1 -1
- package/dist/testing.cjs +1 -6
- package/dist/testing.js +1 -1
- package/dist/virtual/background-entrypoint.js +16 -1
- package/package.json +6 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.17.
|
|
2
|
+
var version = "0.17.2-alpha1";
|
|
3
3
|
|
|
4
4
|
// src/core/utils/paths.ts
|
|
5
5
|
import systemPath from "node:path";
|
|
@@ -2849,21 +2849,6 @@ var ValidationError = class extends Error {
|
|
|
2849
2849
|
|
|
2850
2850
|
// src/core/utils/building/internal-build.ts
|
|
2851
2851
|
import consola3 from "consola";
|
|
2852
|
-
|
|
2853
|
-
// src/core/utils/exec.ts
|
|
2854
|
-
import managePath from "manage-path";
|
|
2855
|
-
import { resolve as resolve13 } from "node:path";
|
|
2856
|
-
var managedPath = managePath(process.env);
|
|
2857
|
-
var exec = async (file, args, options) => {
|
|
2858
|
-
managedPath.restore();
|
|
2859
|
-
managedPath.push(
|
|
2860
|
-
resolve13(wxt.config.root, "node_modules/wxt/node_modules/.bin")
|
|
2861
|
-
);
|
|
2862
|
-
const { execa } = await import("./execa-4F7CCWCA.js");
|
|
2863
|
-
return await execa(file, args, options);
|
|
2864
|
-
};
|
|
2865
|
-
|
|
2866
|
-
// src/core/utils/building/internal-build.ts
|
|
2867
2852
|
async function internalBuild() {
|
|
2868
2853
|
await wxt.hooks.callHook("build:before", wxt);
|
|
2869
2854
|
const verb = wxt.config.command === "serve" ? "Pre-rendering" : "Building";
|
|
@@ -2915,8 +2900,9 @@ async function combineAnalysisStats() {
|
|
|
2915
2900
|
absolute: true
|
|
2916
2901
|
});
|
|
2917
2902
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
2918
|
-
await
|
|
2919
|
-
|
|
2903
|
+
const { execa } = await import("./execa-4F7CCWCA.js");
|
|
2904
|
+
await execa(
|
|
2905
|
+
"wxt-rollup-plugin-visualizer",
|
|
2920
2906
|
[
|
|
2921
2907
|
...absolutePaths,
|
|
2922
2908
|
"--template",
|
package/dist/cli.js
CHANGED
|
@@ -2181,7 +2181,7 @@ function getChunkSortWeight(filename) {
|
|
|
2181
2181
|
import pc4 from "picocolors";
|
|
2182
2182
|
|
|
2183
2183
|
// package.json
|
|
2184
|
-
var version = "0.17.
|
|
2184
|
+
var version = "0.17.2-alpha1";
|
|
2185
2185
|
|
|
2186
2186
|
// src/core/utils/log/printHeader.ts
|
|
2187
2187
|
import { consola as consola2 } from "consola";
|
|
@@ -2858,21 +2858,6 @@ var ValidationError = class extends Error {
|
|
|
2858
2858
|
|
|
2859
2859
|
// src/core/utils/building/internal-build.ts
|
|
2860
2860
|
import consola3 from "consola";
|
|
2861
|
-
|
|
2862
|
-
// src/core/utils/exec.ts
|
|
2863
|
-
import managePath from "manage-path";
|
|
2864
|
-
import { resolve as resolve13 } from "node:path";
|
|
2865
|
-
var managedPath = managePath(process.env);
|
|
2866
|
-
var exec = async (file, args, options) => {
|
|
2867
|
-
managedPath.restore();
|
|
2868
|
-
managedPath.push(
|
|
2869
|
-
resolve13(wxt.config.root, "node_modules/wxt/node_modules/.bin")
|
|
2870
|
-
);
|
|
2871
|
-
const { execa } = await import("./execa-Y2EWTC4S.js");
|
|
2872
|
-
return await execa(file, args, options);
|
|
2873
|
-
};
|
|
2874
|
-
|
|
2875
|
-
// src/core/utils/building/internal-build.ts
|
|
2876
2861
|
async function internalBuild() {
|
|
2877
2862
|
await wxt.hooks.callHook("build:before", wxt);
|
|
2878
2863
|
const verb = wxt.config.command === "serve" ? "Pre-rendering" : "Building";
|
|
@@ -2924,8 +2909,9 @@ async function combineAnalysisStats() {
|
|
|
2924
2909
|
absolute: true
|
|
2925
2910
|
});
|
|
2926
2911
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
2927
|
-
await
|
|
2928
|
-
|
|
2912
|
+
const { execa } = await import("./execa-Y2EWTC4S.js");
|
|
2913
|
+
await execa(
|
|
2914
|
+
"wxt-rollup-plugin-visualizer",
|
|
2929
2915
|
[
|
|
2930
2916
|
...absolutePaths,
|
|
2931
2917
|
"--template",
|
|
@@ -3480,7 +3466,7 @@ async function prepare(config) {
|
|
|
3480
3466
|
|
|
3481
3467
|
// src/core/zip.ts
|
|
3482
3468
|
import zipdir from "zip-dir";
|
|
3483
|
-
import { dirname as dirname5, relative as relative11, resolve as
|
|
3469
|
+
import { dirname as dirname5, relative as relative11, resolve as resolve13 } from "node:path";
|
|
3484
3470
|
import fs15 from "fs-extra";
|
|
3485
3471
|
import { minimatch as minimatch2 } from "minimatch";
|
|
3486
3472
|
async function zip(config) {
|
|
@@ -3498,14 +3484,14 @@ async function zip(config) {
|
|
|
3498
3484
|
).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
3499
3485
|
await fs15.ensureDir(wxt.config.outBaseDir);
|
|
3500
3486
|
const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
|
|
3501
|
-
const outZipPath =
|
|
3487
|
+
const outZipPath = resolve13(wxt.config.outBaseDir, outZipFilename);
|
|
3502
3488
|
await zipdir(wxt.config.outDir, {
|
|
3503
3489
|
saveTo: outZipPath
|
|
3504
3490
|
});
|
|
3505
3491
|
zipFiles.push(outZipPath);
|
|
3506
3492
|
if (wxt.config.browser === "firefox") {
|
|
3507
3493
|
const sourcesZipFilename = applyTemplate(wxt.config.zip.sourcesTemplate);
|
|
3508
|
-
const sourcesZipPath =
|
|
3494
|
+
const sourcesZipPath = resolve13(wxt.config.outBaseDir, sourcesZipFilename);
|
|
3509
3495
|
await zipdir(wxt.config.zip.sourcesRoot, {
|
|
3510
3496
|
saveTo: sourcesZipPath,
|
|
3511
3497
|
filter(path8) {
|
|
@@ -3569,7 +3555,8 @@ function createAliasedCommand(base, name, alias, docsUrl) {
|
|
|
3569
3555
|
const args = process.argv.slice(
|
|
3570
3556
|
process.argv.indexOf(aliasedCommand.name) + 1
|
|
3571
3557
|
);
|
|
3572
|
-
await
|
|
3558
|
+
const { execa } = await import("./execa-Y2EWTC4S.js");
|
|
3559
|
+
await execa(alias, args, {
|
|
3573
3560
|
stdio: "inherit"
|
|
3574
3561
|
});
|
|
3575
3562
|
} catch {
|
|
@@ -3667,7 +3654,7 @@ cli.command("init [directory]", "initialize a new project").option("-t, --templa
|
|
|
3667
3654
|
createAliasedCommand(
|
|
3668
3655
|
cli,
|
|
3669
3656
|
"submit",
|
|
3670
|
-
"publish-extension",
|
|
3657
|
+
"wxt-publish-extension",
|
|
3671
3658
|
"https://www.npmjs.com/publish-browser-extension"
|
|
3672
3659
|
);
|
|
3673
3660
|
var commands_default = cli;
|
package/dist/index.cjs
CHANGED
|
@@ -130,12 +130,12 @@ var require_isexe = __commonJS({
|
|
|
130
130
|
if (typeof Promise !== "function") {
|
|
131
131
|
throw new TypeError("callback not provided");
|
|
132
132
|
}
|
|
133
|
-
return new Promise(function(
|
|
133
|
+
return new Promise(function(resolve14, reject) {
|
|
134
134
|
isexe(path11, options || {}, function(er, is) {
|
|
135
135
|
if (er) {
|
|
136
136
|
reject(er);
|
|
137
137
|
} else {
|
|
138
|
-
|
|
138
|
+
resolve14(is);
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
});
|
|
@@ -202,27 +202,27 @@ var require_which = __commonJS({
|
|
|
202
202
|
opt = {};
|
|
203
203
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
204
204
|
const found = [];
|
|
205
|
-
const step = (i) => new Promise((
|
|
205
|
+
const step = (i) => new Promise((resolve14, reject) => {
|
|
206
206
|
if (i === pathEnv.length)
|
|
207
|
-
return opt.all && found.length ?
|
|
207
|
+
return opt.all && found.length ? resolve14(found) : reject(getNotFoundError(cmd));
|
|
208
208
|
const ppRaw = pathEnv[i];
|
|
209
209
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
210
210
|
const pCmd = path11.join(pathPart, cmd);
|
|
211
211
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
212
|
-
|
|
212
|
+
resolve14(subStep(p, i, 0));
|
|
213
213
|
});
|
|
214
|
-
const subStep = (p, i, ii) => new Promise((
|
|
214
|
+
const subStep = (p, i, ii) => new Promise((resolve14, reject) => {
|
|
215
215
|
if (ii === pathExt.length)
|
|
216
|
-
return
|
|
216
|
+
return resolve14(step(i + 1));
|
|
217
217
|
const ext = pathExt[ii];
|
|
218
218
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
219
219
|
if (!er && is) {
|
|
220
220
|
if (opt.all)
|
|
221
221
|
found.push(p + ext);
|
|
222
222
|
else
|
|
223
|
-
return
|
|
223
|
+
return resolve14(p + ext);
|
|
224
224
|
}
|
|
225
|
-
return
|
|
225
|
+
return resolve14(subStep(p, i, ii + 1));
|
|
226
226
|
});
|
|
227
227
|
});
|
|
228
228
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -1529,7 +1529,7 @@ var init_kill = __esm({
|
|
|
1529
1529
|
return spawnedPromise;
|
|
1530
1530
|
}
|
|
1531
1531
|
let timeoutId;
|
|
1532
|
-
const timeoutPromise = new Promise((
|
|
1532
|
+
const timeoutPromise = new Promise((resolve14, reject) => {
|
|
1533
1533
|
timeoutId = setTimeout(() => {
|
|
1534
1534
|
timeoutKill(spawned, killSignal, reject);
|
|
1535
1535
|
}, timeout);
|
|
@@ -2013,9 +2013,9 @@ var init_promise = __esm({
|
|
|
2013
2013
|
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
2014
2014
|
}
|
|
2015
2015
|
};
|
|
2016
|
-
getSpawnedPromise = (spawned) => new Promise((
|
|
2016
|
+
getSpawnedPromise = (spawned) => new Promise((resolve14, reject) => {
|
|
2017
2017
|
spawned.on("exit", (exitCode, signal) => {
|
|
2018
|
-
|
|
2018
|
+
resolve14({ exitCode, signal });
|
|
2019
2019
|
});
|
|
2020
2020
|
spawned.on("error", (error) => {
|
|
2021
2021
|
reject(error);
|
|
@@ -4608,7 +4608,7 @@ function getChunkSortWeight(filename) {
|
|
|
4608
4608
|
var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
4609
4609
|
|
|
4610
4610
|
// package.json
|
|
4611
|
-
var version = "0.17.
|
|
4611
|
+
var version = "0.17.2-alpha1";
|
|
4612
4612
|
|
|
4613
4613
|
// src/core/utils/log/printHeader.ts
|
|
4614
4614
|
var import_consola2 = require("consola");
|
|
@@ -5218,7 +5218,7 @@ async function rebuild(allEntrypoints, entrypointGroups, existingOutput = {
|
|
|
5218
5218
|
}
|
|
5219
5219
|
|
|
5220
5220
|
// src/core/utils/building/internal-build.ts
|
|
5221
|
-
var
|
|
5221
|
+
var import_node_path14 = require("path");
|
|
5222
5222
|
|
|
5223
5223
|
// src/core/utils/validation.ts
|
|
5224
5224
|
function validateEntrypoints(entrypoints) {
|
|
@@ -5281,21 +5281,6 @@ var ValidationError = class extends Error {
|
|
|
5281
5281
|
|
|
5282
5282
|
// src/core/utils/building/internal-build.ts
|
|
5283
5283
|
var import_consola3 = __toESM(require("consola"), 1);
|
|
5284
|
-
|
|
5285
|
-
// src/core/utils/exec.ts
|
|
5286
|
-
var import_manage_path = __toESM(require("manage-path"), 1);
|
|
5287
|
-
var import_node_path14 = require("path");
|
|
5288
|
-
var managedPath = (0, import_manage_path.default)(process.env);
|
|
5289
|
-
var exec = async (file, args, options) => {
|
|
5290
|
-
managedPath.restore();
|
|
5291
|
-
managedPath.push(
|
|
5292
|
-
(0, import_node_path14.resolve)(wxt.config.root, "node_modules/wxt/node_modules/.bin")
|
|
5293
|
-
);
|
|
5294
|
-
const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
|
|
5295
|
-
return await execa2(file, args, options);
|
|
5296
|
-
};
|
|
5297
|
-
|
|
5298
|
-
// src/core/utils/building/internal-build.ts
|
|
5299
5284
|
async function internalBuild() {
|
|
5300
5285
|
await wxt.hooks.callHook("build:before", wxt);
|
|
5301
5286
|
const verb = wxt.config.command === "serve" ? "Pre-rendering" : "Building";
|
|
@@ -5333,7 +5318,7 @@ async function internalBuild() {
|
|
|
5333
5318
|
}
|
|
5334
5319
|
if (wxt.config.analysis.enabled) {
|
|
5335
5320
|
await combineAnalysisStats();
|
|
5336
|
-
const statsPath = (0,
|
|
5321
|
+
const statsPath = (0, import_node_path14.relative)(wxt.config.root, wxt.config.analysis.outputFile);
|
|
5337
5322
|
wxt.logger.info(
|
|
5338
5323
|
`Analysis complete:
|
|
5339
5324
|
${import_picocolors5.default.gray("\u2514\u2500")} ${import_picocolors5.default.yellow(statsPath)}`
|
|
@@ -5347,8 +5332,9 @@ async function combineAnalysisStats() {
|
|
|
5347
5332
|
absolute: true
|
|
5348
5333
|
});
|
|
5349
5334
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
5350
|
-
await
|
|
5351
|
-
|
|
5335
|
+
const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
|
|
5336
|
+
await execa2(
|
|
5337
|
+
"wxt-rollup-plugin-visualizer",
|
|
5352
5338
|
[
|
|
5353
5339
|
...absolutePaths,
|
|
5354
5340
|
"--template",
|
|
@@ -5378,7 +5364,7 @@ function printValidationResults({
|
|
|
5378
5364
|
return map;
|
|
5379
5365
|
}, /* @__PURE__ */ new Map());
|
|
5380
5366
|
Array.from(entrypointErrors.entries()).forEach(([entrypoint, errors2]) => {
|
|
5381
|
-
import_consola3.default.log((0,
|
|
5367
|
+
import_consola3.default.log((0, import_node_path14.relative)(cwd, entrypoint.inputPath));
|
|
5382
5368
|
console.log();
|
|
5383
5369
|
errors2.forEach((err) => {
|
|
5384
5370
|
const type = err.type === "error" ? import_picocolors5.default.red("ERROR") : import_picocolors5.default.yellow("WARN");
|
|
@@ -5396,7 +5382,7 @@ async function build(config) {
|
|
|
5396
5382
|
}
|
|
5397
5383
|
|
|
5398
5384
|
// src/core/clean.ts
|
|
5399
|
-
var
|
|
5385
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
5400
5386
|
var import_fast_glob4 = __toESM(require("fast-glob"), 1);
|
|
5401
5387
|
var import_fs_extra13 = __toESM(require("fs-extra"), 1);
|
|
5402
5388
|
var import_consola4 = require("consola");
|
|
@@ -5411,7 +5397,7 @@ async function clean(root = process.cwd()) {
|
|
|
5411
5397
|
];
|
|
5412
5398
|
import_consola4.consola.debug("Looking for:", tempDirs.map(import_picocolors6.default.cyan).join(", "));
|
|
5413
5399
|
const directories = await (0, import_fast_glob4.default)(tempDirs, {
|
|
5414
|
-
cwd:
|
|
5400
|
+
cwd: import_node_path15.default.resolve(root),
|
|
5415
5401
|
absolute: true,
|
|
5416
5402
|
onlyDirectories: true,
|
|
5417
5403
|
deep: 2
|
|
@@ -5422,11 +5408,11 @@ async function clean(root = process.cwd()) {
|
|
|
5422
5408
|
}
|
|
5423
5409
|
import_consola4.consola.debug(
|
|
5424
5410
|
"Found:",
|
|
5425
|
-
directories.map((dir) => import_picocolors6.default.cyan(
|
|
5411
|
+
directories.map((dir) => import_picocolors6.default.cyan(import_node_path15.default.relative(root, dir))).join(", ")
|
|
5426
5412
|
);
|
|
5427
5413
|
for (const directory of directories) {
|
|
5428
5414
|
await import_fs_extra13.default.rm(directory, { force: true, recursive: true });
|
|
5429
|
-
import_consola4.consola.debug("Deleted " + import_picocolors6.default.cyan(
|
|
5415
|
+
import_consola4.consola.debug("Deleted " + import_picocolors6.default.cyan(import_node_path15.default.relative(root, directory)));
|
|
5430
5416
|
}
|
|
5431
5417
|
}
|
|
5432
5418
|
|
|
@@ -5441,12 +5427,12 @@ function defineRunnerConfig(config) {
|
|
|
5441
5427
|
}
|
|
5442
5428
|
|
|
5443
5429
|
// src/core/runners/wsl.ts
|
|
5444
|
-
var
|
|
5430
|
+
var import_node_path16 = require("path");
|
|
5445
5431
|
function createWslRunner() {
|
|
5446
5432
|
return {
|
|
5447
5433
|
async openBrowser() {
|
|
5448
5434
|
wxt.logger.warn(
|
|
5449
|
-
`Cannot open browser when using WSL. Load "${(0,
|
|
5435
|
+
`Cannot open browser when using WSL. Load "${(0, import_node_path16.relative)(
|
|
5450
5436
|
process.cwd(),
|
|
5451
5437
|
wxt.config.outDir
|
|
5452
5438
|
)}" as an unpacked extension manually`
|
|
@@ -5534,12 +5520,12 @@ var DEFAULT_CHROMIUM_PREFS = {
|
|
|
5534
5520
|
};
|
|
5535
5521
|
|
|
5536
5522
|
// src/core/runners/safari.ts
|
|
5537
|
-
var
|
|
5523
|
+
var import_node_path17 = require("path");
|
|
5538
5524
|
function createSafariRunner() {
|
|
5539
5525
|
return {
|
|
5540
5526
|
async openBrowser() {
|
|
5541
5527
|
wxt.logger.warn(
|
|
5542
|
-
`Cannot Safari using web-ext. Load "${(0,
|
|
5528
|
+
`Cannot Safari using web-ext. Load "${(0, import_node_path17.relative)(
|
|
5543
5529
|
process.cwd(),
|
|
5544
5530
|
wxt.config.outDir
|
|
5545
5531
|
)}" as an unpacked extension manually`
|
|
@@ -5551,12 +5537,12 @@ function createSafariRunner() {
|
|
|
5551
5537
|
}
|
|
5552
5538
|
|
|
5553
5539
|
// src/core/runners/manual.ts
|
|
5554
|
-
var
|
|
5540
|
+
var import_node_path18 = require("path");
|
|
5555
5541
|
function createManualRunner() {
|
|
5556
5542
|
return {
|
|
5557
5543
|
async openBrowser() {
|
|
5558
5544
|
wxt.logger.info(
|
|
5559
|
-
`Load "${(0,
|
|
5545
|
+
`Load "${(0, import_node_path18.relative)(
|
|
5560
5546
|
process.cwd(),
|
|
5561
5547
|
wxt.config.outDir
|
|
5562
5548
|
)}" as an unpacked extension manually`
|
|
@@ -5588,7 +5574,7 @@ async function createExtensionRunner() {
|
|
|
5588
5574
|
var import_consola5 = require("consola");
|
|
5589
5575
|
var import_async_mutex = require("async-mutex");
|
|
5590
5576
|
var import_picocolors7 = __toESM(require("picocolors"), 1);
|
|
5591
|
-
var
|
|
5577
|
+
var import_node_path19 = require("path");
|
|
5592
5578
|
async function createServer(inlineConfig) {
|
|
5593
5579
|
const port = await getPort();
|
|
5594
5580
|
const hostname = "localhost";
|
|
@@ -5697,7 +5683,7 @@ function createFileReloader(server) {
|
|
|
5697
5683
|
return;
|
|
5698
5684
|
}
|
|
5699
5685
|
wxt.logger.info(
|
|
5700
|
-
`Changed: ${Array.from(new Set(fileChanges)).map((file) => import_picocolors7.default.dim((0,
|
|
5686
|
+
`Changed: ${Array.from(new Set(fileChanges)).map((file) => import_picocolors7.default.dim((0, import_node_path19.relative)(wxt.config.root, file))).join(", ")}`
|
|
5701
5687
|
);
|
|
5702
5688
|
const allEntrypoints = await findEntrypoints();
|
|
5703
5689
|
const { output: newOutput } = await rebuild(
|
|
@@ -5787,7 +5773,7 @@ var import_prompts = __toESM(require("prompts"), 1);
|
|
|
5787
5773
|
var import_consola6 = require("consola");
|
|
5788
5774
|
var import_giget = require("giget");
|
|
5789
5775
|
var import_fs_extra14 = __toESM(require("fs-extra"), 1);
|
|
5790
|
-
var
|
|
5776
|
+
var import_node_path20 = __toESM(require("path"), 1);
|
|
5791
5777
|
var import_picocolors8 = __toESM(require("picocolors"), 1);
|
|
5792
5778
|
async function initialize(options) {
|
|
5793
5779
|
import_consola6.consola.info("Initalizing new project");
|
|
@@ -5835,7 +5821,7 @@ async function initialize(options) {
|
|
|
5835
5821
|
input.template ??= defaultTemplate;
|
|
5836
5822
|
input.packageManager ??= options.packageManager;
|
|
5837
5823
|
await cloneProject(input);
|
|
5838
|
-
const cdPath =
|
|
5824
|
+
const cdPath = import_node_path20.default.relative(process.cwd(), import_node_path20.default.resolve(input.directory));
|
|
5839
5825
|
console.log();
|
|
5840
5826
|
import_consola6.consola.log(
|
|
5841
5827
|
`\u2728 WXT project created with the ${TEMPLATE_COLORS[input.template.name]?.(input.template.name) ?? input.template.name} template.`
|
|
@@ -5879,8 +5865,8 @@ async function cloneProject({
|
|
|
5879
5865
|
force: true
|
|
5880
5866
|
});
|
|
5881
5867
|
await import_fs_extra14.default.move(
|
|
5882
|
-
|
|
5883
|
-
|
|
5868
|
+
import_node_path20.default.join(directory, "_gitignore"),
|
|
5869
|
+
import_node_path20.default.join(directory, ".gitignore")
|
|
5884
5870
|
).catch(
|
|
5885
5871
|
(err) => import_consola6.consola.warn("Failed to move _gitignore to .gitignore:", err)
|
|
5886
5872
|
);
|
|
@@ -5913,7 +5899,7 @@ async function prepare(config) {
|
|
|
5913
5899
|
|
|
5914
5900
|
// src/core/zip.ts
|
|
5915
5901
|
var import_zip_dir = __toESM(require("zip-dir"), 1);
|
|
5916
|
-
var
|
|
5902
|
+
var import_node_path21 = require("path");
|
|
5917
5903
|
var import_fs_extra15 = __toESM(require("fs-extra"), 1);
|
|
5918
5904
|
var import_minimatch2 = require("minimatch");
|
|
5919
5905
|
async function zip(config) {
|
|
@@ -5923,7 +5909,7 @@ async function zip(config) {
|
|
|
5923
5909
|
wxt.logger.info("Zipping extension...");
|
|
5924
5910
|
const zipFiles = [];
|
|
5925
5911
|
const projectName = wxt.config.zip.name ?? kebabCaseAlphanumeric(
|
|
5926
|
-
(await getPackageJson())?.name || (0,
|
|
5912
|
+
(await getPackageJson())?.name || (0, import_node_path21.dirname)(process.cwd())
|
|
5927
5913
|
);
|
|
5928
5914
|
const applyTemplate = (template) => template.replaceAll("{{name}}", projectName).replaceAll("{{browser}}", wxt.config.browser).replaceAll(
|
|
5929
5915
|
"{{version}}",
|
|
@@ -5931,18 +5917,18 @@ async function zip(config) {
|
|
|
5931
5917
|
).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
5932
5918
|
await import_fs_extra15.default.ensureDir(wxt.config.outBaseDir);
|
|
5933
5919
|
const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
|
|
5934
|
-
const outZipPath = (0,
|
|
5920
|
+
const outZipPath = (0, import_node_path21.resolve)(wxt.config.outBaseDir, outZipFilename);
|
|
5935
5921
|
await (0, import_zip_dir.default)(wxt.config.outDir, {
|
|
5936
5922
|
saveTo: outZipPath
|
|
5937
5923
|
});
|
|
5938
5924
|
zipFiles.push(outZipPath);
|
|
5939
5925
|
if (wxt.config.browser === "firefox") {
|
|
5940
5926
|
const sourcesZipFilename = applyTemplate(wxt.config.zip.sourcesTemplate);
|
|
5941
|
-
const sourcesZipPath = (0,
|
|
5927
|
+
const sourcesZipPath = (0, import_node_path21.resolve)(wxt.config.outBaseDir, sourcesZipFilename);
|
|
5942
5928
|
await (0, import_zip_dir.default)(wxt.config.zip.sourcesRoot, {
|
|
5943
5929
|
saveTo: sourcesZipPath,
|
|
5944
5930
|
filter(path11) {
|
|
5945
|
-
const relativePath = (0,
|
|
5931
|
+
const relativePath = (0, import_node_path21.relative)(wxt.config.zip.sourcesRoot, path11);
|
|
5946
5932
|
return wxt.config.zip.includeSources.some(
|
|
5947
5933
|
(pattern) => (0, import_minimatch2.minimatch)(relativePath, pattern)
|
|
5948
5934
|
) || !wxt.config.zip.excludeSources.some(
|
package/dist/index.d.cts
CHANGED
|
@@ -64,6 +64,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
|
|
|
64
64
|
*/
|
|
65
65
|
declare function zip(config?: InlineConfig): Promise<string[]>;
|
|
66
66
|
|
|
67
|
-
var version = "0.17.
|
|
67
|
+
var version = "0.17.2-alpha1";
|
|
68
68
|
|
|
69
69
|
export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
|
|
|
64
64
|
*/
|
|
65
65
|
declare function zip(config?: InlineConfig): Promise<string[]>;
|
|
66
66
|
|
|
67
|
-
var version = "0.17.
|
|
67
|
+
var version = "0.17.2-alpha1";
|
|
68
68
|
|
|
69
69
|
export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
|
package/dist/index.js
CHANGED
package/dist/storage.cjs
CHANGED
|
@@ -83,7 +83,7 @@ function createStorage() {
|
|
|
83
83
|
const driverKey = key.substring(deliminatorIndex + 1);
|
|
84
84
|
if (driverKey == null)
|
|
85
85
|
throw Error(
|
|
86
|
-
`Storage key should be in the form of "area:key", but
|
|
86
|
+
`Storage key should be in the form of "area:key", but received "${key}"`
|
|
87
87
|
);
|
|
88
88
|
return {
|
|
89
89
|
driverArea,
|
package/dist/storage.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ interface WxtStorage {
|
|
|
8
8
|
*/
|
|
9
9
|
getItem<T>(key: string, opts?: GetItemOptions<T>): Promise<T | null>;
|
|
10
10
|
/**
|
|
11
|
-
* Get multiple items from storage. There is no
|
|
11
|
+
* Get multiple items from storage. There is no guarantee of order in the returned array.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* await storage.getItems(["local:installDate", "session:someCounter"]);
|
|
@@ -88,7 +88,7 @@ interface WxtStorage {
|
|
|
88
88
|
snapshot(base: string, opts?: SnapshotOptions): Promise<Record<string, unknown>>;
|
|
89
89
|
/**
|
|
90
90
|
* Restores the results of `snapshot`. If new properties have been saved since the snapshot, they are
|
|
91
|
-
* not overridden. Only values existing in the snapshot are
|
|
91
|
+
* not overridden. Only values existing in the snapshot are overridden.
|
|
92
92
|
*/
|
|
93
93
|
restoreSnapshot(base: string, data: any): Promise<void>;
|
|
94
94
|
/**
|
package/dist/storage.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface WxtStorage {
|
|
|
8
8
|
*/
|
|
9
9
|
getItem<T>(key: string, opts?: GetItemOptions<T>): Promise<T | null>;
|
|
10
10
|
/**
|
|
11
|
-
* Get multiple items from storage. There is no
|
|
11
|
+
* Get multiple items from storage. There is no guarantee of order in the returned array.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* await storage.getItems(["local:installDate", "session:someCounter"]);
|
|
@@ -88,7 +88,7 @@ interface WxtStorage {
|
|
|
88
88
|
snapshot(base: string, opts?: SnapshotOptions): Promise<Record<string, unknown>>;
|
|
89
89
|
/**
|
|
90
90
|
* Restores the results of `snapshot`. If new properties have been saved since the snapshot, they are
|
|
91
|
-
* not overridden. Only values existing in the snapshot are
|
|
91
|
+
* not overridden. Only values existing in the snapshot are overridden.
|
|
92
92
|
*/
|
|
93
93
|
restoreSnapshot(base: string, data: any): Promise<void>;
|
|
94
94
|
/**
|
package/dist/storage.js
CHANGED
|
@@ -48,7 +48,7 @@ function createStorage() {
|
|
|
48
48
|
const driverKey = key.substring(deliminatorIndex + 1);
|
|
49
49
|
if (driverKey == null)
|
|
50
50
|
throw Error(
|
|
51
|
-
`Storage key should be in the form of "area:key", but
|
|
51
|
+
`Storage key should be in the form of "area:key", but received "${key}"`
|
|
52
52
|
);
|
|
53
53
|
return {
|
|
54
54
|
driverArea,
|
package/dist/testing.cjs
CHANGED
|
@@ -1267,13 +1267,8 @@ var import_fs_extra11 = __toESM(require("fs-extra"), 1);
|
|
|
1267
1267
|
var import_defu2 = __toESM(require("defu"), 1);
|
|
1268
1268
|
|
|
1269
1269
|
// src/core/utils/building/internal-build.ts
|
|
1270
|
-
var import_node_path13 = require("path");
|
|
1271
|
-
var import_consola3 = __toESM(require("consola"), 1);
|
|
1272
|
-
|
|
1273
|
-
// src/core/utils/exec.ts
|
|
1274
|
-
var import_manage_path = __toESM(require("manage-path"), 1);
|
|
1275
1270
|
var import_node_path12 = require("path");
|
|
1276
|
-
var
|
|
1271
|
+
var import_consola3 = __toESM(require("consola"), 1);
|
|
1277
1272
|
|
|
1278
1273
|
// src/testing/wxt-vitest-plugin.ts
|
|
1279
1274
|
function WxtVitest(inlineConfig) {
|
package/dist/testing.js
CHANGED
|
@@ -75,8 +75,23 @@ async function reloadContentScriptMv3({
|
|
|
75
75
|
if (registration === "runtime") {
|
|
76
76
|
await reloadRuntimeContentScriptMv3(contentScript);
|
|
77
77
|
} else {
|
|
78
|
-
await
|
|
78
|
+
await reloadManifestContentScriptMv3(contentScript);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function reloadManifestContentScriptMv3(contentScript) {
|
|
82
|
+
const id = `wxt:${contentScript.js[0]}`;
|
|
83
|
+
logger.log("Reloading content script:", contentScript);
|
|
84
|
+
const registered = await browser2.scripting.getRegisteredContentScripts();
|
|
85
|
+
logger.debug("Existing scripts:", registered);
|
|
86
|
+
const existing = registered.find((cs) => cs.id === id);
|
|
87
|
+
if (existing) {
|
|
88
|
+
logger.debug("Updating content script", existing);
|
|
89
|
+
await browser2.scripting.updateContentScripts([{ ...contentScript, id }]);
|
|
90
|
+
} else {
|
|
91
|
+
logger.debug("Registering new content script...");
|
|
92
|
+
await browser2.scripting.registerContentScripts([{ ...contentScript, id }]);
|
|
79
93
|
}
|
|
94
|
+
await reloadTabsForContentScript(contentScript);
|
|
80
95
|
}
|
|
81
96
|
async function reloadRuntimeContentScriptMv3(contentScript) {
|
|
82
97
|
logger.log("Reloading content script:", contentScript);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.17.
|
|
4
|
+
"version": "0.17.2-alpha1",
|
|
5
5
|
"description": "Next gen framework for developing web extensions",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18",
|
|
@@ -30,7 +30,11 @@
|
|
|
30
30
|
"bin",
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
|
-
"bin":
|
|
33
|
+
"bin": {
|
|
34
|
+
"wxt": "./bin/wxt.mjs",
|
|
35
|
+
"wxt-publish-extension": "./bin/wxt-publish-extension.mjs",
|
|
36
|
+
"wxt-rollup-plugin-visualizer": "./bin/wxt-rollup-plugin-visualizer.mjs"
|
|
37
|
+
},
|
|
34
38
|
"main": "./dist/index.cjs",
|
|
35
39
|
"module": "./dist/index.js",
|
|
36
40
|
"types": "./dist/index.d.ts",
|
|
@@ -104,7 +108,6 @@
|
|
|
104
108
|
"jiti": "^1.21.0",
|
|
105
109
|
"json5": "^2.2.3",
|
|
106
110
|
"linkedom": "^0.16.1",
|
|
107
|
-
"manage-path": "^2.0.0",
|
|
108
111
|
"minimatch": "^9.0.3",
|
|
109
112
|
"natural-compare": "^1.4.0",
|
|
110
113
|
"normalize-path": "^3.0.0",
|