webext-schema 2.1.1 → 2.2.0

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.
@@ -4,7 +4,7 @@
4
4
 
5
5
  /* api */
6
6
  import { IS_WIN } from './constant.js';
7
- import { URL, fileURLToPath } from 'url';
7
+ import { fileURLToPath } from 'url';
8
8
  import { getType, isString } from './common.js';
9
9
  import fs, { promises as fsPromise } from 'fs';
10
10
  import path from 'path';
package/modules/update.js CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  /* api */
6
6
  import { CHAR, INDENT } from './constant.js';
7
- import { URL } from 'url';
8
7
  import JSON5 from 'json5';
9
8
  import { createFile } from './file-util.js';
10
9
  import { getType, isString } from './common.js';
package/package.json CHANGED
@@ -29,10 +29,10 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "camelize": "^1.0.0",
32
- "commander": "^9.0.0",
32
+ "commander": "^9.1.0",
33
33
  "decamelize": "^6.0.0",
34
34
  "json5": "^2.2.0",
35
- "node-fetch": "^3.2.1",
35
+ "node-fetch": "^3.2.3",
36
36
  "sinon": "^13.0.1"
37
37
  },
38
38
  "devDependencies": {
@@ -41,12 +41,12 @@
41
41
  "eslint": "^7.32.0",
42
42
  "eslint-config-standard": "^16.0.3",
43
43
  "eslint-plugin-import": "^2.25.4",
44
- "eslint-plugin-jsdoc": "^37.9.6",
44
+ "eslint-plugin-jsdoc": "^37.9.7",
45
45
  "eslint-plugin-node": "^11.1.0",
46
46
  "eslint-plugin-promise": "^5.2.0",
47
- "mocha": "^9.2.1",
47
+ "mocha": "^9.2.2",
48
48
  "nock": "^13.2.4",
49
49
  "npm-run-all": "^4.1.5"
50
50
  },
51
- "version": "2.1.1"
51
+ "version": "2.2.0"
52
52
  }
@@ -15206,7 +15206,8 @@
15206
15206
  "s390x",
15207
15207
  "sparc64",
15208
15208
  "x86-32",
15209
- "x86-64"
15209
+ "x86-64",
15210
+ "noarch"
15210
15211
  ],
15211
15212
  "allowedContexts": [
15212
15213
  "content",
@@ -16028,6 +16029,65 @@
16028
16029
  "description": "Details specifying the target into which to inject the CSS."
16029
16030
  }
16030
16031
  }
16032
+ },
16033
+ {
16034
+ "id": "ContentScriptFilter",
16035
+ "type": "object",
16036
+ "properties": {
16037
+ "ids": {
16038
+ "type": "array",
16039
+ "optional": true,
16040
+ "description": "The IDs of specific scripts to retrieve with <code>getRegisteredContentScripts()</code> or to unregister with <code>unregisterContentScripts()</code>.",
16041
+ "items": {
16042
+ "type": "string"
16043
+ }
16044
+ }
16045
+ }
16046
+ },
16047
+ {
16048
+ "id": "RegisteredContentScript",
16049
+ "type": "object",
16050
+ "properties": {
16051
+ "allFrames": {
16052
+ "type": "boolean",
16053
+ "optional": true,
16054
+ "description": "If specified 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."
16055
+ },
16056
+ "excludeMatches": {
16057
+ "type": "array",
16058
+ "optional": true,
16059
+ "description": "Excludes pages that this content script would otherwise be injected into.",
16060
+ "items": {
16061
+ "type": "string"
16062
+ }
16063
+ },
16064
+ "id": {
16065
+ "type": "string",
16066
+ "description": "The id of the content script, specified in the API call."
16067
+ },
16068
+ "js": {
16069
+ "type": "array",
16070
+ "optional": true,
16071
+ "description": "The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array.",
16072
+ "items": {
16073
+ "$ref": "manifest.ExtensionURL"
16074
+ }
16075
+ },
16076
+ "matches": {
16077
+ "type": "array",
16078
+ "optional": true,
16079
+ "description": "Specifies which pages this content script will be injected into. Must be specified for <code>registerContentScripts()</code>.",
16080
+ "items": {
16081
+ "type": "string"
16082
+ }
16083
+ },
16084
+ "runAt": {
16085
+ "$ref": "extensionTypes.RunAt",
16086
+ "optional": true,
16087
+ "default": "document_idle",
16088
+ "description": "Specifies when JavaScript files are injected into the web page. The preferred and default value is <code>document_idle</code>."
16089
+ }
16090
+ }
16031
16091
  }
16032
16092
  ],
16033
16093
  "functions": [
@@ -16095,6 +16155,76 @@
16095
16155
  "parameters": []
16096
16156
  }
16097
16157
  ]
