@wxt-dev/browser 0.1.42 → 0.2.0

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 +5 -5
  2. package/src/gen/index.d.ts +26 -44
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.42",
4
+ "version": "0.2.0",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
7
7
  "types": "src/index.d.ts",
@@ -25,11 +25,11 @@
25
25
  "src"
26
26
  ],
27
27
  "devDependencies": {
28
- "@types/chrome": "0.1.42",
29
- "@types/node": "^20.0.0",
28
+ "@types/chrome": "0.2.0",
29
+ "@types/node": "^20.17.6",
30
30
  "nano-spawn": "^2.0.0",
31
- "typescript": "^5.9.3",
32
- "vitest": "^4.0.18"
31
+ "typescript": "^6.0.3",
32
+ "vitest": "^4.1.5"
33
33
  },
34
34
  "dependencies": {
35
35
  "@types/filesystem": "*",
@@ -1727,7 +1727,7 @@ export namespace Browser {
1727
1727
  *
1728
1728
  * `allow`: Allow sites to use advanced clipboard capabilities,
1729
1729
  *
1730
- * `block`: Don't allow sites to use advanced clipboard capabilties,
1730
+ * `block`: Don't allow sites to use advanced clipboard capabilities,
1731
1731
  *
1732
1732
  * `ask`: Ask when a site wants to use advanced clipboard capabilities.
1733
1733
  *
@@ -1878,6 +1878,8 @@ export namespace Browser {
1878
1878
  BROWSER_ACTION = "browser_action",
1879
1879
  PAGE_ACTION = "page_action",
1880
1880
  ACTION = "action",
1881
+ /** @since Chrome 149 */
1882
+ TAB = "tab",
1881
1883
  }
1882
1884
 
1883
1885
  /**
@@ -2248,7 +2250,7 @@ export namespace Browser {
2248
2250
  *
2249
2251
  * Permissions: "debugger"
2250
2252
  */
2251
- export namespace _debugger {
2253
+ namespace _debugger {
2252
2254
  /** Debuggee identifier. Either tabId, extensionId or targetId must be specified */
2253
2255
  interface Debuggee {
2254
2256
  /** The id of the tab which you intend to debug. */
@@ -2587,7 +2589,7 @@ export namespace Browser {
2587
2589
  interface EditResponseCookie {
2588
2590
  /** Filter for cookies that will be modified. All empty entries are ignored. */
2589
2591
  filter: ResponseCookie;
2590
- /** Attributes that shall be overridden in cookies that machted the filter. Attributes that are set to an empty string are removed. */
2592
+ /** Attributes that shall be overridden in cookies that matched the filter. Attributes that are set to an empty string are removed. */
2591
2593
  modification: ResponseCookie;
2592
2594
  }
2593
2595
 
@@ -2605,7 +2607,7 @@ export namespace Browser {
2605
2607
  interface EditRequestCookie {
2606
2608
  /** Filter for cookies that will be modified. All empty entries are ignored. */
2607
2609
  filter: RequestCookie;
2608
- /** Attributes that shall be overridden in cookies that machted the filter. Attributes that are set to an empty string are removed. */
2610
+ /** Attributes that shall be overridden in cookies that matched the filter. Attributes that are set to an empty string are removed. */
2609
2611
  modification: RequestCookie;
2610
2612
  }
2611
2613
 
@@ -4547,7 +4549,7 @@ export namespace Browser {
4547
4549
  const inIncognitoContext: boolean;
4548
4550
 
4549
4551
  /**
4550
- * Set for the lifetime of a callback if an ansychronous extension api has resulted in an error. If no error has occurred lastError will be `undefined`.
4552
+ * Set for the lifetime of a callback if an asynchronous extension api has resulted in an error. If no error has occurred lastError will be `undefined`.
4551
4553
  * @deprecated since Chrome 58. Please use {@link runtime.lastError}
4552
4554
  */
4553
4555
  const lastError: runtime.LastError | undefined;
@@ -8914,6 +8916,7 @@ export namespace Browser {
8914
8916
  /**
8915
8917
  * The native client architecture. This may be different from arch on some platforms.
8916
8918
  * @since Chrome 44
8919
+ * @deprecated since Chrome 149. This enum is deprecated following complete removal of Native Client.
8917
8920
  */
8918
8921
  enum PlatformNaclArch {
8919
8922
  /** Specifies the native client architecture as arm. */
@@ -9074,7 +9077,10 @@ export namespace Browser {
9074
9077
  os: `${PlatformOs}`;
9075
9078
  /** The machine's processor architecture. */
9076
9079
  arch: `${PlatformArch}`;
9077
- /** The native client architecture. This may be different from arch on some platforms. */
9080
+ /**
9081
+ * The native client architecture. This may be different from arch on some platforms.
9082
+ * @deprecated since Chrome 149. This attribute is deprecated following complete removal of Native Client.
9083
+ */
9078
9084
  nacl_arch?: `${PlatformNaclArch}`;
9079
9085
  }
9080
9086
 
@@ -9219,11 +9225,6 @@ export namespace Browser {
9219
9225
  | "webRequestBlocking"
9220
9226
  | "webRequestAuthProvider";
9221
9227
 
9222
- /**
9223
- * @deprecated Use `ManifestPermission` instead.
9224
- */
9225
- type ManifestPermissions = ManifestPermission;
9226
-
9227
9228
  /** Source : https://developer.chrome.com/docs/extensions/reference/api/permissions */
9228
9229
  type ManifestOptionalPermission = Exclude<
9229
9230
  ManifestPermission,
@@ -9241,11 +9242,6 @@ export namespace Browser {
9241
9242
  | "webAuthenticationProxy"
9242
9243
  >;
9243
9244
 
9244
- /**
9245
- * @deprecated Use `ManifestOptionalPermission` instead.
9246
- */
9247
- type ManifestOptionalPermissions = ManifestOptionalPermission;
9248
-
9249
9245
  interface SearchProvider {
9250
9246
  name?: string | undefined;
9251
9247
  keyword?: string | undefined;
@@ -10114,12 +10110,7 @@ export namespace Browser {
10114
10110
  * Permissions: "storage"
10115
10111
  */
10116
10112
  export namespace storage {
10117
- /** NoInfer for old TypeScript versions (Required TS 5.4+) */
10118
- type NoInferX<T> = T[][T extends any ? 0 : never];
10119
- // The next line prevents things without the export keyword from being automatically exported (like NoInferX)
10120
- export {};
10121
-
10122
- export interface StorageArea {
10113
+ interface StorageArea {
10123
10114
  /**
10124
10115
  * Gets the amount of space (in bytes) being used by one or more items.
10125
10116
  * @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.
@@ -10166,11 +10157,11 @@ export namespace Browser {
10166
10157
  * Can return its result via Promise in Manifest V3 or later since Chrome 95.
10167
10158
  */
10168
10159
  get<T = { [key: string]: unknown }>(
10169
- keys?: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null,
10160
+ keys?: NoInfer<keyof T> | Array<NoInfer<keyof T>> | Partial<NoInfer<T>> | null | undefined,
10170
10161
  ): Promise<T>;
10171
10162
  get<T = { [key: string]: unknown }>(callback: (items: T) => void): void;
10172
10163
  get<T = { [key: string]: unknown }>(
10173
- keys: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null | undefined,
10164
+ keys: NoInfer<keyof T> | Array<NoInfer<keyof T>> | Partial<NoInfer<T>> | null | undefined,
10174
10165
  callback: (items: T) => void,
10175
10166
  ): void;
10176
10167
 
@@ -10197,19 +10188,19 @@ export namespace Browser {
10197
10188
  getKeys(callback: (keys: string[]) => void): void;
10198
10189
  }
10199
10190
 
10200
- export interface StorageChange {
10191
+ interface StorageChange {
10201
10192
  /** The new value of the item, if there is a new value. */
10202
10193
  newValue?: unknown;
10203
10194
  /** The old value of the item, if there was an old value. */
10204
10195
  oldValue?: unknown;
10205
10196
  }
10206
10197
 
10207
- export interface LocalStorageArea extends StorageArea {
10198
+ interface LocalStorageArea extends StorageArea {
10208
10199
  /** 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. */
10209
10200
  QUOTA_BYTES: 10485760;
10210
10201
  }
10211
10202
 
10212
- export interface SyncStorageArea extends StorageArea {
10203
+ interface SyncStorageArea extends StorageArea {
10213
10204
  /** @deprecated The storage.sync API no longer has a sustained write operation quota. */
10214
10205
  MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: 1000000;
10215
10206
  /** 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. */
@@ -10232,18 +10223,18 @@ export namespace Browser {
10232
10223
  MAX_WRITE_OPERATIONS_PER_MINUTE: 120;
10233
10224
  }
10234
10225
 
10235
- export interface SessionStorageArea extends StorageArea {
10226
+ interface SessionStorageArea extends StorageArea {
10236
10227
  /** 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. */
10237
10228
  QUOTA_BYTES: 10485760;
10238
10229
  }
10239
10230
 
10240
- export type AreaName = "sync" | "local" | "managed" | "session";
10231
+ type AreaName = "sync" | "local" | "managed" | "session";
10241
10232
 
10242
10233
  /**
10243
10234
  * The storage area's access level.
10244
10235
  * @since Chrome 102
10245
10236
  */
10246
- export enum AccessLevel {
10237
+ enum AccessLevel {
10247
10238
  /** Specifies contexts originating from the extension itself. */
10248
10239
  TRUSTED_CONTEXTS = "TRUSTED_CONTEXTS",
10249
10240
  /** Specifies contexts originating from outside the extension. */
@@ -10251,13 +10242,13 @@ export namespace Browser {
10251
10242
  }
10252
10243
 
10253
10244
  /** Items in the `local` storage area are local to each machine. */
10254
- export const local: LocalStorageArea;
10245
+ const local: LocalStorageArea;
10255
10246
 
10256
10247
  /** Items in the `sync` storage area are synced using Chrome Sync. */
10257
- export const sync: SyncStorageArea;
10248
+ const sync: SyncStorageArea;
10258
10249
 
10259
10250
  /** 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. */
10260
- export const managed: StorageArea;
10251
+ const managed: StorageArea;
10261
10252
 
10262
10253
  /**
10263
10254
  * Items in the `session` storage area are stored in-memory and will not be persisted to disk.
@@ -10265,10 +10256,10 @@ export namespace Browser {
10265
10256
  * MV3 only
10266
10257
  * @since Chrome 102
10267
10258
  */
10268
- export const session: SessionStorageArea;
10259
+ const session: SessionStorageArea;
10269
10260
 
10270
10261
  /** Fired when one or more items change. */
10271
- export const onChanged: events.Event<(changes: { [key: string]: StorageChange }, areaName: AreaName) => void>;
10262
+ const onChanged: events.Event<(changes: { [key: string]: StorageChange }, areaName: AreaName) => void>;
10272
10263
  }
10273
10264
 
10274
10265
  ////////////////////
@@ -10291,10 +10282,6 @@ export namespace Browser {
10291
10282
  total: number;
10292
10283
  }
10293
10284
 
10294
- /** @deprecated Use {@link CpuTime} instead. */
10295
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
10296
- interface ProcessorUsage extends CpuTime {}
10297
-
10298
10285
  interface ProcessorInfo {
10299
10286
  /** Cumulative usage info for this logical processor. */
10300
10287
  usage: CpuTime;
@@ -12527,10 +12514,6 @@ export namespace Browser {
12527
12514
  reconnect?: string | undefined;
12528
12515
  }
12529
12516
 
12530
- /** @deprecated Use {@link Parameters} instead */
12531
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
12532
- interface VpnSessionParameters extends Parameters {}
12533
-
12534
12517
  /** The enum is used by the platform to notify the client of the VPN session status. */
12535
12518
  enum PlatformMessage {
12536
12519
  /** Indicates that the VPN configuration connected. */
@@ -13435,7 +13418,6 @@ export namespace Browser {
13435
13418
 
13436
13419
  /** 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. */
13437
13420
  const onBeforeSendHeaders: WebRequestEvent<
13438
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
13439
13421
  (details: OnBeforeSendHeadersDetails) => BlockingResponse | undefined,
13440
13422
  `${OnBeforeSendHeadersOptions}`[]
13441
13423
  >;