wxt 0.16.3 → 0.16.5

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/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(path7) {
15
- return normalize(path7);
14
+ function normalizePath(path8) {
15
+ return normalize(path8);
16
16
  }
17
- function unnormalizePath(path7) {
18
- return systemPath.normalize(path7);
17
+ function unnormalizePath(path8) {
18
+ return systemPath.normalize(path8);
19
19
  }
20
20
  var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
21
21
  var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
@@ -68,6 +68,7 @@ async function buildEntrypoints(groups, spinner) {
68
68
  try {
69
69
  steps.push(await wxt.config.builder.build(group));
70
70
  } catch (err) {
71
+ wxt.logger.error(err);
71
72
  throw Error(`Failed to build ${groupNames.join(", ")}`, { cause: err });
72
73
  }
73
74
  }
@@ -747,7 +748,7 @@ async function writePathsDeclarationFile(entrypoints) {
747
748
  wxt.config.outDir,
748
749
  entry.inputPath.endsWith(".html") ? ".html" : ".js"
749
750
  )
750
- ).concat(await getPublicFiles()).map(normalizePath).map((path7) => ` | "/${path7}"`).sort().join("\n");
751
+ ).concat(await getPublicFiles()).map(normalizePath).map((path8) => ` | "/${path8}"`).sort().join("\n");
751
752
  const template = `// Generated by wxt
752
753
  import "wxt/browser";
753
754
 
@@ -855,7 +856,7 @@ async function writeMainDeclarationFile(references) {
855
856
  }
856
857
  async function writeTsConfigFile(mainReference) {
857
858
  const dir = wxt.config.wxtDir;
858
- const getTsconfigPath = (path7) => normalizePath(relative3(dir, path7));
859
+ const getTsconfigPath = (path8) => normalizePath(relative3(dir, path8));
859
860
  const paths = Object.entries(wxt.config.alias).flatMap(([alias, absolutePath]) => {
860
861
  const aliasPath = getTsconfigPath(absolutePath);
861
862
  return [
@@ -891,7 +892,7 @@ ${paths}
891
892
 
892
893
  // src/core/utils/building/resolve-config.ts
893
894
  import { loadConfig } from "c12";
894
- import path3 from "node:path";
895
+ import path4 from "node:path";
895
896
 
896
897
  // src/core/utils/cache.ts
897
898
  import fs5, { ensureDir } from "fs-extra";
@@ -900,14 +901,14 @@ function createFsCache(wxtDir) {
900
901
  const getPath = (key) => resolve5(wxtDir, "cache", encodeURIComponent(key));
901
902
  return {
902
903
  async set(key, value) {
903
- const path7 = getPath(key);
904
- await ensureDir(dirname2(path7));
905
- await writeFileIfDifferent(path7, value);
904
+ const path8 = getPath(key);
905
+ await ensureDir(dirname2(path8));
906
+ await writeFileIfDifferent(path8, value);
906
907
  },
907
908
  async get(key) {
908
- const path7 = getPath(key);
909
+ const path8 = getPath(key);
909
910
  try {
910
- return await fs5.readFile(path7, "utf-8");
911
+ return await fs5.readFile(path8, "utf-8");
911
912
  } catch {
912
913
  return void 0;
913
914
  }
@@ -1041,10 +1042,10 @@ function pointToDevServer(config, server, id, document, querySelector, attr) {
1041
1042
  relative4(config.root, resolvedAbsolutePath)
1042
1043
  );
1043
1044
  if (relativePath.startsWith(".")) {
1044
- let path7 = normalizePath(resolvedAbsolutePath);
1045
- if (!path7.startsWith("/"))
1046
- path7 = "/" + path7;
1047
- element.setAttribute(attr, `${server.origin}/@fs${path7}`);
1045
+ let path8 = normalizePath(resolvedAbsolutePath);
1046
+ if (!path8.startsWith("/"))
1047
+ path8 = "/" + path8;
1048
+ element.setAttribute(attr, `${server.origin}/@fs${path8}`);
1048
1049
  } else {
1049
1050
  const url = new URL(relativePath, server.origin);
1050
1051
  element.setAttribute(attr, url.href);
@@ -1341,12 +1342,12 @@ function cssEntrypoints(entrypoint, config) {
1341
1342
 
1342
1343
  // src/core/builders/vite/plugins/bundleAnalysis.ts
1343
1344
  import { visualizer } from "rollup-plugin-visualizer";
1345
+ import path3 from "node:path";
1344
1346
  var increment = 0;
1345
- function bundleAnalysis() {
1347
+ function bundleAnalysis(config) {
1346
1348
  return visualizer({
1347
- emitFile: true,
1348
1349
  template: "raw-data",
1349
- filename: `stats-${increment++}.json`
1350
+ filename: path3.resolve(config.outDir, `stats-${increment++}.json`)
1350
1351
  });
1351
1352
  }
1352
1353
 
@@ -1462,7 +1463,7 @@ async function createViteBuilder(inlineConfig, userConfig, wxtConfig) {
1462
1463
  defineImportMeta()
1463
1464
  );
1464
1465
  if (wxtConfig.analysis.enabled) {
1465
- config.plugins.push(bundleAnalysis());
1466
+ config.plugins.push(bundleAnalysis(wxtConfig));
1466
1467
  }
1467
1468
  return config;
1468
1469
  };
@@ -1663,20 +1664,20 @@ async function resolveConfig(inlineConfig, command, server) {
1663
1664
  const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
1664
1665
  const mode = mergedConfig.mode ?? (command === "build" ? "production" : "development");
1665
1666
  const env = { browser, command, manifestVersion, mode };
1666
- const root = path3.resolve(
1667
+ const root = path4.resolve(
1667
1668
  inlineConfig.root ?? userConfig.root ?? process.cwd()
1668
1669
  );
1669
- const wxtDir = path3.resolve(root, ".wxt");
1670
- const srcDir = path3.resolve(root, mergedConfig.srcDir ?? root);
1671
- const entrypointsDir = path3.resolve(
1670
+ const wxtDir = path4.resolve(root, ".wxt");
1671
+ const srcDir = path4.resolve(root, mergedConfig.srcDir ?? root);
1672
+ const entrypointsDir = path4.resolve(
1672
1673
  srcDir,
1673
1674
  mergedConfig.entrypointsDir ?? "entrypoints"
1674
1675
  );
1675
1676
  const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
1676
- const publicDir = path3.resolve(srcDir, mergedConfig.publicDir ?? "public");
1677
- const typesDir = path3.resolve(wxtDir, "types");
1678
- const outBaseDir = path3.resolve(root, mergedConfig.outDir ?? ".output");
1679
- const outDir = path3.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
1677
+ const publicDir = path4.resolve(srcDir, mergedConfig.publicDir ?? "public");
1678
+ const typesDir = path4.resolve(wxtDir, "types");
1679
+ const outBaseDir = path4.resolve(root, mergedConfig.outDir ?? ".output");
1680
+ const outDir = path4.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
1680
1681
  const reloadCommand = mergedConfig.dev?.reloadCommand ?? "Alt+R";
1681
1682
  const runnerConfig = await loadConfig({
1682
1683
  name: "web-ext",
@@ -1693,7 +1694,7 @@ async function resolveConfig(inlineConfig, command, server) {
1693
1694
  "~": srcDir,
1694
1695
  "@@": root,
1695
1696
  "~~": root
1696
- }).map(([key, value]) => [key, path3.resolve(root, value)])
1697
+ }).map(([key, value]) => [key, path4.resolve(root, value)])
1697
1698
  );
1698
1699
  const finalConfig = {
1699
1700
  browser,
@@ -1723,7 +1724,11 @@ async function resolveConfig(inlineConfig, command, server) {
1723
1724
  },
1724
1725
  analysis: {
1725
1726
  enabled: mergedConfig.analysis?.enabled ?? false,
1726
- template: mergedConfig.analysis?.template ?? "treemap"
1727
+ template: mergedConfig.analysis?.template ?? "treemap",
1728
+ outputFile: path4.resolve(
1729
+ root,
1730
+ mergedConfig.analysis?.outputFile ?? "stats.html"
1731
+ )
1727
1732
  },
1728
1733
  userConfigMetadata: userConfigMetadata ?? {},
1729
1734
  alias,
@@ -1793,8 +1798,8 @@ function mergeInlineConfig(inlineConfig, userConfig) {
1793
1798
  outDir: inlineConfig.outDir ?? userConfig.outDir,
1794
1799
  zip: zip2,
1795
1800
  analysis: {
1796
- enabled: inlineConfig.analysis?.enabled ?? userConfig.analysis?.enabled,
1797
- template: inlineConfig.analysis?.template ?? userConfig.analysis?.template
1801
+ ...userConfig.analysis,
1802
+ ...inlineConfig.analysis
1798
1803
  },
1799
1804
  alias: {
1800
1805
  ...userConfig.alias,
@@ -1901,16 +1906,16 @@ ${noImports}`;
1901
1906
  // src/core/utils/building/import-entrypoint.ts