16158
+ },
16159
+ {
16160
+ "name": "registerContentScripts",
16161
+ "type": "function",
16162
+ "description": "Registers one or more content scripts for this extension.",
16163
+ "async": "callback",
16164
+ "parameters": [
16165
+ {
16166
+ "name": "scripts",
16167
+ "type": "array",
16168
+ "description": "Contains a list of scripts to be registered. If there are errors during script parsing/file validation, or if the IDs specified already exist, then no scripts are registered.",
16169
+ "items": {
16170
+ "$ref": "RegisteredContentScript"
16171
+ }
16172
+ },
16173
+ {
16174
+ "name": "callback",
16175
+ "type": "function",
16176
+ "description": "Invoked upon completion of the registration.",
16177
+ "parameters": []
16178
+ }
16179
+ ]
16180
+ },
16181
+ {
16182
+ "name": "getRegisteredContentScripts",
16183
+ "type": "function",
16184
+ "description": "Returns all dynamically registered content scripts for this extension that match the given filter.",
16185
+ "async": "callback",
16186
+ "parameters": [
16187
+ {
16188
+ "name": "filter",
16189
+ "$ref": "ContentScriptFilter",
16190
+ "optional": true,
16191
+ "description": "An object to filter the extension's dynamically registered scripts."
16192
+ },
16193
+ {
16194
+ "name": "callback",
16195
+ "type": "function",
16196
+ "description": "The resulting array contains the registered content scripts.",
16197
+ "parameters": [
16198
+ {
16199
+ "name": "scripts",
16200
+ "type": "array",
16201
+ "items": {
16202
+ "$ref": "RegisteredContentScript"
16203
+ }
16204
+ }
16205
+ ]
16206
+ }
16207
+ ]
16208
+ },
16209
+ {
16210
+ "name": "unregisterContentScripts",
16211
+ "type": "function",
16212
+ "description": "Unregisters one or more content scripts for this extension.",
16213
+ "async": "callback",
16214
+ "parameters": [
16215
+ {
16216
+ "name": "filter",
16217
+ "$ref": "ContentScriptFilter",
16218
+ "optional": true,
16219
+ "description": "If specified, only unregisters dynamic content scripts which match the filter. Otherwise, all of the extension's dynamic content scripts are unregistered."
16220
+ },
16221
+ {
16222
+ "name": "callback",
16223
+ "type": "function",
16224
+ "description": "Invoked upon completion of the unregistration.",
16225
+ "parameters": []
16226
+ }
16227
+ ]
16098
16228
  }
16099
16229
  ]
16100
16230
  }
@@ -13018,6 +13018,11 @@
13018
13018
  }
13019
13019
  ]
13020
13020
  },
13021
+ "granted_host_permissions": {
13022
+ "type": "boolean",
13023
+ "optional": true,
13024
+ "default": false
13025
+ },
13021
13026
  "host_permissions": {
13022
13027
  "min_manifest_version": 3,
13023
13028
  "type": "array",
@@ -14493,9 +14498,6 @@
14493
14498
  "permissions.json": [
14494
14499
  {
14495
14500
  "namespace": "permissions",
14496
- "permissions": [
14497
- "manifest:optional_permissions"
14498
- ],
14499
14501
  "types": [
14500
14502
  {
14501
14503
  "id": "Permissions",
@@ -15337,7 +15339,6 @@
15337
15339
  "functions": [
15338
15340
  {
15339
15341
  "name": "getBackgroundPage",
15340
- "max_manifest_version": 2,
15341
15342
  "type": "function",
15342
15343
  "description": "Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.",
15343
15344
  "async": "callback",
@@ -15943,6 +15944,10 @@
15943
15944
  "target": {
15944
15945
  "$ref": "InjectionTarget",
15945
15946
  "description": "Details specifying the target into which to inject the script."
15947
+ },
15948
+ "world": {
15949
+ "$ref": "ExecutionWorld",
15950
+ "optional": true
15946
15951
  }
15947
15952
  }
15948
15953
  },
@@ -16037,13 +16042,21 @@
16037
16042
  "ids": {
16038
16043
  "type": "array",
16039
16044
  "optional": true,
16040
- "description": "The IDs of specific scripts to retrieve with <code>getRegisteredContentScripts()</code>.",
16045
+ "description": "The IDs of specific scripts to retrieve with <code>getRegisteredContentScripts()</code> or to unregister with <code>unregisterContentScripts()</code>.",
16041
16046
  "items": {
16042
16047
  "type": "string"
16043
16048
  }
16044
16049
  }
16045
16050
  }
16046
16051
  },
16052
+ {
16053
+ "id": "ExecutionWorld",
16054
+ "type": "string",
16055
+ "enum": [
16056
+ "ISOLATED"
16057
+ ],
16058
+ "description": "The JavaScript world for a script to execute within. We currently only support the <code>'ISOLATED'</code> world."
16059
+ },
16047
16060
  {
16048
16061
  "id": "RegisteredContentScript",
16049
16062
  "type": "object",
@@ -16084,8 +16097,22 @@
16084
16097
  "runAt": {
16085
16098
  "$ref": "extensionTypes.RunAt",
16086
16099
  "optional": true,
16087
- "default": "document_idle",
16088
16100
  "description": "Specifies when JavaScript files are injected into the web page. The preferred and default value is <code>document_idle</code>."
16101
+ },
16102
+ "persistAcrossSessions": {
16103
+ "type": "boolean",
16104
+ "enum": [
16105
+ false
16106
+ ],
16107
+ "description": "Specifies if this content script will persist into future sessions. This is currently NOT supported."
16108
+ },
16109
+ "css": {
16110
+ "type": "array",
16111
+ "optional": true,
16112
+ "description": "The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array.",
16113
+ "items": {
16114
+ "$ref": "manifest.ExtensionURL"
16115
+ }
16089
16116
  }
16090
16117
  }
16091
16118
  }
@@ -16205,6 +16232,59 @@
16205
16232
  ]
16206
16233
  }
