wxt 0.18.8 → 0.18.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import cac from "cac";
12
12
 
13
13
  // src/core/utils/fs.ts
14
14
  import fs3 from "fs-extra";
15
- import glob from "fast-glob";
15
+ import glob2 from "fast-glob";
16
16
 
17
17
  // src/core/utils/paths.ts
18
18
  import systemPath from "node:path";
@@ -548,38 +548,6 @@ async function removeEmptyDirs(dir) {
548
548
  }
549
549
  }
550
550
 
551
- // src/core/builders/vite/plugins/unimport.ts
552
- import { createUnimport } from "unimport";
553
- import { extname as extname2 } from "path";
554
- var ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
555
- ".js",
556
- ".jsx",
557
- ".ts",
558
- ".tsx",
559
- ".vue",
560
- ".svelte"
561
- ]);
562
- function unimport(config) {
563
- const options = config.imports;
564
- if (options === false) return [];
565
- const unimport2 = createUnimport(options);
566
- return {
567
- name: "wxt:unimport",
568
- async config() {
569
- await unimport2.scanImportsFromDir(void 0, { cwd: config.srcDir });
570
- },
571
- async transform(code, id) {
572
- if (id.includes("node_modules")) return;
573
- if (!ENABLED_EXTENSIONS.has(extname2(id))) return;
574
- const injected = await unimport2.injectImports(code, id);
575
- return {
576
- code: injected.code,
577
- map: injected.s.generateMap({ hires: "boundary", source: id })
578
- };
579
- }
580
- };
581
- }
582
-
583
551
  // src/core/utils/virtual-modules.ts
