@wxt-dev/browser 0.1.37 → 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.
- package/package.json +3 -3
- package/src/gen/index.d.ts +44 -24
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.
|
|
4
|
+
"version": "0.1.39",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
|
7
7
|
"types": "src/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"src"
|
|
20
20
|
],
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/chrome": "0.1.
|
|
23
|
-
"
|
|
22
|
+
"@types/chrome": "0.1.39",
|
|
23
|
+
"@types/node": "^20.0.0",
|
|
24
24
|
"nano-spawn": "^2.0.0",
|
|
25
25
|
"typescript": "^5.9.3",
|
|
26
26
|
"vitest": "^4.0.18"
|
package/src/gen/index.d.ts
CHANGED
|
@@ -348,9 +348,10 @@ export namespace Browser {
|
|
|
348
348
|
export function setIcon(details: TabIconDetails, callback: () => void): void;
|
|
349
349
|
|
|
350
350
|
/**
|
|
351
|
-
* Sets the
|
|
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(
|
|
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;
|
|
@@ -4076,14 +4090,17 @@ export namespace Browser {
|
|
|
4076
4090
|
id: string;
|
|
4077
4091
|
/**
|
|
4078
4092
|
* Implements the WebCrypto's SubtleCrypto interface. The cryptographic operations, including key generation, are hardware-backed.
|
|
4079
|
-
*
|
|
4093
|
+
*
|
|
4094
|
+
* Only non-extractable keys can be generated. The supported key types are RSASSA-PKCS1-V1_5 with `modulusLength` up to 2048 and ECDSA with `namedCurve` P-256. Each key can be used for signing data at most once, unless the extension is allowlisted by the KeyPermissions policy, in which case the key can be used indefinitely.
|
|
4095
|
+
*
|
|
4080
4096
|
* Keys generated on a specific `Token` cannot be used with any other Tokens, nor can they be used with `window.crypto.subtle`. Equally, `Key` objects created with `window.crypto.subtle` cannot be used with this interface.
|
|
4081
4097
|
*/
|
|
4082
4098
|
subtleCrypto: SubtleCrypto;
|
|
4083
4099
|
/**
|
|
4084
|
-
* Implements the WebCrypto's SubtleCrypto interface. The cryptographic operations, including key generation, are software-backed.
|
|
4085
|
-
*
|
|
4086
|
-
* Only non-extractable keys can be generated. The supported key
|
|
4100
|
+
* Implements the WebCrypto's SubtleCrypto interface. The cryptographic operations, including key generation, are software-backed. Protection of the keys, and thus implementation of the non-extractable property, is done in software, so the keys are less protected than hardware-backed keys.
|
|
4101
|
+
*
|
|
4102
|
+
* Only non-extractable keys can be generated. The only supported key type is RSASSA-PKCS1-V1_5 with `modulusLength` up to 2048. up to 2048. Each key can be used for signing data at most once, unless the extension is allowlisted through the KeyPermissions policy, in which case the key can be used indefinitely.
|
|
4103
|
+
*
|
|
4087
4104
|
* Keys generated on a specific `Token` cannot be used with any other Tokens, nor can they be used with `window.crypto.subtle`. Equally, `Key` objects created with `window.crypto.subtle` cannot be used with this interface.
|
|
4088
4105
|
* @since Chrome 97
|
|
4089
4106
|
*/
|
|
@@ -4363,9 +4380,12 @@ export namespace Browser {
|
|
|
4363
4380
|
}
|
|
4364
4381
|
|
|
4365
4382
|
/**
|
|
4366
|
-
* 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.
|
|
4367
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.
|
|
4368
4387
|
*/
|
|
4388
|
+
export function getNetworkDetails(): Promise<NetworkDetails>;
|
|
4369
4389
|
export function getNetworkDetails(callback: (networkDetails: NetworkDetails) => void): void;
|
|
4370
4390
|
}
|
|
4371
4391
|
|
|
@@ -6307,7 +6327,7 @@ export namespace Browser {
|
|
|
6307
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.
|
|
6308
6328
|
* @param details Profile options.
|
|
6309
6329
|
*
|
|
6310
|
-
* Can return its result via Promise since Chrome
|
|
6330
|
+
* Can return its result via Promise since Chrome 106.
|
|
6311
6331
|
*/
|
|
6312
6332
|
export function getProfileUserInfo(details?: ProfileDetails): Promise<ProfileUserInfo>;
|
|
6313
6333
|
export function getProfileUserInfo(
|
|
@@ -6322,7 +6342,7 @@ export namespace Browser {
|
|
|
6322
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`.
|
|
6323
6343
|
* @param details Token information.
|
|
6324
6344
|
*
|
|
6325
|
-
* Can return its result via Promise since Chrome
|
|
6345
|
+
* Can return its result via Promise since Chrome 106.
|
|
6326
6346
|
*/
|
|
6327
6347
|
export function removeCachedAuthToken(details: InvalidTokenDetails): Promise<void>;
|
|
6328
6348
|
export function removeCachedAuthToken(details: InvalidTokenDetails, callback: () => void): void;
|
|
@@ -7910,7 +7930,7 @@ export namespace Browser {
|
|
|
7910
7930
|
|
|
7911
7931
|
export enum ClientCertificateType {
|
|
7912
7932
|
ECDSA_SIGN = "ecdsaSign",
|
|
7913
|
-
|
|
7933
|
+
RSA_SIGN = "rsaSign",
|
|
7914
7934
|
}
|
|
7915
7935
|
|
|
7916
7936
|
export interface SelectDetails {
|
|
@@ -8805,7 +8825,7 @@ export namespace Browser {
|
|
|
8805
8825
|
export type QueryInfo =
|
|
8806
8826
|
& {
|
|
8807
8827
|
/** String to query with the default search provider. */
|
|
8808
|
-
text
|
|
8828
|
+
text: string;
|
|
8809
8829
|
}
|
|
8810
8830
|
& (
|
|
8811
8831
|
| {
|
|
@@ -9692,7 +9712,7 @@ export namespace Browser {
|
|
|
9692
9712
|
/** Sent after onSuspend to indicate that the app won't be unloaded after all. */
|
|
9693
9713
|
export const onSuspendCanceled: events.Event<() => void>;
|
|
9694
9714
|
|
|
9695
|
-
/** Fired when a message is sent from either
|
|
9715
|
+
/** Fired when a message is sent from either {@link runtime.sendMessage} or {@link tabs.sendMessage}. */
|
|
9696
9716
|
export const onMessage: events.Event<
|
|
9697
9717
|
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
|
9698
9718
|
>;
|
|
@@ -11058,7 +11078,7 @@ export namespace Browser {
|
|
|
11058
11078
|
sessionId?: string | undefined;
|
|
11059
11079
|
/**
|
|
11060
11080
|
* The ID of the Split View that the tab belongs to.
|
|
11061
|
-
* @since Chrome
|
|
11081
|
+
* @since Chrome 140
|
|
11062
11082
|
*/
|
|
11063
11083
|
splitViewId?: number | undefined;
|
|
11064
11084
|
/**
|
|
@@ -11134,7 +11154,7 @@ export namespace Browser {
|
|
|
11134
11154
|
|
|
11135
11155
|
/**
|
|
11136
11156
|
* An ID that represents the absence of a split tab.
|
|
11137
|
-
* @since Chrome
|
|
11157
|
+
* @since Chrome 140
|
|
11138
11158
|
*/
|
|
11139
11159
|
export const SPLIT_VIEW_ID_NONE: -1;
|
|
11140
11160
|
|
|
@@ -11581,7 +11601,7 @@ export namespace Browser {
|
|
|
11581
11601
|
export function duplicate(tabId: number, callback: (tab?: Tab) => void): void;
|
|
11582
11602
|
|
|
11583
11603
|
/**
|
|
11584
|
-
* Sends a single message to the content script(s) in the specified tab
|
|
11604
|
+
* Sends a single message to the content script(s) in the specified tab. The {@link runtime.onMessage} event is fired in each content script running in the specified tab for the current extension.
|
|
11585
11605
|
*
|
|
11586
11606
|
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
|
11587
11607
|
*/
|
|
@@ -12141,7 +12161,7 @@ export namespace Browser {
|
|
|
12141
12161
|
* Called when the list of {@link TtsVoice} that would be returned by getVoices has changed.
|
|
12142
12162
|
* @since Chrome 124
|
|
12143
12163
|
*/
|
|
12144
|
-
const onVoicesChanged: Browser.events.Event<() => void>;
|
|
12164
|
+
export const onVoicesChanged: Browser.events.Event<() => void>;
|
|
12145
12165
|
}
|
|
12146
12166
|
|
|
12147
12167
|
////////////////////
|
|
@@ -13093,7 +13113,7 @@ export namespace Browser {
|
|
|
13093
13113
|
EXTRA_HEADERS = "extraHeaders",
|
|
13094
13114
|
}
|
|
13095
13115
|
|
|
13096
|
-
/** @since Chrome
|
|
13116
|
+
/** @since Chrome 79 */
|
|
13097
13117
|
export enum OnErrorOccurredOptions {
|
|
13098
13118
|
/** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
|
|
13099
13119
|
EXTRA_HEADERS = "extraHeaders",
|
|
@@ -13285,14 +13305,14 @@ export namespace Browser {
|
|
|
13285
13305
|
extends SetPartial<WebRequestDetails, "documentId" | "documentLifecycle" | "frameType">
|
|
13286
13306
|
{
|
|
13287
13307
|
/** Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'. */
|
|
13288
|
-
requestBody
|
|
13308
|
+
requestBody?: {
|
|
13289
13309
|
/** Errors when obtaining request body data. */
|
|
13290
13310
|
error?: string;
|
|
13291
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'\]}. */
|
|
13292
13312
|
formData?: { [key: string]: FormDataItem[] };
|
|
13293
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. */
|
|
13294
13314
|
raw?: UploadData[];
|
|
13295
|
-
}
|
|
13315
|
+
};
|
|
13296
13316
|
}
|
|
13297
13317
|
|
|
13298
13318
|
export interface OnBeforeSendHeadersDetails extends WebRequestDetails {
|
|
@@ -14344,7 +14364,7 @@ export namespace Browser {
|
|
|
14344
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"]}`
|
|
14345
14365
|
* @since Chrome 129
|
|
14346
14366
|
*/
|
|
14347
|
-
responseHeaders?: { [name: string]:
|
|
14367
|
+
responseHeaders?: { [name: string]: string[] };
|
|
14348
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. */
|
|
14349
14369
|
tabId?: number;
|
|
14350
14370
|
/**
|
|
@@ -14682,13 +14702,13 @@ export namespace Browser {
|
|
|
14682
14702
|
* Fired when the extension's side panel is closed.
|
|
14683
14703
|
* @since Chrome 142
|
|
14684
14704
|
*/
|
|
14685
|
-
const onClosed: events.Event<(info: PanelClosedInfo) => void>;
|
|
14705
|
+
export const onClosed: events.Event<(info: PanelClosedInfo) => void>;
|
|
14686
14706
|
|
|
14687
14707
|
/**
|
|
14688
14708
|
* Fired when the extension's side panel is opened.
|
|
14689
14709
|
* @since Chrome 141
|
|
14690
14710
|
*/
|
|
14691
|
-
const onOpened: events.Event<(info: PanelOpenedInfo) => void>;
|
|
14711
|
+
export const onOpened: events.Event<(info: PanelOpenedInfo) => void>;
|
|
14692
14712
|
}
|
|
14693
14713
|
|
|
14694
14714
|
////////////////////
|
|
@@ -14794,7 +14814,7 @@ export namespace Browser {
|
|
|
14794
14814
|
/** Specifies wildcard patterns for pages this user script will be injected into. */
|
|
14795
14815
|
includeGlobs?: string[] | undefined;
|
|
14796
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.*/
|
|
14797
|
-
js
|
|
14817
|
+
js?: ScriptSource[] | undefined;
|
|
14798
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}. */
|
|
14799
14819
|
matches?: string[] | undefined;
|
|
14800
14820
|
/** Specifies when JavaScript files are injected into the web page. The preferred and default value is `document_idle` */
|