16207
16234
  ]
16235
+ },
16236
+ {
16237
+ "name": "unregisterContentScripts",
16238
+ "type": "function",
16239
+ "description": "Unregisters one or more content scripts for this extension.",
16240
+ "async": "callback",
16241
+ "parameters": [
16242
+ {
16243
+ "name": "filter",
16244
+ "$ref": "ContentScriptFilter",
16245
+ "optional": true,
16246
+ "description": "If specified, only unregisters dynamic content scripts which match the filter. Otherwise, all of the extension's dynamic content scripts are unregistered."
16247
+ },
16248
+ {
16249
+ "name": "callback",
16250
+ "type": "function",
16251
+ "description": "Invoked upon completion of the unregistration.",
16252
+ "parameters": []
16253
+ }
16254
+ ]
16255
+ },
16256
+ {
16257
+ "name": "updateContentScripts",
16258
+ "type": "function",
16259
+ "description": "Updates one or more content scripts for this extension.",
16260
+ "async": "callback",
16261
+ "parameters": [
16262
+ {
16263
+ "name": "scripts",
16264
+ "type": "array",
16265
+ "description": "Contains a list of scripts to be updated. If there are errors during script parsing/file validation, or if the IDs specified do not already exist, then no scripts are updated.",
16266
+ "items": {
16267
+ "type": "object",
16268
+ "$import": "RegisteredContentScript",
16269
+ "properties": {
16270
+ "persistAcrossSessions": {
16271
+ "type": "boolean",
16272
+ "optional": true,
16273
+ "enum": [
16274
+ false
16275
+ ],
16276
+ "description": "Specifies if this content script will persist into future sessions. This is currently NOT supported."
16277
+ }
16278
+ }
16279
+ }
16280
+ },
16281
+ {
16282
+ "name": "callback",
16283
+ "type": "function",
16284
+ "description": "Invoked when scripts have been updated.",
16285
+ "parameters": []
16286
+ }
16287
+ ]
16208
16288
  }
16209
16289
  ]
16210
16290
  }
@@ -17784,6 +17864,26 @@
17784
17864
  },
17785
17865
  "maxItems": 15,
17786
17866
  "optional": true
17867
+ },
17868
+ "color_scheme": {
17869
+ "optional": true,
17870
+ "type": "string",
17871
+ "enum": [
17872
+ "auto",
17873
+ "light",
17874
+ "dark",
17875
+ "system"
17876
+ ]
17877
+ },
17878
+ "content_color_scheme": {
17879
+ "optional": true,
17880
+ "type": "string",
17881
+ "enum": [
17882
+ "auto",
17883
+ "light",
17884
+ "dark",
17885
+ "system"
17886
+ ]
17787
17887
  }
17788
17888
  },
17789
17889
  "additionalProperties": {
@@ -1300,9 +1300,6 @@
1300
1300
  "permissions.json": [
1301
1301
  {
1302
1302
  "namespace": "permissions",
1303
- "permissions": [
1304
- "manifest:optional_permissions"
1305
- ],
1306
1303
  "types": [
1307
1304
  {
1308
1305
  "id": "Permissions",
@@ -1714,7 +1711,6 @@
1714
1711
  "functions": [
1715
1712
  {
1716
1713
  "name": "getBackgroundPage",
1717
- "max_manifest_version": 2,
1718
1714
  "type": "function",
1719
1715
  "description": "Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.",
1720
1716
  "async": "callback",
@@ -2638,6 +2634,26 @@
2638
2634
  },
2639
2635
  "maxItems": 15,
2640
2636
  "optional": true
2637
+ },
2638
+ "color_scheme": {
2639
+ "description": "If set, overrides the general 'toolbar theme'.",
2640
+ "optional": true,
2641
+ "type": "string",
2642
+ "enum": [
2643
+ "light",
2644
+ "dark",
2645
+ "auto"
2646
+ ]
2647
+ },
2648
+ "content_color_scheme": {
2649
+ "description": "If set, overrides the color scheme for the content area.",
2650
+ "optional": true,
2651
+ "type": "string",
2652
+ "enum": [
2653
+ "light",
2654
+ "dark",
2655
+ "auto"
2656
+ ]
2641
2657
  }
2642
2658
  },
2643
2659
  "additionalProperties": {