wxt 0.14.3 → 0.14.5

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.
@@ -323,6 +323,24 @@ interface InlineConfig {
323
323
  */
324
324
  includeBrowserPolyfill?: boolean;
325
325
  };
326
+ /**
327
+ * Config effecting dev mode only.
328
+ */
329
+ dev?: {
330
+ /**
331
+ * Controls whether a custom keyboard shortcut command, `Alt+R`, is added during dev mode to
332
+ * quickly reload the extension.
333
+ *
334
+ * If false, the shortcut is not added during development.
335
+ *
336
+ * If set to a custom string, you can override the key combo used. See
337
+ * [Chrome's command docs](https://developer.chrome.com/docs/extensions/reference/api/commands)
338
+ * for available options.
339
+ *
340
+ * @default "Alt+R"
341
+ */
342
+ reloadCommand?: string | false;
343
+ };
326
344
  }
327
345
  interface InlineConfig {
328
346
  /**
@@ -323,6 +323,24 @@ interface InlineConfig {
323
323
  */
324
324
  includeBrowserPolyfill?: boolean;
325
325
  };
326
+ /**
327
+ * Config effecting dev mode only.
328
+ */
329
+ dev?: {
330
+ /**
331
+ * Controls whether a custom keyboard shortcut command, `Alt+R`, is added during dev mode to
332
+ * quickly reload the extension.
333
+ *
334
+ * If false, the shortcut is not added during development.
335
+ *
336
+ * If set to a custom string, you can override the key combo used. See
337
+ * [Chrome's command docs](https://developer.chrome.com/docs/extensions/reference/api/commands)
338
+ * for available options.
339
+ *
340
+ * @default "Alt+R"
341
+ */
342
+ reloadCommand?: string | false;
343
+ };
326
344
  }
327
345
  interface InlineConfig {
328
346
  /**
package/dist/index.cjs CHANGED
@@ -3977,6 +3977,7 @@ async function getInternalConfig(inlineConfig, command, server) {
3977
3977
  const typesDir = import_node_path7.default.resolve(wxtDir, "types");
3978
3978
  const outBaseDir = import_node_path7.default.resolve(root, mergedConfig.outDir ?? ".output");
3979
3979
  const outDir = import_node_path7.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
3980
+ const reloadCommand = mergedConfig.dev?.reloadCommand ?? "Alt+R";
3980
3981
  const runnerConfig = await (0, import_c12.loadConfig)({
3981
3982
  name: "web-ext",
3982
3983
  cwd: root,
@@ -4029,7 +4030,10 @@ async function getInternalConfig(inlineConfig, command, server) {
4029
4030
  experimental: {
4030
4031
  includeBrowserPolyfill: mergedConfig.experimental?.includeBrowserPolyfill ?? true
4031
4032
  },
4032
- server
4033
+ server,
4034
+ dev: {
4035
+ reloadCommand
4036
+ }
4033
4037
  };
4034
4038
  const builder = await createViteBuilder(
4035
4039
  inlineConfig,
@@ -4096,7 +4100,11 @@ function mergeInlineConfig(inlineConfig, userConfig) {
4096
4100
  ...inlineConfig.experimental
4097
4101
  },
4098
4102
  vite: void 0,
4099
- transformManifest: void 0
4103
+ transformManifest: void 0,
4104
+ dev: {
4105
+ ...userConfig.dev,
4106
+ ...inlineConfig.dev
4107
+ }
4100
4108
  };
4101
4109
  }
4102
4110
  function resolveInternalZipConfig(root, mergedConfig) {
@@ -4373,7 +4381,7 @@ function getChunkSortWeight(filename) {
4373
4381
  var import_picocolors4 = __toESM(require("picocolors"), 1);
4374
4382
 
4375
4383
  // package.json
4376
- var version = "0.14.3";
4384
+ var version = "0.14.5";
4377
4385
 
4378
4386
  // src/core/utils/log/printHeader.ts
4379
4387
  var import_consola2 = require("consola");
@@ -4514,6 +4522,7 @@ async function writeManifest(manifest, output, config) {
4514
4522
  });
4515
4523
  }
4516
4524
  async function generateManifest(entrypoints, buildOutput, config) {
4525
+ const warnings = [];
4517
4526
  const pkg = await getPackageJson(config);
4518
4527
  let versionName = config.manifest.version_name ?? config.manifest.version ?? pkg?.version;
4519
4528
  if (versionName == null) {
@@ -4531,21 +4540,26 @@ async function generateManifest(entrypoints, buildOutput, config) {
4531
4540
  short_name: pkg?.shortName,
4532
4541
  icons: discoverIcons(buildOutput)
4533
4542
  };
4534
- if (config.command === "serve") {
4535
- baseManifest.commands = {
4536
- "wxt:reload-extension": {
4537
- description: "Reload the extension during development",
4538
- suggested_key: {
4539
- default: "Alt+R"
4540
- }
4541
- }
4542
- };
4543
- }
4544
4543
  const userManifest = config.manifest;
4545
4544
  const manifest = (0, import_defu3.default)(
4546
4545
  userManifest,
4547
4546
  baseManifest
4548
4547
  );
4548
+ if (config.command === "serve" && config.dev.reloadCommand) {
4549
+ if (manifest.commands && Object.keys(manifest.commands).length >= 4) {
4550
+ warnings.push([
4551
+ "Extension already has 4 registered commands, WXT's reload command is disabled"
4552
+ ]);
4553
+ } else {
4554
+ manifest.commands ??= {};
4555
+ manifest.commands["wxt:reload-extension"] = {
4556
+ description: "Reload the extension during development",
4557
+ suggested_key: {
4558
+ default: config.dev.reloadCommand
4559
+ }
4560
+ };
4561
+ }
4562
+ }
4549
4563
  manifest.version = version2;
4550
4564
  manifest.version_name = // Firefox doesn't support version_name
4551
4565
  config.browser === "firefox" || versionName === version2 ? void 0 : versionName;
@@ -4564,7 +4578,10 @@ async function generateManifest(entrypoints, buildOutput, config) {
4564
4578
  "Manifest 'version' is missing. Either:\n1. Add a version in your <rootDir>/package.json\n2. Pass the version via the manifest option in your wxt.config.ts"
4565
4579
  );
4566
4580
  }
4567
- return finalManifest;
4581
+ return {
4582
+ manifest: finalManifest,
4583
+ warnings
4584
+ };
4568
4585
  }
4569
4586
  function simplifyVersion(versionName) {
4570
4587
  const version2 = /^((0|[1-9][0-9]{0,8})([.](0|[1-9][0-9]{0,8})){0,3}).*$/.exec(
@@ -4925,11 +4942,7 @@ async function rebuild(config, allEntrypoints, entrypointGroups, existingOutput
4925
4942
  steps: [...existingOutput.steps, ...newOutput.steps],
4926
4943
  publicAssets: [...existingOutput.publicAssets, ...newOutput.publicAssets]
4927
4944
  };
4928
- const newManifest = await generateManifest(
4929
- allEntrypoints,
4930
- mergedOutput,
4931
- config
4932
- );
4945
+ const { manifest: newManifest, warnings: manifestWarnings } = await generateManifest(allEntrypoints, mergedOutput, config);
4933
4946
  const finalOutput = {
4934
4947
  manifest: newManifest,
4935
4948
  ...newOutput
@@ -4945,7 +4958,8 @@ async function rebuild(config, allEntrypoints, entrypointGroups, existingOutput
4945
4958
  ...finalOutput.publicAssets
4946
4959
  ]
4947
4960
  },
4948
- manifest: newManifest
4961
+ manifest: newManifest,
4962
+ warnings: manifestWarnings
4949
4963
  };
4950
4964
  }
4951
4965
 
@@ -4964,13 +4978,21 @@ async function internalBuild(config) {
4964
4978
  const entrypoints = await findEntrypoints(config);
4965
4979
  config.logger.debug("Detected entrypoints:", entrypoints);
4966
4980
  const groups = groupEntrypoints(entrypoints);
4967
- const { output } = await rebuild(config, entrypoints, groups, void 0);
4981
+ const { output, warnings } = await rebuild(
4982
+ config,
4983
+ entrypoints,
4984
+ groups,
4985
+ void 0
4986
+ );
4968
4987
  await printBuildSummary(
4969
4988
  config.logger.success,
4970
4989
  `Built extension in ${formatDuration(Date.now() - startTime)}`,
4971
4990
  output,
4972
4991
  config
4973
4992
  );
4993
+ for (const warning of warnings) {
4994
+ config.logger.warn(...warning);
4995
+ }
4974
4996
  if (config.analysis.enabled) {
4975
4997
  await combineAnalysisStats(config);
4976
4998
  config.logger.info(
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-QOQPHF1G.cjs';
2
- export { q as BackgroundDefinition, h as BackgroundEntrypoint, g as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, w as ConfigEnv, p as ContentScriptBaseDefinition, m as ContentScriptDefinition, C as ContentScriptEntrypoint, n as ContentScriptIsolatedWorldDefinition, o as ContentScriptMainWorldDefinition, j as Entrypoint, k as EntrypointGroup, t as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, l as OnContentScriptStopped, i as OptionsEntrypoint, c as OutputAsset, b as OutputChunk, O as OutputFile, s as PerBrowserOption, P as PopupEntrypoint, S as ServerInfo, T as TargetBrowser, e as TargetManifestVersion, r as UnlistedScriptDefinition, u as UserManifest, v as UserManifestFn, x as WxtBuilder, y as WxtBuilderServer, a as WxtViteConfig } from './external-QOQPHF1G.cjs';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './external-biT0d3qK.cjs';
2
+ export { q as BackgroundDefinition, h as BackgroundEntrypoint, g as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, w as ConfigEnv, p as ContentScriptBaseDefinition, m as ContentScriptDefinition, C as ContentScriptEntrypoint, n as ContentScriptIsolatedWorldDefinition, o as ContentScriptMainWorldDefinition, j as Entrypoint, k as EntrypointGroup, t as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, l as OnContentScriptStopped, i as OptionsEntrypoint, c as OutputAsset, b as OutputChunk, O as OutputFile, s as PerBrowserOption, P as PopupEntrypoint, S as ServerInfo, T as TargetBrowser, e as TargetManifestVersion, r as UnlistedScriptDefinition, u as UserManifest, v as UserManifestFn, x as WxtBuilder, y as WxtBuilderServer, a as WxtViteConfig } from './external-biT0d3qK.cjs';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -62,6 +62,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
62
62
  */
63
63
  declare function zip(config?: InlineConfig): Promise<string[]>;
64
64
 
65
- var version = "0.14.3";
65
+ var version = "0.14.5";
66
66
 
67
67
  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-QOQPHF1G.js';
2
- export { q as BackgroundDefinition, h as BackgroundEntrypoint, g as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, w as ConfigEnv, p as ContentScriptBaseDefinition, m as ContentScriptDefinition, C as ContentScriptEntrypoint, n as ContentScriptIsolatedWorldDefinition, o as ContentScriptMainWorldDefinition, j as Entrypoint, k as EntrypointGroup, t as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, l as OnContentScriptStopped, i as OptionsEntrypoint, c as OutputAsset, b as OutputChunk, O as OutputFile, s as PerBrowserOption, P as PopupEntrypoint, S as ServerInfo, T as TargetBrowser, e as TargetManifestVersion, r as UnlistedScriptDefinition, u as UserManifest, v as UserManifestFn, x as WxtBuilder, y as WxtBuilderServer, a as WxtViteConfig } from './external-QOQPHF1G.js';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './external-biT0d3qK.js';
2
+ export { q as BackgroundDefinition, h as BackgroundEntrypoint, g as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, w as ConfigEnv, p as ContentScriptBaseDefinition, m as ContentScriptDefinition, C as ContentScriptEntrypoint, n as ContentScriptIsolatedWorldDefinition, o as ContentScriptMainWorldDefinition, j as Entrypoint, k as EntrypointGroup, t as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, l as OnContentScriptStopped, i as OptionsEntrypoint, c as OutputAsset, b as OutputChunk, O as OutputFile, s as PerBrowserOption, P as PopupEntrypoint, S as ServerInfo, T as TargetBrowser, e as TargetManifestVersion, r as UnlistedScriptDefinition, u as UserManifest, v as UserManifestFn, x as WxtBuilder, y as WxtBuilderServer, a as WxtViteConfig } from './external-biT0d3qK.js';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -62,6 +62,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
62
62
  */
63
63
  declare function zip(config?: InlineConfig): Promise<string[]>;
64
64
 
65
- var version = "0.14.3";
65
+ var version = "0.14.5";
66
66
 
67
67
  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-E6XT3LOQ.js";
18
+ } from "./chunk-YECUTQH3.js";
19
19
  import "./chunk-VBXJIVYU.js";
