@wxt-dev/browser 0.1.38 → 0.1.39

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 +33 -16
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.1.38",
4
+ "version": "0.1.39",
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.1.38",
22
+ "@types/chrome": "0.1.39",
23
23
  "@types/node": "^20.0.0",
24
24
  "nano-spawn": "^2.0.0",
25
25
  "typescript": "^5.9.3",
@@ -348,9 +348,10 @@ export namespace Browser {
348
348
  export function setIcon(details: TabIconDetails, callback: () => void): void;
349
349
 
350
350
  /**
351
- * Sets the html document to be opened as a popup when the user clicks on the action's icon.
351
+ * Sets the HTML document to be opened as a popup when the user clicks on the action's icon.
352
352
  *
353
353
  * Can return its result via Promise.
354
+ * @since Chrome 96
354
355
  */
355
356
  export function setPopup(details: PopupDetails): Promise<void>;
356
357
  export function setPopup(details: PopupDetails, callback: () => void): void;
@@ -1167,6 +1168,7 @@ export namespace Browser {
1167
1168
  * Clears websites' cache storage data.
1168
1169
  *
1169
1170
  * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1171
+ * @since Chrome 72
1170
1172
  */
1171
1173
  export function removeCacheStorage(options: RemovalOptions): Promise<void>;
1172
1174
  export function removeCacheStorage(options: RemovalOptions, callback: () => void): void;
@@ -2435,7 +2437,17 @@ export namespace Browser {
2435
2437
  * Exactly one of `imageData` or `path` must be specified. Both are dictionaries mapping a number of pixels to an image representation. The image representation in `imageData` is an `ImageData` object; for example, from a `canvas` element, while the image representation in `path` is the path to an image file relative to the extension's manifest. If `scale` screen pixels fit into a device-independent pixel, the `scale * n` icon is used. If that scale is missing, another image is resized to the required size.
2436
2438
  */
2437
2439
  export class SetIcon {
2438
- constructor(options?: { imageData?: ImageData | { [size: string]: ImageData } | undefined });
2440
+ constructor(
2441
+ options:
2442
+ | {
2443
+ imageData: ImageData | { [index: number]: ImageData };
2444
+ path?: string | { [index: number]: string } | undefined;
2445
+ }
2446
+ | {
2447
+ imageData?: ImageData | { [index: number]: ImageData } | undefined;
2448
+ path: string | { [index: number]: string };
2449
+ },
2450
+ );
2439
2451
  }
2440
2452
 
2441
2453
  /** Provides the Declarative Event API consisting of {@link events.Event.addRules addRules}, {@link events.Event.removeRules removeRules}, and {@link events.Event.getRules getRules}. */
@@ -3332,7 +3344,7 @@ export namespace Browser {
3332
3344
  /** Indicates the data type of the option. The requested data type must match the real data type of the underlying option. */
3333
3345
  type: `${OptionType}`;
3334
3346
  /** Indicates the value to set. Leave unset to request automatic setting for options that have `autoSettable` enabled. The data type supplied for `value` must match `type`. */
3335
- value?: string | number | boolean | number;
3347
+ value?: string | number | boolean | number[];
3336
3348
  }
3337
3349
 
3338
3350
  /**
@@ -3562,6 +3574,8 @@ export namespace Browser {
3562
3574
  /**
3563
3575
  * Performs a document scan and returns a Promise that resolves with a {@link ScanResults} object. If a callback is passed to this function, the returned data is passed to it instead.
3564
3576
  * @param options An object containing scan parameters.
3577
+ *
3578
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
3565
3579
  */
3566
3580
  export function scan(options: ScanOptions): Promise<ScanResults>;
3567
3581
  export function scan(options: ScanOptions, callback: (result: ScanResults) => void): void;
@@ -4366,9 +4380,12 @@ export namespace Browser {
4366
4380
  }
4367
4381
 
4368
4382
  /**
4369
- * Retrieves the network details of the device's default network. If the user is not affiliated or the device is not connected to a network, runtime.lastError will be set with a failure reason.
4383
+ * Retrieves the network details of the device's default network. If the user is not affiliated or the device is not connected to a network, {@link runtime.lastError} will be set with a failure reason.
4370
4384
  * @param callback Called with the device's default network's NetworkDetails.
4385
+ *
4386
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
4371
4387
  */
4388
+ export function getNetworkDetails(): Promise<NetworkDetails>;
4372
4389
  export function getNetworkDetails(callback: (networkDetails: NetworkDetails) => void): void;
4373
4390
  }
4374
4391
 
@@ -6310,7 +6327,7 @@ export namespace Browser {
6310
6327
  * This API is different from identity.getAccounts in two ways. The information returned is available offline, and it only applies to the primary account for the profile.
6311
6328
  * @param details Profile options.
6312
6329
  *
6313
- * Can return its result via Promise since Chrome 105.
6330
+ * Can return its result via Promise since Chrome 106.
6314
6331
  */
6315
6332
  export function getProfileUserInfo(details?: ProfileDetails): Promise<ProfileUserInfo>;
6316
6333
  export function getProfileUserInfo(
@@ -6325,7 +6342,7 @@ export namespace Browser {
6325
6342
  * If an access token is discovered to be invalid, it should be passed to removeCachedAuthToken to remove it from the cache. The app may then retrieve a fresh token with `getAuthToken`.
6326
6343
  * @param details Token information.
6327
6344
  *
6328
- * Can return its result via Promise since Chrome 105.
6345
+ * Can return its result via Promise since Chrome 106.
6329
6346
  */
6330
6347
  export function removeCachedAuthToken(details: InvalidTokenDetails): Promise<void>;
6331
6348
  export function removeCachedAuthToken(details: InvalidTokenDetails, callback: () => void): void;
@@ -7913,7 +7930,7 @@ export namespace Browser {
7913
7930
 
7914
7931
  export enum ClientCertificateType {
7915
7932
  ECDSA_SIGN = "ecdsaSign",
7916
- RAS_SIGN = "rasSign",
7933
+ RSA_SIGN = "rsaSign",
7917
7934
  }
7918
7935
 
7919
7936
  export interface SelectDetails {
@@ -8808,7 +8825,7 @@ export namespace Browser {
8808
8825
  export type QueryInfo =
8809
8826
  & {
8810
8827
  /** String to query with the default search provider. */
8811
- text?: string | undefined;
8828
+ text: string;
8812
8829
  }
8813
8830
  & (
8814
8831
  | {
@@ -12144,7 +12161,7 @@ export namespace Browser {
12144
12161
  * Called when the list of {@link TtsVoice} that would be returned by getVoices has changed.
12145
12162
  * @since Chrome 124
12146
12163
  */
12147
- const onVoicesChanged: Browser.events.Event<() => void>;
12164
+ export const onVoicesChanged: Browser.events.Event<() => void>;
12148
12165
  }
12149
12166
 
12150
12167
  ////////////////////
@@ -13096,7 +13113,7 @@ export namespace Browser {
13096
13113
  EXTRA_HEADERS = "extraHeaders",
13097
13114
  }
13098
13115
 
13099
- /** @since Chrome 44 */
13116
+ /** @since Chrome 79 */
13100
13117
  export enum OnErrorOccurredOptions {
13101
13118
  /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13102
13119
  EXTRA_HEADERS = "extraHeaders",
@@ -13288,14 +13305,14 @@ export namespace Browser {
13288
13305
  extends SetPartial<WebRequestDetails, "documentId" | "documentLifecycle" | "frameType">
13289
13306
  {
13290
13307
  /** Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'. */
13291
- requestBody: {
13308
+ requestBody?: {
13292
13309
  /** Errors when obtaining request body data. */
13293
13310
  error?: string;
13294
13311
  /** If the request method is POST and the body is a sequence of key-value pairs encoded in UTF8, encoded as either multipart/form-data, or application/x-www-form-urlencoded, this dictionary is present and for each key contains the list of all values for that key. If the data is of another media type, or if it is malformed, the dictionary is not present. An example value of this dictionary is {'key': \['value1', 'value2'\]}. */
13295
13312
  formData?: { [key: string]: FormDataItem[] };
13296
13313
  /** If the request method is PUT or POST, and the body is not already parsed in formData, then the unparsed request body elements are contained in this array. */
13297
13314
  raw?: UploadData[];
13298
- } | undefined;
13315
+ };
13299
13316
  }
13300
13317
 
13301
13318
  export interface OnBeforeSendHeadersDetails extends WebRequestDetails {
@@ -14347,7 +14364,7 @@ export namespace Browser {
14347
14364
  * The headers provided by a hypothetical response if the request does not get blocked or redirected before it is sent. Represented as an object which maps a header name to a list of string values. If not specified, the hypothetical response would return empty response headers, which can match rules which match on the non-existence of headers. E.g. `{"content-type": ["text/html; charset=utf-8", "multipart/form-data"]}`
14348
14365
  * @since Chrome 129
14349
14366
  */
14350
- responseHeaders?: { [name: string]: unknown };
14367
+ responseHeaders?: { [name: string]: string[] };
14351
14368
  /** The ID of the tab in which the hypothetical request takes place. Does not need to correspond to a real tab ID. Default is -1, meaning that the request isn't related to a tab. */
14352
14369
  tabId?: number;
14353
14370
  /**
@@ -14685,13 +14702,13 @@ export namespace Browser {
14685
14702
  * Fired when the extension's side panel is closed.
14686
14703
  * @since Chrome 142
14687
14704
  */
14688
- const onClosed: events.Event<(info: PanelClosedInfo) => void>;
14705
+ export const onClosed: events.Event<(info: PanelClosedInfo) => void>;
14689
14706
 
14690
14707
  /**
14691
14708
  * Fired when the extension's side panel is opened.
14692
14709
  * @since Chrome 141
14693
14710
  */
14694
- const onOpened: events.Event<(info: PanelOpenedInfo) => void>;
14711
+ export const onOpened: events.Event<(info: PanelOpenedInfo) => void>;
14695
14712
  }
14696
14713
 
14697
14714
  ////////////////////
@@ -14797,7 +14814,7 @@ export namespace Browser {
14797
14814
  /** Specifies wildcard patterns for pages this user script will be injected into. */
14798
14815
  includeGlobs?: string[] | undefined;
14799
14816
  /** The list of ScriptSource objects defining sources of scripts to be injected into matching pages. This property must be specified for {@link register}, and when specified it must be a non-empty array.*/
14800
- js: ScriptSource[];
14817
+ js?: ScriptSource[] | undefined;
14801
14818
  /** Specifies which pages this user script will be injected into. See Match Patterns for more details on the syntax of these strings. This property must be specified for {@link register}. */
14802
14819
  matches?: string[] | undefined;
14803
14820
  /** Specifies when JavaScript files are injected into the web page. The preferred and default value is `document_idle` */