@wxt-dev/browser 0.1.43 → 0.2.2
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 +2 -2
- package/src/gen/index.d.ts +61 -52
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.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
|
7
7
|
"types": "src/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"src"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/chrome": "0.
|
|
28
|
+
"@types/chrome": "0.2.2",
|
|
29
29
|
"@types/node": "^20.17.6",
|
|
30
30
|
"nano-spawn": "^2.0.0",
|
|
31
31
|
"typescript": "^6.0.3",
|
package/src/gen/index.d.ts
CHANGED
|
@@ -383,22 +383,53 @@ export namespace Browser {
|
|
|
383
383
|
* Permissions: "alarms"
|
|
384
384
|
*/
|
|
385
385
|
export namespace alarms {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
386
|
+
type AlarmCreateInfo =
|
|
387
|
+
& {
|
|
388
|
+
/**
|
|
389
|
+
* Whether the alarm should persist across sessions (browser restarts). In Chrome, this defaults to true to match historical behavior, but you should set this explicitly to maximize compatibility across browsers.
|
|
390
|
+
* @since Chrome 150
|
|
391
|
+
*/
|
|
392
|
+
persistAcrossSessions?: boolean | undefined;
|
|
393
|
+
}
|
|
394
|
+
& (
|
|
395
|
+
| {
|
|
396
|
+
/** Length of time in minutes after which the {@link onAlarm} event should fire. */
|
|
397
|
+
delayInMinutes: number;
|
|
398
|
+
/** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
|
|
399
|
+
periodInMinutes?: number | undefined;
|
|
400
|
+
/** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
|
|
401
|
+
when?: never | undefined;
|
|
402
|
+
}
|
|
403
|
+
| {
|
|
404
|
+
/** Length of time in minutes after which the {@link onAlarm} event should fire. */
|
|
405
|
+
delayInMinutes?: number | undefined;
|
|
406
|
+
/** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
|
|
407
|
+
periodInMinutes: number;
|
|
408
|
+
/** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
|
|
409
|
+
when?: number | undefined;
|
|
410
|
+
}
|
|
411
|
+
| {
|
|
412
|
+
/** Length of time in minutes after which the {@link onAlarm} event should fire. */
|
|
413
|
+
delayInMinutes?: never | undefined;
|
|
414
|
+
/** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
|
|
415
|
+
periodInMinutes?: number | undefined;
|
|
416
|
+
/** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
|
|
417
|
+
when: number;
|
|
418
|
+
}
|
|
419
|
+
);
|
|
394
420
|
|
|
395
421
|
interface Alarm {
|
|
422
|
+
/** Name of this alarm. */
|
|
423
|
+
name: string;
|
|
396
424
|
/** If not null, the alarm is a repeating alarm and will fire again in `periodInMinutes` minutes. */
|
|
397
425
|
periodInMinutes?: number;
|
|
426
|
+
/**
|
|
427
|
+
* Whether the alarm should persist across sessions (browser restarts).
|
|
428
|
+
* @since Chrome 150
|
|
429
|
+
*/
|
|
430
|
+
persistAcrossSessions: boolean;
|
|
398
431
|
/** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. `Date.now() + n`). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */
|
|
399
432
|
scheduledTime: number;
|
|
400
|
-
/** Name of this alarm. */
|
|
401
|
-
name: string;
|
|
402
433
|
}
|
|
403
434
|
|
|
404
435
|
/**
|
|
@@ -2250,7 +2281,7 @@ export namespace Browser {
|
|
|
2250
2281
|
*
|
|
2251
2282
|
* Permissions: "debugger"
|
|
2252
2283
|
*/
|
|
2253
|
-
|
|
2284
|
+
namespace _debugger {
|
|
2254
2285
|
/** Debuggee identifier. Either tabId, extensionId or targetId must be specified */
|
|
2255
2286
|
interface Debuggee {
|
|
2256
2287
|
/** The id of the tab which you intend to debug. */
|
|
@@ -7606,7 +7637,7 @@ export namespace Browser {
|
|
|
7606
7637
|
* Creates a new offscreen document for the extension.
|
|
7607
7638
|
* @param parameters The parameters describing the offscreen document to create.
|
|
7608
7639
|
*
|
|
7609
|
-
* Can return its result via Promise
|
|
7640
|
+
* Can return its result via Promise.
|
|
7610
7641
|
*/
|
|
7611
7642
|
function createDocument(parameters: CreateParameters): Promise<void>;
|
|
7612
7643
|
function createDocument(parameters: CreateParameters, callback: () => void): void;
|
|
@@ -7614,7 +7645,7 @@ export namespace Browser {
|
|
|
7614
7645
|
/**
|
|
7615
7646
|
* Closes the currently-open offscreen document for the extension.
|
|
7616
7647
|
*
|
|
7617
|
-
* Can return its result via Promise
|
|
7648
|
+
* Can return its result via Promise.
|
|
7618
7649
|
*/
|
|
7619
7650
|
function closeDocument(): Promise<void>;
|
|
7620
7651
|
function closeDocument(callback: () => void): void;
|
|
@@ -7622,7 +7653,8 @@ export namespace Browser {
|
|
|
7622
7653
|
/**
|
|
7623
7654
|
* Determines whether the extension has an active document.
|
|
7624
7655
|
*
|
|
7625
|
-
* Can return its result via Promise
|
|
7656
|
+
* Can return its result via Promise.
|
|
7657
|
+
* @since Chrome 150
|
|
7626
7658
|
*/
|
|
7627
7659
|
function hasDocument(): Promise<boolean>;
|
|
7628
7660
|
function hasDocument(callback: (result: boolean) => void): void;
|
|
@@ -9184,6 +9216,7 @@ export namespace Browser {
|
|
|
9184
9216
|
| "identity"
|
|
9185
9217
|
| "identity.email"
|
|
9186
9218
|
| "idle"
|
|
9219
|
+
| "input"
|
|
9187
9220
|
| "loginState"
|
|
9188
9221
|
| "management"
|
|
9189
9222
|
| "nativeMessaging"
|
|
@@ -9225,11 +9258,6 @@ export namespace Browser {
|
|
|
9225
9258
|
| "webRequestBlocking"
|
|
9226
9259
|
| "webRequestAuthProvider";
|
|
9227
9260
|
|
|
9228
|
-
/**
|
|
9229
|
-
* @deprecated Use `ManifestPermission` instead.
|
|
9230
|
-
*/
|
|
9231
|
-
type ManifestPermissions = ManifestPermission;
|
|
9232
|
-
|
|
9233
9261
|
/** Source : https://developer.chrome.com/docs/extensions/reference/api/permissions */
|
|
9234
9262
|
type ManifestOptionalPermission = Exclude<
|
|
9235
9263
|
ManifestPermission,
|
|
@@ -9247,11 +9275,6 @@ export namespace Browser {
|
|
|
9247
9275
|
| "webAuthenticationProxy"
|
|
9248
9276
|
>;
|
|
9249
9277
|
|
|
9250
|
-
/**
|
|
9251
|
-
* @deprecated Use `ManifestOptionalPermission` instead.
|
|
9252
|
-
*/
|
|
9253
|
-
type ManifestOptionalPermissions = ManifestOptionalPermission;
|
|
9254
|
-
|
|
9255
9278
|
interface SearchProvider {
|
|
9256
9279
|
name?: string | undefined;
|
|
9257
9280
|
keyword?: string | undefined;
|
|
@@ -10120,12 +10143,7 @@ export namespace Browser {
|
|
|
10120
10143
|
* Permissions: "storage"
|
|
10121
10144
|
*/
|
|
10122
10145
|
export namespace storage {
|
|
10123
|
-
|
|
10124
|
-
type NoInferX<T> = T[][T extends any ? 0 : never];
|
|
10125
|
-
// The next line prevents things without the export keyword from being automatically exported (like NoInferX)
|
|
10126
|
-
export {};
|
|
10127
|
-
|
|
10128
|
-
export interface StorageArea {
|
|
10146
|
+
interface StorageArea {
|
|
10129
10147
|
/**
|
|
10130
10148
|
* Gets the amount of space (in bytes) being used by one or more items.
|
|
10131
10149
|
* @param keys A single key or list of keys to get the total usage for. An empty list will return 0. Pass in `null` to get the total usage of all of storage.
|
|
@@ -10172,11 +10190,11 @@ export namespace Browser {
|
|
|
10172
10190
|
* Can return its result via Promise in Manifest V3 or later since Chrome 95.
|
|
10173
10191
|
*/
|
|
10174
10192
|
get<T = { [key: string]: unknown }>(
|
|
10175
|
-
keys?:
|
|
10193
|
+
keys?: NoInfer<keyof T> | Array<NoInfer<keyof T>> | Partial<NoInfer<T>> | null | undefined,
|
|
10176
10194
|
): Promise<T>;
|
|
10177
10195
|
get<T = { [key: string]: unknown }>(callback: (items: T) => void): void;
|
|
10178
10196
|
get<T = { [key: string]: unknown }>(
|
|
10179
|
-
keys:
|
|
10197
|
+
keys: NoInfer<keyof T> | Array<NoInfer<keyof T>> | Partial<NoInfer<T>> | null | undefined,
|
|
10180
10198
|
callback: (items: T) => void,
|
|
10181
10199
|
): void;
|
|
10182
10200
|
|
|
@@ -10203,19 +10221,19 @@ export namespace Browser {
|
|
|
10203
10221
|
getKeys(callback: (keys: string[]) => void): void;
|
|
10204
10222
|
}
|
|
10205
10223
|
|
|
10206
|
-
|
|
10224
|
+
interface StorageChange {
|
|
10207
10225
|
/** The new value of the item, if there is a new value. */
|
|
10208
10226
|
newValue?: unknown;
|
|
10209
10227
|
/** The old value of the item, if there was an old value. */
|
|
10210
10228
|
oldValue?: unknown;
|
|
10211
10229
|
}
|
|
10212
10230
|
|
|
10213
|
-
|
|
10231
|
+
interface LocalStorageArea extends StorageArea {
|
|
10214
10232
|
/** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or a rejected Promise if using async/await. */
|
|
10215
10233
|
QUOTA_BYTES: 10485760;
|
|
10216
10234
|
}
|
|
10217
10235
|
|
|
10218
|
-
|
|
10236
|
+
interface SyncStorageArea extends StorageArea {
|
|
10219
10237
|
/** @deprecated The storage.sync API no longer has a sustained write operation quota. */
|
|
10220
10238
|
MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: 1000000;
|
|
10221
10239
|
/** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected. */
|
|
@@ -10238,18 +10256,18 @@ export namespace Browser {
|
|
|
10238
10256
|
MAX_WRITE_OPERATIONS_PER_MINUTE: 120;
|
|
10239
10257
|
}
|
|
10240
10258
|
|
|
10241
|
-
|
|
10259
|
+
interface SessionStorageArea extends StorageArea {
|
|
10242
10260
|
/** The maximum amount (in bytes) of data that can be stored in memory, as measured by estimating the dynamically allocated memory usage of every value and key. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected. */
|
|
10243
10261
|
QUOTA_BYTES: 10485760;
|
|
10244
10262
|
}
|
|
10245
10263
|
|
|
10246
|
-
|
|
10264
|
+
type AreaName = "sync" | "local" | "managed" | "session";
|
|
10247
10265
|
|
|
10248
10266
|
/**
|
|
10249
10267
|
* The storage area's access level.
|
|
10250
10268
|
* @since Chrome 102
|
|
10251
10269
|
*/
|
|
10252
|
-
|
|
10270
|
+
enum AccessLevel {
|
|
10253
10271
|
/** Specifies contexts originating from the extension itself. */
|
|
10254
10272
|
TRUSTED_CONTEXTS = "TRUSTED_CONTEXTS",
|
|
10255
10273
|
/** Specifies contexts originating from outside the extension. */
|
|
@@ -10257,13 +10275,13 @@ export namespace Browser {
|
|
|
10257
10275
|
}
|
|
10258
10276
|
|
|
10259
10277
|
/** Items in the `local` storage area are local to each machine. */
|
|
10260
|
-
|
|
10278
|
+
const local: LocalStorageArea;
|
|
10261
10279
|
|
|
10262
10280
|
/** Items in the `sync` storage area are synced using Chrome Sync. */
|
|
10263
|
-
|
|
10281
|
+
const sync: SyncStorageArea;
|
|
10264
10282
|
|
|
10265
10283
|
/** Items in the `managed` storage area are set by an enterprise policy configured by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. For information on configuring a policy, see Manifest for storage areas. */
|
|
10266
|
-
|
|
10284
|
+
const managed: StorageArea;
|
|
10267
10285
|
|
|
10268
10286
|
/**
|
|
10269
10287
|
* Items in the `session` storage area are stored in-memory and will not be persisted to disk.
|
|
@@ -10271,10 +10289,10 @@ export namespace Browser {
|
|
|
10271
10289
|
* MV3 only
|
|
10272
10290
|
* @since Chrome 102
|
|
10273
10291
|
*/
|
|
10274
|
-
|
|
10292
|
+
const session: SessionStorageArea;
|
|
10275
10293
|
|
|
10276
10294
|
/** Fired when one or more items change. */
|
|
10277
|
-
|
|
10295
|
+
const onChanged: events.Event<(changes: { [key: string]: StorageChange }, areaName: AreaName) => void>;
|
|
10278
10296
|
}
|
|
10279
10297
|
|
|
10280
10298
|
////////////////////
|
|
@@ -10297,10 +10315,6 @@ export namespace Browser {
|
|
|
10297
10315
|
total: number;
|
|
10298
10316
|
}
|
|
10299
10317
|
|
|
10300
|
-
/** @deprecated Use {@link CpuTime} instead. */
|
|
10301
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
10302
|
-
interface ProcessorUsage extends CpuTime {}
|
|
10303
|
-
|
|
10304
10318
|
interface ProcessorInfo {
|
|
10305
10319
|
/** Cumulative usage info for this logical processor. */
|
|
10306
10320
|
usage: CpuTime;
|
|
@@ -12533,10 +12547,6 @@ export namespace Browser {
|
|
|
12533
12547
|
reconnect?: string | undefined;
|
|
12534
12548
|
}
|
|
12535
12549
|
|
|
12536
|
-
/** @deprecated Use {@link Parameters} instead */
|
|
12537
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
12538
|
-
interface VpnSessionParameters extends Parameters {}
|
|
12539
|
-
|
|
12540
12550
|
/** The enum is used by the platform to notify the client of the VPN session status. */
|
|
12541
12551
|
enum PlatformMessage {
|
|
12542
12552
|
/** Indicates that the VPN configuration connected. */
|
|
@@ -13441,7 +13451,6 @@ export namespace Browser {
|
|
|
13441
13451
|
|
|
13442
13452
|
/** Fired before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is made to the server, but before any HTTP data is sent. */
|
|
13443
13453
|
const onBeforeSendHeaders: WebRequestEvent<
|
|
13444
|
-
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
13445
13454
|
(details: OnBeforeSendHeadersDetails) => BlockingResponse | undefined,
|
|
13446
13455
|
`${OnBeforeSendHeadersOptions}`[]
|
|
13447
13456
|
>;
|