@wxt-dev/browser 0.0.315 → 0.0.317

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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/gen/index.d.ts +67 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wxt-dev/browser",
3
3
  "description": "Provides a cross-browser API for using extension APIs and types based on @types/chrome",
4
- "version": "0.0.315",
4
+ "version": "0.0.317",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
7
7
  "types": "src/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "src"
20
20
  ],
21
21
  "devDependencies": {
22
- "@types/chrome": "0.0.315",
22
+ "@types/chrome": "0.0.317",
23
23
  "fs-extra": "^11.3.0",
24
24
  "nano-spawn": "^0.2.0",
25
25
  "tsx": "4.19.3",
@@ -8958,7 +8958,7 @@ export namespace Browser {
8958
8958
  default_popup?: string | undefined;
8959
8959
  }
8960
8960
 
8961
- // Source: https://developer.Browser.com/docs/extensions/mv3/declare_permissions/
8961
+ /** Source: https://developer.Browser.com/docs/extensions/reference/permissions-list */
8962
8962
  export type ManifestPermissions =
8963
8963
  | "accessibilityFeatures.modify"
8964
8964
  | "accessibilityFeatures.read"
@@ -9015,11 +9015,11 @@ export namespace Browser {
9015
9015
  | "privacy"
9016
9016
  | "processes"
9017
9017
  | "proxy"
9018
+ | "readingList"
9018
9019
  | "scripting"
9019
9020
  | "search"
9020
9021
  | "sessions"
9021
9022
  | "sidePanel"
9022
- | "signedInDevices"
9023
9023
  | "storage"
9024
9024
  | "system.cpu"
9025
9025
  | "system.display"
@@ -9042,6 +9042,23 @@ export namespace Browser {
9042
9042
  | "webRequestBlocking"
9043
9043
  | "webRequestAuthProvider";
9044
9044
 
9045
+ /** Source : https://developer.Browser.com/docs/extensions/reference/api/permissions */
9046
+ export type ManifestOptionalPermissions = Exclude<
9047
+ ManifestPermissions,
9048
+ | "debugger"
9049
+ | "declarativeNetRequest"
9050
+ | "devtools"
9051
+ | "experimental"
9052
+ | "fontSettings"
9053
+ | "geolocation"
9054
+ | "proxy"
9055
+ | "tts"
9056
+ | "ttsEngine"
9057
+ | "unlimitedStorage"
9058
+ | "wallpaper"
9059
+ | "webAuthenticationProxy"
9060
+ >;
9061
+
9045
9062
  export interface SearchProvider {
9046
9063
  name?: string | undefined;
9047
9064
  keyword?: string | undefined;
@@ -9261,8 +9278,8 @@ export namespace Browser {
9261
9278
  }
9262
9279
  | undefined;
9263
9280
  content_security_policy?: string | undefined;
9264
- optional_permissions?: string[] | undefined;
9265
- permissions?: string[] | undefined;
9281
+ optional_permissions?: ManifestOptionalPermissions[] | string[] | undefined;
9282
+ permissions?: ManifestPermissions[] | string[] | undefined;
9266
9283
  web_accessible_resources?: string[] | undefined;
9267
9284
  }
9268
9285
 
@@ -9297,7 +9314,7 @@ export namespace Browser {
9297
9314
  sandbox?: string;
9298
9315
  };
9299
9316
  host_permissions?: string[] | undefined;
9300
- optional_permissions?: ManifestPermissions[] | undefined;
9317
+ optional_permissions?: ManifestOptionalPermissions[] | undefined;
9301
9318
  optional_host_permissions?: string[] | undefined;
9302
9319
  permissions?: ManifestPermissions[] | undefined;
9303
9320
  web_accessible_resources?: Array<{ resources: string[]; matches: string[] }> | undefined;
@@ -14845,6 +14862,18 @@ export namespace Browser {
14845
14862
  */
14846
14863
  export type ExecutionWorld = "MAIN" | "USER_SCRIPT";
14847
14864
 
14865
+ /** @since Chrome 135 */
14866
+ export interface InjectionResult {
14867
+ /** The document associated with the injection. */
14868
+ documentId: string;
14869
+ /** The error, if any. `error` and `result` are mutually exclusive. */
14870
+ error?: string;
14871
+ /** The frame associated with the injection. */
14872
+ frameId: number;
14873
+ /** The result of the script execution. */
14874
+ result: any;
14875
+ }
14876
+
14848
14877
  export interface WorldProperties {
14849
14878
  /** Specifies the world csp. The default is the `ISOLATED` world csp. */
14850
14879
  csp?: string;
@@ -14861,6 +14890,18 @@ export namespace Browser {
14861
14890
  ids?: string[];
14862
14891
  }
14863
14892
 
14893
+ /** @since Chrome 135 */
14894
+ export interface InjectionTarget {
14895
+ /** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` is specified. */
14896
+ allFrames?: boolean;
14897
+ /** The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set. */
14898
+ documentIds?: string[];
14899
+ /** The IDs of specific frames to inject into. */
14900
+ frameIds?: number[];
14901
+ /** The ID of the tab into which to inject. */
14902
+ tabId: number;
14903
+ }
14904
+
14864
14905
  export interface RegisteredUserScript {
14865
14906
  /** If true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched. */
14866
14907
  allFrames?: boolean;
@@ -14887,6 +14928,20 @@ export namespace Browser {
14887
14928
  worldId?: string;
14888
14929
  }
14889
14930
 
14931
+ /** @since Chrome 135 */
14932
+ export interface UserScriptInjection {
14933
+ /** Whether the injection should be triggered in the target as soon as possible. Note that this is not a guarantee that injection will occur prior to page load, as the page may have already loaded by the time the script reaches the target. */
14934
+ injectImmediately?: boolean;
14935
+ /** The list of ScriptSource objects defining sources of scripts to be injected into the target. */
14936
+ js: ScriptSource[];
14937
+ /** Details specifying the target into which to inject the script. */
14938
+ target: InjectionTarget;
14939
+ /** The JavaScript "world" to run the script in. The default is `USER_SCRIPT`. */
14940
+ world?: ExecutionWorld;
14941
+ /** Specifies the user script world ID to execute in. If omitted, the script will execute in the default user script world. Only valid if `world` is omitted or is `USER_SCRIPT`. Values with leading underscores (`_`) are reserved. */
14942
+ worldId?: string;
14943
+ }
14944
+
14890
14945
  /**
14891
14946
  * Properties for a script source.
14892
14947
  */
@@ -14939,6 +14994,13 @@ export namespace Browser {
14939
14994
  export function getWorldConfigurations(): Promise<WorldProperties[]>;
14940
14995
  export function getWorldConfigurations(callback: (worlds: WorldProperties[]) => void): void;
14941
14996
 
14997
+ /**
14998
+ * Injects a script into a target context. By default, the script will be run at `document_idle`, or immediately if the page has already loaded. If the `injectImmediately` property is set, the script will inject without waiting, even if the page has not finished loading. If the script evaluates to a promise, the browser will wait for the promise to settle and return the resulting value.
14999
+ * @since Chrome 135
15000
+ */
15001
+ export function execute(injection: UserScriptInjection): Promise<InjectionResult[]>;
15002
+ export function execute(injection: UserScriptInjection, callback: (result: InjectionResult[]) => void): void;
15003
+
14942
15004
  /**
14943
15005
  * Registers one or more user scripts for this extension.
14944
15006
  *