wxt 0.21.0 → 0.21.2

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 (153) hide show
  1. package/README.md +0 -1
  2. package/bin/wxt-publish-extension.mjs +4 -3
  3. package/dist/browser.d.mts +7 -6
  4. package/dist/browser.mjs +6 -5
  5. package/dist/builtin-modules/favicon-permission.mjs +28 -0
  6. package/dist/builtin-modules/index.mjs +3 -4
  7. package/dist/builtin-modules/unimport.mjs +1 -3
  8. package/dist/cli/cli-utils.mjs +8 -9
  9. package/dist/cli/commands.mjs +1 -3
  10. package/dist/cli/index.mjs +1 -3
  11. package/dist/core/build.d.mts +9 -8
  12. package/dist/core/build.mjs +10 -11
  13. package/dist/core/builders/vite/index.mjs +123 -75
  14. package/dist/core/builders/vite/plugins/bundleAnalysis.mjs +1 -3
  15. package/dist/core/builders/vite/plugins/cssEntrypoints.mjs +6 -6
  16. package/dist/core/builders/vite/plugins/defineImportMeta.mjs +3 -4
  17. package/dist/core/builders/vite/plugins/devHtmlPrerender.mjs +34 -26
  18. package/dist/core/builders/vite/plugins/devServerGlobals.mjs +3 -3
  19. package/dist/core/builders/vite/plugins/entrypointGroupGlobals.mjs +2 -6
  20. package/dist/core/builders/vite/plugins/extensionApiMock.mjs +13 -8
  21. package/dist/core/builders/vite/plugins/globals.mjs +1 -3
  22. package/dist/core/builders/vite/plugins/iifeAnonymous.mjs +1 -2
  23. package/dist/core/builders/vite/plugins/iifeFooter.mjs +14 -7
  24. package/dist/core/builders/vite/plugins/index.mjs +17 -19
  25. package/dist/core/builders/vite/plugins/noopBackground.mjs +14 -9
  26. package/dist/core/builders/vite/plugins/removeEntrypointMainFunction.mjs +10 -12
  27. package/dist/core/builders/vite/plugins/resolveAppConfig.mjs +14 -10
  28. package/dist/core/builders/vite/plugins/resolveVirtualModules.mjs +15 -13
  29. package/dist/core/builders/vite/plugins/tsconfigPaths.mjs +1 -2
  30. package/dist/core/builders/vite/plugins/wxtPluginLoader.mjs +22 -17
  31. package/dist/core/clean.d.mts +3 -14
  32. package/dist/core/clean.mjs +19 -13
  33. package/dist/core/create-server.d.mts +6 -5
  34. package/dist/core/create-server.mjs +21 -117
  35. package/dist/core/define-config.mjs +1 -2
  36. package/dist/core/define-web-ext-config.d.mts +3 -6
  37. package/dist/core/define-web-ext-config.mjs +3 -12
  38. package/dist/core/generate-wxt-dir.mjs +53 -35
  39. package/dist/core/index.d.mts +3 -2
  40. package/dist/core/index.mjs +11 -11
  41. package/dist/core/initialize.mjs +28 -29
  42. package/dist/core/keyboard-shortcuts.mjs +4 -8
  43. package/dist/core/package-managers/bun.mjs +1 -3
  44. package/dist/core/package-managers/deno.mjs +1 -2
  45. package/dist/core/package-managers/index.mjs +1 -3
  46. package/dist/core/package-managers/npm.mjs +3 -5
  47. package/dist/core/package-managers/pnpm.mjs +1 -3
  48. package/dist/core/package-managers/yarn.mjs +1 -3
  49. package/dist/core/prepare.mjs +1 -3
  50. package/dist/core/resolve-config.mjs +63 -43
  51. package/dist/core/runners/manual.mjs +2 -6
  52. package/dist/core/runners/safari.mjs +3 -4
  53. package/dist/core/runners/web-ext.mjs +8 -11
  54. package/dist/core/runners/wsl.mjs +3 -4
  55. package/dist/core/utils/arrays.mjs +4 -11
  56. package/dist/core/utils/building/build-entrypoints.mjs +10 -11
  57. package/dist/core/utils/building/detect-dev-changes.mjs +37 -19
  58. package/dist/core/utils/building/find-entrypoints.mjs +40 -21
  59. package/dist/core/utils/building/group-entrypoints.mjs +3 -4
  60. package/dist/core/utils/building/index.mjs +7 -8
  61. package/dist/core/utils/building/internal-build.mjs +21 -21
  62. package/dist/core/utils/building/rebuild.mjs +10 -10
  63. package/dist/core/utils/cache.mjs +6 -8
  64. package/dist/core/utils/constants.mjs +3 -4
  65. package/dist/core/utils/content-scripts.mjs +3 -4
  66. package/dist/core/utils/content-security-policy.mjs +2 -5
  67. package/dist/core/utils/create-file-reloader.mjs +158 -0
  68. package/dist/core/utils/entrypoints.d.mts +10 -0
  69. package/dist/core/utils/entrypoints.mjs +6 -10
  70. package/dist/core/utils/env.mjs +24 -19
  71. package/dist/core/utils/environments/browser-environment.mjs +1 -3
  72. package/dist/core/utils/environments/environment.mjs +1 -2
  73. package/dist/core/utils/environments/extension-environment.mjs +1 -3
  74. package/dist/core/utils/environments/index.mjs +3 -4
  75. package/dist/core/utils/eslint.mjs +1 -2
  76. package/dist/core/utils/fs.mjs +23 -14
  77. package/dist/core/utils/globals.mjs +1 -2
  78. package/dist/core/utils/i18n.mjs +2 -3
  79. package/dist/core/utils/index.d.mts +2 -0
  80. package/dist/core/utils/index.mjs +3 -3
  81. package/dist/core/utils/log/index.mjs +5 -6
  82. package/dist/core/utils/log/printBuildSummary.mjs +1 -3
  83. package/dist/core/utils/log/printFileList.mjs +25 -21
  84. package/dist/core/utils/log/printHeader.mjs +3 -5
  85. package/dist/core/utils/log/printTable.mjs +1 -2
  86. package/dist/core/utils/manifest.mjs +39 -46
  87. package/dist/core/utils/number.mjs +1 -2
  88. package/dist/core/utils/package.mjs +3 -5
  89. package/dist/core/utils/paths.d.mts +2 -2
  90. package/dist/core/utils/paths.mjs +7 -9
  91. package/dist/core/utils/strings.mjs +4 -7
  92. package/dist/core/utils/syntax-errors.mjs +3 -5
  93. package/dist/core/utils/theme-icons.mjs +71 -0
  94. package/dist/core/utils/time.mjs +1 -13
  95. package/dist/core/utils/transform.mjs +9 -7
  96. package/dist/core/utils/validation.mjs +1 -2
  97. package/dist/core/utils/virtual-modules.mjs +9 -15
  98. package/dist/core/wxt.mjs +11 -12
  99. package/dist/core/zip.d.mts +1 -0
  100. package/dist/core/zip.mjs +25 -20
  101. package/dist/index.d.mts +4 -4
  102. package/dist/index.mjs +3 -3
  103. package/dist/modules.d.mts +64 -61
  104. package/dist/modules.mjs +70 -66
  105. package/dist/testing/fake-browser.mjs +1 -2
  106. package/dist/testing/wxt-vitest-plugin.d.mts +4 -2
  107. package/dist/testing/wxt-vitest-plugin.mjs +5 -7
  108. package/dist/types.d.mts +636 -450
  109. package/dist/utils/app-config.d.mts +1 -0
  110. package/dist/utils/app-config.mjs +3 -3
  111. package/dist/utils/content-script-context.d.mts +49 -39
  112. package/dist/utils/content-script-context.mjs +37 -32
  113. package/dist/utils/content-script-ui/iframe.d.mts +14 -15
  114. package/dist/utils/content-script-ui/iframe.mjs +1 -3
  115. package/dist/utils/content-script-ui/integrated.d.mts +8 -7
  116. package/dist/utils/content-script-ui/integrated.mjs +1 -3
  117. package/dist/utils/content-script-ui/shadow-root.d.mts +37 -25
  118. package/dist/utils/content-script-ui/shadow-root.mjs +5 -8
  119. package/dist/utils/content-script-ui/shared.mjs +1 -3
  120. package/dist/utils/content-script-ui/types.d.mts +29 -34
  121. package/dist/utils/content-script-ui/types.mjs +1 -1
  122. package/dist/utils/define-app-config.d.mts +4 -3
  123. package/dist/utils/define-app-config.mjs +5 -5
  124. package/dist/utils/define-background.mjs +1 -2
  125. package/dist/utils/define-content-script.mjs +1 -2
  126. package/dist/utils/define-unlisted-script.mjs +1 -2
  127. package/dist/utils/define-wxt-plugin.mjs +1 -2
  128. package/dist/utils/inject-script.d.mts +2 -2
  129. package/dist/utils/inject-script.mjs +4 -5
  130. package/dist/utils/internal/custom-events.mjs +3 -4
  131. package/dist/utils/internal/location-watcher.mjs +4 -6
  132. package/dist/utils/internal/logger.mjs +2 -5
  133. package/dist/utils/match-patterns.mjs +2 -3
  134. package/dist/utils/split-shadow-root-css.d.mts +6 -2
  135. package/dist/utils/split-shadow-root-css.mjs +7 -4
  136. package/dist/utils/storage.mjs +2 -3
  137. package/dist/version.mjs +2 -3
  138. package/dist/virtual/background-entrypoint.mjs +4 -16
  139. package/dist/virtual/content-script-isolated-world-entrypoint.mjs +2 -7
  140. package/dist/virtual/content-script-main-world-entrypoint.mjs +2 -7
  141. package/dist/virtual/mock-browser.d.mts +1 -1
  142. package/dist/virtual/mock-browser.mjs +2 -4
  143. package/dist/virtual/reload-html.mjs +3 -10
  144. package/dist/virtual/unlisted-script-entrypoint.mjs +2 -7
  145. package/package.json +55 -49
  146. package/LICENSE +0 -21
  147. package/dist/core/builders/vite/plugins/download.mjs +0 -25
  148. package/dist/core/runners/index.mjs +0 -17
  149. package/dist/core/utils/minimatch-multiple.mjs +0 -28
  150. package/dist/core/utils/network.mjs +0 -38
  151. package/dist/core/utils/wsl.mjs +0 -12
  152. package/dist/testing/index.d.mts +0 -3
  153. package/dist/testing/index.mjs +0 -4
package/dist/types.d.mts CHANGED
@@ -4,112 +4,115 @@
4
4
  * modifying the options in `tsconfig.json`.
5
5
  *
6
6
  * @example
