wxt 0.17.2-alpha1 → 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.
@@ -1,14 +1,14 @@
1
1
  // package.json
2
- var version = "0.17.2-alpha1";
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(path7) {
8
- return normalize(path7);
7
+ function normalizePath(path8) {
8
+ return normalize(path8);
9
9
  }
10
- function unnormalizePath(path7) {
11
- return systemPath.normalize(path7);
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((path7) => ` | "/${path7}"`).sort().join("\n");
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 = (path7) => normalizePath(relative3(dir, path7));
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 path7 = getPath(key);
886
- await ensureDir(dirname2(path7));
887
- await writeFileIfDifferent(path7, value);
885
+ const path8 = getPath(key);
886
+ await ensureDir(dirname2(path8));
887
+ await writeFileIfDifferent(path8, value);
888
888
  },
889
889
  async get(key) {
890
- const path7 = getPath(key);
890
+ const path8 = getPath(key);
891
891
  try {
892
- return await fs5.readFile(path7, "utf-8");
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 path7 = normalizePath(resolvedAbsolutePath);
1027
- if (!path7.startsWith("/"))
1028
- path7 = "/" + path7;
1029
- element.setAttribute(attr, `${server.origin}/@fs${path7}`);
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(path7) {
1988
- wxt.logger.debug("Loading file metadata:", path7);
1989
- const normalPath = normalizePath(path7);
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(path7, "utf-8");
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(path7);
2039
+ const res = await jiti(path8);
2040
2040
  return res.default;
2041
2041
  } catch (err) {
2042
- const filePath = relative5(wxt.config.root, path7);
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(
@@ -2849,6 +2849,29 @@ 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
2852
2875
  async function internalBuild() {
2853
2876
  await wxt.hooks.callHook("build:before", wxt);
2854
2877
  const verb = wxt.config.command === "serve" ? "Pre-rendering" : "Building";
@@ -2900,9 +2923,8 @@ async function combineAnalysisStats() {
2900
2923
  absolute: true
2901
2924
  });
2902
2925
  const absolutePaths = unixFiles.map(unnormalizePath);
2903
- const { execa } = await import("./execa-4F7CCWCA.js");
2904
- await execa(
2905
- "wxt-rollup-plugin-visualizer",
2926
+ await execaDependencyBin(
2927
+ "rollup-plugin-visualizer",
2906
2928
  [
2907
2929
  ...absolutePaths,
2908
2930
  "--template",
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(path8) {
15
- return normalize(path8);
14
+ function normalizePath(path9) {
15
+ return normalize(path9);
16
16
  }
17
- function unnormalizePath(path8) {
18
- return systemPath.normalize(path8);
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((path8) => ` | "/${path8}"`).sort().join("\n");
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 = (path8) => normalizePath(relative3(dir, path8));
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 path8 = getPath(key);
911
- await ensureDir(dirname2(path8));
912
- await writeFileIfDifferent(path8, value);
910
+ const path9 = getPath(key);
911
+ await ensureDir(dirname2(path9));
912
+ await writeFileIfDifferent(path9, value);
913
913
  },
914
914
  async get(key) {
915
- const path8 = getPath(key);
915
+ const path9 = getPath(key);
916
916
  try {
917
- return await fs5.readFile(path8, "utf-8");
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 path8 = normalizePath(resolvedAbsolutePath);
1052
- if (!path8.startsWith("/"))
1053
- path8 = "/" + path8;
1054
- element.setAttribute(attr, `${server.origin}/@fs${path8}`);
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(path8) {
1988
- wxt.logger.debug("Loading file metadata:", path8);
1989
- const normalPath = normalizePath(path8);
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(path8, "utf-8");
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(path8);
2039
+ const res = await jiti(path9);
2040
2040
  return res.default;
2041
2041
  } catch (err) {
2042
- const filePath = relative5(wxt.config.root, path8);
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.2-alpha1";
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";
@@ -2858,6 +2858,29 @@ 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
2861
2884
  async function internalBuild() {
2862
2885
  await wxt.hooks.callHook("build:before", wxt);
2863
2886
  const verb = wxt.config.command === "serve" ? "Pre-rendering" : "Building";
@@ -2909,9 +2932,8 @@ async function combineAnalysisStats() {
2909
2932
  absolute: true
2910
2933
  });
2911
2934
  const absolutePaths = unixFiles.map(unnormalizePath);
2912
- const { execa } = await import("./execa-Y2EWTC4S.js");
2913
- await execa(
2914
- "wxt-rollup-plugin-visualizer",
2935
+ await execaDependencyBin(
2936
+ "rollup-plugin-visualizer",
2915
2937
  [
2916
2938
  ...absolutePaths,
2917
2939
  "--template",
@@ -2959,7 +2981,7 @@ async function build(config) {
2959
2981
  }
2960
2982
 
2961
2983
  // src/core/clean.ts
2962
- import path6 from "node:path";
2984
+ import path7 from "node:path";
2963
2985
  import glob4 from "fast-glob";
2964
2986
  import fs13 from "fs-extra";
2965
2987
  import { consola as consola4 } from "consola";
@@ -2974,7 +2996,7 @@ async function clean(root = process.cwd()) {
2974
2996
  ];
2975
2997
  consola4.debug("Looking for:", tempDirs.map(pc6.cyan).join(", "));
2976
2998
  const directories = await glob4(tempDirs, {
2977
- cwd: path6.resolve(root),
2999
+ cwd: path7.resolve(root),
2978
3000
  absolute: true,
2979
3001
  onlyDirectories: true,
2980
3002
  deep: 2
@@ -2985,11 +3007,11 @@ async function clean(root = process.cwd()) {
2985
3007
  }
2986
3008
  consola4.debug(
2987
3009
  "Found:",
2988
- directories.map((dir) => pc6.cyan(path6.relative(root, dir))).join(", ")
3010
+ directories.map((dir) => pc6.cyan(path7.relative(root, dir))).join(", ")
2989
3011
  );
2990
3012
  for (const directory of directories) {
2991
3013
  await fs13.rm(directory, { force: true, recursive: true });
2992
- consola4.debug("Deleted " + pc6.cyan(path6.relative(root, directory)));
3014
+ consola4.debug("Deleted " + pc6.cyan(path7.relative(root, directory)));
2993
3015
  }
2994
3016
  }
2995
3017
 
@@ -3193,8 +3215,8 @@ async function createServer(inlineConfig) {
3193
3215
  reloadContentScript(payload) {
3194
3216
  server.ws.send("wxt:reload-content-script", payload);
3195
3217
  },
3196
- reloadPage(path8) {
3197
- server.ws.send("wxt:reload-page", path8);
3218
+ reloadPage(path9) {
3219
+ server.ws.send("wxt:reload-page", path9);
3198
3220
  },
3199
3221
  reloadExtension() {
3200
3222
  server.ws.send("wxt:reload-extension");
@@ -3225,11 +3247,11 @@ async function getPort() {
3225
3247
  function createFileReloader(server) {
3226
3248
  const fileChangedMutex = new Mutex();
3227
3249
  const changeQueue = [];
3228
- return async (event, path8) => {
3250
+ return async (event, path9) => {
3229
3251
  await wxt.reloadConfig();
3230
- if (path8.startsWith(wxt.config.outBaseDir))
3252
+ if (path9.startsWith(wxt.config.outBaseDir))
3231
3253
  return;
3232
- changeQueue.push([event, path8]);
3254
+ changeQueue.push([event, path9]);
3233
3255
  await fileChangedMutex.runExclusive(async () => {
3234
3256
  if (server.currentOutput == null)
3235
3257
  return;
@@ -3308,8 +3330,8 @@ function reloadContentScripts(steps, server) {
3308
3330
  function reloadHtmlPages(groups, server) {
3309
3331
  const htmlEntries = groups.flat().filter(isHtmlEntrypoint);
3310
3332
  htmlEntries.forEach((entry) => {
3311
- const path8 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
3312
- server.reloadPage(path8);
3333
+ const path9 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
3334
+ server.reloadPage(path9);
3313
3335
  });
3314
3336
  return {
3315
3337
  reloadedNames: htmlEntries.map((entry) => entry.name)
@@ -3340,7 +3362,7 @@ import prompts from "prompts";
3340
3362
  import { consola as consola6 } from "consola";
3341
3363
  import { downloadTemplate } from "giget";
3342
3364
  import fs14 from "fs-extra";
3343
- import path7 from "node:path";
3365
+ import path8 from "node:path";
3344
3366
  import pc8 from "picocolors";
3345
3367
  async function initialize(options) {
3346
3368
  consola6.info("Initalizing new project");
@@ -3388,7 +3410,7 @@ async function initialize(options) {
3388
3410
  input.template ??= defaultTemplate;
3389
3411
  input.packageManager ??= options.packageManager;
3390
3412
  await cloneProject(input);
3391
- const cdPath = path7.relative(process.cwd(), path7.resolve(input.directory));
3413
+ const cdPath = path8.relative(process.cwd(), path8.resolve(input.directory));
3392
3414
  console.log();
3393
3415
  consola6.log(
3394
3416
  `\u2728 WXT project created with the ${TEMPLATE_COLORS[input.template.name]?.(input.template.name) ?? input.template.name} template.`
@@ -3432,8 +3454,8 @@ async function cloneProject({
3432
3454
  force: true
3433
3455
  });
3434
3456
  await fs14.move(
3435
- path7.join(directory, "_gitignore"),
3436
- path7.join(directory, ".gitignore")
3457
+ path8.join(directory, "_gitignore"),
3458
+ path8.join(directory, ".gitignore")
3437
3459
  ).catch(
3438
3460
  (err) => consola6.warn("Failed to move _gitignore to .gitignore:", err)
3439
3461
  );
@@ -3494,8 +3516,8 @@ async function zip(config) {
3494
3516
  const sourcesZipPath = resolve13(wxt.config.outBaseDir, sourcesZipFilename);
3495
3517
  await zipdir(wxt.config.zip.sourcesRoot, {
3496
3518
  saveTo: sourcesZipPath,
3497
- filter(path8) {
3498
- const relativePath = relative11(wxt.config.zip.sourcesRoot, path8);
3519
+ filter(path9) {
3520
+ const relativePath = relative11(wxt.config.zip.sourcesRoot, path9);
3499
3521
  return wxt.config.zip.includeSources.some(
3500
3522
  (pattern) => minimatch2(relativePath, pattern)
3501
3523
  ) || !wxt.config.zip.excludeSources.some(
@@ -3555,8 +3577,7 @@ function createAliasedCommand(base, name, alias, docsUrl) {
3555
3577
  const args = process.argv.slice(
3556
3578
  process.argv.indexOf(aliasedCommand.name) + 1
3557
3579
  );
3558
- const { execa } = await import("./execa-Y2EWTC4S.js");
3559
- await execa(alias, args, {
3580
+ await execaDependencyBin(alias, args, {
3560
3581
  stdio: "inherit"
3561
3582
  });
3562
3583
  } catch {
@@ -3654,7 +3675,7 @@ cli.command("init [directory]", "initialize a new project").option("-t, --templa
3654
3675
  createAliasedCommand(
3655
3676
  cli,
3656
3677
  "submit",
3657
- "wxt-publish-extension",
3678
+ "publish-extension",
3658
3679
  "https://www.npmjs.com/publish-browser-extension"
3659
3680
  );
3660
3681
  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(path11, options) {
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 && path11.substr(-p.length).toLowerCase() === 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, path11, options) {
60
+ function checkStat(stat, path12, options) {
61
61
  if (!stat.isSymbolicLink() && !stat.isFile()) {
62
62
  return false;
63
63
  }
64
- return checkPathExt(path11, options);
64
+ return checkPathExt(path12, options);
65
65
  }
66
- function isexe(path11, options, cb) {
67
- fs16.stat(path11, function(er, stat) {
68
- cb(er, er ? false : checkStat(stat, path11, options));
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(path11, options) {
72
- return checkStat(fs16.statSync(path11), path11, options);
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(path11, options, cb) {
85
- fs16.stat(path11, function(er, 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(path11, options) {
90
- return checkStat(fs16.statSync(path11), options);
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(path11, options, cb) {
124
+ function isexe(path12, 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(path11, options || {}, function(er, is) {
134
+ isexe(path12, 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(path11, options || {}, function(er, is) {
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(path11, options) {
153
+ function sync(path12, options) {
154
154
  try {
155
- return core.sync(path11, options || {});
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 path11 = require("path");
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" });
@@ -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 = path11.join(pathPart, cmd);
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
  });
@@ -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 = path11.join(pathPart, cmd);
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 path11 = require("path");
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 ? path11.delimiter : void 0
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 = path11.resolve(hasCustomCwd ? parsed.options.cwd : "", 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 [path11, argument] = match[0].replace(/#! ?/, "").split(" ");
367
- const binary = path11.split("/").pop();
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 path11 = require("path");
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 = path11.normalize(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 path11 = pathKey({ env });
594
- options.path = env[path11];
595
- env[path11] = npmRunPath(options);
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;
@@ -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(path11) {
2438
- return (0, import_normalize_path.default)(path11);
2437
+ function normalizePath(path12) {
2438
+ return (0, import_normalize_path.default)(path12);
2439
2439
  }
2440
- function unnormalizePath(path11) {
2441
- return import_node_path.default.normalize(path11);
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((path11) => ` | "/${path11}"`).sort().join("\n");
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 = (path11) => normalizePath((0, import_path3.relative)(dir, path11));
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 path11 = getPath(key);
3334
- await (0, import_fs_extra5.ensureDir)((0, import_path4.dirname)(path11));
3335
- await writeFileIfDifferent(path11, value);
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 path11 = getPath(key);
3338
+ const path12 = getPath(key);
3339
3339
  try {
3340
- return await import_fs_extra5.default.readFile(path11, "utf-8");
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 path11 = normalizePath(resolvedAbsolutePath);
3475
- if (!path11.startsWith("/"))
3476
- path11 = "/" + path11;
3477
- element.setAttribute(attr, `${server.origin}/@fs${path11}`);
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(path11) {
4415
- wxt.logger.debug("Loading file metadata:", path11);
4416
- const normalPath = normalizePath(path11);
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(path11, "utf-8");
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(path11);
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, path11);
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 import_fs_extra12 = __toESM(require("fs-extra"), 1);
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.2-alpha1";
4611
+ var version = "0.17.2-alpha2";
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 import_node_path14 = require("path");
5221
+ var import_node_path15 = require("path");
5222
5222
 
5223
5223
  // src/core/utils/validation.ts
5224
5224
  function validateEntrypoints(entrypoints) {
@@ -5281,6 +5281,29 @@ 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
5284
5307
  async function internalBuild() {
5285
5308
  await wxt.hooks.callHook("build:before", wxt);
5286
5309
  const verb = wxt.config.command === "serve" ? "Pre-rendering" : "Building";
@@ -5291,8 +5314,8 @@ async function internalBuild() {
5291
5314
  )}`
5292
5315
  );
5293
5316
  const startTime = Date.now();
5294
- await import_fs_extra12.default.rm(wxt.config.outDir, { recursive: true, force: true });
5295
- await import_fs_extra12.default.ensureDir(wxt.config.outDir);
5317
+ await import_fs_extra13.default.rm(wxt.config.outDir, { recursive: true, force: true });
5318
+ await import_fs_extra13.default.ensureDir(wxt.config.outDir);
5296
5319
  const entrypoints = await findEntrypoints();
5297
5320
  wxt.logger.debug("Detected entrypoints:", entrypoints);
5298
5321
  const validationResults = validateEntrypoints(entrypoints);
@@ -5318,7 +5341,7 @@ async function internalBuild() {
5318
5341
  }
5319
5342
  if (wxt.config.analysis.enabled) {
5320
5343
  await combineAnalysisStats();
5321
- const statsPath = (0, import_node_path14.relative)(wxt.config.root, wxt.config.analysis.outputFile);
5344
+ const statsPath = (0, import_node_path15.relative)(wxt.config.root, wxt.config.analysis.outputFile);
5322
5345
  wxt.logger.info(
5323
5346
  `Analysis complete:
5324
5347
  ${import_picocolors5.default.gray("\u2514\u2500")} ${import_picocolors5.default.yellow(statsPath)}`
@@ -5332,9 +5355,8 @@ async function combineAnalysisStats() {
5332
5355
  absolute: true
5333
5356
  });
5334
5357
  const absolutePaths = unixFiles.map(unnormalizePath);
5335
- const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
5336
- await execa2(
5337
- "wxt-rollup-plugin-visualizer",
5358
+ await execaDependencyBin(
5359
+ "rollup-plugin-visualizer",
5338
5360
  [
5339
5361
  ...absolutePaths,
5340
5362
  "--template",
@@ -5345,7 +5367,7 @@ async function combineAnalysisStats() {
5345
5367
  { cwd: wxt.config.root, stdio: "inherit" }
5346
5368
  );
5347
5369
  if (!wxt.config.analysis.keepArtifacts) {
5348
- await Promise.all(absolutePaths.map((statsFile) => import_fs_extra12.default.remove(statsFile)));
5370
+ await Promise.all(absolutePaths.map((statsFile) => import_fs_extra13.default.remove(statsFile)));
5349
5371
  }
5350
5372
  }
5351
5373
  function printValidationResults({
@@ -5364,7 +5386,7 @@ function printValidationResults({
5364
5386
  return map;
5365
5387
  }, /* @__PURE__ */ new Map());
5366
5388
  Array.from(entrypointErrors.entries()).forEach(([entrypoint, errors2]) => {
5367
- import_consola3.default.log((0, import_node_path14.relative)(cwd, entrypoint.inputPath));
5389
+ import_consola3.default.log((0, import_node_path15.relative)(cwd, entrypoint.inputPath));
5368
5390
  console.log();
5369
5391
  errors2.forEach((err) => {
5370
5392
  const type = err.type === "error" ? import_picocolors5.default.red("ERROR") : import_picocolors5.default.yellow("WARN");
@@ -5382,9 +5404,9 @@ async function build(config) {
5382
5404
  }
5383
5405
 
5384
5406
  // src/core/clean.ts
5385
- var import_node_path15 = __toESM(require("path"), 1);
5407
+ var import_node_path16 = __toESM(require("path"), 1);
5386
5408
  var import_fast_glob4 = __toESM(require("fast-glob"), 1);
5387
- var import_fs_extra13 = __toESM(require("fs-extra"), 1);
5409
+ var import_fs_extra14 = __toESM(require("fs-extra"), 1);
5388
5410
  var import_consola4 = require("consola");
5389
5411
  var import_picocolors6 = __toESM(require("picocolors"), 1);
5390
5412
  async function clean(root = process.cwd()) {
@@ -5397,7 +5419,7 @@ async function clean(root = process.cwd()) {
5397
5419
  ];
5398
5420
  import_consola4.consola.debug("Looking for:", tempDirs.map(import_picocolors6.default.cyan).join(", "));
5399
5421
  const directories = await (0, import_fast_glob4.default)(tempDirs, {
5400
- cwd: import_node_path15.default.resolve(root),
5422
+ cwd: import_node_path16.default.resolve(root),
5401
5423
  absolute: true,
5402
5424
  onlyDirectories: true,
5403
5425
  deep: 2
@@ -5408,11 +5430,11 @@ async function clean(root = process.cwd()) {
5408
5430
  }
5409
5431
  import_consola4.consola.debug(
5410
5432
  "Found:",
5411
- directories.map((dir) => import_picocolors6.default.cyan(import_node_path15.default.relative(root, dir))).join(", ")
5433
+ directories.map((dir) => import_picocolors6.default.cyan(import_node_path16.default.relative(root, dir))).join(", ")
5412
5434
  );
5413
5435
  for (const directory of directories) {
5414
- await import_fs_extra13.default.rm(directory, { force: true, recursive: true });
5415
- import_consola4.consola.debug("Deleted " + import_picocolors6.default.cyan(import_node_path15.default.relative(root, directory)));
5436
+ await import_fs_extra14.default.rm(directory, { force: true, recursive: true });
5437
+ import_consola4.consola.debug("Deleted " + import_picocolors6.default.cyan(import_node_path16.default.relative(root, directory)));
5416
5438
  }
5417
5439
  }
5418
5440
 
@@ -5427,12 +5449,12 @@ function defineRunnerConfig(config) {
5427
5449
  }
5428
5450
 
5429
5451
  // src/core/runners/wsl.ts
5430
- var import_node_path16 = require("path");
5452
+ var import_node_path17 = require("path");
5431
5453
  function createWslRunner() {
5432
5454
  return {
5433
5455
  async openBrowser() {
5434
5456
  wxt.logger.warn(
5435
- `Cannot open browser when using WSL. Load "${(0, import_node_path16.relative)(
5457
+ `Cannot open browser when using WSL. Load "${(0, import_node_path17.relative)(
5436
5458
  process.cwd(),
5437
5459
  wxt.config.outDir
5438
5460
  )}" as an unpacked extension manually`
@@ -5520,12 +5542,12 @@ var DEFAULT_CHROMIUM_PREFS = {
5520
5542
  };
5521
5543
 
5522
5544
  // src/core/runners/safari.ts
5523
- var import_node_path17 = require("path");
5545
+ var import_node_path18 = require("path");
5524
5546
  function createSafariRunner() {
5525
5547
  return {
5526
5548
  async openBrowser() {
5527
5549
  wxt.logger.warn(
5528
- `Cannot Safari using web-ext. Load "${(0, import_node_path17.relative)(
5550
+ `Cannot Safari using web-ext. Load "${(0, import_node_path18.relative)(
5529
5551
  process.cwd(),
5530
5552
  wxt.config.outDir
5531
5553
  )}" as an unpacked extension manually`
@@ -5537,12 +5559,12 @@ function createSafariRunner() {
5537
5559
  }
5538
5560
 
5539
5561
  // src/core/runners/manual.ts
5540
- var import_node_path18 = require("path");
5562
+ var import_node_path19 = require("path");
5541
5563
  function createManualRunner() {
5542
5564
  return {
5543
5565
  async openBrowser() {
5544
5566
  wxt.logger.info(
5545
- `Load "${(0, import_node_path18.relative)(
5567
+ `Load "${(0, import_node_path19.relative)(
5546
5568
  process.cwd(),
5547
5569
  wxt.config.outDir
5548
5570
  )}" as an unpacked extension manually`
@@ -5574,7 +5596,7 @@ async function createExtensionRunner() {
5574
5596
  var import_consola5 = require("consola");
5575
5597
  var import_async_mutex = require("async-mutex");
5576
5598
  var import_picocolors7 = __toESM(require("picocolors"), 1);
5577
- var import_node_path19 = require("path");
5599
+ var import_node_path20 = require("path");
5578
5600
  async function createServer(inlineConfig) {
5579
5601
  const port = await getPort();
5580
5602
  const hostname = "localhost";
@@ -5626,8 +5648,8 @@ async function createServer(inlineConfig) {
5626
5648
  reloadContentScript(payload) {
5627
5649
  server.ws.send("wxt:reload-content-script", payload);
5628
5650
  },
5629
- reloadPage(path11) {
5630
- server.ws.send("wxt:reload-page", path11);
5651
+ reloadPage(path12) {
5652
+ server.ws.send("wxt:reload-page", path12);
5631
5653
  },
5632
5654
  reloadExtension() {
5633
5655
  server.ws.send("wxt:reload-extension");
@@ -5658,11 +5680,11 @@ async function getPort() {
5658
5680
  function createFileReloader(server) {
5659
5681
  const fileChangedMutex = new import_async_mutex.Mutex();
5660
5682
  const changeQueue = [];
5661
- return async (event, path11) => {
5683
+ return async (event, path12) => {
5662
5684
  await wxt.reloadConfig();
5663
- if (path11.startsWith(wxt.config.outBaseDir))
5685
+ if (path12.startsWith(wxt.config.outBaseDir))
5664
5686
  return;
5665
- changeQueue.push([event, path11]);
5687
+ changeQueue.push([event, path12]);
5666
5688
  await fileChangedMutex.runExclusive(async () => {
5667
5689
  if (server.currentOutput == null)
5668
5690
  return;
@@ -5683,7 +5705,7 @@ function createFileReloader(server) {
5683
5705
  return;
5684
5706
  }
5685
5707
  wxt.logger.info(
5686
- `Changed: ${Array.from(new Set(fileChanges)).map((file) => import_picocolors7.default.dim((0, import_node_path19.relative)(wxt.config.root, file))).join(", ")}`
5708
+ `Changed: ${Array.from(new Set(fileChanges)).map((file) => import_picocolors7.default.dim((0, import_node_path20.relative)(wxt.config.root, file))).join(", ")}`
5687
5709
  );
5688
5710
  const allEntrypoints = await findEntrypoints();
5689
5711
  const { output: newOutput } = await rebuild(
@@ -5741,8 +5763,8 @@ function reloadContentScripts(steps, server) {
5741
5763
  function reloadHtmlPages(groups, server) {
5742
5764
  const htmlEntries = groups.flat().filter(isHtmlEntrypoint);
5743
5765
  htmlEntries.forEach((entry) => {
5744
- const path11 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
5745
- server.reloadPage(path11);
5766
+ const path12 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
5767
+ server.reloadPage(path12);
5746
5768
  });
5747
5769
  return {
5748
5770
  reloadedNames: htmlEntries.map((entry) => entry.name)
@@ -5772,8 +5794,8 @@ function getExternalOutputDependencies(server) {
5772
5794
  var import_prompts = __toESM(require("prompts"), 1);
5773
5795
  var import_consola6 = require("consola");
5774
5796
  var import_giget = require("giget");
5775
- var import_fs_extra14 = __toESM(require("fs-extra"), 1);
5776
- var import_node_path20 = __toESM(require("path"), 1);
5797
+ var import_fs_extra15 = __toESM(require("fs-extra"), 1);
5798
+ var import_node_path21 = __toESM(require("path"), 1);
5777
5799
  var import_picocolors8 = __toESM(require("picocolors"), 1);
5778
5800
  async function initialize(options) {
5779
5801
  import_consola6.consola.info("Initalizing new project");
@@ -5821,7 +5843,7 @@ async function initialize(options) {
5821
5843
  input.template ??= defaultTemplate;
5822
5844
  input.packageManager ??= options.packageManager;
5823
5845
  await cloneProject(input);
5824
- const cdPath = import_node_path20.default.relative(process.cwd(), import_node_path20.default.resolve(input.directory));
5846
+ const cdPath = import_node_path21.default.relative(process.cwd(), import_node_path21.default.resolve(input.directory));
5825
5847
  console.log();
5826
5848
  import_consola6.consola.log(
5827
5849
  `\u2728 WXT project created with the ${TEMPLATE_COLORS[input.template.name]?.(input.template.name) ?? input.template.name} template.`
@@ -5864,9 +5886,9 @@ async function cloneProject({
5864
5886
  dir: directory,
5865
5887
  force: true
5866
5888
  });
5867
- await import_fs_extra14.default.move(
5868
- import_node_path20.default.join(directory, "_gitignore"),
5869
- import_node_path20.default.join(directory, ".gitignore")
5889
+ await import_fs_extra15.default.move(
5890
+ import_node_path21.default.join(directory, "_gitignore"),
5891
+ import_node_path21.default.join(directory, ".gitignore")
5870
5892
  ).catch(
5871
5893
  (err) => import_consola6.consola.warn("Failed to move _gitignore to .gitignore:", err)
5872
5894
  );
@@ -5899,8 +5921,8 @@ async function prepare(config) {
5899
5921
 
5900
5922
  // src/core/zip.ts
5901
5923
  var import_zip_dir = __toESM(require("zip-dir"), 1);
5902
- var import_node_path21 = require("path");
5903
- var import_fs_extra15 = __toESM(require("fs-extra"), 1);
5924
+ var import_node_path22 = require("path");
5925
+ var import_fs_extra16 = __toESM(require("fs-extra"), 1);
5904
5926
  var import_minimatch2 = require("minimatch");
5905
5927
  async function zip(config) {
5906
5928
  await registerWxt("build", config);
@@ -5909,26 +5931,26 @@ async function zip(config) {
5909
5931
  wxt.logger.info("Zipping extension...");
5910
5932
  const zipFiles = [];
5911
5933
  const projectName = wxt.config.zip.name ?? kebabCaseAlphanumeric(
5912
- (await getPackageJson())?.name || (0, import_node_path21.dirname)(process.cwd())
5934
+ (await getPackageJson())?.name || (0, import_node_path22.dirname)(process.cwd())
5913
5935
  );
5914
5936
  const applyTemplate = (template) => template.replaceAll("{{name}}", projectName).replaceAll("{{browser}}", wxt.config.browser).replaceAll(
5915
5937
  "{{version}}",
5916
5938
  output.manifest.version_name ?? output.manifest.version
5917
5939
  ).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
5918
- await import_fs_extra15.default.ensureDir(wxt.config.outBaseDir);
5940
+ await import_fs_extra16.default.ensureDir(wxt.config.outBaseDir);
5919
5941
  const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
5920
- const outZipPath = (0, import_node_path21.resolve)(wxt.config.outBaseDir, outZipFilename);
5942
+ const outZipPath = (0, import_node_path22.resolve)(wxt.config.outBaseDir, outZipFilename);
5921
5943
  await (0, import_zip_dir.default)(wxt.config.outDir, {
5922
5944
  saveTo: outZipPath
5923
5945
  });
5924
5946
  zipFiles.push(outZipPath);
5925
5947
  if (wxt.config.browser === "firefox") {
5926
5948
  const sourcesZipFilename = applyTemplate(wxt.config.zip.sourcesTemplate);
5927
- const sourcesZipPath = (0, import_node_path21.resolve)(wxt.config.outBaseDir, sourcesZipFilename);
5949
+ const sourcesZipPath = (0, import_node_path22.resolve)(wxt.config.outBaseDir, sourcesZipFilename);
5928
5950
  await (0, import_zip_dir.default)(wxt.config.zip.sourcesRoot, {
5929
5951
  saveTo: sourcesZipPath,
5930
- filter(path11) {
5931
- const relativePath = (0, import_node_path21.relative)(wxt.config.zip.sourcesRoot, path11);
5952
+ filter(path12) {
5953
+ const relativePath = (0, import_node_path22.relative)(wxt.config.zip.sourcesRoot, path12);
5932
5954
  return wxt.config.zip.includeSources.some(
5933
5955
  (pattern) => (0, import_minimatch2.minimatch)(relativePath, pattern)
5934
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.2-alpha1";
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.2-alpha1";
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
@@ -17,7 +17,7 @@ import {
17
17
  unnormalizePath,
18
18
  version,
19
19
  wxt
20
- } from "./chunk-5I3RQIJ6.js";
20
+ } from "./chunk-7E4MYYBY.js";
21
21
  import "./chunk-VBXJIVYU.js";
22
22
 
23
23
  // src/core/build.ts
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(path7) {
48
- return (0, import_normalize_path.default)(path7);
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 path7 = normalizePath(resolvedAbsolutePath);
195
- if (!path7.startsWith("/"))
196
- path7 = "/" + path7;
197
- element.setAttribute(attr, `${server.origin}/@fs${path7}`);
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 path7 = getPath(key);
735
- await (0, import_fs_extra7.ensureDir)((0, import_path3.dirname)(path7));
736
- await writeFileIfDifferent(path7, value);
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 path7 = getPath(key);
739
+ const path8 = getPath(key);
740
740
  try {
741
- return await import_fs_extra7.default.readFile(path7, "utf-8");
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 import_fs_extra12 = __toESM(require("fs-extra"), 1);
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);
@@ -1267,9 +1267,13 @@ var import_fs_extra11 = __toESM(require("fs-extra"), 1);
1267
1267
  var import_defu2 = __toESM(require("defu"), 1);
1268
1268
 
1269
1269
  // src/core/utils/building/internal-build.ts
1270
- var import_node_path12 = require("path");
1270
+ var import_node_path13 = 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
+
1273
1277
  // src/testing/wxt-vitest-plugin.ts
1274
1278
  function WxtVitest(inlineConfig) {
1275
1279
  return resolveConfig(inlineConfig ?? {}, "serve").then((config) => [
package/dist/testing.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  tsconfigPaths,
6
6
  unimport,
7
7
  webextensionPolyfillMock
8
- } from "./chunk-5I3RQIJ6.js";
8
+ } from "./chunk-7E4MYYBY.js";
9
9
  import "./chunk-VBXJIVYU.js";
10
10
 
11
11
  // src/testing/fake-browser.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.17.2-alpha1",
4
+ "version": "0.17.2-alpha2",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",
@@ -30,11 +30,7 @@
30
30
  "bin",
31
31
  "dist"
32
32
  ],
33
- "bin": {
34
- "wxt": "./bin/wxt.mjs",
35
- "wxt-publish-extension": "./bin/wxt-publish-extension.mjs",
36
- "wxt-rollup-plugin-visualizer": "./bin/wxt-rollup-plugin-visualizer.mjs"
37
- },
33
+ "bin": "./bin/wxt.mjs",
38
34
  "main": "./dist/index.cjs",
39
35
  "module": "./dist/index.js",
40
36
  "types": "./dist/index.d.ts",
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- await import('publish-browser-extension/dist/cli.cjs');
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- await import('rollup-plugin-visualizer/dist/bin/cli.js');
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }