wxt 0.17.12 → 0.18.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.
@@ -320,6 +320,14 @@ interface InlineConfig {
320
320
  * ["@scope/package-name@1.1.3", "package-name@^2"]
321
321
  */
322
322
  downloadPackages?: string[];
323
+ /**
324
+ * Compression level to use when zipping files.
325
+ *
326
+ * Levels: 0 (no compression) to 9 (maximum compression).
327
+ *
328
+ * @default 9
329
+ */
330
+ compressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
323
331
  };
324
332
  /**
325
333
  * @deprecated Use `hooks.build.manifestGenerated` to modify your manifest instead. This option
@@ -421,6 +429,15 @@ interface InlineConfig {
421
429
  * })
422
430
  */
423
431
  includeBrowserPolyfill?: boolean;
432
+ /**
433
+ * When set to `true`, use the Vite Runtime API to load entrypoint options instead of the default, `jiti`.
434
+ *
435
+ * Lets you use imported variables and leverage your Vite config to add support for non-standard APIs/syntax.
436
+ *
437
+ * @experimental Early access to try out the feature before it becomes the default.
438
+ * @default false
439
+ */
440
+ viteRuntime?: boolean;
424
441
  };
425
442
  /**
426
443
  * Config effecting dev mode only.
@@ -647,8 +664,8 @@ interface BaseContentScriptEntrypointOptions extends BaseEntrypointOptions {
647
664
  * - `"manifest"`: The content script will be added to the `content_scripts` entry in the
648
665
  * manifest. This is the normal and most well known way of registering a content script.
649
666
  * - `"runtime"`: The content script's `matches` is added to `host_permissions` and you are
650
- * responsible for using the scripting API to register the content script dynamically at
651
- * runtime.
667
+ * responsible for using the scripting API to register/execute the content script
668
+ * dynamically at runtime.
652
669
  *
653
670
  * @default "manifest"
654
671
  */
@@ -753,14 +770,22 @@ type OnContentScriptStopped = (cb: () => void) => void;
753
770
  interface IsolatedWorldContentScriptDefinition extends IsolatedWorldContentScriptEntrypointOptions {
754
771
  /**
755
772
  * Main function executed when the content script is loaded.
773
+ *
774
+ * When running a content script with `browser.scripting.executeScript`,
775
+ * values returned from this function will be returned in the `executeScript`
776
+ * result as well. Otherwise returning a value does nothing.
756
777
  */
757
- main(ctx: ContentScriptContext): void | Promise<void>;
778
+ main(ctx: ContentScriptContext): any | Promise<any>;
758
779
  }
759
780
  interface MainWorldContentScriptDefinition extends MainWorldContentScriptEntrypointOptions {
760
781
  /**
761
782
  * Main function executed when the content script is loaded.
783
+ *
784
+ * When running a content script with `browser.scripting.executeScript`,
785
+ * values returned from this function will be returned in the `executeScript`
786
+ * result as well. Otherwise returning a value does nothing.
762
787
  */
763
- main(): void | Promise<void>;
788
+ main(): any | Promise<any>;
764
789
  }
765
790
  type ContentScriptDefinition = IsolatedWorldContentScriptDefinition | MainWorldContentScriptDefinition;
766
791
  interface BackgroundDefinition extends BackgroundEntrypointOptions {
@@ -772,8 +797,12 @@ interface BackgroundDefinition extends BackgroundEntrypointOptions {
772
797
  interface UnlistedScriptDefinition extends BaseEntrypointOptions {
773
798
  /**
774
799
  * Main function executed when the unlisted script is ran.
800
+ *
801
+ * When running a content script with `browser.scripting.executeScript`,
802
+ * values returned from this function will be returned in the `executeScript`
803
+ * result as well. Otherwise returning a value does nothing.
775
804
  */
776
- main(): void | Promise<void>;
805
+ main(): any | Promise<any>;
777
806
  }
778
807
  /**
779
808
  * Either a single value or a map of different browsers to the value for that browser.
@@ -907,6 +936,10 @@ interface WxtBuilder {
907
936
  * Version of tool used to build. Ex: "5.0.2"
908
937
  */
909
938
  version: string;
939
+ /**
940
+ * Import the entrypoint file, returning the default export containing the options.
941
+ */
942
+ importEntrypoint<T>(path: string): Promise<T>;
910
943
  /**
911
944
  * Build a single entrypoint group. This is effectively one of the multiple "steps" during the
912
945
  * build process.
@@ -1084,6 +1117,7 @@ interface ResolvedConfig {
1084
1117
  sourcesRoot: string;
1085
1118
  downloadedPackagesDir: string;
1086
1119
  downloadPackages: string[];
1120
+ compressionLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
1087
1121
  };
1088
1122
  /**
1089
1123
  * @deprecated Use `build:manifestGenerated` hook instead.
@@ -1108,6 +1142,7 @@ interface ResolvedConfig {
1108
1142
  alias: Record<string, string>;
1109
1143
  experimental: {
1110
1144
  includeBrowserPolyfill: boolean;
1145
+ viteRuntime: boolean;
1111
1146
  };
1112
1147
  dev: {
1113
1148
  /** Only defined during dev command */