wxt 0.8.4 → 0.8.6

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 (36) hide show
  1. package/README.md +3 -2
  2. package/dist/browser.js +3 -4
  3. package/dist/chunk-FNTE2L27.js +7 -0
  4. package/dist/chunk-VFZ5667B.js +2410 -0
  5. package/dist/chunk-YUG22S6W.js +38 -0
  6. package/dist/cli.cjs +3941 -3775
  7. package/dist/cli.d.cts +2 -0
  8. package/dist/client.d.ts +5 -171
  9. package/dist/client.js +128 -131
  10. package/dist/execa-WKZHVHC5.js +2043 -0
  11. package/dist/external-9107db91.d.ts +176 -0
  12. package/dist/external-cb0967d6.d.ts +572 -0
  13. package/dist/index.cjs +2727 -2355
  14. package/dist/index.d.cts +36 -583
  15. package/dist/index.d.ts +36 -583
  16. package/dist/index.js +330 -4484
  17. package/dist/sandbox.d.ts +2 -23
  18. package/dist/sandbox.js +1 -2
  19. package/dist/testing.cjs +161 -35
  20. package/dist/testing.d.cts +7 -273
  21. package/dist/testing.d.ts +7 -273
  22. package/dist/testing.js +12 -676
  23. package/dist/{virtual-modules → virtual}/background-entrypoint.js +6 -7
  24. package/dist/{virtual-modules → virtual}/content-script-entrypoint.js +4 -5
  25. package/dist/virtual/mock-browser.js +152 -0
  26. package/dist/{virtual-modules → virtual}/reload-html.js +2 -3
  27. package/dist/{virtual-modules → virtual}/unlisted-script-entrypoint.js +2 -3
  28. package/package.json +6 -5
  29. package/dist/index.cjs.map +0 -1
  30. package/dist/index.js.map +0 -1
  31. package/dist/virtual-modules/background-entrypoint.js.map +0 -1
  32. package/dist/virtual-modules/content-script-entrypoint.js.map +0 -1
  33. package/dist/virtual-modules/fake-browser.cjs +0 -31
  34. package/dist/virtual-modules/fake-browser.js +0 -8
  35. package/dist/virtual-modules/reload-html.js.map +0 -1
  36. package/dist/virtual-modules/unlisted-script-entrypoint.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,574 +1,25 @@
1
- import * as vite from 'vite';
2
- import { Manifest, Scripting } from 'webextension-polyfill';
3
- import { UnimportOptions } from 'unimport';
4
- import { LogLevel } from 'consola';
5
- import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './external-cb0967d6.js';
2
+ export { k as BackgroundDefinition, f as BackgroundEntrypoint, e as BaseEntrypoint, d as BaseEntrypointOptions, b as BuildStepOutput, q as ConfigEnv, j as ContentScriptDefinition, C as ContentScriptEntrypoint, g as Entrypoint, h as EntrypointGroup, n as ExcludableEntrypoint, G as GenericEntrypoint, L as Logger, i as OnContentScriptStopped, O as OptionsEntrypoint, m as PerBrowserOption, P as PopupEntrypoint, T as TargetBrowser, c as TargetManifestVersion, l as UnlistedScriptDefinition, o as UserManifest, p as UserManifestFn, a as WxtInlineViteConfig, r as WxtViteConfig } from './external-cb0967d6.js';
3
+ import 'vite';
4
+ import 'webextension-polyfill';
5
+ import 'unimport';
6
+ import 'consola';
7
+ import 'rollup-plugin-visualizer';
6
8
 
7
9
  /**
8
- * Implements [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
9
- * Used to detect and stop content script code when the script is invalidated.
10
+ * Bundles the extension for production. Returns a promise of the build result. Discovers the `wxt.config.ts` file in
11
+ * the root directory, and merges that config with what is passed in.
10
12
  *
11
- * It also provides several utilities like `ctx.setTimeout` and `ctx.setInterval` that should be used in
12
- * content scripts instead of `window.setTimeout` or `window.setInterval`.
13
- */
14
- declare class ContentScriptContext implements AbortController {
15
- #private;
16
- private readonly contentScriptName;
17
- readonly options?: Omit<ContentScriptDefinition, "main"> | undefined;
18
- private static SCRIPT_STARTED_MESSAGE_TYPE;
19
- constructor(contentScriptName: string, options?: Omit<ContentScriptDefinition, "main"> | undefined);
20
- get signal(): AbortSignal;
21
- abort(reason?: any): void;
22
- get isInvalid(): boolean;
23
- get isValid(): boolean;
24
- /**
25
- * Add a listener that is called when the content script's context is invalidated.
26
- *
27
- * @returns A function to remove the listener.
28
- *
29
- * @example
30
- * browser.runtime.onMessage.addListener(cb);
31
- * const removeInvalidatedListener = ctx.onInvalidated(() => {
32
- * browser.runtime.onMessage.removeListener(cb);
33
- * })
34
- * // ...
35
- * removeInvalidatedListener();
36
- */
37
- onInvalidated(cb: () => void): () => void;
38
- /**
39
- * Return a promise that never resolves. Useful if you have an async function that shouldn't run
40
- * after the context is expired.
41
- *
42
- * @example
43
- * const getValueFromStorage = async () => {
44
- * if (ctx.isInvalid) return ctx.block();
45
- *
46
- * // ...
47
- * }
48
- */
49
- block<T>(): Promise<T>;
50
- /**
51
- * Wrapper around `window.setInterval` that automatically clears the interval when invalidated.
52
- */
53
- setInterval(handler: () => void, timeout?: number): number;
54
- /**
55
- * Wrapper around `window.setTimeout` that automatically clears the interval when invalidated.
56
- */
57
- setTimeout(handler: () => void, timeout?: number): number;
58
- /**
59
- * Wrapper around `window.requestAnimationFrame` that automatically cancels the request when
60
- * invalidated.
61
- */
62
- requestAnimationFrame(callback: FrameRequestCallback): number;
63
- /**
64
- * Wrapper around `window.requestIdleCallback` that automatically cancels the request when
65
- * invalidated.
66
- */
67
- requestIdleCallback(callback: IdleRequestCallback, options?: IdleRequestOptions): number;
68
- /**
69
- * Call `target.addEventListener` and remove the event listener when the context is invalidated.
70
- *
71
- * @example
72
- * ctx.addEventListener(window, "mousemove", () => {
73
- * // ...
74
- * });
75
- * ctx.addEventListener(document, "visibilitychange", () => {
76
- * // ...
77
- * });
78
- */
79
- addEventListener(target: any, type: string, handler: (event: Event) => void, options?: AddEventListenerOptions): void;
80
- /**
81
- * @internal
82
- * Abort the abort controller and execute all `onInvalidated` listeners.
83
- */
84
- notifyInvalidated(): void;
85
- }
86
-
87
- interface InlineConfig {
88
- /**
89
- * Your project's root directory containing the `package.json` used to fill out the
90
- * `manifest.json`.
91
- *
92
- * @default process.cwd()
93
- */
94
- root?: string;
95
- /**
96
- * Directory containing all source code. Set to `"src"` to move all source code to a `src/`
97
- * directory.
98
- *
99
- * @default config.root
100
- */
101
- srcDir?: string;
102
- /**
103
- * Directory containing files that will be copied to the output directory as-is.
104
- *
105
- * @default "${config.root}/public"
106
- */
107
- publicDir?: string;
108
- /**
109
- * @default "${config.srcDir}/entrypoints"
110
- */
111
- entrypointsDir?: string;
112
- /**
113
- * > Only available when using the JS API. Not available in `wxt.config.ts` files
114
- *
115
- * Path to `wxt.config.ts` file or `false` to disable config file discovery.
116
- *
117
- * @default "wxt.config.ts"
118
- */
119
- configFile?: string | false;
120
- /**
121
- * Set to `true` to show debug logs. Overriden by the command line `--debug` option.
122
- *
123
- * @default false
124
- */
125
- debug?: boolean;
126
- /**
127
- * Explicitly set a mode to run in. This will override the default mode for each command, and can
128
- * be overridden by the command line `--mode` option.
129
- */
130
- mode?: string;
131
- /**
132
- * Customize auto-import options. Set to `false` to disable auto-imports.
133
- *
134
- * For example, to add a directory to auto-import from, you can use:
135
- *
136
- * ```ts
137
- * export default defineConfig({
138
- * imports: {
139
- * dirs: ["some-directory"]
140
- * }
141
- * })
142
- * ```
143
- */
144
- imports?: Partial<UnimportOptions> | false;
145
- /**
146
- * Explicitly set a browser to build for. This will override the default browser for each command,
147
- * and can be overridden by the command line `--browser` option.
148
- *
149
- * @default
150
- * "chrome"
151
- */
152
- browser?: TargetBrowser;
153
- /**
154
- * Explicitly set a manifest version to target. This will override the default manifest version
155
- * for each command, and can be overridden by the command line `--mv2` or `--mv3` option.
156
- */
157
- manifestVersion?: TargetManifestVersion;
158
- /**
159
- * Override the logger used.
160
- *
161
- * @default
162
- * consola
163
- */
164
- logger?: Logger;
165
- /**
166
- * Return custom Vite options from a function. See
167
- * <https://vitejs.dev/config/shared-options.html>.
168
- *
169
- * [`root`](#root), [`configFile`](#configfile), and [`mode`](#mode) should be set in WXT's config
170
- * instead of Vite's.
171
- *
172
- * This is a function because any vite plugins added need to be recreated for each individual
173
- * build step, incase they have internal state causing them to fail when reused.
174
- */
175
- vite?: (env: ConfigEnv) => WxtViteConfig | Promise<WxtViteConfig>;
176
- /**
177
- * Customize the `manifest.json` output. Can be an object, promise, or function that returns an
178
- * object or promise.
179
- */
180
- manifest?: UserManifest | Promise<UserManifest> | UserManifestFn;
181
- /**
182
- * Custom runner options. Options set here can be overridden in a `web-ext.config.ts` file.
183
- */
184
- runner?: ExtensionRunnerConfig;
185
- zip?: {
186
- /**
187
- * Configure the filename output when zipping files.
188
- *
189
- * Available template variables:
190
- *
191
- * - `{{name}}` - The project's name converted to kebab-case
192
- * - `{{version}}` - The version_name or version from the manifest
193
- * - `{{browser}}` - The target browser from the `--browser` CLI flag
194
- * - `{{manifestVersion}}` - Either "2" or "3"
195
- *
196
- * @default "{{name}}-{{version}}-{{browser}}.zip"
197
- */
198
- artifactTemplate?: string;
199
- /**
200
- * Configure the filename output when zipping files.
201
- *
202
- * Available template variables:
203
- *
204
- * - `{{name}}` - The project's name converted to kebab-case
205
- * - `{{version}}` - The version_name or version from the manifest
206
- * - `{{browser}}` - The target browser from the `--browser` CLI flag
207
- * - `{{manifestVersion}}` - Either "2" or "3"
208
- *
209
- * @default "{{name}}-{{version}}-sources.zip"
210
- */
211
- sourcesTemplate?: string;
212
- /**
213
- * Override the artifactTemplate's `{name}` template variable. Defaults to the `package.json`'s
214
- * name, or if that doesn't exist, the current working directories name.
215
- */
216
- name?: string;
217
- /**
218
- * Root directory to ZIP when generating the sources ZIP.
219
- *
220
- * @default config.root
221
- */
222
- sourcesRoot?: string;
223
- /**
224
- * [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to exclude when
225
- * creating a ZIP of all your source code for Firfox. Patterns are relative to your
226
- * `config.zip.sourcesRoot`.
227
- *
228
- * Hidden files, node_modules, and tests are ignored by default.
229
- *
230
- * @example
231
- * [
232
- * "coverage", // Ignore the coverage directory in the `sourcesRoot`
233
- * ]
234
- */
235
- ignoredSources?: string[];
236
- };
237
- /**
238
- * Transform the final manifest before it's written to the file system. Edit the `manifest`
239
- * parameter directly, do not return a new object. Return values are ignored.
240
- *
241
- * @example
242
- * defineConfig({
243
- * // Add a CSS-only content script.
244
- * transformManifest(manifest) {
245
- * manifest.content_scripts.push({
246
- * matches: ["*://google.com/*"],
247
- * css: ["content-scripts/some-example.css"],
248
- * });
249
- * }
250
- * })
251
- */
252
- transformManifest?: (manifest: Manifest.WebExtensionManifest) => void;
253
- analysis?: {
254
- /**
255
- * Explicitly include bundle analysis when running `wxt build`. This can be overridden by the
256
- * command line `--analysis` option.
257
- *
258
- * @default false
259
- */
260
- enabled?: boolean;
261
- /**
262
- * When running `wxt build --analyze` or setting `analysis.enabled` to true, customize how the
263
- * bundle will be visualized. See
264
- * [`rollup-plugin-visualizer`](https://github.com/btd/rollup-plugin-visualizer#how-to-use-generated-files)
265
- * for more details.
266
- *
267
- * @default "treemap"
268
- */
269
- template?: PluginVisualizerOptions['template'];
270
- };
271
- }
272
- interface WxtInlineViteConfig extends Omit<vite.InlineConfig, 'root' | 'configFile' | 'mode' | 'build'> {
273
- build?: Omit<vite.BuildOptions, 'outDir'>;
274
- }
275
- interface BuildOutput {
276
- manifest: Manifest.WebExtensionManifest;
277
- publicAssets: vite.Rollup.OutputAsset[];
278
- steps: BuildStepOutput[];
279
- }
280
- interface BuildStepOutput {
281
- entrypoints: EntrypointGroup;
282
- chunks: (vite.Rollup.OutputChunk | vite.Rollup.OutputAsset)[];
283
- }
284
- interface WxtDevServer extends vite.ViteDevServer {
285
- /**
286
- * Ex: `3000`
287
- */
288
- port: number;
289
- /**
290
- * Ex: `"localhost"`
291
- */
292
- hostname: string;
293
- /**
294
- * Ex: `"http://localhost:3000"`
295
- */
296
- origin: string;
297
- /**
298
- * Stores the current build output of the server.
299
- */
300
- currentOutput: BuildOutput;
301
- /**
302
- * Start the server on the first open port.
303
- */
304
- start(): Promise<void>;
305
- /**
306
- * Tell the extension to reload by running `browser.runtime.reload`.
307
- */
308
- reloadExtension: () => void;
309
- /**
310
- * Tell an extension page to reload.
311
- *
312
- * The path is the bundle path, not the input paths, so if the input paths is
313
- * "src/options/index.html", you would pass "options.html" because that's where it is written to
314
- * in the dist directory, and where it's available at in the actual extension.
315
- *
316
- * @example
317
- * server.reloadPage("popup.html")
318
- * server.reloadPage("sandbox.html")
319
- */
320
- reloadPage: (path: string) => void;
321
- /**
322
- * Tell the extension to restart a content script.
323
- *
324
- * @param contentScript The manifest definition for a content script
325
- */
326
- reloadContentScript: (contentScript: Omit<Scripting.RegisteredContentScript, 'id'>) => void;
327
- }
328
- type TargetBrowser = string;
329
- type TargetManifestVersion = 2 | 3;
330
- type UserConfig = Omit<InlineConfig, 'configFile'>;
331
- interface Logger {
332
- debug(...args: any[]): void;
333
- log(...args: any[]): void;
334
- info(...args: any[]): void;
335
- warn(...args: any[]): void;
336
- error(...args: any[]): void;
337
- fatal(...args: any[]): void;
338
- success(...args: any[]): void;
339
- level: LogLevel;
340
- }
341
- interface BaseEntrypointOptions {
342
- include?: TargetBrowser[];
343
- exclude?: TargetBrowser[];
344
- }
345
- interface BaseEntrypoint {
346
- /**
347
- * The entrypoint's name. This is the filename or dirname without the type suffix.
348
- *
349
- * Examples:
350
- * - `popup.html` &rarr; `popup`
351
- * - `options/index.html` &rarr; `options`
352
- * - `named.sandbox.html` &rarr; `named`
353
- * - `named.sandbox/index.html` &rarr; `named`
354
- * - `sandbox.html` &rarr; `sandbox`
355
- * - `sandbox.index.html` &rarr; `sandbox`
356
- * - `overlay.content.ts` &rarr; `overlay`
357
- * - `overlay.content/index.ts` &rarr; `overlay`
358
- *
359
- * The name is used when generating an output file:
360
- * `<entrypoint.outputDir>/<entrypoint.name>.<ext>`
361
- */
362
- name: string;
363
- /**
364
- * Absolute path to the entrypoint's input file.
365
- */
366
- inputPath: string;
367
- /**
368
- * Absolute path to the entrypoint's output directory. Can be the`InternalConfg.outDir` or a
369
- * subdirectory of it.
370
- */
371
- outputDir: string;
372
- options: BaseEntrypointOptions;
373
- }
374
- interface GenericEntrypoint extends BaseEntrypoint {
375
- type: 'sandbox' | 'bookmarks' | 'history' | 'newtab' | 'sidepanel' | 'devtools' | 'unlisted-page' | 'unlisted-script' | 'unlisted-style' | 'content-script-style';
376
- }
377
- interface BackgroundEntrypoint extends BaseEntrypoint {
378
- type: 'background';
379
- options: {
380
- persistent?: boolean;
381
- type?: 'module';
382
- } & BaseEntrypointOptions;
383
- }
384
- interface ContentScriptEntrypoint extends BaseEntrypoint {
385
- type: 'content-script';
386
- options: Omit<ContentScriptDefinition, 'main'> & BaseEntrypointOptions;
387
- }
388
- interface PopupEntrypoint extends BaseEntrypoint {
389
- type: 'popup';
390
- options: {
391
- /**
392
- * Defaults to "browser_action" to be equivalent to MV3's "action" key
393
- */
394
- mv2Key?: 'browser_action' | 'page_action';
395
- defaultIcon?: Record<string, string>;
396
- defaultTitle?: string;
397
- browserStyle?: boolean;
398
- } & BaseEntrypointOptions;
399
- }
400
- interface OptionsEntrypoint extends BaseEntrypoint {
401
- type: 'options';
402
- options: {
403
- openInTab?: boolean;
404
- browserStyle?: boolean;
405
- chromeStyle?: boolean;
406
- } & BaseEntrypointOptions;
407
- }
408
- type Entrypoint = GenericEntrypoint | BackgroundEntrypoint | ContentScriptEntrypoint | PopupEntrypoint | OptionsEntrypoint;
409
- type OnContentScriptStopped = (cb: () => void) => void;
410
- interface ContentScriptDefinition extends ExcludableEntrypoint {
411
- matches: PerBrowserOption<Manifest.ContentScript['matches']>;
412
- /**
413
- * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
414
- * @default "documentIdle"
415
- */
416
- runAt?: PerBrowserOption<Manifest.ContentScript['run_at']>;
417
- /**
418
- * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
419
- * @default false
420
- */
421
- matchAboutBlank?: PerBrowserOption<Manifest.ContentScript['match_about_blank']>;
422
- /**
423
- * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
424
- * @default []
425
- */
426
- excludeMatches?: PerBrowserOption<Manifest.ContentScript['exclude_matches']>;
427
- /**
428
- * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
429
- * @default []
430
- */
431
- includeGlobs?: PerBrowserOption<Manifest.ContentScript['include_globs']>;
432
- /**
433
- * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
434
- * @default []
435
- */
436
- excludeGlobs?: PerBrowserOption<Manifest.ContentScript['exclude_globs']>;
437
- /**
438
- * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
439
- * @default false
440
- */
441
- allFrames?: PerBrowserOption<Manifest.ContentScript['all_frames']>;
442
- /**
443
- * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
444
- * @default false
445
- */
446
- matchOriginAsFallback?: PerBrowserOption<boolean>;
447
- /**
448
- * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
449
- * @default "ISOLATED"
450
- */
451
- world?: PerBrowserOption<'ISOLATED' | 'MAIN'>;
452
- /**
453
- * Customize how imported/generated styles are injected with the content script. Regardless of the
454
- * mode selected, CSS will always be built and included in the output directory.
455
- *
456
- * - `"manifest"` - Include the CSS in the manifest, under the content script's `css` array.
457
- * - `"manual"` - Exclude the CSS from the manifest. You are responsible for manually loading it
458
- * onto the page. Use `browser.runtime.getURL("content-scripts/<name>.css")` to get the file's
459
- * URL
460
- * - `"ui"` - Exclude the CSS from the manifest. CSS will be automatically added to your UI when
461
- * calling `createContentScriptUi`
462
- *
463
- * @default "manifest"
464
- */
465
- cssInjectionMode?: PerBrowserOption<'manifest' | 'manual' | 'ui'>;
466
- /**
467
- * Main function executed when the content script is loaded.
468
- */
469
- main(ctx: ContentScriptContext): void | Promise<void>;
470
- }
471
- interface BackgroundDefinition extends ExcludableEntrypoint {
472
- type?: PerBrowserOption<'module'>;
473
- persistent?: PerBrowserOption<boolean>;
474
- main(): void;
475
- }
476
- interface UnlistedScriptDefinition extends ExcludableEntrypoint {
477
- /**
478
- * Main function executed when the unlisted script is ran.
479
- */
480
- main(): void | Promise<void>;
481
- }
482
- type PerBrowserOption<T> = T | {
483
- [browser: TargetBrowser]: T;
484
- };
485
- interface ExcludableEntrypoint {
486
- /**
487
- * List of target browsers to include this entrypoint in. Defaults to being included in all
488
- * builds. Cannot be used with `exclude`. You must choose one of the two options.
489
- *
490
- * @default undefined
491
- */
492
- include?: TargetBrowser[];
493
- /**
494
- * List of target browsers to exclude this entrypoint from. Cannot be used with `include`. You
495
- * must choose one of the two options.
496
- *
497
- * @default undefined
498
- */
499
- exclude?: TargetBrowser[];
500
- }
501
- /**
502
- * Manifest customization available in the `wxt.config.ts` file. You cannot configure entrypoints
503
- * here, they are configured inline.
504
- */
505
- type UserManifest = Partial<Omit<Manifest.WebExtensionManifest, 'background' | 'chrome_url_overrides' | 'devtools_page' | 'manifest_version' | 'options_page' | 'options_ui' | 'sandbox' | 'sidepanel' | 'sidebar_action'>>;
506
- type UserManifestFn = (env: ConfigEnv) => UserManifest | Promise<UserManifest>;
507
- interface ConfigEnv {
508
- mode: string;
509
- command: 'build' | 'serve';
510
- /**
511
- * Browser passed in from the CLI
512
- */
513
- browser: TargetBrowser;
514
- /**
515
- * Manifest version passed in from the CLI
516
- */
517
- manifestVersion: 2 | 3;
518
- }
519
- /**
520
- * Configure how the browser starts up.
13
+ * @example
14
+ * // Use config from `wxt.config.ts`
15
+ * const res = await build()
16
+ *
17
+ * // or override config `from wxt.config.ts`
18
+ * const res = await build({
19
+ * // Override config...
20
+ * })
521
21
  */
522
- interface ExtensionRunnerConfig {
523
- /**
524
- * Whether or not to open the browser with the extension installed in dev mode.
525
- *
526
- * @default false
527
- */
528
- disabled?: boolean;
529
- /**
530
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#browser-console
531
- */
532
- openConsole?: boolean;
533
- /**
534
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#devtools
535
- */
536
- openDevtools?: boolean;
537
- /**
538
- * List of browser names and the binary that should be used to open the browser.
539
- *
540
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#chromium-binary
541
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#firefox
542
- */
543
- binaries?: Record<string, string>;
544
- /**
545
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#firefox-profile
546
- */
547
- firefoxProfile?: string;
548
- /**
549
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#chromium-profile
550
- */
551
- chromiumProfile?: string;
552
- /**
553
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#pref
554
- */
555
- firefoxPrefs?: Record<string, string>;
556
- /**
557
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#args
558
- */
559
- firefoxArgs?: string[];
560
- /**
561
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#args
562
- */
563
- chromiumArgs?: string[];
564
- /**
565
- * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#start-url
566
- */
567
- startUrls?: string[];
568
- }
569
- type WxtViteConfig = Omit<vite.UserConfig, 'root' | 'configFile' | 'mode'>;
570
-
571
- type EntrypointGroup = Entrypoint | Entrypoint[];
22
+ declare function build(config?: InlineConfig): Promise<BuildOutput>;
572
23
 
573
24
  /**
574
25
  * Remove generated/temp files from the directory.
@@ -580,25 +31,10 @@ type EntrypointGroup = Entrypoint | Entrypoint[];
580
31
  */
581
32
  declare function clean(root?: string): Promise<void>;
582
33
 
583
- var version = "0.8.4";
584
-
585
34
  declare function defineConfig(config: UserConfig): UserConfig;
586
35
 
587
36
  declare function defineRunnerConfig(config: ExtensionRunnerConfig): ExtensionRunnerConfig;
588
37
 
589
- /**
590
- * @module wxt
591
- */
592
-
593
- /**
594
- * Bundles the extension for production. Returns a promise of the build result.
595
- *
596
- * @example
597
- * const res = await build({
598
- * // Enter config...
599
- * })
600
- */
601
- declare function build(config: InlineConfig): Promise<BuildOutput>;
602
38
  /**
603
39
  * Creates a dev server and pre-builds all the files that need to exist before loading the extension.
604
40
  *
@@ -610,4 +46,21 @@ declare function build(config: InlineConfig): Promise<BuildOutput>;
610
46
  */
611
47
  declare function createServer(config?: InlineConfig): Promise<WxtDevServer>;
612
48
 
613
- export { BackgroundDefinition, BackgroundEntrypoint, BaseEntrypoint, BaseEntrypointOptions, BuildOutput, BuildStepOutput, ConfigEnv, ContentScriptDefinition, ContentScriptEntrypoint, Entrypoint, ExcludableEntrypoint, ExtensionRunnerConfig, GenericEntrypoint, InlineConfig, Logger, OnContentScriptStopped, OptionsEntrypoint, PerBrowserOption, PopupEntrypoint, TargetBrowser, TargetManifestVersion, UnlistedScriptDefinition, UserConfig, UserManifest, UserManifestFn, WxtDevServer, WxtInlineViteConfig, WxtViteConfig, build, clean, createServer, defineConfig, defineRunnerConfig, version };
49
+ declare function initialize(options: {
50
+ directory: string;
51
+ template: string;
52
+ packageManager: string;
53
+ }): Promise<void>;
54
+
55
+ declare function prepare(config: InlineConfig): Promise<void>;
56
+
57
+ /**
58
+ * Build and zip the extension for distribution.
59
+ * @param config Opitonal config that will override your `<root>/wxt.config.ts`.
60
+ * @returns A list of all files included in the ZIP.
61
+ */
62
+ declare function zip(config?: InlineConfig): Promise<string[]>;
63
+
64
+ var version = "0.8.6";
65
+
66
+ export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };