wxt 0.18.15 → 0.19.0

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 (257) hide show
  1. package/bin/wxt.mjs +1 -1
  2. package/dist/browser/chrome.d.ts +17 -0
  3. package/dist/browser/chrome.mjs +7 -0
  4. package/dist/browser/index.d.ts +18 -0
  5. package/dist/browser/index.mjs +2 -0
  6. package/dist/builtin-modules/index.d.ts +2 -0
  7. package/dist/builtin-modules/index.mjs +2 -0
  8. package/dist/builtin-modules/unimport.d.ts +8 -0
  9. package/dist/builtin-modules/unimport.mjs +99 -0
  10. package/dist/cli/cli-utils.d.ts +25 -0
  11. package/dist/cli/cli-utils.mjs +58 -0
  12. package/dist/cli/commands.d.ts +2 -0
  13. package/dist/cli/commands.mjs +104 -0
  14. package/dist/cli/index.d.ts +1 -0
  15. package/dist/cli/index.mjs +11 -0
  16. package/dist/client/app-config.d.ts +2 -0
  17. package/dist/client/app-config.mjs +4 -0
  18. package/dist/client/content-scripts/content-script-context.d.ts +114 -0
  19. package/dist/client/content-scripts/content-script-context.mjs +169 -0
  20. package/dist/client/content-scripts/custom-events.d.ts +10 -0
  21. package/dist/client/content-scripts/custom-events.mjs +13 -0
  22. package/dist/client/content-scripts/index.d.ts +2 -0
  23. package/dist/client/content-scripts/index.mjs +2 -0
  24. package/dist/client/content-scripts/location-watcher.d.ts +12 -0
  25. package/dist/client/content-scripts/location-watcher.mjs +22 -0
  26. package/dist/client/content-scripts/ui/index.d.ts +23 -0
  27. package/dist/client/content-scripts/ui/index.mjs +188 -0
  28. package/dist/{client.d.ts → client/content-scripts/ui/types.d.ts} +17 -45
  29. package/dist/client/content-scripts/ui/types.mjs +0 -0
  30. package/dist/client/index.d.ts +7 -0
  31. package/dist/client/index.mjs +2 -0
  32. package/dist/core/build.d.ts +15 -0
  33. package/dist/core/build.mjs +6 -0
  34. package/dist/core/builders/vite/index.d.ts +3 -0
  35. package/dist/core/builders/vite/index.mjs +285 -0
  36. package/dist/core/builders/vite/plugins/bundleAnalysis.d.ts +7 -0
  37. package/dist/core/builders/vite/plugins/bundleAnalysis.mjs +15 -0
  38. package/dist/core/builders/vite/plugins/cssEntrypoints.d.ts +13 -0
  39. package/dist/core/builders/vite/plugins/cssEntrypoints.mjs +22 -0
  40. package/dist/core/builders/vite/plugins/defineImportMeta.d.ts +14 -0
  41. package/dist/core/builders/vite/plugins/defineImportMeta.mjs +13 -0
  42. package/dist/core/builders/vite/plugins/devHtmlPrerender.d.ts +7 -0
  43. package/dist/core/builders/vite/plugins/devHtmlPrerender.mjs +140 -0
  44. package/dist/core/builders/vite/plugins/devServerGlobals.d.ts +6 -0
  45. package/dist/core/builders/vite/plugins/devServerGlobals.mjs +15 -0
  46. package/dist/core/builders/vite/plugins/download.d.ts +10 -0
  47. package/dist/core/builders/vite/plugins/download.mjs +14 -0
  48. package/dist/core/builders/vite/plugins/entrypointGroupGlobals.d.ts +6 -0
  49. package/dist/core/builders/vite/plugins/entrypointGroupGlobals.mjs +16 -0
  50. package/dist/core/builders/vite/plugins/extensionApiMock.d.ts +11 -0
  51. package/dist/core/builders/vite/plugins/extensionApiMock.mjs +26 -0
  52. package/dist/core/builders/vite/plugins/globals.d.ts +3 -0
  53. package/dist/core/builders/vite/plugins/globals.mjs +15 -0
  54. package/dist/core/builders/vite/plugins/index.d.ts +17 -0
  55. package/dist/core/builders/vite/plugins/index.mjs +17 -0
  56. package/dist/core/builders/vite/plugins/multipageMove.d.ts +20 -0
  57. package/dist/core/builders/vite/plugins/multipageMove.mjs +59 -0
  58. package/dist/core/builders/vite/plugins/noopBackground.d.ts +6 -0
  59. package/dist/core/builders/vite/plugins/noopBackground.mjs +17 -0
  60. package/dist/core/builders/vite/plugins/removeEntrypointMainFunction.d.ts +6 -0
  61. package/dist/core/builders/vite/plugins/removeEntrypointMainFunction.mjs +12 -0
  62. package/dist/core/builders/vite/plugins/resolveAppConfig.d.ts +6 -0
  63. package/dist/core/builders/vite/plugins/resolveAppConfig.mjs +26 -0
  64. package/dist/core/builders/vite/plugins/resolveExtensionApi.d.ts +10 -0
  65. package/dist/core/builders/vite/plugins/resolveExtensionApi.mjs +15 -0
  66. package/dist/core/builders/vite/plugins/resolveVirtualModules.d.ts +6 -0
  67. package/dist/core/builders/vite/plugins/resolveVirtualModules.mjs +30 -0
  68. package/dist/core/builders/vite/plugins/tsconfigPaths.d.ts +3 -0
  69. package/dist/core/builders/vite/plugins/tsconfigPaths.mjs +12 -0
  70. package/dist/core/builders/vite/plugins/wxtPluginLoader.d.ts +6 -0
  71. package/dist/core/builders/vite/plugins/wxtPluginLoader.mjs +56 -0
  72. package/dist/core/clean.d.ts +21 -0
  73. package/dist/core/clean.mjs +38 -0
  74. package/dist/core/create-server.d.ts +11 -0
  75. package/dist/core/create-server.mjs +206 -0
  76. package/dist/core/define-config.d.ts +2 -0
  77. package/dist/core/define-config.mjs +3 -0
  78. package/dist/core/define-runner-config.d.ts +2 -0
  79. package/dist/core/define-runner-config.mjs +3 -0
  80. package/dist/core/index.d.ts +8 -0
  81. package/dist/core/index.mjs +8 -0
  82. package/dist/core/initialize.d.ts +5 -0
  83. package/dist/core/initialize.mjs +128 -0
  84. package/dist/core/package-managers/bun.d.ts +2 -0
  85. package/dist/core/package-managers/bun.mjs +19 -0
  86. package/dist/core/package-managers/index.d.ts +2 -0
  87. package/dist/core/package-managers/index.mjs +65 -0
  88. package/dist/core/package-managers/npm.d.ts +17 -0
  89. package/dist/core/package-managers/npm.mjs +58 -0
  90. package/dist/core/package-managers/pnpm.d.ts +2 -0
  91. package/dist/core/package-managers/pnpm.mjs +21 -0
  92. package/dist/core/package-managers/types.d.ts +2 -0
  93. package/dist/core/package-managers/types.mjs +0 -0
  94. package/dist/core/package-managers/yarn.d.ts +2 -0
  95. package/dist/core/package-managers/yarn.mjs +31 -0
  96. package/dist/core/prepare.d.ts +2 -0
  97. package/dist/core/prepare.mjs +8 -0
  98. package/dist/core/runners/index.d.ts +2 -0
  99. package/dist/core/runners/index.mjs +12 -0
  100. package/dist/core/runners/manual.d.ts +5 -0
  101. package/dist/core/runners/manual.mjs +16 -0
  102. package/dist/core/runners/safari.d.ts +5 -0
  103. package/dist/core/runners/safari.mjs +16 -0
  104. package/dist/core/runners/web-ext.d.ts +5 -0
  105. package/dist/core/runners/web-ext.mjs +78 -0
  106. package/dist/core/runners/wsl.d.ts +5 -0
  107. package/dist/core/runners/wsl.mjs +16 -0
  108. package/dist/core/utils/arrays.d.ts +13 -0
  109. package/dist/{chunk-BERPNPEZ.js → core/utils/arrays.mjs} +6 -10
  110. package/dist/core/utils/building/build-entrypoints.d.ts +3 -0
  111. package/dist/core/utils/building/build-entrypoints.mjs +47 -0
  112. package/dist/core/utils/building/detect-dev-changes.d.ts +57 -0
  113. package/dist/core/utils/building/detect-dev-changes.mjs +93 -0
  114. package/dist/core/utils/building/find-entrypoints.d.ts +5 -0
  115. package/dist/core/utils/building/find-entrypoints.mjs +385 -0
  116. package/dist/core/utils/building/generate-wxt-dir.d.ts +5 -0
  117. package/dist/core/utils/building/generate-wxt-dir.mjs +192 -0
  118. package/dist/core/utils/building/group-entrypoints.d.ts +8 -0
  119. package/dist/core/utils/building/group-entrypoints.mjs +37 -0
  120. package/dist/core/utils/building/import-entrypoint.d.ts +16 -0
  121. package/dist/core/utils/building/import-entrypoint.mjs +97 -0
  122. package/dist/core/utils/building/index.d.ts +9 -0
  123. package/dist/core/utils/building/index.mjs +9 -0
  124. package/dist/core/utils/building/internal-build.d.ts +12 -0
  125. package/dist/core/utils/building/internal-build.mjs +112 -0
  126. package/dist/core/utils/building/rebuild.d.ts +23 -0
  127. package/dist/core/utils/building/rebuild.mjs +39 -0
  128. package/dist/core/utils/building/resolve-config.d.ts +11 -0
  129. package/dist/core/utils/building/resolve-config.mjs +364 -0
  130. package/dist/core/utils/cache.d.ts +8 -0
  131. package/dist/core/utils/cache.mjs +21 -0
  132. package/dist/core/utils/cli.d.ts +3 -0
  133. package/dist/core/utils/cli.mjs +26 -0
  134. package/dist/core/utils/constants.d.ts +5 -0
  135. package/dist/core/utils/constants.mjs +1 -0
  136. package/dist/core/utils/content-scripts.d.ts +11 -0
  137. package/dist/core/utils/content-scripts.mjs +60 -0
  138. package/dist/core/utils/content-security-policy.d.ts +14 -0
  139. package/dist/core/utils/content-security-policy.mjs +39 -0
  140. package/dist/core/utils/entrypoints.d.ts +25 -0
  141. package/dist/core/utils/entrypoints.mjs +31 -0
  142. package/dist/core/utils/eslint.d.ts +1 -0
  143. package/dist/core/utils/eslint.mjs +11 -0
  144. package/dist/core/utils/fs.d.ts +13 -0
  145. package/dist/core/utils/fs.mjs +15 -0
  146. package/dist/core/utils/globals.d.ts +11 -0
  147. package/dist/core/utils/globals.mjs +53 -0
  148. package/dist/core/utils/i18n.d.ts +11 -0
  149. package/dist/core/utils/i18n.mjs +35 -0
  150. package/dist/core/utils/log/index.d.ts +4 -0
  151. package/dist/core/utils/log/index.mjs +4 -0
  152. package/dist/core/utils/log/printBuildSummary.d.ts +2 -0
  153. package/dist/core/utils/log/printBuildSummary.mjs +32 -0
  154. package/dist/core/utils/log/printFileList.d.ts +1 -0
  155. package/dist/core/utils/log/printFileList.mjs +42 -0
  156. package/dist/core/utils/log/printHeader.d.ts +1 -0
  157. package/dist/core/utils/log/printHeader.mjs +7 -0
  158. package/dist/core/utils/log/printTable.d.ts +1 -0
  159. package/dist/core/utils/log/printTable.mjs +22 -0
  160. package/dist/core/utils/manifest.d.ts +44 -0
  161. package/dist/core/utils/manifest.mjs +512 -0
  162. package/dist/core/utils/network.d.ts +7 -0
  163. package/dist/core/utils/network.mjs +38 -0
  164. package/dist/core/utils/package.d.ts +6 -0
  165. package/dist/core/utils/package.mjs +14 -0
  166. package/dist/core/utils/paths.d.ts +11 -0
  167. package/dist/core/utils/paths.mjs +10 -0
  168. package/dist/core/utils/strings.d.ts +14 -0
  169. package/dist/core/utils/strings.mjs +18 -0
  170. package/dist/core/utils/testing/fake-objects.d.ts +4556 -0
  171. package/dist/core/utils/testing/fake-objects.mjs +322 -0
  172. package/dist/core/utils/time.d.ts +9 -0
  173. package/dist/core/utils/time.mjs +17 -0
  174. package/dist/core/utils/transform.d.ts +9 -0
  175. package/dist/core/utils/transform.mjs +17 -0
  176. package/dist/core/utils/types.d.ts +10 -0
  177. package/dist/core/utils/types.mjs +0 -0
  178. package/dist/core/utils/validation.d.ts +15 -0
  179. package/dist/core/utils/validation.mjs +55 -0
  180. package/dist/core/utils/virtual-modules.d.ts +22 -0
  181. package/dist/core/utils/virtual-modules.mjs +14 -0
  182. package/dist/core/utils/wsl.d.ts +4 -0
  183. package/dist/core/utils/wsl.mjs +4 -0
  184. package/dist/core/wxt.d.ts +19 -0
  185. package/dist/core/wxt.mjs +41 -0
  186. package/dist/core/zip.d.ts +7 -0
  187. package/dist/core/zip.mjs +137 -0
  188. package/dist/index.d.ts +4 -79
  189. package/dist/index.mjs +3 -0
  190. package/dist/modules.d.ts +10 -20
  191. package/dist/{chunk-6XSIWUWF.js → modules.mjs} +7 -16
  192. package/dist/sandbox/define-app-config.d.ts +19 -0
  193. package/dist/sandbox/define-app-config.mjs +3 -0
  194. package/dist/sandbox/define-background.d.ts +3 -0
  195. package/dist/sandbox/define-background.mjs +4 -0
  196. package/dist/sandbox/define-content-script.d.ts +2 -0
  197. package/dist/sandbox/define-content-script.mjs +3 -0
  198. package/dist/sandbox/define-unlisted-script.d.ts +3 -0
  199. package/dist/sandbox/define-unlisted-script.mjs +4 -0
  200. package/dist/sandbox/define-wxt-plugin.d.ts +2 -0
  201. package/dist/sandbox/define-wxt-plugin.mjs +3 -0
  202. package/dist/sandbox/dev-server-websocket.d.ts +21 -0
  203. package/dist/sandbox/dev-server-websocket.mjs +37 -0
  204. package/dist/sandbox/index.d.ts +11 -0
  205. package/dist/sandbox/index.mjs +6 -0
  206. package/dist/sandbox/utils/logger.d.ts +9 -0
  207. package/dist/sandbox/utils/logger.mjs +15 -0
  208. package/dist/storage.d.ts +39 -16
  209. package/dist/{storage.js → storage.mjs} +30 -41
  210. package/dist/testing/fake-browser.d.ts +1 -0
  211. package/dist/testing/fake-browser.mjs +1 -0
  212. package/dist/testing/index.d.ts +5 -0
  213. package/dist/testing/index.mjs +2 -0
  214. package/dist/{testing.d.ts → testing/wxt-vitest-plugin.d.ts} +3 -15
  215. package/dist/testing/wxt-vitest-plugin.mjs +26 -0
  216. package/dist/{index-nWRfwAJi.d.cts → types.d.ts} +150 -264
  217. package/dist/types.mjs +0 -0
  218. package/dist/version.d.ts +1 -0
  219. package/dist/version.mjs +1 -0
  220. package/dist/virtual/{background-entrypoint.js → background-entrypoint.mjs} +31 -40
  221. package/dist/virtual/{content-script-isolated-world-entrypoint.js → content-script-isolated-world-entrypoint.mjs} +9 -13
  222. package/dist/virtual/{content-script-main-world-entrypoint.js → content-script-main-world-entrypoint.mjs} +9 -14
  223. package/dist/virtual/mock-browser.mjs +6 -0
  224. package/dist/virtual/{reload-html.js → reload-html.mjs} +8 -9
  225. package/dist/virtual/{unlisted-script-entrypoint.js → unlisted-script-entrypoint.mjs} +8 -12
  226. package/package.json +47 -57
  227. package/dist/browser.d.ts +0 -18
  228. package/dist/browser.js +0 -6
  229. package/dist/chunk-BM6QYGAW.js +0 -1063
  230. package/dist/chunk-FNTE2L27.js +0 -7
  231. package/dist/chunk-FP7RYLVL.js +0 -3617
  232. package/dist/chunk-KPD5J7PZ.js +0 -1065
  233. package/dist/chunk-QGM4M3NI.js +0 -37
  234. package/dist/chunk-SGKCDMVR.js +0 -38
  235. package/dist/cli.d.ts +0 -2
  236. package/dist/cli.js +0 -4438
  237. package/dist/client.js +0 -424
  238. package/dist/define-app-config-bg54F_lV.d.ts +0 -294
  239. package/dist/execa-4UBDUBJZ.js +0 -7244
  240. package/dist/execa-QLUM2B3W.js +0 -7245
  241. package/dist/index-nWRfwAJi.d.ts +0 -1401
  242. package/dist/index.cjs +0 -14473
  243. package/dist/index.d.cts +0 -81
  244. package/dist/index.js +0 -696
  245. package/dist/modules.cjs +0 -96
  246. package/dist/modules.d.cts +0 -119
  247. package/dist/modules.js +0 -17
  248. package/dist/prompt-25QIVJDC.js +0 -755
  249. package/dist/prompt-7BMKNSWS.js +0 -754
  250. package/dist/sandbox.d.ts +0 -16
  251. package/dist/sandbox.js +0 -36
  252. package/dist/storage.cjs +0 -439
  253. package/dist/storage.d.cts +0 -200
  254. package/dist/testing.cjs +0 -2815
  255. package/dist/testing.d.cts +0 -30
  256. package/dist/testing.js +0 -40
  257. package/dist/virtual/mock-browser.js +0 -6
