Skip to content

Commit 6d00261

Browse files
authored
🤖 Merge PR DefinitelyTyped#74847 [chrome] update manifest keys by @erwanjugand
1 parent 2de9b74 commit 6d00261

File tree

2 files changed

+184
-74
lines changed

2 files changed

+184
-74
lines changed

types/chrome/index.d.ts

Lines changed: 110 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -9264,36 +9264,37 @@ declare namespace chrome {
92649264

92659265
export interface ManifestBase {
92669266
// Required
9267+
/** An integer specifying the version of the manifest file format that your extension uses. */
92679268
manifest_version: number;
9269+
/** A string that identifies the extension in the Chrome Web Store, the install dialog, and the user's Chrome Extensions page (`chrome://extensions`). The maximum length is 75 characters. */
92689270
name: string;
9271+
/** A string that identifies the extension's version number. */
92699272
version: string;
92709273

92719274
// Recommended
9275+
/** A string that defines the default language of an extension that supports multiple locales. Examples include "en" and "pt_BR". This key is required in localized extensions, and must not be used in extensions that aren't localized. */
92729276
default_locale?: string | undefined;
9277+
/** A string that describes the extension on both the Chrome Web Store and the user's extension management page. The maximum length is 132 characters. */
92739278
description?: string | undefined;
9279+
/** One or more icons that represent your extension. */
92749280
icons?: ManifestIcons | undefined;
92759281

92769282
// Optional
9277-
author?: {
9278-
email: string;
9279-
} | undefined;
9280-
background_page?: string | undefined;
9283+
/** @deprecated As of February 2024, the `author` key is no longer supported by Chrome or the Chrome Web Store. If present, it's silently ignored. */
9284+
author?: { email: string } | undefined;
9285+
/** Defines overrides for selected Chrome settings. */
92819286
chrome_settings_overrides?: {
92829287
homepage?: string | undefined;
92839288
search_provider?: SearchProvider | undefined;
92849289
startup_pages?: string[] | undefined;
92859290
} | undefined;
9286-
chrome_ui_overrides?: {
9287-
bookmarks_ui?: {
9288-
remove_bookmark_shortcut?: boolean | undefined;
9289-
remove_button?: boolean | undefined;
9290-
} | undefined;
9291-
} | undefined;
9291+
/** Defines overrides for default Chrome pages. */
92929292
chrome_url_overrides?: {
92939293
bookmarks?: string | undefined;
92949294
history?: string | undefined;
92959295
newtab?: string | undefined;
92969296
} | undefined;
9297+
/** Defines keyboard shortcuts within the extension. */
92979298
commands?: {
92989299
[name: string]: {
92999300
suggested_key?: {
@@ -9311,128 +9312,115 @@ declare namespace chrome {
93119312
matches?: string[] | undefined;
93129313
permissions?: string[] | undefined;
93139314
} | undefined;
9314-
content_scripts?:
9315-
| Array<{
9316-
matches?: string[] | undefined;
9317-
exclude_matches?: string[] | undefined;
9318-
css?: string[] | undefined;
9319-
js?: string[] | undefined;
9320-
run_at?: string | undefined;
9321-
all_frames?: boolean | undefined;
9322-
match_about_blank?: boolean | undefined;
9323-
include_globs?: string[] | undefined;
9324-
exclude_globs?: string[] | undefined;
9325-
}>
9326-
| undefined;
93279315
converted_from_user_script?: boolean | undefined;
9316+
/** Specifies a value for the Cross-Origin-Embedder-Policy HTTP header, which configures embedding of cross-origin resources in an extension page. */
9317+
cross_origin_embedder_policy?: { value: string } | undefined;
9318+
/** Specifies a value for the Cross-Origin-Opener-Policy HTTP header, which lets you ensure that a top-level extension page doesn't share a browsing context group with cross-origin documents. */
9319+
cross_origin_opener_policy?: { value: string } | undefined;
93289320
current_locale?: string | undefined;
9321+
/** Defines static rules for the declarativeNetRequest API, which allows blocking and modifying of network requests. */
9322+
declarative_net_request?: { rule_resources?: declarativeNetRequest.Ruleset[] } | undefined;
9323+
/** Defines pages that use the DevTools APIs. */
93299324
devtools_page?: string | undefined;
93309325
event_rules?:
93319326
| Array<{
93329327
event?: string | undefined;
9333-
actions?:
9334-
| Array<{
9335-
type: string;
9336-
}>
9337-
| undefined;
9328+
actions?: Array<{ type: string }> | undefined;
93389329
conditions?: chrome.declarativeContent.PageStateMatcherProperties[] | undefined;
93399330
}>
93409331
| undefined;
9332+
/** Specifies what other pages and extensions can connect to your extensions. */
93419333
externally_connectable?: {
93429334
ids?: string[] | undefined;
93439335
matches?: string[] | undefined;
93449336
accepts_tls_channel_id?: boolean | undefined;
93459337
} | undefined;
9338+
/** Provides access to the fileBrowserHandler API, which lets extensions access the ChromeOS file browser. */
93469339
file_browser_handlers?:
93479340
| Array<{
93489341
id?: string | undefined;
93499342
default_title?: string | undefined;
93509343
file_filters?: string[] | undefined;
93519344
}>
93529345
| undefined;
9346+
/** Allows access to the fileSystemProvider API, which lets extensions create file systems that ChromeOS can use. */
93539347
file_system_provider_capabilities?: {
9348+
/** Whether configuring via onConfigureRequested is supported. By default: false. */
93549349
configurable?: boolean | undefined;
9350+
/** Whether setting watchers and notifying about changes is supported. By default: false. */
93559351
watchable?: boolean | undefined;
9352+
/** Whether multiple (more than one) mounted file systems are supported. By default: false. */
93569353
multiple_mounts?: boolean | undefined;
9357-
source?: string | undefined;
9354+
/** Files app uses above information in order to render related UI elements appropriately. For example, if `configurable` is set to true, then a menu item for configuring volumes will be rendered. Similarly, if `multiple_mounts` is set to true, then Files app will allow to add more than one mount points from the UI. If `watchable` is false, then a refresh button will be rendered. Note, that if possible you should add support for watchers, so changes on the file system can be reflected immediately and automatically. */
9355+
source: "file" | "device" | "network";
93589356
} | undefined;
9357+
/** string specifying a URL for the extension's homepage. If this is undefined, the homepage defaults to the extension's Chrome Web Store page. This field is particularly useful if you host the extension on your own site. */
93599358
homepage_url?: string | undefined;
9359+
/** Allows resources to be imported into the extension. */
93609360
import?:
93619361
| Array<{
93629362
id: string;
93639363
minimum_version?: string | undefined;
93649364
}>
93659365
| undefined;
9366-
export?: {
9367-
whitelist?: string[] | undefined;
9368-
} | undefined;
9369-
incognito?: string | undefined;
9366+
/** Allows resources to be exported from the extension. */
9367+
export?: { allowlist?: string[] | undefined } | undefined;
9368+
/** Defines how the extension behaves in incognito mode. */
9369+
incognito?: "spanning" | "split" | "not_allowed" | undefined;
9370+
/** Allows the use of the Input Method Editor API. */
93709371
input_components?:
93719372
| Array<{
9372-
name?: string | undefined;
9373-
type?: string | undefined;
9373+
name: string;
93749374
id?: string | undefined;
9375-
description?: string | undefined;
93769375
language?: string[] | string | undefined;
9377-
layouts?: string[] | undefined;
9378-
indicator?: string | undefined;
9376+
layouts?: string[] | string | undefined;
9377+
input_view?: string | undefined;
9378+
options_page?: string | undefined;
93799379
}>
93809380
| undefined;
9381+
/** Specifies your extension's ID for various development use cases. */
93819382
key?: string | undefined;
9383+
/** Defines the oldest Chrome version that can install your extension. The value must be a substring of an existing Chrome browser version string, such as "107" or "107.0.5304.87". Users with versions of Chrome older than the minimum version see a "Not compatible" warning in the Chrome Web Store, and are unable to install your extension. If you add this to an existing extension, users whose Chrome version is older won't receive automatic updates to your extension. This includes business users in ephemeral mode. */
93829384
minimum_chrome_version?: string | undefined;
93839385
nacl_modules?:
93849386
| Array<{
93859387
path: string;
93869388
mime_type: string;
93879389
}>
93889390
| undefined;
9391+
/** Allows the use of an OAuth 2.0 security ID. The value of this key must be an object with "client_id" and "scopes" properties. */
93899392
oauth2?: {
93909393
client_id: string;
93919394
scopes?: string[] | undefined;
93929395
} | undefined;
93939396
offline_enabled?: boolean | undefined;
9394-
omnibox?: {
9395-
keyword: string;
9396-
} | undefined;
9397+
/** Allows the extension to register a keyword in Chrome's address bar. */
9398+
omnibox?: { keyword: string } | undefined;
9399+
/** Specifies a path to an options.html file for the extension to use as an options page. */
93979400
options_page?: string | undefined;
9401+
/** Specifies a path to an HTML file that lets a user change extension options from the Chrome Extensions page. */
93989402
options_ui?: {
9399-
page?: string | undefined;
9400-
chrome_style?: boolean | undefined;
9401-
open_in_tab?: boolean | undefined;
9403+
/** Path to the options page, relative to the extension's root. */
9404+
page: string;
9405+
/** Specify as `false` to declare an embedded options page. If `true`, the extension's options page will be opened in a new tab rather than embedded in `chrome://extensions`. */
9406+
open_in_tab: boolean;
94029407
} | undefined;
9403-
platforms?:
9404-
| Array<{
9405-
nacl_arch?: string | undefined;
9406-
sub_package_path: string;
9407-
}>
9408-
| undefined;
9409-
plugins?:
9410-
| Array<{
9411-
path: string;
9412-
}>
9413-
| undefined;
9408+
/** Lists technologies required to use the extension. */
94149409
requirements?: {
9415-
"3D"?: {
9416-
features?: string[] | undefined;
9417-
} | undefined;
9418-
plugins?: {
9419-
npapi?: boolean | undefined;
9420-
} | undefined;
9410+
"3D"?: { features?: string[] | undefined } | undefined;
9411+
/** @deprecated NPAPI Plugin support for extensions has been discontinued as of Chrome version 45 */
9412+
plugins?: { npapi?: boolean | undefined } | undefined;
94219413
} | undefined;
9414+
/** Defines a set of extension pages that don't have access to extension APIs or direct access to non-sandboxed pages. */
94229415
sandbox?: {
94239416
pages: string[];
94249417
content_security_policy?: string | undefined;
94259418
} | undefined;
9419+
/** A string containing a shortened version of the extension's name to be used when character space is limited. The maximum length is 12 characters. If this is undefined, a truncated version of the "name" key displays instead. */
94269420
short_name?: string | undefined;
9427-
spellcheck?: {
9428-
dictionary_language?: string | undefined;
9429-
dictionary_locale?: string | undefined;
9430-
dictionary_format?: string | undefined;
9431-
dictionary_path?: string | undefined;
9432-
} | undefined;
9433-
storage?: {
9434-
managed_schema: string;
9435-
} | undefined;
9421+
/** Declares a JSON schema for the managed storage area. */
9422+
storage?: { managed_schema: string } | undefined;
9423+
/** Registers the extension as a text to speech engine. */
94369424
tts_engine?: {
94379425
voices: Array<{
94389426
voice_name: string;
@@ -9441,13 +9429,14 @@ declare namespace chrome {
94419429
event_types?: string[] | undefined;
94429430
}>;
94439431
} | undefined;
9432+
/** A string containing the URL of the extension's updates page. Use this key if you're hosting your extension outside the Chrome Web Store. */
94449433
update_url?: string | undefined;
9434+
/** A string describing the extension's version. Examples include "1.0 beta" and "build rc2". If this is unspecified, the "version" value displays on the extension management page instead. */
94459435
version_name?: string | undefined;
94469436
[key: string]: any;
94479437
}
94489438

94499439
export interface ManifestV2 extends ManifestBase {
9450-
// Required
94519440
manifest_version: 2;
94529441

94539442
// Pick one (or none)
@@ -9462,24 +9451,50 @@ declare namespace chrome {
94629451
persistent?: boolean | undefined;
94639452
}
94649453
| undefined;
9454+
/** Specifies JavaScript or CSS files to be used when the user opens certain web pages. */
9455+
content_scripts?:
9456+
| Array<{
9457+
matches?: string[] | undefined;
9458+
exclude_matches?: string[] | undefined;
9459+
css?: string[] | undefined;
9460+
js?: string[] | undefined;
9461+
run_at?: string | undefined;
9462+
all_frames?: boolean | undefined;
9463+
match_about_blank?: boolean | undefined;
9464+
include_globs?: string[] | undefined;
9465+
exclude_globs?: string[] | undefined;
9466+
}>
9467+
| undefined;
9468+
/** Defines restrictions on the scripts, styles, and other resources an extension can use. */
94659469
content_security_policy?: string | undefined;
9470+
/** Declares optional permissions for your extension. */
94669471
optional_permissions?: (ManifestOptionalPermission | string)[] | undefined;
9472+
/** Enables use of particular extension APIs. */
94679473
permissions?: (ManifestPermission | string)[] | undefined;
9474+
platforms?:
9475+
| Array<{
9476+
nacl_arch?: string | undefined;
9477+
sub_package_path: string;
9478+
}>
9479+
| undefined;
9480+
/** Defines files within the extension that can be accessed by web pages or other extensions. */
94689481
web_accessible_resources?: string[] | undefined;
94699482
}
94709483

94719484
export interface ManifestV3 extends ManifestBase {
9472-
// Required
94739485
manifest_version: 3;
94749486

94759487
// Optional
9488+
/** Defines the appearance and behavior of the extension's icon in the Google Toolbar. */
94769489
action?: ManifestAction | undefined;
9490+
/** Specifies the JavaScript file containing the extension's service worker, which acts as an event handler. */
94779491
background?:
94789492
| {
94799493
service_worker: string;
9480-
type?: "module"; // If the service worker uses ES modules
9494+
type?: "module";
94819495
}
94829496
| undefined;
9497+
/** Specifies JavaScript or CSS files to be used when the user opens certain web pages. */
94839498
content_scripts?:
94849499
| Array<{
94859500
matches?: string[] | undefined;
@@ -9494,14 +9509,35 @@ declare namespace chrome {
94949509
world?: "ISOLATED" | "MAIN" | undefined;
94959510
}>
94969511
| undefined;
9512+
/** Defines restrictions on the scripts, styles, and other resources an extension can use. */
94979513
content_security_policy?: {
94989514
extension_pages?: string;
94999515
sandbox?: string;
9500-
};
9516+
} | undefined;
9517+
/** Specifies file types for ChromeOS extensions to handle. */
9518+
file_handlers?:
9519+
| Array<{
9520+
/** Specifies an HTML file to show when a file is opened. The file must be within your extension. Processing the file, whether it's displayed or used in some other way, is done with JavaScript using appropriate web platform APIs. This code must be in a separate JavaScript file included via a `<script>` tag. */
9521+
action: string;
9522+
/** A user friendly description of the action. */
9523+
name: string;
9524+
/** The file types that can be processed by the page specified in "action". The items in the dictionary are a key/value pair where the key is a MIME type and the value is an array of file extensions. Only known MIME types are allowed for the key. Custom file types are allowed but the key for a custom type must be a known MIME type, and the mapping between the MIME type and the custom file type must be supported by the underlying operating system. */
9525+
accept: { [mime_type: string]: string[] };
9526+
/** Specifies whether multiple files should be opened in a single client or multiple clients. The default value is "single-client". */
9527+
launch_type?: "multiple-clients" | "single-client" | undefined;
9528+
}>
9529+
| undefined;
9530+
/** Lists the web pages your extension is allowed to interact with, defined using URL match patterns. User permission for these sites is requested at install time. */
95019531
host_permissions?: string[] | undefined;
9532+
/** Declares optional permissions for your extension. */
95029533
optional_permissions?: ManifestOptionalPermission[] | undefined;
9534+
/** Declares optional host permissions for your extension. */
95039535
optional_host_permissions?: string[] | undefined;
9536+
/** Enables use of particular extension APIs. */
95049537
permissions?: ManifestPermission[] | undefined;
9538+
/** Identifies an HTML file to display in a sidePanel. */
9539+
side_panel?: { default_path: string } | undefined;
9540+
/** Defines files within the extension that can be accessed by web pages or other extensions. */
95059541
web_accessible_resources?:
95069542
| Array<
95079543
& {

0 commit comments

Comments
 (0)