wxt 0.17.5 → 0.17.7

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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-VBXJIVYU.js";
4
4
 
5
5
  // package.json
6
- var version = "0.17.5";
6
+ var version = "0.17.7";
7
7
 
8
8
  // src/core/utils/paths.ts
9
9
  import systemPath from "node:path";
@@ -1674,6 +1674,7 @@ function isModuleInstalled(name) {
1674
1674
  }
1675
1675
 
1676
1676
  // src/core/utils/building/resolve-config.ts
1677
+ import fs9 from "fs-extra";
1677
1678
  async function resolveConfig(inlineConfig, command, server) {
1678
1679
  let userConfig = {};
1679
1680
  let userConfigMetadata;
@@ -1709,8 +1710,14 @@ async function resolveConfig(inlineConfig, command, server) {
1709
1710
  srcDir,
1710
1711
  mergedConfig.entrypointsDir ?? "entrypoints"
1711
1712
  );
1713
+ if (await isDirMissing(entrypointsDir)) {
1714
+ logMissingDir(logger, "Entrypoints", entrypointsDir);
1715
+ }
1712
1716
  const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
1713
1717
  const publicDir = path5.resolve(srcDir, mergedConfig.publicDir ?? "public");
1718
+ if (await isDirMissing(publicDir)) {
1719
+ logMissingDir(logger, "Public", publicDir);
1720
+ }
1714
1721
  const typesDir = path5.resolve(wxtDir, "types");
1715
1722
  const outBaseDir = path5.resolve(root, mergedConfig.outDir ?? ".output");
1716
1723
  const outDir = path5.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
@@ -1928,6 +1935,16 @@ async function resolveWxtModuleDir() {
1928
1935
  const requireResolve = __require?.resolve ?? (await import("node:module")).default.createRequire(import.meta.url).resolve;
1929
1936
  return path5.resolve(requireResolve("wxt"), "../..");
1930
1937
  }
1938
+ async function isDirMissing(dir) {
1939
+ return !await fs9.exists(dir);
1940
+ }
1941
+ function logMissingDir(logger, name, expected) {
1942
+ logger.warn(
1943
+ `${name} directory not found: ./${normalizePath(
1944
+ path5.relative(process.cwd(), expected)
1945
+ )}`
1946
+ );
1947
+ }
1931
1948
 
1932
1949
  // src/core/utils/building/group-entrypoints.ts
1933
1950
  function groupEntrypoints(entrypoints) {
@@ -1971,7 +1988,7 @@ var ENTRY_TYPE_TO_GROUP_MAP = {
1971
1988
  // src/core/utils/building/import-entrypoint.ts
1972
1989
  import createJITI from "jiti";
1973
1990
  import { createUnimport as createUnimport3 } from "unimport";
1974
- import fs9 from "fs-extra";
1991
+ import fs10 from "fs-extra";
1975
1992
  import { relative as relative5, resolve as resolve10 } from "node:path";
1976
1993
 
1977
1994
  // src/core/utils/strings.ts
@@ -2003,7 +2020,7 @@ async function importEntrypointFile(path8) {
2003
2020
  dirs: []
2004
2021
  });
2005
2022
  await unimport2.init();
2006
- const text = await fs9.readFile(path8, "utf-8");
2023
+ const text = await fs10.readFile(path8, "utf-8");
2007
2024
  const textNoImports = removeProjectImportStatements(text);
2008
2025
  const { code } = await unimport2.injectImports(textNoImports);
2009
2026
  wxt.logger.debug(
@@ -2078,7 +2095,7 @@ function getEsbuildOptions(opts) {
2078
2095
 
2079
2096
  // src/core/utils/building/internal-build.ts
2080
2097
  import pc5 from "picocolors";
2081
- import fs12 from "fs-extra";
2098
+ import fs13 from "fs-extra";
2082
2099
 
2083
2100
  // src/core/utils/log/printBuildSummary.ts
2084
2101
  import { resolve as resolve11 } from "path";
@@ -2086,7 +2103,7 @@ import { resolve as resolve11 } from "path";
2086
2103
  // src/core/utils/log/printFileList.ts
2087
2104
  import path6 from "node:path";
2088
2105
  import pc3 from "picocolors";
2089
- import fs10 from "fs-extra";
2106
+ import fs11 from "fs-extra";
2090
2107
  import { filesize } from "filesize";
2091
2108
 
2092
2109
  // src/core/utils/log/printTable.ts
@@ -2127,7 +2144,7 @@ async function printFileList(log, header, baseDir, files) {
2127
2144
  ];
2128
2145
  const prefix = i === files.length - 1 ? " \u2514\u2500" : " \u251C\u2500";
2129
2146
  const color = getChunkColor(file);
2130
- const stats = await fs10.lstat(file);
2147
+ const stats = await fs11.lstat(file);
2131
2148
  totalSize += stats.size;
2132
2149
  const size = String(filesize(stats.size));
2133
2150
  return [
@@ -2195,7 +2212,7 @@ import { consola as consola2 } from "consola";
2195
2212
  import glob3 from "fast-glob";
2196
2213
 
2197
2214
  // src/core/utils/manifest.ts
2198
- import fs11 from "fs-extra";
2215
+ import fs12 from "fs-extra";
2199
2216
  import { resolve as resolve12 } from "path";
2200
2217
 
2201
2218
  // src/core/utils/content-security-policy.ts
@@ -2306,7 +2323,7 @@ function mapWxtOptionsToRegisteredContentScript(options, js, css) {
2306
2323
  import defu2 from "defu";
2307
2324
  async function writeManifest(manifest, output) {
2308
2325
  const str = wxt.config.mode === "production" ? JSON.stringify(manifest) : JSON.stringify(manifest, null, 2);
2309
- await fs11.ensureDir(wxt.config.outDir);
2326
+ await fs12.ensureDir(wxt.config.outDir);
2310
2327
  await writeFileIfDifferent(resolve12(wxt.config.outDir, "manifest.json"), str);
2311
2328
  output.publicAssets.unshift({
2312
2329
  type: "asset",
@@ -2362,11 +2379,14 @@ async function generateManifest(entrypoints, buildOutput) {
2362
2379
  addDevModePermissions(manifest);
2363
2380
  wxt.config.transformManifest(manifest);
2364
2381
  await wxt.hooks.callHook("build:manifestGenerated", wxt, manifest);
2365
- if (wxt.config.manifestVersion === 2)
2382
+ if (wxt.config.manifestVersion === 2) {
2366
2383
  convertWebAccessibleResourcesToMv2(manifest);
2384
+ convertActionToMv2(manifest);
2385
+ }
2367
2386
  if (wxt.config.manifestVersion === 3) {
2368
2387
  validateMv3WebAccessbileResources(manifest);
2369
2388
  }
2389
+ stripKeys(manifest);
2370
2390
  if (manifest.name == null)
2371
2391
  throw Error(
2372
2392
  "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"
@@ -2742,6 +2762,11 @@ function convertWebAccessibleResourcesToMv2(manifest) {
2742
2762
  )
2743
2763
  );
2744
2764
  }
2765
+ function convertActionToMv2(manifest) {
2766
+ if (manifest.action == null || manifest.browser_action != null || manifest.page_action != null)
2767
+ return;
2768
+ manifest.browser_action = manifest.action;
2769
+ }
2745
2770
  function validateMv3WebAccessbileResources(manifest) {
2746
2771
  if (manifest.web_accessible_resources == null)
2747
2772
  return;
@@ -2756,6 +2781,46 @@ function validateMv3WebAccessbileResources(manifest) {
2756
2781
  );
2757
2782
  }
2758
2783
  }
2784
+ function stripKeys(manifest) {
2785
+ let keysToRemove = [];
2786
+ if (wxt.config.manifestVersion === 2) {
2787
+ keysToRemove.push(...mv3OnlyKeys);
2788
+ if (wxt.config.browser === "firefox")
2789
+ keysToRemove.push(...firefoxMv3OnlyKeys);
2790
+ } else {
2791
+ keysToRemove.push(...mv2OnlyKeys);
2792
+ }
2793
+ keysToRemove.forEach((key) => {
2794
+ delete manifest[key];
2795
+ });
2796
+ }
2797
+ var mv2OnlyKeys = [
2798
+ "page_action",
2799
+ "browser_action",
2800
+ "automation",
2801
+ "content_capabilities",
2802
+ "converted_from_user_script",
2803
+ "current_locale",
2804
+ "differential_fingerprint",
2805
+ "event_rules",
2806
+ "file_browser_handlers",
2807
+ "file_system_provider_capabilities",
2808
+ "input_components",
2809
+ "nacl_modules",
2810
+ "natively_connectable",
2811
+ "offline_enabled",
2812
+ "platforms",
2813
+ "replacement_web_app",
2814
+ "system_indicator",
2815
+ "user_scripts"
2816
+ ];
2817
+ var mv3OnlyKeys = [
2818
+ "action",
2819
+ "export",
2820
+ "optional_host_permissions",
2821
+ "side_panel"
2822
+ ];
2823
+ var firefoxMv3OnlyKeys = ["host_permissions"];
2759
2824
 
2760
2825
  // src/core/utils/building/rebuild.ts
2761
2826
  async function rebuild(allEntrypoints, entrypointGroups, existingOutput = {
@@ -2870,8 +2935,8 @@ async function internalBuild() {
2870
2935
  )}`
2871
2936
  );
2872
2937
  const startTime = Date.now();
2873
- await fs12.rm(wxt.config.outDir, { recursive: true, force: true });
2874
- await fs12.ensureDir(wxt.config.outDir);
2938
+ await fs13.rm(wxt.config.outDir, { recursive: true, force: true });
2939
+ await fs13.ensureDir(wxt.config.outDir);
2875
2940
  const entrypoints = await findEntrypoints();
2876
2941
  wxt.logger.debug("Detected entrypoints:", entrypoints);
2877
2942
  const validationResults = validateEntrypoints(entrypoints);
@@ -2917,7 +2982,7 @@ async function combineAnalysisStats() {
2917
2982
  filename: wxt.config.analysis.outputFile
2918
2983
  });
2919
2984
  if (!wxt.config.analysis.keepArtifacts) {
2920
- await Promise.all(absolutePaths.map((statsFile) => fs12.remove(statsFile)));
2985
+ await Promise.all(absolutePaths.map((statsFile) => fs13.remove(statsFile)));
2921
2986
  }
2922
2987
  }
2923
2988
  function printValidationResults({
@@ -3085,7 +3150,7 @@ var pnpm = {
3085
3150
  return npm.downloadDependency(...args);
3086
3151
  },
3087
3152
  async listDependencies(options) {
3088
- const args = ["ls", "--json"];
3153
+ const args = ["ls", "-r", "--json"];
3089
3154
  if (options?.all) {
3090
3155
  args.push("--depth", "Infinity");
3091
3156
  }
package/dist/cli.js CHANGED
@@ -160,7 +160,7 @@ var pnpm = {
160
160
  return npm.downloadDependency(...args);
161
161
  },
162
162
  async listDependencies(options) {
163
- const args = ["ls", "--json"];
163
+ const args = ["ls", "-r", "--json"];
164
164
  if (options?.all) {
165
165
  args.push("--depth", "Infinity");
166
166
  }
@@ -1881,6 +1881,7 @@ function isModuleInstalled(name) {
1881
1881
  }
1882
1882
 
1883
1883
  // src/core/utils/building/resolve-config.ts
1884
+ import fs9 from "fs-extra";
1884
1885
  async function resolveConfig(inlineConfig, command, server) {
1885
1886
  let userConfig = {};
1886
1887
  let userConfigMetadata;
@@ -1916,8 +1917,14 @@ async function resolveConfig(inlineConfig, command, server) {
1916
1917
  srcDir,
1917
1918
  mergedConfig.entrypointsDir ?? "entrypoints"
1918
1919
  );
1920
+ if (await isDirMissing(entrypointsDir)) {
1921
+ logMissingDir(logger, "Entrypoints", entrypointsDir);
1922
+ }
1919
1923
  const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
1920
1924
  const publicDir = path5.resolve(srcDir, mergedConfig.publicDir ?? "public");
1925
+ if (await isDirMissing(publicDir)) {
1926
+ logMissingDir(logger, "Public", publicDir);
1927
+ }
1921
1928
  const typesDir = path5.resolve(wxtDir, "types");
1922
1929
  const outBaseDir = path5.resolve(root, mergedConfig.outDir ?? ".output");
1923
1930
  const outDir = path5.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
@@ -2135,6 +2142,16 @@ async function resolveWxtModuleDir() {
2135
2142
  const requireResolve = __require?.resolve ?? (await import("node:module")).default.createRequire(import.meta.url).resolve;
2136
2143
  return path5.resolve(requireResolve("wxt"), "../..");
2137
2144
  }
2145
+ async function isDirMissing(dir) {
2146
+ return !await fs9.exists(dir);
2147
+ }
2148
+ function logMissingDir(logger, name, expected) {
2149
+ logger.warn(
2150
+ `${name} directory not found: ./${normalizePath(
2151
+ path5.relative(process.cwd(), expected)
2152
+ )}`
2153
+ );
2154
+ }
2138
2155
 
2139
2156
  // src/core/utils/building/group-entrypoints.ts
2140
2157
  function groupEntrypoints(entrypoints) {
@@ -2178,7 +2195,7 @@ var ENTRY_TYPE_TO_GROUP_MAP = {
2178
2195
  // src/core/utils/building/import-entrypoint.ts
2179
2196
  import createJITI from "jiti";
2180
2197
  import { createUnimport as createUnimport3 } from "unimport";
2181
- import fs9 from "fs-extra";
2198
+ import fs10 from "fs-extra";
2182
2199
  import { relative as relative5, resolve as resolve10 } from "node:path";
2183
2200
 
2184
2201
  // src/core/utils/strings.ts
@@ -2210,7 +2227,7 @@ async function importEntrypointFile(path10) {
2210
2227
  dirs: []
2211
2228
  });
2212
2229
  await unimport2.init();
2213
- const text = await fs9.readFile(path10, "utf-8");
2230
+ const text = await fs10.readFile(path10, "utf-8");
2214
2231
  const textNoImports = removeProjectImportStatements(text);
2215
2232
  const { code } = await unimport2.injectImports(textNoImports);
2216
2233
  wxt.logger.debug(
@@ -2285,7 +2302,7 @@ function getEsbuildOptions(opts) {
2285
2302
 
2286
2303
  // src/core/utils/building/internal-build.ts
2287
2304
  import pc5 from "picocolors";
2288
- import fs12 from "fs-extra";
2305
+ import fs13 from "fs-extra";
2289
2306
 
2290
2307
  // src/core/utils/log/printBuildSummary.ts
2291
2308
  import { resolve as resolve11 } from "path";
@@ -2293,7 +2310,7 @@ import { resolve as resolve11 } from "path";
2293
2310
  // src/core/utils/log/printFileList.ts
2294
2311
  import path6 from "node:path";
2295
2312
  import pc3 from "picocolors";
2296
- import fs10 from "fs-extra";
2313
+ import fs11 from "fs-extra";
2297
2314
  import { filesize } from "filesize";
2298
2315
 
2299
2316
  // src/core/utils/log/printTable.ts
@@ -2334,7 +2351,7 @@ async function printFileList(log, header, baseDir, files) {
2334
2351
  ];
2335
2352
  const prefix = i === files.length - 1 ? " \u2514\u2500" : " \u251C\u2500";
2336
2353
  const color = getChunkColor(file);
2337
- const stats = await fs10.lstat(file);
2354
+ const stats = await fs11.lstat(file);
2338
2355
  totalSize += stats.size;
2339
2356
  const size = String(filesize(stats.size));
2340
2357
  return [
@@ -2398,7 +2415,7 @@ function getChunkSortWeight(filename) {
2398
2415
  import pc4 from "picocolors";
2399
2416
 
2400
2417
  // package.json
2401
- var version = "0.17.5";
2418
+ var version = "0.17.7";
2402
2419
 
2403
2420
  // src/core/utils/log/printHeader.ts
2404
2421
  import { consola as consola2 } from "consola";
@@ -2411,7 +2428,7 @@ function printHeader() {
2411
2428
  import glob3 from "fast-glob";
2412
2429
 
2413
2430
  // src/core/utils/manifest.ts
2414
- import fs11 from "fs-extra";
2431
+ import fs12 from "fs-extra";
2415
2432
  import { resolve as resolve12 } from "path";
2416
2433
 
2417
2434
  // src/core/utils/content-security-policy.ts
@@ -2522,7 +2539,7 @@ function mapWxtOptionsToRegisteredContentScript(options, js, css) {
2522
2539
  import defu2 from "defu";
2523
2540
  async function writeManifest(manifest, output) {
2524
2541
  const str = wxt.config.mode === "production" ? JSON.stringify(manifest) : JSON.stringify(manifest, null, 2);
2525
- await fs11.ensureDir(wxt.config.outDir);
2542
+ await fs12.ensureDir(wxt.config.outDir);
2526
2543
  await writeFileIfDifferent(resolve12(wxt.config.outDir, "manifest.json"), str);
2527
2544
  output.publicAssets.unshift({
2528
2545
  type: "asset",
@@ -2578,11 +2595,14 @@ async function generateManifest(entrypoints, buildOutput) {
2578
2595
  addDevModePermissions(manifest);
2579
2596
  wxt.config.transformManifest(manifest);
2580
2597
  await wxt.hooks.callHook("build:manifestGenerated", wxt, manifest);
2581
- if (wxt.config.manifestVersion === 2)
2598
+ if (wxt.config.manifestVersion === 2) {
2582
2599
  convertWebAccessibleResourcesToMv2(manifest);
2600
+ convertActionToMv2(manifest);
2601
+ }
2583
2602
  if (wxt.config.manifestVersion === 3) {
2584
2603
  validateMv3WebAccessbileResources(manifest);
2585
2604
  }
2605
+ stripKeys(manifest);
2586
2606
  if (manifest.name == null)
2587
2607
  throw Error(
2588
2608
  "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"
@@ -2958,6 +2978,11 @@ function convertWebAccessibleResourcesToMv2(manifest) {
2958
2978
  )
2959
2979
  );
2960
2980
  }
2981
+ function convertActionToMv2(manifest) {
2982
+ if (manifest.action == null || manifest.browser_action != null || manifest.page_action != null)
2983
+ return;
2984
+ manifest.browser_action = manifest.action;
2985
+ }
2961
2986
  function validateMv3WebAccessbileResources(manifest) {
2962
2987
  if (manifest.web_accessible_resources == null)
2963
2988
  return;
@@ -2972,6 +2997,46 @@ function validateMv3WebAccessbileResources(manifest) {
2972
2997
  );
2973
2998
  }
2974
2999
  }
3000
+ function stripKeys(manifest) {
3001
+ let keysToRemove = [];
3002
+ if (wxt.config.manifestVersion === 2) {
3003
+ keysToRemove.push(...mv3OnlyKeys);
3004
+ if (wxt.config.browser === "firefox")
3005
+ keysToRemove.push(...firefoxMv3OnlyKeys);
3006
+ } else {
3007
+ keysToRemove.push(...mv2OnlyKeys);
3008
+ }
3009
+ keysToRemove.forEach((key) => {
3010
+ delete manifest[key];
3011
+ });
3012
+ }
3013
+ var mv2OnlyKeys = [
3014
+ "page_action",
3015
+ "browser_action",
3016
+ "automation",
3017
+ "content_capabilities",
3018
+ "converted_from_user_script",
3019
+ "current_locale",
3020
+ "differential_fingerprint",
3021
+ "event_rules",
3022
+ "file_browser_handlers",
3023
+ "file_system_provider_capabilities",
3024
+ "input_components",
3025
+ "nacl_modules",
3026
+ "natively_connectable",
3027
+ "offline_enabled",
3028
+ "platforms",
3029
+ "replacement_web_app",
3030
+ "system_indicator",
3031
+ "user_scripts"
3032
+ ];
3033
+ var mv3OnlyKeys = [
3034
+ "action",
3035
+ "export",
3036
+ "optional_host_permissions",
3037
+ "side_panel"
3038
+ ];
3039
+ var firefoxMv3OnlyKeys = ["host_permissions"];
2975
3040
 
2976
3041
  // src/core/utils/building/rebuild.ts
2977
3042
  async function rebuild(allEntrypoints, entrypointGroups, existingOutput = {
@@ -3086,8 +3151,8 @@ async function internalBuild() {
3086
3151
  )}`
3087
3152
  );
3088
3153
  const startTime = Date.now();
3089
- await fs12.rm(wxt.config.outDir, { recursive: true, force: true });
3090
- await fs12.ensureDir(wxt.config.outDir);
3154
+ await fs13.rm(wxt.config.outDir, { recursive: true, force: true });
3155
+ await fs13.ensureDir(wxt.config.outDir);
3091
3156
  const entrypoints = await findEntrypoints();
3092
3157
  wxt.logger.debug("Detected entrypoints:", entrypoints);
3093
3158
  const validationResults = validateEntrypoints(entrypoints);
@@ -3133,7 +3198,7 @@ async function combineAnalysisStats() {
3133
3198
  filename: wxt.config.analysis.outputFile
3134
3199
  });
3135
3200
  if (!wxt.config.analysis.keepArtifacts) {
3136
- await Promise.all(absolutePaths.map((statsFile) => fs12.remove(statsFile)));
3201
+ await Promise.all(absolutePaths.map((statsFile) => fs13.remove(statsFile)));
3137
3202
  }
3138
3203
  }
3139
3204
  function printValidationResults({
@@ -3172,7 +3237,7 @@ async function build(config) {
3172
3237
  // src/core/clean.ts
3173
3238
  import path7 from "node:path";
3174
3239
  import glob4 from "fast-glob";
3175
- import fs13 from "fs-extra";
3240
+ import fs14 from "fs-extra";
3176
3241
  import { consola as consola4 } from "consola";
3177
3242
  import pc6 from "picocolors";
3178
3243
  async function clean(root = process.cwd()) {
@@ -3199,7 +3264,7 @@ async function clean(root = process.cwd()) {
3199
3264
  directories.map((dir) => pc6.cyan(path7.relative(root, dir))).join(", ")
3200
3265
  );
3201
3266
  for (const directory of directories) {
3202
- await fs13.rm(directory, { force: true, recursive: true });
3267
+ await fs14.rm(directory, { force: true, recursive: true });
3203
3268
  consola4.debug("Deleted " + pc6.cyan(path7.relative(root, directory)));
3204
3269
  }
3205
3270
  }
@@ -3550,7 +3615,7 @@ function getExternalOutputDependencies(server) {
3550
3615
  import prompts from "prompts";
3551
3616
  import { consola as consola6 } from "consola";
3552
3617
  import { downloadTemplate } from "giget";
3553
- import fs14 from "fs-extra";
3618
+ import fs15 from "fs-extra";
3554
3619
  import path8 from "node:path";
3555
3620
  import pc8 from "picocolors";
3556
3621
  async function initialize(options) {
@@ -3642,7 +3707,7 @@ async function cloneProject({
3642
3707
  dir: directory,
3643
3708
  force: true
3644
3709
  });
3645
- await fs14.move(
3710
+ await fs15.move(
3646
3711
  path8.join(directory, "_gitignore"),
3647
3712
  path8.join(directory, ".gitignore")
3648
3713
  ).catch(
@@ -3677,7 +3742,7 @@ async function prepare(config) {
3677
3742
 
3678
3743
  // src/core/zip.ts
3679
3744
  import path9 from "node:path";
3680
- import fs15 from "fs-extra";
3745
+ import fs16 from "fs-extra";
3681
3746
  import { minimatch as minimatch2 } from "minimatch";
3682
3747
  import JSZip from "jszip";
3683
3748
  import glob5 from "fast-glob";
@@ -3694,7 +3759,7 @@ async function zip(config) {
3694
3759
  "{{version}}",
3695
3760
  output.manifest.version_name ?? output.manifest.version
3696
3761
  ).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
3697
- await fs15.ensureDir(wxt.config.outBaseDir);
3762
+ await fs16.ensureDir(wxt.config.outBaseDir);
3698
3763
  const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
3699
3764
  const outZipPath = path9.resolve(wxt.config.outBaseDir, outZipFilename);
3700
3765
  await zipDir(wxt.config.outDir, outZipPath);
@@ -3709,9 +3774,9 @@ async function zip(config) {
3709
3774
  await zipDir(wxt.config.zip.sourcesRoot, sourcesZipPath, {
3710
3775
  include: wxt.config.zip.includeSources,
3711
3776
  exclude: wxt.config.zip.excludeSources,
3712
- transform(file, content) {
3713
- if (file.endsWith("package.json")) {
3714
- return addOverridesToPackageJson(content, overrides);
3777
+ transform(absolutePath, zipPath, content) {
3778
+ if (zipPath.endsWith("package.json")) {
3779
+ return addOverridesToPackageJson(absolutePath, content, overrides);
3715
3780
  }
3716
3781
  },
3717
3782
  additionalFiles: downloadedPackages
@@ -3749,19 +3814,19 @@ async function zipDir(directory, outputPath, options) {
3749
3814
  for (const file of filesToZip) {
3750
3815
  const absolutePath = path9.resolve(directory, file);
3751
3816
  if (file.endsWith(".json")) {
3752
- const content = await fs15.readFile(absolutePath, "utf-8");
3817
+ const content = await fs16.readFile(absolutePath, "utf-8");
3753
3818
  archive.file(
3754
3819
  file,
3755
- await options?.transform?.(file, content) || content
3820
+ await options?.transform?.(absolutePath, file, content) || content
3756
3821
  );
3757
3822
  } else {
3758
- const content = await fs15.readFile(absolutePath);
3823
+ const content = await fs16.readFile(absolutePath);
3759
3824
  archive.file(file, content);
3760
3825
  }
3761
3826
  }
3762
3827
  await options?.additionalWork?.(archive);
3763
3828
  const buffer = await archive.generateAsync({ type: "base64" });
3764
- await fs15.writeFile(outputPath, buffer, "base64");
3829
+ await fs16.writeFile(outputPath, buffer, "base64");
3765
3830
  }
3766
3831
  async function downloadPrivatePackages() {
3767
3832
  const overrides = {};
@@ -3783,22 +3848,23 @@ async function downloadPrivatePackages() {
3783
3848
  wxt.config.zip.downloadedPackagesDir
3784
3849
  );
3785
3850
  files.push(tgzPath);
3786
- overrides[id] = "file://./" + normalizePath(path9.relative(wxt.config.root, tgzPath));
3851
+ overrides[id] = tgzPath;
3787
3852
  }
3788
3853
  }
3789
3854
  return { overrides, files };
3790
3855
  }
3791
- function addOverridesToPackageJson(content, overrides) {
3856
+ function addOverridesToPackageJson(absolutePackageJsonPath, content, overrides) {
3792
3857
  if (Object.keys(overrides).length === 0)
3793
3858
  return content;
3859
+ const packageJsonDir = path9.dirname(absolutePackageJsonPath);
3794
3860
  const oldPackage = JSON.parse(content);
3795
3861
  const newPackage = {
3796
3862
  ...oldPackage,
3797
- [wxt.pm.overridesKey]: {
3798
- ...oldPackage[wxt.pm.overridesKey],
3799
- ...overrides
3800
- }
3863
+ [wxt.pm.overridesKey]: { ...oldPackage[wxt.pm.overridesKey] }
3801
3864
  };
3865
+ Object.entries(overrides).forEach(([key, absolutePath]) => {
3866
+ newPackage[wxt.pm.overridesKey][key] = "file://./" + normalizePath(path9.relative(packageJsonDir, absolutePath));
3867
+ });
3802
3868
  return JSON.stringify(newPackage, null, 2);
3803
3869
  }
3804
3870
 
@@ -139,6 +139,9 @@ interface InlineConfig {
139
139
  * Directory containing all source code. Set to `"src"` to move all source code to a `src/`
140
140
  * directory.
141
141
  *
142
+ * After changing, don't forget to move the `public/` and `entrypoints/` directories into the new
143
+ * source dir.
144
+ *
142
145
  * @default config.root
143
146
  */
144
147
  srcDir?: string;
@@ -139,6 +139,9 @@ interface InlineConfig {
139
139
  * Directory containing all source code. Set to `"src"` to move all source code to a `src/`
140
140
  * directory.
141
141
  *
142
+ * After changing, don't forget to move the `public/` and `entrypoints/` directories into the new
143
+ * source dir.
144
+ *
142
145
  * @default config.root
143
146
  */
144
147
  srcDir?: string;
package/dist/index.cjs CHANGED
@@ -39,7 +39,7 @@ var require_windows = __commonJS({
39
39
  "use strict";
40
40
  module2.exports = isexe;
41
41
  isexe.sync = sync;
42
- var fs16 = require("fs");
42
+ var fs17 = require("fs");
43
43
  function checkPathExt(path13, options) {
44
44
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
45
45
  if (!pathext) {
@@ -64,12 +64,12 @@ var require_windows = __commonJS({
64
64
  return checkPathExt(path13, options);
65
65
  }
66
66
  function isexe(path13, options, cb) {
67
- fs16.stat(path13, function(er, stat) {
67
+ fs17.stat(path13, function(er, stat) {
68
68
  cb(er, er ? false : checkStat(stat, path13, options));
69
69
  });
70
70
  }
71
71
  function sync(path13, options) {
72
- return checkStat(fs16.statSync(path13), path13, options);
72
+ return checkStat(fs17.statSync(path13), path13, options);
73
73
  }
74
74
  }
75
75
  });
@@ -80,14 +80,14 @@ var require_mode = __commonJS({
80
80
  "use strict";
81
81
  module2.exports = isexe;
82
82
  isexe.sync = sync;
83
- var fs16 = require("fs");
83
+ var fs17 = require("fs");
84
84
  function isexe(path13, options, cb) {
85
- fs16.stat(path13, function(er, stat) {
85
+ fs17.stat(path13, function(er, stat) {
86
86
  cb(er, er ? false : checkStat(stat, options));
87
87
  });
88
88
  }
89
89
  function sync(path13, options) {
90
- return checkStat(fs16.statSync(path13), options);
90
+ return checkStat(fs17.statSync(path13), options);
91
91
  }
92
92
  function checkStat(stat, options) {
93
93
  return stat.isFile() && checkMode(stat, options);
@@ -112,7 +112,7 @@ var require_mode = __commonJS({
112
112
  var require_isexe = __commonJS({
113
113
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
114
114
  "use strict";
115
- var fs16 = require("fs");
115
+ var fs17 = require("fs");
116
116
  var core;
117
117
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
118
118
  core = require_windows();
@@ -377,16 +377,16 @@ var require_shebang_command = __commonJS({
377
377
  var require_readShebang = __commonJS({
378
378
  "node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
379
379
  "use strict";
380
- var fs16 = require("fs");
380
+ var fs17 = require("fs");
381
381
  var shebangCommand = require_shebang_command();
382
382
  function readShebang(command) {
383
383
  const size = 150;
384
384
  const buffer = Buffer.alloc(size);
385
385
  let fd;
386
386
  try {
387
- fd = fs16.openSync(command, "r");
388
- fs16.readSync(fd, buffer, 0, size, 0);
389
- fs16.closeSync(fd);
387
+ fd = fs17.openSync(command, "r");
388
+ fs17.readSync(fd, buffer, 0, size, 0);
389
+ fs17.closeSync(fd);
390
390
  } catch (e) {
391
391
  }
392
392
  return shebangCommand(buffer.toString());
@@ -2574,7 +2574,7 @@ var pnpm = {
2574
2574
  return npm.downloadDependency(...args);
2575
2575
  },
2576
2576
  async listDependencies(options) {
2577
- const args = ["ls", "--json"];
2577
+ const args = ["ls", "-r", "--json"];
2578
2578
  if (options?.all) {
2579
2579
  args.push("--depth", "Infinity");
2580
2580
  }
@@ -4298,6 +4298,7 @@ function isModuleInstalled(name) {
4298
4298
  }
4299
4299
 
4300
4300
  // src/core/utils/building/resolve-config.ts
4301
+ var import_fs_extra10 = __toESM(require("fs-extra"), 1);
4301
4302
  var import_meta = {};
4302
4303
  async function resolveConfig(inlineConfig, command, server) {
4303
4304
  let userConfig = {};
@@ -4334,8 +4335,14 @@ async function resolveConfig(inlineConfig, command, server) {
4334
4335
  srcDir,
4335
4336
  mergedConfig.entrypointsDir ?? "entrypoints"
4336
4337
  );
4338
+ if (await isDirMissing(entrypointsDir)) {
4339
+ logMissingDir(logger, "Entrypoints", entrypointsDir);
4340
+ }
4337
4341
  const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
4338
4342
  const publicDir = import_node_path12.default.resolve(srcDir, mergedConfig.publicDir ?? "public");
4343
+ if (await isDirMissing(publicDir)) {
4344
+ logMissingDir(logger, "Public", publicDir);
4345
+ }
4339
4346
  const typesDir = import_node_path12.default.resolve(wxtDir, "types");
4340
4347
  const outBaseDir = import_node_path12.default.resolve(root, mergedConfig.outDir ?? ".output");
4341
4348
  const outDir = import_node_path12.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
@@ -4553,6 +4560,16 @@ async function resolveWxtModuleDir() {
4553
4560
  const requireResolve = require?.resolve ?? (await import("module")).default.createRequire(import_meta.url).resolve;
4554
4561
  return import_node_path12.default.resolve(requireResolve("wxt"), "../..");
4555
4562
  }
4563
+ async function isDirMissing(dir) {
4564
+ return !await import_fs_extra10.default.exists(dir);
4565
+ }
4566
+ function logMissingDir(logger, name, expected) {
4567
+ logger.warn(
4568
+ `${name} directory not found: ./${normalizePath(
4569
+ import_node_path12.default.relative(process.cwd(), expected)
4570
+ )}`
4571
+ );
4572
+ }
4556
4573
 
4557
4574
  // src/core/utils/building/group-entrypoints.ts
4558
4575
  function groupEntrypoints(entrypoints) {
@@ -4596,7 +4613,7 @@ var ENTRY_TYPE_TO_GROUP_MAP = {
4596
4613
  // src/core/utils/building/import-entrypoint.ts
4597
4614
  var import_jiti = __toESM(require("jiti"), 1);
4598
4615
  var import_unimport3 = require("unimport");
4599
- var import_fs_extra10 = __toESM(require("fs-extra"), 1);
4616
+ var import_fs_extra11 = __toESM(require("fs-extra"), 1);
4600
4617
  var import_node_path13 = require("path");
4601
4618
 
4602
4619
  // src/core/utils/strings.ts
@@ -4629,7 +4646,7 @@ async function importEntrypointFile(path13) {
4629
4646
  dirs: []
4630
4647
  });
4631
4648
  await unimport2.init();
4632
- const text = await import_fs_extra10.default.readFile(path13, "utf-8");
4649
+ const text = await import_fs_extra11.default.readFile(path13, "utf-8");
4633
4650
  const textNoImports = removeProjectImportStatements(text);
4634
4651
  const { code } = await unimport2.injectImports(textNoImports);
4635
4652
  wxt.logger.debug(
@@ -4704,7 +4721,7 @@ function getEsbuildOptions(opts) {
4704
4721
 
4705
4722
  // src/core/utils/building/internal-build.ts
4706
4723
  var import_picocolors5 = __toESM(require("picocolors"), 1);
4707
- var import_fs_extra13 = __toESM(require("fs-extra"), 1);
4724
+ var import_fs_extra14 = __toESM(require("fs-extra"), 1);
4708
4725
 
4709
4726
  // src/core/utils/log/printBuildSummary.ts
4710
4727
  var import_path7 = require("path");
@@ -4712,7 +4729,7 @@ var import_path7 = require("path");
4712
4729
  // src/core/utils/log/printFileList.ts
4713
4730
  var import_node_path14 = __toESM(require("path"), 1);
4714
4731
  var import_picocolors3 = __toESM(require("picocolors"), 1);
4715
- var import_fs_extra11 = __toESM(require("fs-extra"), 1);
4732
+ var import_fs_extra12 = __toESM(require("fs-extra"), 1);
4716
4733
  var import_filesize = require("filesize");
4717
4734
 
4718
4735
  // src/core/utils/log/printTable.ts
@@ -4753,7 +4770,7 @@ async function printFileList(log, header, baseDir, files) {
4753
4770
  ];
4754
4771
  const prefix = i === files.length - 1 ? " \u2514\u2500" : " \u251C\u2500";
4755
4772
  const color = getChunkColor(file);
4756
- const stats = await import_fs_extra11.default.lstat(file);
4773
+ const stats = await import_fs_extra12.default.lstat(file);
4757
4774
  totalSize += stats.size;
4758
4775
  const size = String((0, import_filesize.filesize)(stats.size));
4759
4776
  return [
@@ -4817,7 +4834,7 @@ function getChunkSortWeight(filename) {
4817
4834
  var import_picocolors4 = __toESM(require("picocolors"), 1);
4818
4835
 
4819
4836
  // package.json
4820
- var version = "0.17.5";
4837
+ var version = "0.17.7";
4821
4838
 
4822
4839
  // src/core/utils/log/printHeader.ts
4823
4840
  var import_consola2 = require("consola");
@@ -4826,7 +4843,7 @@ var import_consola2 = require("consola");
4826
4843
  var import_fast_glob3 = __toESM(require("fast-glob"), 1);
4827
4844
 
4828
4845
  // src/core/utils/manifest.ts
4829
- var import_fs_extra12 = __toESM(require("fs-extra"), 1);
4846
+ var import_fs_extra13 = __toESM(require("fs-extra"), 1);
4830
4847
  var import_path8 = require("path");
4831
4848
 
4832
4849
  // src/core/utils/content-security-policy.ts
@@ -4937,7 +4954,7 @@ function mapWxtOptionsToRegisteredContentScript(options, js, css) {
4937
4954
  var import_defu2 = __toESM(require("defu"), 1);
4938
4955
  async function writeManifest(manifest, output) {
4939
4956
  const str = wxt.config.mode === "production" ? JSON.stringify(manifest) : JSON.stringify(manifest, null, 2);
4940
- await import_fs_extra12.default.ensureDir(wxt.config.outDir);
4957
+ await import_fs_extra13.default.ensureDir(wxt.config.outDir);
4941
4958
  await writeFileIfDifferent((0, import_path8.resolve)(wxt.config.outDir, "manifest.json"), str);
4942
4959
  output.publicAssets.unshift({
4943
4960
  type: "asset",
@@ -4993,11 +5010,14 @@ async function generateManifest(entrypoints, buildOutput) {
4993
5010
  addDevModePermissions(manifest);
4994
5011
  wxt.config.transformManifest(manifest);
4995
5012
  await wxt.hooks.callHook("build:manifestGenerated", wxt, manifest);
4996
- if (wxt.config.manifestVersion === 2)
5013
+ if (wxt.config.manifestVersion === 2) {
4997
5014
  convertWebAccessibleResourcesToMv2(manifest);
5015
+ convertActionToMv2(manifest);
5016
+ }
4998
5017
  if (wxt.config.manifestVersion === 3) {
4999
5018
  validateMv3WebAccessbileResources(manifest);
5000
5019
  }
5020
+ stripKeys(manifest);
5001
5021
  if (manifest.name == null)
5002
5022
  throw Error(
5003
5023
  "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"
@@ -5373,6 +5393,11 @@ function convertWebAccessibleResourcesToMv2(manifest) {
5373
5393
  )
5374
5394
  );
5375
5395
  }
5396
+ function convertActionToMv2(manifest) {
5397
+ if (manifest.action == null || manifest.browser_action != null || manifest.page_action != null)
5398
+ return;
5399
+ manifest.browser_action = manifest.action;
5400
+ }
5376
5401
  function validateMv3WebAccessbileResources(manifest) {
5377
5402
  if (manifest.web_accessible_resources == null)
5378
5403
  return;
@@ -5387,6 +5412,46 @@ function validateMv3WebAccessbileResources(manifest) {
5387
5412
  );
5388
5413
  }
5389
5414
  }
5415
+ function stripKeys(manifest) {
5416
+ let keysToRemove = [];
5417
+ if (wxt.config.manifestVersion === 2) {
5418
+ keysToRemove.push(...mv3OnlyKeys);
5419
+ if (wxt.config.browser === "firefox")
5420
+ keysToRemove.push(...firefoxMv3OnlyKeys);
5421
+ } else {
5422
+ keysToRemove.push(...mv2OnlyKeys);
5423
+ }
5424
+ keysToRemove.forEach((key) => {
5425
+ delete manifest[key];
5426
+ });
5427
+ }
5428
+ var mv2OnlyKeys = [
5429
+ "page_action",
5430
+ "browser_action",
5431
+ "automation",
5432
+ "content_capabilities",
5433
+ "converted_from_user_script",
5434
+ "current_locale",
5435
+ "differential_fingerprint",
5436
+ "event_rules",
5437
+ "file_browser_handlers",
5438
+ "file_system_provider_capabilities",
5439
+ "input_components",
5440
+ "nacl_modules",
5441
+ "natively_connectable",
5442
+ "offline_enabled",
5443
+ "platforms",
5444
+ "replacement_web_app",
5445
+ "system_indicator",
5446
+ "user_scripts"
5447
+ ];
5448
+ var mv3OnlyKeys = [
5449
+ "action",
5450
+ "export",
5451
+ "optional_host_permissions",
5452
+ "side_panel"
5453
+ ];
5454
+ var firefoxMv3OnlyKeys = ["host_permissions"];
5390
5455
 
5391
5456
  // src/core/utils/building/rebuild.ts
5392
5457
  async function rebuild(allEntrypoints, entrypointGroups, existingOutput = {
@@ -5501,8 +5566,8 @@ async function internalBuild() {
5501
5566
  )}`
5502
5567
  );
5503
5568
  const startTime = Date.now();
5504
- await import_fs_extra13.default.rm(wxt.config.outDir, { recursive: true, force: true });
5505
- await import_fs_extra13.default.ensureDir(wxt.config.outDir);
5569
+ await import_fs_extra14.default.rm(wxt.config.outDir, { recursive: true, force: true });
5570
+ await import_fs_extra14.default.ensureDir(wxt.config.outDir);
5506
5571
  const entrypoints = await findEntrypoints();
5507
5572
  wxt.logger.debug("Detected entrypoints:", entrypoints);
5508
5573
  const validationResults = validateEntrypoints(entrypoints);
@@ -5548,7 +5613,7 @@ async function combineAnalysisStats() {
5548
5613
  filename: wxt.config.analysis.outputFile
5549
5614
  });
5550
5615
  if (!wxt.config.analysis.keepArtifacts) {
5551
- await Promise.all(absolutePaths.map((statsFile) => import_fs_extra13.default.remove(statsFile)));
5616
+ await Promise.all(absolutePaths.map((statsFile) => import_fs_extra14.default.remove(statsFile)));
5552
5617
  }
5553
5618
  }
5554
5619
  function printValidationResults({
@@ -5587,7 +5652,7 @@ async function build(config) {
5587
5652
  // src/core/clean.ts
5588
5653
  var import_node_path16 = __toESM(require("path"), 1);
5589
5654
  var import_fast_glob4 = __toESM(require("fast-glob"), 1);
5590
- var import_fs_extra14 = __toESM(require("fs-extra"), 1);
5655
+ var import_fs_extra15 = __toESM(require("fs-extra"), 1);
5591
5656
  var import_consola4 = require("consola");
5592
5657
  var import_picocolors6 = __toESM(require("picocolors"), 1);
5593
5658
  async function clean(root = process.cwd()) {
@@ -5614,7 +5679,7 @@ async function clean(root = process.cwd()) {
5614
5679
  directories.map((dir) => import_picocolors6.default.cyan(import_node_path16.default.relative(root, dir))).join(", ")
5615
5680
  );
5616
5681
  for (const directory of directories) {
5617
- await import_fs_extra14.default.rm(directory, { force: true, recursive: true });
5682
+ await import_fs_extra15.default.rm(directory, { force: true, recursive: true });
5618
5683
  import_consola4.consola.debug("Deleted " + import_picocolors6.default.cyan(import_node_path16.default.relative(root, directory)));
5619
5684
  }
5620
5685
  }
@@ -5975,7 +6040,7 @@ function getExternalOutputDependencies(server) {
5975
6040
  var import_prompts = __toESM(require("prompts"), 1);
5976
6041
  var import_consola6 = require("consola");
5977
6042
  var import_giget = require("giget");
5978
- var import_fs_extra15 = __toESM(require("fs-extra"), 1);
6043
+ var import_fs_extra16 = __toESM(require("fs-extra"), 1);
5979
6044
  var import_node_path21 = __toESM(require("path"), 1);
5980
6045
  var import_picocolors8 = __toESM(require("picocolors"), 1);
5981
6046
  async function initialize(options) {
@@ -6067,7 +6132,7 @@ async function cloneProject({
6067
6132
  dir: directory,
6068
6133
  force: true
6069
6134
  });
6070
- await import_fs_extra15.default.move(
6135
+ await import_fs_extra16.default.move(
6071
6136
  import_node_path21.default.join(directory, "_gitignore"),
6072
6137
  import_node_path21.default.join(directory, ".gitignore")
6073
6138
  ).catch(
@@ -6102,7 +6167,7 @@ async function prepare(config) {
6102
6167
 
6103
6168
  // src/core/zip.ts
6104
6169
  var import_node_path22 = __toESM(require("path"), 1);
6105
- var import_fs_extra16 = __toESM(require("fs-extra"), 1);
6170
+ var import_fs_extra17 = __toESM(require("fs-extra"), 1);
6106
6171
  var import_minimatch2 = require("minimatch");
6107
6172
  var import_jszip = __toESM(require("jszip"), 1);
6108
6173
  var import_fast_glob5 = __toESM(require("fast-glob"), 1);
@@ -6119,7 +6184,7 @@ async function zip(config) {
6119
6184
  "{{version}}",
6120
6185
  output.manifest.version_name ?? output.manifest.version
6121
6186
  ).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
6122
- await import_fs_extra16.default.ensureDir(wxt.config.outBaseDir);
6187
+ await import_fs_extra17.default.ensureDir(wxt.config.outBaseDir);
6123
6188
  const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
6124
6189
  const outZipPath = import_node_path22.default.resolve(wxt.config.outBaseDir, outZipFilename);
6125
6190
  await zipDir(wxt.config.outDir, outZipPath);
@@ -6134,9 +6199,9 @@ async function zip(config) {
6134
6199
  await zipDir(wxt.config.zip.sourcesRoot, sourcesZipPath, {
6135
6200
  include: wxt.config.zip.includeSources,
6136
6201
  exclude: wxt.config.zip.excludeSources,
6137
- transform(file, content) {
6138
- if (file.endsWith("package.json")) {
6139
- return addOverridesToPackageJson(content, overrides);
6202
+ transform(absolutePath, zipPath, content) {
6203
+ if (zipPath.endsWith("package.json")) {
6204
+ return addOverridesToPackageJson(absolutePath, content, overrides);
6140
6205
  }
6141
6206
  },
6142
6207
  additionalFiles: downloadedPackages
@@ -6174,19 +6239,19 @@ async function zipDir(directory, outputPath, options) {
6174
6239
  for (const file of filesToZip) {
6175
6240
  const absolutePath = import_node_path22.default.resolve(directory, file);
6176
6241
  if (file.endsWith(".json")) {
6177
- const content = await import_fs_extra16.default.readFile(absolutePath, "utf-8");
6242
+ const content = await import_fs_extra17.default.readFile(absolutePath, "utf-8");
6178
6243
  archive.file(
6179
6244
  file,
6180
- await options?.transform?.(file, content) || content
6245
+ await options?.transform?.(absolutePath, file, content) || content
6181
6246
  );
6182
6247
  } else {
6183
- const content = await import_fs_extra16.default.readFile(absolutePath);
6248
+ const content = await import_fs_extra17.default.readFile(absolutePath);
6184
6249
  archive.file(file, content);
6185
6250
  }
6186
6251
  }
6187
6252
  await options?.additionalWork?.(archive);
6188
6253
  const buffer = await archive.generateAsync({ type: "base64" });
6189
- await import_fs_extra16.default.writeFile(outputPath, buffer, "base64");
6254
+ await import_fs_extra17.default.writeFile(outputPath, buffer, "base64");
6190
6255
  }
6191
6256
  async function downloadPrivatePackages() {
6192
6257
  const overrides = {};
@@ -6208,22 +6273,23 @@ async function downloadPrivatePackages() {
6208
6273
  wxt.config.zip.downloadedPackagesDir
6209
6274
  );
6210
6275
  files.push(tgzPath);
6211
- overrides[id] = "file://./" + normalizePath(import_node_path22.default.relative(wxt.config.root, tgzPath));
6276
+ overrides[id] = tgzPath;
6212
6277
  }
6213
6278
  }
6214
6279
  return { overrides, files };
6215
6280
  }
6216
- function addOverridesToPackageJson(content, overrides) {
6281
+ function addOverridesToPackageJson(absolutePackageJsonPath, content, overrides) {
6217
6282
  if (Object.keys(overrides).length === 0)
6218
6283
  return content;
6284
+ const packageJsonDir = import_node_path22.default.dirname(absolutePackageJsonPath);
6219
6285
  const oldPackage = JSON.parse(content);
6220
6286
  const newPackage = {
6221
6287
  ...oldPackage,
6222
- [wxt.pm.overridesKey]: {
6223
- ...oldPackage[wxt.pm.overridesKey],
6224
- ...overrides
6225
- }
6288
+ [wxt.pm.overridesKey]: { ...oldPackage[wxt.pm.overridesKey] }
6226
6289
  };
6290
+ Object.entries(overrides).forEach(([key, absolutePath]) => {
6291
+ newPackage[wxt.pm.overridesKey][key] = "file://./" + normalizePath(import_node_path22.default.relative(packageJsonDir, absolutePath));
6292
+ });
6227
6293
  return JSON.stringify(newPackage, null, 2);
6228
6294
  }
6229
6295
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-5w9cnXgy.cjs';
2
- export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, p as Entrypoint, q as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, Z as ExtensionRunner, Y as FsCache, G as GenericEntrypoint, N as HookResult, s as IsolatedWorldContentScriptDefinition, i as IsolatedWorldContentScriptEntrypointOptions, L as Logger, t as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, r as OnContentScriptStopped, n as OptionsEntrypoint, j as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, y as PerBrowserMap, x as PerBrowserOption, m as PopupEntrypoint, P as PopupEntrypointOptions, R as ReloadContentScriptPayload, X as ResolvedConfig, a1 as ResolvedEslintrc, z as ResolvedPerBrowserOptions, K as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, A as UserManifest, D as UserManifestFn, _ as VirtualEntrypointType, V as Wxt, H as WxtBuilder, J as WxtBuilderServer, Q as WxtHooks, a4 as WxtPackageManager, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-5w9cnXgy.cjs';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-l43sonfW.cjs';
2
+ export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, p as Entrypoint, q as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, Z as ExtensionRunner, Y as FsCache, G as GenericEntrypoint, N as HookResult, s as IsolatedWorldContentScriptDefinition, i as IsolatedWorldContentScriptEntrypointOptions, L as Logger, t as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, r as OnContentScriptStopped, n as OptionsEntrypoint, j as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, y as PerBrowserMap, x as PerBrowserOption, m as PopupEntrypoint, P as PopupEntrypointOptions, R as ReloadContentScriptPayload, X as ResolvedConfig, a1 as ResolvedEslintrc, z as ResolvedPerBrowserOptions, K as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, A as UserManifest, D as UserManifestFn, _ as VirtualEntrypointType, V as Wxt, H as WxtBuilder, J as WxtBuilderServer, Q as WxtHooks, a4 as WxtPackageManager, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-l43sonfW.cjs';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -65,6 +65,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
65
65
  */
66
66
  declare function zip(config?: InlineConfig): Promise<string[]>;
67
67
 
68
- var version = "0.17.5";
68
+ var version = "0.17.7";
69
69
 
70
70
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-5w9cnXgy.js';
2
- export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, p as Entrypoint, q as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, Z as ExtensionRunner, Y as FsCache, G as GenericEntrypoint, N as HookResult, s as IsolatedWorldContentScriptDefinition, i as IsolatedWorldContentScriptEntrypointOptions, L as Logger, t as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, r as OnContentScriptStopped, n as OptionsEntrypoint, j as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, y as PerBrowserMap, x as PerBrowserOption, m as PopupEntrypoint, P as PopupEntrypointOptions, R as ReloadContentScriptPayload, X as ResolvedConfig, a1 as ResolvedEslintrc, z as ResolvedPerBrowserOptions, K as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, A as UserManifest, D as UserManifestFn, _ as VirtualEntrypointType, V as Wxt, H as WxtBuilder, J as WxtBuilderServer, Q as WxtHooks, a4 as WxtPackageManager, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-5w9cnXgy.js';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-l43sonfW.js';
2
+ export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, p as Entrypoint, q as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, Z as ExtensionRunner, Y as FsCache, G as GenericEntrypoint, N as HookResult, s as IsolatedWorldContentScriptDefinition, i as IsolatedWorldContentScriptEntrypointOptions, L as Logger, t as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, r as OnContentScriptStopped, n as OptionsEntrypoint, j as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, y as PerBrowserMap, x as PerBrowserOption, m as PopupEntrypoint, P as PopupEntrypointOptions, R as ReloadContentScriptPayload, X as ResolvedConfig, a1 as ResolvedEslintrc, z as ResolvedPerBrowserOptions, K as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, A as UserManifest, D as UserManifestFn, _ as VirtualEntrypointType, V as Wxt, H as WxtBuilder, J as WxtBuilderServer, Q as WxtHooks, a4 as WxtPackageManager, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-l43sonfW.js';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -65,6 +65,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
65
65
  */
66
66
  declare function zip(config?: InlineConfig): Promise<string[]>;
67
67
 
68
- var version = "0.17.5";
68
+ var version = "0.17.7";
69
69
 
70
70
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  unnormalizePath,
19
19
  version,
20
20
  wxt
21
- } from "./chunk-4K4AQ5GV.js";
21
+ } from "./chunk-QFL6IFHC.js";
22
22
  import "./chunk-VBXJIVYU.js";
23
23
 
24
24
  // src/core/build.ts
@@ -577,9 +577,9 @@ async function zip(config) {
577
577
  await zipDir(wxt.config.zip.sourcesRoot, sourcesZipPath, {
578
578
  include: wxt.config.zip.includeSources,
579
579
  exclude: wxt.config.zip.excludeSources,
580
- transform(file, content) {
581
- if (file.endsWith("package.json")) {
582
- return addOverridesToPackageJson(content, overrides);
580
+ transform(absolutePath, zipPath, content) {
581
+ if (zipPath.endsWith("package.json")) {
582
+ return addOverridesToPackageJson(absolutePath, content, overrides);
583
583
  }
584
584
  },
585
585
  additionalFiles: downloadedPackages
@@ -620,7 +620,7 @@ async function zipDir(directory, outputPath, options) {
620
620
  const content = await fs3.readFile(absolutePath, "utf-8");
621
621
  archive.file(
622
622
  file,
623
- await options?.transform?.(file, content) || content
623
+ await options?.transform?.(absolutePath, file, content) || content
624
624
  );
625
625
  } else {
626
626
  const content = await fs3.readFile(absolutePath);
@@ -651,22 +651,23 @@ async function downloadPrivatePackages() {
651
651
  wxt.config.zip.downloadedPackagesDir
652
652
  );
653
653
  files.push(tgzPath);
654
- overrides[id] = "file://./" + normalizePath(path3.relative(wxt.config.root, tgzPath));
654
+ overrides[id] = tgzPath;
655
655
  }
656
656
  }
657
657
  return { overrides, files };
658
658
  }
659
- function addOverridesToPackageJson(content, overrides) {
659
+ function addOverridesToPackageJson(absolutePackageJsonPath, content, overrides) {
660
660
  if (Object.keys(overrides).length === 0)
661
661
  return content;
662
+ const packageJsonDir = path3.dirname(absolutePackageJsonPath);
662
663
  const oldPackage = JSON.parse(content);
663
664
  const newPackage = {
664
665
  ...oldPackage,
665
- [wxt.pm.overridesKey]: {
666
- ...oldPackage[wxt.pm.overridesKey],
667
- ...overrides
668
- }
666
+ [wxt.pm.overridesKey]: { ...oldPackage[wxt.pm.overridesKey] }
669
667
  };
668
+ Object.entries(overrides).forEach(([key, absolutePath]) => {
669
+ newPackage[wxt.pm.overridesKey][key] = "file://./" + normalizePath(path3.relative(packageJsonDir, absolutePath));
670
+ });
670
671
  return JSON.stringify(newPackage, null, 2);
671
672
  }
672
673
  export {
package/dist/testing.cjs CHANGED
@@ -983,6 +983,7 @@ function isModuleInstalled(name) {
983
983
  }
984
984
 
985
985
  // src/core/utils/building/resolve-config.ts
986
+ var import_fs_extra10 = __toESM(require("fs-extra"), 1);
986
987
  var import_meta = {};
987
988
  async function resolveConfig(inlineConfig, command, server) {
988
989
  let userConfig = {};
@@ -1019,8 +1020,14 @@ async function resolveConfig(inlineConfig, command, server) {
1019
1020
  srcDir,
1020
1021
  mergedConfig.entrypointsDir ?? "entrypoints"
1021
1022
  );
1023
+ if (await isDirMissing(entrypointsDir)) {
1024
+ logMissingDir(logger, "Entrypoints", entrypointsDir);
1025
+ }
1022
1026
  const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
1023
1027
  const publicDir = import_node_path10.default.resolve(srcDir, mergedConfig.publicDir ?? "public");
1028
+ if (await isDirMissing(publicDir)) {
1029
+ logMissingDir(logger, "Public", publicDir);
1030
+ }
1024
1031
  const typesDir = import_node_path10.default.resolve(wxtDir, "types");
1025
1032
  const outBaseDir = import_node_path10.default.resolve(root, mergedConfig.outDir ?? ".output");
1026
1033
  const outDir = import_node_path10.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
@@ -1238,23 +1245,33 @@ async function resolveWxtModuleDir() {
1238
1245
  const requireResolve = require?.resolve ?? (await import("module")).default.createRequire(import_meta.url).resolve;
1239
1246
  return import_node_path10.default.resolve(requireResolve("wxt"), "../..");
1240
1247
  }
1248
+ async function isDirMissing(dir) {
1249
+ return !await import_fs_extra10.default.exists(dir);
1250
+ }
1251
+ function logMissingDir(logger, name, expected) {
1252
+ logger.warn(
1253
+ `${name} directory not found: ./${normalizePath(
1254
+ import_node_path10.default.relative(process.cwd(), expected)
1255
+ )}`
1256
+ );
1257
+ }
1241
1258
 
1242
1259
  // src/core/utils/building/import-entrypoint.ts
1243
1260
  var import_jiti = __toESM(require("jiti"), 1);
1244
1261
  var import_unimport3 = require("unimport");
1245
- var import_fs_extra10 = __toESM(require("fs-extra"), 1);
1262
+ var import_fs_extra11 = __toESM(require("fs-extra"), 1);
1246
1263
  var import_node_path11 = require("path");
1247
1264
  var import_esbuild = require("esbuild");
1248
1265
  var import_node_url = require("url");
1249
1266
 
1250
1267
  // src/core/utils/building/internal-build.ts
1251
1268
  var import_picocolors5 = __toESM(require("picocolors"), 1);
1252
- var import_fs_extra13 = __toESM(require("fs-extra"), 1);
1269
+ var import_fs_extra14 = __toESM(require("fs-extra"), 1);
1253
1270
 
1254
1271
  // src/core/utils/log/printFileList.ts
1255
1272
  var import_node_path12 = __toESM(require("path"), 1);
1256
1273
  var import_picocolors3 = __toESM(require("picocolors"), 1);
1257
- var import_fs_extra11 = __toESM(require("fs-extra"), 1);
1274
+ var import_fs_extra12 = __toESM(require("fs-extra"), 1);
1258
1275
  var import_filesize = require("filesize");
1259
1276
  var DEFAULT_COLOR = import_picocolors3.default.blue;
1260
1277
  var CHUNK_COLORS = {
@@ -1277,7 +1294,7 @@ var import_consola2 = require("consola");
1277
1294
  var import_fast_glob3 = __toESM(require("fast-glob"), 1);
1278
1295
 
1279
1296
  // src/core/utils/manifest.ts
1280
- var import_fs_extra12 = __toESM(require("fs-extra"), 1);
1297
+ var import_fs_extra13 = __toESM(require("fs-extra"), 1);
1281
1298
  var import_defu2 = __toESM(require("defu"), 1);
1282
1299
 
1283
1300
  // src/core/utils/building/internal-build.ts
@@ -1,6 +1,6 @@
1
1
  export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
2
2
  import * as vite from 'vite';
3
- import { I as InlineConfig } from './index-5w9cnXgy.cjs';
3
+ import { I as InlineConfig } from './index-l43sonfW.cjs';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
6
6
  import 'consola';
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
2
2
  import * as vite from 'vite';
3
- import { I as InlineConfig } from './index-5w9cnXgy.js';
3
+ import { I as InlineConfig } from './index-l43sonfW.js';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
6
6
  import 'consola';
package/dist/testing.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  tsconfigPaths,
6
6
  unimport,
7
7
  webextensionPolyfillMock
8
- } from "./chunk-4K4AQ5GV.js";
8
+ } from "./chunk-QFL6IFHC.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.5",
4
+ "version": "0.17.7",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }