wxt 0.17.8 → 0.17.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.
@@ -235,10 +235,11 @@ interface InlineConfig {
235
235
  *
236
236
  * Available template variables:
237
237
  *
238
- * - `{{name}}` - The project's name converted to kebab-case
239
- * - `{{version}}` - The version_name or version from the manifest
240
- * - `{{browser}}` - The target browser from the `--browser` CLI flag
241
- * - `{{manifestVersion}}` - Either "2" or "3"
238
+ * - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
239
+ * - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
240
+ * - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
241
+ * - <span v-pre>`{{mode}}`</span> - The current mode
242
+ * - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
242
243
  *
243
244
  * @default "{{name}}-{{version}}-{{browser}}.zip"
244
245
  */
@@ -248,10 +249,11 @@ interface InlineConfig {
248
249
  *
249
250
  * Available template variables:
250
251
  *
251
- * - `{{name}}` - The project's name converted to kebab-case
252
- * - `{{version}}` - The version_name or version from the manifest
253
- * - `{{browser}}` - The target browser from the `--browser` CLI flag
254
- * - `{{manifestVersion}}` - Either "2" or "3"
252
+ * - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
253
+ * - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
254
+ * - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
255
+ * - <span v-pre>`{{mode}}`</span> - The current mode
256
+ * - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
255
257
  *
256
258
  * @default "{{name}}-{{version}}-sources.zip"
257
259
  */
@@ -424,6 +426,12 @@ interface InlineConfig {
424
426
  * Config effecting dev mode only.
425
427
  */
426
428
  dev?: {
429
+ server?: {
430
+ /**
431
+ * Port to run the dev server on. Defaults to the first open port from 3000 to 3010.
432
+ */
433
+ port?: number;
434
+ };
427
435
  /**
428
436
  * Controls whether a custom keyboard shortcut command, `Alt+R`, is added during dev mode to
429
437
  * quickly reload the extension.
@@ -800,7 +808,7 @@ interface ConfigEnv {
800
808
  /**
801
809
  * The command used to run WXT. `"serve"` during development and `"build"` for any other command.
802
810
  */
803
- command: 'build' | 'serve';
811
+ command: WxtCommand;
804
812
  /**
805
813
  * Browser passed in from the CLI via the `-b` or `--browser` flag. Defaults to `"chrome"` when not passed.
806
814
  */
@@ -812,6 +820,7 @@ interface ConfigEnv {
812
820
  */
813
821
  manifestVersion: 2 | 3;
814
822
  }
823
+ type WxtCommand = 'build' | 'serve';
815
824
  /**
816
825
  * Configure how the browser starts up.
817
826
  */
@@ -1012,6 +1021,17 @@ interface Wxt {
1012
1021
  * Package manager utilities.
1013
1022
  */
1014
1023
  pm: WxtPackageManager;
1024
+ /**
1025
+ * If the dev server was started, it will be availble.
1026
+ */
1027
+ server?: WxtDevServer;
1028
+ /**
1029
+ * The module in charge of executing all the build steps.
1030
+ */
1031
+ builder: WxtBuilder;
1032
+ }
1033
+ interface ResolvedConfig {
1034
+ vite: (env: ConfigEnv) => WxtViteConfig | Promise<WxtViteConfig>;
1015
1035
  }
1016
1036
  interface ResolvedConfig {
1017
1037
  root: string;
@@ -1029,7 +1049,7 @@ interface ResolvedConfig {
1029
1049
  */
1030
1050
  wxtModuleDir: string;
1031
1051
  mode: string;
1032
- command: 'build' | 'serve';
1052
+ command: WxtCommand;
1033
1053
  browser: TargetBrowser;
1034
1054
  manifestVersion: TargetManifestVersion;
1035
1055
  env: ConfigEnv;
@@ -1037,7 +1057,6 @@ interface ResolvedConfig {
1037
1057
  imports: false | WxtResolvedUnimportOptions;
1038
1058
  manifest: UserManifest;
1039
1059
  fsCache: FsCache;
1040
- server?: WxtDevServer;
1041
1060
  runnerConfig: ResolvedConfig$1<ExtensionRunnerConfig>;
1042
1061
  zip: {
1043
1062
  name?: string;
@@ -1049,7 +1068,10 @@ interface ResolvedConfig {
1049
1068
  downloadedPackagesDir: string;
1050
1069
  downloadPackages: string[];
1051
1070
  };
1052
- transformManifest: (manifest: Manifest.WebExtensionManifest) => void;
1071
+ /**
1072
+ * @deprecated Use `build:manifestGenerated` hook instead.
1073
+ */
1074
+ transformManifest?: (manifest: Manifest.WebExtensionManifest) => void;
1053
1075
  analysis: {
1054
1076
  enabled: boolean;
1055
1077
  open: boolean;
@@ -1070,11 +1092,15 @@ interface ResolvedConfig {
1070
1092
  experimental: {
1071
1093
  includeBrowserPolyfill: boolean;
1072
1094
  };
1073
- builder: WxtBuilder;
1074
1095
  dev: {
1096
+ /** Only defined during dev command */
1097
+ server?: {
1098
+ port: number;
1099
+ hostname: string;
1100
+ };
1075
1101
  reloadCommand: string | false;
1076
1102
  };
1077
- hooks: Partial<WxtHooks>;
1103
+ hooks: NestedHooks<WxtHooks>;
1078
1104
  }
1079
1105
  interface FsCache {
1080
1106
  set(key: string, value: string): Promise<void>;
@@ -1160,4 +1186,4 @@ interface Dependency {
1160
1186
  version: string;
1161
1187
  }
1162
1188
 
1163
- export type { EslintGlobalsPropValue as $, UserManifest as A, BuildOutput as B, ContentScriptEntrypoint as C, UserManifestFn as D, ExtensionRunnerConfig as E, ConfigEnv as F, GenericEntrypoint as G, WxtBuilder as H, InlineConfig as I, WxtBuilderServer as J, ServerInfo as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, HookResult as N, OutputFile as O, PopupEntrypointOptions as P, WxtHooks as Q, ReloadContentScriptPayload as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, Wxt as V, WxtDevServer as W, ResolvedConfig as X, FsCache as Y, ExtensionRunner as Z, VirtualEntrypointType as _, WxtViteConfig as a, Eslintrc as a0, ResolvedEslintrc as a1, WxtUnimportOptions as a2, WxtResolvedUnimportOptions as a3, WxtPackageManager as a4, Dependency as a5, OutputChunk as b, OutputAsset as c, BuildStepOutput as d, TargetManifestVersion as e, BaseEntrypointOptions as f, BackgroundEntrypointOptions as g, BaseContentScriptEntrypointOptions as h, IsolatedWorldContentScriptEntrypointOptions as i, OptionsEntrypointOptions as j, BaseEntrypoint as k, BackgroundEntrypoint as l, PopupEntrypoint as m, OptionsEntrypoint as n, SidepanelEntrypoint as o, Entrypoint as p, EntrypointGroup as q, OnContentScriptStopped as r, IsolatedWorldContentScriptDefinition as s, MainWorldContentScriptDefinition as t, ContentScriptDefinition as u, BackgroundDefinition as v, UnlistedScriptDefinition as w, PerBrowserOption as x, PerBrowserMap as y, ResolvedPerBrowserOptions as z };
1189
+ export type { VirtualEntrypointType as $, ResolvedPerBrowserOptions as A, BuildOutput as B, ContentScriptEntrypoint as C, UserManifest as D, ExtensionRunnerConfig as E, UserManifestFn as F, GenericEntrypoint as G, ConfigEnv as H, InlineConfig as I, WxtCommand as J, WxtBuilder as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, WxtBuilderServer as N, OutputFile as O, PopupEntrypointOptions as P, ServerInfo as Q, ResolvedConfig as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, HookResult as V, WxtDevServer as W, WxtHooks as X, Wxt as Y, FsCache as Z, ExtensionRunner as _, WxtViteConfig as a, EslintGlobalsPropValue as a0, Eslintrc as a1, ResolvedEslintrc as a2, WxtUnimportOptions as a3, WxtResolvedUnimportOptions as a4, WxtPackageManager as a5, Dependency as a6, OutputChunk as b, OutputAsset as c, BuildStepOutput as d, ReloadContentScriptPayload as e, TargetManifestVersion as f, BaseEntrypointOptions as g, BackgroundEntrypointOptions as h, BaseContentScriptEntrypointOptions as i, IsolatedWorldContentScriptEntrypointOptions as j, OptionsEntrypointOptions as k, BaseEntrypoint as l, BackgroundEntrypoint as m, PopupEntrypoint as n, OptionsEntrypoint as o, SidepanelEntrypoint as p, Entrypoint as q, EntrypointGroup as r, OnContentScriptStopped as s, IsolatedWorldContentScriptDefinition as t, MainWorldContentScriptDefinition as u, ContentScriptDefinition as v, BackgroundDefinition as w, UnlistedScriptDefinition as x, PerBrowserOption as y, PerBrowserMap as z };
@@ -235,10 +235,11 @@ interface InlineConfig {
235
235
  *
236
236
  * Available template variables:
237
237
  *
238
- * - `{{name}}` - The project's name converted to kebab-case
239
- * - `{{version}}` - The version_name or version from the manifest
240
- * - `{{browser}}` - The target browser from the `--browser` CLI flag
241
- * - `{{manifestVersion}}` - Either "2" or "3"
238
+ * - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
239
+ * - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
240
+ * - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
241
+ * - <span v-pre>`{{mode}}`</span> - The current mode
242
+ * - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
242
243
  *
243
244
  * @default "{{name}}-{{version}}-{{browser}}.zip"
244
245
  */
@@ -248,10 +249,11 @@ interface InlineConfig {
248
249
  *
249
250
  * Available template variables:
250
251
  *
251
- * - `{{name}}` - The project's name converted to kebab-case
252
- * - `{{version}}` - The version_name or version from the manifest
253
- * - `{{browser}}` - The target browser from the `--browser` CLI flag
254
- * - `{{manifestVersion}}` - Either "2" or "3"
252
+ * - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
253
+ * - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
254
+ * - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
255
+ * - <span v-pre>`{{mode}}`</span> - The current mode
256
+ * - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
255
257
  *
256
258
  * @default "{{name}}-{{version}}-sources.zip"
257
259
  */
@@ -424,6 +426,12 @@ interface InlineConfig {
424
426
  * Config effecting dev mode only.
425
427
  */
426
428
  dev?: {
429
+ server?: {
430
+ /**
431
+ * Port to run the dev server on. Defaults to the first open port from 3000 to 3010.
432
+ */
433
+ port?: number;
434
+ };
427
435
  /**
428
436
  * Controls whether a custom keyboard shortcut command, `Alt+R`, is added during dev mode to
429
437
  * quickly reload the extension.
@@ -800,7 +808,7 @@ interface ConfigEnv {
800
808
  /**
801
809
  * The command used to run WXT. `"serve"` during development and `"build"` for any other command.
802
810
  */
803
- command: 'build' | 'serve';
811
+ command: WxtCommand;
804
812
  /**
805
813
  * Browser passed in from the CLI via the `-b` or `--browser` flag. Defaults to `"chrome"` when not passed.
806
814
  */
@@ -812,6 +820,7 @@ interface ConfigEnv {
812
820
  */
813
821
  manifestVersion: 2 | 3;
814
822
  }
823
+ type WxtCommand = 'build' | 'serve';
815
824
  /**
816
825
  * Configure how the browser starts up.
817
826
  */
@@ -1012,6 +1021,17 @@ interface Wxt {
1012
1021
  * Package manager utilities.
1013
1022
  */
1014
1023
  pm: WxtPackageManager;
1024
+ /**
1025
+ * If the dev server was started, it will be availble.
1026
+ */
1027
+ server?: WxtDevServer;
1028
+ /**
1029
+ * The module in charge of executing all the build steps.
1030
+ */
1031
+ builder: WxtBuilder;
1032
+ }
1033
+ interface ResolvedConfig {
1034
+ vite: (env: ConfigEnv) => WxtViteConfig | Promise<WxtViteConfig>;
1015
1035
  }
1016
1036
  interface ResolvedConfig {
1017
1037
  root: string;
@@ -1029,7 +1049,7 @@ interface ResolvedConfig {
1029
1049
  */
1030
1050
  wxtModuleDir: string;
1031
1051
  mode: string;
1032
- command: 'build' | 'serve';
1052
+ command: WxtCommand;
1033
1053
  browser: TargetBrowser;
1034
1054
  manifestVersion: TargetManifestVersion;
1035
1055
  env: ConfigEnv;
@@ -1037,7 +1057,6 @@ interface ResolvedConfig {
1037
1057
  imports: false | WxtResolvedUnimportOptions;
1038
1058
  manifest: UserManifest;
1039
1059
  fsCache: FsCache;
1040
- server?: WxtDevServer;
1041
1060
  runnerConfig: ResolvedConfig$1<ExtensionRunnerConfig>;
1042
1061
  zip: {
1043
1062
  name?: string;
@@ -1049,7 +1068,10 @@ interface ResolvedConfig {
1049
1068
  downloadedPackagesDir: string;
1050
1069
  downloadPackages: string[];
1051
1070
  };
1052
- transformManifest: (manifest: Manifest.WebExtensionManifest) => void;
1071
+ /**
1072
+ * @deprecated Use `build:manifestGenerated` hook instead.
1073
+ */
1074
+ transformManifest?: (manifest: Manifest.WebExtensionManifest) => void;
1053
1075
  analysis: {
1054
1076
  enabled: boolean;
1055
1077
  open: boolean;
@@ -1070,11 +1092,15 @@ interface ResolvedConfig {
1070
1092
  experimental: {
1071
1093
  includeBrowserPolyfill: boolean;
1072
1094
  };
1073
- builder: WxtBuilder;
1074
1095
  dev: {
1096
+ /** Only defined during dev command */
1097
+ server?: {
1098
+ port: number;
1099
+ hostname: string;
1100
+ };
1075
1101
  reloadCommand: string | false;
1076
1102
  };
1077
- hooks: Partial<WxtHooks>;
1103
+ hooks: NestedHooks<WxtHooks>;
1078
1104
  }
1079
1105
  interface FsCache {
1080
1106
  set(key: string, value: string): Promise<void>;
@@ -1160,4 +1186,4 @@ interface Dependency {
1160
1186
  version: string;
1161
1187
  }
1162
1188
 
1163
- export type { EslintGlobalsPropValue as $, UserManifest as A, BuildOutput as B, ContentScriptEntrypoint as C, UserManifestFn as D, ExtensionRunnerConfig as E, ConfigEnv as F, GenericEntrypoint as G, WxtBuilder as H, InlineConfig as I, WxtBuilderServer as J, ServerInfo as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, HookResult as N, OutputFile as O, PopupEntrypointOptions as P, WxtHooks as Q, ReloadContentScriptPayload as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, Wxt as V, WxtDevServer as W, ResolvedConfig as X, FsCache as Y, ExtensionRunner as Z, VirtualEntrypointType as _, WxtViteConfig as a, Eslintrc as a0, ResolvedEslintrc as a1, WxtUnimportOptions as a2, WxtResolvedUnimportOptions as a3, WxtPackageManager as a4, Dependency as a5, OutputChunk as b, OutputAsset as c, BuildStepOutput as d, TargetManifestVersion as e, BaseEntrypointOptions as f, BackgroundEntrypointOptions as g, BaseContentScriptEntrypointOptions as h, IsolatedWorldContentScriptEntrypointOptions as i, OptionsEntrypointOptions as j, BaseEntrypoint as k, BackgroundEntrypoint as l, PopupEntrypoint as m, OptionsEntrypoint as n, SidepanelEntrypoint as o, Entrypoint as p, EntrypointGroup as q, OnContentScriptStopped as r, IsolatedWorldContentScriptDefinition as s, MainWorldContentScriptDefinition as t, ContentScriptDefinition as u, BackgroundDefinition as v, UnlistedScriptDefinition as w, PerBrowserOption as x, PerBrowserMap as y, ResolvedPerBrowserOptions as z };
1189
+ export type { VirtualEntrypointType as $, ResolvedPerBrowserOptions as A, BuildOutput as B, ContentScriptEntrypoint as C, UserManifest as D, ExtensionRunnerConfig as E, UserManifestFn as F, GenericEntrypoint as G, ConfigEnv as H, InlineConfig as I, WxtCommand as J, WxtBuilder as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, WxtBuilderServer as N, OutputFile as O, PopupEntrypointOptions as P, ServerInfo as Q, ResolvedConfig as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, HookResult as V, WxtDevServer as W, WxtHooks as X, Wxt as Y, FsCache as Z, ExtensionRunner as _, WxtViteConfig as a, EslintGlobalsPropValue as a0, Eslintrc as a1, ResolvedEslintrc as a2, WxtUnimportOptions as a3, WxtResolvedUnimportOptions as a4, WxtPackageManager as a5, Dependency as a6, OutputChunk as b, OutputAsset as c, BuildStepOutput as d, ReloadContentScriptPayload as e, TargetManifestVersion as f, BaseEntrypointOptions as g, BackgroundEntrypointOptions as h, BaseContentScriptEntrypointOptions as i, IsolatedWorldContentScriptEntrypointOptions as j, OptionsEntrypointOptions as k, BaseEntrypoint as l, BackgroundEntrypoint as m, PopupEntrypoint as n, OptionsEntrypoint as o, SidepanelEntrypoint as p, Entrypoint as q, EntrypointGroup as r, OnContentScriptStopped as s, IsolatedWorldContentScriptDefinition as t, MainWorldContentScriptDefinition as u, ContentScriptDefinition as v, BackgroundDefinition as w, UnlistedScriptDefinition as x, PerBrowserOption as y, PerBrowserMap as z };