fix: Upgrade @wxt-dev/browser to latest @types/chrome version

This commit is contained in:
aklinker1
2025-05-30 01:54:08 +00:00
committed by github-actions[bot]
parent 4f772fc0f7
commit 30cf8e6d54
3 changed files with 183 additions and 238 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@wxt-dev/browser",
"description": "Provides a cross-browser API for using extension APIs and types based on @types/chrome",
"version": "0.0.323",
"version": "0.0.324",
"type": "module",
"main": "src/index.mjs",
"types": "src/index.d.ts",
@@ -23,7 +23,7 @@
"src"
],
"devDependencies": {
"@types/chrome": "0.0.323",
"@types/chrome": "0.0.324",
"fs-extra": "^11.3.0",
"nano-spawn": "^0.2.0",
"tsx": "4.19.4",
+176 -231
View File
@@ -152,20 +152,17 @@ export namespace Browser {
* @since Chrome 88, MV3
*/
export namespace action {
/** @deprecated Use BadgeColorDetails instead. */
export interface BadgeBackgroundColorDetails extends BadgeColorDetails {}
export interface BadgeColorDetails {
/** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with a CSS value, with opaque red being #FF0000 or #F00. */
/** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is `[255, 0, 0, 255]`. Can also be a string with a CSS value, with opaque red being `#FF0000` or `#F00`. */
color: string | ColorArray;
/** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
/** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
tabId?: number | undefined;
}
export interface BadgeTextDetails {
/** Any number of characters can be passed, but only about four can fit in the space. */
text: string;
/** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
/** Any number of characters can be passed, but only about four can fit in the space. If an empty string (`''`) is passed, the badge text is cleared. If `tabId` is specified and `text` is null, the text for the specified tab is cleared and defaults to the global badge text. */
text?: string | undefined;
/** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
tabId?: number | undefined;
}
@@ -174,33 +171,34 @@ export namespace Browser {
export interface TitleDetails {
/** The string the action should display when moused over. */
title: string;
/** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
/** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
tabId?: number | undefined;
}
export interface PopupDetails {
/** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
/** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
tabId?: number | undefined;
/** The html file to show in a popup. If set to the empty string (''), no popup is shown. */
/** The html file to show in a popup. If set to the empty string (`''`), no popup is shown. */
popup: string;
}
export interface TabIconDetails {
/** Optional. Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' */
/** Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}' */
path?: string | { [index: number]: string } | undefined;
/** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
/** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
tabId?: number | undefined;
/** Optional. Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' */
/** Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}' */
imageData?: ImageData | { [index: number]: ImageData } | undefined;
}
/** @since Chrome 99 */
export interface OpenPopupOptions {
/** Optional. The id of the window to open the action popup in. Defaults to the currently-active window if unspecified. */
/** The id of the window to open the action popup in. Defaults to the currently-active window if unspecified. */
windowId?: number | undefined;
}
export interface TabDetails {
/** Optional. The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
/** The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
tabId?: number | undefined;
}
@@ -220,232 +218,154 @@ export namespace Browser {
}
/**
* @since Chrome 88
* Disables the action for a tab.
* @param tabId The id of the tab for which you want to modify the action.
* @return The `disable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
* @param tabId The ID of the tab for which you want to modify the action.
*
* Can return its result via Promise.
*/
export function disable(tabId?: number): Promise<void>;
/**
* @since Chrome 88
* Disables the action for a tab.
* @param tabId The id of the tab for which you want to modify the action.
* @param callback
*/
export function disable(callback: () => void): void;
export function disable(tabId: number, callback: () => void): void;
export function disable(tabId: number | undefined, callback: () => void): void;
/**
* @since Chrome 88
* Enables the action for a tab. By default, actions are enabled.
* @param tabId The id of the tab for which you want to modify the action.
* @return The `enable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
* @param tabId The ID of the tab for which you want to modify the action.
*
* Can return its result via Promise.
*/
export function enable(tabId?: number): Promise<void>;
/**
* @since Chrome 88
* Enables the action for a tab. By default, actions are enabled.
* @param tabId The id of the tab for which you want to modify the action.
* @param callback
*/
export function enable(callback: () => void): void;
export function enable(tabId: number, callback: () => void): void;
export function enable(tabId: number | undefined, callback: () => void): void;
/**
* @since Chrome 88
* Gets the background color of the action.
*/
export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
/**
* @since Chrome 88
* Gets the background color of the action.
* @return The `getBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only).
*
* Can return its result via Promise.
*/
export function getBadgeBackgroundColor(details: TabDetails): Promise<ColorArray>;
export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
/**
* @since Chrome 88
* Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.
* If displayActionCountAsBadgeText is enabled, a placeholder text will be returned unless the
* declarativeNetRequestFeedback permission is present or tab-specific badge text was provided.
* Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned. If {@link declarativeNetRequest.ExtensionActionOptions.displayActionCountAsBadgeText displayActionCountAsBadgeText} is enabled, a placeholder text will be returned unless the {@link runtime.ManifestPermissions declarativeNetRequestFeedback} permission is present or tab-specific badge text was provided.
*
* Can return its result via Promise.
*/
export function getBadgeText(details: TabDetails): Promise<string>;
export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
/**
* @since Chrome 88
* Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.
* If displayActionCountAsBadgeText is enabled, a placeholder text will be returned unless the
* declarativeNetRequestFeedback permission is present or tab-specific badge text was provided.
* @return The `getBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only).
*/
export function getBadgeText(details: TabDetails): Promise<string>;
/**
* @since Chrome 110
* Gets the text color of the action.
*
* Can return its result via Promise.
* @since Chrome 110
*/
export function getBadgeTextColor(details: TabDetails): Promise<ColorArray>;
export function getBadgeTextColor(details: TabDetails, callback: (result: ColorArray) => void): void;
/**
* @since Chrome 110
* Gets the text color of the action.
* @return The `getBadgeTextColor` method provides its result via callback or returned as a `Promise` (MV3 only).
*/
export function getBadgeTextColor(details: TabDetails): Promise<ColorArray>;
/**
* @since Chrome 88
* Gets the html document set as the popup for this action.
*
* Can return its result via Promise.
*/
export function getPopup(details: TabDetails): Promise<string>;
export function getPopup(details: TabDetails, callback: (result: string) => void): void;
/**
* @since Chrome 88
* Gets the html document set as the popup for this action.
* @return The `getPopup` method provides its result via callback or returned as a `Promise` (MV3 only).
*/
export function getPopup(details: TabDetails): Promise<string>;
/**
* @since Chrome 88
* Gets the title of the action.
*
* Can return its result via Promise.
*/
export function getTitle(details: TabDetails): Promise<string>;
export function getTitle(details: TabDetails, callback: (result: string) => void): void;
/**
* @since Chrome 88
* Gets the title of the action.
* @return The `getTitle` method provides its result via callback or returned as a `Promise` (MV3 only).
*/
export function getTitle(details: TabDetails): Promise<string>;
/**
* @since Chrome 91
* Returns the user-specified settings relating to an extension's action.
*
* Can return its result via Promise.
* @since Chrome 91
*/
export function getUserSettings(): Promise<UserSettings>;
export function getUserSettings(callback: (userSettings: UserSettings) => void): void;
/**
* @since Chrome 91
* Returns the user-specified settings relating to an extension's action.
* @return The `getUserSettings` method provides its result via callback or returned as a `Promise` (MV3 only).
*/
export function getUserSettings(): Promise<UserSettings>;
/**
* Indicates whether the extension action is enabled for a tab (or globally if no `tabId` is provided). Actions enabled using only {@link declarativeContent} always return false.
*
* Can return its result via Promise.
* @since Chrome 110
* Indicates whether the extension action is enabled for a tab (or globally if no tabId is provided). Actions enabled using only declarativeContent always return false.
*/
export function isEnabled(tabId?: number): Promise<boolean>;
export function isEnabled(callback: (isEnabled: boolean) => void): void;
export function isEnabled(tabId: number | undefined, callback: (isEnabled: boolean) => void): void;
/**
* @since Chrome 110
* Indicates whether the extension action is enabled for a tab (or globally if no tabId is provided). Actions enabled using only declarativeContent always return false.
* @return True if the extension action is enabled.
*/
export function isEnabled(tabId?: number): Promise<boolean>;
/**
* @since Chrome 99
* Opens the extension's popup.
* Opens the extension's popup. Between Chrome 118 and Chrome 126, this is only available to policy installed extensions.
*
* @param options Specifies options for opening the popup.
* () => {...}
* @return The `openPopup` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
*
* Can return its result via Promise.
* @since Chrome 127
*/
export function openPopup(options?: OpenPopupOptions): Promise<void>;
/**
* @since Chrome 99
* Opens the extension's popup.
* @param options Specifies options for opening the popup.
*/
export function openPopup(callback: () => void): void;
export function openPopup(options: OpenPopupOptions, callback: () => void): void;
export function openPopup(options: OpenPopupOptions | undefined, callback: () => void): void;
/**
* @since Chrome 88
* Sets the background color for the badge.
* @return The `setBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
*
* Can return its result via Promise.
*/
export function setBadgeBackgroundColor(details: BadgeColorDetails): Promise<void>;
/**
* @since Chrome 88
* Sets the background color for the badge.
*/
export function setBadgeBackgroundColor(details: BadgeColorDetails, callback: () => void): void;
/**
* @since Chrome 88
* Sets the badge text for the action. The badge is displayed on top of the icon.
* @return The `setBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
*
* Can return its result via Promise.
*/
export function setBadgeText(details: BadgeTextDetails): Promise<void>;
/**
* @since Chrome 88
* Sets the badge text for the action. The badge is displayed on top of the icon.
*/
export function setBadgeText(details: BadgeTextDetails, callback: () => void): void;
/**
* @since Chrome 110
* Sets the text color for the badge.
* @return The `setBadgeTextColor` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
*
* Can return its result via Promise.
* @since Chrome 110
*/
export function setBadgeTextColor(details: BadgeColorDetails): Promise<void>;
/**
* @since Chrome 100
* Sets the text color for the badge.
*/
export function setBadgeTextColor(details: BadgeColorDetails, callback: () => void): void;
/**
* @since Chrome 88
* Sets the icon for the action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element,
* or as dictionary of either one of those. Either the path or the imageData property must be specified.
* @return The `setIcon` method provides its result via callback or returned as a `Promise` (MV3 only). Since Chrome 96.
* Sets the icon for the action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified.
*
* Can return its result via Promise.
*/
export function setIcon(details: TabIconDetails): Promise<void>;
export function setIcon(details: TabIconDetails, callback: () => void): void;
/**
* @since Chrome 88
* Sets the html document to be opened as a popup when the user clicks on the action's icon.
* @return The `setPopup` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
*
* Can return its result via Promise.
*/
export function setPopup(details: PopupDetails): Promise<void>;
/**
* @since Chrome 88
* Sets the html document to be opened as a popup when the user clicks on the action's icon.
*/
export function setPopup(details: PopupDetails, callback: () => void): void;
/**
* @since Chrome 88
* Sets the title of the action. This shows up in the tooltip.
* @return The `setTitle` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
*
* Can return its result via Promise.
*/
export function setTitle(details: TitleDetails): Promise<void>;
/**
* @since Chrome 88
* Sets the title of the action. This shows up in the tooltip.
*/
export function setTitle(details: TitleDetails, callback: () => void): void;
/** Fired when an action icon is clicked. This event will not fire if the action has a popup. */
export const onClicked: Browser.events.Event<(tab: Browser.tabs.Tab) => void>;
export const onClicked: events.Event<(tab: Browser.tabs.Tab) => void>;
/**
* Fired when user-specified settings relating to an extension's action change.
* @since Chrome 130
*/
export const onUserSettingsChanged: Browser.events.Event<(change: UserSettingsChange) => void>;
export const onUserSettingsChanged: events.Event<(change: UserSettingsChange) => void>;
}
////////////////////
@@ -4499,6 +4419,84 @@ export namespace Browser {
export var onRequestExternal: OnRequestEvent;
}
////////////////////
// Extension Types
////////////////////
/** The `Browser.extensionTypes` API contains type declarations for Chrome extensions. */
export namespace extensionTypes {
/**
* The origin of injected CSS.
* @since Chrome 66
*/
export type CSSOrigin = "author" | "user";
/**
* The document lifecycle of the frame.
* @since Chrome 106
*/
export type DocumentLifecycle = "prerender" | "active" | "cached" | "pending_deletion";
/**
* The type of frame.
* @since Chrome 106
*/
export type FrameType = "outermost_frame" | "fenced_frame" | "sub_frame";
/** Details about the format and quality of an image. */
export interface ImageDetails {
/** The format of the resulting image. Default is `"jpeg"`. */
format?: ImageFormat | undefined;
/** When format is `"jpeg"`, controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease. */
quality?: number | undefined;
}
/**
* The format of an image.
* @since Chrome 44
*/
export type ImageFormat = "jpeg" | "png";
/** Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. */
export interface InjectDetails {
/** If allFrames is `true`, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's `false` and is only injected into the top frame. If `true` and `frameId` is set, then the code is inserted in the selected frame and all of its child frames. */
allFrames?: boolean | undefined;
/**
* JavaScript or CSS code to inject.
*
* **Warning:** Be careful using the `code` parameter. Incorrect use of it may open your extension to cross site scripting attacks
*/
code?: string | undefined;
/**
* The origin of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to `"author"`.
* @since Chrome 66
*/
cssOrigin?: CSSOrigin | undefined;
/** JavaScript or CSS file to inject. */
file?: string | undefined;
/**
* The frame where the script or CSS should be injected. Defaults to 0 (the top-level frame).
* @since Chrome 50
*/
frameId?: number | undefined;
/** If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is `false`. */
matchAboutBlank?: boolean;
/** The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle". */
runAt?: RunAt | undefined;
}
/**
* The soonest that the JavaScript or CSS will be injected into the tab.
*
* "document_start" : Script is injected after any files from css, but before any other DOM is constructed or any other script is run.
*
* "document_end" : Script is injected immediately after the DOM is complete, but before subresources like images and frames have loaded.
*
* "document_idle" : The browser chooses a time to inject the script between "document_end" and immediately after the `window.onload` event fires. The exact moment of injection depends on how complex the document is and how long it is taking to load, and is optimized for page load speed. Content scripts running at "document_idle" don't need to listen for the `window.onload` event; they are guaranteed to run after the DOM completes. If a script definitely needs to run after `window.onload`, the extension can check if `onload` has already fired by using the `document.readyState` property.
* @since Chrome 44
*/
export type RunAt = "document_start" | "document_end" | "document_idle";
}
////////////////////
// File Browser Handler
////////////////////
@@ -8708,9 +8706,6 @@ export namespace Browser {
export function addListener(callback: (info: OnReceiveErrorInfo) => void): void;
}
type DocumentLifecycle = "prerender" | "active" | "cached" | "pending_deletion";
type FrameType = "outermost_frame" | "fenced_frame" | "sub_frame";
////////////////////
// Runtime
////////////////////
@@ -8866,7 +8861,7 @@ export namespace Browser {
* The lifecycle the document that opened the connection is in at the time the port was created. Note that the lifecycle state of the document may have changed since port creation.
* @since Chrome 106
*/
documentLifecycle?: DocumentLifecycle | undefined;
documentLifecycle?: extensionTypes.DocumentLifecycle | undefined;
/**
* A UUID of the document that opened the connection.
* @since Chrome 106
@@ -9700,7 +9695,7 @@ export namespace Browser {
js?: string[];
matches?: string[];
persistAcrossSessions?: boolean;
runAt?: "document_start" | "document_end" | "document_idle";
runAt?: extensionTypes.RunAt;
world?: ExecutionWorld;
}
@@ -11145,45 +11140,6 @@ export namespace Browser {
defaultZoomFactor?: number | undefined;
}
export interface InjectDetails {
/**
* Optional.
* If allFrames is true, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's false and is only injected into the top frame.
*/
allFrames?: boolean | undefined;
/**
* Optional. JavaScript or CSS code to inject.
* Warning: Be careful using the code parameter. Incorrect use of it may open your extension to cross site scripting attacks.
*/
code?: string | undefined;
/**
* Optional. The soonest that the JavaScript or CSS will be injected into the tab.
* One of: "document_start", "document_end", or "document_idle"
* @since Chrome 20
*/
runAt?: string | undefined;
/** Optional. JavaScript or CSS file to inject. */
file?: string | undefined;
/**
* Optional.
* The frame where the script or CSS should be injected. Defaults to 0 (the top-level frame).
* @since Chrome 39
*/
frameId?: number | undefined;
/**
* Optional.
* If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is false.
* @since Chrome 39
*/
matchAboutBlank?: boolean | undefined;
/**
* Optional. The origin of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to "author".
* One of: "author", or "user"
* @since Chrome 66
*/
cssOrigin?: string | undefined;
}
export interface CreateProperties {
/** Optional. The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window. */
index?: number | undefined;
@@ -11265,19 +11221,6 @@ export namespace Browser {
autoDiscardable?: boolean | undefined;
}
export interface CaptureVisibleTabOptions {
/**
* Optional.
* When format is "jpeg", controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease.
*/
quality?: number | undefined;
/**
* Optional. The format of an image.
* One of: "jpeg", or "png"
*/
format?: string | undefined;
}
export interface ReloadProperties {
/** Optional. Whether using any local cache. Default is false. */
bypassCache?: boolean | undefined;
@@ -11540,21 +11483,21 @@ export namespace Browser {
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
* @return The `executeScript` method provides its result via callback or returned as a `Promise` (MV3 only). The result of the script in every injected frame.
*/
export function executeScript(details: InjectDetails): Promise<any[]>;
export function executeScript(details: extensionTypes.InjectDetails): Promise<any[]>;
/**
* Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
* @param callback Optional. Called after all the JavaScript has been executed.
* Parameter result: The result of the script in every injected frame.
*/
export function executeScript(details: InjectDetails, callback?: (result: any[]) => void): void;
export function executeScript(details: extensionTypes.InjectDetails, callback?: (result: any[]) => void): void;
/**
* Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
* @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window.
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
* @return The `executeScript` method provides its result via callback or returned as a `Promise` (MV3 only). The result of the script in every injected frame.
*/
export function executeScript(tabId: number, details: InjectDetails): Promise<any[]>;
export function executeScript(tabId: number, details: extensionTypes.InjectDetails): Promise<any[]>;
/**
* Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
* @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window.
@@ -11562,7 +11505,11 @@ export namespace Browser {
* @param callback Optional. Called after all the JavaScript has been executed.
* Parameter result: The result of the script in every injected frame.
*/
export function executeScript(tabId: number, details: InjectDetails, callback?: (result: any[]) => void): void;
export function executeScript(
tabId: number,
details: extensionTypes.InjectDetails,
callback?: (result: any[]) => void,
): void;
/** Retrieves details about the specified tab. */
export function get(tabId: number, callback: (tab: Tab) => void): void;
/**
@@ -11737,14 +11684,17 @@ export namespace Browser {
* @param options Optional. Details about the format and quality of an image.
* @return The `captureVisibleTab` method provides its result via callback or returned as a `Promise` (MV3 only). A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
*/
export function captureVisibleTab(options: CaptureVisibleTabOptions): Promise<string>;
export function captureVisibleTab(options: extensionTypes.ImageDetails): Promise<string>;
/**
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
* @param options Optional. Details about the format and quality of an image.
* @param callback
* Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
*/
export function captureVisibleTab(options: CaptureVisibleTabOptions, callback: (dataUrl: string) => void): void;
export function captureVisibleTab(
options: extensionTypes.ImageDetails,
callback: (dataUrl: string) => void,
): void;
/**
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
* @param windowId Optional. The target window. Defaults to the current window.
@@ -11753,7 +11703,7 @@ export namespace Browser {
*/
export function captureVisibleTab(
windowId: number,
options: CaptureVisibleTabOptions,
options: extensionTypes.ImageDetails,
): Promise<string>;
/**
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
@@ -11764,7 +11714,7 @@ export namespace Browser {
*/
export function captureVisibleTab(
windowId: number,
options: CaptureVisibleTabOptions,
options: extensionTypes.ImageDetails,
callback: (dataUrl: string) => void,
): void;
/**
@@ -11881,27 +11831,27 @@ export namespace Browser {
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
* @return The `insertCSS` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
*/
export function insertCSS(details: InjectDetails): Promise<void>;
export function insertCSS(details: extensionTypes.InjectDetails): Promise<void>;
/**
* Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
* @param callback Optional. Called when all the CSS has been inserted.
*/
export function insertCSS(details: InjectDetails, callback: () => void): void;
export function insertCSS(details: extensionTypes.InjectDetails, callback: () => void): void;
/**
* Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
* @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
* @return The `insertCSS` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
*/
export function insertCSS(tabId: number, details: InjectDetails): Promise<void>;
export function insertCSS(tabId: number, details: extensionTypes.InjectDetails): Promise<void>;
/**
* Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
* @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
* @param callback Optional. Called when all the CSS has been inserted.
*/
export function insertCSS(tabId: number, details: InjectDetails, callback: () => void): void;
export function insertCSS(tabId: number, details: extensionTypes.InjectDetails, callback: () => void): void;
/**
* Highlights the given tabs.
* @since Chrome 16
@@ -12960,11 +12910,11 @@ export namespace Browser {
/** A UUID of the document loaded. */
documentId: string;
/** The lifecycle the document is in. */
documentLifecycle: DocumentLifecycle;
documentLifecycle: extensionTypes.DocumentLifecycle;
/** True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. */
errorOccurred: boolean;
/** The type of frame the navigation occurred in. */
frameType: FrameType;
frameType: extensionTypes.FrameType;
/** A UUID of the parent document owning this frame. This is not set if there is no parent. */
parentDocumentId?: string | undefined;
/** ID of frame that wraps the frame. Set to -1 of no parent frame exists. */
@@ -13003,11 +12953,11 @@ export namespace Browser {
/** 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process. */
frameId: number;
/** The type of frame the navigation occurred in. */
frameType: FrameType;
frameType: extensionTypes.FrameType;
/** A UUID of the document loaded. (This is not set for onBeforeNavigate callbacks.) */
documentId?: string | undefined;
/** The lifecycle the document is in. */
documentLifecycle: DocumentLifecycle;
documentLifecycle: extensionTypes.DocumentLifecycle;
/** A UUID of the parent document owning this frame. This is not set if there is no parent. */
parentDocumentId?: string | undefined;
/**
@@ -13290,8 +13240,8 @@ export namespace Browser {
/** Optional. The HTTP request headers that are going to be sent out with this request. */
requestHeaders?: HttpHeader[] | undefined;
documentId: string;
documentLifecycle: DocumentLifecycle;
frameType: FrameType;
documentLifecycle: extensionTypes.DocumentLifecycle;
frameType: extensionTypes.FrameType;
frameId: number;
initiator?: string | undefined;
parentDocumentId?: string | undefined;
@@ -14909,7 +14859,7 @@ export namespace Browser {
/** Specifies which pages this user script will be injected into. See Match Patterns for more details on the syntax of these strings. This property must be specified for ${ref:register}. */
matches?: string[];
/** Specifies when JavaScript files are injected into the web page. The preferred and default value is document_idle */
runAt?: RunAt;
runAt?: extensionTypes.RunAt;
/** The JavaScript execution environment to run the script in. The default is `USER_SCRIPT` */
world?: ExecutionWorld;
/**
@@ -14943,11 +14893,6 @@ export namespace Browser {
file?: string;
}
/**
* Enum for the run-at property.
*/
export type RunAt = "document_start" | "document_end" | "document_idle";
/**
* Configures the `USER_SCRIPT` execution environment.
*
+5 -5
View File
@@ -167,8 +167,8 @@ importers:
version: 1.2.15
devDependencies:
'@types/chrome':
specifier: 0.0.323
version: 0.0.323
specifier: 0.0.324
version: 0.0.324
fs-extra:
specifier: ^11.3.0
version: 11.3.0
@@ -1929,8 +1929,8 @@ packages:
'@types/babel__traverse@7.20.6':
resolution: {integrity: sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==}
'@types/chrome@0.0.323':
resolution: {integrity: sha512-ipiDwx41lmGeLnbiT6ENOayvWXdkqKqNwqDQWEuz6dujaX7slSkk1nbSt5Q5c6xnQ708+kuCFrC00VLltSbWVA==}
'@types/chrome@0.0.324':
resolution: {integrity: sha512-puFoA5uJbN9+oaD/MjtMY13H7vPvO/IlSP4pe+uD/c+hB7HsbcOOLVRZlRWgkDSqupw4R+53pS9K9ORHYyMBCg==}
'@types/conventional-commits-parser@5.0.1':
resolution: {integrity: sha512-7uz5EHdzz2TqoMfV7ee61Egf5y6NkcO4FB/1iCCQnbeiI1F3xzv3vK5dBCXUCLQgGYS+mUeigK1iKQzvED+QnQ==}
@@ -6082,7 +6082,7 @@ snapshots:
dependencies:
'@babel/types': 7.27.0
'@types/chrome@0.0.323':
'@types/chrome@0.0.324':
dependencies:
'@types/filesystem': 0.0.36
'@types/har-format': 1.2.15