wxt 0.17.2-alpha2 → 0.17.2-alpha4
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-7E4MYYBY.js → chunk-C57BR3TX.js} +24 -46
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +53 -65
- package/dist/index.cjs +103 -119
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -1
- package/dist/testing.cjs +13 -17
- package/dist/testing.js +1 -1
- package/package.json +10 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.17.2-
|
|
2
|
+
var version = "0.17.2-alpha4";
|
|
3
3
|
|
|
4
4
|
// src/core/utils/paths.ts
|
|
5
5
|
import systemPath from "node:path";
|
|
6
6
|
import normalize from "normalize-path";
|
|
7
|
-
function normalizePath(
|
|
8
|
-
return normalize(
|
|
7
|
+
function normalizePath(path7) {
|
|
8
|
+
return normalize(path7);
|
|
9
9
|
}
|
|
10
|
-
function unnormalizePath(
|
|
11
|
-
return systemPath.normalize(
|
|
10
|
+
function unnormalizePath(path7) {
|
|
11
|
+
return systemPath.normalize(path7);
|
|
12
12
|
}
|
|
13
13
|
var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
|
|
14
14
|
var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
|
|
@@ -729,7 +729,7 @@ async function writePathsDeclarationFile(entrypoints) {
|
|
|
729
729
|
wxt.config.outDir,
|
|
730
730
|
isHtmlEntrypoint(entry) ? ".html" : ".js"
|
|
731
731
|
)
|
|
732
|
-
).concat(await getPublicFiles()).map(normalizePath).map((
|
|
732
|
+
).concat(await getPublicFiles()).map(normalizePath).map((path7) => ` | "/${path7}"`).sort().join("\n");
|
|
733
733
|
const template = `// Generated by wxt
|
|
734
734
|
import "wxt/browser";
|
|
735
735
|
|
|
@@ -837,7 +837,7 @@ async function writeMainDeclarationFile(references) {
|
|
|
837
837
|
}
|
|
838
838
|
async function writeTsConfigFile(mainReference) {
|
|
839
839
|
const dir = wxt.config.wxtDir;
|
|
840
|
-
const getTsconfigPath = (
|
|
840
|
+
const getTsconfigPath = (path7) => normalizePath(relative3(dir, path7));
|
|
841
841
|
const paths = Object.entries(wxt.config.alias).flatMap(([alias, absolutePath]) => {
|
|
842
842
|
const aliasPath = getTsconfigPath(absolutePath);
|
|
843
843
|
return [
|
|
@@ -882,14 +882,14 @@ function createFsCache(wxtDir) {
|
|
|
882
882
|
const getPath = (key) => resolve5(wxtDir, "cache", encodeURIComponent(key));
|
|
883
883
|
return {
|
|
884
884
|
async set(key, value) {
|
|
885
|
-
const
|
|
886
|
-
await ensureDir(dirname2(
|
|
887
|
-
await writeFileIfDifferent(
|
|
885
|
+
const path7 = getPath(key);
|
|
886
|
+
await ensureDir(dirname2(path7));
|
|
887
|
+
await writeFileIfDifferent(path7, value);
|
|
888
888
|
},
|
|
889
889
|
async get(key) {
|
|
890
|
-
const
|
|
890
|
+
const path7 = getPath(key);
|
|
891
891
|
try {
|
|
892
|
-
return await fs5.readFile(
|
|
892
|
+
return await fs5.readFile(path7, "utf-8");
|
|
893
893
|
} catch {
|
|
894
894
|
return void 0;
|
|
895
895
|
}
|
|
@@ -1023,10 +1023,10 @@ function pointToDevServer(config, server, id, document, querySelector, attr) {
|
|
|
1023
1023
|
relative4(config.root, resolvedAbsolutePath)
|
|
1024
1024
|
);
|
|
1025
1025
|
if (relativePath.startsWith(".")) {
|
|
1026
|
-
let
|
|
1027
|
-
if (!
|
|
1028
|
-
|
|
1029
|
-
element.setAttribute(attr, `${server.origin}/@fs${
|
|
1026
|
+
let path7 = normalizePath(resolvedAbsolutePath);
|
|
1027
|
+
if (!path7.startsWith("/"))
|
|
1028
|
+
path7 = "/" + path7;
|
|
1029
|
+
element.setAttribute(attr, `${server.origin}/@fs${path7}`);
|
|
1030
1030
|
} else {
|
|
1031
1031
|
const url = new URL(relativePath, server.origin);
|
|
1032
1032
|
element.setAttribute(attr, url.href);
|
|
@@ -1984,16 +1984,16 @@ ${noImports}`;
|
|
|
1984
1984
|
// src/core/utils/building/import-entrypoint.ts
|
|
1985
1985
|
import { transformSync } from "esbuild";
|
|
1986
1986
|
import { fileURLToPath } from "node:url";
|
|
1987
|
-
async function importEntrypointFile(
|
|
1988
|
-
wxt.logger.debug("Loading file metadata:",
|
|
1989
|
-
const normalPath = normalizePath(
|
|
1987
|
+
async function importEntrypointFile(path7) {
|
|
1988
|
+
wxt.logger.debug("Loading file metadata:", path7);
|
|
1989
|
+
const normalPath = normalizePath(path7);
|
|
1990
1990
|
const unimport2 = createUnimport3({
|
|
1991
1991
|
...wxt.config.imports,
|
|
1992
1992
|
// Only allow specific imports, not all from the project
|
|
1993
1993
|
dirs: []
|
|
1994
1994
|
});
|
|
1995
1995
|
await unimport2.init();
|
|
1996
|
-
const text = await fs9.readFile(
|
|
1996
|
+
const text = await fs9.readFile(path7, "utf-8");
|
|
1997
1997
|
const textNoImports = removeProjectImportStatements(text);
|
|
1998
1998
|
const { code } = await unimport2.injectImports(textNoImports);
|
|
1999
1999
|
wxt.logger.debug(
|
|
@@ -2036,10 +2036,10 @@ async function importEntrypointFile(path8) {
|
|
|
2036
2036
|
}
|
|
2037
2037
|
);
|
|
2038
2038
|
try {
|
|
2039
|
-
const res = await jiti(
|
|
2039
|
+
const res = await jiti(path7);
|
|
2040
2040
|
return res.default;
|
|
2041
2041
|
} catch (err) {
|
|
2042
|
-
const filePath = relative5(wxt.config.root,
|
|
2042
|
+
const filePath = relative5(wxt.config.root, path7);
|
|
2043
2043
|
if (err instanceof ReferenceError) {
|
|
2044
2044
|
const variableName = err.message.replace(" is not defined", "");
|
|
2045
2045
|
throw Error(
|
|
@@ -2849,29 +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 path7 from "node:path";
|
|
2855
|
-
import { exists } from "fs-extra";
|
|
2856
|
-
async function execaDependencyBin(name, args, options) {
|
|
2857
|
-
const possiblePaths = [
|
|
2858
|
-
// Standard location
|
|
2859
|
-
path7.resolve(`node_modules/.bin/${name}`),
|
|
2860
|
-
path7.resolve(wxt.config.root, `node_modules/.bin/${name}`),
|
|
2861
|
-
// PNPM non-hoisted paths
|
|
2862
|
-
path7.resolve(`node_modules/wxt/node_modules/.bin/${name}`),
|
|
2863
|
-
path7.resolve(wxt.config.root, `node_modules/wxt/node_modules/.bin/${name}`)
|
|
2864
|
-
];
|
|
2865
|
-
const location = (await Promise.all(
|
|
2866
|
-
possiblePaths.map((p) => ({ path: p, exists: exists(p) }))
|
|
2867
|
-
)).find((item) => item.exists);
|
|
2868
|
-
if (location == null)
|
|
2869
|
-
throw Error(`Could not locate "${name}" binary`);
|
|
2870
|
-
const { execa } = await import("./execa-4F7CCWCA.js");
|
|
2871
|
-
execa(location.path, args, options);
|
|
2872
|
-
}
|
|
2873
|
-
|
|
2874
|
-
// src/core/utils/building/internal-build.ts
|
|
2875
2852
|
async function internalBuild() {
|
|
2876
2853
|
await wxt.hooks.callHook("build:before", wxt);
|
|
2877
2854
|
const verb = wxt.config.command === "serve" ? "Pre-rendering" : "Building";
|
|
@@ -2923,7 +2900,8 @@ async function combineAnalysisStats() {
|
|
|
2923
2900
|
absolute: true
|
|
2924
2901
|
});
|
|
2925
2902
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
2926
|
-
await
|
|
2903
|
+
const { execa } = await import("./execa-4F7CCWCA.js");
|
|
2904
|
+
await execa(
|
|
2927
2905
|
"rollup-plugin-visualizer",
|
|
2928
2906
|
[
|
|
2929
2907
|
...absolutePaths,
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
CHANGED
|
@@ -11,11 +11,11 @@ import glob from "fast-glob";
|
|
|
11
11
|
// src/core/utils/paths.ts
|
|
12
12
|
import systemPath from "node:path";
|
|
13
13
|
import normalize from "normalize-path";
|
|
14
|
-
function normalizePath(
|
|
15
|
-
return normalize(
|
|
14
|
+
function normalizePath(path8) {
|
|
15
|
+
return normalize(path8);
|
|
16
16
|
}
|
|
17
|
-
function unnormalizePath(
|
|
18
|
-
return systemPath.normalize(
|
|
17
|
+
function unnormalizePath(path8) {
|
|
18
|
+
return systemPath.normalize(path8);
|
|
19
19
|
}
|
|
20
20
|
var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
|
|
21
21
|
var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
|
|
@@ -754,7 +754,7 @@ async function writePathsDeclarationFile(entrypoints) {
|
|
|
754
754
|
wxt.config.outDir,
|
|
755
755
|
isHtmlEntrypoint(entry) ? ".html" : ".js"
|
|
756
756
|
)
|
|
757
|
-
).concat(await getPublicFiles()).map(normalizePath).map((
|
|
757
|
+
).concat(await getPublicFiles()).map(normalizePath).map((path8) => ` | "/${path8}"`).sort().join("\n");
|
|
758
758
|
const template = `// Generated by wxt
|
|
759
759
|
import "wxt/browser";
|
|
760
760
|
|
|
@@ -862,7 +862,7 @@ async function writeMainDeclarationFile(references) {
|
|
|
862
862
|
}
|
|
863
863
|
async function writeTsConfigFile(mainReference) {
|
|
864
864
|
const dir = wxt.config.wxtDir;
|
|
865
|
-
const getTsconfigPath = (
|
|
865
|
+
const getTsconfigPath = (path8) => normalizePath(relative3(dir, path8));
|
|
866
866
|
const paths = Object.entries(wxt.config.alias).flatMap(([alias, absolutePath]) => {
|
|
867
867
|
const aliasPath = getTsconfigPath(absolutePath);
|
|
868
868
|
return [
|
|
@@ -907,14 +907,14 @@ function createFsCache(wxtDir) {
|
|
|
907
907
|
const getPath = (key) => resolve5(wxtDir, "cache", encodeURIComponent(key));
|
|
908
908
|
return {
|
|
909
909
|
async set(key, value) {
|
|
910
|
-
const
|
|
911
|
-
await ensureDir(dirname2(
|
|
912
|
-
await writeFileIfDifferent(
|
|
910
|
+
const path8 = getPath(key);
|
|
911
|
+
await ensureDir(dirname2(path8));
|
|
912
|
+
await writeFileIfDifferent(path8, value);
|
|
913
913
|
},
|
|
914
914
|
async get(key) {
|
|
915
|
-
const
|
|
915
|
+
const path8 = getPath(key);
|
|
916
916
|
try {
|
|
917
|
-
return await fs5.readFile(
|
|
917
|
+
return await fs5.readFile(path8, "utf-8");
|
|
918
918
|
} catch {
|
|
919
919
|
return void 0;
|
|
920
920
|
}
|
|
@@ -1048,10 +1048,10 @@ function pointToDevServer(config, server, id, document, querySelector, attr) {
|
|
|
1048
1048
|
relative4(config.root, resolvedAbsolutePath)
|
|
1049
1049
|
);
|
|
1050
1050
|
if (relativePath.startsWith(".")) {
|
|
1051
|
-
let
|
|
1052
|
-
if (!
|
|
1053
|
-
|
|
1054
|
-
element.setAttribute(attr, `${server.origin}/@fs${
|
|
1051
|
+
let path8 = normalizePath(resolvedAbsolutePath);
|
|
1052
|
+
if (!path8.startsWith("/"))
|
|
1053
|
+
path8 = "/" + path8;
|
|
1054
|
+
element.setAttribute(attr, `${server.origin}/@fs${path8}`);
|
|
1055
1055
|
} else {
|
|
1056
1056
|
const url = new URL(relativePath, server.origin);
|
|
1057
1057
|
element.setAttribute(attr, url.href);
|
|
@@ -1984,16 +1984,16 @@ ${noImports}`;
|
|
|
1984
1984
|
// src/core/utils/building/import-entrypoint.ts
|
|
1985
1985
|
import { transformSync } from "esbuild";
|
|
1986
1986
|
import { fileURLToPath } from "node:url";
|
|
1987
|
-
async function importEntrypointFile(
|
|
1988
|
-
wxt.logger.debug("Loading file metadata:",
|
|
1989
|
-
const normalPath = normalizePath(
|
|
1987
|
+
async function importEntrypointFile(path8) {
|
|
1988
|
+
wxt.logger.debug("Loading file metadata:", path8);
|
|
1989
|
+
const normalPath = normalizePath(path8);
|
|
1990
1990
|
const unimport2 = createUnimport3({
|
|
1991
1991
|
...wxt.config.imports,
|
|
1992
1992
|
// Only allow specific imports, not all from the project
|
|
1993
1993
|
dirs: []
|
|
1994
1994
|
});
|
|
1995
1995
|
await unimport2.init();
|
|
1996
|
-
const text = await fs9.readFile(
|
|
1996
|
+
const text = await fs9.readFile(path8, "utf-8");
|
|
1997
1997
|
const textNoImports = removeProjectImportStatements(text);
|
|
1998
1998
|
const { code } = await unimport2.injectImports(textNoImports);
|
|
1999
1999
|
wxt.logger.debug(
|
|
@@ -2036,10 +2036,10 @@ async function importEntrypointFile(path9) {
|
|
|
2036
2036
|
}
|
|
2037
2037
|
);
|
|
2038
2038
|
try {
|
|
2039
|
-
const res = await jiti(
|
|
2039
|
+
const res = await jiti(path8);
|
|
2040
2040
|
return res.default;
|
|
2041
2041
|
} catch (err) {
|
|
2042
|
-
const filePath = relative5(wxt.config.root,
|
|
2042
|
+
const filePath = relative5(wxt.config.root, path8);
|
|
2043
2043
|
if (err instanceof ReferenceError) {
|
|
2044
2044
|
const variableName = err.message.replace(" is not defined", "");
|
|
2045
2045
|
throw Error(
|
|
@@ -2181,7 +2181,7 @@ function getChunkSortWeight(filename) {
|
|
|
2181
2181
|
import pc4 from "picocolors";
|
|
2182
2182
|
|
|
2183
2183
|
// package.json
|
|
2184
|
-
var version = "0.17.2-
|
|
2184
|
+
var version = "0.17.2-alpha4";
|
|
2185
2185
|
|
|
2186
2186
|
// src/core/utils/log/printHeader.ts
|
|
2187
2187
|
import { consola as consola2 } from "consola";
|
|
@@ -2858,29 +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 path6 from "node:path";
|
|
2864
|
-
import { exists } from "fs-extra";
|
|
2865
|
-
async function execaDependencyBin(name, args, options) {
|
|
2866
|
-
const possiblePaths = [
|
|
2867
|
-
// Standard location
|
|
2868
|
-
path6.resolve(`node_modules/.bin/${name}`),
|
|
2869
|
-
path6.resolve(wxt.config.root, `node_modules/.bin/${name}`),
|
|
2870
|
-
// PNPM non-hoisted paths
|
|
2871
|
-
path6.resolve(`node_modules/wxt/node_modules/.bin/${name}`),
|
|
2872
|
-
path6.resolve(wxt.config.root, `node_modules/wxt/node_modules/.bin/${name}`)
|
|
2873
|
-
];
|
|
2874
|
-
const location = (await Promise.all(
|
|
2875
|
-
possiblePaths.map((p) => ({ path: p, exists: exists(p) }))
|
|
2876
|
-
)).find((item) => item.exists);
|
|
2877
|
-
if (location == null)
|
|
2878
|
-
throw Error(`Could not locate "${name}" binary`);
|
|
2879
|
-
const { execa } = await import("./execa-Y2EWTC4S.js");
|
|
2880
|
-
execa(location.path, args, options);
|
|
2881
|
-
}
|
|
2882
|
-
|
|
2883
|
-
// src/core/utils/building/internal-build.ts
|
|
2884
2861
|
async function internalBuild() {
|
|
2885
2862
|
await wxt.hooks.callHook("build:before", wxt);
|
|
2886
2863
|
const verb = wxt.config.command === "serve" ? "Pre-rendering" : "Building";
|
|
@@ -2932,7 +2909,8 @@ async function combineAnalysisStats() {
|
|
|
2932
2909
|
absolute: true
|
|
2933
2910
|
});
|
|
2934
2911
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
2935
|
-
await
|
|
2912
|
+
const { execa } = await import("./execa-Y2EWTC4S.js");
|
|
2913
|
+
await execa(
|
|
2936
2914
|
"rollup-plugin-visualizer",
|
|
2937
2915
|
[
|
|
2938
2916
|
...absolutePaths,
|
|
@@ -2975,13 +2953,19 @@ function printValidationResults({
|
|
|
2975
2953
|
}
|
|
2976
2954
|
|
|
2977
2955
|
// src/core/build.ts
|
|
2956
|
+
import { ensureDependencyInstalled } from "nypm";
|
|
2978
2957
|
async function build(config) {
|
|
2979
2958
|
await registerWxt("build", config);
|
|
2959
|
+
if (wxt.config.analysis.enabled) {
|
|
2960
|
+
await ensureDependencyInstalled("rollup-plugin-visualizer", {
|
|
2961
|
+
dev: true
|
|
2962
|
+
});
|
|
2963
|
+
}
|
|
2980
2964
|
return await internalBuild();
|
|
2981
2965
|
}
|
|
2982
2966
|
|
|
2983
2967
|
// src/core/clean.ts
|
|
2984
|
-
import
|
|
2968
|
+
import path6 from "node:path";
|
|
2985
2969
|
import glob4 from "fast-glob";
|
|
2986
2970
|
import fs13 from "fs-extra";
|
|
2987
2971
|
import { consola as consola4 } from "consola";
|
|
@@ -2996,7 +2980,7 @@ async function clean(root = process.cwd()) {
|
|
|
2996
2980
|
];
|
|
2997
2981
|
consola4.debug("Looking for:", tempDirs.map(pc6.cyan).join(", "));
|
|
2998
2982
|
const directories = await glob4(tempDirs, {
|
|
2999
|
-
cwd:
|
|
2983
|
+
cwd: path6.resolve(root),
|
|
3000
2984
|
absolute: true,
|
|
3001
2985
|
onlyDirectories: true,
|
|
3002
2986
|
deep: 2
|
|
@@ -3007,11 +2991,11 @@ async function clean(root = process.cwd()) {
|
|
|
3007
2991
|
}
|
|
3008
2992
|
consola4.debug(
|
|
3009
2993
|
"Found:",
|
|
3010
|
-
directories.map((dir) => pc6.cyan(
|
|
2994
|
+
directories.map((dir) => pc6.cyan(path6.relative(root, dir))).join(", ")
|
|
3011
2995
|
);
|
|
3012
2996
|
for (const directory of directories) {
|
|
3013
2997
|
await fs13.rm(directory, { force: true, recursive: true });
|
|
3014
|
-
consola4.debug("Deleted " + pc6.cyan(
|
|
2998
|
+
consola4.debug("Deleted " + pc6.cyan(path6.relative(root, directory)));
|
|
3015
2999
|
}
|
|
3016
3000
|
}
|
|
3017
3001
|
|
|
@@ -3215,8 +3199,8 @@ async function createServer(inlineConfig) {
|
|
|
3215
3199
|
reloadContentScript(payload) {
|
|
3216
3200
|
server.ws.send("wxt:reload-content-script", payload);
|
|
3217
3201
|
},
|
|
3218
|
-
reloadPage(
|
|
3219
|
-
server.ws.send("wxt:reload-page",
|
|
3202
|
+
reloadPage(path8) {
|
|
3203
|
+
server.ws.send("wxt:reload-page", path8);
|
|
3220
3204
|
},
|
|
3221
3205
|
reloadExtension() {
|
|
3222
3206
|
server.ws.send("wxt:reload-extension");
|
|
@@ -3247,11 +3231,11 @@ async function getPort() {
|
|
|
3247
3231
|
function createFileReloader(server) {
|
|
3248
3232
|
const fileChangedMutex = new Mutex();
|
|
3249
3233
|
const changeQueue = [];
|
|
3250
|
-
return async (event,
|
|
3234
|
+
return async (event, path8) => {
|
|
3251
3235
|
await wxt.reloadConfig();
|
|
3252
|
-
if (
|
|
3236
|
+
if (path8.startsWith(wxt.config.outBaseDir))
|
|
3253
3237
|
return;
|
|
3254
|
-
changeQueue.push([event,
|
|
3238
|
+
changeQueue.push([event, path8]);
|
|
3255
3239
|
await fileChangedMutex.runExclusive(async () => {
|
|
3256
3240
|
if (server.currentOutput == null)
|
|
3257
3241
|
return;
|
|
@@ -3330,8 +3314,8 @@ function reloadContentScripts(steps, server) {
|
|
|
3330
3314
|
function reloadHtmlPages(groups, server) {
|
|
3331
3315
|
const htmlEntries = groups.flat().filter(isHtmlEntrypoint);
|
|
3332
3316
|
htmlEntries.forEach((entry) => {
|
|
3333
|
-
const
|
|
3334
|
-
server.reloadPage(
|
|
3317
|
+
const path8 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
|
|
3318
|
+
server.reloadPage(path8);
|
|
3335
3319
|
});
|
|
3336
3320
|
return {
|
|
3337
3321
|
reloadedNames: htmlEntries.map((entry) => entry.name)
|
|
@@ -3362,7 +3346,7 @@ import prompts from "prompts";
|
|
|
3362
3346
|
import { consola as consola6 } from "consola";
|
|
3363
3347
|
import { downloadTemplate } from "giget";
|
|
3364
3348
|
import fs14 from "fs-extra";
|
|
3365
|
-
import
|
|
3349
|
+
import path7 from "node:path";
|
|
3366
3350
|
import pc8 from "picocolors";
|
|
3367
3351
|
async function initialize(options) {
|
|
3368
3352
|
consola6.info("Initalizing new project");
|
|
@@ -3410,7 +3394,7 @@ async function initialize(options) {
|
|
|
3410
3394
|
input.template ??= defaultTemplate;
|
|
3411
3395
|
input.packageManager ??= options.packageManager;
|
|
3412
3396
|
await cloneProject(input);
|
|
3413
|
-
const cdPath =
|
|
3397
|
+
const cdPath = path7.relative(process.cwd(), path7.resolve(input.directory));
|
|
3414
3398
|
console.log();
|
|
3415
3399
|
consola6.log(
|
|
3416
3400
|
`\u2728 WXT project created with the ${TEMPLATE_COLORS[input.template.name]?.(input.template.name) ?? input.template.name} template.`
|
|
@@ -3454,8 +3438,8 @@ async function cloneProject({
|
|
|
3454
3438
|
force: true
|
|
3455
3439
|
});
|
|
3456
3440
|
await fs14.move(
|
|
3457
|
-
|
|
3458
|
-
|
|
3441
|
+
path7.join(directory, "_gitignore"),
|
|
3442
|
+
path7.join(directory, ".gitignore")
|
|
3459
3443
|
).catch(
|
|
3460
3444
|
(err) => consola6.warn("Failed to move _gitignore to .gitignore:", err)
|
|
3461
3445
|
);
|
|
@@ -3516,8 +3500,8 @@ async function zip(config) {
|
|
|
3516
3500
|
const sourcesZipPath = resolve13(wxt.config.outBaseDir, sourcesZipFilename);
|
|
3517
3501
|
await zipdir(wxt.config.zip.sourcesRoot, {
|
|
3518
3502
|
saveTo: sourcesZipPath,
|
|
3519
|
-
filter(
|
|
3520
|
-
const relativePath = relative11(wxt.config.zip.sourcesRoot,
|
|
3503
|
+
filter(path8) {
|
|
3504
|
+
const relativePath = relative11(wxt.config.zip.sourcesRoot, path8);
|
|
3521
3505
|
return wxt.config.zip.includeSources.some(
|
|
3522
3506
|
(pattern) => minimatch2(relativePath, pattern)
|
|
3523
3507
|
) || !wxt.config.zip.excludeSources.some(
|
|
@@ -3538,6 +3522,7 @@ async function zip(config) {
|
|
|
3538
3522
|
|
|
3539
3523
|
// src/cli/cli-utils.ts
|
|
3540
3524
|
import consola7, { LogLevels as LogLevels2 } from "consola";
|
|
3525
|
+
import { ensureDependencyInstalled as ensureDependencyInstalled2 } from "nypm";
|
|
3541
3526
|
function wrapAction(cb, options) {
|
|
3542
3527
|
return async (...args) => {
|
|
3543
3528
|
const isDebug = !!args.find((arg) => arg?.debug);
|
|
@@ -3570,14 +3555,16 @@ function getArrayFromFlags(flags, name) {
|
|
|
3570
3555
|
return result.length ? result : void 0;
|
|
3571
3556
|
}
|
|
3572
3557
|
var aliasCommandNames = /* @__PURE__ */ new Set();
|
|
3573
|
-
function createAliasedCommand(base, name, alias, docsUrl) {
|
|
3558
|
+
function createAliasedCommand(base, name, alias, packageName, docsUrl) {
|
|
3574
3559
|
const aliasedCommand = base.command(name, `Alias for ${alias} (${docsUrl})`).allowUnknownOptions().action(async () => {
|
|
3575
3560
|
try {
|
|
3561
|
+
await ensureDependencyInstalled2(packageName, { dev: true });
|
|
3576
3562
|
await registerWxt("build");
|
|
3577
3563
|
const args = process.argv.slice(
|
|
3578
3564
|
process.argv.indexOf(aliasedCommand.name) + 1
|
|
3579
3565
|
);
|
|
3580
|
-
await
|
|
3566
|
+
const { execa } = await import("./execa-Y2EWTC4S.js");
|
|
3567
|
+
await execa(alias, args, {
|
|
3581
3568
|
stdio: "inherit"
|
|
3582
3569
|
});
|
|
3583
3570
|
} catch {
|
|
@@ -3676,6 +3663,7 @@ createAliasedCommand(
|
|
|
3676
3663
|
cli,
|
|
3677
3664
|
"submit",
|
|
3678
3665
|
"publish-extension",
|
|
3666
|
+
"publish-browser-extension",
|
|
3679
3667
|
"https://www.npmjs.com/publish-browser-extension"
|
|
3680
3668
|
);
|
|
3681
3669
|
var commands_default = cli;
|
package/dist/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@ var require_windows = __commonJS({
|
|
|
40
40
|
module2.exports = isexe;
|
|
41
41
|
isexe.sync = sync;
|
|
42
42
|
var fs16 = require("fs");
|
|
43
|
-
function checkPathExt(
|
|
43
|
+
function checkPathExt(path11, options) {
|
|
44
44
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
45
45
|
if (!pathext) {
|
|
46
46
|
return true;
|
|
@@ -51,25 +51,25 @@ var require_windows = __commonJS({
|
|
|
51
51
|
}
|
|
52
52
|
for (var i = 0; i < pathext.length; i++) {
|
|
53
53
|
var p = pathext[i].toLowerCase();
|
|
54
|
-
if (p &&
|
|
54
|
+
if (p && path11.substr(-p.length).toLowerCase() === p) {
|
|
55
55
|
return true;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
60
|
-
function checkStat(stat,
|
|
60
|
+
function checkStat(stat, path11, options) {
|
|
61
61
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
|
-
return checkPathExt(
|
|
64
|
+
return checkPathExt(path11, options);
|
|
65
65
|
}
|
|
66
|
-
function isexe(
|
|
67
|
-
fs16.stat(
|
|
68
|
-
cb(er, er ? false : checkStat(stat,
|
|
66
|
+
function isexe(path11, options, cb) {
|
|
67
|
+
fs16.stat(path11, function(er, stat) {
|
|
68
|
+
cb(er, er ? false : checkStat(stat, path11, options));
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
function sync(
|
|
72
|
-
return checkStat(fs16.statSync(
|
|
71
|
+
function sync(path11, options) {
|
|
72
|
+
return checkStat(fs16.statSync(path11), path11, options);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
});
|
|
@@ -81,13 +81,13 @@ var require_mode = __commonJS({
|
|
|
81
81
|
module2.exports = isexe;
|
|
82
82
|
isexe.sync = sync;
|
|
83
83
|
var fs16 = require("fs");
|
|
84
|
-
function isexe(
|
|
85
|
-
fs16.stat(
|
|
84
|
+
function isexe(path11, options, cb) {
|
|
85
|
+
fs16.stat(path11, function(er, stat) {
|
|
86
86
|
cb(er, er ? false : checkStat(stat, options));
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
function sync(
|
|
90
|
-
return checkStat(fs16.statSync(
|
|
89
|
+
function sync(path11, options) {
|
|
90
|
+
return checkStat(fs16.statSync(path11), options);
|
|
91
91
|
}
|
|
92
92
|
function checkStat(stat, options) {
|
|
93
93
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -121,7 +121,7 @@ var require_isexe = __commonJS({
|
|
|
121
121
|
}
|
|
122
122
|
module2.exports = isexe;
|
|
123
123
|
isexe.sync = sync;
|
|
124
|
-
function isexe(
|
|
124
|
+
function isexe(path11, options, cb) {
|
|
125
125
|
if (typeof options === "function") {
|
|
126
126
|
cb = options;
|
|
127
127
|
options = {};
|
|
@@ -131,7 +131,7 @@ var require_isexe = __commonJS({
|
|
|
131
131
|
throw new TypeError("callback not provided");
|
|
132
132
|
}
|
|
133
133
|
return new Promise(function(resolve14, reject) {
|
|
134
|
-
isexe(
|
|
134
|
+
isexe(path11, options || {}, function(er, is) {
|
|
135
135
|
if (er) {
|
|
136
136
|
reject(er);
|
|
137
137
|
} else {
|
|
@@ -140,7 +140,7 @@ var require_isexe = __commonJS({
|
|
|
140
140
|
});
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
core(
|
|
143
|
+
core(path11, options || {}, function(er, is) {
|
|
144
144
|
if (er) {
|
|
145
145
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
146
146
|
er = null;
|
|
@@ -150,9 +150,9 @@ var require_isexe = __commonJS({
|
|
|
150
150
|
cb(er, is);
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
function sync(
|
|
153
|
+
function sync(path11, options) {
|
|
154
154
|
try {
|
|
155
|
-
return core.sync(
|
|
155
|
+
return core.sync(path11, options || {});
|
|
156
156
|
} catch (er) {
|
|
157
157
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
158
158
|
return false;
|
|
@@ -169,7 +169,7 @@ var require_which = __commonJS({
|
|
|
169
169
|
"node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
|
|
170
170
|
"use strict";
|
|
171
171
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
172
|
-
var
|
|
172
|
+
var path11 = require("path");
|
|
173
173
|
var COLON = isWindows ? ";" : ":";
|
|
174
174
|
var isexe = require_isexe();
|
|
175
175
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -207,7 +207,7 @@ var require_which = __commonJS({
|
|
|
207
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
|
-
const pCmd =
|
|
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
|
});
|
|
@@ -234,7 +234,7 @@ var require_which = __commonJS({
|
|
|
234
234
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
235
235
|
const ppRaw = pathEnv[i];
|
|
236
236
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
237
|
-
const pCmd =
|
|
237
|
+
const pCmd = path11.join(pathPart, cmd);
|
|
238
238
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
239
239
|
for (let j = 0; j < pathExt.length; j++) {
|
|
240
240
|
const cur = p + pathExt[j];
|
|
@@ -282,7 +282,7 @@ var require_path_key = __commonJS({
|
|
|
282
282
|
var require_resolveCommand = __commonJS({
|
|
283
283
|
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
|
|
284
284
|
"use strict";
|
|
285
|
-
var
|
|
285
|
+
var path11 = require("path");
|
|
286
286
|
var which = require_which();
|
|
287
287
|
var getPathKey = require_path_key();
|
|
288
288
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -300,7 +300,7 @@ var require_resolveCommand = __commonJS({
|
|
|
300
300
|
try {
|
|
301
301
|
resolved = which.sync(parsed.command, {
|
|
302
302
|
path: env[getPathKey({ env })],
|
|
303
|
-
pathExt: withoutPathExt ?
|
|
303
|
+
pathExt: withoutPathExt ? path11.delimiter : void 0
|
|
304
304
|
});
|
|
305
305
|
} catch (e) {
|
|
306
306
|
} finally {
|
|
@@ -309,7 +309,7 @@ var require_resolveCommand = __commonJS({
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
if (resolved) {
|
|
312
|
-
resolved =
|
|
312
|
+
resolved = path11.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
313
313
|
}
|
|
314
314
|
return resolved;
|
|
315
315
|
}
|
|
@@ -363,8 +363,8 @@ var require_shebang_command = __commonJS({
|
|
|
363
363
|
if (!match) {
|
|
364
364
|
return null;
|
|
365
365
|
}
|
|
366
|
-
const [
|
|
367
|
-
const binary =
|
|
366
|
+
const [path11, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
367
|
+
const binary = path11.split("/").pop();
|
|
368
368
|
if (binary === "env") {
|
|
369
369
|
return argument;
|
|
370
370
|
}
|
|
@@ -399,7 +399,7 @@ var require_readShebang = __commonJS({
|
|
|
399
399
|
var require_parse = __commonJS({
|
|
400
400
|
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
|
|
401
401
|
"use strict";
|
|
402
|
-
var
|
|
402
|
+
var path11 = require("path");
|
|
403
403
|
var resolveCommand = require_resolveCommand();
|
|
404
404
|
var escape = require_escape();
|
|
405
405
|
var readShebang = require_readShebang();
|
|
@@ -424,7 +424,7 @@ var require_parse = __commonJS({
|
|
|
424
424
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
425
425
|
if (parsed.options.forceShell || needsShell) {
|
|
426
426
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
427
|
-
parsed.command =
|
|
427
|
+
parsed.command = path11.normalize(parsed.command);
|
|
428
428
|
parsed.command = escape.command(parsed.command);
|
|
429
429
|
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
430
430
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -590,9 +590,9 @@ function npmRunPath(options = {}) {
|
|
|
590
590
|
}
|
|
591
591
|
function npmRunPathEnv({ env = import_node_process.default.env, ...options } = {}) {
|
|
592
592
|
env = { ...env };
|
|
593
|
-
const
|
|
594
|
-
options.path = env[
|
|
595
|
-
env[
|
|
593
|
+
const path11 = pathKey({ env });
|
|
594
|
+
options.path = env[path11];
|
|
595
|
+
env[path11] = npmRunPath(options);
|
|
596
596
|
return env;
|
|
597
597
|
}
|
|
598
598
|
var import_node_process, import_node_path12, import_node_url2;
|
|
@@ -2434,11 +2434,11 @@ var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
|
2434
2434
|
// src/core/utils/paths.ts
|
|
2435
2435
|
var import_node_path = __toESM(require("path"), 1);
|
|
2436
2436
|
var import_normalize_path = __toESM(require("normalize-path"), 1);
|
|
2437
|
-
function normalizePath(
|
|
2438
|
-
return (0, import_normalize_path.default)(
|
|
2437
|
+
function normalizePath(path11) {
|
|
2438
|
+
return (0, import_normalize_path.default)(path11);
|
|
2439
2439
|
}
|
|
2440
|
-
function unnormalizePath(
|
|
2441
|
-
return import_node_path.default.normalize(
|
|
2440
|
+
function unnormalizePath(path11) {
|
|
2441
|
+
return import_node_path.default.normalize(path11);
|
|
2442
2442
|
}
|
|
2443
2443
|
var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
|
|
2444
2444
|
var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
|
|
@@ -3177,7 +3177,7 @@ async function writePathsDeclarationFile(entrypoints) {
|
|
|
3177
3177
|
wxt.config.outDir,
|
|
3178
3178
|
isHtmlEntrypoint(entry) ? ".html" : ".js"
|
|
3179
3179
|
)
|
|
3180
|
-
).concat(await getPublicFiles()).map(normalizePath).map((
|
|
3180
|
+
).concat(await getPublicFiles()).map(normalizePath).map((path11) => ` | "/${path11}"`).sort().join("\n");
|
|
3181
3181
|
const template = `// Generated by wxt
|
|
3182
3182
|
import "wxt/browser";
|
|
3183
3183
|
|
|
@@ -3285,7 +3285,7 @@ async function writeMainDeclarationFile(references) {
|
|
|
3285
3285
|
}
|
|
3286
3286
|
async function writeTsConfigFile(mainReference) {
|
|
3287
3287
|
const dir = wxt.config.wxtDir;
|
|
3288
|
-
const getTsconfigPath = (
|
|
3288
|
+
const getTsconfigPath = (path11) => normalizePath((0, import_path3.relative)(dir, path11));
|
|
3289
3289
|
const paths = Object.entries(wxt.config.alias).flatMap(([alias, absolutePath]) => {
|
|
3290
3290
|
const aliasPath = getTsconfigPath(absolutePath);
|
|
3291
3291
|
return [
|
|
@@ -3330,14 +3330,14 @@ function createFsCache(wxtDir) {
|
|
|
3330
3330
|
const getPath = (key) => (0, import_path4.resolve)(wxtDir, "cache", encodeURIComponent(key));
|
|
3331
3331
|
return {
|
|
3332
3332
|
async set(key, value) {
|
|
3333
|
-
const
|
|
3334
|
-
await (0, import_fs_extra5.ensureDir)((0, import_path4.dirname)(
|
|
3335
|
-
await writeFileIfDifferent(
|
|
3333
|
+
const path11 = getPath(key);
|
|
3334
|
+
await (0, import_fs_extra5.ensureDir)((0, import_path4.dirname)(path11));
|
|
3335
|
+
await writeFileIfDifferent(path11, value);
|
|
3336
3336
|
},
|
|
3337
3337
|
async get(key) {
|
|
3338
|
-
const
|
|
3338
|
+
const path11 = getPath(key);
|
|
3339
3339
|
try {
|
|
3340
|
-
return await import_fs_extra5.default.readFile(
|
|
3340
|
+
return await import_fs_extra5.default.readFile(path11, "utf-8");
|
|
3341
3341
|
} catch {
|
|
3342
3342
|
return void 0;
|
|
3343
3343
|
}
|
|
@@ -3471,10 +3471,10 @@ function pointToDevServer(config, server, id, document, querySelector, attr) {
|
|
|
3471
3471
|
(0, import_node_path4.relative)(config.root, resolvedAbsolutePath)
|
|
3472
3472
|
);
|
|
3473
3473
|
if (relativePath.startsWith(".")) {
|
|
3474
|
-
let
|
|
3475
|
-
if (!
|
|
3476
|
-
|
|
3477
|
-
element.setAttribute(attr, `${server.origin}/@fs${
|
|
3474
|
+
let path11 = normalizePath(resolvedAbsolutePath);
|
|
3475
|
+
if (!path11.startsWith("/"))
|
|
3476
|
+
path11 = "/" + path11;
|
|
3477
|
+
element.setAttribute(attr, `${server.origin}/@fs${path11}`);
|
|
3478
3478
|
} else {
|
|
3479
3479
|
const url2 = new URL(relativePath, server.origin);
|
|
3480
3480
|
element.setAttribute(attr, url2.href);
|
|
@@ -4411,16 +4411,16 @@ ${noImports}`;
|
|
|
4411
4411
|
var import_esbuild = require("esbuild");
|
|
4412
4412
|
var import_node_url = require("url");
|
|
4413
4413
|
var import_meta = {};
|
|
4414
|
-
async function importEntrypointFile(
|
|
4415
|
-
wxt.logger.debug("Loading file metadata:",
|
|
4416
|
-
const normalPath = normalizePath(
|
|
4414
|
+
async function importEntrypointFile(path11) {
|
|
4415
|
+
wxt.logger.debug("Loading file metadata:", path11);
|
|
4416
|
+
const normalPath = normalizePath(path11);
|
|
4417
4417
|
const unimport2 = (0, import_unimport3.createUnimport)({
|
|
4418
4418
|
...wxt.config.imports,
|
|
4419
4419
|
// Only allow specific imports, not all from the project
|
|
4420
4420
|
dirs: []
|
|
4421
4421
|
});
|
|
4422
4422
|
await unimport2.init();
|
|
4423
|
-
const text = await import_fs_extra9.default.readFile(
|
|
4423
|
+
const text = await import_fs_extra9.default.readFile(path11, "utf-8");
|
|
4424
4424
|
const textNoImports = removeProjectImportStatements(text);
|
|
4425
4425
|
const { code } = await unimport2.injectImports(textNoImports);
|
|
4426
4426
|
wxt.logger.debug(
|
|
@@ -4463,10 +4463,10 @@ async function importEntrypointFile(path12) {
|
|
|
4463
4463
|
}
|
|
4464
4464
|
);
|
|
4465
4465
|
try {
|
|
4466
|
-
const res = await jiti(
|
|
4466
|
+
const res = await jiti(path11);
|
|
4467
4467
|
return res.default;
|
|
4468
4468
|
} catch (err) {
|
|
4469
|
-
const filePath = (0, import_node_path10.relative)(wxt.config.root,
|
|
4469
|
+
const filePath = (0, import_node_path10.relative)(wxt.config.root, path11);
|
|
4470
4470
|
if (err instanceof ReferenceError) {
|
|
4471
4471
|
const variableName = err.message.replace(" is not defined", "");
|
|
4472
4472
|
throw Error(
|
|
@@ -4495,7 +4495,7 @@ function getEsbuildOptions(opts) {
|
|
|
4495
4495
|
|
|
4496
4496
|
// src/core/utils/building/internal-build.ts
|
|
4497
4497
|
var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
4498
|
-
var
|
|
4498
|
+
var import_fs_extra12 = __toESM(require("fs-extra"), 1);
|
|
4499
4499
|
|
|
4500
4500
|
// src/core/utils/log/printBuildSummary.ts
|
|
4501
4501
|
var import_path7 = require("path");
|
|
@@ -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.2-
|
|
4611
|
+
var version = "0.17.2-alpha4";
|
|
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,29 +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_node_path14 = __toESM(require("path"), 1);
|
|
5287
|
-
var import_fs_extra12 = require("fs-extra");
|
|
5288
|
-
async function execaDependencyBin(name, args, options) {
|
|
5289
|
-
const possiblePaths = [
|
|
5290
|
-
// Standard location
|
|
5291
|
-
import_node_path14.default.resolve(`node_modules/.bin/${name}`),
|
|
5292
|
-
import_node_path14.default.resolve(wxt.config.root, `node_modules/.bin/${name}`),
|
|
5293
|
-
// PNPM non-hoisted paths
|
|
5294
|
-
import_node_path14.default.resolve(`node_modules/wxt/node_modules/.bin/${name}`),
|
|
5295
|
-
import_node_path14.default.resolve(wxt.config.root, `node_modules/wxt/node_modules/.bin/${name}`)
|
|
5296
|
-
];
|
|
5297
|
-
const location = (await Promise.all(
|
|
5298
|
-
possiblePaths.map((p) => ({ path: p, exists: (0, import_fs_extra12.exists)(p) }))
|
|
5299
|
-
)).find((item) => item.exists);
|
|
5300
|
-
if (location == null)
|
|
5301
|
-
throw Error(`Could not locate "${name}" binary`);
|
|
5302
|
-
const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
|
|
5303
|
-
execa2(location.path, args, options);
|
|
5304
|
-
}
|
|
5305
|
-
|
|
5306
|
-
// src/core/utils/building/internal-build.ts
|
|
5307
5284
|
async function internalBuild() {
|
|
5308
5285
|
await wxt.hooks.callHook("build:before", wxt);
|
|
5309
5286
|
const verb = wxt.config.command === "serve" ? "Pre-rendering" : "Building";
|
|
@@ -5314,8 +5291,8 @@ async function internalBuild() {
|
|
|
5314
5291
|
)}`
|
|
5315
5292
|
);
|
|
5316
5293
|
const startTime = Date.now();
|
|
5317
|
-
await
|
|
5318
|
-
await
|
|
5294
|
+
await import_fs_extra12.default.rm(wxt.config.outDir, { recursive: true, force: true });
|
|
5295
|
+
await import_fs_extra12.default.ensureDir(wxt.config.outDir);
|
|
5319
5296
|
const entrypoints = await findEntrypoints();
|
|
5320
5297
|
wxt.logger.debug("Detected entrypoints:", entrypoints);
|
|
5321
5298
|
const validationResults = validateEntrypoints(entrypoints);
|
|
@@ -5341,7 +5318,7 @@ async function internalBuild() {
|
|
|
5341
5318
|
}
|
|
5342
5319
|
if (wxt.config.analysis.enabled) {
|
|
5343
5320
|
await combineAnalysisStats();
|
|
5344
|
-
const statsPath = (0,
|
|
5321
|
+
const statsPath = (0, import_node_path14.relative)(wxt.config.root, wxt.config.analysis.outputFile);
|
|
5345
5322
|
wxt.logger.info(
|
|
5346
5323
|
`Analysis complete:
|
|
5347
5324
|
${import_picocolors5.default.gray("\u2514\u2500")} ${import_picocolors5.default.yellow(statsPath)}`
|
|
@@ -5355,7 +5332,8 @@ async function combineAnalysisStats() {
|
|
|
5355
5332
|
absolute: true
|
|
5356
5333
|
});
|
|
5357
5334
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
5358
|
-
await
|
|
5335
|
+
const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
|
|
5336
|
+
await execa2(
|
|
5359
5337
|
"rollup-plugin-visualizer",
|
|
5360
5338
|
[
|
|
5361
5339
|
...absolutePaths,
|
|
@@ -5367,7 +5345,7 @@ async function combineAnalysisStats() {
|
|
|
5367
5345
|
{ cwd: wxt.config.root, stdio: "inherit" }
|
|
5368
5346
|
);
|
|
5369
5347
|
if (!wxt.config.analysis.keepArtifacts) {
|
|
5370
|
-
await Promise.all(absolutePaths.map((statsFile) =>
|
|
5348
|
+
await Promise.all(absolutePaths.map((statsFile) => import_fs_extra12.default.remove(statsFile)));
|
|
5371
5349
|
}
|
|
5372
5350
|
}
|
|
5373
5351
|
function printValidationResults({
|
|
@@ -5386,7 +5364,7 @@ function printValidationResults({
|
|
|
5386
5364
|
return map;
|
|
5387
5365
|
}, /* @__PURE__ */ new Map());
|
|
5388
5366
|
Array.from(entrypointErrors.entries()).forEach(([entrypoint, errors2]) => {
|
|
5389
|
-
import_consola3.default.log((0,
|
|
5367
|
+
import_consola3.default.log((0, import_node_path14.relative)(cwd, entrypoint.inputPath));
|
|
5390
5368
|
console.log();
|
|
5391
5369
|
errors2.forEach((err) => {
|
|
5392
5370
|
const type = err.type === "error" ? import_picocolors5.default.red("ERROR") : import_picocolors5.default.yellow("WARN");
|
|
@@ -5398,15 +5376,21 @@ function printValidationResults({
|
|
|
5398
5376
|
}
|
|
5399
5377
|
|
|
5400
5378
|
// src/core/build.ts
|
|
5379
|
+
var import_nypm = require("nypm");
|
|
5401
5380
|
async function build(config) {
|
|
5402
5381
|
await registerWxt("build", config);
|
|
5382
|
+
if (wxt.config.analysis.enabled) {
|
|
5383
|
+
await (0, import_nypm.ensureDependencyInstalled)("rollup-plugin-visualizer", {
|
|
5384
|
+
dev: true
|
|
5385
|
+
});
|
|
5386
|
+
}
|
|
5403
5387
|
return await internalBuild();
|
|
5404
5388
|
}
|
|
5405
5389
|
|
|
5406
5390
|
// src/core/clean.ts
|
|
5407
|
-
var
|
|
5391
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
5408
5392
|
var import_fast_glob4 = __toESM(require("fast-glob"), 1);
|
|
5409
|
-
var
|
|
5393
|
+
var import_fs_extra13 = __toESM(require("fs-extra"), 1);
|
|
5410
5394
|
var import_consola4 = require("consola");
|
|
5411
5395
|
var import_picocolors6 = __toESM(require("picocolors"), 1);
|
|
5412
5396
|
async function clean(root = process.cwd()) {
|
|
@@ -5419,7 +5403,7 @@ async function clean(root = process.cwd()) {
|
|
|
5419
5403
|
];
|
|
5420
5404
|
import_consola4.consola.debug("Looking for:", tempDirs.map(import_picocolors6.default.cyan).join(", "));
|
|
5421
5405
|
const directories = await (0, import_fast_glob4.default)(tempDirs, {
|
|
5422
|
-
cwd:
|
|
5406
|
+
cwd: import_node_path15.default.resolve(root),
|
|
5423
5407
|
absolute: true,
|
|
5424
5408
|
onlyDirectories: true,
|
|
5425
5409
|
deep: 2
|
|
@@ -5430,11 +5414,11 @@ async function clean(root = process.cwd()) {
|
|
|
5430
5414
|
}
|
|
5431
5415
|
import_consola4.consola.debug(
|
|
5432
5416
|
"Found:",
|
|
5433
|
-
directories.map((dir) => import_picocolors6.default.cyan(
|
|
5417
|
+
directories.map((dir) => import_picocolors6.default.cyan(import_node_path15.default.relative(root, dir))).join(", ")
|
|
5434
5418
|
);
|
|
5435
5419
|
for (const directory of directories) {
|
|
5436
|
-
await
|
|
5437
|
-
import_consola4.consola.debug("Deleted " + import_picocolors6.default.cyan(
|
|
5420
|
+
await import_fs_extra13.default.rm(directory, { force: true, recursive: true });
|
|
5421
|
+
import_consola4.consola.debug("Deleted " + import_picocolors6.default.cyan(import_node_path15.default.relative(root, directory)));
|
|
5438
5422
|
}
|
|
5439
5423
|
}
|
|
5440
5424
|
|
|
@@ -5449,12 +5433,12 @@ function defineRunnerConfig(config) {
|
|
|
5449
5433
|
}
|
|
5450
5434
|
|
|
5451
5435
|
// src/core/runners/wsl.ts
|
|
5452
|
-
var
|
|
5436
|
+
var import_node_path16 = require("path");
|
|
5453
5437
|
function createWslRunner() {
|
|
5454
5438
|
return {
|
|
5455
5439
|
async openBrowser() {
|
|
5456
5440
|
wxt.logger.warn(
|
|
5457
|
-
`Cannot open browser when using WSL. Load "${(0,
|
|
5441
|
+
`Cannot open browser when using WSL. Load "${(0, import_node_path16.relative)(
|
|
5458
5442
|
process.cwd(),
|
|
5459
5443
|
wxt.config.outDir
|
|
5460
5444
|
)}" as an unpacked extension manually`
|
|
@@ -5542,12 +5526,12 @@ var DEFAULT_CHROMIUM_PREFS = {
|
|
|
5542
5526
|
};
|
|
5543
5527
|
|
|
5544
5528
|
// src/core/runners/safari.ts
|
|
5545
|
-
var
|
|
5529
|
+
var import_node_path17 = require("path");
|
|
5546
5530
|
function createSafariRunner() {
|
|
5547
5531
|
return {
|
|
5548
5532
|
async openBrowser() {
|
|
5549
5533
|
wxt.logger.warn(
|
|
5550
|
-
`Cannot Safari using web-ext. Load "${(0,
|
|
5534
|
+
`Cannot Safari using web-ext. Load "${(0, import_node_path17.relative)(
|
|
5551
5535
|
process.cwd(),
|
|
5552
5536
|
wxt.config.outDir
|
|
5553
5537
|
)}" as an unpacked extension manually`
|
|
@@ -5559,12 +5543,12 @@ function createSafariRunner() {
|
|
|
5559
5543
|
}
|
|
5560
5544
|
|
|
5561
5545
|
// src/core/runners/manual.ts
|
|
5562
|
-
var
|
|
5546
|
+
var import_node_path18 = require("path");
|
|
5563
5547
|
function createManualRunner() {
|
|
5564
5548
|
return {
|
|
5565
5549
|
async openBrowser() {
|
|
5566
5550
|
wxt.logger.info(
|
|
5567
|
-
`Load "${(0,
|
|
5551
|
+
`Load "${(0, import_node_path18.relative)(
|
|
5568
5552
|
process.cwd(),
|
|
5569
5553
|
wxt.config.outDir
|
|
5570
5554
|
)}" as an unpacked extension manually`
|
|
@@ -5596,7 +5580,7 @@ async function createExtensionRunner() {
|
|
|
5596
5580
|
var import_consola5 = require("consola");
|
|
5597
5581
|
var import_async_mutex = require("async-mutex");
|
|
5598
5582
|
var import_picocolors7 = __toESM(require("picocolors"), 1);
|
|
5599
|
-
var
|
|
5583
|
+
var import_node_path19 = require("path");
|
|
5600
5584
|
async function createServer(inlineConfig) {
|
|
5601
5585
|
const port = await getPort();
|
|
5602
5586
|
const hostname = "localhost";
|
|
@@ -5648,8 +5632,8 @@ async function createServer(inlineConfig) {
|
|
|
5648
5632
|
reloadContentScript(payload) {
|
|
5649
5633
|
server.ws.send("wxt:reload-content-script", payload);
|
|
5650
5634
|
},
|
|
5651
|
-
reloadPage(
|
|
5652
|
-
server.ws.send("wxt:reload-page",
|
|
5635
|
+
reloadPage(path11) {
|
|
5636
|
+
server.ws.send("wxt:reload-page", path11);
|
|
5653
5637
|
},
|
|
5654
5638
|
reloadExtension() {
|
|
5655
5639
|
server.ws.send("wxt:reload-extension");
|
|
@@ -5680,11 +5664,11 @@ async function getPort() {
|
|
|
5680
5664
|
function createFileReloader(server) {
|
|
5681
5665
|
const fileChangedMutex = new import_async_mutex.Mutex();
|
|
5682
5666
|
const changeQueue = [];
|
|
5683
|
-
return async (event,
|
|
5667
|
+
return async (event, path11) => {
|
|
5684
5668
|
await wxt.reloadConfig();
|
|
5685
|
-
if (
|
|
5669
|
+
if (path11.startsWith(wxt.config.outBaseDir))
|
|
5686
5670
|
return;
|
|
5687
|
-
changeQueue.push([event,
|
|
5671
|
+
changeQueue.push([event, path11]);
|
|
5688
5672
|
await fileChangedMutex.runExclusive(async () => {
|
|
5689
5673
|
if (server.currentOutput == null)
|
|
5690
5674
|
return;
|
|
@@ -5705,7 +5689,7 @@ function createFileReloader(server) {
|
|
|
5705
5689
|
return;
|
|
5706
5690
|
}
|
|
5707
5691
|
wxt.logger.info(
|
|
5708
|
-
`Changed: ${Array.from(new Set(fileChanges)).map((file) => import_picocolors7.default.dim((0,
|
|
5692
|
+
`Changed: ${Array.from(new Set(fileChanges)).map((file) => import_picocolors7.default.dim((0, import_node_path19.relative)(wxt.config.root, file))).join(", ")}`
|
|
5709
5693
|
);
|
|
5710
5694
|
const allEntrypoints = await findEntrypoints();
|
|
5711
5695
|
const { output: newOutput } = await rebuild(
|
|
@@ -5763,8 +5747,8 @@ function reloadContentScripts(steps, server) {
|
|
|
5763
5747
|
function reloadHtmlPages(groups, server) {
|
|
5764
5748
|
const htmlEntries = groups.flat().filter(isHtmlEntrypoint);
|
|
5765
5749
|
htmlEntries.forEach((entry) => {
|
|
5766
|
-
const
|
|
5767
|
-
server.reloadPage(
|
|
5750
|
+
const path11 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
|
|
5751
|
+
server.reloadPage(path11);
|
|
5768
5752
|
});
|
|
5769
5753
|
return {
|
|
5770
5754
|
reloadedNames: htmlEntries.map((entry) => entry.name)
|
|
@@ -5794,8 +5778,8 @@ function getExternalOutputDependencies(server) {
|
|
|
5794
5778
|
var import_prompts = __toESM(require("prompts"), 1);
|
|
5795
5779
|
var import_consola6 = require("consola");
|
|
5796
5780
|
var import_giget = require("giget");
|
|
5797
|
-
var
|
|
5798
|
-
var
|
|
5781
|
+
var import_fs_extra14 = __toESM(require("fs-extra"), 1);
|
|
5782
|
+
var import_node_path20 = __toESM(require("path"), 1);
|
|
5799
5783
|
var import_picocolors8 = __toESM(require("picocolors"), 1);
|
|
5800
5784
|
async function initialize(options) {
|
|
5801
5785
|
import_consola6.consola.info("Initalizing new project");
|
|
@@ -5843,7 +5827,7 @@ async function initialize(options) {
|
|
|
5843
5827
|
input.template ??= defaultTemplate;
|
|
5844
5828
|
input.packageManager ??= options.packageManager;
|
|
5845
5829
|
await cloneProject(input);
|
|
5846
|
-
const cdPath =
|
|
5830
|
+
const cdPath = import_node_path20.default.relative(process.cwd(), import_node_path20.default.resolve(input.directory));
|
|
5847
5831
|
console.log();
|
|
5848
5832
|
import_consola6.consola.log(
|
|
5849
5833
|
`\u2728 WXT project created with the ${TEMPLATE_COLORS[input.template.name]?.(input.template.name) ?? input.template.name} template.`
|
|
@@ -5886,9 +5870,9 @@ async function cloneProject({
|
|
|
5886
5870
|
dir: directory,
|
|
5887
5871
|
force: true
|
|
5888
5872
|
});
|
|
5889
|
-
await
|
|
5890
|
-
|
|
5891
|
-
|
|
5873
|
+
await import_fs_extra14.default.move(
|
|
5874
|
+
import_node_path20.default.join(directory, "_gitignore"),
|
|
5875
|
+
import_node_path20.default.join(directory, ".gitignore")
|
|
5892
5876
|
).catch(
|
|
5893
5877
|
(err) => import_consola6.consola.warn("Failed to move _gitignore to .gitignore:", err)
|
|
5894
5878
|
);
|
|
@@ -5921,8 +5905,8 @@ async function prepare(config) {
|
|
|
5921
5905
|
|
|
5922
5906
|
// src/core/zip.ts
|
|
5923
5907
|
var import_zip_dir = __toESM(require("zip-dir"), 1);
|
|
5924
|
-
var
|
|
5925
|
-
var
|
|
5908
|
+
var import_node_path21 = require("path");
|
|
5909
|
+
var import_fs_extra15 = __toESM(require("fs-extra"), 1);
|
|
5926
5910
|
var import_minimatch2 = require("minimatch");
|
|
5927
5911
|
async function zip(config) {
|
|
5928
5912
|
await registerWxt("build", config);
|
|
@@ -5931,26 +5915,26 @@ async function zip(config) {
|
|
|
5931
5915
|
wxt.logger.info("Zipping extension...");
|
|
5932
5916
|
const zipFiles = [];
|
|
5933
5917
|
const projectName = wxt.config.zip.name ?? kebabCaseAlphanumeric(
|
|
5934
|
-
(await getPackageJson())?.name || (0,
|
|
5918
|
+
(await getPackageJson())?.name || (0, import_node_path21.dirname)(process.cwd())
|
|
5935
5919
|
);
|
|
5936
5920
|
const applyTemplate = (template) => template.replaceAll("{{name}}", projectName).replaceAll("{{browser}}", wxt.config.browser).replaceAll(
|
|
5937
5921
|
"{{version}}",
|
|
5938
5922
|
output.manifest.version_name ?? output.manifest.version
|
|
5939
5923
|
).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
5940
|
-
await
|
|
5924
|
+
await import_fs_extra15.default.ensureDir(wxt.config.outBaseDir);
|
|
5941
5925
|
const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
|
|
5942
|
-
const outZipPath = (0,
|
|
5926
|
+
const outZipPath = (0, import_node_path21.resolve)(wxt.config.outBaseDir, outZipFilename);
|
|
5943
5927
|
await (0, import_zip_dir.default)(wxt.config.outDir, {
|
|
5944
5928
|
saveTo: outZipPath
|
|
5945
5929
|
});
|
|
5946
5930
|
zipFiles.push(outZipPath);
|
|
5947
5931
|
if (wxt.config.browser === "firefox") {
|
|
5948
5932
|
const sourcesZipFilename = applyTemplate(wxt.config.zip.sourcesTemplate);
|
|
5949
|
-
const sourcesZipPath = (0,
|
|
5933
|
+
const sourcesZipPath = (0, import_node_path21.resolve)(wxt.config.outBaseDir, sourcesZipFilename);
|
|
5950
5934
|
await (0, import_zip_dir.default)(wxt.config.zip.sourcesRoot, {
|
|
5951
5935
|
saveTo: sourcesZipPath,
|
|
5952
|
-
filter(
|
|
5953
|
-
const relativePath = (0,
|
|
5936
|
+
filter(path11) {
|
|
5937
|
+
const relativePath = (0, import_node_path21.relative)(wxt.config.zip.sourcesRoot, path11);
|
|
5954
5938
|
return wxt.config.zip.includeSources.some(
|
|
5955
5939
|
(pattern) => (0, import_minimatch2.minimatch)(relativePath, pattern)
|
|
5956
5940
|
) || !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.2-
|
|
67
|
+
var version = "0.17.2-alpha4";
|
|
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.2-
|
|
67
|
+
var version = "0.17.2-alpha4";
|
|
68
68
|
|
|
69
69
|
export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
|
package/dist/index.js
CHANGED
|
@@ -17,12 +17,18 @@ import {
|
|
|
17
17
|
unnormalizePath,
|
|
18
18
|
version,
|
|
19
19
|
wxt
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-C57BR3TX.js";
|
|
21
21
|
import "./chunk-VBXJIVYU.js";
|
|
22
22
|
|
|
23
23
|
// src/core/build.ts
|
|
24
|
+
import { ensureDependencyInstalled } from "nypm";
|
|
24
25
|
async function build(config) {
|
|
25
26
|
await registerWxt("build", config);
|
|
27
|
+
if (wxt.config.analysis.enabled) {
|
|
28
|
+
await ensureDependencyInstalled("rollup-plugin-visualizer", {
|
|
29
|
+
dev: true
|
|
30
|
+
});
|
|
31
|
+
}
|
|
26
32
|
return await internalBuild();
|
|
27
33
|
}
|
|
28
34
|
|
package/dist/testing.cjs
CHANGED
|
@@ -44,8 +44,8 @@ var import_node_path2 = __toESM(require("path"), 1);
|
|
|
44
44
|
// src/core/utils/paths.ts
|
|
45
45
|
var import_node_path = __toESM(require("path"), 1);
|
|
46
46
|
var import_normalize_path = __toESM(require("normalize-path"), 1);
|
|
47
|
-
function normalizePath(
|
|
48
|
-
return (0, import_normalize_path.default)(
|
|
47
|
+
function normalizePath(path7) {
|
|
48
|
+
return (0, import_normalize_path.default)(path7);
|
|
49
49
|
}
|
|
50
50
|
var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
|
|
51
51
|
var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
|
|
@@ -191,10 +191,10 @@ function pointToDevServer(config, server, id, document, querySelector, attr) {
|
|
|
191
191
|
(0, import_node_path3.relative)(config.root, resolvedAbsolutePath)
|
|
192
192
|
);
|
|
193
193
|
if (relativePath.startsWith(".")) {
|
|
194
|
-
let
|
|
195
|
-
if (!
|
|
196
|
-
|
|
197
|
-
element.setAttribute(attr, `${server.origin}/@fs${
|
|
194
|
+
let path7 = normalizePath(resolvedAbsolutePath);
|
|
195
|
+
if (!path7.startsWith("/"))
|
|
196
|
+
path7 = "/" + path7;
|
|
197
|
+
element.setAttribute(attr, `${server.origin}/@fs${path7}`);
|
|
198
198
|
} else {
|
|
199
199
|
const url = new URL(relativePath, server.origin);
|
|
200
200
|
element.setAttribute(attr, url.href);
|
|
@@ -731,14 +731,14 @@ function createFsCache(wxtDir) {
|
|
|
731
731
|
const getPath = (key) => (0, import_path3.resolve)(wxtDir, "cache", encodeURIComponent(key));
|
|
732
732
|
return {
|
|
733
733
|
async set(key, value) {
|
|
734
|
-
const
|
|
735
|
-
await (0, import_fs_extra7.ensureDir)((0, import_path3.dirname)(
|
|
736
|
-
await writeFileIfDifferent(
|
|
734
|
+
const path7 = getPath(key);
|
|
735
|
+
await (0, import_fs_extra7.ensureDir)((0, import_path3.dirname)(path7));
|
|
736
|
+
await writeFileIfDifferent(path7, value);
|
|
737
737
|
},
|
|
738
738
|
async get(key) {
|
|
739
|
-
const
|
|
739
|
+
const path7 = getPath(key);
|
|
740
740
|
try {
|
|
741
|
-
return await import_fs_extra7.default.readFile(
|
|
741
|
+
return await import_fs_extra7.default.readFile(path7, "utf-8");
|
|
742
742
|
} catch {
|
|
743
743
|
return void 0;
|
|
744
744
|
}
|
|
@@ -1235,7 +1235,7 @@ var import_node_url = require("url");
|
|
|
1235
1235
|
|
|
1236
1236
|
// src/core/utils/building/internal-build.ts
|
|
1237
1237
|
var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
1238
|
-
var
|
|
1238
|
+
var import_fs_extra12 = __toESM(require("fs-extra"), 1);
|
|
1239
1239
|
|
|
1240
1240
|
// src/core/utils/log/printFileList.ts
|
|
1241
1241
|
var import_node_path11 = __toESM(require("path"), 1);
|
|
@@ -1267,13 +1267,9 @@ 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
|
|
1270
|
+
var import_node_path12 = require("path");
|
|
1271
1271
|
var import_consola3 = __toESM(require("consola"), 1);
|
|
1272
1272
|
|
|
1273
|
-
// src/core/utils/exec.ts
|
|
1274
|
-
var import_node_path12 = __toESM(require("path"), 1);
|
|
1275
|
-
var import_fs_extra12 = require("fs-extra");
|
|
1276
|
-
|
|
1277
1273
|
// src/testing/wxt-vitest-plugin.ts
|
|
1278
1274
|
function WxtVitest(inlineConfig) {
|
|
1279
1275
|
return resolveConfig(inlineConfig ?? {}, "serve").then((config) => [
|
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.17.2-
|
|
4
|
+
"version": "0.17.2-alpha4",
|
|
5
5
|
"description": "Next gen framework for developing web extensions",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18",
|
|
@@ -107,10 +107,10 @@
|
|
|
107
107
|
"minimatch": "^9.0.3",
|
|
108
108
|
"natural-compare": "^1.4.0",
|
|
109
109
|
"normalize-path": "^3.0.0",
|
|
110
|
+
"nypm": "^0.3.6",
|
|
110
111
|
"ora": "^7.0.1",
|
|
111
112
|
"picocolors": "^1.0.0",
|
|
112
113
|
"prompts": "^2.4.2",
|
|
113
|
-
"publish-browser-extension": "^2.1.2",
|
|
114
114
|
"rollup-plugin-visualizer": "^5.9.2",
|
|
115
115
|
"unimport": "^3.4.0",
|
|
116
116
|
"vite": "^5.1.3",
|
|
@@ -147,6 +147,14 @@
|
|
|
147
147
|
"vitest-mock-extended": "^1.3.1",
|
|
148
148
|
"vue": "^3.3.10"
|
|
149
149
|
},
|
|
150
|
+
"peerDependencies": {
|
|
151
|
+
"publish-browser-extension": "^2.1.2"
|
|
152
|
+
},
|
|
153
|
+
"peerDependenciesMeta": {
|
|
154
|
+
"publish-browser-extension": {
|
|
155
|
+
"optional": true
|
|
156
|
+
}
|
|
157
|
+
},
|
|
150
158
|
"packageManager": "pnpm@8.6.3",
|
|
151
159
|
"simple-git-hooks": {
|
|
152
160
|
"pre-commit": "pnpm lint-staged"
|