1902
1907
  import { transformSync } from "esbuild";
1903
1908
  import { fileURLToPath } from "node:url";
1904
- async function importEntrypointFile(path7) {
1905
- wxt.logger.debug("Loading file metadata:", path7);
1906
- const normalPath = normalizePath(path7);
1909
+ async function importEntrypointFile(path8) {
1910
+ wxt.logger.debug("Loading file metadata:", path8);
1911
+ const normalPath = normalizePath(path8);
1907
1912
  const unimport2 = createUnimport3({
1908
1913
  ...getUnimportOptions(wxt.config),
1909
1914
  // Only allow specific imports, not all from the project
1910
1915
  dirs: []
1911
1916
  });
1912
1917
  await unimport2.init();
1913
- const text = await fs8.readFile(path7, "utf-8");
1918
+ const text = await fs8.readFile(path8, "utf-8");
1914
1919
  const textNoImports = removeProjectImportStatements(text);
1915
1920
  const { code } = await unimport2.injectImports(textNoImports);
1916
1921
  wxt.logger.debug(
@@ -1953,10 +1958,10 @@ async function importEntrypointFile(path7) {
1953
1958
  }
1954
1959
  );
1955
1960
  try {
1956
- const res = await jiti(path7);
1961
+ const res = await jiti(path8);
1957
1962
  return res.default;
1958
1963
  } catch (err) {
1959
- const filePath = relative5(wxt.config.root, path7);
1964
+ const filePath = relative5(wxt.config.root, path8);
1960
1965
  if (err instanceof ReferenceError) {
1961
1966
  const variableName = err.message.replace(" is not defined", "");
1962
1967
  throw Error(
@@ -1986,7 +1991,7 @@ import fs12 from "fs-extra";
1986
1991
  import { resolve as resolve10 } from "path";
1987
1992
 
1988
1993
  // src/core/utils/log/printFileList.ts
1989
- import path4 from "node:path";
1994
+ import path5 from "node:path";
1990
1995
  import pc3 from "picocolors";
1991
1996
  import fs9 from "fs-extra";
1992
1997
  import { filesize } from "filesize";
@@ -2024,8 +2029,8 @@ async function printFileList(log, header, baseDir, files) {
2024
2029
  const fileRows = await Promise.all(
2025
2030
  files.map(async (file, i) => {
2026
2031
  const parts = [
2027
- path4.relative(process.cwd(), baseDir) + path4.sep,
2028
- path4.relative(baseDir, file)
2032
+ path5.relative(process.cwd(), baseDir) + path5.sep,
2033
+ path5.relative(baseDir, file)
2029
2034
  ];
2030
2035
  const prefix = i === files.length - 1 ? " \u2514\u2500" : " \u251C\u2500";
2031
2036
  const color = getChunkColor(file);
@@ -2093,7 +2098,7 @@ function getChunkSortWeight(filename) {
2093
2098
  import pc4 from "picocolors";
2094
2099
 
2095
2100
  // package.json
2096
- var version = "0.16.3";
2101
+ var version = "0.16.5";
2097
2102
 
2098
2103
  // src/core/utils/log/printHeader.ts
2099
2104
  import { consola as consola2 } from "consola";
@@ -2226,7 +2231,6 @@ async function getPackageJson() {
2226
2231
  }
2227
2232
 
2228
2233
  // src/core/utils/manifest.ts
2229
- import { produce } from "immer";
2230
2234
  import defu3 from "defu";
2231
2235
  async function writeManifest(manifest, output) {
2232
2236
  const str = wxt.config.mode === "production" ? JSON.stringify(manifest) : JSON.stringify(manifest, null, 2);
@@ -2257,7 +2261,7 @@ async function generateManifest(entrypoints, buildOutput) {
2257
2261
  icons: discoverIcons(buildOutput)
2258
2262
  };
2259
2263
  const userManifest = wxt.config.manifest;
2260
- const manifest = defu3(
2264
+ let manifest = defu3(
2261
2265
  userManifest,
2262
2266
  baseManifest
2263
2267
  );
@@ -2284,19 +2288,24 @@ async function generateManifest(entrypoints, buildOutput) {
2284
2288
  addDevModeCsp(manifest);
2285
2289
  if (wxt.config.command === "serve")
2286
2290
  addDevModePermissions(manifest);
2287
- const finalManifest = produce(manifest, wxt.config.transformManifest);
2288
- await wxt.hooks.callHook("build:manifestGenerated", wxt, finalManifest);
2289
- if (finalManifest.name == null)
2291
+ wxt.config.transformManifest(manifest);
2292
+ await wxt.hooks.callHook("build:manifestGenerated", wxt, manifest);
2293
+ if (wxt.config.manifestVersion === 2)
2294
+ convertWebAccessibleResourcesToMv2(manifest);
2295
+ if (wxt.config.manifestVersion === 3) {
2296
+ validateMv3WebAccessbileResources(manifest);
2297
+ }
2298
+ if (manifest.name == null)
2290
2299
  throw Error(
2291
2300
  "Manifest 'name' is missing. Either:\n1. Set the name in your <rootDir>/package.json\n2. Set a name via the manifest option in your wxt.config.ts"
2292
2301
  );
2293
- if (finalManifest.version == null) {
2302
+ if (manifest.version == null) {
2294
2303
  throw Error(
2295
2304
  "Manifest 'version' is missing. Either:\n1. Add a version in your <rootDir>/package.json\n2. Pass the version via the manifest option in your wxt.config.ts"
2296
2305
  );
2297
2306
  }
2298
2307
  return {
2299
- manifest: finalManifest,
2308
+ manifest,
2300
2309
  warnings
2301
2310
  };
2302
2311
  }
@@ -2599,17 +2608,13 @@ function getContentScriptCssWebAccessibleResources(contentScripts, contentScript
2599
2608
  const cssFile = contentScriptCssMap[script.name];
2600
2609
  if (cssFile == null)
2601
2610
  return;
2602
- if (wxt.config.manifestVersion === 2) {
2603
- resources.push(cssFile);
2604
- } else {
2605
- resources.push({
2606
- resources: [cssFile],
2607
- matches: resolvePerBrowserOption(
2608
- script.options.matches,
2609
- wxt.config.browser
2610
- ).map((matchPattern) => stripPathFromMatchPattern(matchPattern))
2611
- });
2612
- }
2611
+ resources.push({
2612
+ resources: [cssFile],
2613
+ matches: resolvePerBrowserOption(
2614
+ script.options.matches,
2615
+ wxt.config.browser
2616
+ ).map((matchPattern) => stripPathFromMatchPattern(matchPattern))
2617
+ });
2613
2618
  });
2614
2619
  return resources;
2615
2620
  }
@@ -2644,6 +2649,33 @@ function stripPathFromMatchPattern(pattern) {
2644
2649
  const startOfPath = pattern.indexOf("/", protocolSepIndex + 3);
2645
2650
  return pattern.substring(0, startOfPath) + "/*";
2646
2651
  }
2652
+ function convertWebAccessibleResourcesToMv2(manifest) {
2653
+ if (manifest.web_accessible_resources == null)
2654
+ return;
2655
+ manifest.web_accessible_resources = Array.from(
2656
+ new Set(
2657
+ manifest.web_accessible_resources.flatMap((item) => {
2658
+ if (typeof item === "string")
2659
+ return item;
2660
+ return item.resources;
2661
+ })
2662
+ )
2663
+ );
2664
+ }
2665
+ function validateMv3WebAccessbileResources(manifest) {
2666
+ if (manifest.web_accessible_resources == null)
2667
+ return;
2668
+ const stringResources = manifest.web_accessible_resources.filter(
2669
+ (item) => typeof item === "string"
2670
+ );
2671
+ if (stringResources.length > 0) {
2672
+ throw Error(
2673
+ `Non-MV3 web_accessible_resources detected: ${JSON.stringify(
2674
+ stringResources
2675
+ )}. When manually defining web_accessible_resources, define them as MV3 objects ({ matches: [...], resources: [...] }), and WXT will automatically convert them to MV2 when necessary.`
2676
+ );
2677
+ }
2678
+ }
2647
2679
 
2648
2680
  // src/core/utils/building/rebuild.ts
2649
2681
  async function rebuild(allEntrypoints, entrypointGroups, existingOutput = {
@@ -2799,9 +2831,10 @@ async function internalBuild() {
2799
2831
  }
2800
2832
  if (wxt.config.analysis.enabled) {
2801
2833
  await combineAnalysisStats();
2834
+ const statsPath = relative6(wxt.config.root, wxt.config.analysis.outputFile);
2802
2835
  wxt.logger.info(
2803
2836
  `Analysis complete:
2804
- ${pc5.gray("\u2514\u2500")} ${pc5.yellow("stats.html")}`
2837
+ ${pc5.gray("\u2514\u2500")} ${pc5.yellow(statsPath)}`
2805
2838
  );
2806
2839
  }
2807
2840
  return output;
@@ -2814,9 +2847,16 @@ async function combineAnalysisStats() {
2814
2847
  const absolutePaths = unixFiles.map(unnormalizePath);
2815
2848
  await exec(
2816
2849
  "rollup-plugin-visualizer",
2817
- [...absolutePaths, "--template", wxt.config.analysis.template],
2850
+ [
2851
+ ...absolutePaths,
2852
+ "--template",
2853
+ wxt.config.analysis.template,
2854
+ "--filename",
2855
+ wxt.config.analysis.outputFile
2856
+ ],
2818
2857
  { cwd: wxt.config.root, stdio: "inherit" }
2819
2858
  );
2859
+ await Promise.all(absolutePaths.map((statsFile) => fs12.remove(statsFile)));
2820
2860
  }
2821
2861
  function printValidationResults({
2822
2862
  errorCount,
@@ -2852,7 +2892,7 @@ async function build(config) {
2852
2892
  }
2853
2893
 
2854
2894
  // src/core/clean.ts
2855
- import path5 from "node:path";
2895
+ import path6 from "node:path";
2856
2896
  import glob4 from "fast-glob";
2857
2897
  import fs13 from "fs-extra";
2858
2898
  import { consola as consola4 } from "consola";
@@ -2867,7 +2907,7 @@ async function clean(root = process.cwd()) {
2867
2907
  ];
2868
2908
  consola4.debug("Looking for:", tempDirs.map(pc6.cyan).join(", "));
2869
2909
  const directories = await glob4(tempDirs, {
2870
- cwd: path5.resolve(root),
2910
+ cwd: path6.resolve(root),
2871
2911
  absolute: true,
2872
2912
  onlyDirectories: true,
2873
2913
  deep: 2
@@ -2878,11 +2918,11 @@ async function clean(root = process.cwd()) {
2878
2918
  }
2879
2919
  consola4.debug(
2880
2920
  "Found:",
2881
- directories.map((dir) => pc6.cyan(path5.relative(root, dir))).join(", ")
2921
+ directories.map((dir) => pc6.cyan(path6.relative(root, dir))).join(", ")
2882
2922
  );
2883
2923
  for (const directory of directories) {
2884
2924
  await fs13.rm(directory, { force: true, recursive: true });
2885
- consola4.debug("Deleted " + pc6.cyan(path5.relative(root, directory)));
2925
+ consola4.debug("Deleted " + pc6.cyan(path6.relative(root, directory)));
2886
2926
  }
2887
2927
  }
2888
2928
 
@@ -3081,8 +3121,8 @@ async function createServer(inlineConfig) {
3081
3121
  reloadContentScript(contentScript) {
3082
3122
  server.ws.send("wxt:reload-content-script", contentScript);
3083
3123
  },
3084
- reloadPage(path7) {
3085
- server.ws.send("wxt:reload-page", path7);
3124
+ reloadPage(path8) {
3125
+ server.ws.send("wxt:reload-page", path8);
3086
3126
  },
3087
3127
  reloadExtension() {
3088
3128
  server.ws.send("wxt:reload-extension");
@@ -3113,11 +3153,11 @@ async function getPort() {
3113
3153
  function createFileReloader(server) {
3114
3154
  const fileChangedMutex = new Mutex();
3115
3155
  const changeQueue = [];
3116
- return async (event, path7) => {
3156
+ return async (event, path8) => {
3117
3157
  await wxt.reloadConfig();
3118
- if (path7.startsWith(wxt.config.outBaseDir))
3158
+ if (path8.startsWith(wxt.config.outBaseDir))
3119
3159
  return;
3120
- changeQueue.push([event, path7]);
3160
+ changeQueue.push([event, path8]);
3121
3161
  await fileChangedMutex.runExclusive(async () => {
3122
3162
  if (server.currentOutput == null)
3123
3163
  return;
@@ -3207,8 +3247,8 @@ function reloadContentScripts(steps, server) {
3207
3247
  function reloadHtmlPages(groups, server) {
3208
3248
  const htmlEntries = groups.flat().filter((entry) => entry.inputPath.endsWith(".html"));
3209
3249
  htmlEntries.forEach((entry) => {
3210
- const path7 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
3211
- server.reloadPage(path7);
3250
+ const path8 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
3251
+ server.reloadPage(path8);
3212
3252
  });
3213
3253
  return {
3214
3254
  reloadedNames: htmlEntries.map((entry) => entry.name)
@@ -3225,7 +3265,7 @@ import prompts from "prompts";
3225
3265
  import { consola as consola6 } from "consola";
3226
3266
  import { downloadTemplate } from "giget";
3227
3267
  import fs14 from "fs-extra";
3228
- import path6 from "node:path";
3268
+ import path7 from "node:path";
3229
3269
  import pc8 from "picocolors";
3230
3270
  async function initialize(options) {
3231
3271
  consola6.info("Initalizing new project");
@@ -3273,7 +3313,7 @@ async function initialize(options) {
3273
3313
  input.template ??= defaultTemplate;
3274
3314
  input.packageManager ??= options.packageManager;
3275
3315
  await cloneProject(input);
3276
- const cdPath = path6.relative(process.cwd(), path6.resolve(input.directory));
3316
+ const cdPath = path7.relative(process.cwd(), path7.resolve(input.directory));
3277
3317
  console.log();
3278
3318
  consola6.log(
3279
3319
  `\u2728 WXT project created with the ${TEMPLATE_COLORS[input.template.name]?.(input.template.name) ?? input.template.name} template.`
@@ -3317,8 +3357,8 @@ async function cloneProject({
3317
3357
  force: true
3318
3358
  });
3319
3359
  await fs14.move(
3320
- path6.join(directory, "_gitignore"),
3321
- path6.join(directory, ".gitignore")
3360
+ path7.join(directory, "_gitignore"),
3361
+ path7.join(directory, ".gitignore")
3322
3362
  ).catch(
3323
3363
  (err) => consola6.warn("Failed to move _gitignore to .gitignore:", err)
3324
3364
  );
@@ -3379,8 +3419,8 @@ async function zip(config) {
3379
3419
  const sourcesZipPath = resolve14(wxt.config.outBaseDir, sourcesZipFilename);
3380
3420
  await zipdir(wxt.config.zip.sourcesRoot, {
3381
3421
  saveTo: sourcesZipPath,
3382
- filter(path7) {
3383
- const relativePath = relative11(wxt.config.zip.sourcesRoot, path7);
3422
+ filter(path8) {
3423
+ const relativePath = relative11(wxt.config.zip.sourcesRoot, path8);
3384
3424
  return wxt.config.zip.includeSources.some(
3385
3425
  (pattern) => minimatch2(relativePath, pattern)
3386
3426
  ) || !wxt.config.zip.excludeSources.some(
@@ -303,6 +303,12 @@ interface InlineConfig {
303
303
  * @default "treemap"
304
304
  */
305
305
  template?: PluginVisualizerOptions['template'];
306
+ /**
307
+ * Name of the output HTML file. Relative to the project's root directory.
308
+ *
309
+ * @default "stats.html"
310
+ */
311
+ outputFile?: string;
306
312
  };
307
313
  /**
308
314
  * Add additional paths to the `.wxt/tsconfig.json`. Use this instead of overwriting the `paths`
@@ -895,6 +901,8 @@ interface ResolvedConfig {
895
901
  analysis: {
896
902
  enabled: boolean;
897
903
  template: NonNullable<PluginVisualizerOptions['template']>;
904
+ /** Absolute file path */
905
+ outputFile: string;
898
906
  };
899
907
  userConfigMetadata: Omit<ResolvedConfig$1<UserConfig>, 'config'>;
900
908
  /**
@@ -303,6 +303,12 @@ interface InlineConfig {
303
303
  * @default "treemap"
304
304
  */
305
305
  template?: PluginVisualizerOptions['template'];
306
+ /**
307
+ * Name of the output HTML file. Relative to the project's root directory.
308
+ *
309
+ * @default "stats.html"
310
+ */
311
+ outputFile?: string;
306
312
  };
307
313
  /**
308
314
  * Add additional paths to the `.wxt/tsconfig.json`. Use this instead of overwriting the `paths`
@@ -895,6 +901,8 @@ interface ResolvedConfig {
895
901
  analysis: {
896
902
  enabled: boolean;
897
903
  template: NonNullable<PluginVisualizerOptions['template']>;
904
+ /** Absolute file path */
905
+ outputFile: string;
898
906
  };
899
907
  userConfigMetadata: Omit<ResolvedConfig$1<UserConfig>, 'config'>;
900
908
  /**