wxt 0.18.8 → 0.18.9

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/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  unnormalizePath,
20
20
  version,
21
21
  wxt
22
- } from "./chunk-Z3C7S5VV.js";
22
+ } from "./chunk-UA35R5HN.js";
23
23
  import "./chunk-BERPNPEZ.js";
24
24
  import {
25
25
  consola
@@ -1,4 +1,4 @@
1
- import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-D6lH9OkP.cjs';
1
+ import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-B0efqfEK.cjs';
2
2
  import * as vite from 'vite';
3
3
  import { UnimportOptions } from 'unimport';
4
4
  import 'webextension-polyfill';
package/dist/modules.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-D6lH9OkP.js';
1
+ import { a6 as WxtModuleOptions, a8 as WxtModule, a7 as WxtModuleSetup, Y as Wxt, r as Entrypoint } from './index-B0efqfEK.js';
2
2
  import * as vite from 'vite';
3
3
  import { UnimportOptions } from 'unimport';
4
4
  import 'webextension-polyfill';
package/dist/testing.cjs CHANGED
@@ -445,7 +445,7 @@ var init_core = __esm({
445
445
 
446
446
  // ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/shared/consola.06ad8a64.mjs
447
447
  function parseStack(stack) {
448
- const cwd = process.cwd() + import_node_path11.sep;
448
+ const cwd = process.cwd() + import_node_path10.sep;
449
449
  const lines = stack.split("\n").splice(1).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
450
450
  return lines;
451
451
  }
@@ -453,12 +453,12 @@ function writeStream(data, stream) {
453
453
  const write = stream.__write || stream.write;
454
454
  return write.call(stream, data);
455
455
  }
456
- var import_node_util, import_node_path11, bracket, BasicReporter;
456
+ var import_node_util, import_node_path10, bracket, BasicReporter;
457
457
  var init_consola_06ad8a64 = __esm({
458
458
  "../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/shared/consola.06ad8a64.mjs"() {
459
459
  "use strict";
460
460
  import_node_util = require("util");
461
- import_node_path11 = require("path");
461
+ import_node_path10 = require("path");
462
462
  bracket = (x) => x ? `[${x}]` : "";
463
463
  BasicReporter = class {
464
464
  formatStack(stack, opts) {
@@ -861,7 +861,7 @@ async function prompt(message, opts = {}) {
861
861
  }
862
862
  throw new Error(`Unknown prompt type: ${opts.type}`);
863
863
  }
864
- var import_node_process, import_node_readline, import_node_tty, import_tty, import_node_util2, import_node_path12, ESC, CSI, beep, cursor, scroll, erase, src, picocolors, tty2, isColorSupported2, formatter, replaceClose2, createColors2, picocolorsExports, l, m, G, K, Y, v, L, M, T, r, Z, H, q, p, J, b, W, Q, I, w, N, j, X, _, DD, uD, R, V, tD, h, sD, iD, ED, oD, unicode, s, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR, S_BAR_END, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, symbol, text, confirm, select, multiselect;
864
+ var import_node_process, import_node_readline, import_node_tty, import_tty, import_node_util2, import_node_path11, ESC, CSI, beep, cursor, scroll, erase, src, picocolors, tty2, isColorSupported2, formatter, replaceClose2, createColors2, picocolorsExports, l, m, G, K, Y, v, L, M, T, r, Z, H, q, p, J, b, W, Q, I, w, N, j, X, _, DD, uD, R, V, tD, h, sD, iD, ED, oD, unicode, s, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR, S_BAR_END, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, symbol, text, confirm, select, multiselect;
865
865
  var init_prompt = __esm({
866
866
  "../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/chunks/prompt.mjs"() {
867
867
  "use strict";
@@ -874,7 +874,7 @@ var init_prompt = __esm({
874
874
  init_core();
875
875
  init_consola_06ad8a64();
876
876
  import_node_util2 = require("util");
877
- import_node_path12 = require("path");
877
+ import_node_path11 = require("path");
878
878
  ESC = "\x1B";
879
879
  CSI = `${ESC}[`;
880
880
  beep = "\x07";
@@ -2154,6 +2154,11 @@ var import_nypm = require("nypm");
2154
2154
  var import_node_path8 = __toESM(require("path"), 1);
2155
2155
  var import_fs_extra3 = require("fs-extra");
2156
2156
 
2157
+ // src/core/builders/vite/index.ts
2158
+ var import_server = require("vite-node/server");
2159
+ var import_client = require("vite-node/client");
2160
+ var import_source_map = require("vite-node/source-map");
2161
+
2157
2162
  // src/core/utils/fs.ts
2158
2163
  async function writeFileIfDifferent(file, newContents) {
2159
2164
  const existingContents = await import_fs_extra4.default.readFile(file, "utf-8").catch(() => void 0);
@@ -2167,22 +2172,12 @@ var import_fs_extra5 = __toESM(require("fs-extra"), 1);
2167
2172
  var import_picocolors = __toESM(require("picocolors"), 1);
2168
2173
 
2169
2174
  // src/core/utils/building/find-entrypoints.ts
2170
- var import_fs_extra7 = __toESM(require("fs-extra"), 1);
2175
+ var import_fs_extra6 = __toESM(require("fs-extra"), 1);
2171
2176
  var import_minimatch = require("minimatch");
2172
2177
  var import_linkedom3 = require("linkedom");
2173
2178
  var import_json5 = __toESM(require("json5"), 1);
2174
2179
  var import_fast_glob2 = __toESM(require("fast-glob"), 1);
2175
2180
  var import_picocolors2 = __toESM(require("picocolors"), 1);
2176
-
2177
- // src/core/utils/building/import-entrypoint.ts
2178
- var import_jiti = __toESM(require("jiti"), 1);
2179
- var import_unimport2 = require("unimport");
2180
- var import_fs_extra6 = __toESM(require("fs-extra"), 1);
2181
- var import_node_path9 = require("path");
2182
- var import_esbuild = require("esbuild");
2183
- var import_node_url = require("url");
2184
-
2185
- // src/core/utils/building/find-entrypoints.ts
2186
2181
  var PATH_GLOB_TO_TYPE_MAP = {
2187
2182
  "sandbox.html": "sandbox",
2188
2183
  "sandbox/index.html": "sandbox",
@@ -2224,29 +2219,29 @@ var PATH_GLOB_TO_TYPE_MAP = {
2224
2219
  };
2225
2220
 
2226
2221
  // src/core/utils/building/generate-wxt-dir.ts
2227
- var import_unimport3 = require("unimport");
2228
- var import_fs_extra8 = __toESM(require("fs-extra"), 1);
2229
- var import_node_path10 = __toESM(require("path"), 1);
2222
+ var import_unimport2 = require("unimport");
2223
+ var import_fs_extra7 = __toESM(require("fs-extra"), 1);
2224
+ var import_node_path9 = __toESM(require("path"), 1);
2230
2225
 
2231
2226
  // src/core/utils/building/resolve-config.ts
2232
2227
  var import_c12 = require("c12");
2233
- var import_node_path15 = __toESM(require("path"), 1);
2228
+ var import_node_path14 = __toESM(require("path"), 1);
2234
2229
 
2235
2230
  // src/core/utils/cache.ts
2236
- var import_fs_extra9 = __toESM(require("fs-extra"), 1);
2231
+ var import_fs_extra8 = __toESM(require("fs-extra"), 1);
2237
2232
  var import_path2 = require("path");
2238
2233
  function createFsCache(wxtDir) {
2239
2234
  const getPath = (key) => (0, import_path2.resolve)(wxtDir, "cache", encodeURIComponent(key));
2240
2235
  return {
2241
2236
  async set(key, value) {
2242
2237
  const path8 = getPath(key);
2243
- await (0, import_fs_extra9.ensureDir)((0, import_path2.dirname)(path8));
2238
+ await (0, import_fs_extra8.ensureDir)((0, import_path2.dirname)(path8));
2244
2239
  await writeFileIfDifferent(path8, value);
2245
2240
  },
2246
2241
  async get(key) {
2247
2242
  const path8 = getPath(key);
2248
2243
  try {
2249
- return await import_fs_extra9.default.readFile(path8, "utf-8");
2244
+ return await import_fs_extra8.default.readFile(path8, "utf-8");
2250
2245
  } catch {
2251
2246
  return void 0;
2252
2247
  }
@@ -2262,14 +2257,14 @@ var import_node_process3 = require("process");
2262
2257
  init_utils();
2263
2258
  var import_node_tty2 = require("tty");
2264
2259
  var import_node_util3 = require("util");
2265
- var import_node_path13 = require("path");
2260
+ var import_node_path12 = require("path");
2266
2261
 
2267
2262
  // src/core/utils/building/resolve-config.ts
2268
2263
  var import_defu = __toESM(require("defu"), 1);
2269
2264
 
2270
2265
  // src/core/utils/package.ts
2271
- var import_node_path14 = require("path");
2272
- var import_fs_extra10 = __toESM(require("fs-extra"), 1);
2266
+ var import_node_path13 = require("path");
2267
+ var import_fs_extra9 = __toESM(require("fs-extra"), 1);
2273
2268
  function isModuleInstalled(name) {
2274
2269
  return import(
2275
2270
  /* @vite-ignore */
@@ -2278,7 +2273,7 @@ function isModuleInstalled(name) {
2278
2273
  }
2279
2274
 
2280
2275
  // src/core/utils/building/resolve-config.ts
2281
- var import_fs_extra11 = __toESM(require("fs-extra"), 1);
2276
+ var import_fs_extra10 = __toESM(require("fs-extra"), 1);
2282
2277
  var import_fast_glob3 = __toESM(require("fast-glob"), 1);
2283
2278
  var import_meta = {};
2284
2279
  async function resolveConfig(inlineConfig, command) {
@@ -2305,28 +2300,28 @@ async function resolveConfig(inlineConfig, command) {
2305
2300
  const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
2306
2301
  const mode = mergedConfig.mode ?? COMMAND_MODES[command];
2307
2302
  const env2 = { browser, command, manifestVersion, mode };
2308
- const root = import_node_path15.default.resolve(
2303
+ const root = import_node_path14.default.resolve(
2309
2304
  inlineConfig.root ?? userConfig.root ?? process.cwd()
2310
2305
  );
2311
- const wxtDir = import_node_path15.default.resolve(root, ".wxt");
2306
+ const wxtDir = import_node_path14.default.resolve(root, ".wxt");
2312
2307
  const wxtModuleDir = await resolveWxtModuleDir();
2313
- const srcDir = import_node_path15.default.resolve(root, mergedConfig.srcDir ?? root);
2314
- const entrypointsDir = import_node_path15.default.resolve(
2308
+ const srcDir = import_node_path14.default.resolve(root, mergedConfig.srcDir ?? root);
2309
+ const entrypointsDir = import_node_path14.default.resolve(
2315
2310
  srcDir,
2316
2311
  mergedConfig.entrypointsDir ?? "entrypoints"
2317
2312
  );
2318
- const modulesDir = import_node_path15.default.resolve(srcDir, mergedConfig.modulesDir ?? "modules");
2313
+ const modulesDir = import_node_path14.default.resolve(srcDir, mergedConfig.modulesDir ?? "modules");
2319
2314
  if (await isDirMissing(entrypointsDir)) {
2320
2315
  logMissingDir(logger, "Entrypoints", entrypointsDir);
2321
2316
  }
2322
2317
  const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
2323
- const publicDir = import_node_path15.default.resolve(srcDir, mergedConfig.publicDir ?? "public");
2318
+ const publicDir = import_node_path14.default.resolve(srcDir, mergedConfig.publicDir ?? "public");
2324
2319
  if (await isDirMissing(publicDir)) {
2325
2320
  logMissingDir(logger, "Public", publicDir);
2326
2321
  }
2327
- const typesDir = import_node_path15.default.resolve(wxtDir, "types");
2328
- const outBaseDir = import_node_path15.default.resolve(root, mergedConfig.outDir ?? ".output");
2329
- const outDir = import_node_path15.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
2322
+ const typesDir = import_node_path14.default.resolve(wxtDir, "types");
2323
+ const outBaseDir = import_node_path14.default.resolve(root, mergedConfig.outDir ?? ".output");
2324
+ const outDir = import_node_path14.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
2330
2325
  const reloadCommand = mergedConfig.dev?.reloadCommand ?? "Alt+R";
2331
2326
  const runnerConfig = await (0, import_c12.loadConfig)({
2332
2327
  name: "web-ext",
@@ -2343,7 +2338,7 @@ async function resolveConfig(inlineConfig, command) {
2343
2338
  "~": srcDir,
2344
2339
  "@@": root,
2345
2340
  "~~": root
2346
- }).map(([key, value]) => [key, import_node_path15.default.resolve(root, value)])
2341
+ }).map(([key, value]) => [key, import_node_path14.default.resolve(root, value)])
2347
2342
  );
2348
2343
  let devServerConfig;
2349
2344
  if (command === "serve") {
@@ -2395,7 +2390,7 @@ async function resolveConfig(inlineConfig, command) {
2395
2390
  alias,
2396
2391
  experimental: (0, import_defu.default)(mergedConfig.experimental, {
2397
2392
  includeBrowserPolyfill: true,
2398
- viteRuntime: false
2393
+ entrypointImporter: "jiti"
2399
2394
  }),
2400
2395
  dev: {
2401
2396
  server: devServerConfig,
@@ -2433,7 +2428,7 @@ async function mergeInlineConfig(inlineConfig, userConfig) {
2433
2428
  };
2434
2429
  }
2435
2430
  function resolveZipConfig(root, mergedConfig) {
2436
- const downloadedPackagesDir = import_node_path15.default.resolve(root, ".wxt/local_modules");
2431
+ const downloadedPackagesDir = import_node_path14.default.resolve(root, ".wxt/local_modules");
2437
2432
  return {
2438
2433
  name: void 0,
2439
2434
  sourcesTemplate: "{{name}}-{{version}}-sources.zip",
@@ -2459,12 +2454,12 @@ function resolveZipConfig(root, mergedConfig) {
2459
2454
  };
2460
2455
  }
2461
2456
  function resolveAnalysisConfig(root, mergedConfig) {
2462
- const analysisOutputFile = import_node_path15.default.resolve(
2457
+ const analysisOutputFile = import_node_path14.default.resolve(
2463
2458
  root,
2464
2459
  mergedConfig.analysis?.outputFile ?? "stats.html"
2465
2460
  );
2466
- const analysisOutputDir = import_node_path15.default.dirname(analysisOutputFile);
2467
- const analysisOutputName = import_node_path15.default.parse(analysisOutputFile).name;
2461
+ const analysisOutputDir = import_node_path14.default.dirname(analysisOutputFile);
2462
+ const analysisOutputName = import_node_path14.default.parse(analysisOutputFile).name;
2468
2463
  return {
2469
2464
  enabled: mergedConfig.analysis?.enabled ?? false,
2470
2465
  open: mergedConfig.analysis?.open ?? false,
@@ -2503,7 +2498,7 @@ async function getUnimportOptions(wxtDir, logger, config) {
2503
2498
  dirs: ["components", "composables", "hooks", "utils"],
2504
2499
  eslintrc: {
2505
2500
  enabled,
2506
- filePath: import_node_path15.default.resolve(wxtDir, "eslintrc-auto-import.json"),
2501
+ filePath: import_node_path14.default.resolve(wxtDir, "eslintrc-auto-import.json"),
2507
2502
  globalsPropValue: true
2508
2503
  }
2509
2504
  };
@@ -2514,15 +2509,15 @@ async function getUnimportOptions(wxtDir, logger, config) {
2514
2509
  }
2515
2510
  async function resolveWxtModuleDir() {
2516
2511
  const requireResolve = require?.resolve ?? (await import("module")).default.createRequire(import_meta.url).resolve;
2517
- return import_node_path15.default.resolve(requireResolve("wxt"), "../..");
2512
+ return import_node_path14.default.resolve(requireResolve("wxt"), "../..");
2518
2513
  }
2519
2514
  async function isDirMissing(dir) {
2520
- return !await import_fs_extra11.default.exists(dir);
2515
+ return !await import_fs_extra10.default.exists(dir);
2521
2516
  }
2522
2517
  function logMissingDir(logger, name, expected) {
2523
2518
  logger.warn(
2524
2519
  `${name} directory not found: ./${normalizePath(
2525
- import_node_path15.default.relative(process.cwd(), expected)
2520
+ import_node_path14.default.relative(process.cwd(), expected)
2526
2521
  )}`
2527
2522
  );
2528
2523
  }
@@ -2566,7 +2561,7 @@ async function resolveWxtModules(modulesDir, modules = []) {
2566
2561
  }).catch(() => []);
2567
2562
  const localModules = await Promise.all(
2568
2563
  localModulePaths.map(async (file) => {
2569
- const absolutePath = normalizePath(import_node_path15.default.resolve(modulesDir, file));
2564
+ const absolutePath = normalizePath(import_node_path14.default.resolve(modulesDir, file));
2570
2565
  const { config } = await (0, import_c12.loadConfig)({
2571
2566
  configFile: absolutePath,
2572
2567
  globalRc: false,
@@ -2590,6 +2585,14 @@ async function resolveWxtModules(modulesDir, modules = []) {
2590
2585
  return [...npmModules, ...localModules];
2591
2586
  }
2592
2587
 
2588
+ // src/core/utils/building/import-entrypoint.ts
2589
+ var import_jiti = __toESM(require("jiti"), 1);
2590
+ var import_unimport3 = require("unimport");
2591
+ var import_fs_extra11 = __toESM(require("fs-extra"), 1);
2592
+ var import_node_path15 = require("path");
2593
+ var import_esbuild = require("esbuild");
2594
+ var import_node_url = require("url");
2595
+
2593
2596
  // src/core/utils/building/internal-build.ts
2594
2597
  var import_picocolors5 = __toESM(require("picocolors"), 1);
2595
2598
  var import_fs_extra14 = __toESM(require("fs-extra"), 1);
@@ -1,6 +1,6 @@
1
1
  export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
2
2
  import * as vite from 'vite';
3
- import { I as InlineConfig } from './index-D6lH9OkP.cjs';
3
+ import { I as InlineConfig } from './index-B0efqfEK.cjs';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
6
6
  import 'consola';
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
2
2
  import * as vite from 'vite';
3
- import { I as InlineConfig } from './index-D6lH9OkP.js';
3
+ import { I as InlineConfig } from './index-B0efqfEK.js';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
6
6
  import 'consola';
package/dist/testing.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  tsconfigPaths,
6
6
  unimport,
7
7
  webextensionPolyfillMock
8
- } from "./chunk-Z3C7S5VV.js";
8
+ } from "./chunk-UA35R5HN.js";
9
9
  import "./chunk-BERPNPEZ.js";
10
10
  import "./chunk-BM6QYGAW.js";
11
11
  import "./chunk-QGM4M3NI.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.18.8",
4
+ "version": "0.18.9",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "repository": {
7
7
  "type": "git",
@@ -128,6 +128,7 @@
128
128
  "publish-browser-extension": "^2.1.3",
129
129
  "unimport": "^3.7.2",
130
130
  "vite": "^5.3.0",
131
+ "vite-node": "^1.6.0",
131
132
  "web-ext-run": "^0.2.0",
132
133
  "webextension-polyfill": "^0.10.0"
133
134
  },