wxt 0.19.22 → 0.20.0-beta1

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.
Files changed (103) hide show
  1. package/README.md +6 -0
  2. package/dist/browser.d.ts +28 -0
  3. package/dist/builtin-modules/unimport.d.ts +1 -1
  4. package/dist/builtin-modules/unimport.mjs +36 -12
  5. package/dist/cli/index.mjs +0 -1
  6. package/dist/core/builders/vite/index.mjs +21 -38
  7. package/dist/core/builders/vite/plugins/extensionApiMock.d.ts +1 -6
  8. package/dist/core/builders/vite/plugins/extensionApiMock.mjs +2 -4
  9. package/dist/core/builders/vite/plugins/index.d.ts +0 -1
  10. package/dist/core/builders/vite/plugins/index.mjs +0 -1
  11. package/dist/core/builders/vite/plugins/noopBackground.mjs +1 -1
  12. package/dist/core/create-server.mjs +1 -0
  13. package/dist/core/define-web-ext-config.d.ts +9 -0
  14. package/dist/core/define-web-ext-config.mjs +10 -0
  15. package/dist/core/generate-wxt-dir.mjs +4 -6
  16. package/dist/core/index.d.ts +1 -1
  17. package/dist/core/index.mjs +1 -1
  18. package/dist/core/initialize.mjs +2 -5
  19. package/dist/core/keyboard-shortcuts.mjs +3 -9
  20. package/dist/core/resolve-config.mjs +152 -55
  21. package/dist/core/runners/web-ext.mjs +1 -1
  22. package/dist/core/utils/building/find-entrypoints.mjs +2 -1
  23. package/dist/core/utils/building/index.d.ts +0 -1
  24. package/dist/core/utils/building/index.mjs +0 -1
  25. package/dist/core/utils/building/rebuild.d.ts +1 -2
  26. package/dist/core/utils/content-scripts.d.ts +3 -3
  27. package/dist/core/utils/content-scripts.mjs +2 -0
  28. package/dist/core/utils/eslint.mjs +3 -5
  29. package/dist/core/utils/manifest.d.ts +3 -8
  30. package/dist/core/utils/manifest.mjs +4 -7
  31. package/dist/core/utils/strings.d.ts +0 -4
  32. package/dist/core/utils/strings.mjs +0 -6
  33. package/dist/core/utils/testing/fake-objects.d.ts +3416 -991
  34. package/dist/core/utils/testing/fake-objects.mjs +19 -22
  35. package/dist/core/utils/transform.d.ts +1 -1
  36. package/dist/core/utils/types.d.ts +2 -0
  37. package/dist/core/utils/validation.mjs +2 -2
  38. package/dist/index.d.ts +5 -0
  39. package/dist/modules.d.ts +1 -1
  40. package/dist/testing/index.d.ts +1 -0
  41. package/dist/testing/wxt-vitest-plugin.mjs +3 -5
  42. package/dist/types.d.ts +48 -70
  43. package/dist/utils/app-config.d.ts +2 -0
  44. package/dist/{client/content-scripts → utils}/content-script-context.d.ts +4 -3
  45. package/dist/{client/content-scripts → utils}/content-script-context.mjs +5 -3
  46. package/dist/utils/content-script-ui/iframe.d.ts +32 -0
  47. package/dist/utils/content-script-ui/iframe.mjs +30 -0
  48. package/dist/utils/content-script-ui/integrated.d.ts +34 -0
  49. package/dist/utils/content-script-ui/integrated.mjs +32 -0
  50. package/dist/utils/content-script-ui/shadow-root.d.ts +76 -0
  51. package/dist/utils/content-script-ui/shadow-root.mjs +73 -0
  52. package/dist/utils/content-script-ui/shared.d.ts +5 -0
  53. package/dist/{client/content-scripts/ui/index.mjs → utils/content-script-ui/shared.mjs} +5 -138
  54. package/dist/{client/content-scripts/ui → utils/content-script-ui}/types.d.ts +0 -96
  55. package/dist/{sandbox → utils}/define-app-config.d.ts +3 -2
  56. package/dist/{sandbox → utils}/define-background.d.ts +1 -0
  57. package/dist/{sandbox → utils}/define-content-script.d.ts +1 -0
  58. package/dist/{sandbox → utils}/define-unlisted-script.d.ts +1 -0
  59. package/dist/{sandbox → utils}/define-wxt-plugin.d.ts +1 -0
  60. package/dist/{sandbox → utils/internal}/dev-server-websocket.mjs +1 -1
  61. package/dist/{client/content-scripts → utils/internal}/location-watcher.d.ts +1 -1
  62. package/dist/utils/match-patterns.d.ts +5 -0
  63. package/dist/utils/match-patterns.mjs +1 -0
  64. package/dist/utils/storage.d.ts +5 -0
  65. package/dist/version.mjs +1 -1
  66. package/dist/virtual/background-entrypoint.mjs +1 -1
  67. package/dist/virtual/content-script-isolated-world-entrypoint.mjs +1 -1
  68. package/package.json +108 -71
  69. package/dist/browser/chrome.d.ts +0 -13
  70. package/dist/browser/index.d.ts +0 -26
  71. package/dist/browser/index.mjs +0 -2
  72. package/dist/client/app-config.d.ts +0 -2
  73. package/dist/client/content-scripts/index.d.ts +0 -2
  74. package/dist/client/content-scripts/index.mjs +0 -2
  75. package/dist/client/content-scripts/ui/index.d.ts +0 -23
  76. package/dist/client/index.d.ts +0 -8
  77. package/dist/client/index.mjs +0 -3
  78. package/dist/core/builders/vite/plugins/resolveExtensionApi.d.ts +0 -10
  79. package/dist/core/builders/vite/plugins/resolveExtensionApi.mjs +0 -15
  80. package/dist/core/define-runner-config.d.ts +0 -2
  81. package/dist/core/define-runner-config.mjs +0 -3
  82. package/dist/core/utils/building/import-entrypoint.d.ts +0 -16
  83. package/dist/core/utils/building/import-entrypoint.mjs +0 -100
  84. package/dist/sandbox/index.d.ts +0 -11
  85. package/dist/sandbox/index.mjs +0 -6
  86. package/dist/storage.d.ts +0 -4
  87. /package/dist/{browser/chrome.mjs → browser.mjs} +0 -0
  88. /package/dist/{client → utils}/app-config.mjs +0 -0
  89. /package/dist/{client/content-scripts/ui → utils/content-script-ui}/types.mjs +0 -0
  90. /package/dist/{sandbox → utils}/define-app-config.mjs +0 -0
  91. /package/dist/{sandbox → utils}/define-background.mjs +0 -0
  92. /package/dist/{sandbox → utils}/define-content-script.mjs +0 -0
  93. /package/dist/{sandbox → utils}/define-unlisted-script.mjs +0 -0
  94. /package/dist/{sandbox → utils}/define-wxt-plugin.mjs +0 -0
  95. /package/dist/{client → utils}/inject-script.d.ts +0 -0
  96. /package/dist/{client → utils}/inject-script.mjs +0 -0
  97. /package/dist/{client/content-scripts → utils/internal}/custom-events.d.ts +0 -0
  98. /package/dist/{client/content-scripts → utils/internal}/custom-events.mjs +0 -0
  99. /package/dist/{sandbox → utils/internal}/dev-server-websocket.d.ts +0 -0
  100. /package/dist/{client/content-scripts → utils/internal}/location-watcher.mjs +0 -0
  101. /package/dist/{sandbox/utils → utils/internal}/logger.d.ts +0 -0
  102. /package/dist/{sandbox/utils → utils/internal}/logger.mjs +0 -0
  103. /package/dist/{storage.mjs → utils/storage.mjs} +0 -0
