@wxt-dev/browser 0.1.36 → 0.1.38
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 -6
- package/src/__tests__/index.test.ts +7 -7
- package/src/gen/index.d.ts +56 -6
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.38",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
|
7
7
|
"types": "src/index.d.ts",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"src"
|
|
20
20
|
],
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/chrome": "0.1.
|
|
23
|
-
"
|
|
24
|
-
"nano-spawn": "^
|
|
25
|
-
"typescript": "^5.9.
|
|
26
|
-
"vitest": "^4.0.
|
|
22
|
+
"@types/chrome": "0.1.38",
|
|
23
|
+
"@types/node": "^20.0.0",
|
|
24
|
+
"nano-spawn": "^2.0.0",
|
|
25
|
+
"typescript": "^5.9.3",
|
|
26
|
+
"vitest": "^4.0.18"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
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
|
*
|
|
@@ -4069,14 +4076,17 @@ export namespace Browser {
|
|
|
4069
4076
|
id: string;
|
|
4070
4077
|
/**
|
|
4071
4078
|
* Implements the WebCrypto's SubtleCrypto interface. The cryptographic operations, including key generation, are hardware-backed.
|
|
4072
|
-
*
|
|
4079
|
+
*
|
|
4080
|
+
* 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.
|
|
4081
|
+
*
|
|
4073
4082
|
* 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.
|
|
4074
4083
|
*/
|
|
4075
4084
|
subtleCrypto: SubtleCrypto;
|
|
4076
4085
|
/**
|
|
4077
|
-
* Implements the WebCrypto's SubtleCrypto interface. The cryptographic operations, including key generation, are software-backed.
|
|
4078
|
-
*
|
|
4079
|
-
* Only non-extractable keys can be generated. The supported key
|
|
4086
|
+
* 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.
|
|
4087
|
+
*
|
|
4088
|
+
* 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.
|
|
4089
|
+
*
|
|
4080
4090
|
* 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
4091
|
* @since Chrome 97
|
|
4082
4092
|
*/
|
|
@@ -9685,7 +9695,7 @@ export namespace Browser {
|
|
|
9685
9695
|
/** Sent after onSuspend to indicate that the app won't be unloaded after all. */
|
|
9686
9696
|
export const onSuspendCanceled: events.Event<() => void>;
|
|
9687
9697
|
|
|
9688
|
-
/** Fired when a message is sent from either
|
|
9698
|
+
/** Fired when a message is sent from either {@link runtime.sendMessage} or {@link tabs.sendMessage}. */
|
|
9689
9699
|
export const onMessage: events.Event<
|
|
9690
9700
|
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
|
9691
9701
|
>;
|
|
@@ -11049,6 +11059,11 @@ export namespace Browser {
|
|
|
11049
11059
|
height?: number | undefined;
|
|
11050
11060
|
/** The session ID used to uniquely identify a tab obtained from the {@link sessions} API. */
|
|
11051
11061
|
sessionId?: string | undefined;
|
|
11062
|
+
/**
|
|
11063
|
+
* The ID of the Split View that the tab belongs to.
|
|
11064
|
+
* @since Chrome 140
|
|
11065
|
+
*/
|
|
11066
|
+
splitViewId?: number | undefined;
|
|
11052
11067
|
/**
|
|
11053
11068
|
* The ID of the group that the tab belongs to.
|
|
11054
11069
|
* @since Chrome 88
|
|
@@ -11120,6 +11135,12 @@ export namespace Browser {
|
|
|
11120
11135
|
*/
|
|
11121
11136
|
export const MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND = 2;
|
|
11122
11137
|
|
|
11138
|
+
/**
|
|
11139
|
+
* An ID that represents the absence of a split tab.
|
|
11140
|
+
* @since Chrome 140
|
|
11141
|
+
*/
|
|
11142
|
+
export const SPLIT_VIEW_ID_NONE: -1;
|
|
11143
|
+
|
|
11123
11144
|
/**
|
|
11124
11145
|
* An ID that represents the absence of a browser tab.
|
|
11125
11146
|
* @since Chrome 46
|
|
@@ -11563,7 +11584,7 @@ export namespace Browser {
|
|
|
11563
11584
|
export function duplicate(tabId: number, callback: (tab?: Tab) => void): void;
|
|
11564
11585
|
|
|
11565
11586
|
/**
|
|
11566
|
-
* Sends a single message to the content script(s) in the specified tab
|
|
11587
|
+
* 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.
|
|
11567
11588
|
*
|
|
11568
11589
|
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
|
11569
11590
|
*/
|
|
@@ -14085,6 +14106,30 @@ export namespace Browser {
|
|
|
14085
14106
|
responseHeaders?: HeaderInfo[];
|
|
14086
14107
|
}
|
|
14087
14108
|
|
|
14109
|
+
/** @since Chrome 145 */
|
|
14110
|
+
export enum RuleConditionKeys {
|
|
14111
|
+
URL_FILTER = "urlFilter",
|
|
14112
|
+
REGEX_FILTER = "regexFilter",
|
|
14113
|
+
IS_URL_FILTER_CASE_SENSITIVE = "isUrlFilterCaseSensitive",
|
|
14114
|
+
INITIATOR_DOMAINS = "initiatorDomains",
|
|
14115
|
+
EXCLUDED_INITIATOR_DOMAINS = "excludedInitiatorDomains",
|
|
14116
|
+
REQUEST_DOMAINS = "requestDomains",
|
|
14117
|
+
EXCLUDED_REQUEST_DOMAINS = "excludedRequestDomains",
|
|
14118
|
+
TOP_DOMAINS = "topDomains",
|
|
14119
|
+
EXCLUDED_TOP_DOMAINS = "excludedTopDomains",
|
|
14120
|
+
DOMAINS = "domains",
|
|
14121
|
+
EXCLUDED_DOMAINS = "excludedDomains",
|
|
14122
|
+
RESOURCE_TYPES = "resourceTypes",
|
|
14123
|
+
EXCLUDED_RESOURCE_TYPES = "excludedResourceTypes",
|
|
14124
|
+
REQUEST_METHODS = "requestMethods",
|
|
14125
|
+
EXCLUDED_REQUEST_METHODS = "excludedRequestMethods",
|
|
14126
|
+
DOMAIN_TYPE = "domainType",
|
|
14127
|
+
TAB_IDS = "tabIds",
|
|
14128
|
+
EXCLUDED_TAB_IDS = "excludedTabIds",
|
|
14129
|
+
RESPONSE_HEADERS = "responseHeaders",
|
|
14130
|
+
EXCLUDED_RESPONSE_HEADERS = "excludedResponseHeaders",
|
|
14131
|
+
}
|
|
14132
|
+
|
|
14088
14133
|
export interface MatchedRule {
|
|
14089
14134
|
/** A matching rule's ID. */
|
|
14090
14135
|
ruleId: number;
|
|
@@ -14305,6 +14350,11 @@ export namespace Browser {
|
|
|
14305
14350
|
responseHeaders?: { [name: string]: unknown };
|
|
14306
14351
|
/** 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. */
|
|
14307
14352
|
tabId?: number;
|
|
14353
|
+
/**
|
|
14354
|
+
* The associated top-level frame URL (if any) for the request.
|
|
14355
|
+
* @since Chrome 145
|
|
14356
|
+
*/
|
|
14357
|
+
topUrl?: string;
|
|
14308
14358
|
/** The resource type of the hypothetical request. */
|
|
14309
14359
|
type: `${ResourceType}`;
|
|
14310
14360
|
/** The URL of the hypothetical request. */
|