@wxt-dev/browser 0.1.1 → 0.1.3

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 +2 -2
  2. package/src/gen/index.d.ts +93 -159
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.1",
4
+ "version": "0.1.3",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
7
7
  "types": "src/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "src"
20
20
  ],
21
21
  "devDependencies": {
22
- "@types/chrome": "0.1.1",
22
+ "@types/chrome": "0.1.3",
23
23
  "fs-extra": "^11.3.0",
24
24
  "nano-spawn": "^0.2.0",
25
25
  "tsx": "4.19.4",
@@ -1088,267 +1088,209 @@ export namespace Browser {
1088
1088
  */
1089
1089
  export namespace browsingData {
1090
1090
  export interface OriginTypes {
1091
- /** Optional. Extensions and packaged applications a user has installed (be _really_ careful!). */
1091
+ /** Extensions and packaged applications a user has installed (be _really_ careful!). */
1092
1092
  extension?: boolean | undefined;
1093
- /** Optional. Websites that have been installed as hosted applications (be careful!). */
1093
+ /** Websites that have been installed as hosted applications (be careful!). */
1094
1094
  protectedWeb?: boolean | undefined;
1095
- /** Optional. Normal websites. */
1095
+ /** Normal websites. */
1096
1096
  unprotectedWeb?: boolean | undefined;
1097
1097
  }
1098
1098
 
1099
1099
  /** Options that determine exactly what data will be removed. */
1100
1100
  export interface RemovalOptions {
1101
1101
  /**
1102
- * Optional.
1102
+ * When present, data for origins in this list is excluded from deletion. Can't be used together with `origins`. Only supported for cookies, storage and cache. Cookies are excluded for the whole registrable domain.
1103
1103
  * @since Chrome 74
1104
- * When present, data for origins in this list is excluded from deletion. Can't be used together with origins. Only supported for cookies, storage and cache. Cookies are excluded for the whole registrable domain.
1105
1104
  */
1106
1105
  excludeOrigins?: string[] | undefined;
1107
- /**
1108
- * Optional.
1109
- * An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only "unprotected" origins. Please ensure that you _really_ want to remove application data before adding 'protectedWeb' or 'extensions'.
1110
- */
1106
+ /** An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only "unprotected" origins. Please ensure that you _really_ want to remove application data before adding 'protectedWeb' or 'extensions'. */
1111
1107
  originTypes?: OriginTypes | undefined;
1112
1108
  /**
1113
- * Optional.
1114
- * @since Chrome 74
1115
1109
  * When present, only data for origins in this list is deleted. Only supported for cookies, storage and cache. Cookies are cleared for the whole registrable domain.
1110
+ * @since Chrome 74
1116
1111
  */
1117
- origins?: string[] | undefined;
1118
- /**
1119
- * Optional.
1120
- * Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the {@link Date.getTime} method). If absent, defaults to 0 (which would remove all browsing data).
1121
- */
1112
+ origins?: [string, ...string[]] | undefined;
1113
+ /** Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the {@link Date.getTime getTime} method of the JavaScript `Date` object). If absent, defaults to 0 (which would remove all browsing data). */
1122
1114
  since?: number | undefined;
1123
1115
  }
1124
1116
 
1125
- /**
1126
- * @since Chrome 27
1127
- * A set of data types. Missing data types are interpreted as false.
1128
- */
1117
+ /** A set of data types. Missing data types are interpreted as `false`. */
1129
1118
  export interface DataTypeSet {
1130
- /** Optional. Websites' WebSQL data. */
1119
+ /** Websites' WebSQL data. */
1131
1120
  webSQL?: boolean | undefined;
1132
- /** Optional. Websites' IndexedDB data. */
1121
+ /** Websites' IndexedDB data. */
1133
1122
  indexedDB?: boolean | undefined;
1134
- /** Optional. The browser's cookies. */
1123
+ /** The browser's cookies. */
1135
1124
  cookies?: boolean | undefined;
1136
- /** Optional. Stored passwords. */
1125
+ /** Stored passwords. */
1137
1126
  passwords?: boolean | undefined;
1138
1127
  /**
1139
- * @deprecated Deprecated since Chrome 76.
1140
- * Support for server-bound certificates has been removed. This data type will be ignored.
1141
- *
1142
- * Optional. Server-bound certificates.
1128
+ * Server-bound certificates.
1129
+ * @deprecated since Chrome 76. Support for server-bound certificates has been removed. This data type will be ignored.
1143
1130
  */
1144
1131
  serverBoundCertificates?: boolean | undefined;
1145
- /** Optional. The browser's download list. */
1132
+ /** The browser's download list. */
1146
1133
  downloads?: boolean | undefined;
1147
- /** Optional. The browser's cache. Note: when removing data, this clears the entire cache: it is not limited to the range you specify. */
1134
+ /** The browser's cache. */
1148
1135
  cache?: boolean | undefined;
1149
- /** Optional. The browser's cacheStorage. */
1136
+ /** Cache storage. */
1150
1137
  cacheStorage?: boolean | undefined;
1151
- /** Optional. Websites' appcaches. */
1138
+ /** Websites' appcaches. */
1152
1139
  appcache?: boolean | undefined;
1153
- /** Optional. Websites' file systems. */
1140
+ /** Websites' file systems. */
1154
1141
  fileSystems?: boolean | undefined;
1155
1142
  /**
1156
- * @deprecated Deprecated since Chrome 88.
1157
- * Support for Flash has been removed. This data type will be ignored.
1158
- *
1159
- * Optional. Plugins' data.
1143
+ * Plugins' data.
1144
+ * @deprecated since Chrome 88. Support for Flash has been removed. This data type will be ignored.
1160
1145
  */
1161
1146
  pluginData?: boolean | undefined;
1162
- /** Optional. Websites' local storage data. */
1147
+ /** Websites' local storage data. */
1163
1148
  localStorage?: boolean | undefined;
1164
- /** Optional. The browser's stored form data. */
1149
+ /** The browser's stored form data. */
1165
1150
  formData?: boolean | undefined;
1166
- /** Optional. The browser's history. */
1151
+ /** The browser's history. */
1167
1152
  history?: boolean | undefined;
1168
- /**
1169
- * Optional.
1170
- * @since Chrome 39
1171
- * Service Workers.
1172
- */
1153
+ /** Service Workers. */
1173
1154
  serviceWorkers?: boolean | undefined;
1174
1155
  }
1175
1156
 
1176
1157
  export interface SettingsResult {
1177
1158
  options: RemovalOptions;
1178
- /** All of the types will be present in the result, with values of true if they are both selected to be removed and permitted to be removed, otherwise false. */
1159
+ /** All of the types will be present in the result, with values of `true` if they are both selected to be removed and permitted to be removed, otherwise `false`. */
1179
1160
  dataToRemove: DataTypeSet;
1180
- /** All of the types will be present in the result, with values of true if they are permitted to be removed (e.g., by enterprise policy) and false if not. */
1161
+ /** All of the types will be present in the result, with values of `true` if they are permitted to be removed (e.g., by enterprise policy) and `false` if not. */
1181
1162
  dataRemovalPermitted: DataTypeSet;
1182
1163
  }
1183
1164
 
1184
1165
  /**
1185
- * @since Chrome 26
1186
1166
  * Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.
1187
- * @return The `settings` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1167
+ *
1168
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1188
1169
  */
1189
1170
  export function settings(): Promise<SettingsResult>;
1190
- /**
1191
- * @since Chrome 26
1192
- * Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.
1193
- */
1194
1171
  export function settings(callback: (result: SettingsResult) => void): void;
1172
+
1195
1173
  /**
1196
- * @deprecated Deprecated since Chrome 88.
1197
- * Support for Flash has been removed. This function has no effect.
1198
- *
1199
1174
  * Clears plugins' data.
1200
- * @return The `removePluginData` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1201
- */
1202
- export function removePluginData(options: RemovalOptions): Promise<void>;
1203
- /**
1204
- * @deprecated Deprecated since Chrome 88.
1205
- * Support for Flash has been removed. This function has no effect.
1206
1175
  *
1207
- * Clears plugins' data.
1208
- * @param callback Called when plugins' data has been cleared.
1176
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1177
+ * @deprecated since Chrome 88. Support for Flash has been removed. This function has no effect
1209
1178
  */
1179
+ export function removePluginData(options: RemovalOptions): Promise<void>;
1210
1180
  export function removePluginData(options: RemovalOptions, callback: () => void): void;
1181
+
1211
1182
  /**
1212
- * @since Chrome 72
1213
1183
  * Clears websites' service workers.
1214
- * @return The `removeServiceWorkers` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1215
- */
1216
- export function removeServiceWorkers(options: RemovalOptions): Promise<void>;
1217
- /**
1184
+ *
1185
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1218
1186
  * @since Chrome 72
1219
- * Clears websites' service workers.
1220
- * @param callback Called when the browser's service workers have been cleared.
1221
1187
  */
1188
+ export function removeServiceWorkers(options: RemovalOptions): Promise<void>;
1222
1189
  export function removeServiceWorkers(options: RemovalOptions, callback: () => void): void;
1190
+
1223
1191
  /**
1224
1192
  * Clears the browser's stored form data (autofill).
1225
- * @return The `removeFormData` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1193
+ *
1194
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1226
1195
  */
1227
1196
  export function removeFormData(options: RemovalOptions): Promise<void>;
1228
- /**
1229
- * Clears the browser's stored form data (autofill).
1230
- * @param callback Called when the browser's form data has been cleared.
1231
- */
1232
1197
  export function removeFormData(options: RemovalOptions, callback: () => void): void;
1198
+
1233
1199
  /**
1234
1200
  * Clears websites' file system data.
1235
- * @return The `removeFileSystems` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1201
+ *
1202
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1236
1203
  */
1237
1204
  export function removeFileSystems(options: RemovalOptions): Promise<void>;
1238
- /**
1239
- * Clears websites' file system data.
1240
- * @param callback Called when websites' file systems have been cleared.
1241
- */
1242
1205
  export function removeFileSystems(options: RemovalOptions, callback: () => void): void;
1206
+
1243
1207
  /**
1244
1208
  * Clears various types of browsing data stored in a user's profile.
1209
+ *
1210
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1245
1211
  * @param dataToRemove The set of data types to remove.
1246
- * @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1247
1212
  */
1248
1213
  export function remove(options: RemovalOptions, dataToRemove: DataTypeSet): Promise<void>;
1249
- /**
1250
- * Clears various types of browsing data stored in a user's profile.
1251
- * @param dataToRemove The set of data types to remove.
1252
- * @param callback Called when deletion has completed.
1253
- */
1254
1214
  export function remove(options: RemovalOptions, dataToRemove: DataTypeSet, callback: () => void): void;
1215
+
1255
1216
  /**
1256
1217
  * Clears the browser's stored passwords.
1257
- * @return The `removePasswords` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1218
+ *
1219
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1258
1220
  */
1259
1221
  export function removePasswords(options: RemovalOptions): Promise<void>;
1260
- /**
1261
- * Clears the browser's stored passwords.
1262
- * @param callback Called when the browser's passwords have been cleared.
1263
- */
1264
1222
  export function removePasswords(options: RemovalOptions, callback: () => void): void;
1223
+
1265
1224
  /**
1266
1225
  * Clears the browser's cookies and server-bound certificates modified within a particular timeframe.
1267
- * @return The `removeCookies` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1226
+ *
1227
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1268
1228
  */
1269
1229
  export function removeCookies(options: RemovalOptions): Promise<void>;
1270
- /**
1271
- * Clears the browser's cookies and server-bound certificates modified within a particular timeframe.
1272
- * @param callback Called when the browser's cookies and server-bound certificates have been cleared.
1273
- */
1274
1230
  export function removeCookies(options: RemovalOptions, callback: () => void): void;
1231
+
1275
1232
  /**
1276
1233
  * Clears websites' WebSQL data.
1277
- * @return The `removeWebSQL` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1234
+ *
1235
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1278
1236
  */
1279
1237
  export function removeWebSQL(options: RemovalOptions): Promise<void>;
1280
- /**
1281
- * Clears websites' WebSQL data.
1282
- * @param callback Called when websites' WebSQL databases have been cleared.
1283
- */
1284
1238
  export function removeWebSQL(options: RemovalOptions, callback: () => void): void;
1239
+
1285
1240
  /**
1286
1241
  * Clears websites' appcache data.
1287
- * @return The `removeAppcache` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1242
+ *
1243
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1288
1244
  */
1289
1245
  export function removeAppcache(options: RemovalOptions): Promise<void>;
1290
- /**
1291
- * Clears websites' appcache data.
1292
- * @param callback Called when websites' appcache data has been cleared.
1293
- */
1294
1246
  export function removeAppcache(options: RemovalOptions, callback: () => void): void;
1295
- /** Clears websites' cache storage data.
1296
- * @return The `removeCacheStorage` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1247
+
1248
+ /**
1249
+ * Clears websites' cache storage data.
1250
+ *
1251
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1297
1252
  */
1298
1253
  export function removeCacheStorage(options: RemovalOptions): Promise<void>;
1299
- /** Clears websites' cache storage data.
1300
- * @param callback Called when websites' appcache data has been cleared.
1301
- */
1302
1254
  export function removeCacheStorage(options: RemovalOptions, callback: () => void): void;
1255
+
1303
1256
  /**
1304
1257
  * Clears the browser's list of downloaded files (not the downloaded files themselves).
1305
- * @return The `removeDownloads` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1258
+ *
1259
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1306
1260
  */
1307
1261
  export function removeDownloads(options: RemovalOptions): Promise<void>;
1308
- /**
1309
- * Clears the browser's list of downloaded files (not the downloaded files themselves).
1310
- * @param callback Called when the browser's list of downloaded files has been cleared.
1311
- */
1312
1262
  export function removeDownloads(options: RemovalOptions, callback: () => void): void;
1263
+
1313
1264
  /**
1314
1265
  * Clears websites' local storage data.
1315
- * @return The `removeLocalStorage` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1266
+ *
1267
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1316
1268
  */
1317
1269
  export function removeLocalStorage(options: RemovalOptions): Promise<void>;
1318
- /**
1319
- * Clears websites' local storage data.
1320
- * @param callback Called when websites' local storage has been cleared.
1321
- */
1322
1270
  export function removeLocalStorage(options: RemovalOptions, callback: () => void): void;
1271
+
1323
1272
  /**
1324
1273
  * Clears the browser's cache.
1325
- * @return The `removeCache` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1274
+ *
1275
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1326
1276
  */
1327
1277
  export function removeCache(options: RemovalOptions): Promise<void>;
1328
- /**
1329
- * Clears the browser's cache.
1330
- * @param callback Called when the browser's cache has been cleared.
1331
- */
1332
1278
  export function removeCache(options: RemovalOptions, callback: () => void): void;
1279
+
1333
1280
  /**
1334
1281
  * Clears the browser's history.
1335
- * @return The `removeHistory` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1282
+ *
1283
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1336
1284
  */
1337
1285
  export function removeHistory(options: RemovalOptions): Promise<void>;
1338
- /**
1339
- * Clears the browser's history.
1340
- * @param callback Called when the browser's history has cleared.
1341
- */
1342
1286
  export function removeHistory(options: RemovalOptions, callback: () => void): void;
1287
+
1343
1288
  /**
1344
1289
  * Clears websites' IndexedDB data.
1345
- * @return The `removeIndexedDB` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1290
+ *
1291
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1346
1292
  */
1347
1293
  export function removeIndexedDB(options: RemovalOptions): Promise<void>;
1348
- /**
1349
- * Clears websites' IndexedDB data.
1350
- * @param callback Called when websites' IndexedDB data has been cleared.
1351
- */
1352
1294
  export function removeIndexedDB(options: RemovalOptions, callback: () => void): void;
1353
1295
  }
1354
1296
 
@@ -1602,29 +1544,24 @@ export namespace Browser {
1602
1544
  */
1603
1545
  export namespace commands {
1604
1546
  export interface Command {
1605
- /** Optional. The name of the Extension Command */
1606
- name?: string | undefined;
1607
- /** Optional. The Extension Command description */
1608
- description?: string | undefined;
1609
- /** Optional. The shortcut active for this command, or blank if not active. */
1610
- shortcut?: string | undefined;
1547
+ /** The name of the Extension Command */
1548
+ name?: string;
1549
+ /** The Extension Command description */
1550
+ description?: string;
1551
+ /** The shortcut active for this command, or blank if not active. */
1552
+ shortcut?: string;
1611
1553
  }
1612
1554
 
1613
- export interface CommandEvent extends Browser.events.Event<(command: string, tab: Browser.tabs.Tab) => void> {}
1614
-
1615
1555
  /**
1616
- * Returns all the registered extension commands for this extension and their shortcut (if active).
1617
- * @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
1556
+ * Returns all the registered extension commands for this extension and their shortcut (if active). Before Chrome 110, this command did not return `_execute_action`.
1557
+ *
1558
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1618
1559
  */
1619
1560
  export function getAll(): Promise<Command[]>;
1620
- /**
1621
- * Returns all the registered extension commands for this extension and their shortcut (if active).
1622
- * @param callback Called to return the registered commands.
1623
- */
1624
1561
  export function getAll(callback: (commands: Command[]) => void): void;
1625
1562
 
1626
1563
  /** Fired when a registered command is activated using a keyboard shortcut. */
1627
- export var onCommand: CommandEvent;
1564
+ export const onCommand: events.Event<(command: string, tab?: tabs.Tab) => void>;
1628
1565
  }
1629
1566
 
1630
1567
  ////////////////////
@@ -2928,7 +2865,7 @@ export namespace Browser {
2928
2865
 
2929
2866
  export interface PanelSearchEvent extends Browser.events.Event<(action: string, queryString?: string) => void> {}
2930
2867
 
2931
- /** Represents a panel created by extension. */
2868
+ /** Represents a panel created by an extension. */
2932
2869
  export interface ExtensionPanel {
2933
2870
  /**
2934
2871
  * Appends a button to the status bar of the panel.
@@ -8345,10 +8282,7 @@ export namespace Browser {
8345
8282
  */
8346
8283
  relatedWebsiteSetsEnabled: Browser.types.ChromeSetting<boolean>;
8347
8284
 
8348
- /**
8349
- * If disabled, Chrome blocks third-party sites from setting cookies.
8350
- * The value of this preference is of type boolean, and the default value is `true`.
8351
- */
8285
+ /** If disabled, Chrome blocks third-party sites from setting cookies. The value of this preference is of type boolean, and the default value is `true`. Extensions may not enable this API in Incognito mode, where third-party cookies are blocked and can only be allowed at the site level. If you try setting this API to true in Incognito, it will throw an error. */
8352
8286
  thirdPartyCookiesAllowed: Browser.types.ChromeSetting<boolean>;
8353
8287
 
8354
8288
  /**
@@ -9917,14 +9851,14 @@ export namespace Browser {
9917
9851
  */
9918
9852
  get<T = { [key: string]: any }>(callback: (items: T) => void): void;
9919
9853
  /**
9920
- * Sets the desired access level for the storage area. The default will be only trusted contexts.
9854
+ * Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while managed, local, and sync storage allow access from both trusted and untrusted contexts.
9921
9855
  * @param accessOptions An object containing an accessLevel key which contains the access level of the storage area.
9922
9856
  * @return A void Promise.
9923
9857
  * @since Chrome 102
9924
9858
  */
9925
9859
  setAccessLevel(accessOptions: { accessLevel: AccessLevel }): Promise<void>;
9926
9860
  /**
9927
- * Sets the desired access level for the storage area. The default will be only trusted contexts.
9861
+ * Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while managed, local, and sync storage allow access from both trusted and untrusted contexts.
9928
9862
  * @param accessOptions An object containing an accessLevel key which contains the access level of the storage area.
9929
9863
  * @param callback Optional.
9930
9864
  * @since Chrome 102