package/README.md CHANGED
@@ -76,6 +76,12 @@ Or see the [installation guide](https://wxt.dev/guide/installation.html) to get
76
76
  - 📏 Bundle analysis
77
77
  - ⬇️ Download and bundle remote URL imports
78
78
 
79
+ ## Sponsors
80
+
81
+ WXT is a [MIT-licensed](https://github.com/wxt-dev/wxt/blob/main/LICENSE) open source project with its ongoing development made possible entirely by the support of these awesome backers. If you'd like to join them, please consider [sponsoring WXT's development](https://github.com/sponsors/wxt-dev).
82
+
83
+ <a href="https://github.com/sponsors/wxt-dev"><img alt="WXT Sponsors" src="https://raw.githubusercontent.com/wxt-dev/static/refs/heads/main/sponsorkit/sponsors.svg"></a>
84
+
79
85
  ## Contributors
80
86
 
81
87
  <!-- automd:contributors author="aklinker1" license="MIT" github="wxt-dev/wxt" -->
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Contains the `browser` export which you should use to access the extension APIs in your project:
3
+ * ```ts
4
+ * import { browser } from 'wxt/browser';
5
+ *
6
+ * browser.runtime.onInstalled.addListener(() => {
7
+ * // ...
8
+ * })
9
+ * ```
10
+ * @module wxt/browser
11
+ */
12
+ /**
13
+ * This interface is empty because it is generated per-project when running `wxt prepare`. See:
14
+ * - `.wxt/types/paths.d.ts`
15
+ */
16
+ export interface WxtRuntime {
17
+ }
18
+ /**
19
+ * This interface is empty because it is generated per-project when running `wxt prepare`. See:
20
+ * - `.wxt/types/i18n.d.ts`
21
+ */
22
+ export interface WxtI18n {
23
+ }
24
+ export type WxtBrowser = Omit<typeof chrome, 'runtime' | 'i18n'> & {
25
+ runtime: WxtRuntime & Omit<(typeof chrome)['runtime'], 'getURL'>;
26
+ i18n: WxtI18n & Omit<(typeof chrome)['i18n'], 'getMessage'>;
27
+ };
28
+ export declare const browser: WxtBrowser;
@@ -3,6 +3,6 @@ import { type Unimport } from 'unimport';
3
3
  import { Plugin } from 'vite';
4
4
  declare const _default: WxtModule<import("../types").WxtModuleOptions>;
5
5
  export default _default;
6
- export declare function vitePlugin(unimport: Unimport): Plugin;
6
+ export declare function vitePlugin(unimport: Unimport, autoImportsEnabled: boolean): Plugin;
7
7
  export declare function getEslint8ConfigEntry(options: WxtResolvedUnimportOptions, globals: Record<string, EslintGlobalsPropValue>): WxtDirFileEntry;
8
8
  export declare function getEslint9ConfigEntry(options: WxtResolvedUnimportOptions, globals: Record<string, EslintGlobalsPropValue>): WxtDirFileEntry;
@@ -1,40 +1,45 @@
1
1
  import { addViteConfig, defineWxtModule } from "../modules.mjs";
2
- import { createUnimport } from "unimport";
2
+ import { createUnimport, toExports } from "unimport";
3
3
  import { extname } from "node:path";
4
4
  export default defineWxtModule({
5
5
  name: "wxt:built-in:unimport",
6
6
  setup(wxt) {
7
- const options = wxt.config.imports;
8
- if (options === false) return;
9
7
  let unimport;
8
+ const isEnabled = () => !wxt.config.imports.disabled;
10
9
  wxt.hooks.hook("config:resolved", () => {
11
10
  const addModuleImports = (module) => {
12
11
  if (!module.imports) return;
13
- options.imports ??= [];
14
- options.imports.push(...module.imports);
12
+ wxt.config.imports.imports ??= [];
13
+ wxt.config.imports.imports.push(...module.imports);
15
14
  };
16
15
  wxt.config.builtinModules.forEach(addModuleImports);
17
16
  wxt.config.userModules.forEach(addModuleImports);
18
17
  });
19
18
  wxt.hooks.afterEach((event) => {
20
19
  if (event.name === "config:resolved") {
21
- unimport = createUnimport(options);
20
+ unimport = createUnimport(wxt.config.imports);
22
21
  }
23
22
  });
24
23
  wxt.hooks.hook("prepare:types", async (_, entries) => {
25
24
  await unimport.init();
25
+ entries.push(await getImportsModuleEntry(wxt, unimport));
26
+ if (!isEnabled()) return;
26
27
  entries.push(await getImportsDeclarationEntry(unimport));
27
- if (options.eslintrc.enabled === false) return;
28
+ if (wxt.config.imports.eslintrc.enabled === false) return;
28
29
  entries.push(
29
- await getEslintConfigEntry(unimport, options.eslintrc.enabled, options)
30
+ await getEslintConfigEntry(
31
+ unimport,
32
+ wxt.config.imports.eslintrc.enabled,
33
+ wxt.config.imports
34
+ )
30
35
  );
31
36
  });
32
37
  addViteConfig(wxt, () => ({
33
- plugins: [vitePlugin(unimport)]
38
+ plugins: [vitePlugin(unimport, isEnabled())]
34
39
  }));
35
40
  }
36
41
  });
37
- export function vitePlugin(unimport) {
42
+ export function vitePlugin(unimport, autoImportsEnabled) {
38
43
  const ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
39
44
  ".js",
40
45
  ".jsx",
@@ -48,7 +53,12 @@ export function vitePlugin(unimport) {
48
53
  async transform(code, id) {
49
54
  if (id.includes("node_modules")) return;
50
55
  if (!ENABLED_EXTENSIONS.has(extname(id))) return;
51
- const injected = await unimport.injectImports(code, id);
56
+ const injected = await unimport.injectImports(code, id, {
57
+ // Only auto-import modules if enabled
58
+ autoImport: autoImportsEnabled,
59
+ // Always resolve the #imports module, even when auto-imports are disabled
60
+ transformVirtualImports: true
61
+ });
52
62
  return {
53
63
  code: injected.code,
54
64
  map: injected.s.generateMap({ hires: "boundary", source: id })
@@ -57,7 +67,6 @@ export function vitePlugin(unimport) {
57
67
  };
58
68
  }
59
69
  async function getImportsDeclarationEntry(unimport) {
60
- await unimport.init();
61
70
  return {
62
71
  path: "types/imports.d.ts",
63
72
  text: [
@@ -68,6 +77,21 @@ async function getImportsDeclarationEntry(unimport) {
68
77
  tsReference: true
69
78
  };
70
79
  }
80
+ async function getImportsModuleEntry(wxt, unimport) {
81
+ const imports = await unimport.getImports();
82
+ return {
83
+ path: "types/imports-module.d.ts",
84
+ text: [
85
+ "// Generated by wxt",
86
+ "// Types for the #import virtual module",
87
+ "declare module '#imports' {",
88
+ ` ${toExports(imports, wxt.config.wxtDir, true).replaceAll("\n", "\n ")}`,
89
+ "}",
90
+ ""
91
+ ].join("\n"),
92
+ tsReference: true
93
+ };
94
+ }
71
95
  async function getEslintConfigEntry(unimport, version, options) {
72
96
  const globals = (await unimport.getImports()).map((i) => i.as ?? i.name).filter(Boolean).sort().reduce((globals2, name) => {
73
97
  globals2[name] = options.eslintrc.globalsPropValue;
@@ -1,7 +1,6 @@
1
1
  import cli from "./commands.mjs";
2
2
  import { version } from "../version.mjs";
3
3
  import { isAliasedCommand } from "./cli-utils.mjs";
4
- process.env.VITE_CJS_IGNORE_WARNING = "true";
5
4
  cli.parse(process.argv, { run: false });
6
5
  if (!isAliasedCommand(cli.matchedCommand)) {
7
6
  cli.help();
@@ -5,7 +5,6 @@ import {
5
5
  } from "../../utils/entrypoints.mjs";
6
6
  import { toArray } from "../../utils/arrays.mjs";
7
7
  import { safeVarName } from "../../utils/strings.mjs";
8
- import { importEntrypointFile } from "../../utils/building/index.mjs";
9
8
  import { ViteNodeServer } from "vite-node/server";
10
9
  import { ViteNodeRunner } from "vite-node/client";
11
10
  import { installSourcemapsSupport } from "vite-node/source-map";
@@ -45,7 +44,6 @@ export async function createViteBuilder(wxtConfig, hooks, getWxtDevServer) {
45
44
  wxtPlugins.tsconfigPaths(wxtConfig),
46
45
  wxtPlugins.noopBackground(),
47
46
  wxtPlugins.globals(wxtConfig),
48
- wxtPlugins.resolveExtensionApi(wxtConfig),
49
47
  wxtPlugins.defineImportMeta(),
50
48
  wxtPlugins.wxtPluginLoader(wxtConfig),
51
49
  wxtPlugins.resolveAppConfig(wxtConfig)
@@ -214,44 +212,26 @@ export async function createViteBuilder(wxtConfig, hooks, getWxtDevServer) {
214
212
  version: vite.version,
215
213
  async importEntrypoint(path) {
216
214
  const env = createExtensionEnvironment();
217
- switch (wxtConfig.entrypointLoader) {
218
- default:
219
- case "jiti": {
220
- return await env.run(() => importEntrypointFile(path));
221
- }
222
- case "vite-node": {
223
- const { runner, server } = await createViteNodeImporter([path]);
224
- const res = await env.run(() => runner.executeFile(path));
225
- await server.close();
226
- requireDefaultExport(path, res);
227
- return res.default;
228
- }
229
- }
215
+ const { runner, server } = await createViteNodeImporter([path]);
216
+ const res = await env.run(() => runner.executeFile(path));
217
+ await server.close();
218
+ requireDefaultExport(path, res);
219
+ return res.default;
230
220
  },
231
221
  async importEntrypoints(paths) {
232
222
  const env = createExtensionEnvironment();
233
- switch (wxtConfig.entrypointLoader) {
234
- default:
235
- case "jiti": {
236
- return await env.run(
237
- () => Promise.all(paths.map(importEntrypointFile))
238
- );
239
- }
240
- case "vite-node": {
241
- const { runner, server } = await createViteNodeImporter(paths);
242
- const res = await env.run(
243
- () => Promise.all(
244
- paths.map(async (path) => {
245
- const mod = await runner.executeFile(path);
246
- requireDefaultExport(path, mod);
247
- return mod.default;
248
- })
249
- )
250
- );
251
- await server.close();
252
- return res;
253
- }
254
- }
223
+ const { runner, server } = await createViteNodeImporter(paths);
224
+ const res = await env.run(
225
+ () => Promise.all(
226
+ paths.map(async (path) => {
227
+ const mod = await runner.executeFile(path);
228
+ requireDefaultExport(path, mod);
229
+ return mod.default;
230
+ })
231
+ )
232
+ );
233
+ await server.close();
234
+ return res;
255
235
  },
256
236
  async build(group) {
257
237
  let entryConfig;
@@ -302,7 +282,10 @@ export async function createViteBuilder(wxtConfig, hooks, getWxtDevServer) {
302
282
  viteServer.ws.on(message, cb);
303
283
  }
304
284
  },
305
- watcher: viteServer.watcher
285
+ watcher: viteServer.watcher,
286
+ on(event, cb) {
287
+ viteServer.httpServer?.on(event, cb);
288
+ }
306
289
  };
307
290
  return server;
308
291
  }
@@ -1,11 +1,6 @@
1
1
  import type * as vite from 'vite';
2
2
  import { ResolvedConfig } from '../../../../types';
3
3
  /**
4
- * Mock `webextension-polyfill`, `wxt/browser`, and `wxt/browser/*` by inlining
5
- * all dependencies that import them and adding a custom alias so that Vite
6
- * resolves to a mocked version of the module.
7
- *
8
- * TODO: Detect non-wxt dependencies (like `@webext-core/*`) that import `webextension-polyfill` via
9
- * `npm list` and inline them automatically.
4
+ * Mock `wxt/browser` and stub the global `browser`/`chrome` types with a fake version of the extension APIs
10
5
  */
11
6
  export declare function extensionApiMock(config: ResolvedConfig): vite.PluginOption;
@@ -15,14 +15,12 @@ export function extensionApiMock(config) {
15
15
  },
16
16
  resolve: {
17
17
  alias: [
18
- { find: "webextension-polyfill", replacement },
19
18
  // wxt/browser, wxt/browser/...
20
- { find: /^wxt\/browser.*/, replacement }
19
+ { find: "wxt/browser", replacement }
21
20
  ]
22
21
  },
23
22
  ssr: {
24
- // Inline all WXT modules so vite processes them so the aliases can
25
- // be resolved
23
+ // Inline all WXT modules subdependencies can be mocked
26
24
  noExternal: ["wxt"]
27
25
  }
28
26
  };
@@ -9,7 +9,6 @@ export * from './cssEntrypoints';
9
9
  export * from './bundleAnalysis';
10
10
  export * from './globals';
11
11
  export * from './extensionApiMock';
12
- export * from './resolveExtensionApi';
13
12
  export * from './entrypointGroupGlobals';
14
13
  export * from './defineImportMeta';
15
14
  export * from './removeEntrypointMainFunction';
@@ -9,7 +9,6 @@ export * from "./cssEntrypoints.mjs";
9
9
  export * from "./bundleAnalysis.mjs";
10
10
  export * from "./globals.mjs";
11
11
  export * from "./extensionApiMock.mjs";
12
- export * from "./resolveExtensionApi.mjs";
13
12
  export * from "./entrypointGroupGlobals.mjs";
14
13
  export * from "./defineImportMeta.mjs";
15
14
  export * from "./removeEntrypointMainFunction.mjs";
@@ -9,7 +9,7 @@ export function noopBackground() {
9
9
  },
10
10
  load(id) {
11
11
  if (id === resolvedVirtualModuleId) {
12
- return `import { defineBackground } from 'wxt/sandbox';
12
+ return `import { defineBackground } from 'wxt/utils/define-background';
13
13
  export default defineBackground(() => void 0)`;
14
14
  }
15
15
  }
@@ -124,6 +124,7 @@ async function createServerInternal() {
124
124
  }
125
125
  await runner.openBrowser();
126
126
  };
127
+ builderServer.on?.("close", () => keyboardShortcuts.stop());
127
128
  return server;
128
129
  }
129
130
  function createFileReloader(server) {
@@ -0,0 +1,9 @@
1
+ import { WebExtConfig } from '../types';
2
+ /**
3
+ * @deprecated Use `defineWebExtConfig` instead. Same function, different name.
4
+ */
5
+ export declare function defineRunnerConfig(config: WebExtConfig): WebExtConfig;
6
+ /**
7
+ * Configure how [`web-ext`](https://github.com/mozilla/web-ext) starts the browser during development.
8
+ */
9
+ export declare function defineWebExtConfig(config: WebExtConfig): WebExtConfig;
@@ -0,0 +1,10 @@
1
+ import consola from "consola";
2
+ export function defineRunnerConfig(config) {
3
+ consola.warn(
4
+ "`defineRunnerConfig` is deprecated, use `defineWebExtConfig` instead. See https://wxt.dev/guide/resources/upgrading.html#v0-19-0-rarr-v0-20-0"
5
+ );
6
+ return defineWebExtConfig(config);
7
+ }
8
+ export function defineWebExtConfig(config) {
9
+ return config;
10
+ }
@@ -19,9 +19,7 @@ export async function generateWxtDir(entrypoints) {
19
19
  entries.push(await getPathsDeclarationEntry(entrypoints));
20
20
  entries.push(await getI18nDeclarationEntry());
21
21
  entries.push(await getGlobalsDeclarationEntry());
22
- if (wxt.config.extensionApi === "chrome") {
23
- entries.push({ module: "@types/chrome" });
24
- }
22
+ entries.push({ module: "@types/chrome" });
25
23
  entries.push(await getTsConfigEntry());
26
24
  await wxt.hooks.callHook("prepare:types", wxt, entries);
27
25
  entries.push(getMainDeclarationEntry(entries));
@@ -180,10 +178,10 @@ async function getTsConfigEntry() {
180
178
  const paths = Object.entries(wxt.config.alias).flatMap(([alias, absolutePath]) => {
181
179
  const aliasPath = getTsconfigPath(absolutePath);
182
180
  return [
183
- ` "${alias}": ["${aliasPath}"]`,
184
- ` "${alias}/*": ["${aliasPath}/*"]`
181
+ `"${alias}": ["${aliasPath}"]`,
182
+ `"${alias}/*": ["${aliasPath}/*"]`
185
183
  ];
186
- }).join(",\n");
184
+ }).map((line) => ` ${line}`).join(",\n");
187
185
  const text = `{
188
186
  "compilerOptions": {
189
187
  "target": "ESNext",
@@ -1,7 +1,7 @@
1
1
  export * from './build';
2
2
  export * from './clean';
3
3
  export * from './define-config';
4
- export * from './define-runner-config';
4
+ export * from './define-web-ext-config';
5
5
  export * from './create-server';
6
6
  export * from './initialize';
7
7
  export * from './prepare';
@@ -1,7 +1,7 @@
1
1
  export * from "./build.mjs";
2
2
  export * from "./clean.mjs";
3
3
  export * from "./define-config.mjs";
4
- export * from "./define-runner-config.mjs";
4
+ export * from "./define-web-ext-config.mjs";
5
5
  export * from "./create-server.mjs";
6
6
  export * from "./initialize.mjs";
7
7
  export * from "./prepare.mjs";
@@ -5,7 +5,7 @@ import fs from "fs-extra";
5
5
  import path from "node:path";
6
6
  import pc from "picocolors";
7
7
  export async function initialize(options) {
8
- consola.info("Initalizing new project");
8
+ consola.info("Initializing new project");
9
9
  const templates = await listTemplates();
10
10
  const defaultTemplate = templates.find(
11
11
  (template) => template.name === options.template?.toLowerCase().trim()
@@ -35,10 +35,7 @@ export async function initialize(options) {
35
35
  { title: pc.red("npm"), value: "npm" },
36
36
  { title: pc.yellow("pnpm"), value: "pnpm" },
37
37
  { title: pc.cyan("yarn"), value: "yarn" },
38
- {
39
- title: `${pc.magenta("bun")}${pc.gray(" (experimental)")}`,
40
- value: "bun"
41
- }
38
+ { title: pc.magenta("bun"), value: "bun" }
42
39
  ]
43
40
  }
44
41
  ],
@@ -2,7 +2,6 @@ import readline from "node:readline";
2
2
  import { wxt } from "./wxt.mjs";
3
3
  import pc from "picocolors";
4
4
  export function createKeyboardShortcuts(server) {
5
- let isWatching = false;
6
5
  let rl;
7
6
  const handleInput = (line) => {
8
7
  if (line.trim() === "o") {
@@ -11,22 +10,17 @@ export function createKeyboardShortcuts(server) {
11
10
  };
12
11
  return {
13
12
  start() {
14
- if (isWatching) return;
13
+ if (rl) return;
15
14
  rl = readline.createInterface({
16
15
  input: process.stdin,
17
16
  terminal: false
18
17
  // Don't intercept ctrl+C, ctrl+Z, etc
19
18
  });
20
19
  rl.on("line", handleInput);
21
- isWatching = true;
22
20
  },
23
21
  stop() {
24
- if (!isWatching) return;
25
- if (rl) {
26
- rl.close();
27
- rl = void 0;
28
- }
29
- isWatching = false;
22
+ rl?.close();
23
+ rl = void 0;
30
24
  },
31
25
  printHelp(flags) {
32
26
  if (flags.canReopenBrowser) {