584
552
  var virtualEntrypointTypes = [
585
553
  "content-script-main-world",
@@ -974,8 +942,11 @@ ${noImports}`;
974
942
  }
975
943
 
976
944
  // src/core/builders/vite/index.ts
945
+ import { ViteNodeServer } from "vite-node/server";
946
+ import { ViteNodeRunner } from "vite-node/client";
947
+ import { installSourcemapsSupport } from "vite-node/source-map";
977
948
  async function createViteBuilder(wxtConfig, hooks, server) {
978
- const vite = await import("vite");
949
+ const vite2 = await import("vite");
979
950
  const getBaseConfig = async () => {
980
951
  const config = await wxtConfig.vite(wxtConfig.env);
981
952
  config.root = wxtConfig.root;
@@ -997,7 +968,6 @@ async function createViteBuilder(wxtConfig, hooks, server) {
997
968
  config.plugins.push(
998
969
  download(wxtConfig),
999
970
  devHtmlPrerender(wxtConfig, server),
1000
- unimport(wxtConfig),
1001
971
  resolveVirtualModules(wxtConfig),
1002
972
  devServerGlobals(wxtConfig, server),
1003
973
  tsconfigPaths(wxtConfig),
@@ -1120,22 +1090,65 @@ async function createViteBuilder(wxtConfig, hooks, server) {
1120
1090
  };
1121
1091
  return {
1122
1092
  name: "Vite",
1123
- version: vite.version,
1124
- async importEntrypoint(url) {
1125
- const baseConfig = await getBaseConfig();
1126
- const envConfig = {
1127
- plugins: [
1128
- webextensionPolyfillMock(wxtConfig),
1129
- removeEntrypointMainFunction(wxtConfig, url)
1130
- ]
1131
- };
1132
- const config = vite.mergeConfig(baseConfig, envConfig);
1133
- const server2 = await vite.createServer(config);
1134
- await server2.listen();
1135
- const runtime = await vite.createViteRuntime(server2, { hmr: false });
1136
- const module = await runtime.executeUrl(url);
1137
- await server2.close();
1138
- return module.default;
1093
+ version: vite2.version,
1094
+ async importEntrypoint(path11) {
1095
+ switch (wxtConfig.experimental.entrypointImporter) {
1096
+ default:
1097
+ case "jiti": {
1098
+ return await importEntrypointFile(path11);
1099
+ }
1100
+ case "vite-runtime": {
1101
+ const baseConfig = await getBaseConfig();
1102
+ const envConfig = {
1103
+ plugins: [
1104
+ webextensionPolyfillMock(wxtConfig),
1105
+ removeEntrypointMainFunction(wxtConfig, path11)
1106
+ ]
1107
+ };
1108
+ const config = vite2.mergeConfig(baseConfig, envConfig);
1109
+ const server2 = await vite2.createServer(config);
1110
+ await server2.listen();
1111
+ const runtime = await vite2.createViteRuntime(server2, { hmr: false });
1112
+ const module = await runtime.executeUrl(path11);
1113
+ await server2.close();
1114
+ return module.default;
1115
+ }
1116
+ case "vite-node": {
1117
+ const baseConfig = await getBaseConfig();
1118
+ baseConfig.optimizeDeps ??= {};
1119
+ baseConfig.optimizeDeps.noDiscovery = true;
1120
+ baseConfig.optimizeDeps.include = [];
1121
+ const envConfig = {
1122
+ plugins: [
1123
+ webextensionPolyfillMock(wxtConfig),
1124
+ removeEntrypointMainFunction(wxtConfig, path11)
1125
+ ]
1126
+ };
1127
+ const config = vite2.mergeConfig(baseConfig, envConfig);
1128
+ const server2 = await vite2.createServer(config);
1129
+ await server2.pluginContainer.buildStart({});
1130
+ const node = new ViteNodeServer(server2);
1131
+ installSourcemapsSupport({
1132
+ getSourceMap: (source) => node.getSourceMap(source)
1133
+ });
1134
+ const runner = new ViteNodeRunner({
1135
+ root: server2.config.root,
1136
+ base: server2.config.base,
1137
+ // when having the server and runner in a different context,
1138
+ // you will need to handle the communication between them
1139
+ // and pass to this function
1140
+ fetchModule(id) {
1141
+ return node.fetchModule(id);
1142
+ },
1143
+ resolveId(id, importer) {
1144
+ return node.resolveId(id, importer);
1145
+ }
1146
+ });
1147
+ const res = await runner.executeFile(path11);
1148
+ await server2.close();
1149
+ return res.default;
1150
+ }
1151
+ }
1139
1152
  },
1140
1153
  async build(group) {
1141
1154
  let entryConfig;
@@ -1143,13 +1156,13 @@ async function createViteBuilder(wxtConfig, hooks, server) {
1143
1156
  else if (group.inputPath.endsWith(".css"))
1144
1157
  entryConfig = getCssConfig(group);
1145
1158
  else entryConfig = getLibModeConfig(group);
1146
- const buildConfig = vite.mergeConfig(await getBaseConfig(), entryConfig);
1159
+ const buildConfig = vite2.mergeConfig(await getBaseConfig(), entryConfig);
1147
1160
  await hooks.callHook(
1148
1161
  "vite:build:extendConfig",
1149
1162
  toArray(group),
1150
1163
  buildConfig
1151
1164
  );
1152
- const result = await vite.build(buildConfig);
1165
+ const result = await vite2.build(buildConfig);
1153
1166
  return {
1154
1167
  entrypoints: group,
1155
1168
  chunks: getBuildOutputChunks(result)
@@ -1165,9 +1178,9 @@ async function createViteBuilder(wxtConfig, hooks, server) {
1165
1178
  }
1166
1179
  };
1167
1180
  const baseConfig = await getBaseConfig();
1168
- const finalConfig = vite.mergeConfig(baseConfig, serverConfig);
1181
+ const finalConfig = vite2.mergeConfig(baseConfig, serverConfig);
1169
1182
  await hooks.callHook("vite:devServer:extendConfig", finalConfig);
1170
- const viteServer = await vite.createServer(finalConfig);
1183
+ const viteServer = await vite2.createServer(finalConfig);
1171
1184
  const server2 = {
1172
1185
  async listen() {
1173
1186
  await viteServer.listen(info.port);
@@ -1215,6 +1228,107 @@ function getRollupEntry(entrypoint) {
1215
1228
  return entrypoint.inputPath;
1216
1229
  }
1217
1230
 
1231
+ // src/modules.ts
1232
+ import * as vite from "vite";
1233
+ import glob from "fast-glob";
1234
+ function defineWxtModule(module) {
1235
+ if (typeof module === "function") return { setup: module };
1236
+ return module;
1237
+ }
1238
+ function addViteConfig(wxt2, viteConfig) {
1239
+ wxt2.hooks.hook("ready", (wxt3) => {
1240
+ const userVite = wxt3.config.vite;
1241
+ wxt3.config.vite = async (env) => {
1242
+ const fromUser = await userVite(env);
1243
+ const fromModule = viteConfig(env) ?? {};
1244
+ return vite.mergeConfig(fromModule, fromUser);
1245
+ };
1246
+ });
1247
+ }
1248
+
1249
+ // src/builtin-modules/unimport.ts
1250
+ import { createUnimport } from "unimport";
1251
+ import { extname as extname2 } from "node:path";
1252
+ var unimport_default = defineWxtModule({
1253
+ name: "wxt:built-in:unimport",
1254
+ setup(wxt2) {
1255
+ const options = wxt2.config.imports;
1256
+ if (options === false) return;
1257
+ let unimport;
1258
+ wxt2.hooks.hook("ready", () => {
1259
+ const addModuleImports = (module) => {
1260
+ if (!module.imports) return;
1261
+ options.imports ??= [];
1262
+ options.imports.push(...module.imports);
1263
+ };
1264
+ wxt2.config.builtinModules.forEach(addModuleImports);
1265
+ wxt2.config.userModules.forEach(addModuleImports);
1266
+ });
1267
+ wxt2.hooks.afterEach((event) => {
1268
+ if (event.name === "ready") {
1269
+ unimport = createUnimport(options);
1270
+ }
1271
+ });
1272
+ wxt2.hooks.hook("prepare:types", async (_, entries) => {
1273
+ await unimport.init();
1274
+ entries.push(await getImportsDeclarationEntry(unimport));
1275
+ if (!options.eslintrc.enabled) return;
1276
+ entries.push(await getImportsEslintEntry(unimport, options));
1277
+ });
1278
+ addViteConfig(wxt2, () => ({
1279
+ plugins: [vitePlugin(unimport)]
1280
+ }));
1281
+ }
1282
+ });
1283
+ function vitePlugin(unimport) {
1284
+ const ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
1285
+ ".js",
1286
+ ".jsx",
1287
+ ".ts",
1288
+ ".tsx",
1289
+ ".vue",
1290
+ ".svelte"
1291
+ ]);
1292
+ return {
1293
+ name: "wxt:unimport",
1294
+ async transform(code, id) {
1295
+ if (id.includes("node_modules")) return;
1296
+ if (!ENABLED_EXTENSIONS.has(extname2(id))) return;
1297
+ const injected = await unimport.injectImports(code, id);
1298
+ return {
1299
+ code: injected.code,
1300
+ map: injected.s.generateMap({ hires: "boundary", source: id })
1301
+ };
1302
+ }
1303
+ };
1304
+ }
1305
+ async function getImportsDeclarationEntry(unimport) {
1306
+ await unimport.init();
1307
+ return {
1308
+ path: "types/imports.d.ts",
1309
+ text: [
1310
+ "// Generated by wxt",
1311
+ await unimport.generateTypeDeclarations(),
1312
+ ""
1313
+ ].join("\n"),
1314
+ tsReference: true
1315
+ };
1316
+ }
1317
+ async function getImportsEslintEntry(unimport, options) {
1318
+ const globals2 = {};
1319
+ const eslintrc = { globals: globals2 };
1320
+ (await unimport.getImports()).map((i) => i.as ?? i.name).filter(Boolean).sort().forEach((name) => {
1321
+ eslintrc.globals[name] = options.eslintrc.globalsPropValue;
1322
+ });
1323
+ return {
1324
+ path: options.eslintrc.filePath,
1325
+ text: JSON.stringify(eslintrc, null, 2) + "\n"
1326
+ };
1327
+ }
1328
+
1329
+ // src/builtin-modules/index.ts
1330
+ var builtinModules = [unimport_default];
1331
+
1218
1332
  // src/core/wxt.ts
1219
1333
  var wxt;
1220
1334
  async function registerWxt(command, inlineConfig = {}, getServer) {
@@ -1236,18 +1350,16 @@ async function registerWxt(command, inlineConfig = {}, getServer) {
1236
1350
  builder,
1237
1351
  server
1238
1352
  };
1239
- for (const module of config.modules) {
1353
+ const initModule = async (module) => {
1240
1354
  if (module.hooks) wxt.hooks.addHooks(module.hooks);
1241
- if (wxt.config.imports !== false && module.imports) {
1242
- wxt.config.imports.imports ??= [];
1243
- wxt.config.imports.imports.push(...module.imports);
1244
- }
1245
1355
  await module.setup?.(
1246
1356
  wxt,
1247
1357
  // @ts-expect-error: Untyped configKey field
1248
1358
  module.configKey ? config[module.configKey] : void 0
1249
1359
  );
1250
- }
1360
+ };
1361
+ for (const builtinModule of builtinModules) await initModule(builtinModule);
1362
+ for (const userModule of config.userModules) await initModule(userModule);
1251
1363
  wxt.hooks.addHooks(config.hooks);
1252
1364
  await wxt.hooks.callHook("ready", wxt);
1253
1365
  }
@@ -1261,7 +1373,7 @@ async function writeFileIfDifferent(file, newContents) {
1261
1373
  }
1262
1374
  async function getPublicFiles() {
1263
1375
  if (!await fs3.exists(wxt.config.publicDir)) return [];
1264
- const files = await glob("**/*", { cwd: wxt.config.publicDir });
1376
+ const files = await glob2("**/*", { cwd: wxt.config.publicDir });
1265
1377
  return files.map(unnormalizePath);
1266
1378
  }
1267
1379
 
@@ -1295,13 +1407,17 @@ async function copyPublicDirectory() {
1295
1407
  await wxt.hooks.callHook("build:publicAssets", wxt, files);
1296
1408
  if (files.length === 0) return [];
1297
1409
  const publicAssets = [];
1298
- for (const { absoluteSrc, relativeDest } of files) {
1299
- const absoluteDest = resolve6(wxt.config.outDir, relativeDest);
1410
+ for (const file of files) {
1411
+ const absoluteDest = resolve6(wxt.config.outDir, file.relativeDest);
1300
1412
  await fs4.ensureDir(dirname3(absoluteDest));
1301
- await fs4.copyFile(absoluteSrc, absoluteDest);
1413
+ if ("absoluteSrc" in file) {
1414
+ await fs4.copyFile(file.absoluteSrc, absoluteDest);
1415
+ } else {
1416
+ await fs4.writeFile(absoluteDest, file.contents, "utf8");
1417
+ }
1302
1418
  publicAssets.push({
1303
1419
  type: "asset",
1304
- fileName: relativeDest
1420
+ fileName: file.relativeDest
1305
1421
  });
1306
1422
  }
1307
1423
  return publicAssets;
@@ -1400,117 +1516,26 @@ function findEffectedSteps(changedFile, currentOutput) {
1400
1516
  }
1401
1517
 
1402
1518
  // src/core/utils/building/find-entrypoints.ts
1403
- import { relative as relative4, resolve as resolve8 } from "path";
1404
- import fs6 from "fs-extra";
1519
+ import { relative as relative3, resolve as resolve7 } from "path";
1520
+ import fs5 from "fs-extra";
1405
1521
  import { minimatch } from "minimatch";
1406
1522
  import { parseHTML as parseHTML3 } from "linkedom";
1407
1523
  import JSON5 from "json5";
1408
- import glob2 from "fast-glob";
1524
+ import glob3 from "fast-glob";
1409
1525
  import pc2 from "picocolors";
1410
-
1411
- // src/core/utils/building/import-entrypoint.ts
1412
- import createJITI from "jiti";
1413
- import { createUnimport as createUnimport2 } from "unimport";
1414
- import fs5 from "fs-extra";
1415
- import { relative as relative3, resolve as resolve7 } from "node:path";
1416
- import { transformSync } from "esbuild";
1417
- import { fileURLToPath } from "node:url";
1418
- async function importEntrypointFile(path11) {
1419
- wxt.logger.debug("Loading file metadata:", path11);
1420
- const normalPath = normalizePath(path11);
1421
- const unimport2 = createUnimport2({
1422
- ...wxt.config.imports,
1423
- // Only allow specific imports, not all from the project
1424
- dirs: []
1425
- });
1426
- await unimport2.init();
1427
- const text = await fs5.readFile(path11, "utf-8");
1428
- const textNoImports = removeProjectImportStatements(text);
1429
- const { code } = await unimport2.injectImports(textNoImports);
1430
- wxt.logger.debug(
1431
- ["Text:", text, "No imports:", textNoImports, "Code:", code].join("\n")
1432
- );
1433
- const jiti = createJITI(
1434
- typeof __filename !== "undefined" ? __filename : fileURLToPath(import.meta.url),
1435
- {
1436
- cache: false,
1437
- debug: wxt.config.debug,
1438
- esmResolve: true,
1439
- alias: {
1440
- "webextension-polyfill": resolve7(
1441
- wxt.config.wxtModuleDir,
1442
- "dist/virtual/mock-browser.js"
1443
- )
1444
- },
1445
- // Continue using node to load TS files even if `bun run --bun` is detected. Jiti does not
1446
- // respect the custom transform function when using it's native bun option.
1447
- experimentalBun: false,
1448
- // List of extensions to transform with esbuild
1449
- extensions: [
1450
- ".ts",
1451
- ".cts",
1452
- ".mts",
1453
- ".tsx",
1454
- ".js",
1455
- ".cjs",
1456
- ".mjs",
1457
- ".jsx"
1458
- ],
1459
- transform(opts) {
1460
- const isEntrypoint = opts.filename === normalPath;
1461
- return transformSync(
1462
- // Use modified source code for entrypoints
1463
- isEntrypoint ? code : opts.source,
1464
- getEsbuildOptions(opts)
1465
- );
1466
- }
1467
- }
1468
- );
1469
- try {
1470
- const res = await jiti(path11);
1471
- return res.default;
1472
- } catch (err) {
1473
- const filePath = relative3(wxt.config.root, path11);
1474
- if (err instanceof ReferenceError) {
1475
- const variableName = err.message.replace(" is not defined", "");
1476
- throw Error(
1477
- `${filePath}: Cannot use imported variable "${variableName}" outside the main function. See https://wxt.dev/guide/go-further/entrypoint-side-effects.html`,
1478
- { cause: err }
1479
- );
1480
- } else {
1481
- wxt.logger.error(err);
1482
- throw Error(`Failed to load entrypoint: ${filePath}`, { cause: err });
1483
- }
1484
- }
1485
- }
1486
- function getEsbuildOptions(opts) {
1487
- const isJsx = opts.filename?.endsWith("x");
1488
- return {
1489
- format: "cjs",
1490
- loader: isJsx ? "tsx" : "ts",
1491
- ...isJsx ? {
1492
- // `h` and `Fragment` are undefined, but that's OK because JSX is never evaluated while
1493
- // grabbing the entrypoint's options.
1494
- jsxFactory: "h",
1495
- jsxFragment: "Fragment"
1496
- } : void 0
1497
- };
1498
- }
1499
-
1500
- // src/core/utils/building/find-entrypoints.ts
1501
1526
  async function findEntrypoints() {
1502
- await fs6.mkdir(wxt.config.wxtDir, { recursive: true });
1503
- await fs6.writeJson(resolve8(wxt.config.wxtDir, "tsconfig.json"), {});
1504
- const relativePaths = await glob2(Object.keys(PATH_GLOB_TO_TYPE_MAP), {
1527
+ await fs5.mkdir(wxt.config.wxtDir, { recursive: true });
1528
+ await fs5.writeJson(resolve7(wxt.config.wxtDir, "tsconfig.json"), {});
1529
+ const relativePaths = await glob3(Object.keys(PATH_GLOB_TO_TYPE_MAP), {
1505
1530
  cwd: wxt.config.entrypointsDir
1506
1531
  });
1507
1532
  relativePaths.sort();
1508
1533
  const pathGlobs = Object.keys(PATH_GLOB_TO_TYPE_MAP);
1509
1534
  const entrypointInfos = relativePaths.reduce((results, relativePath) => {
1510
- const inputPath = resolve8(wxt.config.entrypointsDir, relativePath);
1535
+ const inputPath = resolve7(wxt.config.entrypointsDir, relativePath);
1511
1536
  const name = getEntrypointName(wxt.config.entrypointsDir, inputPath);
1512
1537
  const matchingGlob = pathGlobs.find(
1513
- (glob7) => minimatch(relativePath, glob7)
1538
+ (glob8) => minimatch(relativePath, glob8)
1514
1539
  );
1515
1540
  if (matchingGlob) {
1516
1541
  const type = PATH_GLOB_TO_TYPE_MAP[matchingGlob];
@@ -1549,7 +1574,7 @@ async function findEntrypoints() {
1549
1574
  return {
1550
1575
  ...info,
1551
1576
  type,
1552
- outputDir: resolve8(wxt.config.outDir, CONTENT_SCRIPT_OUT_DIR),
1577
+ outputDir: resolve7(wxt.config.outDir, CONTENT_SCRIPT_OUT_DIR),
1553
1578
  options: {
1554
1579
  include: void 0,
1555
1580
  exclude: void 0
@@ -1623,7 +1648,7 @@ function preventDuplicateEntrypointNames(files) {
1623
1648
  if (absolutePaths.length > 1) {
1624
1649
  lines.push(`- ${name}`);
1625
1650
  absolutePaths.forEach((absolutePath) => {
1626
- lines.push(` - ${relative4(wxt.config.root, absolutePath)}`);
1651
+ lines.push(` - ${relative3(wxt.config.root, absolutePath)}`);
1627
1652
  });
1628
1653
  }
1629
1654
  return lines;
@@ -1711,7 +1736,7 @@ async function getUnlistedScriptEntrypoint({
1711
1736
  name,
1712
1737
  skipped
1713
1738
  }) {
1714
- const defaultExport = await importEntrypoint(inputPath);
1739
+ const defaultExport = await wxt.builder.importEntrypoint(inputPath);
1715
1740
  if (defaultExport == null) {
1716
1741
  throw Error(
1717
1742
  `${name}: Default export not found, did you forget to call "export default defineUnlistedScript(...)"?`
@@ -1734,7 +1759,7 @@ async function getBackgroundEntrypoint({
1734
1759
  }) {
1735
1760
  let options = {};
1736
1761
  if (inputPath !== VIRTUAL_NOOP_BACKGROUND_MODULE_ID) {
1737
- const defaultExport = await importEntrypoint(inputPath);
1762
+ const defaultExport = await wxt.builder.importEntrypoint(inputPath);
1738
1763
  if (defaultExport == null) {
1739
1764
  throw Error(
1740
1765
  `${name}: Default export not found, did you forget to call "export default defineBackground(...)"?`
@@ -1760,7 +1785,13 @@ async function getContentScriptEntrypoint({
1760
1785
  name,
1761
1786
  skipped
1762
1787
  }) {
1763
- const { main: _, ...options } = await importEntrypoint(inputPath);
1788
+ const defaultExport = await wxt.builder.importEntrypoint(inputPath);
1789
+ if (defaultExport == null) {
1790
+ throw Error(
1791
+ `${name}: Default export not found, did you forget to call "export default defineContentScript(...)"?`
1792
+ );
1793
+ }
1794
+ const { main: _, ...options } = defaultExport;
1764
1795
  if (options == null) {
1765
1796
  throw Error(
1766
1797
  `${name}: Default export not found, did you forget to call "export default defineContentScript(...)"?`
@@ -1770,7 +1801,7 @@ async function getContentScriptEntrypoint({
1770
1801
  type: "content-script",
1771
1802
  name,
1772
1803
  inputPath,
1773
- outputDir: resolve8(wxt.config.outDir, CONTENT_SCRIPT_OUT_DIR),
1804
+ outputDir: resolve7(wxt.config.outDir, CONTENT_SCRIPT_OUT_DIR),
1774
1805
  options: resolvePerBrowserOptions(options, wxt.config.browser),
1775
1806
  skipped
1776
1807
  };
@@ -1803,7 +1834,7 @@ async function getSidepanelEntrypoint(info) {
1803
1834
  };
1804
1835
  }
1805
1836
  async function getHtmlEntrypointOptions(info, keyMap, queries, parsers) {
1806
- const content = await fs6.readFile(info.inputPath, "utf-8");
1837
+ const content = await fs5.readFile(info.inputPath, "utf-8");
1807
1838
  const { document } = parseHTML3(content);
1808
1839
  const options = {};
1809
1840
  const defaultQuery = (manifestKey) => document.querySelector(`meta[name='manifest.${manifestKey}']`)?.getAttribute("content");
@@ -1863,14 +1894,10 @@ var PATH_GLOB_TO_TYPE_MAP = {
1863
1894
  [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
1864
1895
  };
1865
1896
  var CONTENT_SCRIPT_OUT_DIR = "content-scripts";
1866
- function importEntrypoint(path11) {
1867
- return wxt.config.experimental.viteRuntime ? wxt.builder.importEntrypoint(path11) : importEntrypointFile(path11);
1868
- }
1869
1897
 
1870
1898
  // src/core/utils/building/generate-wxt-dir.ts
1871
- import { createUnimport as createUnimport3 } from "unimport";
1872
- import fs7 from "fs-extra";
1873
- import { relative as relative5, resolve as resolve9 } from "path";
1899
+ import fs6 from "fs-extra";
1900
+ import { dirname as dirname4, relative as relative4, resolve as resolve8 } from "node:path";
1874
1901
  import path5 from "node:path";
1875
1902
 
1876
1903
  // src/core/utils/i18n.ts
@@ -1912,42 +1939,33 @@ function parseI18nMessages(messagesJson) {
1912
1939
 
1913
1940
  // src/core/utils/building/generate-wxt-dir.ts
1914
1941
  async function generateTypesDir(entrypoints) {
1915
- await fs7.ensureDir(wxt.config.typesDir);
1916
- const references = [];
1917
- if (wxt.config.imports !== false) {
1918
- const unimport2 = createUnimport3(wxt.config.imports);
1919
- references.push(await writeImportsDeclarationFile(unimport2));
1920
- if (wxt.config.imports.eslintrc.enabled) {
1921
- await writeImportsEslintFile(unimport2, wxt.config.imports);
1922
- }
1923
- }
1924
- references.push(await writePathsDeclarationFile(entrypoints));
1925
- references.push(await writeI18nDeclarationFile());
1926
- references.push(await writeGlobalsDeclarationFile());
1927
- const mainReference = await writeMainDeclarationFile(references);
1928
- await writeTsConfigFile(mainReference);
1929
- }
1930
- async function writeImportsDeclarationFile(unimport2) {
1931
- const filePath = resolve9(wxt.config.typesDir, "imports.d.ts");
1932
- await unimport2.scanImportsFromDir(void 0, { cwd: wxt.config.srcDir });
1933
- await writeFileIfDifferent(
1934
- filePath,
1935
- ["// Generated by wxt", await unimport2.generateTypeDeclarations()].join(
1936
- "\n"
1937
- ) + "\n"
1938
- );
1939
- return filePath;
1940
- }
1941
- async function writeImportsEslintFile(unimport2, options) {
1942
- const globals2 = {};
1943
- const eslintrc = { globals: globals2 };
1944
- (await unimport2.getImports()).map((i) => i.as ?? i.name).filter(Boolean).sort().forEach((name) => {
1945
- eslintrc.globals[name] = options.eslintrc.globalsPropValue;
1942
+ await fs6.ensureDir(wxt.config.typesDir);
1943
+ const entries = [
1944
+ // Hard-coded entries
1945
+ { module: "wxt/vite-builder-env" }
1946
+ ];
1947
+ wxt.config.userModules.forEach((module) => {
1948
+ if (module.type === "node_module" && module.configKey != null)
1949
+ entries.push({ module: module.id });
1946
1950
  });
1947
- await fs7.writeJson(options.eslintrc.filePath, eslintrc, { spaces: 2 });
1951
+ entries.push(await getPathsDeclarationEntry(entrypoints));
1952
+ entries.push(await getI18nDeclarationEntry());
1953
+ entries.push(await getGlobalsDeclarationEntry());
1954
+ entries.push(await getTsConfigEntry());
1955
+ await wxt.hooks.callHook("prepare:types", wxt, entries);
1956
+ entries.push(getMainDeclarationEntry(entries));
1957
+ const absoluteFileEntries = entries.filter((entry) => "path" in entry).map((entry) => ({
1958
+ ...entry,
1959
+ path: resolve8(wxt.config.wxtDir, entry.path)
1960
+ }));
1961
+ await Promise.all(
1962
+ absoluteFileEntries.map(async (file) => {
1963
+ await fs6.ensureDir(dirname4(file.path));
1964
+ await writeFileIfDifferent(file.path, file.text);
1965
+ })
1966
+ );
1948
1967
  }
1949
- async function writePathsDeclarationFile(entrypoints) {
1950
- const filePath = resolve9(wxt.config.typesDir, "paths.d.ts");
1968
+ async function getPathsDeclarationEntry(entrypoints) {
1951
1969
  const unions = entrypoints.map(
1952
1970
  (entry) => getEntrypointBundlePath(
1953
1971
  entry,
@@ -1968,14 +1986,13 @@ declare module "wxt/browser" {
1968
1986
  }
1969
1987
  }
1970
1988
  `;
1971
- await writeFileIfDifferent(
1972
- filePath,
1973
- template.replace("{{ union }}", unions || " | never")
1974
- );
1975
- return filePath;
1989
+ return {
1990
+ path: "types/paths.d.ts",
1991
+ text: template.replace("{{ union }}", unions || " | never"),
1992
+ tsReference: true
1993
+ };
1976
1994
  }
1977
- async function writeI18nDeclarationFile() {
1978
- const filePath = resolve9(wxt.config.typesDir, "i18n.d.ts");
1995
+ async function getI18nDeclarationEntry() {
1979
1996
  const defaultLocale = wxt.config.manifest.default_locale;
1980
1997
  const template = `// Generated by wxt
1981
1998
  import "wxt/browser";
@@ -2004,7 +2021,7 @@ declare module "wxt/browser" {
2004
2021
  defaultLocale,
2005
2022
  "messages.json"
2006
2023
  );
2007
- const content = JSON.parse(await fs7.readFile(defaultLocalePath, "utf-8"));
2024
+ const content = JSON.parse(await fs6.readFile(defaultLocalePath, "utf-8"));
2008
2025
  messages = parseI18nMessages(content);
2009
2026
  } else {
2010
2027
  messages = parseI18nMessages({});
@@ -2021,18 +2038,17 @@ declare module "wxt/browser" {
2021
2038
  options?: GetMessageOptions,
2022
2039
  ): string;`;
2023
2040
  });
2024
- await writeFileIfDifferent(
2025
- filePath,
2026
- template.replace("{{ overrides }}", overrides.join("\n"))
2027
- );
2028
- return filePath;
2041
+ return {
2042
+ path: "types/i18n.d.ts",
2043
+ text: template.replace("{{ overrides }}", overrides.join("\n")),
2044
+ tsReference: true
2045
+ };
2029
2046
  }
2030
- async function writeGlobalsDeclarationFile() {
2031
- const filePath = resolve9(wxt.config.typesDir, "globals.d.ts");
2047
+ async function getGlobalsDeclarationEntry() {
2032
2048
  const globals2 = [...getGlobals(wxt.config), ...getEntrypointGlobals("")];
2033
- await writeFileIfDifferent(
2034
- filePath,
2035
- [
2049
+ return {
2050
+ path: "types/globals.d.ts",
2051
+ text: [
2036
2052
  "// Generated by wxt",
2037
2053
  "export {}",
2038
2054
  "interface ImportMetaEnv {",
@@ -2040,36 +2056,31 @@ async function writeGlobalsDeclarationFile() {
2040
2056
  "}",
2041
2057
  "interface ImportMeta {",
2042
2058
  " readonly env: ImportMetaEnv",
2043
- "}"
2044
- ].join("\n") + "\n"
2045
- );
2046
- return filePath;
2059
+ "}",
2060
+ ""
2061
+ ].join("\n"),
2062
+ tsReference: true
2063
+ };
2047
2064
  }
2048
- async function writeMainDeclarationFile(references) {
2049
- const dir = wxt.config.wxtDir;
2050
- const filePath = resolve9(dir, "wxt.d.ts");
2051
- await writeFileIfDifferent(
2052
- filePath,
2053
- [
2054
- "// Generated by wxt",
2055
- `/// <reference types="wxt/vite-builder-env" />`,
2056
- ...references.map(
2057
- (ref) => `/// <reference types="./${normalizePath(relative5(dir, ref))}" />`
2058
- ),
2059
- // Add references to modules installed from NPM to the TS project so
2060
- // their type augmentation can update InlineConfig correctly. Local
2061
- // modules defined in <root>/modules are already apart of the project, so
2062
- // we don't need to add them.
2063
- ...wxt.config.modules.filter(
2064
- (module) => module.type === "node_module" && module.configKey != null
2065
- ).map((module) => `/// <reference types="${module.id}" />`)
2066
- ].join("\n") + "\n"
2067
- );
2068
- return filePath;
2065
+ function getMainDeclarationEntry(references) {
2066
+ const lines = ["// Generated by wxt"];
2067
+ references.forEach((ref) => {
2068
+ if ("module" in ref) {
2069
+ return lines.push(`/// <reference types="${ref.module}" />`);
2070
+ } else if (ref.tsReference) {
2071
+ const absolutePath = resolve8(wxt.config.wxtDir, ref.path);
2072
+ const relativePath = relative4(wxt.config.wxtDir, absolutePath);
2073
+ lines.push(`/// <reference types="./${normalizePath(relativePath)}" />`);
2074
+ }
2075
+ });
2076
+ return {
2077
+ path: "wxt.d.ts",
2078
+ text: lines.join("\n") + "\n"
2079
+ };
2069
2080
  }
2070
- async function writeTsConfigFile(mainReference) {
2081
+ async function getTsConfigEntry() {
2071
2082
  const dir = wxt.config.wxtDir;
2072
- const getTsconfigPath = (path11) => normalizePath(relative5(dir, path11));
2083
+ const getTsconfigPath = (path11) => normalizePath(relative4(dir, path11));
2073
2084
  const paths = Object.entries(wxt.config.alias).flatMap(([alias, absolutePath]) => {
2074
2085
  const aliasPath = getTsconfigPath(absolutePath);
2075
2086
  return [
@@ -2077,9 +2088,7 @@ async function writeTsConfigFile(mainReference) {
2077
2088
  ` "${alias}/*": ["${aliasPath}/*"]`
2078
2089
  ];
2079
2090
  }).join(",\n");
2080
- await writeFileIfDifferent(
2081
- resolve9(dir, "tsconfig.json"),
2082
- `{
2091
+ const text = `{
2083
2092
  "compilerOptions": {
2084
2093
  "target": "ESNext",
2085
2094
  "module": "ESNext",
@@ -2096,11 +2105,14 @@ ${paths}
2096
2105
  },
2097
2106
  "include": [
2098
2107
  "${getTsconfigPath(wxt.config.root)}/**/*",
2099
- "./${getTsconfigPath(mainReference)}"
2108
+ "./wxt.d.ts"
2100
2109
  ],
2101
2110
  "exclude": ["${getTsconfigPath(wxt.config.outBaseDir)}"]
2102
- }`
2103
- );
2111
+ }`;
2112
+ return {
2113
+ path: "tsconfig.json",
2114
+ text
2115
+ };
2104
2116
  }
2105
2117
 
2106
2118
  // src/core/utils/building/resolve-config.ts
@@ -2108,20 +2120,20 @@ import { loadConfig } from "c12";
2108
2120
  import path6 from "node:path";
2109
2121
 
2110
2122
  // src/core/utils/cache.ts
2111
- import fs8, { ensureDir as ensureDir3 } from "fs-extra";
2112
- import { dirname as dirname4, resolve as resolve10 } from "path";
2123
+ import fs7, { ensureDir as ensureDir3 } from "fs-extra";
2124
+ import { dirname as dirname5, resolve as resolve9 } from "path";
2113
2125
  function createFsCache(wxtDir) {
2114
- const getPath = (key) => resolve10(wxtDir, "cache", encodeURIComponent(key));
2126
+ const getPath = (key) => resolve9(wxtDir, "cache", encodeURIComponent(key));
2115
2127
  return {
2116
2128
  async set(key, value) {
2117
2129
  const path11 = getPath(key);
2118
- await ensureDir3(dirname4(path11));
2130
+ await ensureDir3(dirname5(path11));
2119
2131
  await writeFileIfDifferent(path11, value);
2120
2132
  },
2121
2133
  async get(key) {
2122
2134
  const path11 = getPath(key);
2123
2135
  try {
2124
- return await fs8.readFile(path11, "utf-8");
2136
+ return await fs7.readFile(path11, "utf-8");
2125
2137
  } catch {
2126
2138
  return void 0;
2127
2139
  }
@@ -2133,12 +2145,12 @@ function createFsCache(wxtDir) {
2133
2145
  import defu from "defu";
2134
2146
 
2135
2147
  // src/core/utils/package.ts
2136
- import { resolve as resolve11 } from "node:path";
2137
- import fs9 from "fs-extra";
2148
+ import { resolve as resolve10 } from "node:path";
2149
+ import fs8 from "fs-extra";
2138
2150
  async function getPackageJson() {
2139
- const file = resolve11(wxt.config.root, "package.json");
2151
+ const file = resolve10(wxt.config.root, "package.json");
2140
2152
  try {
2141
- return await fs9.readJson(file);
2153
+ return await fs8.readJson(file);
2142
2154
  } catch (err) {
2143
2155
  wxt.logger.debug(
2144
2156
  `Failed to read package.json at: ${file}. Returning undefined.`
@@ -2154,8 +2166,8 @@ function isModuleInstalled(name) {
2154
2166
  }
2155
2167
 
2156
2168
  // src/core/utils/building/resolve-config.ts
2157
- import fs10 from "fs-extra";
2158
- import glob3 from "fast-glob";
2169
+ import fs9 from "fs-extra";
2170
+ import glob4 from "fast-glob";
2159
2171
  async function resolveConfig(inlineConfig, command) {
2160
2172
  let userConfig = {};
2161
2173
  let userConfigMetadata;
@@ -2232,14 +2244,20 @@ async function resolveConfig(inlineConfig, command) {
2232
2244
  hostname: "localhost"
2233
2245
  };
2234
2246
  }
2235
- const modules = await resolveWxtModules(modulesDir, mergedConfig.modules);
2236
- const moduleOptions = modules.reduce((map, module) => {
2237
- if (module.configKey) {
2238
- map[module.configKey] = // @ts-expect-error
2239
- mergedConfig[module.configKey];
2240
- }
2241
- return map;
2242
- }, {});
2247
+ const userModules = await resolveWxtUserModules(
2248
+ modulesDir,
2249
+ mergedConfig.modules
2250
+ );
2251
+ const moduleOptions = userModules.reduce(
2252
+ (map, module) => {
2253
+ if (module.configKey) {
2254
+ map[module.configKey] = // @ts-expect-error
2255
+ mergedConfig[module.configKey];
2256
+ }
2257
+ return map;
2258
+ },
2259
+ {}
2260
+ );
2243
2261
  return {
2244
2262
  browser,
2245
2263
  command,
@@ -2249,7 +2267,7 @@ async function resolveConfig(inlineConfig, command) {
2249
2267
  filterEntrypoints,
2250
2268
  env,
2251
2269
  fsCache: createFsCache(wxtDir),
2252
- imports: await getUnimportOptions(wxtDir, logger, mergedConfig),
2270
+ imports: await getUnimportOptions(wxtDir, srcDir, logger, mergedConfig),
2253
2271
  logger,
2254
2272
  manifest: await resolveManifestConfig(env, mergedConfig.manifest),
2255
2273
  manifestVersion,
@@ -2270,7 +2288,7 @@ async function resolveConfig(inlineConfig, command) {
2270
2288
  alias,
2271
2289
  experimental: defu(mergedConfig.experimental, {
2272
2290
  includeBrowserPolyfill: true,
2273
- viteRuntime: false
2291
+ entrypointImporter: "jiti"
2274
2292
  }),
2275
2293
  dev: {
2276
2294
  server: devServerConfig,
@@ -2278,7 +2296,8 @@ async function resolveConfig(inlineConfig, command) {
2278
2296
  },
2279
2297
  hooks: mergedConfig.hooks ?? {},
2280
2298
  vite: mergedConfig.vite ?? (() => ({})),
2281
- modules,
2299
+ builtinModules,
2300
+ userModules,
2282
2301
  plugins: [],
2283
2302
  ...moduleOptions
2284
2303
  };
@@ -2350,17 +2369,17 @@ function resolveAnalysisConfig(root, mergedConfig) {
2350
2369
  keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
2351
2370
  };
2352
2371
  }
2353
- async function getUnimportOptions(wxtDir, logger, config) {
2372
+ async function getUnimportOptions(wxtDir, srcDir, logger, config) {
2354
2373
  if (config.imports === false) return false;
2355
- const enabledConfig = config.imports?.eslintrc?.enabled;
2356
- let enabled;
2357
- switch (enabledConfig) {
2374
+ const rawEslintEnabled = config.imports?.eslintrc?.enabled;
2375
+ let eslintEnabled;
2376
+ switch (rawEslintEnabled) {
2358
2377
  case void 0:
2359
2378
  case "auto":
2360
- enabled = await isModuleInstalled("eslint");
2379
+ eslintEnabled = await isModuleInstalled("eslint");
2361
2380
  break;
2362
2381
  default:
2363
- enabled = enabledConfig;
2382
+ eslintEnabled = rawEslintEnabled;
2364
2383
  }
2365
2384
  const defaultOptions = {
2366
2385
  debugLog: logger.debug,
@@ -2376,8 +2395,11 @@ async function getUnimportOptions(wxtDir, logger, config) {
2376
2395
  ],
2377
2396
  warn: logger.warn,
2378
2397
  dirs: ["components", "composables", "hooks", "utils"],
2398
+ dirsScanOptions: {
2399
+ cwd: srcDir
2400
+ },
2379
2401
  eslintrc: {
2380
- enabled,
2402
+ enabled: eslintEnabled,
2381
2403
  filePath: path6.resolve(wxtDir, "eslintrc-auto-import.json"),
2382
2404
  globalsPropValue: true
2383
2405
  }
@@ -2392,7 +2414,7 @@ async function resolveWxtModuleDir() {
2392
2414
  return path6.resolve(requireResolve("wxt"), "../..");
2393
2415
  }
2394
2416
  async function isDirMissing(dir) {
2395
- return !await fs10.exists(dir);
2417
+ return !await fs9.exists(dir);
2396
2418
  }
2397
2419
  function logMissingDir(logger, name, expected) {
2398
2420
  logger.warn(
@@ -2406,19 +2428,19 @@ var COMMAND_MODES = {
2406
2428
  serve: "development"
2407
2429
  };
2408
2430
  async function mergeBuilderConfig(inlineConfig, userConfig) {
2409
- const vite = await import("vite").catch(() => void 0);
2410
- if (vite) {
2431
+ const vite2 = await import("vite").catch(() => void 0);
2432
+ if (vite2) {
2411
2433
  return {
2412
2434
  vite: async (env) => {
2413
2435
  const resolvedInlineConfig = await inlineConfig.vite?.(env) ?? {};
2414
2436
  const resolvedUserConfig = await userConfig.vite?.(env) ?? {};
2415
- return vite.mergeConfig(resolvedUserConfig, resolvedInlineConfig);
2437
+ return vite2.mergeConfig(resolvedUserConfig, resolvedInlineConfig);
2416
2438
  }
2417
2439
  };
2418
2440
  }
2419
2441
  throw Error("Builder not found. Make sure vite is installed.");
2420
2442
  }
2421
- async function resolveWxtModules(modulesDir, modules = []) {
2443
+ async function resolveWxtUserModules(modulesDir, modules = []) {
2422
2444
  const npmModules = await Promise.all(
2423
2445
  modules.map(async (moduleId) => {
2424
2446
  const mod = await import(
@@ -2435,7 +2457,7 @@ async function resolveWxtModules(modulesDir, modules = []) {
2435
2457
  };
2436
2458
  })
2437
2459
  );
2438
- const localModulePaths = await glob3(["*.[tj]s", "*/index.[tj]s"], {
2460
+ const localModulePaths = await glob4(["*.[tj]s", "*/index.[tj]s"], {
2439
2461
  cwd: modulesDir,
2440
2462
  onlyFiles: true
2441
2463
  }).catch(() => []);
@@ -2504,6 +2526,95 @@ var ENTRY_TYPE_TO_GROUP_MAP = {
2504
2526
  "content-script-style": "individual"
2505
2527
  };
2506
2528
 
2529
+ // src/core/utils/building/import-entrypoint.ts
2530
+ import createJITI from "jiti";
2531
+ import { createUnimport as createUnimport2 } from "unimport";
2532
+ import fs10 from "fs-extra";
2533
+ import { relative as relative5, resolve as resolve11 } from "node:path";
2534
+ import { transformSync } from "esbuild";
2535
+ import { fileURLToPath } from "node:url";
2536
+ async function importEntrypointFile(path11) {
2537
+ wxt.logger.debug("Loading file metadata:", path11);
2538
+ const normalPath = normalizePath(path11);
2539
+ const unimport = createUnimport2({
2540
+ ...wxt.config.imports,
2541
+ // Only allow specific imports, not all from the project
2542
+ dirs: []
2543
+ });
2544
+ await unimport.init();
2545
+ const text = await fs10.readFile(path11, "utf-8");
2546
+ const textNoImports = removeProjectImportStatements(text);
2547
+ const { code } = await unimport.injectImports(textNoImports);
2548
+ wxt.logger.debug(
2549
+ ["Text:", text, "No imports:", textNoImports, "Code:", code].join("\n")
2550
+ );
2551
+ const jiti = createJITI(
2552
+ typeof __filename !== "undefined" ? __filename : fileURLToPath(import.meta.url),
2553
+ {
2554
+ cache: false,
2555
+ debug: wxt.config.debug,
2556
+ esmResolve: true,
2557
+ alias: {
2558
+ "webextension-polyfill": resolve11(
2559
+ wxt.config.wxtModuleDir,
2560
+ "dist/virtual/mock-browser.js"
2561
+ )
2562
+ },
2563
+ // Continue using node to load TS files even if `bun run --bun` is detected. Jiti does not
2564
+ // respect the custom transform function when using it's native bun option.
2565
+ experimentalBun: false,
2566
+ // List of extensions to transform with esbuild
2567
+ extensions: [
2568
+ ".ts",
2569
+ ".cts",
2570
+ ".mts",
2571
+ ".tsx",
2572
+ ".js",
2573
+ ".cjs",
2574
+ ".mjs",
2575
+ ".jsx"
2576
+ ],
2577
+ transform(opts) {
2578
+ const isEntrypoint = opts.filename === normalPath;
2579
+ return transformSync(
2580
+ // Use modified source code for entrypoints
2581
+ isEntrypoint ? code : opts.source,
2582
+ getEsbuildOptions(opts)
2583
+ );
2584
+ }
2585
+ }
2586
+ );
2587
+ try {
2588
+ const res = await jiti(path11);
2589
+ return res.default;
2590
+ } catch (err) {
2591
+ const filePath = relative5(wxt.config.root, path11);
2592
+ if (err instanceof ReferenceError) {
2593
+ const variableName = err.message.replace(" is not defined", "");
2594
+ throw Error(
2595
+ `${filePath}: Cannot use imported variable "${variableName}" outside the main function. See https://wxt.dev/guide/go-further/entrypoint-side-effects.html`,
2596
+ { cause: err }
2597
+ );
2598
+ } else {
2599
+ wxt.logger.error(err);
2600
+ throw Error(`Failed to load entrypoint: ${filePath}`, { cause: err });
2601
+ }
2602
+ }
2603
+ }
2604
+ function getEsbuildOptions(opts) {
2605
+ const isJsx = opts.filename?.endsWith("x");
2606
+ return {
2607
+ format: "cjs",
2608
+ loader: isJsx ? "tsx" : "ts",
2609
+ ...isJsx ? {
2610
+ // `h` and `Fragment` are undefined, but that's OK because JSX is never evaluated while
2611
+ // grabbing the entrypoint's options.
2612
+ jsxFactory: "h",
2613
+ jsxFragment: "Fragment"
2614
+ } : void 0
2615
+ };
2616
+ }
2617
+
2507
2618
  // src/core/utils/building/internal-build.ts
2508
2619
  import pc5 from "picocolors";
2509
2620
  import fs13 from "fs-extra";
@@ -2615,7 +2726,7 @@ function getChunkSortWeight(filename) {
2615
2726
  import pc4 from "picocolors";
2616
2727
 
2617
2728
  // package.json
2618
- var version = "0.18.7";
2729
+ var version = "0.18.9";
2619
2730
 
2620
2731
  // src/core/utils/log/printHeader.ts
2621
2732
  function printHeader() {
@@ -2624,7 +2735,7 @@ function printHeader() {
2624
2735
  }
2625
2736
 
2626
2737
  // src/core/utils/building/internal-build.ts
2627
- import glob4 from "fast-glob";
2738
+ import glob5 from "fast-glob";
2628
2739
 
2629
2740
  // src/core/utils/manifest.ts
2630
2741
  import fs12 from "fs-extra";
@@ -3389,7 +3500,7 @@ async function internalBuild() {
3389
3500
  return output;
3390
3501
  }
3391
3502
  async function combineAnalysisStats() {
3392
- const unixFiles = await glob4(`${wxt.config.analysis.outputName}-*.json`, {
3503
+ const unixFiles = await glob5(`${wxt.config.analysis.outputName}-*.json`, {
3393
3504
  cwd: wxt.config.analysis.outputDir,
3394
3505
  absolute: true
3395
3506
  });
@@ -3438,7 +3549,7 @@ async function build(config) {
3438
3549
 
3439
3550
  // src/core/clean.ts
3440
3551
  import path8 from "node:path";
3441
- import glob5 from "fast-glob";
3552
+ import glob6 from "fast-glob";
3442
3553
  import fs14 from "fs-extra";
3443
3554
  import pc6 from "picocolors";
3444
3555
  async function clean(root = process.cwd()) {
@@ -3450,7 +3561,7 @@ async function clean(root = process.cwd()) {
3450
3561
  ".output/*"
3451
3562
  ];
3452
3563
  consola.debug("Looking for:", tempDirs.map(pc6.cyan).join(", "));
3453
- const directories = await glob5(tempDirs, {
3564
+ const directories = await glob6(tempDirs, {
3454
3565
  cwd: path8.resolve(root),
3455
3566
  absolute: true,
3456
3567
  onlyDirectories: true,
@@ -3942,7 +4053,7 @@ import path10 from "node:path";
3942
4053
  import fs16 from "fs-extra";
3943
4054
  import { minimatch as minimatch2 } from "minimatch";
3944
4055
  import JSZip from "jszip";
3945
- import glob6 from "fast-glob";
4056
+ import glob7 from "fast-glob";
3946
4057
  async function zip(config) {
3947
4058
  await registerWxt("build", config);
3948
4059
  const output = await internalBuild();
@@ -3990,7 +4101,7 @@ async function zip(config) {
3990
4101
  }
3991
4102
  async function zipDir(directory, outputPath, options) {
3992
4103
  const archive = new JSZip();
3993
- const files = (await glob6("**/*", {
4104
+ const files = (await glob7("**/*", {
3994
4105
  cwd: directory,
3995
4106
  // Ignore node_modules, otherwise this glob step takes forever
3996
4107
  ignore: ["**/node_modules"],