wxt 0.10.1 → 0.10.3

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,17 +1,17 @@
1
1
  // package.json
2
- var version = "0.10.1";
2
+ var version = "0.10.3";
3
3
 
4
4
  // src/core/utils/entrypoints.ts
5
5
  import path, { relative, resolve } from "node:path";
6
6
 
7
7
  // src/core/utils/paths.ts
8
- import nodePath from "node:path";
9
- import * as vite from "vite";
10
- function normalizePath2(path7) {
11
- return vite.normalizePath(path7);
8
+ import systemPath from "node:path";
9
+ import normalize from "normalize-path";
10
+ function normalizePath(path7) {
11
+ return normalize(path7);
12
12
  }
13
13
  function unnormalizePath(path7) {
14
- return nodePath.normalize(path7);
14
+ return systemPath.normalize(path7);
15
15
  }
16
16
  var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
17
17
  var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
@@ -26,7 +26,7 @@ function getEntrypointOutputFile(entrypoint, ext) {
26
26
  return resolve(entrypoint.outputDir, `${entrypoint.name}${ext}`);
27
27
  }
28
28
  function getEntrypointBundlePath(entrypoint, outDir, ext) {
29
- return normalizePath2(
29
+ return normalizePath(
30
30
  relative(outDir, getEntrypointOutputFile(entrypoint, ext))
31
31
  );
32
32
  }
@@ -143,14 +143,14 @@ function getUnimportOptions(config) {
143
143
 
144
144
  // src/core/vite-plugins/unimport.ts
145
145
  import { extname } from "path";
146
- var ENABLED_EXTENSIONS = {
147
- ".js": true,
148
- ".jsx": true,
149
- ".ts": true,
150
- ".tsx": true,
151
- ".vue": true,
152
- ".svelte": true
153
- };
146
+ var ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
147
+ ".js",
148
+ ".jsx",
149
+ ".ts",
150
+ ".tsx",
151
+ ".vue",
152
+ ".svelte"
153
+ ]);
154
154
  function unimport(config) {
155
155
  const options = getUnimportOptions(config);
156
156
  if (options === false)
@@ -162,9 +162,11 @@ function unimport(config) {
162
162
  await unimport2.scanImportsFromDir(void 0, { cwd: config.srcDir });
163
163
  },
164
164
  async transform(code, id) {
165
- const ext = extname(id);
166
- if (ENABLED_EXTENSIONS[ext])
167
- return unimport2.injectImports(code, id);
165
+ if (id.includes("node_modules"))
166
+ return;
167
+ if (!ENABLED_EXTENSIONS.has(extname(id)))
168
+ return;
169
+ return unimport2.injectImports(code, id);
168
170
  }
169
171
  };
170
172
  }