7
- * wxt.hooks.hook("prepare:types", (wxt, entries) => {
8
- * // Add a file, ".wxt/types/example.d.ts", that defines a global
9
- * // variable called "example" in the TS project.
10
- * entries.push({
11
- * path: "types/example.d.ts",
12
- * text: "declare const a: string;",
13
- * tsReference: true,
7
+ * wxt.hooks.hook('prepare:types', (wxt, entries) => {
8
+ * // Add a file, ".wxt/types/example.d.ts", that defines a global
9
+ * // variable called "example" in the TS project.
10
+ * entries.push({
11
+ * path: 'types/example.d.ts',
12
+ * text: 'declare const a: string;',
13
+ * tsReference: true,
14
+ * });
15
+ * // use module to add Triple-Slash Directive in .wxt/wxt.d.ts
16
+ * // eg: /// <reference types="@types/example" />
17
+ * entries.push({
18
+ * module: '@types/example',
19
+ * });
14
20
  * });
15
- * // use module to add Triple-Slash Directive in .wxt/wxt.d.ts
16
- * // eg: /// <reference types="@types/example" />
17
- * entries.push({
18
- * module: '@types/example'
19
- * });
20
- * })
21
- */
22
-
23
- /**
24
- * Specifies the module name that will be used in the `/// <reference types="..." />` directive.
25
- * This value will be added to the `.wxt/wxt.d.ts` file to include type definitions from the specified module.
26
21
  */import { ContentScriptContext } from "./utils/content-script-context.mjs";
27
22
  import { ManifestContentScript } from "./core/utils/types.mjs";
28
- import { ResolvedConfig } from "c12";
29
- import { LogLevel } from "consola";
30
- import { Import, UnimportOptions } from "unimport";
31
23
  import { Hookable, NestedHooks } from "hookable";
32
- import * as Nypm from "nypm";
24
+ import { Import, UnimportOptions } from "unimport";
33
25
  import { PluginVisualizerOptions } from "@aklinker1/rollup-plugin-visualizer";
26
+ import * as Nypm from "nypm";
27
+ import { ResolvedConfig } from "c12";
28
+ import { LogLevel } from "consola";
34
29
  import { Browser } from "@wxt-dev/browser";
35
30
  import * as vite from "vite";
36
31
 
37
32
  //#region src/types.d.ts
38
33
  interface InlineConfig {
39
34
  /**
40
- * Your project's root directory containing the `package.json` used to fill out the
41
- * `manifest.json`.
35
+ * Your project's root directory containing the `package.json` used to fill
36
+ * out the `manifest.json`.
42
37
  *
43
38
  * @default process.cwd()
44
39
  */
45
40
  root?: string;
46
41
  /**
47
- * Directory containing all source code. Set to `"src"` to move all source code to a `src/`
48
- * directory.
42
+ * Directory containing all source code. Set to `"src"` to move all source
43
+ * code to a `src/` directory.
49
44
  *
50
- * After changing, remember to move the `public/` and `entrypoints/` directories into the new
51
- * source dir.
45
+ * After changing, remember to move the `public/` and `entrypoints/`
46
+ * directories into the new source dir.
52
47
  *
53
48
  * @default config.root
54
49
  */
55
50
  srcDir?: string;
56
51
  /**
57
- * Directory containing files that will be copied to the output directory as-is.
52
+ * Directory containing files that will be copied to the output directory
53
+ * as-is.
58
54
  *
59
- * @default "${config.root}/public"
55
+ * @default '${config.root}/public'
60
56
  */
61
57
  publicDir?: string;
62
- /**
63
- * @default "${config.srcDir}/entrypoints"
64
- */
58
+ /** @default '${config.srcDir}/entrypoints' */
65
59
  entrypointsDir?: string;
66
- /**
67
- * @default "${config.root}/modules"
68
- */
60
+ /** @default '${config.root}/modules' */
69
61
  modulesDir?: string;
70
62
  /**
71
- * A list of entrypoint names (`"popup"`, `"options"`, etc.) to build. Will speed up the build if
72
- * your extension has lots of entrypoints, and you don't need to build all of them to develop a
73
- * feature.
74
- * If specified, this completely overrides the `include`/`exclude` option provided per-entrypoint.
63
+ * A list of entrypoint names (`"popup"`, `"options"`, etc.) to build. Will
64
+ * speed up the build if your extension has lots of entrypoints, and you don't
65
+ * need to build all of them to develop a feature. If specified, this
66
+ * completely overrides the `include`/`exclude` option provided
67
+ * per-entrypoint.
75
68
  */
76
69
  filterEntrypoints?: string[];
77
70
  /**
78
71
  * Output directory that stored build folders and ZIPs.
79
72
  *
80
- * @default ".output"
73
+ * @default '.output'
81
74
  */
82
75
  outDir?: string;
83
76
  /**
84
- * Template string for customizing the output directory structure.
85
- * Available variables:
86
- * - <span v-pre>`{{browser}}`</span>: The target browser (e.g., 'chrome', 'firefox')
87
- * - <span v-pre>`{{manifestVersion}}`</span>: The manifest version (e.g., 2 or 3)
88
- * - <span v-pre>`{{mode}}`</span>: The build mode (e.g., 'development', 'production')
89
- * - <span v-pre>`{{modeSuffix}}`</span>: A suffix based on the mode ('-dev' for development, '' for production)
90
- * - <span v-pre>`{{command}}`</span>: The WXT command being run (e.g., 'build', 'serve')
77
+ * Template string for customizing the output directory structure. Available
78
+ * variables:
79
+ *
80
+ * - <span v-pre>`{{browser}}`</span>: The target browser (e.g., 'chrome',
81
+ * 'firefox')
82
+ * - <span v-pre>`{{manifestVersion}}`</span>: The manifest version (e.g., 2 or
83
+ * 3)
84
+ * - <span v-pre>`{{mode}}`</span>: The build mode (e.g., 'development',
85
+ * 'production')
86
+ * - <span v-pre>`{{modeSuffix}}`</span>: A suffix based on the mode ('-dev' for
87
+ * development, '' for production)
88
+ * - <span v-pre>`{{command}}`</span>: The WXT command being run (e.g., 'build',
89
+ * 'serve')
90
+ *
91
+ * @example
92
+ * '{{browser}}-mv{{manifestVersion}}';
91
93
  *
92
- * @example "{{browser}}-mv{{manifestVersion}}"
93
94
  * @default <span v-pre>`"{{browser}}-mv{{manifestVersion}}{{modeSuffix}}"`</span>
94
95
  */
95
96
  outDirTemplate?: string;
96
97
  /**
97
- * > Only available when using the JS API. Not available in `wxt.config.ts` files
98
+ * > Only available when using the JS API. Not available in `wxt.config.ts`
99
+ * > files
98
100
  *
99
101
  * Path to `wxt.config.ts` file or `false` to disable config file discovery.
100
102
  *
101
- * @default "wxt.config.ts"
103
+ * @default 'wxt.config.ts'
102
104
  */
103
105
  configFile?: string | false;
104
106
  /**
105
- * Set to `true` to show debug logs. Overridden by the command line `--debug` option.
107
+ * Set to `true` to show debug logs. Overridden by the command line `--debug`
108
+ * option.
106
109
  *
107
110
  * @default false
108
111
  */
109
112
  debug?: boolean;
110
113
  /**
111
- * Explicitly set a mode to run in. This will override the default mode for each command, and can
112
- * be overridden by the command line `--mode` option.
114
+ * Explicitly set a mode to run in. This will override the default mode for
115
+ * each command, and can be overridden by the command line `--mode` option.
113
116
  */
114
117
  mode?: string;
115
118
  /**
@@ -120,31 +123,49 @@ interface InlineConfig {
120
123
  * ```ts
121
124
  * export default defineConfig({
122
125
  * imports: {
123
- * dirs: ["some-directory"]
124
- * }
125
- * })
126
+ * dirs: ['some-directory'],
127
+ * },
128
+ * });
126
129
  * ```
127
130
  */
128
131
  imports?: WxtUnimportOptions | false;
129
132
  /**
130
- * Explicitly set a browser to build for. This will override the default browser for each command,
131
- * and can be overridden by the command line `--browser` option.
133
+ * Explicitly set a browser to build for. This will override the default
134
+ * browser for each command, and can be overridden by the command line
135
+ * `--browser` option.
132
136
  *
133
137
  * @default
134
138
  * "chrome"
135
139
  */
136
140
  browser?: TargetBrowser;
137
141
  /**
138
- * Target browsers to support. When set, `import.meta.env.BROWSER` will be narrowed to a string literal type containing only the specified browser names.
142
+ * Target browsers to support. When set, `import.meta.env.BROWSER` will be
143
+ * narrowed to a string literal type containing only the specified browser
144
+ * names.
139
145
  *
140
- * @default []
146
+ * @default [ ]
141
147
  */
142
148
  targetBrowsers?: TargetBrowser[];
143
149
  /**
144
- * Explicitly set a manifest version to target. This will override the default manifest version
145
- * for each command, and can be overridden by the command line `--mv2` or `--mv3` option.
150
+ * Explicitly set a manifest version to target. This will override the default
151
+ * manifest version for each command, and can be overridden by the command
152
+ * line `--mv2` or `--mv3` option.
146
153
  */
147
154
  manifestVersion?: TargetManifestVersion;
155
+ /**
156
+ * Chokidar options used by dev-mode file watchers. This is useful in
157
+ * containers, WSL, and network file systems where native file events can be
158
+ * unreliable.
159
+ *
160
+ * @example
161
+ * export default defineConfig({
162
+ * watchOptions: {
163
+ * usePolling: true,
164
+ * interval: 1000,
165
+ * },
166
+ * });
167
+ */
168
+ watchOptions?: vite.WatchOptions;
148
169
  /**
149
170
  * Override the logger used.
150
171
  *
@@ -153,32 +174,59 @@ interface InlineConfig {
153
174
  */
154
175
  logger?: Logger;
155
176
  /**
156
- * Customize the `manifest.json` output. Can be an object, promise, or function that returns an
157
- * object or promise.
177
+ * Customize the `manifest.json` output. Can be an object, promise, or
178
+ * function that returns an object or promise.
158
179
  */
159
180
  manifest?: UserManifest | Promise<UserManifest> | UserManifestFn;
160
181
  /**
161
- * Configure browser startup. Options set here can be overridden in a `web-ext.config.ts` file.
182
+ * Suppress specific warnings during the build process.
183
+ *
184
+ * @example
185
+ * export default defineConfig({
186
+ * suppressWarnings: {
187
+ * firefoxDataCollection: true,
188
+ * },
189
+ * });
162
190
  */
163
- webExt?: WebExtConfig;
191
+ suppressWarnings?: {
192
+ /**
193
+ * Suppress warnings for:
194
+ * https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent
195
+ */
196
+ firefoxDataCollection?: boolean;
197
+ /**
198
+ * Suppress warnings when the Firefox extension ID is missing.
199
+ * https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings#id
200
+ */
201
+ firefoxId?: boolean;
202
+ };
164
203
  /**
165
- * @deprecated Use `webExt` instead. Same option, just renamed.
204
+ * Configure browser startup. Options set here can be overridden in a
205
+ * `web-ext.config.ts` file.
166
206
  */
167
- runner?: WebExtConfig;
207
+ webExt?: WebExtConfig;
168
208
  zip?: {
169
209
  /**
170
210
  * Configure the filename output when zipping files.
171
211
  *
172
212
  * Available template variables:
173
213
  *
174
- * - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
175
- * - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
176
- * - <span v-pre>`{{packageVersion}}`</span> - The version from the package.json
177
- * - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
214
+ * - <span v-pre>`{{name}}`</span> - The project's name converted to
215
+ * kebab-case
216
+ * - <span v-pre>`{{version}}`</span> - The version from the manifest
217
+ * - <span v-pre>`{{versionName}}`</span> - The `version_name` from the
218
+ * manifest or, if not set (i.e. if built for Firefox), the `version` from
219
+ * the manifest
220
+ * - <span v-pre>`{{packageVersion}}`</span> - The version from the
221
+ * package.json
222
+ * - <span v-pre>`{{browser}}`</span> - The target browser from the
223
+ * `--browser` CLI flag
178
224
  * - <span v-pre>`{{mode}}`</span> - The current mode
225
+ * - <span v-pre>`{{modeSuffix}}`</span>: A suffix based on the mode ('-dev'
226
+ * for development, '' for production)
179
227
  * - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
180
228
  *
181
- * @default "{{name}}-{{version}}-{{browser}}.zip"
229
+ * @default '{{name}}-{{packageVersion}}-{{browser}}{{modeSuffix}}.zip'
182
230
  */
183
231
  artifactTemplate?: string;
184
232
  /**
@@ -196,19 +244,28 @@ interface InlineConfig {
196
244
  *
197
245
  * Available template variables:
198
246
  *
199
- * - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
200
- * - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
201
- * - <span v-pre>`{{packageVersion}}`</span> - The version from the package.json
202
- * - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
247
+ * - <span v-pre>`{{name}}`</span> - The project's name converted to
248
+ * kebab-case
249
+ * - <span v-pre>`{{version}}`</span> - The version from the manifest
250
+ * - <span v-pre>`{{versionName}}`</span> - The `version_name` from the
251
+ * manifest or, if not set (i.e. if built for Firefox), the `version` from
252
+ * the manifest
253
+ * - <span v-pre>`{{packageVersion}}`</span> - The version from the
254
+ * package.json
255
+ * - <span v-pre>`{{browser}}`</span> - The target browser from the
256
+ * `--browser` CLI flag
203
257
  * - <span v-pre>`{{mode}}`</span> - The current mode
258
+ * - <span v-pre>`{{modeSuffix}}`</span>: A suffix based on the mode ('-dev'
259
+ * for development, '' for production)
204
260
  * - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
205
261
  *
206
- * @default "{{name}}-{{version}}-sources.zip"
262
+ * @default '{{name}}-{{packageVersion}}-sources{{modeSuffix}}.zip'
207
263
  */
208
264
  sourcesTemplate?: string;
209
265
  /**
210
- * Override the artifactTemplate's `{name}` template variable. Defaults to the `package.json`'s
211
- * name, or if that doesn't exist, the current working directories name.
266
+ * Override the artifactTemplate's `{name}` template variable. Defaults to
267
+ * the `package.json`'s name, or if that doesn't exist, the current working
268
+ * directories name.
212
269
  */
213
270
  name?: string;
214
271
  /**
@@ -218,64 +275,101 @@ interface InlineConfig {
218
275
  */
219
276
  sourcesRoot?: string;
220
277
  /**
221
- * [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to include when
222
- * creating a ZIP of all your source code for Firefox. Patterns are relative to your
223
- * `config.zip.sourcesRoot`.
278
+ * [Tinyglobby](https://npmjs.org/tinyglobby) patterns of files to include
279
+ * when creating a ZIP of all your source code for Firefox. Patterns are
280
+ * relative to your `config.zip.sourcesRoot`.
281
+ *
282
+ * Sources ZIP files are created using standard allowlist/blocklist
283
+ * behavior:
284
+ *
285
+ * - You specify a pattern to "include" (via `includeSources`), then a pattern
286
+ * to "exclude" from the included files (via `excludeSources`).
224
287
  *
225
- * This setting overrides `excludeSources`. So if a file matches both lists, it is included in the ZIP.
288
+ * By default, this option includes all files except for hidden files and
289
+ * directories (files/directories starting with a `.`).
290
+ *
291
+ * If you want to include hidden files/directories in your sources ZIP, see
292
+ * `InlineConfig.zip.dotSources`.
226
293
  *
227
294
  * @example
228
- * [
229
- * "coverage", // Include the coverage directory in the `sourcesRoot`
230
- * ]
295
+ * ['entrypoints/**', 'wxt.config.ts', 'package.json', 'tsconfig.json'];
231
296
  */
232
297
  includeSources?: string[];
233
298
  /**
234
- * [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to exclude when
235
- * creating a ZIP of all your source code for Firefox. Patterns are relative to your
236
- * `config.zip.sourcesRoot`.
299
+ * [Tinyglobby](https://npmjs.org/tinyglobby) patterns of files to exclude
300
+ * when creating a ZIP of all your source code for Firefox. Patterns are
301
+ * relative to your `config.zip.sourcesRoot`.
302
+ *
303
+ * By default, WXT excludes some files:
237
304
  *
238
- * Hidden files, node_modules, and tests are ignored by default.
305
+ * - `node_modules`
306
+ * - Tests files and directories
307
+ * - Output directory
308
+ *
309
+ * Any values specified in this option will be merged with the ones above -
310
+ * you cannot replace the default values, only add to them.
239
311
  *
240
312
  * @example
241
- * [
242
- * "coverage", // Ignore the coverage directory in the `sourcesRoot`
243
- * ]
313
+ * [
314
+ * 'coverage', // Ignore the coverage directory in the `sourcesRoot`
315
+ * ];
244
316
  */
245
317
  excludeSources?: string[];
246
318
  /**
247
- * [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to exclude when
248
- * zipping the extension.
319
+ * Include hidden files/directories in your sources ZIP.
320
+ *
321
+ * [Tinyglobby](https://npmjs.org/tinyglobby) does not match against files
322
+ * and directory that start with a `.` by default. For example, if you need
323
+ * to include a `.env` file, you need to set this to `true`, then exclude
324
+ * other hidden files/directories in `excludeSources`.
325
+ *
326
+ * **Be very careful when this is enabled - WXT may include files with
327
+ * secrets in your ZIP you did not intend to share with Mozilla or upload to
328
+ * other places**. Make sure all hidden files you don't want to include are
329
+ * added to `excludeSources`.
330
+ *
331
+ * @default false
332
+ */
333
+ dotSources?: boolean;
334
+ /**
335
+ * [Tinyglobby](https://npmjs.org/tinyglobby) patterns of files to exclude
336
+ * when zipping the extension.
249
337
  *
250
338
  * @example
251
- * [
252
- * "**\/*.map", // Exclude all sourcemaps
253
- * ]
339
+ * [
340
+ * '**\/*.map', // Exclude all sourcemaps
341
+ * ];
342
+ *
343
+ * @default [ ]
254
344
  */
255
345
  exclude?: string[];
256
346
  /**
257
- * The Firefox review process requires the extension be buildable from source to make reviewing
258
- * easier. This field allows you to use private packages without exposing your auth tokens.
259
- *
260
- * Just list the name of all the packages you want to download and include in the sources zip.
261
- * Usually, these will be private packages behind auth tokens, but they don't have to be.
347
+ * The Firefox review process requires the extension be buildable from
348
+ * source to make reviewing easier. This field allows you to use private
349
+ * packages without exposing your auth tokens.
262
350
  *
263
- * All packages listed here will be downloaded to in `.wxt/local_modules/` and an `overrides` or
264
- * `resolutions` field (depending on your package manager) will be added to the `package.json`,
265
- * pointing to the downloaded packages.
351
+ * Just list the name of all the packages you want to download and include
352
+ * in the sources zip. Usually, these will be private packages behind auth
353
+ * tokens, but they don't have to be.
266
354
  *
267
- * > ***DO NOT include versions or version filters.*** Just the package name. If multiple
268
- * > versions of a package are present in the project, all versions will be downloaded and
269
- * > referenced in the package.json correctly.
355
+ * All packages listed here will be downloaded to in `.wxt/local_modules/`
356
+ * and an `overrides` or `resolutions` field (depending on your package
357
+ * manager) will be added to the `package.json`, pointing to the downloaded
358
+ * packages.
270
359
  *
271
- * @default []
360
+ * > _**DO NOT include versions or version filters.**_ Just the package name.
361
+ * > If multiple versions of a package are present in the project, all
362
+ * > versions will be downloaded and referenced in the package.json
363
+ * > correctly.
272
364
  *
273
365
  * @example
274
- * // Correct:
275
- * ["@scope/package-name", "package-name"]
366
+ * // Correct:
367
+ * ['@scope/package-name', 'package-name'];
276
368
  *
277
- * // Incorrect, don't include versions!!!
278
- * ["@scope/package-name@1.1.3", "package-name@^2"]
369
+ * // Incorrect, don't include versions!!!
370
+ * ['@scope/package-name@1.1.3', 'package-name@^2'];
371
+ *
372
+ * @default [ ]
279
373
  */
280
374
  downloadPackages?: string[];
281
375
  /**
@@ -289,42 +383,44 @@ interface InlineConfig {
289
383
  };
290
384
  analysis?: {
291
385
  /**
292
- * Explicitly include bundle analysis when running `wxt build`. This can be overridden by the
293
- * command line `--analyze` option.
386
+ * Explicitly include bundle analysis when running `wxt build`. This can be
387
+ * overridden by the command line `--analyze` option.
294
388
  *
295
389
  * @default false
296
390
  */
297
391
  enabled?: boolean;
298
392
  /**
299
- * Set to true to automatically open the `stats.html` file when the build is finished. When building in CI, the browser will never open.
393
+ * Set to true to automatically open the `stats.html` file when the build is
394
+ * finished. When building in CI, the browser will never open.
300
395
  *
301
396
  * @default false
302
397
  */
303
398
  open?: boolean;
304
399
  /**
305
- * When running `wxt build --analyze` or setting `analysis.enabled` to true, customize how the
306
- * bundle will be visualized. See
400
+ * When running `wxt build --analyze` or setting `analysis.enabled` to true,
401
+ * customize how the bundle will be visualized. See
307
402
  * [`rollup-plugin-visualizer`](https://github.com/btd/rollup-plugin-visualizer#how-to-use-generated-files)
308
403
  * for more details.
309
404
  *
310
- * @default "treemap"
405
+ * @default 'treemap'
311
406
  */
312
407
  template?: PluginVisualizerOptions['template'];
313
408
  /**
314
409
  * Name of the output HTML file. Relative to the project's root directory.
315
410
  *
316
- * Changing the filename of the outputFile also effects the names of the artifacts generated
317
- * when setting `keepArtifacts` to true:
411
+ * Changing the filename of the outputFile also effects the names of the
412
+ * artifacts generated when setting `keepArtifacts` to true:
413
+ *
318
414
  * - "stats.html" => "stats-*.json"
319
415
  * - "stats/bundle.html" => "bundle-*.json"
320
416
  * - ".analysis/index.html" => "index-*.json"
321
417
  *
322
- * @default "stats.html"
418
+ * @default 'stats.html'
323
419
  */
324
420
  outputFile?: string;
325
421
  /**
326
- * By default, the `stats-*.json` artifacts generated during bundle analysis are deleted. Set to
327
- * `true` to keep them.
422
+ * By default, the `stats-*.json` artifacts generated during bundle analysis
423
+ * are deleted. Set to `true` to keep them.
328
424
  *
329
425
  * One stats file is output per build step.
330
426
  *
@@ -333,66 +429,65 @@ interface InlineConfig {
333
429
  keepArtifacts?: boolean;
334
430
  };
335
431
  /**
336
- * Add additional paths to the `.wxt/tsconfig.json`. Use this instead of overwriting the `paths`
337
- * in the root `tsconfig.json` if you want to add new paths.
432
+ * Add additional paths to the `.wxt/tsconfig.json`. Use this instead of
433
+ * overwriting the `paths` in the root `tsconfig.json` if you want to add new
434
+ * paths.
338
435
  *
339
- * The key is the import alias and the value is either a relative path to the root directory or an absolute path.
436
+ * The key is the import alias and the value is either a relative path to the
437
+ * root directory or an absolute path.
340
438
  *
341
439
  * @example
342
- * {
343
- * "testing": "src/utils/testing.ts"
344
- * }
440
+ * { "testing": "src/utils/testing.ts" }
345
441
  */
346
442
  alias?: Record<string, string>;
347
- /**
348
- * Experimental settings - use with caution.
349
- */
443
+ /** Experimental settings - use with caution. */
350
444
  experimental?: {};
351
- /**
352
- * Config effecting dev mode only.
353
- */
445
+ /** Config effecting dev mode only. */
354
446
  dev?: {
355
447
  server?: {
356
448
  /**
357
449
  * Host to bind the dev server to.
358
450
  *
359
- * @default "localhost"
451
+ * @default 'localhost'
360
452
  */
361
453
  host?: string;
362
454
  /**
363
- * Port to run the dev server on. Defaults to the first open port from 3000 to 3010.
455
+ * Port to run the dev server on. Defaults to the first open port from
456
+ * 3000 to 3010.
364
457
  */
365
458
  port?: number;
366
459
  /**
367
- * Origin to use to connect from the extension ui runtime to the dev server.
460
+ * Origin to use to connect from the extension ui runtime to the dev
461
+ * server.
368
462
  *
369
- * @default "http://localhost:3000"
463
+ * @default 'http://localhost:3000'
370
464
  */
371
465
  origin?: string;
372
466
  /**
373
- * Hostname to run the dev server on.
467
+ * Whether the dev server should fail if the specified port is already in
468
+ * use. When `false` and a `port` is specified, the next available port
469
+ * will be used instead of throwing an error.
374
470
  *
375
- * @deprecated use `host` to specify the interface to bind to, or use `origin` to specify the dev server hostname.
471
+ * @default false
376
472
  */
377
- hostname?: string;
473
+ strictPort?: boolean;
378
474
  };
379
475
  /**
380
- * Controls whether a custom keyboard shortcut command, `Alt+R`, is added during dev mode to
381
- * quickly reload the extension.
476
+ * Controls whether a custom keyboard shortcut command, `Alt+R`, is added
477
+ * during dev mode to quickly reload the extension.
382
478
  *
383
479
  * If false, the shortcut is not added during development.
384
480
  *
385
481
  * If set to a custom string, you can override the key combo used. See
386
- * [Chrome's command docs](https://developer.chrome.com/docs/extensions/reference/api/commands)
482
+ * [Chrome's command
483
+ * docs](https://developer.chrome.com/docs/extensions/reference/api/commands)
387
484
  * for available options.
388
485
  *
389
- * @default "Alt+R"
486
+ * @default 'Alt+R'
390
487
  */
391
488
  reloadCommand?: string | false;
392
489
  };
393
- /**
394
- * Project hooks for running logic during the build process.
395
- */
490
+ /** Project hooks for running logic during the build process. */
396
491
  hooks?: NestedHooks<WxtHooks>;
397
492
  /**
398
493
  * List of WXT module names to include. Can be the full package name
@@ -404,13 +499,14 @@ interface InlineConfig {
404
499
  interface InlineConfig {
405
500
  /**
406
501
  * Return custom Vite options from a function. See
407
- * <https://vitejs.dev/config/shared-options.html>.
502
+ * [https://vitejs.dev/config/shared-options.html](https://vitejs.dev/config/shared-options.html).
408
503
  *
409
- * [`root`](#root), [`configFile`](#configfile), and [`mode`](#mode) should be set in WXT's config
410
- * instead of Vite's.
504
+ * [`root`](#root), [`configFile`](#configfile), and [`mode`](#mode) should be
505
+ * set in WXT's config instead of Vite's.
411
506
  *
412
- * This is a function because any vite plugins added need to be recreated for each individual
413
- * build step, incase they have internal state causing them to fail when reused.
507
+ * This is a function because any vite plugins added need to be recreated for
508
+ * each individual build step, in case they have internal state causing them
509
+ * to fail when reused.
414
510
  */
415
511
  vite?: (env: ConfigEnv) => WxtViteConfig | Promise<WxtViteConfig>;
416
512
  }
@@ -423,15 +519,17 @@ interface WxtHooks {
423
519
  * Called when WXT has created Vite's config for a build step. Useful if you
424
520
  * want to add plugins or update the vite config per entrypoint group.
425
521
  *
426
- * @param entrypoints The list of entrypoints being built with the provided config.
522
+ * @param entrypoints The list of entrypoints being built with the provided
523
+ * config.
427
524
  * @param viteConfig The config that will be used for the dev server.
428
525
  */
429
526
  'vite:build:extendConfig': (entrypoints: readonly Entrypoint[], viteConfig: vite.InlineConfig) => HookResult;
430
527
  /**
431
- * Called when WXT has created Vite's config for the dev server. Useful if
432
- * you want to add plugins or update the vite config per entrypoint group.
528
+ * Called when WXT has created Vite's config for the dev server. Useful if you
529
+ * want to add plugins or update the vite config per entrypoint group.
433
530
  *
434
- * @param viteConfig The config that will be used to build the entrypoints. Can be updated by reference.
531
+ * @param viteConfig The config that will be used to build the entrypoints.
532
+ * Can be updated by reference.
435
533
  */
436
534
  'vite:devServer:extendConfig': (config: vite.InlineConfig) => HookResult;
437
535
  }
@@ -449,9 +547,7 @@ interface OutputChunk {
449
547
  * Ex: "content-scripts/overlay.js"
450
548
  */
451
549
  fileName: string;
452
- /**
453
- * Absolute, normalized paths to all dependencies this chunk relies on.
454
- */
550
+ /** Absolute, normalized paths to all dependencies this chunk relies on. */
455
551
  moduleIds: string[];
456
552
  }
457
553
  interface OutputAsset {
@@ -468,40 +564,32 @@ interface BuildStepOutput {
468
564
  chunks: OutputFile[];
469
565
  }
470
566
  interface WxtDevServer extends Omit<WxtBuilderServer, 'listen' | 'close'>, ServerInfo {
471
- /**
472
- * Stores the current build output of the server.
473
- */
567
+ /** Stores the current build output of the server. */
474
568
  currentOutput: BuildOutput | undefined;
475
- /**
476
- * Start the server.
477
- */
569
+ /** Start the server. */
478
570
  start(): Promise<void>;
479
- /**
480
- * Stop the server.
481
- */
571
+ /** Stop the server. */
482
572
  stop(): Promise<void>;
483
573
  /**
484
- * Close the browser, stop the server, rebuild the entire extension, and start the server again.
574
+ * Close the browser, stop the server, rebuild the entire extension, and start
575
+ * the server again.
485
576
  */
486
577
  restart(): Promise<void>;
487
- /**
488
- * Transform the HTML for dev mode.
489
- */
578
+ /** Transform the HTML for dev mode. */
490
579
  transformHtml(url: string, html: string, originalUrl?: string | undefined): Promise<string>;
491
- /**
492
- * Tell the extension to reload by running `browser.runtime.reload`.
493
- */
580
+ /** Tell the extension to reload by running `browser.runtime.reload`. */
494
581
  reloadExtension: () => void;
495
582
  /**
496
583
  * Tell an extension page to reload.
497
584
  *
498
585
  * The path is the bundle path, not the input paths, so if the input paths is
499
- * "src/options/index.html", you would pass "options.html" because that's where it is written to
500
- * in the dist directory, and where it's available at in the actual extension.
586
+ * "src/options/index.html", you would pass "options.html" because that's
587
+ * where it is written to in the dist directory, and where it's available at
588
+ * in the actual extension.
501
589
  *
502
590
  * @example
503
- * server.reloadPage("popup.html")
504
- * server.reloadPage("sandbox.html")
591
+ * server.reloadPage('popup.html');
592
+ * server.reloadPage('sandbox.html');
505
593
  */
506
594
  reloadPage: (path: string) => void;
507
595
  /**
@@ -510,9 +598,7 @@ interface WxtDevServer extends Omit<WxtBuilderServer, 'listen' | 'close'>, Serve
510
598
  * @param payload Information about the content script to reload.
511
599
  */
512
600
  reloadContentScript: (payload: ReloadContentScriptPayload) => void;
513
- /**
514
- * Grab the latest runner config and restart the browser.
515
- */
601
+ /** Grab the latest runner config and restart the browser. */
516
602
  restartBrowser: () => void;
517
603
  }
518
604
  interface ReloadContentScriptPayload {
@@ -534,15 +620,16 @@ interface Logger {
534
620
  }
535
621
  interface BaseEntrypointOptions {
536
622
  /**
537
- * List of target browsers to include this entrypoint in. Defaults to being included in all
538
- * builds. Cannot be used with `exclude`. You must choose one of the two options.
623
+ * List of target browsers to include this entrypoint in. Defaults to being
624
+ * included in all builds. Cannot be used with `exclude`. You must choose one
625
+ * of the two options.
539
626
  *
540
627
  * @default undefined
541
628
  */
542
629
  include?: TargetBrowser[];
543
630
  /**
544
- * List of target browsers to exclude this entrypoint from. Cannot be used with `include`. You
545
- * must choose one of the two options.
631
+ * List of target browsers to exclude this entrypoint from. Cannot be used
632
+ * with `include`. You must choose one of the two options.
546
633
  *
547
634
  * @default undefined
548
635
  */
@@ -551,10 +638,11 @@ interface BaseEntrypointOptions {
551
638
  interface BackgroundEntrypointOptions extends BaseEntrypointOptions {
552
639
  persistent?: PerBrowserOption<boolean>;
553
640
  /**
554
- * Set to `"module"` to output the background entrypoint as ESM. ESM outputs can share chunks and
555
- * reduce the overall size of the bundled extension.
641
+ * Set to `"module"` to output the background entrypoint as ESM. ESM outputs
642
+ * can share chunks and reduce the overall size of the bundled extension.
556
643
  *
557
- * When `undefined`, the background is bundled individually into an IIFE format.
644
+ * When `undefined`, the background is bundled individually into an IIFE
645
+ * format.
558
646
  *
559
647
  * @default undefined
560
648
  */
@@ -564,19 +652,24 @@ interface BaseScriptEntrypointOptions extends BaseEntrypointOptions {
564
652
  /**
565
653
  * The variable name for the IIFE in the output bundle.
566
654
  *
567
- * This option is relevant for scripts inserted into the page context where the default IIFE
568
- * variable name may conflict with an existing variable on the target page. This applies to content
569
- * scripts with world=MAIN, and others, such as unlisted scripts, that could be dynamically injected
570
- * into the page with a <script> tag.
655
+ * This option is relevant for scripts inserted into the page context where
656
+ * the default IIFE variable name may conflict with an existing variable on
657
+ * the target page. This applies to content scripts with world=MAIN, and
658
+ * others, such as unlisted scripts, that could be dynamically injected into
659
+ * the page with a <script> tag.
571
660
  *
572
661
  * Available options:
573
- * - `true`: automatically generate a name for the IIFE based on the entrypoint name
574
- * - `false`: Output the IIFE without a variable name, making it anonymous. This is the safest option
575
- * to avoid conflicts with existing variables on the page. This will become the default in a future version of WXT.
662
+ *
663
+ * - `true`: automatically generate a name for the IIFE based on the entrypoint
664
+ * name
665
+ * - `false`: Output the IIFE without a variable name, making it anonymous. This
666
+ * is the safest option to avoid conflicts with existing variables on the
667
+ * page.
576
668
  * - `string`: Use the provided string as the global variable name.
577
- * - `function`: A function that receives the entrypoint and returns a string to use as the variable name.
669
+ * - `function`: A function that receives the entrypoint and returns a string to
670
+ * use as the variable name.
578
671
  *
579
- * @default true
672
+ * @default false
580
673
  */
581
674
  globalName?: string | boolean | ((entrypoint: Entrypoint) => string);
582
675
  }
@@ -584,81 +677,112 @@ interface BaseContentScriptEntrypointOptions extends BaseScriptEntrypointOptions
584
677
  matches?: PerBrowserOption<NonNullable<ManifestContentScript['matches']>>;
585
678
  /**
586
679
  * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
587
- * @default "documentIdle"
680
+ *
681
+ * @default 'documentIdle'
588
682
  */
589
683
  runAt?: PerBrowserOption<Browser.scripting.RegisteredContentScript['runAt']>;
590
684
  /**
591
685
  * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
686
+ *
592
687
  * @default false
593
688
  */
594
689
  matchAboutBlank?: PerBrowserOption<ManifestContentScript['match_about_blank']>;
595
690
  /**
596
691
  * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
597
- * @default []
692
+ *
693
+ * @default [ ]
598
694
  */
599
695
  excludeMatches?: PerBrowserOption<ManifestContentScript['exclude_matches']>;
600
696
  /**
601
697
  * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
602
- * @default []
698
+ *
699
+ * @default [ ]
603
700
  */
604
701
  includeGlobs?: PerBrowserOption<ManifestContentScript['include_globs']>;
605
702
  /**
606
703
  * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
607
- * @default []
704
+ *
705
+ * @default [ ]
608
706
  */
609
707
  excludeGlobs?: PerBrowserOption<ManifestContentScript['exclude_globs']>;
610
708
  /**
611
709
  * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
710
+ *
612
711
  * @default false
613
712
  */
614
713
  allFrames?: PerBrowserOption<ManifestContentScript['all_frames']>;
615
714
  /**
616
715
  * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
716
+ *
617
717
  * @default false
618
718
  */
619
719
  matchOriginAsFallback?: PerBrowserOption<boolean>;
620
720
  /**
621
- * Customize how imported/generated styles are injected with the content script. Regardless of the
622
- * mode selected, CSS will always be built and included in the output directory.
721
+ * Customize how imported/generated styles are injected with the content
722
+ * script. Regardless of the mode selected, CSS will always be built and
723
+ * included in the output directory.
623
724
  *
624
- * - `"manifest"` - Include the CSS in the manifest, under the content script's `css` array.
625
- * - `"manual"` - Exclude the CSS from the manifest. You are responsible for manually loading it
626
- * onto the page. Use `browser.runtime.getURL("content-scripts/<name>.css")` to get the file's
725
+ * - `"manifest"` - Include the CSS in the manifest, under the content script's
726
+ * `css` array.
727
+ * - `"manual"` - Exclude the CSS from the manifest. You are responsible for
728
+ * manually loading it onto the page. Use
729
+ * `browser.runtime.getURL("content-scripts/<name>.css")` to get the file's
627
730
  * URL
628
- * - `"ui"` - Exclude the CSS from the manifest. CSS will be automatically added to your UI when
629
- * calling `createShadowRootUi`
731
+ * - `"ui"` - Exclude the CSS from the manifest. CSS will be automatically added
732
+ * to your UI when calling `createShadowRootUi`
630
733
  *
631
- * @default "manifest"
734
+ * @default 'manifest'
632
735
  */
633
736
  cssInjectionMode?: PerBrowserOption<'manifest' | 'manual' | 'ui'>;
634
737
  /**
635
738
  * Specify how the content script is registered.
636
739
  *
637
- * - `"manifest"`: The content script will be added to the `content_scripts` entry in the
638
- * manifest. This is the normal and most well known way of registering a content script.
639
- * - `"runtime"`: The content script's `matches` is added to `host_permissions` and you are
640
- * responsible for using the scripting API to register/execute the content script
641
- * dynamically at runtime.
740
+ * - `"manifest"`: The content script will be added to the `content_scripts`
741
+ * entry in the manifest. This is the normal and most well known way of
742
+ * registering a content script.
743
+ * - `"runtime"`: The content script's `matches` is added to `host_permissions`
744
+ * and you are responsible for using the scripting API to register/execute
745
+ * the content script dynamically at runtime.
642
746
  *
643
- * @default "manifest"
747
+ * @default 'manifest'
644
748
  */
645
749
  registration?: PerBrowserOption<'manifest' | 'runtime'>;
750
+ /**
751
+ * Do not send the `wxt:content-script-started` message via
752
+ * `window.postMessage`.
753
+ *
754
+ * This has been replaced with custom events. The `postMessage` call is kept
755
+ * for backwards compatibility. For some websites the `postMessage` call is
756
+ * undesirable, such as those with poorly written message event listeners.
757
+ *
758
+ * Setting this to `true` opts into the behavior that will become the default
759
+ * in a future version of WXT, where the `postMessage` call is removed
760
+ * entirely.
761
+ *
762
+ * See https://github.com/wxt-dev/wxt/pull/1938 and
763
+ * https://github.com/wxt-dev/wxt/pull/2035 for a detailed discussion.
764
+ */
765
+ noScriptStartedPostMessage?: boolean;
646
766
  }
647
767
  interface MainWorldContentScriptEntrypointOptions extends BaseContentScriptEntrypointOptions {
648
768
  /**
649
- * See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
769
+ * See
770
+ * https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
650
771
  */
651
772
  world: 'MAIN';
652
773
  }
653
774
  interface IsolatedWorldContentScriptEntrypointOptions extends BaseContentScriptEntrypointOptions {
654
775
  /**
655
- * See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
656
- * @default "ISOLATED"
776
+ * See
777
+ * https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
778
+ *
779
+ * @default 'ISOLATED'
657
780
  */
658
781
  world?: 'ISOLATED';
659
782
  }
660
783
  /**
661
784
  * Firefox theme icon definition for light/dark mode support.
785
+ *
662
786
  * @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action#theme_icons
663
787
  */
664
788
  interface ThemeIcon {
@@ -671,19 +795,34 @@ interface ThemeIcon {
671
795
  }
672
796
  interface PopupEntrypointOptions extends BaseEntrypointOptions {
673
797
  /**
674
- * Defaults to "browser_action" to be equivalent to MV3's "action" key
798
+ * The type of action to use in the manifest.
799
+ *
800
+ * In MV2, defaults to `"browser_action"`. In MV3, `"browser_action"` is
801
+ * converted to `"action"`, while `"page_action"` is kept as-is (Firefox MV3
802
+ * only).
675
803
  */
804
+ actionType?: PerBrowserOption<'browser_action' | 'page_action'>;
805
+ /** @deprecated Use `actionType` instead. */
676
806
  mv2Key?: PerBrowserOption<'browser_action' | 'page_action'>;
677
807
  defaultIcon?: Record<string, string>;
678
808
  defaultTitle?: PerBrowserOption<string>;
809
+ /**
810
+ * Chrome only. Controls the initial enabled/disabled state of the action.
811
+ *
812
+ * @see https://developer.chrome.com/docs/extensions/reference/api/action#enabled_state
813
+ */
814
+ defaultState?: PerBrowserOption<'enabled' | 'disabled'>;
679
815
  browserStyle?: PerBrowserOption<boolean>;
680
816
  /**
681
- * Firefox only. Defines the part of the browser in which the button is initially placed.
817
+ * Firefox only. Defines the part of the browser in which the button is
818
+ * initially placed.
819
+ *
682
820
  * @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/action#default_area
683
821
  */
684
822
  defaultArea?: PerBrowserOption<'navbar' | 'menupanel' | 'tabstrip' | 'personaltoolbar'>;
685
823
  /**
686
824
  * Firefox only. Icons for light and dark themes.
825
+ *
687
826
  * @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/action#theme_icons
688
827
  */
689
828
  themeIcons?: ThemeIcon[];
@@ -696,12 +835,15 @@ interface OptionsEntrypointOptions extends BaseEntrypointOptions {
696
835
  }
697
836
  interface SidepanelEntrypointOptions extends BaseEntrypointOptions {
698
837
  /**
699
- * Firefox only. See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/sidebar_action#syntax
838
+ * Firefox only. See
839
+ * https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/sidebar_action#syntax
840
+ *
700
841
  * @default false
701
842
  */
702
843
  openAtInstall?: PerBrowserOption<boolean>;
703
844
  /**
704
- * @deprecated See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/sidebar_action#syntax
845
+ * @deprecated See
846
+ * https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/sidebar_action#syntax
705
847
  */
706
848
  browserStyle?: PerBrowserOption<boolean>;
707
849
  defaultIcon?: string | Record<string, string>;
@@ -709,29 +851,29 @@ interface SidepanelEntrypointOptions extends BaseEntrypointOptions {
709
851
  }
710
852
  interface BaseEntrypoint {
711
853
  /**
712
- * The entrypoint's name. This is the filename or dirname without the type suffix.
854
+ * The entrypoint's name. This is the filename or dirname without the type
855
+ * suffix.
713
856
  *
714
857
  * Examples:
715
- * - `popup.html` &rarr; `popup`
716
- * - `options/index.html` &rarr; `options`
717
- * - `named.sandbox.html` &rarr; `named`
718
- * - `named.sandbox/index.html` &rarr; `named`
719
- * - `sandbox.html` &rarr; `sandbox`
720
- * - `sandbox/index.html` &rarr; `sandbox`
721
- * - `overlay.content.ts` &rarr; `overlay`
722
- * - `overlay.content/index.ts` &rarr; `overlay`
858
+ *
859
+ * - `popup.html` `popup`
860
+ * - `options/index.html` `options`
861
+ * - `named.sandbox.html` `named`
862
+ * - `named.sandbox/index.html` `named`
863
+ * - `sandbox.html` `sandbox`
864
+ * - `sandbox/index.html` `sandbox`
865
+ * - `overlay.content.ts` `overlay`
866
+ * - `overlay.content/index.ts` → `overlay`
723
867
  *
724
868
  * The name is used when generating an output file:
725
869
  * `<entrypoint.outputDir>/<entrypoint.name>.<ext>`
726
870
  */
727
871
  name: string;
728
- /**
729
- * Absolute path to the entrypoint's input file.
730
- */
872
+ /** Absolute path to the entrypoint's input file. */
731
873
  inputPath: string;
732
874
  /**
733
- * Absolute path to the entrypoint's output directory. Can be `wxt.config.outDir` or a
734
- * subdirectory of it.
875
+ * Absolute path to the entrypoint's output directory. Can be
876
+ * `wxt.config.outDir` or a subdirectory of it.
735
877
  */
736
878
  outputDir: string;
737
879
  /**
@@ -739,7 +881,8 @@ interface BaseEntrypoint {
739
881
  * based on the `filterEntrypoints` config or the entrypoint's
740
882
  * `include`/`exclude` options defined inside the file.
741
883
  *
742
- * See https://wxt.dev/guide/essentials/target-different-browsers.html#filtering-entrypoints
884
+ * See
885
+ * https://wxt.dev/guide/essentials/target-different-browsers.html#filtering-entrypoints
743
886
  */
744
887
  skipped?: boolean;
745
888
  }
@@ -803,7 +946,8 @@ interface MainWorldContentScriptDefinition extends MainWorldContentScriptEntrypo
803
946
  type ContentScriptDefinition = IsolatedWorldContentScriptDefinition | MainWorldContentScriptDefinition;
804
947
  interface BackgroundDefinition extends BackgroundEntrypointOptions {
805
948
  /**
806
- * Main function executed when the background script is started. Cannot be async.
949
+ * Main function executed when the background script is started. Cannot be
950
+ * async.
807
951
  */
808
952
  main(): void;
809
953
  }
@@ -818,29 +962,57 @@ interface UnlistedScriptDefinition extends BaseScriptEntrypointOptions {
818
962
  main(): any | Promise<any>;
819
963
  }
820
964
  /**
821
- * Either a single value or a map of different browsers to the value for that browser.
965
+ * Either a single value or a map of different browsers to the value for that
966
+ * browser.
822
967
  */
823
968
  type PerBrowserOption<T> = T | PerBrowserMap<T>;
824
969
  type PerBrowserMap<T> = {
825
970
  [browser: TargetBrowser]: T;
826
971
  };
827
972
  /**
828
- * Convert `{ key: PerBrowserOption<T> }` to just `{ key: T }`, stripping away the
829
- * `PerBrowserOption` type for all fields inside the object.
973
+ * Convert `{ key: PerBrowserOption<T> }` to just `{ key: T }`, stripping away
974
+ * the `PerBrowserOption` type for all fields inside the object.
830
975
  *
831
- * A optional second list of keys can be passed if a field isn't compatible with `PerBrowserOption`, like `defaultIcon`.
976
+ * A optional second list of keys can be passed if a field isn't compatible with
977
+ * `PerBrowserOption`, like `defaultIcon`.
832
978
  */
833
979
  type ResolvedPerBrowserOptions<T, TOmitted extends keyof T = never> = { [key in keyof Omit<T, TOmitted>]: T[key] extends PerBrowserOption<infer U> ? U : T[key] } & { [key in TOmitted]: T[key] };
834
980
  /**
835
- * Manifest customization available in the `wxt.config.ts` file. You cannot configure entrypoints
836
- * here, they are configured inline.
981
+ * Firefox data collection permission types for personal data. See:
982
+ * https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/#specifying-data-types
983
+ */
984
+ type FirefoxDataCollectionType = 'locationInfo' | 'browsingActivity' | 'websiteContent' | 'websiteActivity' | 'searchTerms' | 'bookmarksInfo' | 'healthInfo' | 'contactInfo' | 'socialInfo' | (string & {});
985
+ /**
986
+ * Firefox data collection permissions configuration. See:
987
+ * https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/#specifying-data-types
988
+ */
989
+ interface FirefoxDataCollectionPermissions {
990
+ /**
991
+ * Required data collection permissions. Users must opt in to use the
992
+ * extension. Can include personal data types or "none" to explicitly indicate
993
+ * no data collection.
994
+ */
995
+ required?: Array<FirefoxDataCollectionType | 'none'>;
996
+ /**
997
+ * Optional data collection permissions. Users can opt in after installation.
998
+ * Can include personal data types or "technicalAndInteraction" (which can
999
+ * only be optional).
1000
+ */
1001
+ optional?: Array<FirefoxDataCollectionType | 'technicalAndInteraction'>;
1002
+ }
1003
+ /**
1004
+ * Manifest customization available in the `wxt.config.ts` file. You cannot
1005
+ * configure entrypoints here, they are configured inline.
837
1006
  */
838
1007
  type UserManifest = { [key in keyof Browser.runtime.ManifestV3 as key extends 'action' | 'background' | 'chrome_url_overrides' | 'devtools_page' | 'manifest_version' | 'options_page' | 'options_ui' | 'permissions' | 'sandbox' | 'web_accessible_resources' ? never : key]?: Browser.runtime.ManifestV3[key] } & {
839
1008
  action?: Browser.runtime.ManifestV3['action'] & {
840
- browser_style?: boolean;
1009
+ default_area?: 'navbar' | 'menupanel' | 'tabstrip' | 'personaltoolbar';
1010
+ theme_icons?: ThemeIcon[];
841
1011
  };
842
1012
  browser_action?: Browser.runtime.ManifestV2['browser_action'] & {
843
1013
  browser_style?: boolean;
1014
+ default_area?: 'navbar' | 'menupanel' | 'tabstrip' | 'personaltoolbar';
1015
+ theme_icons?: ThemeIcon[];
844
1016
  };
845
1017
  page_action?: Browser.runtime.ManifestV2['page_action'] & {
846
1018
  browser_style?: boolean;
@@ -851,6 +1023,11 @@ type UserManifest = { [key in keyof Browser.runtime.ManifestV3 as key extends 'a
851
1023
  strict_min_version?: string;
852
1024
  strict_max_version?: string;
853
1025
  update_url?: string;
1026
+ /**
1027
+ * Firefox data collection permissions configuration. See:
1028
+ * https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/#specifying-data-types
1029
+ */
1030
+ data_collection_permissions?: FirefoxDataCollectionPermissions;
854
1031
  };
855
1032
  gecko_android?: {
856
1033
  strict_min_version?: string;
@@ -861,79 +1038,74 @@ type UserManifest = { [key in keyof Browser.runtime.ManifestV3 as key extends 'a
861
1038
  strict_max_version?: string;
862
1039
  };
863
1040
  };
864
- permissions?: (Browser.runtime.ManifestPermissions | (string & Record<never, never>))[];
1041
+ permissions?: (Browser.runtime.ManifestPermission | (string & Record<never, never>))[];
865
1042
  web_accessible_resources?: string[] | Browser.runtime.ManifestV3['web_accessible_resources'];
866
1043
  };
867
1044
  type UserManifestFn = (env: ConfigEnv) => UserManifest | Promise<UserManifest>;
868
1045
  interface ConfigEnv {
869
1046
  /**
870
- * The build mode passed into the CLI. By default, `wxt` uses `"development"` and `wxt build|zip`
871
- * uses `"production"`.
1047
+ * The build mode passed into the CLI. By default, `wxt` uses `"development"`
1048
+ * and `wxt build|zip` uses `"production"`.
872
1049
  */
873
1050
  mode: string;
874
1051
  /**
875
- * The command used to run WXT. `"serve"` during development and `"build"` for any other command.
1052
+ * The command used to run WXT. `"serve"` during development and `"build"` for
1053
+ * any other command.
876
1054
  */
877
1055
  command: WxtCommand;
878
1056
  /**
879
- * Browser passed in from the CLI via the `-b` or `--browser` flag. Defaults to `"chrome"` when not passed.
1057
+ * Browser passed in from the CLI via the `-b` or `--browser` flag. Defaults
1058
+ * to `"chrome"` when not passed.
880
1059
  */
881
1060
  browser: TargetBrowser;
882
1061
  /**
883
- * Manifest version passed in from the CLI via the `--mv2` or `--mv3` flags. When not passed, it depends on the target browser. See
884
- * [the guide](https://wxt.dev/guide/key-concepts/multiple-browsers.html#target-manifest-version) for more
885
- * details.
1062
+ * Manifest version passed in from the CLI via the `--mv2` or `--mv3` flags.
1063
+ * When not passed, it depends on the target browser. See [the
1064
+ * guide](https://wxt.dev/guide/key-concepts/multiple-browsers.html#target-manifest-version)
1065
+ * for more details.
886
1066
  */
887
1067
  manifestVersion: 2 | 3;
888
1068
  }
889
1069
  type WxtCommand = 'build' | 'serve';
890
1070
  /**
891
- * @deprecated Use `WebExtConfig` instead.
892
- */
893
- type ExtensionRunnerConfig = WebExtConfig;
894
- /**
895
- * Options for how [`web-ext`](https://github.com/mozilla/web-ext) starts the browser.
1071
+ * Options for how [`web-ext`](https://github.com/mozilla/web-ext) starts the
1072
+ * browser.
896
1073
  */
897
1074
  interface WebExtConfig {
898
1075
  /**
899
- * Whether or not to open the browser with the extension installed in dev mode.
1076
+ * Whether or not to open the browser with the extension installed in dev
1077
+ * mode.
900
1078
  *
901
1079
  * @default false
902
1080
  */
903
1081
  disabled?: boolean;
904
- /**
905
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#browser-console
906
- */
1082
+ /** @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#browser-console */
907
1083
  openConsole?: boolean;
908
- /**
909
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#devtools
910
- */
1084
+ /** @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#devtools */
911
1085
  openDevtools?: boolean;
912
1086
  /**
913
- * List of browser names and the binary that should be used to open the browser.
1087
+ * List of browser names and the binary that should be used to open the
1088
+ * browser.
914
1089
  *
915
1090
  * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#chromium-binary
916
1091
  * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#firefox
917
1092
  */
918
1093
  binaries?: Record<string, string>;
919
- /**
920
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#firefox-profile
921
- */
1094
+ /** @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#firefox-profile */
922
1095
  firefoxProfile?: string;
923
- /**
924
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#chromium-profile
925
- */
1096
+ /** @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#chromium-profile */
926
1097
  chromiumProfile?: string;
927
1098
  /**
928
- * An map of chrome preferences from https://chromium.googlesource.com/chromium/src/+/main/chrome/common/pref_names.h
1099
+ * An map of chrome preferences from
1100
+ * https://chromium.googlesource.com/chromium/src/+/main/chrome/common/pref_names.h
929
1101
  *
930
1102
  * @example
931
- * // change your downloads directory
932
- * {
1103
+ * // change your downloads directory
1104
+ * {
933
1105
  * download: {
934
- * default_directory: "/my/custom/dir",
1106
+ * default_directory: "/my/custom/dir",
935
1107
  * },
936
- * }
1108
+ * }
937
1109
  *
938
1110
  * @default
939
1111
  * // Enable dev mode and allow content script sourcemaps
@@ -952,135 +1124,122 @@ interface WebExtConfig {
952
1124
  */
953
1125
  chromiumPref?: Record<string, any>;
954
1126
  /**
955
- * By default, chrome opens a random port for debugging. Set this value to use a specific port.
1127
+ * By default, chrome opens a random port for debugging. Set this value to use
1128
+ * a specific port.
956
1129
  */
957
1130
  chromiumPort?: number;
958
- /**
959
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#pref
960
- */
1131
+ /** @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#pref */
961
1132
  firefoxPref?: Record<string, boolean | number | string>;
962
- /**
963
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#args
964
- */
1133
+ /** @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#args */
965
1134
  firefoxArgs?: string[];
966
- /**
967
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#args
968
- */
1135
+ /** @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#args */
969
1136
  chromiumArgs?: string[];
970
- /**
971
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#start-url
972
- */
1137
+ /** @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#start-url */
973
1138
  startUrls?: string[];
974
- /**
975
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#keep-profile-changes
976
- */
1139
+ /** @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#keep-profile-changes */
977
1140
  keepProfileChanges?: boolean;
978
1141
  }
979
1142
  interface WxtBuilder {
980
- /**
981
- * Name of tool used to build. Ex: "Vite" or "Webpack".
982
- */
1143
+ /** Name of tool used to build. Ex: "Vite" or "Webpack". */
983
1144
  name: string;
984
- /**
985
- * Version of tool used to build. Ex: "5.0.2"
986
- */
1145
+ /** Version of tool used to build. Ex: "5.0.2" */
987
1146
  version: string;
988
1147
  /**
989
- * Import a JS entrypoint file, returning the default export containing the options.
990
- */
991
- importEntrypoint<T>(path: string): Promise<T>;
992
- /**
993
- * Import a list of JS entrypoint files, returning their options.
1148
+ * Import a JS entrypoint file, returning the default export containing the
1149
+ * options.
994
1150
  */
1151
+ importEntrypoint<T>(this: WxtBuilder, path: string): Promise<T>;
1152
+ /** Import a list of JS entrypoint files, returning their options. */
995
1153
  importEntrypoints(paths: string[]): Promise<Record<string, unknown>[]>;
996
1154
  /**
997
- * Build a single entrypoint group. This is effectively one of the multiple "steps" during the
998
- * build process.
1155
+ * Build a single entrypoint group. This is effectively one of the multiple
1156
+ * "steps" during the build process.
999
1157
  */
1000
1158
  build(group: EntrypointGroup): Promise<BuildStepOutput>;
1001
- /**
1002
- * Start a dev server at the provided port.
1003
- */
1159
+ /** Start a dev server at the provided port. */
1004
1160
  createServer(info: ServerInfo): Promise<WxtBuilderServer>;
1005
1161
  }
1006
1162
  interface WxtBuilderServer {
1007
- /**
1008
- * Start the server.
1009
- */
1163
+ /** Start the server. */
1010
1164
  listen(): Promise<void>;
1011
- /**
1012
- * Stop the server.
1013
- */
1165
+ /** Stop the server. */
1014
1166
  close(): Promise<void>;
1015
- /**
1016
- * Transform the HTML for dev mode.
1017
- */
1167
+ /** Transform the HTML for dev mode. */
1018
1168
  transformHtml(url: string, html: string, originalUrl?: string | undefined): Promise<string>;
1019
- /**
1020
- * The web socket server used to communicate with the extension.
1021
- */
1169
+ /** The web socket server used to communicate with the extension. */
1022
1170
  ws: {
1023
1171
  /**
1024
1172
  * Send a message via the server's websocket, with an optional payload.
1025
1173
  *
1026
1174
  * @example
1027
- * ws.send("wxt:reload-extension");
1028
- * ws.send("wxt:reload-content-script", { ... });
1029
- */
1030
- send(message: string, payload?: any): void;
1031
- /**
1032
- * Listen for messages over the server's websocket.
1175
+ * ws.send("wxt:reload-extension");
1176
+ * ws.send("wxt:reload-content-script", { ... });
1033
1177
  */
1178
+ send(message: string, payload?: any): void; /** Listen for messages over the server's websocket. */
1034
1179
  on(message: string, cb: (payload: any) => void): void;
1035
1180
  };
1036
- /**
1037
- * Chokidar file watcher instance.
1038
- */
1181
+ /** Chokidar file watcher instance. */
1039
1182
  watcher: vite.ViteDevServer['watcher'];
1040
1183
  on?(event: string, callback: () => void): void;
1041
1184
  }
1042
1185
  interface ServerInfo {
1043
- /**
1044
- * Ex: `"localhost"`
1045
- */
1186
+ /** Ex: `"localhost"` */
1046
1187
  host: string;
1047
- /**
1048
- * Ex: `3000`
1049
- */
1188
+ /** Ex: `3000` */
1050
1189
  port: number;
1051
- /**
1052
- * Ex: `"http://localhost:3000"`
1053
- */
1190
+ /** Ex: `"http://localhost:3000"` */
1054
1191
  origin: string;
1055
1192
  }
1193
+ type PrepareTsconfigs = {
1194
+ /** The JSON contents of the `.wxt/tsconfig.json` file. */tsconfig: any;
1195
+ };
1056
1196
  type HookResult = Promise<void> | void;
1057
1197
  interface WxtHooks {
1058
1198
  /**
1059
1199
  * Called after WXT modules are initialized, when the WXT instance is ready to
1060
1200
  * be used. `wxt.server` isn't available yet, use `server:created` to get it.
1201
+ *
1061
1202
  * @param wxt The configured WXT object
1062
1203
  */
1063
1204
  ready: (wxt: Wxt) => HookResult;
1064
1205
  /**
1065
- * Called whenever config is loaded or reloaded. Use this hook to modify config by modifying `wxt.config`.
1206
+ * Called whenever config is loaded or reloaded. Use this hook to modify
1207
+ * config by modifying `wxt.config`.
1208
+ *
1066
1209
  * @param wxt The configured WXT object
1067
1210
  */
1068
1211
  'config:resolved': (wxt: Wxt) => HookResult;
1069
1212
  'prepare:types': (wxt: Wxt, entries: WxtDirEntry[]) => HookResult;
1070
1213
  /**
1071
- * Called before generating the list of public paths inside
1072
- * `.wxt/types/paths.d.ts`. Use this hook to add additional paths (relative
1073
- * to output directory) WXT doesn't add automatically.
1214
+ * Called before WXT writes your tsconfig to the disk, allowing full
1215
+ * customization by modifying the object by reference.
1074
1216
  *
1075
- * @param wxt The configured WXT object
1076
- * @param paths This list of paths TypeScript allows `browser.runtime.getURL` to be called with.
1217
+ * @since 0.20.28
1218
+ * @example
1219
+ * wxt.hooks.hook('prepare:tsconfig', (wxt, { tsconfig }) => {
1220
+ * tsconfig.compilerOptions.lib.push('WebWorker');
1221
+ * });
1222
+ */
1223
+ 'prepare:tsconfig': (wxt: Wxt, configs: PrepareTsconfigs) => HookResult;
1224
+ /**
1225
+ * Called before generating the list of public paths inside
1226
+ * `.wxt/types/paths.d.ts`. Use this hook to add additional paths (relative to
1227
+ * output directory) WXT doesn't add automatically.
1077
1228
  *
1078
1229
  * @example
1079
- * wxt.hooks.hook('prepare:publicPaths', (wxt, paths) => {
1080
- * paths.push('/icons/128.png');
1081
- * })
1230
+ * wxt.hooks.hook('prepare:publicPaths', (wxt, paths) => {
1231
+ * paths.push('icons/128.png');
1232
+ * paths.push({
1233
+ * type: 'templateLiteral',
1234
+ * path: '_favicon/?${string}',
1235
+ * });
1236
+ * });
1237
+ *
1238
+ * @param wxt The configured WXT object
1239
+ * @param paths This list of paths TypeScript allows `browser.runtime.getURL`
1240
+ * to be called with.
1082
1241
  */
1083
- 'prepare:publicPaths': (wxt: Wxt, paths: string[]) => HookResult;
1242
+ 'prepare:publicPaths': (wxt: Wxt, paths: PublicPathEntry[]) => HookResult;
1084
1243
  /**
1085
1244
  * Called before the build is started in both dev mode and build mode.
1086
1245
  *
@@ -1096,22 +1255,25 @@ interface WxtHooks {
1096
1255
  */
1097
1256
  'build:done': (wxt: Wxt, output: Readonly<BuildOutput>) => HookResult;
1098
1257
  /**
1099
- * Called once the manifest has been generated. Used to transform the manifest by reference before
1100
- * it is written to the output directory.
1258
+ * Called once the manifest has been generated. Used to transform the manifest
1259
+ * by reference before it is written to the output directory.
1260
+ *
1101
1261
  * @param wxt The configured WXT object
1102
1262
  * @param manifest The manifest that was generated
1103
1263
  */
1104
1264
  'build:manifestGenerated': (wxt: Wxt, manifest: Browser.runtime.Manifest) => HookResult;
1105
1265
  /**
1106
1266
  * Called once the names and paths of all entrypoints have been resolved.
1267
+ *
1107
1268
  * @param wxt The configured WXT object
1108
- * @param infos List of entrypoints found in the project's `entrypoints` directory
1269
+ * @param infos List of entrypoints found in the project's `entrypoints`
1270
+ * directory
1109
1271
  */
1110
1272
  'entrypoints:found': (wxt: Wxt, infos: EntrypointInfo[]) => HookResult;
1111
1273
  /**
1112
- * Called once all entrypoints have been loaded from the `entrypointsDir`.
1113
- * Use `wxt.builder.importEntrypoint` to load entrypoint options from the
1114
- * file, or manually define them.
1274
+ * Called once all entrypoints have been loaded from the `entrypointsDir`. Use
1275
+ * `wxt.builder.importEntrypoint` to load entrypoint options from the file, or
1276
+ * manually define them.
1115
1277
  *
1116
1278
  * @param wxt The configured WXT object
1117
1279
  * @param entrypoints The list of entrypoints to be built
@@ -1119,6 +1281,7 @@ interface WxtHooks {
1119
1281
  'entrypoints:resolved': (wxt: Wxt, entrypoints: Entrypoint[]) => HookResult;
1120
1282
  /**
1121
1283
  * Called once all entrypoints have been grouped into their build groups.
1284
+ *
1122
1285
  * @param wxt The configured WXT object
1123
1286
  * @param entrypoints The list of groups to build in each build step
1124
1287
  */
@@ -1126,88 +1289,91 @@ interface WxtHooks {
1126
1289
  /**
1127
1290
  * Called when public assets are found. You can modify the `files` list by
1128
1291
  * reference to add or remove public files.
1292
+ *
1129
1293
  * @param wxt The configured WXT object
1130
- * @param entrypoints The list of files that will be copied into the output directory
1294
+ * @param entrypoints The list of files that will be copied into the output
1295
+ * directory
1131
1296
  */
1132
1297
  'build:publicAssets': (wxt: Wxt, files: ResolvedPublicFile[]) => HookResult;
1133
1298
  /**
1134
1299
  * Called before the zip process starts.
1300
+ *
1135
1301
  * @param wxt The configured WXT object
1136
1302
  */
1137
1303
  'zip:start': (wxt: Wxt) => HookResult;
1138
1304
  /**
1139
1305
  * Called before zipping the extension files.
1306
+ *
1140
1307
  * @param wxt The configured WXT object
1141
1308
  */
1142
1309
  'zip:extension:start': (wxt: Wxt) => HookResult;
1143
1310
  /**
1144
1311
  * Called after zipping the extension files.
1312
+ *
1145
1313
  * @param wxt The configured WXT object
1146
1314
  * @param zipPath The path to the created extension zip file
1147
1315
  */
1148
1316
  'zip:extension:done': (wxt: Wxt, zipPath: string) => HookResult;
1149
1317
  /**
1150
1318
  * Called before zipping the source files (for Firefox).
1319
+ *
1151
1320
  * @param wxt The configured WXT object
1152
1321
  */
1153
1322
  'zip:sources:start': (wxt: Wxt) => HookResult;
1154
1323
  /**
1155
1324
  * Called after zipping the source files (for Firefox).
1325
+ *
1156
1326
  * @param wxt The configured WXT object
1157
1327
  * @param zipPath The path to the created sources zip file
1158
1328
  */
1159
1329
  'zip:sources:done': (wxt: Wxt, zipPath: string) => HookResult;
1160
1330
  /**
1161
1331
  * Called after the entire zip process is complete.
1332
+ *
1162
1333
  * @param wxt The configured WXT object
1163
1334
  * @param zipFiles An array of paths to all created zip files
1164
1335
  */
1165
1336
  'zip:done': (wxt: Wxt, zipFiles: string[]) => HookResult;
1166
1337
  /**
1167
- * Called when the dev server is created (and `wxt.server` is assigned). Server has not been started yet.
1338
+ * Called when the dev server is created (and `wxt.server` is assigned).
1339
+ * Server has not been started yet.
1340
+ *
1168
1341
  * @param wxt The configured WXT object
1169
- * @param server Same as `wxt.server`, the object WXT uses to control the dev server.
1342
+ * @param server Same as `wxt.server`, the object WXT uses to control the dev
1343
+ * server.
1170
1344
  */
1171
1345
  'server:created': (wxt: Wxt, server: WxtDevServer) => HookResult;
1172
1346
  /**
1173
1347
  * Called when the dev server is started.
1348
+ *
1174
1349
  * @param wxt The configured WXT object
1175
- * @param server Same as `wxt.server`, the object WXT uses to control the dev server.
1350
+ * @param server Same as `wxt.server`, the object WXT uses to control the dev
1351
+ * server.
1176
1352
  */
1177
1353
  'server:started': (wxt: Wxt, server: WxtDevServer) => HookResult;
1178
1354
  /**
1179
1355
  * Called when the dev server is stopped.
1356
+ *
1180
1357
  * @param wxt The configured WXT object
1181
- * @param server Same as `wxt.server`, the object WXT uses to control the dev server.
1358
+ * @param server Same as `wxt.server`, the object WXT uses to control the dev
1359
+ * server.
1182
1360
  */
1183
1361
  'server:closed': (wxt: Wxt, server: WxtDevServer) => HookResult;
1184
1362
  }
1185
1363
  interface Wxt {
1186
1364
  config: ResolvedConfig$1;
1187
1365
  hooks: Hookable<WxtHooks>;
1188
- /**
1189
- * Alias for `wxt.hooks.hook(...)`.
1190
- */
1366
+ /** Alias for `wxt.hooks.hook(...)`. */
1191
1367
  hook: Hookable<WxtHooks>['hook'];
1192
- /**
1193
- * Alias for config.logger
1194
- */
1368
+ /** Alias for config.logger */
1195
1369
  logger: Logger;
1196
- /**
1197
- * Reload config file and update `wxt.config` with the result.
1198
- */
1370
+ /** Reload config file and update `wxt.config` with the result. */
1199
1371
  reloadConfig: () => Promise<void>;
1200
- /**
1201
- * Package manager utilities.
1202
- */
1372
+ /** Package manager utilities. */
1203
1373
  pm: WxtPackageManager;
1204
- /**
1205
- * If the dev server was started, it will be available.
1206
- */
1374
+ /** If the dev server was started, it will be available. */
1207
1375
  server?: WxtDevServer;
1208
- /**
1209
- * The module in charge of executing all the build steps.
1210
- */
1376
+ /** The module in charge of executing all the build steps. */
1211
1377
  builder: WxtBuilder;
1212
1378
  }
1213
1379
  interface ResolvedConfig$1 {
@@ -1216,8 +1382,9 @@ interface ResolvedConfig$1 {
1216
1382
  publicDir: string;
1217
1383
  /**
1218
1384
  * Absolute path pointing to `.wxt` directory in project root.
1385
+ *
1219
1386
  * @example
1220
- * "/path/to/project/.wxt"
1387
+ * '/path/to/project/.wxt';
1221
1388
  */
1222
1389
  wxtDir: string;
1223
1390
  typesDir: string;
@@ -1226,19 +1393,22 @@ interface ResolvedConfig$1 {
1226
1393
  filterEntrypoints?: Set<string>;
1227
1394
  /**
1228
1395
  * Absolute path to the `.output` directory
1396
+ *
1229
1397
  * @example
1230
- * "/path/to/project/.output"
1398
+ * '/path/to/project/.output';
1231
1399
  */
1232
1400
  outBaseDir: string;
1233
1401
  /**
1234
1402
  * Absolute path to the target output directory.
1403
+ *
1235
1404
  * @example
1236
- * "/path/to/project/.output/chrome-mv3"
1405
+ * '/path/to/project/.output/chrome-mv3';
1237
1406
  */
1238
1407
  outDir: string;
1239
1408
  debug: boolean;
1240
1409
  /**
1241
- * Absolute path pointing to the `node_modules/wxt` directory, wherever WXT is installed.
1410
+ * Absolute path pointing to the `node_modules/wxt` directory, wherever WXT is
1411
+ * installed.
1242
1412
  */
1243
1413
  wxtModuleDir: string;
1244
1414
  mode: string;
@@ -1251,21 +1421,20 @@ interface ResolvedConfig$1 {
1251
1421
  imports: WxtResolvedUnimportOptions;
1252
1422
  manifest: UserManifest;
1253
1423
  fsCache: FsCache;
1254
- runnerConfig: ResolvedConfig<WebExtConfig>;
1424
+ webExt: ResolvedConfig<WebExtConfig>;
1425
+ runner: ExtensionRunner;
1255
1426
  zip: {
1256
1427
  name?: string;
1257
1428
  artifactTemplate: string;
1258
1429
  sourcesTemplate: string;
1259
1430
  includeSources: string[];
1260
1431
  excludeSources: string[];
1432
+ dotSources: boolean;
1261
1433
  sourcesRoot: string;
1262
1434
  downloadedPackagesDir: string;
1263
1435
  downloadPackages: string[];
1264
1436
  compressionLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
1265
- exclude: string[];
1266
- /**
1267
- * If true, when zipping the extension, also zip the sources.
1268
- */
1437
+ exclude: string[]; /** If true, when zipping the extension, also zip the sources. */
1269
1438
  zipSources: boolean;
1270
1439
  };
1271
1440
  analysis: {
@@ -1278,32 +1447,38 @@ interface ResolvedConfig$1 {
1278
1447
  keepArtifacts: boolean;
1279
1448
  };
1280
1449
  userConfigMetadata: Omit<ResolvedConfig<UserConfig>, 'config'>;
1281
- /**
1282
- * Import aliases to absolute paths.
1283
- */
1450
+ /** Import aliases to absolute paths. */
1284
1451
  alias: Record<string, string>;
1285
1452
  experimental: {};
1453
+ /** List of warning identifiers to suppress during the build process. */
1454
+ suppressWarnings: {
1455
+ firefoxDataCollection?: boolean;
1456
+ firefoxId?: boolean;
1457
+ };
1458
+ /** Chokidar options used by dev-mode file watchers. */
1459
+ watchOptions: vite.WatchOptions;
1286
1460
  dev: {
1287
1461
  /** Only defined during dev command */server?: {
1288
1462
  host: string;
1289
1463
  port: number;
1290
1464
  origin: string;
1465
+ strictPort: boolean;
1291
1466
  /**
1292
- * The milliseconds to debounce when a file is saved before reloading.
1293
- * The only way to set this option is to set the `WXT_WATCH_DEBOUNCE`
1467
+ * The milliseconds to debounce when a file is saved before reloading. The
1468
+ * only way to set this option is to set the `WXT_WATCH_DEBOUNCE`
1294
1469
  * environment variable, either globally (like in `.bashrc` file) or
1295
1470
  * per-project (in `.env` file).
1296
1471
  *
1297
1472
  * For example:
1298
- * ```
1299
- * # ~/.zshrc
1300
- * export WXT_WATCH_DEBOUNCE=1000
1301
- * ```
1302
- * or
1303
- * ```
1304
- * # .env
1305
- * WXT_WATCH_DEBOUNCE=1000
1306
- * ```
1473
+ *
1474
+ * # ~/.zshrc
1475
+ * export WXT_WATCH_DEBOUNCE=1000
1476
+ *
1477
+ * Or
1478
+ *
1479
+ * # .env
1480
+ * WXT_WATCH_DEBOUNCE=1000
1481
+ *
1307
1482
  * @default 800
1308
1483
  */
1309
1484
  watchDebounce: number;
@@ -1314,11 +1489,11 @@ interface ResolvedConfig$1 {
1314
1489
  builtinModules: WxtModule<any>[];
1315
1490
  userModules: WxtModuleWithMetadata<any>[];
1316
1491
  /**
1317
- * An array of string to import plugins from. These paths should be
1318
- * resolvable by vite, and they should `export default defineWxtPlugin(...)`.
1492
+ * An array of string to import plugins from. These paths should be resolvable
1493
+ * by vite, and they should `export default defineWxtPlugin(...)`.
1319
1494
  *
1320
1495
  * @example
1321
- * ["@wxt-dev/module-vue/plugin", "wxt-module-google-analytics/plugin"]
1496
+ * ['@wxt-dev/module-vue/plugin', 'wxt-module-google-analytics/plugin'];
1322
1497
  */
1323
1498
  plugins: string[];
1324
1499
  }
@@ -1335,28 +1510,29 @@ interface ExtensionRunner {
1335
1510
  type EslintGlobalsPropValue = boolean | 'readonly' | 'readable' | 'writable' | 'writeable';
1336
1511
  interface Eslintrc {
1337
1512
  /**
1338
- * When true, generates a file that can be used by ESLint to know which variables are valid globals.
1513
+ * When true, generates a file that can be used by ESLint to know which
1514
+ * variables are valid globals.
1339
1515
  *
1516
+ * - `'auto'`: Check if eslint is installed, and if it is, generate a compatible
1517
+ * config file.
1518
+ * - `true`: Same as `'auto'`.
1340
1519
  * - `false`: Don't generate the file.
1341
- * - `'auto'`: Check if eslint is installed, and if it is, generate a compatible config file.
1342
- * - `true`: Same as `8`.
1343
1520
  * - `8`: Generate a config file compatible with ESLint 8.
1344
1521
  * - `9`: Generate a config file compatible with ESLint 9.
1345
1522
  *
1346
1523
  * @default 'auto'
1347
1524
  */
1348
- enabled?: false | true | 'auto' | 8 | 9;
1525
+ enabled?: 'auto' | boolean | 8 | 9;
1349
1526
  /**
1350
1527
  * File path to save the generated eslint config.
1351
1528
  *
1352
1529
  * Default depends on version of ESLint used:
1530
+ *
1353
1531
  * - 9 and above: './.wxt/eslint-auto-imports.mjs'
1354
1532
  * - 8 and below: './.wxt/eslintrc-auto-import.json'
1355
1533
  */
1356
1534
  filePath?: string;
1357
- /**
1358
- * @default true
1359
- */
1535
+ /** @default true */
1360
1536
  globalsPropValue?: EslintGlobalsPropValue;
1361
1537
  }
1362
1538
  interface ResolvedEslintrc {
@@ -1372,21 +1548,26 @@ type WxtUnimportOptions = Partial<UnimportOptions> & {
1372
1548
  * globals". This option lets you configure a base eslintrc that, when
1373
1549
  * extended, fixes these lint errors.
1374
1550
  *
1375
- * See <https://wxt.dev/guide/key-concepts/auto-imports.html#eslint>
1551
+ * See
1552
+ * [https://wxt.dev/guide/key-concepts/auto-imports.html#eslint](https://wxt.dev/guide/key-concepts/auto-imports.html#eslint)
1376
1553
  */
1377
1554
  eslintrc?: Eslintrc;
1378
1555
  };
1379
1556
  type WxtResolvedUnimportOptions = Partial<UnimportOptions> & {
1380
1557
  /**
1381
- * Set to `true` when the user disabled auto-imports. We still use unimport for the #imports module, but other features should be disabled.
1558
+ * Set to `true` when the user disabled auto-imports. We still use unimport
1559
+ * for the #imports module, but other features should be disabled.
1382
1560
  *
1383
- * You don't need to check this value before modifying the auto-import options. Even if `disabled` is `true`, there's no harm in adding imports to the config - they'll just be ignored.
1561
+ * You don't need to check this value before modifying the auto-import
1562
+ * options. Even if `disabled` is `true`, there's no harm in adding imports to
1563
+ * the config - they'll just be ignored.
1384
1564
  */
1385
1565
  disabled: boolean;
1386
1566
  eslintrc: ResolvedEslintrc;
1387
1567
  };
1388
1568
  /**
1389
- * Package management utils built on top of [`nypm`](https://www.npmjs.com/package/nypm)
1569
+ * Package management utils built on top of
1570
+ * [`nypm`](https://npmjs.org/package/nypm)
1390
1571
  */
1391
1572
  interface WxtPackageManager extends Nypm.PackageManager {
1392
1573
  addDependency: typeof Nypm.addDependency;
@@ -1395,16 +1576,19 @@ interface WxtPackageManager extends Nypm.PackageManager {
1395
1576
  installDependencies: typeof Nypm.installDependencies;
1396
1577
  removeDependency: typeof Nypm.removeDependency;
1397
1578
  /**
1398
- * Download a package's TGZ file and move it into the `downloadDir`. Use's `npm pack <name>`, so
1399
- * you must have setup authorization in `.npmrc` file, regardless of the package manager used.
1579
+ * Download a package's TGZ file and move it into the `downloadDir`. Use's
1580
+ * `npm pack <name>`, so you must have setup authorization in `.npmrc` file,
1581
+ * regardless of the package manager used.
1400
1582
  *
1401
- * @param id Name of the package to download, can include a version (like `wxt@0.17.1`)
1583
+ * @param id Name of the package to download, can include a version (like
1584
+ * `wxt@0.17.1`)
1402
1585
  * @param downloadDir Where to store the package.
1403
1586
  * @returns Absolute path to downloaded file.
1404
1587
  */
1405
1588
  downloadDependency: (id: string, downloadDir: string) => Promise<string>;
1406
1589
  /**
1407
- * Run `npm ls`, `pnpm ls`, or `bun pm ls`, or `yarn list` and return the results.
1590
+ * Run `npm ls`, `pnpm ls`, or `bun pm ls`, or `yarn list` and return the
1591
+ * results.
1408
1592
  *
1409
1593
  * WARNING: Yarn always returns all dependencies
1410
1594
  */
@@ -1412,9 +1596,7 @@ interface WxtPackageManager extends Nypm.PackageManager {
1412
1596
  cwd?: string;
1413
1597
  all?: boolean;
1414
1598
  }) => Promise<Dependency[]>;
1415
- /**
1416
- * Key used to override package versions. Sometimes called "resolutions".
1417
- */
1599
+ /** Key used to override package versions. Sometimes called "resolutions". */
1418
1600
  overridesKey: string;
1419
1601
  }
1420
1602
  interface Dependency {
@@ -1426,12 +1608,11 @@ type WxtModuleSetup<TOptions extends WxtModuleOptions> = (wxt: Wxt, moduleOption
1426
1608
  interface WxtModule<TOptions extends WxtModuleOptions> {
1427
1609
  name?: string;
1428
1610
  /**
1429
- * Key for users to pass options into your module from their `wxt.config.ts` file.
1611
+ * Key for users to pass options into your module from their `wxt.config.ts`
1612
+ * file.
1430
1613
  */
1431
1614
  configKey?: string;
1432
- /**
1433
- * Provide a list of imports to add to auto-imports.
1434
- */
1615
+ /** Provide a list of imports to add to auto-imports. */
1435
1616
  imports?: Import[];
1436
1617
  /**
1437
1618
  * Alternative to adding hooks in setup function with `wxt.hooks`. Hooks are
@@ -1452,49 +1633,54 @@ type ResolvedPublicFile = CopiedPublicFile | GeneratedPublicFile;
1452
1633
  interface ResolvedBasePublicFile {
1453
1634
  /**
1454
1635
  * The relative path in the output directory to copy the file to.
1636
+ *
1455
1637
  * @example
1456
- * "content-scripts/base-styles.css"
1638
+ * 'content-scripts/base-styles.css';
1457
1639
  */
1458
1640
  relativeDest: string;
1459
1641
  }
1460
1642
  interface CopiedPublicFile extends ResolvedBasePublicFile {
1461
1643
  /**
1462
1644
  * The absolute path to the file that will be copied to the output directory.
1645
+ *
1463
1646
  * @example
1464
- * "/path/to/any/file.css"
1647
+ * '/path/to/any/file.css';
1465
1648
  */
1466
1649
  absoluteSrc: string;
1467
1650
  }
1468
1651
  interface GeneratedPublicFile extends ResolvedBasePublicFile {
1469
- /**
1470
- * Text to write to the file.
1471
- */
1652
+ /** Text to write to the file. */
1472
1653
  contents: string;
1473
1654
  }
1655
+ type PublicPathEntry = string | {
1656
+ type: 'string' | 'templateLiteral';
1657
+ path: string;
1658
+ };
1474
1659
  type WxtPlugin = () => void;
1475
1660
  type WxtDirEntry = WxtDirTypeReferenceEntry | WxtDirFileEntry;
1476
1661
  /**
1477
- * Represents type reference to a node module to be added to `.wxt/wxt.d.ts` file
1662
+ * Represents type reference to a node module to be added to `.wxt/wxt.d.ts`
1663
+ * file
1478
1664
  */
1479
1665
  interface WxtDirTypeReferenceEntry {
1666
+ /**
1667
+ * Specifies the module name that will be used in the `/// <reference
1668
+ * types="..." />` directive. This value will be added to the `.wxt/wxt.d.ts`
1669
+ * file to include type definitions from the specified module.
1670
+ */
1480
1671
  module: string;
1481
1672
  }
1482
- /**
1483
- * Represents a file to be written to the project's `.wxt/` directory.
1484
- */
1673
+ /** Represents a file to be written to the project's `.wxt/` directory. */
1485
1674
  interface WxtDirFileEntry {
1486
1675
  /**
1487
- * Path relative to the `.wxt/` directory. So "tsconfig.json" would resolve to ".wxt/tsconfig.json".
1676
+ * Path relative to the `.wxt/` directory. So "tsconfig.json" would resolve to
1677
+ * ".wxt/tsconfig.json".
1488
1678
  */
1489
1679
  path: string;
1490
- /**
1491
- * The text that will be written to the file.
1492
- */
1680
+ /** The text that will be written to the file. */
1493
1681
  text: string;
1494
- /**
1495
- * Set to `true` to add a reference to this file in `.wxt/wxt.d.ts`.
1496
- */
1682
+ /** Set to `true` to add a reference to this file in `.wxt/wxt.d.ts`. */
1497
1683
  tsReference?: boolean;
1498
1684
  }
1499
1685
  //#endregion
1500
- export { BackgroundDefinition, BackgroundEntrypoint, BackgroundEntrypointOptions, BaseContentScriptEntrypointOptions, BaseEntrypoint, BaseEntrypointOptions, BaseScriptEntrypointOptions, BuildOutput, BuildStepOutput, ConfigEnv, ContentScriptDefinition, ContentScriptEntrypoint, CopiedPublicFile, Dependency, Entrypoint, EntrypointGroup, EntrypointInfo, EslintGlobalsPropValue, Eslintrc, ExtensionRunner, ExtensionRunnerConfig, FsCache, GeneratedPublicFile, GenericEntrypoint, HookResult, InlineConfig, IsolatedWorldContentScriptDefinition, IsolatedWorldContentScriptEntrypointOptions, Logger, MainWorldContentScriptDefinition, MainWorldContentScriptEntrypointOptions, OnContentScriptStopped, OptionsEntrypoint, OptionsEntrypointOptions, OutputAsset, OutputChunk, OutputFile, PerBrowserMap, PerBrowserOption, PopupEntrypoint, PopupEntrypointOptions, ReloadContentScriptPayload, ResolvedBasePublicFile, ResolvedConfig$1 as ResolvedConfig, ResolvedEslintrc, ResolvedPerBrowserOptions, ResolvedPublicFile, ServerInfo, SidepanelEntrypoint, SidepanelEntrypointOptions, TargetBrowser, TargetManifestVersion, ThemeIcon, UnlistedScriptDefinition, UnlistedScriptEntrypoint, UserConfig, UserManifest, UserManifestFn, WebExtConfig, Wxt, WxtBuilder, WxtBuilderServer, WxtCommand, WxtDevServer, WxtDirEntry, WxtDirFileEntry, WxtDirTypeReferenceEntry, WxtHooks, WxtModule, WxtModuleOptions, WxtModuleSetup, WxtModuleWithMetadata, WxtPackageManager, WxtPlugin, WxtResolvedUnimportOptions, WxtUnimportOptions, WxtViteConfig };
1686
+ export { BackgroundDefinition, BackgroundEntrypoint, BackgroundEntrypointOptions, BaseContentScriptEntrypointOptions, BaseEntrypoint, BaseEntrypointOptions, BaseScriptEntrypointOptions, BuildOutput, BuildStepOutput, ConfigEnv, ContentScriptDefinition, ContentScriptEntrypoint, CopiedPublicFile, Dependency, Entrypoint, EntrypointGroup, EntrypointInfo, EslintGlobalsPropValue, Eslintrc, ExtensionRunner, FirefoxDataCollectionPermissions, FirefoxDataCollectionType, FsCache, GeneratedPublicFile, GenericEntrypoint, HookResult, InlineConfig, IsolatedWorldContentScriptDefinition, IsolatedWorldContentScriptEntrypointOptions, Logger, MainWorldContentScriptDefinition, MainWorldContentScriptEntrypointOptions, OnContentScriptStopped, OptionsEntrypoint, OptionsEntrypointOptions, OutputAsset, OutputChunk, OutputFile, PerBrowserMap, PerBrowserOption, PopupEntrypoint, PopupEntrypointOptions, PrepareTsconfigs, PublicPathEntry, ReloadContentScriptPayload, ResolvedBasePublicFile, ResolvedConfig$1 as ResolvedConfig, ResolvedEslintrc, ResolvedPerBrowserOptions, ResolvedPublicFile, ServerInfo, SidepanelEntrypoint, SidepanelEntrypointOptions, TargetBrowser, TargetManifestVersion, ThemeIcon, UnlistedScriptDefinition, UnlistedScriptEntrypoint, UserConfig, UserManifest, UserManifestFn, WebExtConfig, Wxt, WxtBuilder, WxtBuilderServer, WxtCommand, WxtDevServer, WxtDirEntry, WxtDirFileEntry, WxtDirTypeReferenceEntry, WxtHooks, WxtModule, WxtModuleOptions, WxtModuleSetup, WxtModuleWithMetadata, WxtPackageManager, WxtPlugin, WxtResolvedUnimportOptions, WxtUnimportOptions, WxtViteConfig };