20
20
 
21
21
  // src/core/build.ts
package/dist/testing.cjs CHANGED
@@ -961,6 +961,7 @@ async function getInternalConfig(inlineConfig, command, server) {
961
961
  const typesDir = import_node_path7.default.resolve(wxtDir, "types");
962
962
  const outBaseDir = import_node_path7.default.resolve(root, mergedConfig.outDir ?? ".output");
963
963
  const outDir = import_node_path7.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
964
+ const reloadCommand = mergedConfig.dev?.reloadCommand ?? "Alt+R";
964
965
  const runnerConfig = await (0, import_c12.loadConfig)({
965
966
  name: "web-ext",
966
967
  cwd: root,
@@ -1013,7 +1014,10 @@ async function getInternalConfig(inlineConfig, command, server) {
1013
1014
  experimental: {
1014
1015
  includeBrowserPolyfill: mergedConfig.experimental?.includeBrowserPolyfill ?? true
1015
1016
  },
1016
- server
1017
+ server,
1018
+ dev: {
1019
+ reloadCommand
1020
+ }
1017
1021
  };
1018
1022
  const builder = await createViteBuilder(
1019
1023
  inlineConfig,
@@ -1080,7 +1084,11 @@ function mergeInlineConfig(inlineConfig, userConfig) {
1080
1084
  ...inlineConfig.experimental
1081
1085
  },
1082
1086
  vite: void 0,
1083
- transformManifest: void 0
1087
+ transformManifest: void 0,
1088
+ dev: {
1089
+ ...userConfig.dev,
1090
+ ...inlineConfig.dev
1091
+ }
1084
1092
  };
1085
1093
  }
1086
1094
  function resolveInternalZipConfig(root, mergedConfig) {
@@ -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-QOQPHF1G.cjs';
3
+ import { I as InlineConfig } from './external-biT0d3qK.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 './external-QOQPHF1G.js';
3
+ import { I as InlineConfig } from './external-biT0d3qK.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-E6XT3LOQ.js";
8
+ } from "./chunk-YECUTQH3.js";
9
9
  import "./chunk-VBXJIVYU.js";
10
10
 
11
11
  // src/testing/fake-browser.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.14.3",
4
+ "version": "0.14.5",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",