forked from extension-js/extension.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manifest-types.ts
393 lines (381 loc) · 9.34 KB
/
manifest-types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
export type ManifestIcons = Record<number, string>
export interface SearchProvider {
name?: string | undefined
keyword?: string | undefined
favicon_url?: string | undefined
search_url: string
encoding?: string | undefined
suggest_url?: string | undefined
instant_url?: string | undefined
image_url?: string | undefined
search_url_post_params?: string | undefined
suggest_url_post_params?: string | undefined
instant_url_post_params?: string | undefined
image_url_post_params?: string | undefined
alternate_urls?: string[] | undefined
prepopulated_id?: number | undefined
is_default?: boolean | undefined
}
export interface ManifestAction {
default_icon?: ManifestIcons | undefined
default_title?: string | undefined
default_popup?: string | undefined
}
// Source: https://developer.chrome.com/docs/extensions/mv3/declare_permissions/
export type ManifestPermissions =
| 'activeTab'
| 'alarms'
| 'background'
| 'bookmarks'
| 'browsingData'
| 'certificateProvider'
| 'clipboardRead'
| 'clipboardWrite'
| 'contentSettings'
| 'contextMenus'
| 'cookies'
| 'debugger'
| 'declarativeContent'
| 'declarativeNetRequest'
| 'declarativeNetRequestFeedback'
| 'declarativeNetRequestWithHostAccess'
| 'declarativeWebRequest'
| 'desktopCapture'
| 'documentScan'
| 'downloads'
| 'downloads.shelf'
| 'downloads.ui'
| 'enterprise.deviceAttributes'
| 'enterprise.hardwarePlatform'
| 'enterprise.networkingAttributes'
| 'enterprise.platformKeys'
| 'experimental'
| 'favicon'
| 'fileBrowserHandler'
| 'fileSystemProvider'
| 'fontSettings'
| 'gcm'
| 'geolocation'
| 'history'
| 'identity'
| 'identity.email'
| 'idle'
| 'loginState'
| 'management'
| 'nativeMessaging'
| 'notifications'
| 'offscreen'
| 'pageCapture'
| 'platformKeys'
| 'power'
| 'printerProvider'
| 'printing'
| 'printingMetrics'
| 'privacy'
| 'processes'
| 'proxy'
| 'scripting'
| 'search'
| 'sessions'
| 'sidePanel'
| 'signedInDevices'
| 'storage'
| 'system.cpu'
| 'system.display'
| 'system.memory'
| 'system.storage'
| 'tabCapture'
| 'tabGroups'
| 'tabs'
| 'topSites'
| 'tts'
| 'ttsEngine'
| 'unlimitedStorage'
| 'vpnProvider'
| 'wallpaper'
| 'webNavigation'
| 'webRequest'
| 'webRequestBlocking'
export interface ManifestBase {
// Required
manifest_version: number
name: string
version: string
// Recommended
default_locale?: string | undefined
description?: string | undefined
icons?: ManifestIcons | undefined
// Optional
author?:
| {
email: string
}
| undefined
background_page?: string | undefined
chrome_settings_overrides?:
| {
homepage?: string | undefined
search_provider?: SearchProvider | undefined
startup_pages?: string[] | undefined
}
| undefined
chrome_ui_overrides?:
| {
bookmarks_ui?:
| {
remove_bookmark_shortcut?: boolean | undefined
remove_button?: boolean | undefined
}
| undefined
}
| undefined
chrome_url_overrides?:
| {
bookmarks?: string | undefined
history?: string | undefined
newtab?: string | undefined
}
| undefined
commands?:
| Record<
string,
{
suggested_key?:
| {
default?: string | undefined
windows?: string | undefined
mac?: string | undefined
chromeos?: string | undefined
linux?: string | undefined
}
| undefined
description?: string | undefined
global?: boolean | undefined
}
>
| undefined
content_capabilities?:
| {
matches?: string[] | undefined
permissions?: string[] | undefined
}
| undefined
content_scripts?:
| Array<{
matches?: string[] | undefined
exclude_matches?: string[] | undefined
css?: string[] | undefined
js?: string[] | undefined
run_at?: string | undefined
all_frames?: boolean | undefined
match_about_blank?: boolean | undefined
include_globs?: string[] | undefined
exclude_globs?: string[] | undefined
}>
| undefined
converted_from_user_script?: boolean | undefined
current_locale?: string | undefined
devtools_page?: string | undefined
event_rules?:
| Array<{
event?: string | undefined
actions?:
| Array<{
type: string
}>
| undefined
conditions?:
| chrome.declarativeContent.PageStateMatcherProperties[]
| undefined
}>
| undefined
externally_connectable?:
| {
ids?: string[] | undefined
matches?: string[] | undefined
accepts_tls_channel_id?: boolean | undefined
}
| undefined
file_browser_handlers?:
| Array<{
id?: string | undefined
default_title?: string | undefined
file_filters?: string[] | undefined
}>
| undefined
file_system_provider_capabilities?:
| {
configurable?: boolean | undefined
watchable?: boolean | undefined
multiple_mounts?: boolean | undefined
source?: string | undefined
}
| undefined
homepage_url?: string | undefined
import?:
| Array<{
id: string
minimum_version?: string | undefined
}>
| undefined
export?:
| {
whitelist?: string[] | undefined
}
| undefined
incognito?: string | undefined
input_components?:
| Array<{
name?: string | undefined
type?: string | undefined
id?: string | undefined
description?: string | undefined
language?: string[] | string | undefined
layouts?: string[] | undefined
indicator?: string | undefined
}>
| undefined
key?: string | undefined
minimum_chrome_version?: string | undefined
nacl_modules?:
| Array<{
path: string
mime_type: string
}>
| undefined
oauth2?:
| {
client_id: string
scopes?: string[] | undefined
}
| undefined
offline_enabled?: boolean | undefined
omnibox?:
| {
keyword: string
}
| undefined
options_page?: string | undefined
options_ui?:
| {
page?: string | undefined
chrome_style?: boolean | undefined
open_in_tab?: boolean | undefined
}
| undefined
platforms?:
| Array<{
nacl_arch?: string | undefined
sub_package_path: string
}>
| undefined
plugins?:
| Array<{
path: string
}>
| undefined
requirements?:
| {
'3D'?:
| {
features?: string[] | undefined
}
| undefined
plugins?:
| {
npapi?: boolean | undefined
}
| undefined
}
| undefined
sandbox?:
| {
pages: string[]
content_security_policy?: string | undefined
}
| undefined
short_name?: string | undefined
spellcheck?:
| {
dictionary_language?: string | undefined
dictionary_locale?: string | undefined
dictionary_format?: string | undefined
dictionary_path?: string | undefined
}
| undefined
storage?:
| {
managed_schema: string
}
| undefined
tts_engine?:
| {
voices: Array<{
voice_name: string
lang?: string | undefined
gender?: string | undefined
event_types?: string[] | undefined
}>
}
| undefined
update_url?: string | undefined
version_name?: string | undefined
[key: string]: any
}
export interface ManifestV2 extends ManifestBase {
// Required
manifest_version: 2
// Pick one (or none)
browser_action?: ManifestAction | undefined
page_action?: ManifestAction | undefined
// Optional
background?:
| {
scripts?: string[] | undefined
page?: string | undefined
persistent?: boolean | undefined
}
| undefined
content_security_policy?: string | undefined
optional_permissions?: string[] | undefined
permissions?: string[] | undefined
web_accessible_resources?: string[] | undefined
}
export interface ManifestV3 extends ManifestBase {
// Required
manifest_version: 3
// Optional
action?: ManifestAction | undefined
background?:
| {
service_worker: string
type?: 'module' // If the service worker uses ES modules
}
| undefined
content_scripts?:
| Array<{
matches?: string[] | undefined
exclude_matches?: string[] | undefined
css?: string[] | undefined
js?: string[] | undefined
run_at?: string | undefined
all_frames?: boolean | undefined
match_about_blank?: boolean | undefined
include_globs?: string[] | undefined
exclude_globs?: string[] | undefined
world?: 'ISOLATED' | 'MAIN' | undefined
}>
| undefined
content_security_policy?: {
extension_pages?: string
sandbox?: string
}
host_permissions?: string[] | undefined
optional_permissions?: ManifestPermissions[] | undefined
optional_host_permissions?: string[] | undefined
permissions?: ManifestPermissions[] | undefined
web_accessible_resources?:
| Array<{resources: string[]; matches: string[]}>
| undefined
}
export type Manifest = ManifestV2 | ManifestV3