@wxt-dev/browser 0.0.316 → 0.0.318
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 +3 -3
- package/src/gen/index.d.ts +98 -73
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.0.
|
|
4
|
+
"version": "0.0.318",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
|
7
7
|
"types": "src/index.d.ts",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"src"
|
|
20
20
|
],
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/chrome": "0.0.
|
|
22
|
+
"@types/chrome": "0.0.318",
|
|
23
23
|
"fs-extra": "^11.3.0",
|
|
24
24
|
"nano-spawn": "^0.2.0",
|
|
25
25
|
"tsx": "4.19.3",
|
|
26
26
|
"typescript": "^5.8.3",
|
|
27
|
-
"vitest": "^3.1.
|
|
27
|
+
"vitest": "^3.1.2"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@types/filesystem": "*",
|
package/src/gen/index.d.ts
CHANGED
|
@@ -12228,131 +12228,111 @@ export namespace Browser {
|
|
|
12228
12228
|
*/
|
|
12229
12229
|
export namespace tabGroups {
|
|
12230
12230
|
/** An ID that represents the absence of a group. */
|
|
12231
|
-
export
|
|
12231
|
+
export const TAB_GROUP_ID_NONE: -1;
|
|
12232
12232
|
|
|
12233
|
-
|
|
12233
|
+
/** The group's color. */
|
|
12234
|
+
export enum Color {
|
|
12235
|
+
BLUE = "blue",
|
|
12236
|
+
CYAN = "cyan",
|
|
12237
|
+
GREEN = "green",
|
|
12238
|
+
GREY = "grey",
|
|
12239
|
+
ORANGE = "orange",
|
|
12240
|
+
PINK = "pink",
|
|
12241
|
+
PURPLE = "purple",
|
|
12242
|
+
RED = "red",
|
|
12243
|
+
YELLOW = "yellow",
|
|
12244
|
+
}
|
|
12234
12245
|
|
|
12235
12246
|
export interface TabGroup {
|
|
12236
12247
|
/** Whether the group is collapsed. A collapsed group is one whose tabs are hidden. */
|
|
12237
12248
|
collapsed: boolean;
|
|
12238
12249
|
/** The group's color. */
|
|
12239
|
-
color:
|
|
12250
|
+
color: `${Color}`;
|
|
12240
12251
|
/** The ID of the group. Group IDs are unique within a browser session. */
|
|
12241
12252
|
id: number;
|
|
12242
|
-
/**
|
|
12243
|
-
title?: string
|
|
12253
|
+
/** The title of the group. */
|
|
12254
|
+
title?: string;
|
|
12244
12255
|
/** The ID of the window that contains the group. */
|
|
12245
12256
|
windowId: number;
|
|
12246
12257
|
}
|
|
12247
12258
|
|
|
12248
12259
|
export interface MoveProperties {
|
|
12249
|
-
/** The position to move the group to. Use
|
|
12260
|
+
/** The position to move the group to. Use `-1` to place the group at the end of the window. */
|
|
12250
12261
|
index: number;
|
|
12251
|
-
/**
|
|
12252
|
-
windowId?: number
|
|
12262
|
+
/** The window to move the group to. Defaults to the window the group is currently in. Note that groups can only be moved to and from windows with {@link windows.windowTypeEnum windows.windowType} type `"normal"`. */
|
|
12263
|
+
windowId?: number;
|
|
12253
12264
|
}
|
|
12254
12265
|
|
|
12255
12266
|
export interface QueryInfo {
|
|
12256
|
-
/**
|
|
12257
|
-
collapsed?: boolean
|
|
12258
|
-
/**
|
|
12259
|
-
color?:
|
|
12260
|
-
/**
|
|
12261
|
-
title?: string
|
|
12262
|
-
/**
|
|
12263
|
-
windowId?: number
|
|
12267
|
+
/** Whether the groups are collapsed. */
|
|
12268
|
+
collapsed?: boolean;
|
|
12269
|
+
/** The color of the groups. */
|
|
12270
|
+
color?: `${Color}`;
|
|
12271
|
+
/** Match group titles against a pattern. */
|
|
12272
|
+
title?: string;
|
|
12273
|
+
/** The ID of the parent window, or {@link windows.WINDOW_ID_CURRENT} for the current window. */
|
|
12274
|
+
windowId?: number;
|
|
12264
12275
|
}
|
|
12265
12276
|
|
|
12266
12277
|
export interface UpdateProperties {
|
|
12267
|
-
/**
|
|
12268
|
-
collapsed?: boolean
|
|
12269
|
-
/**
|
|
12270
|
-
color?:
|
|
12271
|
-
/**
|
|
12272
|
-
title?: string
|
|
12278
|
+
/** Whether the group should be collapsed. */
|
|
12279
|
+
collapsed?: boolean;
|
|
12280
|
+
/** The color of the group. */
|
|
12281
|
+
color?: `${Color}`;
|
|
12282
|
+
/** The title of the group. */
|
|
12283
|
+
title?: string;
|
|
12273
12284
|
}
|
|
12274
12285
|
|
|
12275
12286
|
/**
|
|
12276
12287
|
* Retrieves details about the specified group.
|
|
12277
|
-
*
|
|
12278
|
-
*
|
|
12279
|
-
*/
|
|
12280
|
-
export function get(groupId: number, callback: (group: TabGroup) => void): void;
|
|
12281
|
-
|
|
12282
|
-
/**
|
|
12283
|
-
* Retrieves details about the specified group.
|
|
12284
|
-
* @param groupId The ID of the tab group.
|
|
12285
|
-
* @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
12288
|
+
*
|
|
12289
|
+
* Can return its result via Promise since Chrome 90.
|
|
12286
12290
|
*/
|
|
12287
12291
|
export function get(groupId: number): Promise<TabGroup>;
|
|
12292
|
+
export function get(groupId: number, callback: (group: TabGroup) => void): void;
|
|
12288
12293
|
|
|
12289
12294
|
/**
|
|
12290
12295
|
* Moves the group and all its tabs within its window, or to a new window.
|
|
12291
12296
|
* @param groupId The ID of the group to move.
|
|
12292
|
-
*
|
|
12293
|
-
*
|
|
12294
|
-
*/
|
|
12295
|
-
export function move(groupId: number, moveProperties: MoveProperties): Promise<TabGroup>;
|
|
12296
|
-
|
|
12297
|
-
/**
|
|
12298
|
-
* Moves the group and all its tabs within its window, or to a new window.
|
|
12299
|
-
* @param groupId The ID of the group to move.
|
|
12300
|
-
* @param moveProperties Information on how to move the group.
|
|
12301
|
-
* @param callback Optional.
|
|
12297
|
+
*
|
|
12298
|
+
* Can return its result via Promise since Chrome 90.
|
|
12302
12299
|
*/
|
|
12300
|
+
export function move(groupId: number, moveProperties: MoveProperties): Promise<TabGroup | undefined>;
|
|
12303
12301
|
export function move(
|
|
12304
12302
|
groupId: number,
|
|
12305
12303
|
moveProperties: MoveProperties,
|
|
12306
|
-
callback: (group
|
|
12304
|
+
callback: (group?: TabGroup) => void,
|
|
12307
12305
|
): void;
|
|
12308
12306
|
|
|
12309
12307
|
/**
|
|
12310
12308
|
* Gets all groups that have the specified properties, or all groups if no properties are specified.
|
|
12311
|
-
*
|
|
12312
|
-
*
|
|
12313
|
-
*/
|
|
12314
|
-
export function query(queryInfo: QueryInfo, callback: (result: TabGroup[]) => void): void;
|
|
12315
|
-
|
|
12316
|
-
/**
|
|
12317
|
-
* Gets all groups that have the specified properties, or all groups if no properties are specified.
|
|
12318
|
-
* @param queryInfo Object with search parameters.
|
|
12319
|
-
* @return The `query` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
12309
|
+
*
|
|
12310
|
+
* Can return its result via Promise since Chrome 90.
|
|
12320
12311
|
*/
|
|
12321
12312
|
export function query(queryInfo: QueryInfo): Promise<TabGroup[]>;
|
|
12313
|
+
export function query(queryInfo: QueryInfo, callback: (result: TabGroup[]) => void): void;
|
|
12322
12314
|
|
|
12323
12315
|
/**
|
|
12324
|
-
* Modifies the properties of a group. Properties that are not specified in updateProperties are not modified.
|
|
12325
|
-
* @param groupId The ID of the group to modify.
|
|
12326
|
-
* @param updateProperties Information on how to update the group.
|
|
12327
|
-
* @return The `update` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
12328
|
-
*/
|
|
12329
|
-
export function update(groupId: number, updateProperties: UpdateProperties): Promise<TabGroup>;
|
|
12330
|
-
|
|
12331
|
-
/**
|
|
12332
|
-
* Modifies the properties of a group. Properties that are not specified in updateProperties are not modified.
|
|
12316
|
+
* Modifies the properties of a group. Properties that are not specified in `updateProperties` are not modified.
|
|
12333
12317
|
* @param groupId The ID of the group to modify.
|
|
12334
|
-
*
|
|
12335
|
-
*
|
|
12318
|
+
*
|
|
12319
|
+
* Can return its result via Promise since Chrome 90.
|
|
12336
12320
|
*/
|
|
12321
|
+
export function update(groupId: number, updateProperties: UpdateProperties): Promise<TabGroup | undefined>;
|
|
12337
12322
|
export function update(
|
|
12338
12323
|
groupId: number,
|
|
12339
12324
|
updateProperties: UpdateProperties,
|
|
12340
|
-
callback: (group
|
|
12325
|
+
callback: (group?: TabGroup) => void,
|
|
12341
12326
|
): void;
|
|
12342
12327
|
|
|
12343
|
-
export interface TabGroupCreatedEvent extends Browser.events.Event<(group: TabGroup) => void> {}
|
|
12344
|
-
export interface TabGroupMovedEvent extends Browser.events.Event<(group: TabGroup) => void> {}
|
|
12345
|
-
export interface TabGroupRemovedEvent extends Browser.events.Event<(group: TabGroup) => void> {}
|
|
12346
|
-
export interface TabGroupUpdated extends Browser.events.Event<(group: TabGroup) => void> {}
|
|
12347
|
-
|
|
12348
12328
|
/** Fired when a group is created. */
|
|
12349
|
-
export
|
|
12329
|
+
export const onCreated: events.Event<(group: TabGroup) => void>;
|
|
12350
12330
|
/** Fired when a group is moved within a window. Move events are still fired for the individual tabs within the group, as well as for the group itself. This event is not fired when a group is moved between windows; instead, it will be removed from one window and created in another. */
|
|
12351
|
-
export
|
|
12352
|
-
/** Fired when a group is closed, either directly by the user or automatically because it contained zero. */
|
|
12353
|
-
export
|
|
12331
|
+
export const onMoved: events.Event<(group: TabGroup) => void>;
|
|
12332
|
+
/** Fired when a group is closed, either directly by the user or automatically because it contained zero tabs. */
|
|
12333
|
+
export const onRemoved: events.Event<(group: TabGroup) => void>;
|
|
12354
12334
|
/** Fired when a group is updated. */
|
|
12355
|
-
export
|
|
12335
|
+
export const onUpdated: events.Event<(group: TabGroup) => void>;
|
|
12356
12336
|
}
|
|
12357
12337
|
|
|
12358
12338
|
////////////////////
|
|
@@ -14862,6 +14842,18 @@ export namespace Browser {
|
|
|
14862
14842
|
*/
|
|
14863
14843
|
export type ExecutionWorld = "MAIN" | "USER_SCRIPT";
|
|
14864
14844
|
|
|
14845
|
+
/** @since Chrome 135 */
|
|
14846
|
+
export interface InjectionResult {
|
|
14847
|
+
/** The document associated with the injection. */
|
|
14848
|
+
documentId: string;
|
|
14849
|
+
/** The error, if any. `error` and `result` are mutually exclusive. */
|
|
14850
|
+
error?: string;
|
|
14851
|
+
/** The frame associated with the injection. */
|
|
14852
|
+
frameId: number;
|
|
14853
|
+
/** The result of the script execution. */
|
|
14854
|
+
result: any;
|
|
14855
|
+
}
|
|
14856
|
+
|
|
14865
14857
|
export interface WorldProperties {
|
|
14866
14858
|
/** Specifies the world csp. The default is the `ISOLATED` world csp. */
|
|
14867
14859
|
csp?: string;
|
|
@@ -14878,6 +14870,18 @@ export namespace Browser {
|
|
|
14878
14870
|
ids?: string[];
|
|
14879
14871
|
}
|
|
14880
14872
|
|
|
14873
|
+
/** @since Chrome 135 */
|
|
14874
|
+
export interface InjectionTarget {
|
|
14875
|
+
/** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` is specified. */
|
|
14876
|
+
allFrames?: boolean;
|
|
14877
|
+
/** The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set. */
|
|
14878
|
+
documentIds?: string[];
|
|
14879
|
+
/** The IDs of specific frames to inject into. */
|
|
14880
|
+
frameIds?: number[];
|
|
14881
|
+
/** The ID of the tab into which to inject. */
|
|
14882
|
+
tabId: number;
|
|
14883
|
+
}
|
|
14884
|
+
|
|
14881
14885
|
export interface RegisteredUserScript {
|
|
14882
14886
|
/** If true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched. */
|
|
14883
14887
|
allFrames?: boolean;
|
|
@@ -14904,6 +14908,20 @@ export namespace Browser {
|
|
|
14904
14908
|
worldId?: string;
|
|
14905
14909
|
}
|
|
14906
14910
|
|
|
14911
|
+
/** @since Chrome 135 */
|
|
14912
|
+
export interface UserScriptInjection {
|
|
14913
|
+
/** Whether the injection should be triggered in the target as soon as possible. Note that this is not a guarantee that injection will occur prior to page load, as the page may have already loaded by the time the script reaches the target. */
|
|
14914
|
+
injectImmediately?: boolean;
|
|
14915
|
+
/** The list of ScriptSource objects defining sources of scripts to be injected into the target. */
|
|
14916
|
+
js: ScriptSource[];
|
|
14917
|
+
/** Details specifying the target into which to inject the script. */
|
|
14918
|
+
target: InjectionTarget;
|
|
14919
|
+
/** The JavaScript "world" to run the script in. The default is `USER_SCRIPT`. */
|
|
14920
|
+
world?: ExecutionWorld;
|
|
14921
|
+
/** Specifies the user script world ID to execute in. If omitted, the script will execute in the default user script world. Only valid if `world` is omitted or is `USER_SCRIPT`. Values with leading underscores (`_`) are reserved. */
|
|
14922
|
+
worldId?: string;
|
|
14923
|
+
}
|
|
14924
|
+
|
|
14907
14925
|
/**
|
|
14908
14926
|
* Properties for a script source.
|
|
14909
14927
|
*/
|
|
@@ -14956,6 +14974,13 @@ export namespace Browser {
|
|
|
14956
14974
|
export function getWorldConfigurations(): Promise<WorldProperties[]>;
|
|
14957
14975
|
export function getWorldConfigurations(callback: (worlds: WorldProperties[]) => void): void;
|
|
14958
14976
|
|
|
14977
|
+
/**
|
|
14978
|
+
* Injects a script into a target context. By default, the script will be run at `document_idle`, or immediately if the page has already loaded. If the `injectImmediately` property is set, the script will inject without waiting, even if the page has not finished loading. If the script evaluates to a promise, the browser will wait for the promise to settle and return the resulting value.
|
|
14979
|
+
* @since Chrome 135
|
|
14980
|
+
*/
|
|
14981
|
+
export function execute(injection: UserScriptInjection): Promise<InjectionResult[]>;
|
|
14982
|
+
export function execute(injection: UserScriptInjection, callback: (result: InjectionResult[]) => void): void;
|
|
14983
|
+
|
|
14959
14984
|
/**
|
|
14960
14985
|
* Registers one or more user scripts for this extension.
|
|
14961
14986
|
*
|