@wxt-dev/browser 0.1.32 → 0.1.37
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 +6 -7
- package/src/__tests__/index.test.ts +7 -7
- package/src/gen/index.d.ts +118 -3
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.37",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
|
7
7
|
"types": "src/index.d.ts",
|
|
@@ -19,12 +19,11 @@
|
|
|
19
19
|
"src"
|
|
20
20
|
],
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/chrome": "0.1.
|
|
23
|
-
"fs-extra": "^11.3.
|
|
24
|
-
"nano-spawn": "^
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"vitest": "^3.1.2"
|
|
22
|
+
"@types/chrome": "0.1.37",
|
|
23
|
+
"fs-extra": "^11.3.3",
|
|
24
|
+
"nano-spawn": "^2.0.0",
|
|
25
|
+
"typescript": "^5.9.3",
|
|
26
|
+
"vitest": "^4.0.18"
|
|
28
27
|
},
|
|
29
28
|
"dependencies": {
|
|
30
29
|
"@types/filesystem": "*",
|
|
@@ -5,19 +5,19 @@ import { browser, type Browser } from '../index';
|
|
|
5
5
|
describe('browser', () => {
|
|
6
6
|
describe('types', () => {
|
|
7
7
|
it('should provide types via the Browser import', () => {
|
|
8
|
-
expectTypeOf<Browser.runtime.MessageSender>().
|
|
9
|
-
expectTypeOf<Browser.storage.AreaName>().
|
|
10
|
-
expectTypeOf<Browser.i18n.LanguageDetectionResult>().
|
|
8
|
+
expectTypeOf<Browser.runtime.MessageSender>().toEqualTypeOf<chrome.runtime.MessageSender>();
|
|
9
|
+
expectTypeOf<Browser.storage.AreaName>().toEqualTypeOf<chrome.storage.AreaName>();
|
|
10
|
+
expectTypeOf<Browser.i18n.LanguageDetectionResult>().toEqualTypeOf<chrome.i18n.LanguageDetectionResult>();
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
it('should provide values via the browser import', () => {
|
|
14
|
-
expectTypeOf(browser.runtime.id).
|
|
14
|
+
expectTypeOf(browser.runtime.id).toEqualTypeOf<string>();
|
|
15
15
|
expectTypeOf(
|
|
16
16
|
browser.storage.local,
|
|
17
|
-
).
|
|
17
|
+
).toEqualTypeOf<Browser.storage.LocalStorageArea>();
|
|
18
18
|
expectTypeOf(
|
|
19
|
-
browser.i18n.detectLanguage
|
|
20
|
-
).resolves.
|
|
19
|
+
browser.i18n.detectLanguage,
|
|
20
|
+
).returns.resolves.toEqualTypeOf<chrome.i18n.LanguageDetectionResult>();
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
});
|
package/src/gen/index.d.ts
CHANGED
|
@@ -694,9 +694,16 @@ export namespace Browser {
|
|
|
694
694
|
|
|
695
695
|
/** @deprecated Bookmark write operations are no longer limited by Chrome. */
|
|
696
696
|
export const MAX_WRITE_OPERATIONS_PER_HOUR: 1000000;
|
|
697
|
+
|
|
697
698
|
/** @deprecated Bookmark write operations are no longer limited by Chrome. */
|
|
698
699
|
export const MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: 1000000;
|
|
699
700
|
|
|
701
|
+
/**
|
|
702
|
+
* The `id` associated with the root level node.
|
|
703
|
+
* @since Chrome 145
|
|
704
|
+
*/
|
|
705
|
+
export const ROOT_NODE_ID = "0";
|
|
706
|
+
|
|
700
707
|
/**
|
|
701
708
|
* Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.
|
|
702
709
|
*
|
|
@@ -1031,7 +1038,7 @@ export namespace Browser {
|
|
|
1031
1038
|
cookies?: boolean | undefined;
|
|
1032
1039
|
/**
|
|
1033
1040
|
* Stored passwords.
|
|
1034
|
-
* @deprecated Support for password deletion through extensions has been removed. This data type will be ignored.
|
|
1041
|
+
* @deprecated since Chrome 144. Support for password deletion through extensions has been removed. This data type will be ignored.
|
|
1035
1042
|
*/
|
|
1036
1043
|
passwords?: boolean | undefined;
|
|
1037
1044
|
/**
|
|
@@ -1127,7 +1134,7 @@ export namespace Browser {
|
|
|
1127
1134
|
* Clears the browser's stored passwords.
|
|
1128
1135
|
*
|
|
1129
1136
|
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
1130
|
-
* @deprecated Support for password deletion through extensions has been removed. This function has no effect.
|
|
1137
|
+
* @deprecated since Chrome 144. Support for password deletion through extensions has been removed. This function has no effect.
|
|
1131
1138
|
*/
|
|
1132
1139
|
export function removePasswords(options: RemovalOptions): Promise<void>;
|
|
1133
1140
|
export function removePasswords(options: RemovalOptions, callback: () => void): void;
|
|
@@ -3781,6 +3788,8 @@ export namespace Browser {
|
|
|
3781
3788
|
BLOCKED_SCAN_FAILED = "blockedScanFailed",
|
|
3782
3789
|
/** For use by the Secure Enterprise Browser extension. When required, Chrome will block the download to disc and download the file directly to Google Drive. */
|
|
3783
3790
|
FORCE_SAVE_TO_GDRIVE = "forceSaveToGdrive",
|
|
3791
|
+
/** For use by the Secure Enterprise Browser extension. When required, Chrome will block the download to disc and download the file directly to OneDrive. */
|
|
3792
|
+
FORCE_SAVE_TO_ONEDRIVE = "forceSaveToOnedrive",
|
|
3784
3793
|
}
|
|
3785
3794
|
|
|
3786
3795
|
export interface DownloadItem {
|
|
@@ -11047,6 +11056,11 @@ export namespace Browser {
|
|
|
11047
11056
|
height?: number | undefined;
|
|
11048
11057
|
/** The session ID used to uniquely identify a tab obtained from the {@link sessions} API. */
|
|
11049
11058
|
sessionId?: string | undefined;
|
|
11059
|
+
/**
|
|
11060
|
+
* The ID of the Split View that the tab belongs to.
|
|
11061
|
+
* @since Chrome 145
|
|
11062
|
+
*/
|
|
11063
|
+
splitViewId?: number | undefined;
|
|
11050
11064
|
/**
|
|
11051
11065
|
* The ID of the group that the tab belongs to.
|
|
11052
11066
|
* @since Chrome 88
|
|
@@ -11118,6 +11132,12 @@ export namespace Browser {
|
|
|
11118
11132
|
*/
|
|
11119
11133
|
export const MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND = 2;
|
|
11120
11134
|
|
|
11135
|
+
/**
|
|
11136
|
+
* An ID that represents the absence of a split tab.
|
|
11137
|
+
* @since Chrome 145
|
|
11138
|
+
*/
|
|
11139
|
+
export const SPLIT_VIEW_ID_NONE: -1;
|
|
11140
|
+
|
|
11121
11141
|
/**
|
|
11122
11142
|
* An ID that represents the absence of a browser tab.
|
|
11123
11143
|
* @since Chrome 46
|
|
@@ -13087,6 +13107,10 @@ export namespace Browser {
|
|
|
13087
13107
|
EXTRA_HEADERS = "extraHeaders",
|
|
13088
13108
|
/** Specifies that the response headers should be included in the event. */
|
|
13089
13109
|
RESPONSE_HEADERS = "responseHeaders",
|
|
13110
|
+
/** Specifies that the SecurityInfo should be included in the event. */
|
|
13111
|
+
SECURITY_INFO = "securityInfo",
|
|
13112
|
+
/** Specifies that the SecurityInfo with raw bytes of certificates should be included in the event. */
|
|
13113
|
+
SECURITY_INFO_RAW_DER = "securityInfoRawDer",
|
|
13090
13114
|
}
|
|
13091
13115
|
|
|
13092
13116
|
/** @since Chrome 44 */
|
|
@@ -13147,6 +13171,23 @@ export namespace Browser {
|
|
|
13147
13171
|
OTHER = "other",
|
|
13148
13172
|
}
|
|
13149
13173
|
|
|
13174
|
+
/** @since Chrome 144 */
|
|
13175
|
+
export interface SecurityInfo {
|
|
13176
|
+
/** A list of certificates */
|
|
13177
|
+
certificates: {
|
|
13178
|
+
/** Fingerprints of the certificate. */
|
|
13179
|
+
fingerprint: {
|
|
13180
|
+
/** sha256 fingerprint of the certificate. */
|
|
13181
|
+
sha256: string;
|
|
13182
|
+
};
|
|
13183
|
+
/** Raw bytes of DER encoded server certificate */
|
|
13184
|
+
rawDER?: ArrayBuffer;
|
|
13185
|
+
}[];
|
|
13186
|
+
|
|
13187
|
+
/** State of the connection. One of secure, insecure, broken. */
|
|
13188
|
+
state: string;
|
|
13189
|
+
}
|
|
13190
|
+
|
|
13150
13191
|
/** Contains data uploaded in a URL request. */
|
|
13151
13192
|
export interface UploadData {
|
|
13152
13193
|
/** An ArrayBuffer with a copy of the data. */
|
|
@@ -13164,7 +13205,7 @@ export namespace Browser {
|
|
|
13164
13205
|
* The UUID of the document making the request.
|
|
13165
13206
|
* @since Chrome 106
|
|
13166
13207
|
*/
|
|
13167
|
-
documentId
|
|
13208
|
+
documentId?: string;
|
|
13168
13209
|
/**
|
|
13169
13210
|
* The lifecycle the document is in.
|
|
13170
13211
|
* @since Chrome 106
|
|
@@ -13284,6 +13325,11 @@ export namespace Browser {
|
|
|
13284
13325
|
export interface OnHeadersReceivedDetails extends WebRequestDetails {
|
|
13285
13326
|
/** The HTTP response headers that have been received with this response. */
|
|
13286
13327
|
responseHeaders?: HttpHeader[];
|
|
13328
|
+
/**
|
|
13329
|
+
* Information about the TLS/QUIC connection used for the underlying connection. Only provided if `securityInfo` is specified in the `extraInfoSpec` parameter.
|
|
13330
|
+
* @since Chrome 144
|
|
13331
|
+
*/
|
|
13332
|
+
securityInfo?: SecurityInfo;
|
|
13287
13333
|
/** Standard HTTP status code returned by the server. */
|
|
13288
13334
|
statusCode: number;
|
|
13289
13335
|
/** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/
|
|
@@ -13954,6 +14000,32 @@ export namespace Browser {
|
|
|
13954
14000
|
*/
|
|
13955
14001
|
excludedTabIds?: number[] | undefined;
|
|
13956
14002
|
|
|
14003
|
+
/**
|
|
14004
|
+
* The rule will only match network requests when the associated top-level frame's domain matches one from the list of `topDomains`. If the list is omitted, the rule is applied to requests associated with all top-level frame domains. An empty list is not allowed.
|
|
14005
|
+
*
|
|
14006
|
+
* Notes:
|
|
14007
|
+
* - Sub-domains like "a.example.com" are also allowed.
|
|
14008
|
+
* - The entries must consist of only ascii characters.
|
|
14009
|
+
* - Use punycode encoding for internationalized domains.
|
|
14010
|
+
* - Sub-domains of the listed domains are also matched.
|
|
14011
|
+
* - For requests with no associated top-level frame (e.g. ServiceWorker initiated requests, the request initiator's domain is considered instead.
|
|
14012
|
+
* @since Chrome 141
|
|
14013
|
+
*/
|
|
14014
|
+
topDomains?: string[] | undefined;
|
|
14015
|
+
|
|
14016
|
+
/**
|
|
14017
|
+
* The rule will not match network requests when the associated top-level frame's domain matches one from the list of `excludedTopDomains`. If the list is empty or omitted, no domains are excluded. This takes precedence over `topDomains`.
|
|
14018
|
+
*
|
|
14019
|
+
* Notes:
|
|
14020
|
+
* - Sub-domains like "a.example.com" are also allowed.
|
|
14021
|
+
* - The entries must consist of only ascii characters.
|
|
14022
|
+
* - Use punycode encoding for internationalized domains.
|
|
14023
|
+
* - Sub-domains of the listed domains are also excluded.
|
|
14024
|
+
* - For requests with no associated top-level frame (e.g. ServiceWorker initiated requests, the request initiator's domain is considered instead.
|
|
14025
|
+
* @since Chrome 141
|
|
14026
|
+
*/
|
|
14027
|
+
excludedTopDomains?: string[] | undefined;
|
|
14028
|
+
|
|
13957
14029
|
/** Whether the `urlFilter` or `regexFilter` (whichever is specified) is case sensitive. Default is false. */
|
|
13958
14030
|
isUrlFilterCaseSensitive?: boolean | undefined;
|
|
13959
14031
|
|
|
@@ -14031,6 +14103,30 @@ export namespace Browser {
|
|
|
14031
14103
|
responseHeaders?: HeaderInfo[];
|
|
14032
14104
|
}
|
|
14033
14105
|
|
|
14106
|
+
/** @since Chrome 145 */
|
|
14107
|
+
export enum RuleConditionKeys {
|
|
14108
|
+
URL_FILTER = "urlFilter",
|
|
14109
|
+
REGEX_FILTER = "regexFilter",
|
|
14110
|
+
IS_URL_FILTER_CASE_SENSITIVE = "isUrlFilterCaseSensitive",
|
|
14111
|
+
INITIATOR_DOMAINS = "initiatorDomains",
|
|
14112
|
+
EXCLUDED_INITIATOR_DOMAINS = "excludedInitiatorDomains",
|
|
14113
|
+
REQUEST_DOMAINS = "requestDomains",
|
|
14114
|
+
EXCLUDED_REQUEST_DOMAINS = "excludedRequestDomains",
|
|
14115
|
+
TOP_DOMAINS = "topDomains",
|
|
14116
|
+
EXCLUDED_TOP_DOMAINS = "excludedTopDomains",
|
|
14117
|
+
DOMAINS = "domains",
|
|
14118
|
+
EXCLUDED_DOMAINS = "excludedDomains",
|
|
14119
|
+
RESOURCE_TYPES = "resourceTypes",
|
|
14120
|
+
EXCLUDED_RESOURCE_TYPES = "excludedResourceTypes",
|
|
14121
|
+
REQUEST_METHODS = "requestMethods",
|
|
14122
|
+
EXCLUDED_REQUEST_METHODS = "excludedRequestMethods",
|
|
14123
|
+
DOMAIN_TYPE = "domainType",
|
|
14124
|
+
TAB_IDS = "tabIds",
|
|
14125
|
+
EXCLUDED_TAB_IDS = "excludedTabIds",
|
|
14126
|
+
RESPONSE_HEADERS = "responseHeaders",
|
|
14127
|
+
EXCLUDED_RESPONSE_HEADERS = "excludedResponseHeaders",
|
|
14128
|
+
}
|
|
14129
|
+
|
|
14034
14130
|
export interface MatchedRule {
|
|
14035
14131
|
/** A matching rule's ID. */
|
|
14036
14132
|
ruleId: number;
|
|
@@ -14251,6 +14347,11 @@ export namespace Browser {
|
|
|
14251
14347
|
responseHeaders?: { [name: string]: unknown };
|
|
14252
14348
|
/** 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. */
|
|
14253
14349
|
tabId?: number;
|
|
14350
|
+
/**
|
|
14351
|
+
* The associated top-level frame URL (if any) for the request.
|
|
14352
|
+
* @since Chrome 145
|
|
14353
|
+
*/
|
|
14354
|
+
topUrl?: string;
|
|
14254
14355
|
/** The resource type of the hypothetical request. */
|
|
14255
14356
|
type: `${ResourceType}`;
|
|
14256
14357
|
/** The URL of the hypothetical request. */
|
|
@@ -14517,6 +14618,14 @@ export namespace Browser {
|
|
|
14517
14618
|
default_path: string;
|
|
14518
14619
|
}
|
|
14519
14620
|
|
|
14621
|
+
/**
|
|
14622
|
+
* Closes the extension's side panel. This is a no-op if the panel is already closed.
|
|
14623
|
+
* @param options Specifies the context in which to close the side panel.
|
|
14624
|
+
* @since Chrome 141
|
|
14625
|
+
*/
|
|
14626
|
+
export function close(options: CloseOptions): Promise<void>;
|
|
14627
|
+
export function close(options: CloseOptions, callback: () => void): void;
|
|
14628
|
+
|
|
14520
14629
|
/**
|
|
14521
14630
|
* Returns the side panel's current layout.
|
|
14522
14631
|
* @since Chrome 140
|
|
@@ -14569,6 +14678,12 @@ export namespace Browser {
|
|
|
14569
14678
|
export function setPanelBehavior(behavior: PanelBehavior): Promise<void>;
|
|
14570
14679
|
export function setPanelBehavior(behavior: PanelBehavior, callback: () => void): void;
|
|
14571
14680
|
|
|
14681
|
+
/**
|
|
14682
|
+
* Fired when the extension's side panel is closed.
|
|
14683
|
+
* @since Chrome 142
|
|
14684
|
+
*/
|
|
14685
|
+
const onClosed: events.Event<(info: PanelClosedInfo) => void>;
|
|
14686
|
+
|
|
14572
14687
|
/**
|
|
14573
14688
|
* Fired when the extension's side panel is opened.
|
|
14574
14689
|
* @since Chrome 141
|