@@ -443,7 +445,7 @@ function multipageMove(entrypoints, config) {
443
445
  async writeBundle(_, bundle) {
444
446
  for (const oldBundlePath in bundle) {
445
447
  const entrypoint = entrypoints.find(
446
- (entry) => !!normalizePath2(entry.inputPath).endsWith(oldBundlePath)
448
+ (entry) => !!normalizePath(entry.inputPath).endsWith(oldBundlePath)
447
449
  );
448
450
  if (entrypoint == null) {
449
451
  config.logger.debug(
@@ -490,7 +492,7 @@ function virtualEntrypoint(type, config) {
490
492
  const index = id.indexOf(virtualId);
491
493
  if (index === -1)
492
494
  return;
493
- const inputPath = normalizePath2(id.substring(index + virtualId.length));
495
+ const inputPath = normalizePath(id.substring(index + virtualId.length));
494
496
  return resolvedVirtualId + inputPath;
495
497
  },
496
498
  async load(id) {
@@ -659,7 +661,7 @@ function detectDevChanges(changedFiles, currentOutput) {
659
661
  }
660
662
  function findEffectedSteps(changedFile, currentOutput) {
661
663
  const changes = [];
662
- const changedPath = normalizePath2(changedFile[1]);
664
+ const changedPath = normalizePath(changedFile[1]);
663
665
  const isChunkEffected = (chunk) => (
664
666
  // If it's an HTML file with the same path, is is effected because HTML files need to be pre-rendered
665
667
  // fileName is normalized, relative bundle path
@@ -688,7 +690,7 @@ import { parseHTML as parseHTML2 } from "linkedom";
688
690
  import JSON5 from "json5";
689
691
 
690
692
  // src/core/utils/building/build-entrypoints.ts
691
- import * as vite2 from "vite";
693
+ import * as vite from "vite";
692
694
 
693
695
  // src/core/utils/fs.ts
694
696
  import fs3 from "fs-extra";
@@ -749,6 +751,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
749
751
  plugins.push(cssEntrypoints(entrypoint, config));
750
752
  }
751
753
  const libMode = {
754
+ mode: config.mode,
752
755
  plugins,
753
756
  build: {
754
757
  lib: {
@@ -786,11 +789,11 @@ async function buildSingleEntrypoint(entrypoint, config) {
786
789
  for (const global of getEntrypointGlobals(config, entrypoint.name)) {
787
790
  libMode.define[global.name] = JSON.stringify(global.value);
788
791
  }
789
- const entryConfig = vite2.mergeConfig(
792
+ const entryConfig = vite.mergeConfig(
790
793
  libMode,
791
794
  await config.vite(config.env)
792
795
  );
793
- const result = await vite2.build(entryConfig);
796
+ const result = await vite.build(entryConfig);
794
797
  return {
795
798
  entrypoints: entrypoint,
796
799
  chunks: getBuildOutputChunks(result)
@@ -798,6 +801,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
798
801
  }
799
802
  async function buildMultipleEntrypoints(entrypoints, config) {
800
803
  const multiPage = {
804
+ mode: config.mode,
801
805
  plugins: [multipageMove(entrypoints, config)],
802
806
  build: {
803
807
  rollupOptions: {
@@ -820,11 +824,11 @@ async function buildMultipleEntrypoints(entrypoints, config) {
820
824
  for (const global of getEntrypointGlobals(config, "html")) {
821
825
  multiPage.define[global.name] = JSON.stringify(global.value);
822
826
  }
823
- const entryConfig = vite2.mergeConfig(
827
+ const entryConfig = vite.mergeConfig(
824
828
  multiPage,
825
829
  await config.vite(config.env)
826
830
  );
827
- const result = await vite2.build(entryConfig);
831
+ const result = await vite.build(entryConfig);
828
832
  return {
829
833
  entrypoints,
830
834
  chunks: getBuildOutputChunks(result)
@@ -935,7 +939,7 @@ async function writePathsDeclarationFile(entrypoints, config) {
935
939
  config.outDir,
936
940
  entry.inputPath.endsWith(".html") ? ".html" : ".js"
937
941
  )
938
- ).concat(await getPublicFiles(config)).map(normalizePath2).map((path7) => ` | "/${path7}"`).sort().join("\n");
942
+ ).concat(await getPublicFiles(config)).map(normalizePath).map((path7) => ` | "/${path7}"`).sort().join("\n");
939
943
  const template = `// Generated by wxt
940
944
  import "wxt/browser";
941
945
 
@@ -1030,7 +1034,7 @@ async function writeMainDeclarationFile(references, config) {
1030
1034
  "// Generated by wxt",
1031
1035
  `/// <reference types="vite/client" />`,
1032
1036
  ...references.map(
1033
- (ref) => `/// <reference types="./${normalizePath2(relative3(dir, ref))}" />`
1037
+ (ref) => `/// <reference types="./${normalizePath(relative3(dir, ref))}" />`
1034
1038
  )
1035
1039
  ].join("\n") + "\n"
1036
1040
  );
@@ -1038,7 +1042,7 @@ async function writeMainDeclarationFile(references, config) {
1038
1042
  }
1039
1043
  async function writeTsConfigFile(mainReference, config) {
1040
1044
  const dir = config.wxtDir;
1041
- const getTsconfigPath = (path7) => normalizePath2(relative3(dir, path7));
1045
+ const getTsconfigPath = (path7) => normalizePath(relative3(dir, path7));
1042
1046
  const paths = Object.entries(config.alias).flatMap(([alias, absolutePath]) => {
1043
1047
  const aliasPath = getTsconfigPath(absolutePath);
1044
1048
  return [
@@ -1075,7 +1079,7 @@ ${paths}
1075
1079
  // src/core/utils/building/get-internal-config.ts
1076
1080
  import { loadConfig } from "c12";
1077
1081
  import path5 from "node:path";
1078
- import * as vite3 from "vite";
1082
+ import * as vite2 from "vite";
1079
1083
 
1080
1084
  // src/core/utils/cache.ts
1081
1085
  import fs6, { ensureDir as ensureDir2 } from "fs-extra";
@@ -1101,6 +1105,7 @@ function createFsCache(wxtDir) {
1101
1105
 
1102
1106
  // src/core/utils/building/get-internal-config.ts
1103
1107
  import consola, { LogLevels } from "consola";
1108
+ import defu from "defu";
1104
1109
  async function getInternalConfig(inlineConfig, command) {
1105
1110
  let userConfig = {};
1106
1111
  let userConfigMetadata;
@@ -1202,7 +1207,7 @@ function mergeInlineConfig(inlineConfig, userConfig) {
1202
1207
  } else if (userConfig.imports == null && inlineConfig.imports == null) {
1203
1208
  imports = void 0;
1204
1209
  } else {
1205
- imports = vite3.mergeConfig(
1210
+ imports = vite2.mergeConfig(
1206
1211
  userConfig.imports ?? {},
1207
1212
  inlineConfig.imports ?? {}
1208
1213
  );
@@ -1210,20 +1215,20 @@ function mergeInlineConfig(inlineConfig, userConfig) {
1210
1215
  const manifest = async (env) => {
1211
1216
  const user = await resolveManifestConfig(env, userConfig.manifest);
1212
1217
  const inline = await resolveManifestConfig(env, inlineConfig.manifest);
1213
- return vite3.mergeConfig(user, inline);
1218
+ return vite2.mergeConfig(user, inline);
1214
1219
  };
1215
1220
  const viteConfig = async (env) => {
1216
1221
  const user = await userConfig.vite?.(env);
1217
1222
  const inline = await inlineConfig.vite?.(env);
1218
- return vite3.mergeConfig(user ?? {}, inline ?? {});
1223
+ return vite2.mergeConfig(user ?? {}, inline ?? {});
1219
1224
  };
1220
- const runner = vite3.mergeConfig(
1221
- userConfig.runner ?? {},
1222
- inlineConfig.runner ?? {}
1225
+ const runner = defu(
1226
+ inlineConfig.runner ?? {},
1227
+ userConfig.runner ?? {}
1223
1228
  );
1224
- const zip = vite3.mergeConfig(
1225
- userConfig.zip ?? {},
1226
- inlineConfig.zip ?? {}
1229
+ const zip = defu(
1230
+ inlineConfig.zip ?? {},
1231
+ userConfig.zip ?? {}
1227
1232
  );
1228
1233
  return {
1229
1234
  root: inlineConfig.root ?? userConfig.root,
@@ -1372,7 +1377,7 @@ ${noImports}`;
1372
1377
  import { transformSync } from "esbuild";
1373
1378
  async function importEntrypointFile(path7, config) {
1374
1379
  config.logger.debug("Loading file metadata:", path7);
1375
- const normalPath = normalizePath2(path7);
1380
+ const normalPath = normalizePath(path7);
1376
1381
  const unimport2 = createUnimport3({
1377
1382
  ...getUnimportOptions(config),
1378
1383
  // Only allow specific imports, not all from the project
@@ -1428,7 +1433,7 @@ function getEsbuildOptions(opts) {
1428
1433
 
1429
1434
  // src/core/utils/building/internal-build.ts
1430
1435
  import pc4 from "picocolors";
1431
- import * as vite5 from "vite";
1436
+ import * as vite3 from "vite";
1432
1437
  import fs11 from "fs-extra";
1433
1438
 
1434
1439
  // src/core/utils/log/printBuildSummary.ts
@@ -1665,7 +1670,7 @@ async function getPackageJson(config) {
1665
1670
 
1666
1671
  // src/core/utils/manifest.ts
1667
1672
  import { produce } from "immer";
1668
- import * as vite4 from "vite";
1673
+ import defu2 from "defu";
1669
1674
  async function writeManifest(manifest, output, config) {
1670
1675
  const str = config.mode === "production" ? JSON.stringify(manifest) : JSON.stringify(manifest, null, 2);
1671
1676
  await fs10.ensureDir(config.outDir);
@@ -1695,9 +1700,9 @@ async function generateMainfest(entrypoints, buildOutput, config) {
1695
1700
  icons: discoverIcons(buildOutput)
1696
1701
  };
1697
1702
  const userManifest = config.manifest;
1698
- const manifest = vite4.mergeConfig(
1699
- baseManifest,
1700
- userManifest
1703
+ const manifest = defu2(
1704
+ userManifest,
1705
+ baseManifest
1701
1706
  );
1702
1707
  addEntrypoints(manifest, entrypoints, buildOutput, config);
1703
1708
  if (config.command === "serve")
@@ -1956,7 +1961,7 @@ function discoverIcons(buildOutput) {
1956
1961
  }
1957
1962
  if (size == null)
1958
1963
  return;
1959
- icons.push([size, normalizePath2(asset.fileName)]);
1964
+ icons.push([size, normalizePath(asset.fileName)]);
1960
1965
  });
1961
1966
  return icons.length > 0 ? Object.fromEntries(icons) : void 0;
1962
1967
  }
@@ -2096,7 +2101,7 @@ async function internalBuild(config) {
2096
2101
  const target = `${config.browser}-mv${config.manifestVersion}`;
2097
2102
  config.logger.info(
2098
2103
  `${verb} ${pc4.cyan(target)} for ${pc4.cyan(config.mode)} with ${pc4.green(
2099
- `Vite ${vite5.version}`
2104
+ `Vite ${vite3.version}`
2100
2105
  )}`
2101
2106
  );
2102
2107
  const startTime = Date.now();
package/dist/cli.cjs CHANGED
@@ -2316,11 +2316,11 @@ function execaNode(scriptPath, args, options = {}) {
2316
2316
  const stdio = normalizeStdioNode(options);
2317
2317
  const defaultExecArgv = import_node_process4.default.execArgv.filter((arg) => !arg.startsWith("--inspect"));
2318
2318
  const {
2319
- nodePath: nodePath2 = import_node_process4.default.execPath,
2319
+ nodePath = import_node_process4.default.execPath,
2320
2320
  nodeOptions = defaultExecArgv
2321
2321
  } = options;
2322
2322
  return execa(
2323
- nodePath2,
2323
+ nodePath,
2324
2324
  [
2325
2325
  ...nodeOptions,
2326
2326
  scriptPath,
@@ -2415,19 +2415,19 @@ var init_execa = __esm({
2415
2415
  var import_cac = __toESM(require("cac"), 1);
2416
2416
 
2417
2417
  // package.json
2418
- var version = "0.10.1";
2418
+ var version = "0.10.3";
2419
2419
 
2420
2420
  // src/core/utils/building/build-entrypoints.ts
2421
- var vite2 = __toESM(require("vite"), 1);
2421
+ var vite = __toESM(require("vite"), 1);
2422
2422
 
2423
2423
  // src/core/utils/entrypoints.ts
2424
2424
  var import_node_path2 = __toESM(require("path"), 1);
2425
2425
 
2426
2426
  // src/core/utils/paths.ts
2427
2427
  var import_node_path = __toESM(require("path"), 1);
2428
- var vite = __toESM(require("vite"), 1);
2429
- function normalizePath2(path11) {
2430
- return vite.normalizePath(path11);
2428
+ var import_normalize_path = __toESM(require("normalize-path"), 1);
2429
+ function normalizePath(path11) {
2430
+ return (0, import_normalize_path.default)(path11);
2431
2431
  }
2432
2432
  function unnormalizePath(path11) {
2433
2433
  return import_node_path.default.normalize(path11);
@@ -2445,7 +2445,7 @@ function getEntrypointOutputFile(entrypoint, ext) {
2445
2445
  return (0, import_node_path2.resolve)(entrypoint.outputDir, `${entrypoint.name}${ext}`);
2446
2446
  }
2447
2447
  function getEntrypointBundlePath(entrypoint, outDir, ext) {
2448
- return normalizePath2(
2448
+ return normalizePath(
2449
2449
  (0, import_node_path2.relative)(outDir, getEntrypointOutputFile(entrypoint, ext))
2450
2450
  );
2451
2451
  }
@@ -2680,7 +2680,7 @@ function multipageMove(entrypoints, config) {
2680
2680
  async writeBundle(_, bundle) {
2681
2681
  for (const oldBundlePath in bundle) {
2682
2682
  const entrypoint = entrypoints.find(
2683
- (entry) => !!normalizePath2(entry.inputPath).endsWith(oldBundlePath)
2683
+ (entry) => !!normalizePath(entry.inputPath).endsWith(oldBundlePath)
2684
2684
  );
2685
2685
  if (entrypoint == null) {
2686
2686
  config.logger.debug(
@@ -2746,14 +2746,14 @@ function getUnimportOptions(config) {
2746
2746
 
2747
2747
  // src/core/vite-plugins/unimport.ts
2748
2748
  var import_path2 = require("path");
2749
- var ENABLED_EXTENSIONS = {
2750
- ".js": true,
2751
- ".jsx": true,
2752
- ".ts": true,
2753
- ".tsx": true,
2754
- ".vue": true,
2755
- ".svelte": true
2756
- };
2749
+ var ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
2750
+ ".js",
2751
+ ".jsx",
2752
+ ".ts",
2753
+ ".tsx",
2754
+ ".vue",
2755
+ ".svelte"
2756
+ ]);
2757
2757
  function unimport(config) {
2758
2758
  const options = getUnimportOptions(config);
2759
2759
  if (options === false)
@@ -2765,9 +2765,11 @@ function unimport(config) {
2765
2765
  await unimport2.scanImportsFromDir(void 0, { cwd: config.srcDir });
2766
2766
  },
2767
2767
  async transform(code, id) {
2768
- const ext = (0, import_path2.extname)(id);
2769
- if (ENABLED_EXTENSIONS[ext])
2770
- return unimport2.injectImports(code, id);
2768
+ if (id.includes("node_modules"))
2769
+ return;
2770
+ if (!ENABLED_EXTENSIONS.has((0, import_path2.extname)(id)))
2771
+ return;
2772
+ return unimport2.injectImports(code, id);
2771
2773
  }
2772
2774
  };
2773
2775
  }
@@ -2784,7 +2786,7 @@ function virtualEntrypoint(type, config) {
2784
2786
  const index = id.indexOf(virtualId);
2785
2787
  if (index === -1)
2786
2788
  return;
2787
- const inputPath = normalizePath2(id.substring(index + virtualId.length));
2789
+ const inputPath = normalizePath(id.substring(index + virtualId.length));
2788
2790
  return resolvedVirtualId + inputPath;
2789
2791
  },
2790
2792
  async load(id) {
@@ -3032,6 +3034,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
3032
3034
  plugins.push(cssEntrypoints(entrypoint, config));
3033
3035
  }
3034
3036
  const libMode = {
3037
+ mode: config.mode,
3035
3038
  plugins,
3036
3039
  build: {
3037
3040
  lib: {
@@ -3069,11 +3072,11 @@ async function buildSingleEntrypoint(entrypoint, config) {
3069
3072
  for (const global3 of getEntrypointGlobals(config, entrypoint.name)) {
3070
3073
  libMode.define[global3.name] = JSON.stringify(global3.value);
3071
3074
  }
3072
- const entryConfig = vite2.mergeConfig(
3075
+ const entryConfig = vite.mergeConfig(
3073
3076
  libMode,
3074
3077
  await config.vite(config.env)
3075
3078
  );
3076
- const result = await vite2.build(entryConfig);
3079
+ const result = await vite.build(entryConfig);
3077
3080
  return {
3078
3081
  entrypoints: entrypoint,
3079
3082
  chunks: getBuildOutputChunks(result)
@@ -3081,6 +3084,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
3081
3084
  }
3082
3085
  async function buildMultipleEntrypoints(entrypoints, config) {
3083
3086
  const multiPage = {
3087
+ mode: config.mode,
3084
3088
  plugins: [multipageMove(entrypoints, config)],
3085
3089
  build: {
3086
3090
  rollupOptions: {
@@ -3103,11 +3107,11 @@ async function buildMultipleEntrypoints(entrypoints, config) {
3103
3107
  for (const global3 of getEntrypointGlobals(config, "html")) {
3104
3108
  multiPage.define[global3.name] = JSON.stringify(global3.value);
3105
3109
  }
3106
- const entryConfig = vite2.mergeConfig(
3110
+ const entryConfig = vite.mergeConfig(
3107
3111
  multiPage,
3108
3112
  await config.vite(config.env)
3109
3113
  );
3110
- const result = await vite2.build(entryConfig);
3114
+ const result = await vite.build(entryConfig);
3111
3115
  return {
3112
3116
  entrypoints,
3113
3117
  chunks: getBuildOutputChunks(result)
@@ -3212,7 +3216,7 @@ function detectDevChanges(changedFiles, currentOutput) {
3212
3216
  }
3213
3217
  function findEffectedSteps(changedFile, currentOutput) {
3214
3218
  const changes = [];
3215
- const changedPath = normalizePath2(changedFile[1]);
3219
+ const changedPath = normalizePath(changedFile[1]);
3216
3220
  const isChunkEffected = (chunk) => (
3217
3221
  // If it's an HTML file with the same path, is is effected because HTML files need to be pre-rendered
3218
3222
  // fileName is normalized, relative bundle path
@@ -3613,7 +3617,7 @@ async function writePathsDeclarationFile(entrypoints, config) {
3613
3617
  config.outDir,
3614
3618
  entry.inputPath.endsWith(".html") ? ".html" : ".js"
3615
3619
  )
3616
- ).concat(await getPublicFiles(config)).map(normalizePath2).map((path11) => ` | "/${path11}"`).sort().join("\n");
3620
+ ).concat(await getPublicFiles(config)).map(normalizePath).map((path11) => ` | "/${path11}"`).sort().join("\n");
3617
3621
  const template = `// Generated by wxt
3618
3622
  import "wxt/browser";
3619
3623
 
@@ -3708,7 +3712,7 @@ async function writeMainDeclarationFile(references, config) {
3708
3712
  "// Generated by wxt",
3709
3713
  `/// <reference types="vite/client" />`,
3710
3714
  ...references.map(
3711
- (ref) => `/// <reference types="./${normalizePath2((0, import_path6.relative)(dir, ref))}" />`
3715
+ (ref) => `/// <reference types="./${normalizePath((0, import_path6.relative)(dir, ref))}" />`
3712
3716
  )
3713
3717
  ].join("\n") + "\n"
3714
3718
  );
@@ -3716,7 +3720,7 @@ async function writeMainDeclarationFile(references, config) {
3716
3720
  }
3717
3721
  async function writeTsConfigFile(mainReference, config) {
3718
3722
  const dir = config.wxtDir;
3719
- const getTsconfigPath = (path11) => normalizePath2((0, import_path6.relative)(dir, path11));
3723
+ const getTsconfigPath = (path11) => normalizePath((0, import_path6.relative)(dir, path11));
3720
3724
  const paths = Object.entries(config.alias).flatMap(([alias, absolutePath]) => {
3721
3725
  const aliasPath = getTsconfigPath(absolutePath);
3722
3726
  return [
@@ -3753,7 +3757,7 @@ ${paths}
3753
3757
  // src/core/utils/building/get-internal-config.ts
3754
3758
  var import_c12 = require("c12");
3755
3759
  var import_node_path7 = __toESM(require("path"), 1);
3756
- var vite3 = __toESM(require("vite"), 1);
3760
+ var vite2 = __toESM(require("vite"), 1);
3757
3761
 
3758
3762
  // src/core/utils/cache.ts
3759
3763
  var import_fs_extra7 = __toESM(require("fs-extra"), 1);
@@ -3779,6 +3783,7 @@ function createFsCache(wxtDir) {
3779
3783
 
3780
3784
  // src/core/utils/building/get-internal-config.ts
3781
3785
  var import_consola = __toESM(require("consola"), 1);
3786
+ var import_defu = __toESM(require("defu"), 1);
3782
3787
  async function getInternalConfig(inlineConfig, command) {
3783
3788
  let userConfig = {};
3784
3789
  let userConfigMetadata;
@@ -3880,7 +3885,7 @@ function mergeInlineConfig(inlineConfig, userConfig) {
3880
3885
  } else if (userConfig.imports == null && inlineConfig.imports == null) {
3881
3886
  imports = void 0;
3882
3887
  } else {
3883
- imports = vite3.mergeConfig(
3888
+ imports = vite2.mergeConfig(
3884
3889
  userConfig.imports ?? {},
3885
3890
  inlineConfig.imports ?? {}
3886
3891
  );
@@ -3888,20 +3893,20 @@ function mergeInlineConfig(inlineConfig, userConfig) {
3888
3893
  const manifest = async (env) => {
3889
3894
  const user = await resolveManifestConfig(env, userConfig.manifest);
3890
3895
  const inline = await resolveManifestConfig(env, inlineConfig.manifest);
3891
- return vite3.mergeConfig(user, inline);
3896
+ return vite2.mergeConfig(user, inline);
3892
3897
  };
3893
3898
  const viteConfig = async (env) => {
3894
3899
  const user = await userConfig.vite?.(env);
3895
3900
  const inline = await inlineConfig.vite?.(env);
3896
- return vite3.mergeConfig(user ?? {}, inline ?? {});
3901
+ return vite2.mergeConfig(user ?? {}, inline ?? {});
3897
3902
  };
3898
- const runner = vite3.mergeConfig(
3899
- userConfig.runner ?? {},
3900
- inlineConfig.runner ?? {}
3903
+ const runner = (0, import_defu.default)(
3904
+ inlineConfig.runner ?? {},
3905
+ userConfig.runner ?? {}
3901
3906
  );
3902
- const zip2 = vite3.mergeConfig(
3903
- userConfig.zip ?? {},
3904
- inlineConfig.zip ?? {}
3907
+ const zip2 = (0, import_defu.default)(
3908
+ inlineConfig.zip ?? {},
3909
+ userConfig.zip ?? {}
3905
3910
  );
3906
3911
  return {
3907
3912
  root: inlineConfig.root ?? userConfig.root,
@@ -4050,7 +4055,7 @@ ${noImports}`;
4050
4055
  var import_esbuild = require("esbuild");
4051
4056
  async function importEntrypointFile(path11, config) {
4052
4057
  config.logger.debug("Loading file metadata:", path11);
4053
- const normalPath = normalizePath2(path11);
4058
+ const normalPath = normalizePath(path11);
4054
4059
  const unimport2 = (0, import_unimport5.createUnimport)({
4055
4060
  ...getUnimportOptions(config),
4056
4061
  // Only allow specific imports, not all from the project
@@ -4106,7 +4111,7 @@ function getEsbuildOptions(opts) {
4106
4111
 
4107
4112
  // src/core/utils/building/internal-build.ts
4108
4113
  var import_picocolors4 = __toESM(require("picocolors"), 1);
4109
- var vite5 = __toESM(require("vite"), 1);
4114
+ var vite3 = __toESM(require("vite"), 1);
4110
4115
  var import_fs_extra12 = __toESM(require("fs-extra"), 1);
4111
4116
 
4112
4117
  // src/core/utils/log/printBuildSummary.ts
@@ -4347,7 +4352,7 @@ async function getPackageJson(config) {
4347
4352
 
4348
4353
  // src/core/utils/manifest.ts
4349
4354
  var import_immer = require("immer");
4350
- var vite4 = __toESM(require("vite"), 1);
4355
+ var import_defu2 = __toESM(require("defu"), 1);
4351
4356
  async function writeManifest(manifest, output, config) {
4352
4357
  const str = config.mode === "production" ? JSON.stringify(manifest) : JSON.stringify(manifest, null, 2);
4353
4358
  await import_fs_extra11.default.ensureDir(config.outDir);
@@ -4377,9 +4382,9 @@ async function generateMainfest(entrypoints, buildOutput, config) {
4377
4382
  icons: discoverIcons(buildOutput)
4378
4383
  };
4379
4384
  const userManifest = config.manifest;
4380
- const manifest = vite4.mergeConfig(
4381
- baseManifest,
4382
- userManifest
4385
+ const manifest = (0, import_defu2.default)(
4386
+ userManifest,
4387
+ baseManifest
4383
4388
  );
4384
4389
  addEntrypoints(manifest, entrypoints, buildOutput, config);
4385
4390
  if (config.command === "serve")
@@ -4638,7 +4643,7 @@ function discoverIcons(buildOutput) {
4638
4643
  }
4639
4644
  if (size == null)
4640
4645
  return;
4641
- icons.push([size, normalizePath2(asset.fileName)]);
4646
+ icons.push([size, normalizePath(asset.fileName)]);
4642
4647
  });
4643
4648
  return icons.length > 0 ? Object.fromEntries(icons) : void 0;
4644
4649
  }
@@ -4778,7 +4783,7 @@ async function internalBuild(config) {
4778
4783
  const target = `${config.browser}-mv${config.manifestVersion}`;
4779
4784
  config.logger.info(
4780
4785
  `${verb} ${import_picocolors4.default.cyan(target)} for ${import_picocolors4.default.cyan(config.mode)} with ${import_picocolors4.default.green(
4781
- `Vite ${vite5.version}`
4786
+ `Vite ${vite3.version}`
4782
4787
  )}`
4783
4788
  );
4784
4789
  const startTime = Date.now();
@@ -4858,7 +4863,7 @@ async function clean(root = process.cwd()) {
4858
4863
  }
4859
4864
 
4860
4865
  // src/core/create-server.ts
4861
- var vite6 = __toESM(require("vite"), 1);
4866
+ var vite4 = __toESM(require("vite"), 1);
4862
4867
 
4863
4868
  // src/core/runners/wsl.ts
4864
4869
  var import_node_path13 = require("path");
@@ -5075,8 +5080,8 @@ async function getServerInfo() {
5075
5080
  }
5076
5081
  async function setupServer(serverInfo, config) {
5077
5082
  const runner = await createExtensionRunner(config);
5078
- const viteServer = await vite6.createServer(
5079
- vite6.mergeConfig(serverInfo, await config.vite(config.env))
5083
+ const viteServer = await vite4.createServer(
5084
+ vite4.mergeConfig(serverInfo, await config.vite(config.env))
5080
5085
  );
5081
5086
  const start = async () => {
5082
5087
  await viteServer.listen(server.port);
@@ -393,7 +393,7 @@ interface BaseEntrypoint {
393
393
  * - `named.sandbox.html` &rarr; `named`
394
394
  * - `named.sandbox/index.html` &rarr; `named`
395
395
  * - `sandbox.html` &rarr; `sandbox`
396
- * - `sandbox.index.html` &rarr; `sandbox`
396
+ * - `sandbox/index.html` &rarr; `sandbox`
397
397
  * - `overlay.content.ts` &rarr; `overlay`
398
398
  * - `overlay.content/index.ts` &rarr; `overlay`
399
399
  *
package/dist/index.cjs CHANGED
@@ -2317,11 +2317,11 @@ function execaNode(scriptPath, args, options = {}) {
2317
2317
  const stdio = normalizeStdioNode(options);
2318
2318
  const defaultExecArgv = import_node_process4.default.execArgv.filter((arg) => !arg.startsWith("--inspect"));
2319
2319
  const {
2320
- nodePath: nodePath2 = import_node_process4.default.execPath,
2320
+ nodePath = import_node_process4.default.execPath,
2321
2321
  nodeOptions = defaultExecArgv
2322
2322
  } = options;
2323
2323
  return execa(
2324
- nodePath2,
2324
+ nodePath,
2325
2325
  [
2326
2326
  ...nodeOptions,
2327
2327
  scriptPath,
@@ -2428,16 +2428,16 @@ __export(src_exports, {
2428
2428
  module.exports = __toCommonJS(src_exports);
2429
2429
 
2430
2430
  // src/core/utils/building/build-entrypoints.ts
2431
- var vite2 = __toESM(require("vite"), 1);
2431
+ var vite = __toESM(require("vite"), 1);
2432
2432
 
2433
2433
  // src/core/utils/entrypoints.ts
2434
2434
  var import_node_path2 = __toESM(require("path"), 1);
2435
2435
 
2436
2436
  // src/core/utils/paths.ts
2437
2437
  var import_node_path = __toESM(require("path"), 1);
2438
- var vite = __toESM(require("vite"), 1);
2439
- function normalizePath2(path11) {
2440
- return vite.normalizePath(path11);
2438
+ var import_normalize_path = __toESM(require("normalize-path"), 1);
2439
+ function normalizePath(path11) {
2440
+ return (0, import_normalize_path.default)(path11);
2441
2441
  }
2442
2442
  function unnormalizePath(path11) {
2443
2443
  return import_node_path.default.normalize(path11);
@@ -2455,7 +2455,7 @@ function getEntrypointOutputFile(entrypoint, ext) {
2455
2455
  return (0, import_node_path2.resolve)(entrypoint.outputDir, `${entrypoint.name}${ext}`);
2456
2456
  }
2457
2457
  function getEntrypointBundlePath(entrypoint, outDir, ext) {
2458
- return normalizePath2(
2458
+ return normalizePath(
2459
2459
  (0, import_node_path2.relative)(outDir, getEntrypointOutputFile(entrypoint, ext))
2460
2460
  );
2461
2461
  }
@@ -2690,7 +2690,7 @@ function multipageMove(entrypoints, config) {
2690
2690
  async writeBundle(_, bundle) {
2691
2691
  for (const oldBundlePath in bundle) {
2692
2692
  const entrypoint = entrypoints.find(
2693
- (entry) => !!normalizePath2(entry.inputPath).endsWith(oldBundlePath)
2693
+ (entry) => !!normalizePath(entry.inputPath).endsWith(oldBundlePath)
2694
2694
  );
2695
2695
  if (entrypoint == null) {
2696
2696
  config.logger.debug(
@@ -2756,14 +2756,14 @@ function getUnimportOptions(config) {
2756
2756
 
2757
2757
  // src/core/vite-plugins/unimport.ts
2758
2758
  var import_path2 = require("path");
2759
- var ENABLED_EXTENSIONS = {
2760
- ".js": true,
2761
- ".jsx": true,
2762
- ".ts": true,
2763
- ".tsx": true,
2764
- ".vue": true,
2765
- ".svelte": true
2766
- };
2759
+ var ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
2760
+ ".js",
2761
+ ".jsx",
2762
+ ".ts",
2763
+ ".tsx",
2764
+ ".vue",
2765
+ ".svelte"
2766
+ ]);
2767
2767
  function unimport(config) {
2768
2768
  const options = getUnimportOptions(config);
2769
2769
  if (options === false)
@@ -2775,9 +2775,11 @@ function unimport(config) {
2775
2775
  await unimport2.scanImportsFromDir(void 0, { cwd: config.srcDir });
2776
2776
  },
2777
2777
  async transform(code, id) {
2778
- const ext = (0, import_path2.extname)(id);
2779
- if (ENABLED_EXTENSIONS[ext])
2780
- return unimport2.injectImports(code, id);
2778
+ if (id.includes("node_modules"))
2779
+ return;
2780
+ if (!ENABLED_EXTENSIONS.has((0, import_path2.extname)(id)))
2781
+ return;
2782
+ return unimport2.injectImports(code, id);
2781
2783
  }
2782
2784
  };
2783
2785
  }
@@ -2794,7 +2796,7 @@ function virtualEntrypoint(type, config) {
2794
2796
  const index = id.indexOf(virtualId);
2795
2797
  if (index === -1)
2796
2798
  return;
2797
- const inputPath = normalizePath2(id.substring(index + virtualId.length));
2799
+ const inputPath = normalizePath(id.substring(index + virtualId.length));
2798
2800
  return resolvedVirtualId + inputPath;
2799
2801
  },
2800
2802
  async load(id) {
@@ -3042,6 +3044,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
3042
3044
  plugins.push(cssEntrypoints(entrypoint, config));
3043
3045
  }
3044
3046
  const libMode = {
3047
+ mode: config.mode,
3045
3048
  plugins,
3046
3049
  build: {
3047
3050
  lib: {
@@ -3079,11 +3082,11 @@ async function buildSingleEntrypoint(entrypoint, config) {
3079
3082
  for (const global3 of getEntrypointGlobals(config, entrypoint.name)) {
3080
3083
  libMode.define[global3.name] = JSON.stringify(global3.value);
3081
3084
  }
3082
- const entryConfig = vite2.mergeConfig(
3085
+ const entryConfig = vite.mergeConfig(
3083
3086
  libMode,
3084
3087
  await config.vite(config.env)
3085
3088
  );
3086
- const result = await vite2.build(entryConfig);
3089
+ const result = await vite.build(entryConfig);
3087
3090
  return {
3088
3091
  entrypoints: entrypoint,
3089
3092
  chunks: getBuildOutputChunks(result)
@@ -3091,6 +3094,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
3091
3094
  }
3092
3095
  async function buildMultipleEntrypoints(entrypoints, config) {
3093
3096
  const multiPage = {
3097
+ mode: config.mode,
3094
3098
  plugins: [multipageMove(entrypoints, config)],
3095
3099
  build: {
3096
3100
  rollupOptions: {
@@ -3113,11 +3117,11 @@ async function buildMultipleEntrypoints(entrypoints, config) {
3113
3117
  for (const global3 of getEntrypointGlobals(config, "html")) {
3114
3118
  multiPage.define[global3.name] = JSON.stringify(global3.value);
3115
3119
  }
3116
- const entryConfig = vite2.mergeConfig(
3120
+ const entryConfig = vite.mergeConfig(
3117
3121
  multiPage,
3118
3122
  await config.vite(config.env)
3119
3123
  );
3120
- const result = await vite2.build(entryConfig);
3124
+ const result = await vite.build(entryConfig);
3121
3125
  return {
3122
3126
  entrypoints,
3123
3127
  chunks: getBuildOutputChunks(result)
@@ -3222,7 +3226,7 @@ function detectDevChanges(changedFiles, currentOutput) {
3222
3226
  }
3223
3227
  function findEffectedSteps(changedFile, currentOutput) {
3224
3228
  const changes = [];
3225
- const changedPath = normalizePath2(changedFile[1]);
3229
+ const changedPath = normalizePath(changedFile[1]);
3226
3230
  const isChunkEffected = (chunk) => (
3227
3231
  // If it's an HTML file with the same path, is is effected because HTML files need to be pre-rendered
3228
3232
  // fileName is normalized, relative bundle path
@@ -3623,7 +3627,7 @@ async function writePathsDeclarationFile(entrypoints, config) {
3623
3627
  config.outDir,
3624
3628
  entry.inputPath.endsWith(".html") ? ".html" : ".js"
3625
3629
  )
3626
- ).concat(await getPublicFiles(config)).map(normalizePath2).map((path11) => ` | "/${path11}"`).sort().join("\n");
3630
+ ).concat(await getPublicFiles(config)).map(normalizePath).map((path11) => ` | "/${path11}"`).sort().join("\n");
3627
3631
  const template = `// Generated by wxt
3628
3632
  import "wxt/browser";
3629
3633
 
@@ -3718,7 +3722,7 @@ async function writeMainDeclarationFile(references, config) {
3718
3722
  "// Generated by wxt",
3719
3723
  `/// <reference types="vite/client" />`,
3720
3724
  ...references.map(
3721
- (ref) => `/// <reference types="./${normalizePath2((0, import_path6.relative)(dir, ref))}" />`
3725
+ (ref) => `/// <reference types="./${normalizePath((0, import_path6.relative)(dir, ref))}" />`
3722
3726
  )
3723
3727
  ].join("\n") + "\n"
3724
3728
  );
@@ -3726,7 +3730,7 @@ async function writeMainDeclarationFile(references, config) {
3726
3730
  }
3727
3731
  async function writeTsConfigFile(mainReference, config) {
3728
3732
  const dir = config.wxtDir;
3729
- const getTsconfigPath = (path11) => normalizePath2((0, import_path6.relative)(dir, path11));
3733
+ const getTsconfigPath = (path11) => normalizePath((0, import_path6.relative)(dir, path11));
3730
3734
  const paths = Object.entries(config.alias).flatMap(([alias, absolutePath]) => {
3731
3735
  const aliasPath = getTsconfigPath(absolutePath);
3732
3736
  return [
@@ -3763,7 +3767,7 @@ ${paths}
3763
3767
  // src/core/utils/building/get-internal-config.ts
3764
3768
  var import_c12 = require("c12");
3765
3769
  var import_node_path7 = __toESM(require("path"), 1);
3766
- var vite3 = __toESM(require("vite"), 1);
3770
+ var vite2 = __toESM(require("vite"), 1);
3767
3771
 
3768
3772
  // src/core/utils/cache.ts
3769
3773
  var import_fs_extra7 = __toESM(require("fs-extra"), 1);
@@ -3789,6 +3793,7 @@ function createFsCache(wxtDir) {
3789
3793
 
3790
3794
  // src/core/utils/building/get-internal-config.ts
3791
3795
  var import_consola = __toESM(require("consola"), 1);
3796
+ var import_defu = __toESM(require("defu"), 1);
3792
3797
  async function getInternalConfig(inlineConfig, command) {
3793
3798
  let userConfig = {};
3794
3799
  let userConfigMetadata;
@@ -3890,7 +3895,7 @@ function mergeInlineConfig(inlineConfig, userConfig) {
3890
3895
  } else if (userConfig.imports == null && inlineConfig.imports == null) {
3891
3896
  imports = void 0;
3892
3897
  } else {
3893
- imports = vite3.mergeConfig(
3898
+ imports = vite2.mergeConfig(
3894
3899
  userConfig.imports ?? {},
3895
3900
  inlineConfig.imports ?? {}
3896
3901
  );
@@ -3898,20 +3903,20 @@ function mergeInlineConfig(inlineConfig, userConfig) {
3898
3903
  const manifest = async (env) => {
3899
3904
  const user = await resolveManifestConfig(env, userConfig.manifest);
3900
3905
  const inline = await resolveManifestConfig(env, inlineConfig.manifest);
3901
- return vite3.mergeConfig(user, inline);
3906
+ return vite2.mergeConfig(user, inline);
3902
3907
  };
3903
3908
  const viteConfig = async (env) => {
3904
3909
  const user = await userConfig.vite?.(env);
3905
3910
  const inline = await inlineConfig.vite?.(env);
3906
- return vite3.mergeConfig(user ?? {}, inline ?? {});
3911
+ return vite2.mergeConfig(user ?? {}, inline ?? {});
3907
3912
  };
3908
- const runner = vite3.mergeConfig(
3909
- userConfig.runner ?? {},
3910
- inlineConfig.runner ?? {}
3913
+ const runner = (0, import_defu.default)(
3914
+ inlineConfig.runner ?? {},
3915
+ userConfig.runner ?? {}
3911
3916
  );
3912
- const zip2 = vite3.mergeConfig(
3913
- userConfig.zip ?? {},
3914
- inlineConfig.zip ?? {}
3917
+ const zip2 = (0, import_defu.default)(
3918
+ inlineConfig.zip ?? {},
3919
+ userConfig.zip ?? {}
3915
3920
  );
3916
3921
  return {
3917
3922
  root: inlineConfig.root ?? userConfig.root,
@@ -4060,7 +4065,7 @@ ${noImports}`;
4060
4065
  var import_esbuild = require("esbuild");
4061
4066
  async function importEntrypointFile(path11, config) {
4062
4067
  config.logger.debug("Loading file metadata:", path11);
4063
- const normalPath = normalizePath2(path11);
4068
+ const normalPath = normalizePath(path11);
4064
4069
  const unimport2 = (0, import_unimport5.createUnimport)({
4065
4070
  ...getUnimportOptions(config),
4066
4071
  // Only allow specific imports, not all from the project
@@ -4116,7 +4121,7 @@ function getEsbuildOptions(opts) {
4116
4121
 
4117
4122
  // src/core/utils/building/internal-build.ts
4118
4123
  var import_picocolors4 = __toESM(require("picocolors"), 1);
4119
- var vite5 = __toESM(require("vite"), 1);
4124
+ var vite3 = __toESM(require("vite"), 1);
4120
4125
  var import_fs_extra12 = __toESM(require("fs-extra"), 1);
4121
4126
 
4122
4127
  // src/core/utils/log/printBuildSummary.ts
@@ -4228,7 +4233,7 @@ function getChunkSortWeight(filename) {
4228
4233
  var import_picocolors3 = __toESM(require("picocolors"), 1);
4229
4234
 
4230
4235
  // package.json
4231
- var version = "0.10.1";
4236
+ var version = "0.10.3";
4232
4237
 
4233
4238
  // src/core/utils/log/printHeader.ts
4234
4239
  var import_consola2 = require("consola");
@@ -4358,7 +4363,7 @@ async function getPackageJson(config) {
4358
4363
 
4359
4364
  // src/core/utils/manifest.ts
4360
4365
  var import_immer = require("immer");
4361
- var vite4 = __toESM(require("vite"), 1);
4366
+ var import_defu2 = __toESM(require("defu"), 1);
4362
4367
  async function writeManifest(manifest, output, config) {
4363
4368
  const str = config.mode === "production" ? JSON.stringify(manifest) : JSON.stringify(manifest, null, 2);
4364
4369
  await import_fs_extra11.default.ensureDir(config.outDir);
@@ -4388,9 +4393,9 @@ async function generateMainfest(entrypoints, buildOutput, config) {
4388
4393
  icons: discoverIcons(buildOutput)
4389
4394
  };
4390
4395
  const userManifest = config.manifest;
4391
- const manifest = vite4.mergeConfig(
4392
- baseManifest,
4393
- userManifest
4396
+ const manifest = (0, import_defu2.default)(
4397
+ userManifest,
4398
+ baseManifest
4394
4399
  );
4395
4400
  addEntrypoints(manifest, entrypoints, buildOutput, config);
4396
4401
  if (config.command === "serve")
@@ -4649,7 +4654,7 @@ function discoverIcons(buildOutput) {
4649
4654
  }
4650
4655
  if (size == null)
4651
4656
  return;
4652
- icons.push([size, normalizePath2(asset.fileName)]);
4657
+ icons.push([size, normalizePath(asset.fileName)]);
4653
4658
  });
4654
4659
  return icons.length > 0 ? Object.fromEntries(icons) : void 0;
4655
4660
  }
@@ -4789,7 +4794,7 @@ async function internalBuild(config) {
4789
4794
  const target = `${config.browser}-mv${config.manifestVersion}`;
4790
4795
  config.logger.info(
4791
4796
  `${verb} ${import_picocolors4.default.cyan(target)} for ${import_picocolors4.default.cyan(config.mode)} with ${import_picocolors4.default.green(
4792
- `Vite ${vite5.version}`
4797
+ `Vite ${vite3.version}`
4793
4798
  )}`
4794
4799
  );
4795
4800
  const startTime = Date.now();
@@ -4879,7 +4884,7 @@ function defineRunnerConfig(config) {
4879
4884
  }
4880
4885
 
4881
4886
  // src/core/create-server.ts
4882
- var vite6 = __toESM(require("vite"), 1);
4887
+ var vite4 = __toESM(require("vite"), 1);
4883
4888
 
4884
4889
  // src/core/runners/wsl.ts
4885
4890
  var import_node_path13 = require("path");
@@ -5096,8 +5101,8 @@ async function getServerInfo() {
5096
5101
  }
5097
5102
  async function setupServer(serverInfo, config) {
5098
5103
  const runner = await createExtensionRunner(config);
5099
- const viteServer = await vite6.createServer(
5100
- vite6.mergeConfig(serverInfo, await config.vite(config.env))
5104
+ const viteServer = await vite4.createServer(
5105
+ vite4.mergeConfig(serverInfo, await config.vite(config.env))
5101
5106
  );
5102
5107
  const start = async () => {
5103
5108
  await viteServer.listen(server.port);
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 './external-9115d0fb.js';
2
- export { k as BackgroundDefinition, f as BackgroundEntrypoint, e as BaseEntrypoint, d as BaseEntrypointOptions, b as BuildStepOutput, q as ConfigEnv, j as ContentScriptDefinition, C as ContentScriptEntrypoint, g as Entrypoint, h as EntrypointGroup, n as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, i as OnContentScriptStopped, O as OptionsEntrypoint, m as PerBrowserOption, P as PopupEntrypoint, T as TargetBrowser, c as TargetManifestVersion, l as UnlistedScriptDefinition, o as UserManifest, p as UserManifestFn, a as WxtInlineViteConfig, r as WxtViteConfig } from './external-9115d0fb.js';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './external-d75ae6fd.js';
2
+ export { k as BackgroundDefinition, f as BackgroundEntrypoint, e as BaseEntrypoint, d as BaseEntrypointOptions, b as BuildStepOutput, q as ConfigEnv, j as ContentScriptDefinition, C as ContentScriptEntrypoint, g as Entrypoint, h as EntrypointGroup, n as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, i as OnContentScriptStopped, O as OptionsEntrypoint, m as PerBrowserOption, P as PopupEntrypoint, T as TargetBrowser, c as TargetManifestVersion, l as UnlistedScriptDefinition, o as UserManifest, p as UserManifestFn, a as WxtInlineViteConfig, r as WxtViteConfig } from './external-d75ae6fd.js';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -61,6 +61,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
61
61
  */
62
62
  declare function zip(config?: InlineConfig): Promise<string[]>;
63
63
 
64
- var version = "0.10.1";
64
+ var version = "0.10.3";
65
65
 
66
66
  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 './external-9115d0fb.js';
2
- export { k as BackgroundDefinition, f as BackgroundEntrypoint, e as BaseEntrypoint, d as BaseEntrypointOptions, b as BuildStepOutput, q as ConfigEnv, j as ContentScriptDefinition, C as ContentScriptEntrypoint, g as Entrypoint, h as EntrypointGroup, n as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, i as OnContentScriptStopped, O as OptionsEntrypoint, m as PerBrowserOption, P as PopupEntrypoint, T as TargetBrowser, c as TargetManifestVersion, l as UnlistedScriptDefinition, o as UserManifest, p as UserManifestFn, a as WxtInlineViteConfig, r as WxtViteConfig } from './external-9115d0fb.js';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './external-d75ae6fd.js';
2
+ export { k as BackgroundDefinition, f as BackgroundEntrypoint, e as BaseEntrypoint, d as BaseEntrypointOptions, b as BuildStepOutput, q as ConfigEnv, j as ContentScriptDefinition, C as ContentScriptEntrypoint, g as Entrypoint, h as EntrypointGroup, n as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, i as OnContentScriptStopped, O as OptionsEntrypoint, m as PerBrowserOption, P as PopupEntrypoint, T as TargetBrowser, c as TargetManifestVersion, l as UnlistedScriptDefinition, o as UserManifest, p as UserManifestFn, a as WxtInlineViteConfig, r as WxtViteConfig } from './external-d75ae6fd.js';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -61,6 +61,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
61
61
  */
62
62
  declare function zip(config?: InlineConfig): Promise<string[]>;
63
63
 
64
- var version = "0.10.1";
64
+ var version = "0.10.3";
65
65
 
66
66
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  rebuild,
16
16
  resolvePerBrowserOption,
17
17
  version
18
- } from "./chunk-U65ZYVCI.js";
18
+ } from "./chunk-BHUP6PAP.js";
19
19
  import "./chunk-YUG22S6W.js";
20
20
 
21
21
  // src/core/build.ts
package/dist/testing.cjs CHANGED
@@ -43,9 +43,9 @@ var import_node_path2 = __toESM(require("path"), 1);
43
43
 
44
44
  // src/core/utils/paths.ts
45
45
  var import_node_path = __toESM(require("path"), 1);
46
- var vite = __toESM(require("vite"), 1);
47
- function normalizePath2(path7) {
48
- return vite.normalizePath(path7);
46
+ var import_normalize_path = __toESM(require("normalize-path"), 1);
47
+ function normalizePath(path7) {
48
+ return (0, import_normalize_path.default)(path7);
49
49
  }
50
50
  var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
51
51
  var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
@@ -299,14 +299,14 @@ function getUnimportOptions(config) {
299
299
 
300
300
  // src/core/vite-plugins/unimport.ts
301
301
  var import_path2 = require("path");
302
- var ENABLED_EXTENSIONS = {
303
- ".js": true,
304
- ".jsx": true,
305
- ".ts": true,
306
- ".tsx": true,
307
- ".vue": true,
308
- ".svelte": true
309
- };
302
+ var ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
303
+ ".js",
304
+ ".jsx",
305
+ ".ts",
306
+ ".tsx",
307
+ ".vue",
308
+ ".svelte"
309
+ ]);
310
310
  function unimport(config) {
311
311
  const options = getUnimportOptions(config);
312
312
  if (options === false)
@@ -318,9 +318,11 @@ function unimport(config) {
318
318
  await unimport2.scanImportsFromDir(void 0, { cwd: config.srcDir });
319
319
  },
320
320
  async transform(code, id) {
321
- const ext = (0, import_path2.extname)(id);
322
- if (ENABLED_EXTENSIONS[ext])
323
- return unimport2.injectImports(code, id);
321
+ if (id.includes("node_modules"))
322
+ return;
323
+ if (!ENABLED_EXTENSIONS.has((0, import_path2.extname)(id)))
324
+ return;
325
+ return unimport2.injectImports(code, id);
324
326
  }
325
327
  };
326
328
  }
@@ -337,7 +339,7 @@ function virtualEntrypoint(type, config) {
337
339
  const index = id.indexOf(virtualId);
338
340
  if (index === -1)
339
341
  return;
340
- const inputPath = normalizePath2(id.substring(index + virtualId.length));
342
+ const inputPath = normalizePath(id.substring(index + virtualId.length));
341
343
  return resolvedVirtualId + inputPath;
342
344
  },
343
345
  async load(id) {
@@ -530,7 +532,7 @@ function excludeBrowserPolyfill(config) {
530
532
  }
531
533
 
532
534
  // src/core/utils/building/build-entrypoints.ts
533
- var vite2 = __toESM(require("vite"), 1);
535
+ var vite = __toESM(require("vite"), 1);
534
536
 
535
537
  // src/core/utils/fs.ts
536
538
  var import_fs_extra3 = __toESM(require("fs-extra"), 1);
@@ -603,7 +605,7 @@ var import_node_path6 = __toESM(require("path"), 1);
603
605
  // src/core/utils/building/get-internal-config.ts
604
606
  var import_c12 = require("c12");
605
607
  var import_node_path7 = __toESM(require("path"), 1);
606
- var vite3 = __toESM(require("vite"), 1);
608
+ var vite2 = __toESM(require("vite"), 1);
607
609
 
608
610
  // src/core/utils/cache.ts
609
611
  var import_fs_extra7 = __toESM(require("fs-extra"), 1);
@@ -629,6 +631,7 @@ function createFsCache(wxtDir) {
629
631
 
630
632
  // src/core/utils/building/get-internal-config.ts
631
633
  var import_consola = __toESM(require("consola"), 1);
634
+ var import_defu = __toESM(require("defu"), 1);
632
635
  async function getInternalConfig(inlineConfig, command) {
633
636
  let userConfig = {};
634
637
  let userConfigMetadata;
@@ -730,7 +733,7 @@ function mergeInlineConfig(inlineConfig, userConfig) {
730
733
  } else if (userConfig.imports == null && inlineConfig.imports == null) {
731
734
  imports = void 0;
732
735
  } else {
733
- imports = vite3.mergeConfig(
736
+ imports = vite2.mergeConfig(
734
737
  userConfig.imports ?? {},
735
738
  inlineConfig.imports ?? {}
736
739
  );
@@ -738,20 +741,20 @@ function mergeInlineConfig(inlineConfig, userConfig) {
738
741
  const manifest = async (env) => {
739
742
  const user = await resolveManifestConfig(env, userConfig.manifest);
740
743
  const inline = await resolveManifestConfig(env, inlineConfig.manifest);
741
- return vite3.mergeConfig(user, inline);
744
+ return vite2.mergeConfig(user, inline);
742
745
  };
743
746
  const viteConfig = async (env) => {
744
747
  const user = await userConfig.vite?.(env);
745
748
  const inline = await inlineConfig.vite?.(env);
746
- return vite3.mergeConfig(user ?? {}, inline ?? {});
749
+ return vite2.mergeConfig(user ?? {}, inline ?? {});
747
750
  };
748
- const runner = vite3.mergeConfig(
749
- userConfig.runner ?? {},
750
- inlineConfig.runner ?? {}
751
+ const runner = (0, import_defu.default)(
752
+ inlineConfig.runner ?? {},
753
+ userConfig.runner ?? {}
751
754
  );
752
- const zip = vite3.mergeConfig(
753
- userConfig.zip ?? {},
754
- inlineConfig.zip ?? {}
755
+ const zip = (0, import_defu.default)(
756
+ inlineConfig.zip ?? {},
757
+ userConfig.zip ?? {}
755
758
  );
756
759
  return {
757
760
  root: inlineConfig.root ?? userConfig.root,
@@ -844,7 +847,7 @@ var import_esbuild = require("esbuild");
844
847
 
845
848
  // src/core/utils/building/internal-build.ts
846
849
  var import_picocolors4 = __toESM(require("picocolors"), 1);
847
- var vite5 = __toESM(require("vite"), 1);
850
+ var vite3 = __toESM(require("vite"), 1);
848
851
  var import_fs_extra12 = __toESM(require("fs-extra"), 1);
849
852
 
850
853
  // src/core/utils/log/printFileList.ts
@@ -881,7 +884,7 @@ var import_fs_extra10 = __toESM(require("fs-extra"), 1);
881
884
 
882
885
  // src/core/utils/manifest.ts
883
886
  var import_immer = require("immer");
884
- var vite4 = __toESM(require("vite"), 1);
887
+ var import_defu2 = __toESM(require("defu"), 1);
885
888
 
886
889
  // src/testing/wxt-vitest-plugin.ts
887
890
  function WxtVitest(inlineConfig) {
@@ -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 './external-9115d0fb.js';
3
+ import { I as InlineConfig } from './external-d75ae6fd.js';
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 './external-9115d0fb.js';
3
+ import { I as InlineConfig } from './external-d75ae6fd.js';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
6
6
  import 'consola';
package/dist/testing.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  unimport,
7
7
  webextensionPolyfillAlias,
8
8
  webextensionPolyfillInlineDeps
9
- } from "./chunk-U65ZYVCI.js";
9
+ } from "./chunk-BHUP6PAP.js";
10
10
  import "./chunk-YUG22S6W.js";
11
11
 
12
12
  // src/testing/fake-browser.ts
@@ -2,7 +2,7 @@
2
2
  import { fakeBrowser } from "@webext-core/fake-browser";
3
3
 
4
4
  // src/core/utils/paths.ts
5
- import * as vite from "vite";
5
+ import normalize from "normalize-path";
6
6
  var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
7
7
  var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
8
8
 
@@ -28,7 +28,7 @@ var VIRTUAL_NOOP_BACKGROUND_MODULE_ID = "virtual:user-background";
28
28
  import { visualizer } from "rollup-plugin-visualizer";
29
29
 
30
30
  // src/core/utils/building/build-entrypoints.ts
31
- import * as vite2 from "vite";
31
+ import * as vite from "vite";
32
32
 
33
33
  // src/core/utils/fs.ts
34
34
  import fs3 from "fs-extra";
@@ -92,13 +92,14 @@ import fs6 from "fs-extra";
92
92
 
93
93
  // src/core/utils/building/get-internal-config.ts
94
94
  import { loadConfig } from "c12";
95
- import * as vite3 from "vite";
95
+ import * as vite2 from "vite";
96
96
 
97
97
  // src/core/utils/cache.ts
98
98
  import fs7, { ensureDir as ensureDir2 } from "fs-extra";
99
99
 
100
100
  // src/core/utils/building/get-internal-config.ts
101
101
  import consola, { LogLevels } from "consola";
102
+ import defu from "defu";
102
103
 
103
104
  // src/core/utils/building/import-entrypoint.ts
104
105
  import createJITI from "jiti";
@@ -108,7 +109,7 @@ import { transformSync } from "esbuild";
108
109
 
109
110
  // src/core/utils/building/internal-build.ts
110
111
  import pc4 from "picocolors";
111
- import * as vite5 from "vite";
112
+ import * as vite3 from "vite";
112
113
  import fs12 from "fs-extra";
113
114
 
114
115
  // src/core/utils/log/printFileList.ts
@@ -143,7 +144,7 @@ import fs10 from "fs-extra";
143
144
 
144
145
  // src/core/utils/manifest.ts
145
146
  import { produce } from "immer";
146
- import * as vite4 from "vite";
147
+ import defu2 from "defu";
147
148
 
148
149
  // src/virtual/mock-browser.ts
149
150
  var mock_browser_default = fakeBrowser;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.10.1",
4
+ "version": "0.10.3",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",
@@ -72,6 +72,7 @@
72
72
  "c12": "^1.5.1",
73
73
  "cac": "^6.7.14",
74
74
  "consola": "^3.2.3",
75
+ "defu": "^6.1.3",
75
76
  "esbuild": "^0.19.5",
76
77
  "fast-glob": "^3.3.1",
77
78
  "filesize": "^10.0.8",
@@ -84,6 +85,7 @@
84
85
  "json5": "^2.2.3",
85
86
  "linkedom": "^0.16.1",
86
87
  "minimatch": "^9.0.3",
88
+ "normalize-path": "^3.0.0",
87
89
  "ora": "^7.0.1",
88
90
  "picocolors": "^1.0.0",
89
91
  "prompts": "^2.4.2",
@@ -100,6 +102,7 @@
100
102
  "@types/fs-extra": "^11.0.3",
101
103
  "@types/lodash.merge": "^4.6.8",
102
104
  "@types/node": "^20.8.10",
105
+ "@types/normalize-path": "^3.0.2",
103
106
  "@types/prompts": "^2.4.7",
104
107
  "@vitest/coverage-v8": "^0.34.6",
105
108
  "execa": "^8.0.1",
@@ -112,10 +115,10 @@
112
115
  "simple-git-hooks": "^2.9.0",
113
116
  "tsup": "^7.2.0",
114
117
  "tsx": "^3.12.7",
115
- "typedoc": "^0.25.3",
118
+ "typedoc": "^0.25.4",
116
119
  "typedoc-plugin-markdown": "4.0.0-next.23",
117
120
  "typedoc-vitepress-theme": "1.0.0-next.3",
118
- "typescript": "^5.2.2",
121
+ "typescript": "^5.3.2",
119
122
  "vitepress": "1.0.0-rc.24",
120
123
  "vitest": "^0.34.6",
121
124
  "vitest-mock-extended": "^1.3.1",