wxt 0.17.1 → 0.17.2-alpha2
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-JPO52NRM.js → chunk-7E4MYYBY.js} +41 -33
- package/dist/cli.js +62 -54
- package/dist/index.cjs +103 -95
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/testing.cjs +14 -15
- package/dist/testing.js +1 -1
- package/package.json +1 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.17.
|
|
2
|
+
var version = "0.17.2-alpha2";
|
|
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(path8) {
|
|
8
|
+
return normalize(path8);
|
|
9
9
|
}
|
|
10
|
-
function unnormalizePath(
|
|
11
|
-
return systemPath.normalize(
|
|
10
|
+
function unnormalizePath(path8) {
|
|
11
|
+
return systemPath.normalize(path8);
|
|
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((path8) => ` | "/${path8}"`).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 = (path8) => normalizePath(relative3(dir, path8));
|
|
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 path8 = getPath(key);
|
|
886
|
+
await ensureDir(dirname2(path8));
|
|
887
|
+
await writeFileIfDifferent(path8, value);
|
|
888
888
|
},
|
|
889
889
|
async get(key) {
|
|
890
|
-
const
|
|
890
|
+
const path8 = getPath(key);
|
|
891
891
|
try {
|
|
892
|
-
return await fs5.readFile(
|
|
892
|
+
return await fs5.readFile(path8, "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 path8 = normalizePath(resolvedAbsolutePath);
|
|
1027
|
+
if (!path8.startsWith("/"))
|
|
1028
|
+
path8 = "/" + path8;
|
|
1029
|
+
element.setAttribute(attr, `${server.origin}/@fs${path8}`);
|
|
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(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(path7) {
|
|
|
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(
|
|
@@ -2851,17 +2851,25 @@ var ValidationError = class extends Error {
|
|
|
2851
2851
|
import consola3 from "consola";
|
|
2852
2852
|
|
|
2853
2853
|
// src/core/utils/exec.ts
|
|
2854
|
-
import
|
|
2855
|
-
import {
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
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`);
|
|
2862
2870
|
const { execa } = await import("./execa-4F7CCWCA.js");
|
|
2863
|
-
|
|
2864
|
-
}
|
|
2871
|
+
execa(location.path, args, options);
|
|
2872
|
+
}
|
|
2865
2873
|
|
|
2866
2874
|
// src/core/utils/building/internal-build.ts
|
|
2867
2875
|
async function internalBuild() {
|
|
@@ -2915,7 +2923,7 @@ async function combineAnalysisStats() {
|
|
|
2915
2923
|
absolute: true
|
|
2916
2924
|
});
|
|
2917
2925
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
2918
|
-
await
|
|
2926
|
+
await execaDependencyBin(
|
|
2919
2927
|
"rollup-plugin-visualizer",
|
|
2920
2928
|
[
|
|
2921
2929
|
...absolutePaths,
|
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(path9) {
|
|
15
|
+
return normalize(path9);
|
|
16
16
|
}
|
|
17
|
-
function unnormalizePath(
|
|
18
|
-
return systemPath.normalize(
|
|
17
|
+
function unnormalizePath(path9) {
|
|
18
|
+
return systemPath.normalize(path9);
|
|
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((path9) => ` | "/${path9}"`).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 = (path9) => normalizePath(relative3(dir, path9));
|
|
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 path9 = getPath(key);
|
|
911
|
+
await ensureDir(dirname2(path9));
|
|
912
|
+
await writeFileIfDifferent(path9, value);
|
|
913
913
|
},
|
|
914
914
|
async get(key) {
|
|
915
|
-
const
|
|
915
|
+
const path9 = getPath(key);
|
|
916
916
|
try {
|
|
917
|
-
return await fs5.readFile(
|
|
917
|
+
return await fs5.readFile(path9, "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 path9 = normalizePath(resolvedAbsolutePath);
|
|
1052
|
+
if (!path9.startsWith("/"))
|
|
1053
|
+
path9 = "/" + path9;
|
|
1054
|
+
element.setAttribute(attr, `${server.origin}/@fs${path9}`);
|
|
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(path9) {
|
|
1988
|
+
wxt.logger.debug("Loading file metadata:", path9);
|
|
1989
|
+
const normalPath = normalizePath(path9);
|
|
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(path9, "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(path9);
|
|
2040
2040
|
return res.default;
|
|
2041
2041
|
} catch (err) {
|
|
2042
|
-
const filePath = relative5(wxt.config.root,
|
|
2042
|
+
const filePath = relative5(wxt.config.root, path9);
|
|
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.
|
|
2184
|
+
var version = "0.17.2-alpha2";
|
|
2185
2185
|
|
|
2186
2186
|
// src/core/utils/log/printHeader.ts
|
|
2187
2187
|
import { consola as consola2 } from "consola";
|
|
@@ -2860,17 +2860,25 @@ var ValidationError = class extends Error {
|
|
|
2860
2860
|
import consola3 from "consola";
|
|
2861
2861
|
|
|
2862
2862
|
// src/core/utils/exec.ts
|
|
2863
|
-
import
|
|
2864
|
-
import {
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
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`);
|
|
2871
2879
|
const { execa } = await import("./execa-Y2EWTC4S.js");
|
|
2872
|
-
|
|
2873
|
-
}
|
|
2880
|
+
execa(location.path, args, options);
|
|
2881
|
+
}
|
|
2874
2882
|
|
|
2875
2883
|
// src/core/utils/building/internal-build.ts
|
|
2876
2884
|
async function internalBuild() {
|
|
@@ -2924,7 +2932,7 @@ async function combineAnalysisStats() {
|
|
|
2924
2932
|
absolute: true
|
|
2925
2933
|
});
|
|
2926
2934
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
2927
|
-
await
|
|
2935
|
+
await execaDependencyBin(
|
|
2928
2936
|
"rollup-plugin-visualizer",
|
|
2929
2937
|
[
|
|
2930
2938
|
...absolutePaths,
|
|
@@ -2973,7 +2981,7 @@ async function build(config) {
|
|
|
2973
2981
|
}
|
|
2974
2982
|
|
|
2975
2983
|
// src/core/clean.ts
|
|
2976
|
-
import
|
|
2984
|
+
import path7 from "node:path";
|
|
2977
2985
|
import glob4 from "fast-glob";
|
|
2978
2986
|
import fs13 from "fs-extra";
|
|
2979
2987
|
import { consola as consola4 } from "consola";
|
|
@@ -2988,7 +2996,7 @@ async function clean(root = process.cwd()) {
|
|
|
2988
2996
|
];
|
|
2989
2997
|
consola4.debug("Looking for:", tempDirs.map(pc6.cyan).join(", "));
|
|
2990
2998
|
const directories = await glob4(tempDirs, {
|
|
2991
|
-
cwd:
|
|
2999
|
+
cwd: path7.resolve(root),
|
|
2992
3000
|
absolute: true,
|
|
2993
3001
|
onlyDirectories: true,
|
|
2994
3002
|
deep: 2
|
|
@@ -2999,11 +3007,11 @@ async function clean(root = process.cwd()) {
|
|
|
2999
3007
|
}
|
|
3000
3008
|
consola4.debug(
|
|
3001
3009
|
"Found:",
|
|
3002
|
-
directories.map((dir) => pc6.cyan(
|
|
3010
|
+
directories.map((dir) => pc6.cyan(path7.relative(root, dir))).join(", ")
|
|
3003
3011
|
);
|
|
3004
3012
|
for (const directory of directories) {
|
|
3005
3013
|
await fs13.rm(directory, { force: true, recursive: true });
|
|
3006
|
-
consola4.debug("Deleted " + pc6.cyan(
|
|
3014
|
+
consola4.debug("Deleted " + pc6.cyan(path7.relative(root, directory)));
|
|
3007
3015
|
}
|
|
3008
3016
|
}
|
|
3009
3017
|
|
|
@@ -3207,8 +3215,8 @@ async function createServer(inlineConfig) {
|
|
|
3207
3215
|
reloadContentScript(payload) {
|
|
3208
3216
|
server.ws.send("wxt:reload-content-script", payload);
|
|
3209
3217
|
},
|
|
3210
|
-
reloadPage(
|
|
3211
|
-
server.ws.send("wxt:reload-page",
|
|
3218
|
+
reloadPage(path9) {
|
|
3219
|
+
server.ws.send("wxt:reload-page", path9);
|
|
3212
3220
|
},
|
|
3213
3221
|
reloadExtension() {
|
|
3214
3222
|
server.ws.send("wxt:reload-extension");
|
|
@@ -3239,11 +3247,11 @@ async function getPort() {
|
|
|
3239
3247
|
function createFileReloader(server) {
|
|
3240
3248
|
const fileChangedMutex = new Mutex();
|
|
3241
3249
|
const changeQueue = [];
|
|
3242
|
-
return async (event,
|
|
3250
|
+
return async (event, path9) => {
|
|
3243
3251
|
await wxt.reloadConfig();
|
|
3244
|
-
if (
|
|
3252
|
+
if (path9.startsWith(wxt.config.outBaseDir))
|
|
3245
3253
|
return;
|
|
3246
|
-
changeQueue.push([event,
|
|
3254
|
+
changeQueue.push([event, path9]);
|
|
3247
3255
|
await fileChangedMutex.runExclusive(async () => {
|
|
3248
3256
|
if (server.currentOutput == null)
|
|
3249
3257
|
return;
|
|
@@ -3322,8 +3330,8 @@ function reloadContentScripts(steps, server) {
|
|
|
3322
3330
|
function reloadHtmlPages(groups, server) {
|
|
3323
3331
|
const htmlEntries = groups.flat().filter(isHtmlEntrypoint);
|
|
3324
3332
|
htmlEntries.forEach((entry) => {
|
|
3325
|
-
const
|
|
3326
|
-
server.reloadPage(
|
|
3333
|
+
const path9 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
|
|
3334
|
+
server.reloadPage(path9);
|
|
3327
3335
|
});
|
|
3328
3336
|
return {
|
|
3329
3337
|
reloadedNames: htmlEntries.map((entry) => entry.name)
|
|
@@ -3354,7 +3362,7 @@ import prompts from "prompts";
|
|
|
3354
3362
|
import { consola as consola6 } from "consola";
|
|
3355
3363
|
import { downloadTemplate } from "giget";
|
|
3356
3364
|
import fs14 from "fs-extra";
|
|
3357
|
-
import
|
|
3365
|
+
import path8 from "node:path";
|
|
3358
3366
|
import pc8 from "picocolors";
|
|
3359
3367
|
async function initialize(options) {
|
|
3360
3368
|
consola6.info("Initalizing new project");
|
|
@@ -3402,7 +3410,7 @@ async function initialize(options) {
|
|
|
3402
3410
|
input.template ??= defaultTemplate;
|
|
3403
3411
|
input.packageManager ??= options.packageManager;
|
|
3404
3412
|
await cloneProject(input);
|
|
3405
|
-
const cdPath =
|
|
3413
|
+
const cdPath = path8.relative(process.cwd(), path8.resolve(input.directory));
|
|
3406
3414
|
console.log();
|
|
3407
3415
|
consola6.log(
|
|
3408
3416
|
`\u2728 WXT project created with the ${TEMPLATE_COLORS[input.template.name]?.(input.template.name) ?? input.template.name} template.`
|
|
@@ -3446,8 +3454,8 @@ async function cloneProject({
|
|
|
3446
3454
|
force: true
|
|
3447
3455
|
});
|
|
3448
3456
|
await fs14.move(
|
|
3449
|
-
|
|
3450
|
-
|
|
3457
|
+
path8.join(directory, "_gitignore"),
|
|
3458
|
+
path8.join(directory, ".gitignore")
|
|
3451
3459
|
).catch(
|
|
3452
3460
|
(err) => consola6.warn("Failed to move _gitignore to .gitignore:", err)
|
|
3453
3461
|
);
|
|
@@ -3480,7 +3488,7 @@ async function prepare(config) {
|
|
|
3480
3488
|
|
|
3481
3489
|
// src/core/zip.ts
|
|
3482
3490
|
import zipdir from "zip-dir";
|
|
3483
|
-
import { dirname as dirname5, relative as relative11, resolve as
|
|
3491
|
+
import { dirname as dirname5, relative as relative11, resolve as resolve13 } from "node:path";
|
|
3484
3492
|
import fs15 from "fs-extra";
|
|
3485
3493
|
import { minimatch as minimatch2 } from "minimatch";
|
|
3486
3494
|
async function zip(config) {
|
|
@@ -3498,18 +3506,18 @@ async function zip(config) {
|
|
|
3498
3506
|
).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
3499
3507
|
await fs15.ensureDir(wxt.config.outBaseDir);
|
|
3500
3508
|
const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
|
|
3501
|
-
const outZipPath =
|
|
3509
|
+
const outZipPath = resolve13(wxt.config.outBaseDir, outZipFilename);
|
|
3502
3510
|
await zipdir(wxt.config.outDir, {
|
|
3503
3511
|
saveTo: outZipPath
|
|
3504
3512
|
});
|
|
3505
3513
|
zipFiles.push(outZipPath);
|
|
3506
3514
|
if (wxt.config.browser === "firefox") {
|
|
3507
3515
|
const sourcesZipFilename = applyTemplate(wxt.config.zip.sourcesTemplate);
|
|
3508
|
-
const sourcesZipPath =
|
|
3516
|
+
const sourcesZipPath = resolve13(wxt.config.outBaseDir, sourcesZipFilename);
|
|
3509
3517
|
await zipdir(wxt.config.zip.sourcesRoot, {
|
|
3510
3518
|
saveTo: sourcesZipPath,
|
|
3511
|
-
filter(
|
|
3512
|
-
const relativePath = relative11(wxt.config.zip.sourcesRoot,
|
|
3519
|
+
filter(path9) {
|
|
3520
|
+
const relativePath = relative11(wxt.config.zip.sourcesRoot, path9);
|
|
3513
3521
|
return wxt.config.zip.includeSources.some(
|
|
3514
3522
|
(pattern) => minimatch2(relativePath, pattern)
|
|
3515
3523
|
) || !wxt.config.zip.excludeSources.some(
|
|
@@ -3569,7 +3577,7 @@ function createAliasedCommand(base, name, alias, docsUrl) {
|
|
|
3569
3577
|
const args = process.argv.slice(
|
|
3570
3578
|
process.argv.indexOf(aliasedCommand.name) + 1
|
|
3571
3579
|
);
|
|
3572
|
-
await
|
|
3580
|
+
await execaDependencyBin(alias, args, {
|
|
3573
3581
|
stdio: "inherit"
|
|
3574
3582
|
});
|
|
3575
3583
|
} catch {
|
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(path12, 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 && path12.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, path12, options) {
|
|
61
61
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
|
-
return checkPathExt(
|
|
64
|
+
return checkPathExt(path12, options);
|
|
65
65
|
}
|
|
66
|
-
function isexe(
|
|
67
|
-
fs16.stat(
|
|
68
|
-
cb(er, er ? false : checkStat(stat,
|
|
66
|
+
function isexe(path12, options, cb) {
|
|
67
|
+
fs16.stat(path12, function(er, stat) {
|
|
68
|
+
cb(er, er ? false : checkStat(stat, path12, options));
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
function sync(
|
|
72
|
-
return checkStat(fs16.statSync(
|
|
71
|
+
function sync(path12, options) {
|
|
72
|
+
return checkStat(fs16.statSync(path12), path12, 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(path12, options, cb) {
|
|
85
|
+
fs16.stat(path12, 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(path12, options) {
|
|
90
|
+
return checkStat(fs16.statSync(path12), 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(path12, options, cb) {
|
|
125
125
|
if (typeof options === "function") {
|
|
126
126
|
cb = options;
|
|
127
127
|
options = {};
|
|
@@ -130,17 +130,17 @@ 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(
|
|
134
|
-
isexe(
|
|
133
|
+
return new Promise(function(resolve14, reject) {
|
|
134
|
+
isexe(path12, 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
|
});
|
|
142
142
|
}
|
|
143
|
-
core(
|
|
143
|
+
core(path12, 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(path12, options) {
|
|
154
154
|
try {
|
|
155
|
-
return core.sync(
|
|
155
|
+
return core.sync(path12, 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 path12 = 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" });
|
|
@@ -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
|
-
const pCmd =
|
|
210
|
+
const pCmd = path12.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);
|
|
@@ -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 = path12.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 path12 = 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 ? path12.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 = path12.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 [path12, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
367
|
+
const binary = path12.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 path12 = 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 = path12.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 path12 = pathKey({ env });
|
|
594
|
+
options.path = env[path12];
|
|
595
|
+
env[path12] = npmRunPath(options);
|
|
596
596
|
return env;
|
|
597
597
|
}
|
|
598
598
|
var import_node_process, import_node_path12, import_node_url2;
|
|
@@ -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);
|
|
@@ -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(path12) {
|
|
2438
|
+
return (0, import_normalize_path.default)(path12);
|
|
2439
2439
|
}
|
|
2440
|
-
function unnormalizePath(
|
|
2441
|
-
return import_node_path.default.normalize(
|
|
2440
|
+
function unnormalizePath(path12) {
|
|
2441
|
+
return import_node_path.default.normalize(path12);
|
|
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((path12) => ` | "/${path12}"`).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 = (path12) => normalizePath((0, import_path3.relative)(dir, path12));
|
|
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 path12 = getPath(key);
|
|
3334
|
+
await (0, import_fs_extra5.ensureDir)((0, import_path4.dirname)(path12));
|
|
3335
|
+
await writeFileIfDifferent(path12, value);
|
|
3336
3336
|
},
|
|
3337
3337
|
async get(key) {
|
|
3338
|
-
const
|
|
3338
|
+
const path12 = getPath(key);
|
|
3339
3339
|
try {
|
|
3340
|
-
return await import_fs_extra5.default.readFile(
|
|
3340
|
+
return await import_fs_extra5.default.readFile(path12, "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 path12 = normalizePath(resolvedAbsolutePath);
|
|
3475
|
+
if (!path12.startsWith("/"))
|
|
3476
|
+
path12 = "/" + path12;
|
|
3477
|
+
element.setAttribute(attr, `${server.origin}/@fs${path12}`);
|
|
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(path12) {
|
|
4415
|
+
wxt.logger.debug("Loading file metadata:", path12);
|
|
4416
|
+
const normalPath = normalizePath(path12);
|
|
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(path12, "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(path11) {
|
|
|
4463
4463
|
}
|
|
4464
4464
|
);
|
|
4465
4465
|
try {
|
|
4466
|
-
const res = await jiti(
|
|
4466
|
+
const res = await jiti(path12);
|
|
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, path12);
|
|
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_extra13 = __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.
|
|
4611
|
+
var version = "0.17.2-alpha2";
|
|
4612
4612
|
|
|
4613
4613
|
// src/core/utils/log/printHeader.ts
|
|
4614
4614
|
var import_consola2 = require("consola");
|
|
@@ -5283,17 +5283,25 @@ var ValidationError = class extends Error {
|
|
|
5283
5283
|
var import_consola3 = __toESM(require("consola"), 1);
|
|
5284
5284
|
|
|
5285
5285
|
// src/core/utils/exec.ts
|
|
5286
|
-
var
|
|
5287
|
-
var
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
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`);
|
|
5294
5302
|
const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
|
|
5295
|
-
|
|
5296
|
-
}
|
|
5303
|
+
execa2(location.path, args, options);
|
|
5304
|
+
}
|
|
5297
5305
|
|
|
5298
5306
|
// src/core/utils/building/internal-build.ts
|
|
5299
5307
|
async function internalBuild() {
|
|
@@ -5306,8 +5314,8 @@ async function internalBuild() {
|
|
|
5306
5314
|
)}`
|
|
5307
5315
|
);
|
|
5308
5316
|
const startTime = Date.now();
|
|
5309
|
-
await
|
|
5310
|
-
await
|
|
5317
|
+
await import_fs_extra13.default.rm(wxt.config.outDir, { recursive: true, force: true });
|
|
5318
|
+
await import_fs_extra13.default.ensureDir(wxt.config.outDir);
|
|
5311
5319
|
const entrypoints = await findEntrypoints();
|
|
5312
5320
|
wxt.logger.debug("Detected entrypoints:", entrypoints);
|
|
5313
5321
|
const validationResults = validateEntrypoints(entrypoints);
|
|
@@ -5347,7 +5355,7 @@ async function combineAnalysisStats() {
|
|
|
5347
5355
|
absolute: true
|
|
5348
5356
|
});
|
|
5349
5357
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
5350
|
-
await
|
|
5358
|
+
await execaDependencyBin(
|
|
5351
5359
|
"rollup-plugin-visualizer",
|
|
5352
5360
|
[
|
|
5353
5361
|
...absolutePaths,
|
|
@@ -5359,7 +5367,7 @@ async function combineAnalysisStats() {
|
|
|
5359
5367
|
{ cwd: wxt.config.root, stdio: "inherit" }
|
|
5360
5368
|
);
|
|
5361
5369
|
if (!wxt.config.analysis.keepArtifacts) {
|
|
5362
|
-
await Promise.all(absolutePaths.map((statsFile) =>
|
|
5370
|
+
await Promise.all(absolutePaths.map((statsFile) => import_fs_extra13.default.remove(statsFile)));
|
|
5363
5371
|
}
|
|
5364
5372
|
}
|
|
5365
5373
|
function printValidationResults({
|
|
@@ -5398,7 +5406,7 @@ async function build(config) {
|
|
|
5398
5406
|
// src/core/clean.ts
|
|
5399
5407
|
var import_node_path16 = __toESM(require("path"), 1);
|
|
5400
5408
|
var import_fast_glob4 = __toESM(require("fast-glob"), 1);
|
|
5401
|
-
var
|
|
5409
|
+
var import_fs_extra14 = __toESM(require("fs-extra"), 1);
|
|
5402
5410
|
var import_consola4 = require("consola");
|
|
5403
5411
|
var import_picocolors6 = __toESM(require("picocolors"), 1);
|
|
5404
5412
|
async function clean(root = process.cwd()) {
|
|
@@ -5425,7 +5433,7 @@ async function clean(root = process.cwd()) {
|
|
|
5425
5433
|
directories.map((dir) => import_picocolors6.default.cyan(import_node_path16.default.relative(root, dir))).join(", ")
|
|
5426
5434
|
);
|
|
5427
5435
|
for (const directory of directories) {
|
|
5428
|
-
await
|
|
5436
|
+
await import_fs_extra14.default.rm(directory, { force: true, recursive: true });
|
|
5429
5437
|
import_consola4.consola.debug("Deleted " + import_picocolors6.default.cyan(import_node_path16.default.relative(root, directory)));
|
|
5430
5438
|
}
|
|
5431
5439
|
}
|
|
@@ -5640,8 +5648,8 @@ async function createServer(inlineConfig) {
|
|
|
5640
5648
|
reloadContentScript(payload) {
|
|
5641
5649
|
server.ws.send("wxt:reload-content-script", payload);
|
|
5642
5650
|
},
|
|
5643
|
-
reloadPage(
|
|
5644
|
-
server.ws.send("wxt:reload-page",
|
|
5651
|
+
reloadPage(path12) {
|
|
5652
|
+
server.ws.send("wxt:reload-page", path12);
|
|
5645
5653
|
},
|
|
5646
5654
|
reloadExtension() {
|
|
5647
5655
|
server.ws.send("wxt:reload-extension");
|
|
@@ -5672,11 +5680,11 @@ async function getPort() {
|
|
|
5672
5680
|
function createFileReloader(server) {
|
|
5673
5681
|
const fileChangedMutex = new import_async_mutex.Mutex();
|
|
5674
5682
|
const changeQueue = [];
|
|
5675
|
-
return async (event,
|
|
5683
|
+
return async (event, path12) => {
|
|
5676
5684
|
await wxt.reloadConfig();
|
|
5677
|
-
if (
|
|
5685
|
+
if (path12.startsWith(wxt.config.outBaseDir))
|
|
5678
5686
|
return;
|
|
5679
|
-
changeQueue.push([event,
|
|
5687
|
+
changeQueue.push([event, path12]);
|
|
5680
5688
|
await fileChangedMutex.runExclusive(async () => {
|
|
5681
5689
|
if (server.currentOutput == null)
|
|
5682
5690
|
return;
|
|
@@ -5755,8 +5763,8 @@ function reloadContentScripts(steps, server) {
|
|
|
5755
5763
|
function reloadHtmlPages(groups, server) {
|
|
5756
5764
|
const htmlEntries = groups.flat().filter(isHtmlEntrypoint);
|
|
5757
5765
|
htmlEntries.forEach((entry) => {
|
|
5758
|
-
const
|
|
5759
|
-
server.reloadPage(
|
|
5766
|
+
const path12 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
|
|
5767
|
+
server.reloadPage(path12);
|
|
5760
5768
|
});
|
|
5761
5769
|
return {
|
|
5762
5770
|
reloadedNames: htmlEntries.map((entry) => entry.name)
|
|
@@ -5786,7 +5794,7 @@ function getExternalOutputDependencies(server) {
|
|
|
5786
5794
|
var import_prompts = __toESM(require("prompts"), 1);
|
|
5787
5795
|
var import_consola6 = require("consola");
|
|
5788
5796
|
var import_giget = require("giget");
|
|
5789
|
-
var
|
|
5797
|
+
var import_fs_extra15 = __toESM(require("fs-extra"), 1);
|
|
5790
5798
|
var import_node_path21 = __toESM(require("path"), 1);
|
|
5791
5799
|
var import_picocolors8 = __toESM(require("picocolors"), 1);
|
|
5792
5800
|
async function initialize(options) {
|
|
@@ -5878,7 +5886,7 @@ async function cloneProject({
|
|
|
5878
5886
|
dir: directory,
|
|
5879
5887
|
force: true
|
|
5880
5888
|
});
|
|
5881
|
-
await
|
|
5889
|
+
await import_fs_extra15.default.move(
|
|
5882
5890
|
import_node_path21.default.join(directory, "_gitignore"),
|
|
5883
5891
|
import_node_path21.default.join(directory, ".gitignore")
|
|
5884
5892
|
).catch(
|
|
@@ -5914,7 +5922,7 @@ async function prepare(config) {
|
|
|
5914
5922
|
// src/core/zip.ts
|
|
5915
5923
|
var import_zip_dir = __toESM(require("zip-dir"), 1);
|
|
5916
5924
|
var import_node_path22 = require("path");
|
|
5917
|
-
var
|
|
5925
|
+
var import_fs_extra16 = __toESM(require("fs-extra"), 1);
|
|
5918
5926
|
var import_minimatch2 = require("minimatch");
|
|
5919
5927
|
async function zip(config) {
|
|
5920
5928
|
await registerWxt("build", config);
|
|
@@ -5929,7 +5937,7 @@ async function zip(config) {
|
|
|
5929
5937
|
"{{version}}",
|
|
5930
5938
|
output.manifest.version_name ?? output.manifest.version
|
|
5931
5939
|
).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
5932
|
-
await
|
|
5940
|
+
await import_fs_extra16.default.ensureDir(wxt.config.outBaseDir);
|
|
5933
5941
|
const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
|
|
5934
5942
|
const outZipPath = (0, import_node_path22.resolve)(wxt.config.outBaseDir, outZipFilename);
|
|
5935
5943
|
await (0, import_zip_dir.default)(wxt.config.outDir, {
|
|
@@ -5941,8 +5949,8 @@ async function zip(config) {
|
|
|
5941
5949
|
const sourcesZipPath = (0, import_node_path22.resolve)(wxt.config.outBaseDir, sourcesZipFilename);
|
|
5942
5950
|
await (0, import_zip_dir.default)(wxt.config.zip.sourcesRoot, {
|
|
5943
5951
|
saveTo: sourcesZipPath,
|
|
5944
|
-
filter(
|
|
5945
|
-
const relativePath = (0, import_node_path22.relative)(wxt.config.zip.sourcesRoot,
|
|
5952
|
+
filter(path12) {
|
|
5953
|
+
const relativePath = (0, import_node_path22.relative)(wxt.config.zip.sourcesRoot, path12);
|
|
5946
5954
|
return wxt.config.zip.includeSources.some(
|
|
5947
5955
|
(pattern) => (0, import_minimatch2.minimatch)(relativePath, pattern)
|
|
5948
5956
|
) || !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-alpha2";
|
|
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-alpha2";
|
|
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/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(path8) {
|
|
48
|
+
return (0, import_normalize_path.default)(path8);
|
|
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 path8 = normalizePath(resolvedAbsolutePath);
|
|
195
|
+
if (!path8.startsWith("/"))
|
|
196
|
+
path8 = "/" + path8;
|
|
197
|
+
element.setAttribute(attr, `${server.origin}/@fs${path8}`);
|
|
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 path8 = getPath(key);
|
|
735
|
+
await (0, import_fs_extra7.ensureDir)((0, import_path3.dirname)(path8));
|
|
736
|
+
await writeFileIfDifferent(path8, value);
|
|
737
737
|
},
|
|
738
738
|
async get(key) {
|
|
739
|
-
const
|
|
739
|
+
const path8 = getPath(key);
|
|
740
740
|
try {
|
|
741
|
-
return await import_fs_extra7.default.readFile(
|
|
741
|
+
return await import_fs_extra7.default.readFile(path8, "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_extra13 = __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);
|
|
@@ -1271,9 +1271,8 @@ var import_node_path13 = require("path");
|
|
|
1271
1271
|
var import_consola3 = __toESM(require("consola"), 1);
|
|
1272
1272
|
|
|
1273
1273
|
// src/core/utils/exec.ts
|
|
1274
|
-
var
|
|
1275
|
-
var
|
|
1276
|
-
var managedPath = (0, import_manage_path.default)(process.env);
|
|
1274
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
1275
|
+
var import_fs_extra12 = require("fs-extra");
|
|
1277
1276
|
|
|
1278
1277
|
// src/testing/wxt-vitest-plugin.ts
|
|
1279
1278
|
function WxtVitest(inlineConfig) {
|
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.
|
|
4
|
+
"version": "0.17.2-alpha2",
|
|
5
5
|
"description": "Next gen framework for developing web extensions",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18",
|
|
@@ -104,7 +104,6 @@
|
|
|
104
104
|
"jiti": "^1.21.0",
|
|
105
105
|
"json5": "^2.2.3",
|
|
106
106
|
"linkedom": "^0.16.1",
|
|
107
|
-
"manage-path": "^2.0.0",
|
|
108
107
|
"minimatch": "^9.0.3",
|
|
109
108
|
"natural-compare": "^1.4.0",
|
|
110
109
|
"normalize-path": "^3.0.0",
|