@@ -1,133 +1,14 @@
1
- import * as vite from 'vite';
2
- import { Manifest, Scripting } from 'webextension-polyfill';
1
+ import type * as vite from 'vite';
2
+ import type { Manifest, Scripting } from 'wxt/browser';
3
3
  import { UnimportOptions, Import } from 'unimport';
4
4
  import { LogLevel } from 'consola';
5
- import { PluginVisualizerOptions } from '@aklinker1/rollup-plugin-visualizer';
6
- import { FSWatcher } from 'chokidar';
7
- import { ResolvedConfig as ResolvedConfig$1 } from 'c12';
8
- import { NestedHooks, Hookable } from 'hookable';
9
- import * as Nypm from 'nypm';
10
-
11
- declare class WxtLocationChangeEvent extends Event {
12
- readonly newUrl: URL;
13
- readonly oldUrl: URL;
14
- static EVENT_NAME: string;
15
- constructor(newUrl: URL, oldUrl: URL);
16
- }
17
-
18
- /**
19
- * Implements [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
20
- * Used to detect and stop content script code when the script is invalidated.
21
- *
22
- * It also provides several utilities like `ctx.setTimeout` and `ctx.setInterval` that should be used in
23
- * content scripts instead of `window.setTimeout` or `window.setInterval`.
24
- *
25
- * To create context for testing, you can use the class's constructor:
26
- *
27
- * ```ts
28
- * import { ContentScriptContext } from 'wxt/client';
29
- *
30
- * test("storage listener should be removed when context is invalidated", () => {
31
- * const ctx = new ContentScriptContext('test');
32
- * const item = storage.defineItem("local:count", { defaultValue: 0 });
33
- * const watcher = vi.fn();
34
- *
35
- * const unwatch = item.watch(watcher);
36
- * ctx.onInvalidated(unwatch); // Listen for invalidate here
37
- *
38
- * await item.setValue(1);
39
- * expect(watcher).toBeCalledTimes(1);
40
- * expect(watcher).toBeCalledWith(1, 0);
41
- *
42
- * ctx.notifyInvalidated(); // Use this function to invalidate the context
43
- * await item.setValue(2);
44
- * expect(watcher).toBeCalledTimes(1);
45
- * });
46
- * ```
47
- */
48
- declare class ContentScriptContext implements AbortController {
49
- #private;
50
- private readonly contentScriptName;
51
- readonly options?: Omit<ContentScriptDefinition, "main"> | undefined;
52
- private static SCRIPT_STARTED_MESSAGE_TYPE;
53
- constructor(contentScriptName: string, options?: Omit<ContentScriptDefinition, "main"> | undefined);
54
- get signal(): AbortSignal;
55
- abort(reason?: any): void;
56
- get isInvalid(): boolean;
57
- get isValid(): boolean;
58
- /**
59
- * Add a listener that is called when the content script's context is invalidated.
60
- *
61
- * @returns A function to remove the listener.
62
- *
63
- * @example
64
- * browser.runtime.onMessage.addListener(cb);
65
- * const removeInvalidatedListener = ctx.onInvalidated(() => {
66
- * browser.runtime.onMessage.removeListener(cb);
67
- * })
68
- * // ...
69
- * removeInvalidatedListener();
70
- */
71
- onInvalidated(cb: () => void): () => void;
72
- /**
73
- * Return a promise that never resolves. Useful if you have an async function that shouldn't run
74
- * after the context is expired.
75
- *
76
- * @example
77
- * const getValueFromStorage = async () => {
78
- * if (ctx.isInvalid) return ctx.block();
79
- *
80
- * // ...
81
- * }
82
- */
83
- block<T>(): Promise<T>;
84
- /**
85
- * Wrapper around `window.setInterval` that automatically clears the interval when invalidated.
86
- */
87
- setInterval(handler: () => void, timeout?: number): number;
88
- /**
89
- * Wrapper around `window.setTimeout` that automatically clears the interval when invalidated.
90
- */
91
- setTimeout(handler: () => void, timeout?: number): number;
92
- /**
93
- * Wrapper around `window.requestAnimationFrame` that automatically cancels the request when
94
- * invalidated.
95
- */
96
- requestAnimationFrame(callback: FrameRequestCallback): number;
97
- /**
98
- * Wrapper around `window.requestIdleCallback` that automatically cancels the request when
99
- * invalidated.
100
- */
101
- requestIdleCallback(callback: IdleRequestCallback, options?: IdleRequestOptions): number;
102
- /**
103
- * Call `target.addEventListener` and remove the event listener when the context is invalidated.
104
- *
105
- * Includes additional events useful for content scripts:
106
- *
107
- * - `"wxt:locationchange"` - Triggered when HTML5 history mode is used to change URL. Content
108
- * scripts are not reloaded when navigating this way, so this can be used to reset the content
109
- * script state on URL change, or run custom code.
110
- *
111
- * @example
112
- * ctx.addEventListener(document, "visibilitychange", () => {
113
- * // ...
114
- * });
115
- * ctx.addEventListener(document, "wxt:locationchange", () => {
116
- * // ...
117
- * });
118
- */
119
- addEventListener<TTarget extends EventTarget, TType extends keyof WxtContentScriptEventMap>(target: TTarget, type: TType, handler: (event: WxtContentScriptEventMap[TType]) => void, options?: AddEventListenerOptions): void;
120
- /**
121
- * @internal
122
- * Abort the abort controller and execute all `onInvalidated` listeners.
123
- */
124
- notifyInvalidated(): void;
125
- }
126
- interface WxtContentScriptEventMap extends WindowEventMap {
127
- 'wxt:locationchange': WxtLocationChangeEvent;
128
- }
129
-
130
- interface InlineConfig {
5
+ import type { ContentScriptContext } from './client/content-scripts/content-script-context';
6
+ import type { PluginVisualizerOptions } from '@aklinker1/rollup-plugin-visualizer';
7
+ import type { FSWatcher } from 'chokidar';
8
+ import { ResolvedConfig as C12ResolvedConfig } from 'c12';
9
+ import { Hookable, NestedHooks } from 'hookable';
10
+ import type * as Nypm from 'nypm';
11
+ export interface InlineConfig {
131
12
  /**
132
13
  * Your project's root directory containing the `package.json` used to fill out the
133
14
  * `manifest.json`.
@@ -409,43 +290,34 @@ interface InlineConfig {
409
290
  * }
410
291
  */
411
292
  alias?: Record<string, string>;
293
+ /**
294
+ * Which extension API to use.
295
+ *
296
+ * - `"webextension-polyfill"`: Use `browser` and types from [`webextension-polyfill`](https://www.npmjs.com/package/webextension-polyfill).
297
+ * - `"chrome"` (unstable): Use the regular `chrome` (or `browser` for Firefox/Safari) globals provided by the browser. Types provided by [`@types/chrome`](https://www.npmjs.com/package/@types/chrome), make sure to install the package or types won't work.
298
+ *
299
+ * @default "webextension-polyfill"
300
+ * @since 0.19.0
301
+ */
302
+ extensionApi?: 'webextension-polyfill' | 'chrome';
303
+ /**
304
+ * @deprecated Will be removed in v0.20.0, please migrate to using `vite-node`, the new default.
305
+ *
306
+ * Method used to import entrypoint files during the build process to extract their options.
307
+ *
308
+ * - `"vite-node"` (default as of 0.19.0): Uses `vite-node` to import the entrypoints. Automatically includes vite config based on your wxt.config.ts file
309
+ * - `"jiti"`: Simplest and fastest, but doesn't allow using any imported variables outside the entrypoint's main function
310
+ *
311
+ * @see {@link https://wxt.dev/guide/go-further/entrypoint-importers.html|Entrypoint Importers}
312
+ *
313
+ * @default "vite-node"
314
+ * @since 0.19.0
315
+ */
316
+ entrypointLoader?: 'vite-node' | 'jiti';
412
317
  /**
413
318
  * Experimental settings - use with caution.
414
319
  */
415
- experimental?: {
416
- /**
417
- * Whether to use [`webextension-polyfill`](https://www.npmjs.com/package/webextension-polyfill)
418
- * when importing `browser` from `wxt/browser`.
419
- *
420
- * When set to `false`, WXT will export the chrome global instead of the polyfill from
421
- * `wxt/browser`.
422
- *
423
- * You should use `browser` to access the web extension APIs.
424
- *
425
- * @experimental This option will remain experimental until Manifest V2 is dead.
426
- *
427
- * @default true
428
- * @example
429
- * export default defineConfig({
430
- * experimental: {
431
- * includeBrowserPolyfill: false
432
- * }
433
- * })
434
- */
435
- includeBrowserPolyfill?: boolean;
436
- /**
437
- * Method used to import entrypoint files during the build process to extract their options.
438
- *
439
- * - "jiti": Simplest and fastest, but doesn't allow using any imported variables outside the entrypoint's main function
440
- * - "vite-runtime" (unstable): Uses Vite 5.3's new runtime API to import the entrypoints. Automatically includes vite config based on your wxt.config.ts file
441
- * - "vite-node" (unstable): Uses `vite-node` to import the entrypoints. Automatically includes vite config based on your wxt.config.ts file
442
- *
443
- * @see {@link https://wxt.dev/guide/go-further/entrypoint-side-effects.html|Entrypoint Side-effect Docs}
444
- *
445
- * @default "jiti"
446
- */
447
- entrypointImporter?: 'jiti' | 'vite-runtime' | 'vite-node';
448
- };
320
+ experimental?: {};
449
321
  /**
450
322
  * Config effecting dev mode only.
451
323
  */
@@ -487,7 +359,7 @@ interface InlineConfig {
487
359
  */
488
360
  modules?: string[];
489
361
  }
490
- interface InlineConfig {
362
+ export interface InlineConfig {
491
363
  /**
492
364
  * Return custom Vite options from a function. See
493
365
  * <https://vitejs.dev/config/shared-options.html>.
@@ -500,14 +372,34 @@ interface InlineConfig {
500
372
  */
501
373
  vite?: (env: ConfigEnv) => WxtViteConfig | Promise<WxtViteConfig>;
502
374
  }
503
- type WxtViteConfig = Omit<vite.UserConfig, 'root' | 'configFile' | 'mode'>;
504
- interface BuildOutput {
375
+ export interface ResolvedConfig {
376
+ vite: (env: ConfigEnv) => WxtViteConfig | Promise<WxtViteConfig>;
377
+ }
378
+ export type WxtViteConfig = Omit<vite.UserConfig, 'root' | 'configFile' | 'mode'>;
379
+ export interface WxtHooks {
380
+ /**
381
+ * Called when WXT has created Vite's config for a build step. Useful if you
382
+ * want to add plugins or update the vite config per entrypoint group.
383
+ *
384
+ * @param entrypoints The list of entrypoints being built with the provided config.
385
+ * @param viteConfig The config that will be used for the dev server.
386
+ */
387
+ 'vite:build:extendConfig': (entrypoints: readonly Entrypoint[], viteConfig: vite.InlineConfig) => HookResult;
388
+ /**
389
+ * Called when WXT has created Vite's config for the dev server. Useful if
390
+ * you want to add plugins or update the vite config per entrypoint group.
391
+ *
392
+ * @param viteConfig The config that will be used to build the entrypoints. Can be updated by reference.
393
+ */
394
+ 'vite:devServer:extendConfig': (config: vite.InlineConfig) => HookResult;
395
+ }
396
+ export interface BuildOutput {
505
397
  manifest: Manifest.WebExtensionManifest;
506
398
  publicAssets: OutputAsset[];
507
399
  steps: BuildStepOutput[];
508
400
  }
509
- type OutputFile = OutputChunk | OutputAsset;
510
- interface OutputChunk {
401
+ export type OutputFile = OutputChunk | OutputAsset;
402
+ export interface OutputChunk {
511
403
  type: 'chunk';
512
404
  /**
513
405
  * Relative, normalized path relative to the output directory.
@@ -520,7 +412,7 @@ interface OutputChunk {
520
412
  */
521
413
  moduleIds: string[];
522
414
  }
523
- interface OutputAsset {
415
+ export interface OutputAsset {
524
416
  type: 'asset';
525
417
  /**
526
418
  * Relative, normalized path relative to the output directory.
@@ -529,11 +421,11 @@ interface OutputAsset {
529
421
  */
530
422
  fileName: string;
531
423
  }
532
- interface BuildStepOutput {
424
+ export interface BuildStepOutput {
533
425
  entrypoints: EntrypointGroup;
534
426
  chunks: OutputFile[];
535
427
  }
536
- interface WxtDevServer extends Omit<WxtBuilderServer, 'listen' | 'close'>, ServerInfo {
428
+ export interface WxtDevServer extends Omit<WxtBuilderServer, 'listen' | 'close'>, ServerInfo {
537
429
  /**
538
430
  * Stores the current build output of the server.
539
431
  */
@@ -581,14 +473,14 @@ interface WxtDevServer extends Omit<WxtBuilderServer, 'listen' | 'close'>, Serve
581
473
  */
582
474
  restartBrowser: () => void;
583
475
  }
584
- interface ReloadContentScriptPayload {
476
+ export interface ReloadContentScriptPayload {
585
477
  registration?: BaseContentScriptEntrypointOptions['registration'];
586
478
  contentScript: Omit<Scripting.RegisteredContentScript, 'id'>;
587
479
  }
588
- type TargetBrowser = string;
589
- type TargetManifestVersion = 2 | 3;
590
- type UserConfig = Omit<InlineConfig, 'configFile'>;
591
- interface Logger {
480
+ export type TargetBrowser = string;
481
+ export type TargetManifestVersion = 2 | 3;
482
+ export type UserConfig = Omit<InlineConfig, 'configFile'>;
483
+ export interface Logger {
592
484
  debug(...args: any[]): void;
593
485
  log(...args: any[]): void;
594
486
  info(...args: any[]): void;
@@ -598,7 +490,7 @@ interface Logger {
598
490
  success(...args: any[]): void;
599
491
  level: LogLevel;
600
492
  }
601
- interface BaseEntrypointOptions {
493
+ export interface BaseEntrypointOptions {
602
494
  /**
603
495
  * List of target browsers to include this entrypoint in. Defaults to being included in all
604
496
  * builds. Cannot be used with `exclude`. You must choose one of the two options.
@@ -614,7 +506,7 @@ interface BaseEntrypointOptions {
614
506
  */
615
507
  exclude?: TargetBrowser[];
616
508
  }
617
- interface BackgroundEntrypointOptions extends BaseEntrypointOptions {
509
+ export interface BackgroundEntrypointOptions extends BaseEntrypointOptions {
618
510
  persistent?: PerBrowserOption<boolean>;
619
511
  /**
620
512
  * Set to `"module"` to output the background entrypoint as ESM. ESM outputs can share chunks and
@@ -626,7 +518,7 @@ interface BackgroundEntrypointOptions extends BaseEntrypointOptions {
626
518
  */
627
519
  type?: PerBrowserOption<'module'>;
628
520
  }
629
- interface BaseContentScriptEntrypointOptions extends BaseEntrypointOptions {
521
+ export interface BaseContentScriptEntrypointOptions extends BaseEntrypointOptions {
630
522
  matches: PerBrowserOption<Manifest.ContentScript['matches']>;
631
523
  /**
632
524
  * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
@@ -690,20 +582,20 @@ interface BaseContentScriptEntrypointOptions extends BaseEntrypointOptions {
690
582
  */
691
583
  registration?: PerBrowserOption<'manifest' | 'runtime'>;
692
584
  }
693
- interface MainWorldContentScriptEntrypointOptions extends BaseContentScriptEntrypointOptions {
585
+ export interface MainWorldContentScriptEntrypointOptions extends BaseContentScriptEntrypointOptions {
694
586
  /**
695
587
  * See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
696
588
  */
697
589
  world: 'MAIN';
698
590
  }
699
- interface IsolatedWorldContentScriptEntrypointOptions extends BaseContentScriptEntrypointOptions {
591
+ export interface IsolatedWorldContentScriptEntrypointOptions extends BaseContentScriptEntrypointOptions {
700
592
  /**
701
593
  * See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
702
594
  * @default "ISOLATED"
703
595
  */
704
596
  world?: 'ISOLATED';
705
597
  }
706
- interface PopupEntrypointOptions extends BaseEntrypointOptions {
598
+ export interface PopupEntrypointOptions extends BaseEntrypointOptions {
707
599
  /**
708
600
  * Defaults to "browser_action" to be equivalent to MV3's "action" key
709
601
  */
@@ -712,12 +604,12 @@ interface PopupEntrypointOptions extends BaseEntrypointOptions {
712
604
  defaultTitle?: PerBrowserOption<string>;
713
605
  browserStyle?: PerBrowserOption<boolean>;
714
606
  }
715
- interface OptionsEntrypointOptions extends BaseEntrypointOptions {
607
+ export interface OptionsEntrypointOptions extends BaseEntrypointOptions {
716
608
  openInTab?: PerBrowserOption<boolean>;
717
609
  browserStyle?: PerBrowserOption<boolean>;
718
610
  chromeStyle?: PerBrowserOption<boolean>;
719
611
  }
720
- interface SidepanelEntrypointOptions extends BaseEntrypointOptions {
612
+ export interface SidepanelEntrypointOptions extends BaseEntrypointOptions {
721
613
  /**
722
614
  * Firefox only. See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/sidebar_action#syntax
723
615
  * @default false
@@ -730,7 +622,7 @@ interface SidepanelEntrypointOptions extends BaseEntrypointOptions {
730
622
  defaultIcon?: string | Record<string, string>;
731
623
  defaultTitle?: PerBrowserOption<string>;
732
624
  }
733
- interface BaseEntrypoint {
625
+ export interface BaseEntrypoint {
734
626
  /**
735
627
  * The entrypoint's name. This is the filename or dirname without the type suffix.
736
628
  *
@@ -759,34 +651,34 @@ interface BaseEntrypoint {
759
651
  outputDir: string;
760
652
  skipped: boolean;
761
653
  }
762
- interface GenericEntrypoint extends BaseEntrypoint {
654
+ export interface GenericEntrypoint extends BaseEntrypoint {
763
655
  type: 'sandbox' | 'bookmarks' | 'history' | 'newtab' | 'devtools' | 'unlisted-page' | 'unlisted-script' | 'unlisted-style' | 'content-script-style';
764
656
  options: ResolvedPerBrowserOptions<BaseEntrypointOptions>;
765
657
  }
766
- interface BackgroundEntrypoint extends BaseEntrypoint {
658
+ export interface BackgroundEntrypoint extends BaseEntrypoint {
767
659
  type: 'background';
768
660
  options: ResolvedPerBrowserOptions<BackgroundEntrypointOptions>;
769
661
  }
770
- interface ContentScriptEntrypoint extends BaseEntrypoint {
662
+ export interface ContentScriptEntrypoint extends BaseEntrypoint {
771
663
  type: 'content-script';
772
664
  options: ResolvedPerBrowserOptions<MainWorldContentScriptEntrypointOptions | IsolatedWorldContentScriptEntrypointOptions>;
773
665
  }
774
- interface PopupEntrypoint extends BaseEntrypoint {
666
+ export interface PopupEntrypoint extends BaseEntrypoint {
775
667
  type: 'popup';
776
668
  options: ResolvedPerBrowserOptions<PopupEntrypointOptions, 'defaultIcon'>;
777
669
  }
778
- interface OptionsEntrypoint extends BaseEntrypoint {
670
+ export interface OptionsEntrypoint extends BaseEntrypoint {
779
671
  type: 'options';
780
672
  options: ResolvedPerBrowserOptions<OptionsEntrypointOptions>;
781
673
  }
782
- interface SidepanelEntrypoint extends BaseEntrypoint {
674
+ export interface SidepanelEntrypoint extends BaseEntrypoint {
783
675
  type: 'sidepanel';
784
676
  options: ResolvedPerBrowserOptions<SidepanelEntrypointOptions, 'defaultIcon'>;
785
677
  }
786
- type Entrypoint = GenericEntrypoint | BackgroundEntrypoint | ContentScriptEntrypoint | PopupEntrypoint | OptionsEntrypoint | SidepanelEntrypoint;
787
- type EntrypointGroup = Entrypoint | Entrypoint[];
788
- type OnContentScriptStopped = (cb: () => void) => void;
789
- interface IsolatedWorldContentScriptDefinition extends IsolatedWorldContentScriptEntrypointOptions {
678
+ export type Entrypoint = GenericEntrypoint | BackgroundEntrypoint | ContentScriptEntrypoint | PopupEntrypoint | OptionsEntrypoint | SidepanelEntrypoint;
679
+ export type EntrypointGroup = Entrypoint | Entrypoint[];
680
+ export type OnContentScriptStopped = (cb: () => void) => void;
681
+ export interface IsolatedWorldContentScriptDefinition extends IsolatedWorldContentScriptEntrypointOptions {
790
682
  /**
791
683
  * Main function executed when the content script is loaded.
792
684
  *
@@ -796,7 +688,7 @@ interface IsolatedWorldContentScriptDefinition extends IsolatedWorldContentScrip
796
688
  */
797
689
  main(ctx: ContentScriptContext): any | Promise<any>;
798
690
  }
799
- interface MainWorldContentScriptDefinition extends MainWorldContentScriptEntrypointOptions {
691
+ export interface MainWorldContentScriptDefinition extends MainWorldContentScriptEntrypointOptions {
800
692
  /**
801
693
  * Main function executed when the content script is loaded.
802
694
  *
@@ -806,14 +698,14 @@ interface MainWorldContentScriptDefinition extends MainWorldContentScriptEntrypo
806
698
  */
807
699
  main(): any | Promise<any>;
808
700
  }
809
- type ContentScriptDefinition = IsolatedWorldContentScriptDefinition | MainWorldContentScriptDefinition;
810
- interface BackgroundDefinition extends BackgroundEntrypointOptions {
701
+ export type ContentScriptDefinition = IsolatedWorldContentScriptDefinition | MainWorldContentScriptDefinition;
702
+ export interface BackgroundDefinition extends BackgroundEntrypointOptions {
811
703
  /**
812
704
  * Main function executed when the background script is started. Cannot be async.
813
705
  */
814
706
  main(): void;
815
707
  }
816
- interface UnlistedScriptDefinition extends BaseEntrypointOptions {
708
+ export interface UnlistedScriptDefinition extends BaseEntrypointOptions {
817
709
  /**
818
710
  * Main function executed when the unlisted script is ran.
819
711
  *
@@ -826,8 +718,8 @@ interface UnlistedScriptDefinition extends BaseEntrypointOptions {
826
718
  /**
827
719
  * Either a single value or a map of different browsers to the value for that browser.
828
720
  */
829
- type PerBrowserOption<T> = T | PerBrowserMap<T>;
830
- type PerBrowserMap<T> = {
721
+ export type PerBrowserOption<T> = T | PerBrowserMap<T>;
722
+ export type PerBrowserMap<T> = {
831
723
  [browser: TargetBrowser]: T;
832
724
  };
833
725
  /**
@@ -836,7 +728,7 @@ type PerBrowserMap<T> = {
836
728
  *
837
729
  * A optional second list of keys can be passed if a field isn't compatible with `PerBrowserOption`, like `defaultIcon`.
838
730
  */
839
- type ResolvedPerBrowserOptions<T, TOmitted extends keyof T = never> = {
731
+ export type ResolvedPerBrowserOptions<T, TOmitted extends keyof T = never> = {
840
732
  [key in keyof Omit<T, TOmitted>]: T[key] extends PerBrowserOption<infer U> ? U : T[key];
841
733
  } & {
842
734
  [key in TOmitted]: T[key];
@@ -845,9 +737,9 @@ type ResolvedPerBrowserOptions<T, TOmitted extends keyof T = never> = {
845
737
  * Manifest customization available in the `wxt.config.ts` file. You cannot configure entrypoints
846
738
  * here, they are configured inline.
847
739
  */
848
- type UserManifest = Partial<Omit<Manifest.WebExtensionManifest, 'background' | 'chrome_url_overrides' | 'devtools_page' | 'manifest_version' | 'options_page' | 'options_ui' | 'sandbox'>>;
849
- type UserManifestFn = (env: ConfigEnv) => UserManifest | Promise<UserManifest>;
850
- interface ConfigEnv {
740
+ export type UserManifest = Partial<Omit<Manifest.WebExtensionManifest, 'background' | 'chrome_url_overrides' | 'devtools_page' | 'manifest_version' | 'options_page' | 'options_ui' | 'sandbox'>>;
741
+ export type UserManifestFn = (env: ConfigEnv) => UserManifest | Promise<UserManifest>;
742
+ export interface ConfigEnv {
851
743
  /**
852
744
  * The build mode passed into the CLI. By default, `wxt` uses `"development"` and `wxt build|zip`
853
745
  * uses `"production"`.
@@ -868,11 +760,11 @@ interface ConfigEnv {
868
760
  */
869
761
  manifestVersion: 2 | 3;
870
762
  }
871
- type WxtCommand = 'build' | 'serve';
763
+ export type WxtCommand = 'build' | 'serve';
872
764
  /**
873
765
  * Configure how the browser starts up.
874
766
  */
875
- interface ExtensionRunnerConfig {
767
+ export interface ExtensionRunnerConfig {
876
768
  /**
877
769
  * Whether or not to open the browser with the extension installed in dev mode.
878
770
  *
@@ -954,7 +846,7 @@ interface ExtensionRunnerConfig {
954
846
  */
955
847
  keepProfileChanges?: boolean;
956
848
  }
957
- interface WxtBuilder {
849
+ export interface WxtBuilder {
958
850
  /**
959
851
  * Name of tool used to build. Ex: "Vite" or "Webpack".
960
852
  */
@@ -977,7 +869,7 @@ interface WxtBuilder {
977
869
  */
978
870
  createServer(info: ServerInfo): Promise<WxtBuilderServer>;
979
871
  }
980
- interface WxtBuilderServer {
872
+ export interface WxtBuilderServer {
981
873
  /**
982
874
  * Start the server.
983
875
  */
@@ -1012,7 +904,7 @@ interface WxtBuilderServer {
1012
904
  */
1013
905
  watcher: FSWatcher;
1014
906
  }
1015
- interface ServerInfo {
907
+ export interface ServerInfo {
1016
908
  /**
1017
909
  * Ex: `3000`
1018
910
  */
@@ -1026,25 +918,8 @@ interface ServerInfo {
1026
918
  */
1027
919
  origin: string;
1028
920
  }
1029
- type HookResult = Promise<void> | void;
1030
- interface WxtHooks {
1031
- /**
1032
- * Called when WXT has created Vite's config for a build step. Useful if you
1033
- * want to add plugins or update the vite config per entrypoint group.
1034
- *
1035
- * @param entrypoints The list of entrypoints being built with the provided config.
1036
- * @param viteConfig The config that will be used for the dev server.
1037
- */
1038
- 'vite:build:extendConfig': (entrypoints: readonly Entrypoint[], viteConfig: vite.InlineConfig) => HookResult;
1039
- /**
1040
- * Called when WXT has created Vite's config for the dev server. Useful if
1041
- * you want to add plugins or update the vite config per entrypoint group.
1042
- *
1043
- * @param viteConfig The config that will be used to build the entrypoints. Can be updated by reference.
1044
- */
1045
- 'vite:devServer:extendConfig': (config: vite.InlineConfig) => HookResult;
1046
- }
1047
- interface WxtHooks {
921
+ export type HookResult = Promise<void> | void;
922
+ export interface WxtHooks {
1048
923
  /**
1049
924
  * Called after WXT initialization, when the WXT instance is ready to work.
1050
925
  * @param wxt The configured WXT object
@@ -1068,6 +943,20 @@ interface WxtHooks {
1068
943
  * })
1069
944
  */
1070
945
  'prepare:types': (wxt: Wxt, entries: WxtDirEntry[]) => HookResult;
946
+ /**
947
+ * Called before generating the list of public paths inside
948
+ * `.wxt/types/paths.d.ts`. Use this hook to add additional paths (relative
949
+ * to output directory) WXT doesn't add automatically.
950
+ *
951
+ * @param wxt The configured WXT object
952
+ * @param paths This list of paths TypeScript allows `browser.runtime.getURL` to be called with.
953
+ *
954
+ * @example
955
+ * wxt.hooks.hook('prepare:publicPaths', (wxt, paths) => {
956
+ * paths.push('/icons/128.png');
957
+ * })
958
+ */
959
+ 'prepare:publicPaths': (wxt: Wxt, paths: string[]) => HookResult;
1071
960
  /**
1072
961
  * Called before the build is started in both dev mode and build mode.
1073
962
  *
@@ -1075,7 +964,9 @@ interface WxtHooks {
1075
964
  */
1076
965
  'build:before': (wxt: Wxt) => HookResult;
1077
966
  /**
1078
- * Called once the build process has finished.
967
+ * Called once the build process has finished. You can add files to the build
968
+ * summary here by pushing to `output.publicAssets`.
969
+ *
1079
970
  * @param wxt The configured WXT object
1080
971
  * @param output The results of the build
1081
972
  */
@@ -1107,7 +998,7 @@ interface WxtHooks {
1107
998
  */
1108
999
  'build:publicAssets': (wxt: Wxt, files: ResolvedPublicFile[]) => HookResult;
1109
1000
  }
1110
- interface Wxt {
1001
+ export interface Wxt {
1111
1002
  config: ResolvedConfig;
1112
1003
  hooks: Hookable<WxtHooks>;
1113
1004
  /**
@@ -1131,10 +1022,7 @@ interface Wxt {
1131
1022
  */
1132
1023
  builder: WxtBuilder;
1133
1024
  }
1134
- interface ResolvedConfig {
1135
- vite: (env: ConfigEnv) => WxtViteConfig | Promise<WxtViteConfig>;
1136
- }
1137
- interface ResolvedConfig {
1025
+ export interface ResolvedConfig {
1138
1026
  root: string;
1139
1027
  srcDir: string;
1140
1028
  publicDir: string;
@@ -1174,7 +1062,7 @@ interface ResolvedConfig {
1174
1062
  imports: false | WxtResolvedUnimportOptions;
1175
1063
  manifest: UserManifest;
1176
1064
  fsCache: FsCache;
1177
- runnerConfig: ResolvedConfig$1<ExtensionRunnerConfig>;
1065
+ runnerConfig: C12ResolvedConfig<ExtensionRunnerConfig>;
1178
1066
  zip: {
1179
1067
  name?: string;
1180
1068
  artifactTemplate: string;
@@ -1202,15 +1090,15 @@ interface ResolvedConfig {
1202
1090
  outputName: string;
1203
1091
  keepArtifacts: boolean;
1204
1092
  };
1205
- userConfigMetadata: Omit<ResolvedConfig$1<UserConfig>, 'config'>;
1093
+ userConfigMetadata: Omit<C12ResolvedConfig<UserConfig>, 'config'>;
1206
1094
  /**
1207
1095
  * Import aliases to absolute paths.
1208
1096
  */
1209
1097
  alias: Record<string, string>;
1210
- experimental: {
1211
- includeBrowserPolyfill: boolean;
1212
- entrypointImporter: 'jiti' | 'vite-runtime' | 'vite-node';
1213
- };
1098
+ extensionApi: 'webextension-polyfill' | 'chrome';
1099
+ browserModule: 'wxt/browser' | 'wxt/browser/chrome';
1100
+ entrypointLoader: 'vite-node' | 'jiti';
1101
+ experimental: {};
1214
1102
  dev: {
1215
1103
  /** Only defined during dev command */
1216
1104
  server?: {
@@ -1231,16 +1119,16 @@ interface ResolvedConfig {
1231
1119
  */
1232
1120
  plugins: string[];
1233
1121
  }
1234
- interface FsCache {
1122
+ export interface FsCache {
1235
1123
  set(key: string, value: string): Promise<void>;
1236
1124
  get(key: string): Promise<string | undefined>;
1237
1125
  }
1238
- interface ExtensionRunner {
1126
+ export interface ExtensionRunner {
1239
1127
  openBrowser(): Promise<void>;
1240
1128
  closeBrowser(): Promise<void>;
1241
1129
  }
1242
- type EslintGlobalsPropValue = boolean | 'readonly' | 'readable' | 'writable' | 'writeable';
1243
- interface Eslintrc {
1130
+ export type EslintGlobalsPropValue = boolean | 'readonly' | 'readable' | 'writable' | 'writeable';
1131
+ export interface Eslintrc {
1244
1132
  /**
1245
1133
  * When true, generates a file that can be used by ESLint to know which variables are valid globals.
1246
1134
  *
@@ -1266,14 +1154,14 @@ interface Eslintrc {
1266
1154
  */
1267
1155
  globalsPropValue?: EslintGlobalsPropValue;
1268
1156
  }
1269
- interface ResolvedEslintrc {
1157
+ export interface ResolvedEslintrc {
1270
1158
  /** False if disabled, otherwise the major version of ESLint installed */
1271
1159
  enabled: false | 8 | 9;
1272
1160
  /** Absolute path */
1273
1161
  filePath: string;
1274
1162
  globalsPropValue: EslintGlobalsPropValue;
1275
1163
  }
1276
- type WxtUnimportOptions = Partial<UnimportOptions> & {
1164
+ export type WxtUnimportOptions = Partial<UnimportOptions> & {
1277
1165
  /**
1278
1166
  * When using ESLint, auto-imported variables are linted as "undeclared
1279
1167
  * globals". This option lets you configure a base eslintrc that, when
@@ -1283,13 +1171,13 @@ type WxtUnimportOptions = Partial<UnimportOptions> & {
1283
1171
  */
1284
1172
  eslintrc?: Eslintrc;
1285
1173
  };
1286
- type WxtResolvedUnimportOptions = Partial<UnimportOptions> & {
1174
+ export type WxtResolvedUnimportOptions = Partial<UnimportOptions> & {
1287
1175
  eslintrc: ResolvedEslintrc;
1288
1176
  };
1289
1177
  /**
1290
1178
  * Package management utils built on top of [`nypm`](https://www.npmjs.com/package/nypm)
1291
1179
  */
1292
- interface WxtPackageManager extends Nypm.PackageManager {
1180
+ export interface WxtPackageManager extends Nypm.PackageManager {
1293
1181
  addDependency: typeof Nypm.addDependency;
1294
1182
  addDevDependency: typeof Nypm.addDevDependency;
1295
1183
  ensureDependencyInstalled: typeof Nypm.ensureDependencyInstalled;
@@ -1318,13 +1206,13 @@ interface WxtPackageManager extends Nypm.PackageManager {
1318
1206
  */
1319
1207
  overridesKey: string;
1320
1208
  }
1321
- interface Dependency {
1209
+ export interface Dependency {
1322
1210
  name: string;
1323
1211
  version: string;
1324
1212
  }
1325
- type WxtModuleOptions = Record<string, any>;
1326
- type WxtModuleSetup<TOptions extends WxtModuleOptions> = (wxt: Wxt, moduleOptions?: TOptions) => void | Promise<void>;
1327
- interface WxtModule<TOptions extends WxtModuleOptions> {
1213
+ export type WxtModuleOptions = Record<string, any>;
1214
+ export type WxtModuleSetup<TOptions extends WxtModuleOptions> = (wxt: Wxt, moduleOptions?: TOptions) => void | Promise<void>;
1215
+ export interface WxtModule<TOptions extends WxtModuleOptions> {
1328
1216
  name?: string;
1329
1217
  /**
1330
1218
  * Key for users to pass options into your module from their `wxt.config.ts` file.
@@ -1338,19 +1226,19 @@ interface WxtModule<TOptions extends WxtModuleOptions> {
1338
1226
  * Alternative to adding hooks in setup function with `wxt.hooks`. Hooks are
1339
1227
  * added before the `setup` function is called.
1340
1228
  */
1341
- hooks?: WxtHooks;
1229
+ hooks?: Partial<WxtHooks>;
1342
1230
  /**
1343
1231
  * A custom function that can be used to setup hooks and call module-specific
1344
1232
  * APIs.
1345
1233
  */
1346
1234
  setup?: WxtModuleSetup<TOptions>;
1347
1235
  }
1348
- interface WxtModuleWithMetadata<TOptions extends WxtModuleOptions> extends WxtModule<TOptions> {
1236
+ export interface WxtModuleWithMetadata<TOptions extends WxtModuleOptions> extends WxtModule<TOptions> {
1349
1237
  type: 'local' | 'node_module';
1350
1238
  id: string;
1351
1239
  }
1352
- type ResolvedPublicFile = CopiedPublicFile | GeneratedPublicFile;
1353
- interface ResolvedBasePublicFile {
1240
+ export type ResolvedPublicFile = CopiedPublicFile | GeneratedPublicFile;
1241
+ export interface ResolvedBasePublicFile {
1354
1242
  /**
1355
1243
  * The relative path in the output directory to copy the file to.
1356
1244
  * @example
@@ -1358,7 +1246,7 @@ interface ResolvedBasePublicFile {
1358
1246
  */
1359
1247
  relativeDest: string;
1360
1248
  }
1361
- interface CopiedPublicFile extends ResolvedBasePublicFile {
1249
+ export interface CopiedPublicFile extends ResolvedBasePublicFile {
1362
1250
  /**
1363
1251
  * The absolute path to the file that will be copied to the output directory.
1364
1252
  * @example
@@ -1366,24 +1254,24 @@ interface CopiedPublicFile extends ResolvedBasePublicFile {
1366
1254
  */
1367
1255
  absoluteSrc: string;
1368
1256
  }
1369
- interface GeneratedPublicFile extends ResolvedBasePublicFile {
1257
+ export interface GeneratedPublicFile extends ResolvedBasePublicFile {
1370
1258
  /**
1371
1259
  * Text to write to the file.
1372
1260
  */
1373
1261
  contents: string;
1374
1262
  }
1375
- type WxtPlugin = () => void;
1376
- type WxtDirEntry = WxtDirTypeReferenceEntry | WxtDirFileEntry;
1263
+ export type WxtPlugin = () => void;
1264
+ export type WxtDirEntry = WxtDirTypeReferenceEntry | WxtDirFileEntry;
1377
1265
  /**
1378
1266
  * Represents type reference to a node module to be added to `.wxt/wxt.d.ts` file
1379
1267
  */
1380
- interface WxtDirTypeReferenceEntry {
1268
+ export interface WxtDirTypeReferenceEntry {
1381
1269
  module: string;
1382
1270
  }
1383
1271
  /**
1384
1272
  * Represents a file to be written to the project's `.wxt/` directory.
1385
1273
  */
1386
- interface WxtDirFileEntry {
1274
+ export interface WxtDirFileEntry {
1387
1275
  /**
1388
1276
  * Path relative to the `.wxt/` directory. So "tsconfig.json" would resolve to ".wxt/tsconfig.json".
1389
1277
  */
@@ -1397,5 +1285,3 @@ interface WxtDirFileEntry {
1397
1285
  */
1398
1286
  tsReference?: boolean;
1399
1287
  }
1400
-
1401
- export type { EslintGlobalsPropValue as $, PerBrowserMap as A, BuildOutput as B, ContentScriptEntrypoint as C, ResolvedPerBrowserOptions as D, ExtensionRunnerConfig as E, UserManifest as F, GenericEntrypoint as G, UserManifestFn as H, InlineConfig as I, ConfigEnv as J, WxtCommand as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, WxtBuilder as N, OutputFile as O, PopupEntrypointOptions as P, WxtBuilderServer as Q, ResolvedConfig as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, ServerInfo as V, WxtDevServer as W, HookResult as X, Wxt as Y, FsCache as Z, ExtensionRunner as _, WxtViteConfig as a, Eslintrc as a0, ResolvedEslintrc as a1, WxtUnimportOptions as a2, WxtResolvedUnimportOptions as a3, WxtPackageManager as a4, Dependency as a5, WxtModuleOptions as a6, WxtModuleSetup as a7, WxtModule as a8, WxtModuleWithMetadata as a9, ResolvedPublicFile as aa, ResolvedBasePublicFile as ab, CopiedPublicFile as ac, GeneratedPublicFile as ad, WxtPlugin as ae, WxtDirEntry as af, WxtDirTypeReferenceEntry as ag, WxtDirFileEntry as ah, WxtHooks as b, OutputChunk as c, OutputAsset as d, BuildStepOutput as e, ReloadContentScriptPayload as f, TargetManifestVersion as g, BaseEntrypointOptions as h, BackgroundEntrypointOptions as i, BaseContentScriptEntrypointOptions as j, IsolatedWorldContentScriptEntrypointOptions as k, OptionsEntrypointOptions as l, BaseEntrypoint as m, BackgroundEntrypoint as n, PopupEntrypoint as o, OptionsEntrypoint as p, SidepanelEntrypoint as q, Entrypoint as r, EntrypointGroup as s, OnContentScriptStopped as t, IsolatedWorldContentScriptDefinition as u, MainWorldContentScriptDefinition as v, ContentScriptDefinition as w, BackgroundDefinition as x, UnlistedScriptDefinition as y, PerBrowserOption as z };