webext-schema 2.0.0-a.2 → 2.0.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.
- package/index.js +1 -5
- package/modules/common.js +0 -36
- package/modules/constant.js +0 -4
- package/modules/update.js +1 -1
- package/package.json +3 -3
- package/schemas/beta/webext.json +46 -0
- package/schemas/central/webext.json +42 -0
- package/schemas/release/webext.json +5 -0
package/index.js
CHANGED
|
@@ -3,17 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/* api */
|
|
6
|
-
import { Schema } from './modules/schema.js';
|
|
7
6
|
import { logErr, throwErr } from './modules/common.js';
|
|
8
7
|
import { parseCommand } from './modules/update.js';
|
|
9
8
|
import process from 'process';
|
|
9
|
+
export { Schema } from './modules/schema.js';
|
|
10
10
|
|
|
11
11
|
/* process */
|
|
12
12
|
process.on('uncaughtException', throwErr);
|
|
13
13
|
process.on('unhandledRejection', logErr);
|
|
14
14
|
|
|
15
15
|
parseCommand(process.argv);
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
Schema
|
|
19
|
-
};
|
package/modules/common.js
CHANGED
|
@@ -76,39 +76,3 @@ export const isObjectNotEmpty = o => {
|
|
|
76
76
|
* @returns {boolean} - result
|
|
77
77
|
*/
|
|
78
78
|
export const isString = o => typeof o === 'string' || o instanceof String;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* stringify positive integer
|
|
82
|
-
*
|
|
83
|
-
* @param {number} i - integer
|
|
84
|
-
* @param {boolean} [zero] - treat 0 as a positive integer
|
|
85
|
-
* @returns {?string} - stringified integer
|
|
86
|
-
*/
|
|
87
|
-
export const stringifyPositiveInt = (i, zero = false) =>
|
|
88
|
-
Number.isSafeInteger(i) && ((zero && i >= 0) || i > 0) ? `${i}` : null;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* escape matching char
|
|
92
|
-
*
|
|
93
|
-
* @param {string} str - argument
|
|
94
|
-
* @param {RegExp} re - RegExp
|
|
95
|
-
* @returns {?string} - string
|
|
96
|
-
*/
|
|
97
|
-
export const escapeChar = (str, re) =>
|
|
98
|
-
isString(str) && re && re.global ? str.replace(re, (m, c) => `\\${c}`) : null;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* strip HTML tags and decode HTML entities
|
|
102
|
-
*
|
|
103
|
-
* @param {string} v - value
|
|
104
|
-
* @returns {string} - converted value
|
|
105
|
-
*/
|
|
106
|
-
export const stripHtmlTags = v => {
|
|
107
|
-
while (/^\n*<(?:[^>]+:)?[^>]+?>|<\/(?:[^>]+:)?[^>]+>\n*$/.test(v)) {
|
|
108
|
-
v = v.replace(/^\n*<(?:[^>]+:)?[^>]+?>/, '')
|
|
109
|
-
.replace(/<\/(?:[^>]+:)?[^>]+>\n*$/, '\n');
|
|
110
|
-
}
|
|
111
|
-
return v.replace(/<\/(?:[^>]+:)?[^>]+>\n*<!--.*-->\n*<(?:[^>]+:)?[^>]+>/g, '\n\n')
|
|
112
|
-
.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"')
|
|
113
|
-
.replace(/&/g, '&');
|
|
114
|
-
};
|
package/modules/constant.js
CHANGED
|
@@ -7,9 +7,5 @@ import os from 'os';
|
|
|
7
7
|
|
|
8
8
|
/* constants */
|
|
9
9
|
export const CHAR = 'utf8';
|
|
10
|
-
export const DIR_HOME = os.homedir();
|
|
11
10
|
export const INDENT = 2;
|
|
12
|
-
export const IS_BE = os.endianness() === 'BE';
|
|
13
|
-
export const IS_LE = os.endianness() === 'LE';
|
|
14
|
-
export const IS_MAC = os.platform() === 'darwin';
|
|
15
11
|
export const IS_WIN = os.platform() === 'win32';
|
package/modules/update.js
CHANGED
|
@@ -234,7 +234,7 @@ export const saveSchemaFile = async (channel, info) => {
|
|
|
234
234
|
const content = `${JSON.stringify(schema, null, INDENT)}\n`;
|
|
235
235
|
const fileName = channel === 'mail' ? 'mailext' : 'webext';
|
|
236
236
|
const filePath =
|
|
237
|
-
path.resolve(
|
|
237
|
+
path.resolve(DIR_CWD, 'schemas', channel, `${fileName}.json`);
|
|
238
238
|
const file = await createFile(filePath, content, {
|
|
239
239
|
encoding: CHAR, flag: 'w', mode: PERM_FILE
|
|
240
240
|
});
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"camelize": "^1.0.0",
|
|
27
27
|
"commander": "^8.2.0",
|
|
28
|
-
"decamelize": "^
|
|
28
|
+
"decamelize": "^6.0.0",
|
|
29
29
|
"json5": "^2.2.0",
|
|
30
30
|
"node-fetch": "^3.0.0",
|
|
31
31
|
"sinon": "^11.1.2"
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"eslint-plugin-jsdoc": "^36.1.0",
|
|
40
40
|
"eslint-plugin-node": "^11.1.0",
|
|
41
41
|
"eslint-plugin-promise": "^5.1.0",
|
|
42
|
-
"mocha": "^9.1.
|
|
42
|
+
"mocha": "^9.1.2",
|
|
43
43
|
"nock": "^13.1.3"
|
|
44
44
|
},
|
|
45
|
-
"version": "2.0.0
|
|
45
|
+
"version": "2.0.0"
|
|
46
46
|
}
|
package/schemas/beta/webext.json
CHANGED
|
@@ -9321,6 +9321,18 @@
|
|
|
9321
9321
|
],
|
|
9322
9322
|
"description": "A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set without a 'SameSite' attribute, 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'."
|
|
9323
9323
|
},
|
|
9324
|
+
{
|
|
9325
|
+
"id": "PartitionKey",
|
|
9326
|
+
"type": "object",
|
|
9327
|
+
"description": "The description of the storage partition of a cookie. This object may be omitted (null) if a cookie is not partitioned.",
|
|
9328
|
+
"properties": {
|
|
9329
|
+
"topLevelSite": {
|
|
9330
|
+
"type": "string",
|
|
9331
|
+
"optional": true,
|
|
9332
|
+
"description": "The first-party URL of the cookie, if the cookie is in storage partitioned by the top-level site."
|
|
9333
|
+
}
|
|
9334
|
+
}
|
|
9335
|
+
},
|
|
9324
9336
|
{
|
|
9325
9337
|
"id": "Cookie",
|
|
9326
9338
|
"type": "object",
|
|
@@ -9374,6 +9386,11 @@
|
|
|
9374
9386
|
"firstPartyDomain": {
|
|
9375
9387
|
"type": "string",
|
|
9376
9388
|
"description": "The first-party domain of the cookie."
|
|
9389
|
+
},
|
|
9390
|
+
"partitionKey": {
|
|
9391
|
+
"$ref": "PartitionKey",
|
|
9392
|
+
"optional": true,
|
|
9393
|
+
"description": "The cookie's storage partition, if any. null if not partitioned."
|
|
9377
9394
|
}
|
|
9378
9395
|
}
|
|
9379
9396
|
},
|
|
@@ -9441,6 +9458,11 @@
|
|
|
9441
9458
|
"type": "string",
|
|
9442
9459
|
"optional": true,
|
|
9443
9460
|
"description": "The first-party domain which the cookie to retrieve is associated. This attribute is required if First-Party Isolation is enabled."
|
|
9461
|
+
},
|
|
9462
|
+
"partitionKey": {
|
|
9463
|
+
"$ref": "PartitionKey",
|
|
9464
|
+
"optional": true,
|
|
9465
|
+
"description": "The storage partition, if the cookie is part of partitioned storage. By default, only non-partitioned cookies are returned."
|
|
9444
9466
|
}
|
|
9445
9467
|
}
|
|
9446
9468
|
},
|
|
@@ -9508,6 +9530,11 @@
|
|
|
9508
9530
|
"type": "string",
|
|
9509
9531
|
"optional": "omit-key-if-missing",
|
|
9510
9532
|
"description": "Restricts the retrieved cookies to those whose first-party domains match this one. This attribute is required if First-Party Isolation is enabled. To not filter by a specific first-party domain, use `null` or `undefined`."
|
|
9533
|
+
},
|
|
9534
|
+
"partitionKey": {
|
|
9535
|
+
"$ref": "PartitionKey",
|
|
9536
|
+
"optional": true,
|
|
9537
|
+
"description": "Selects a specific storage partition to look up cookies. Defaults to null, in which case only non-partitioned cookies are retrieved. If an object iis passed, partitioned cookies are also included, and filtered based on the keys present in the given PartitionKey description. An empty object ({}) returns all cookies (partitioned + unpartitioned), a non-empty object (e.g. {topLevelSite: '...'}) only returns cookies whose partition match all given attributes."
|
|
9511
9538
|
}
|
|
9512
9539
|
}
|
|
9513
9540
|
},
|
|
@@ -9592,6 +9619,11 @@
|
|
|
9592
9619
|
"type": "string",
|
|
9593
9620
|
"optional": true,
|
|
9594
9621
|
"description": "The first-party domain of the cookie. This attribute is required if First-Party Isolation is enabled."
|
|
9622
|
+
},
|
|
9623
|
+
"partitionKey": {
|
|
9624
|
+
"$ref": "PartitionKey",
|
|
9625
|
+
"optional": true,
|
|
9626
|
+
"description": "The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used."
|
|
9595
9627
|
}
|
|
9596
9628
|
}
|
|
9597
9629
|
},
|
|
@@ -9638,6 +9670,11 @@
|
|
|
9638
9670
|
"type": "string",
|
|
9639
9671
|
"optional": true,
|
|
9640
9672
|
"description": "The first-party domain associated with the cookie. This attribute is required if First-Party Isolation is enabled."
|
|
9673
|
+
},
|
|
9674
|
+
"partitionKey": {
|
|
9675
|
+
"$ref": "PartitionKey",
|
|
9676
|
+
"optional": true,
|
|
9677
|
+
"description": "The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used."
|
|
9641
9678
|
}
|
|
9642
9679
|
}
|
|
9643
9680
|
},
|
|
@@ -9667,6 +9704,11 @@
|
|
|
9667
9704
|
"firstPartyDomain": {
|
|
9668
9705
|
"type": "string",
|
|
9669
9706
|
"description": "The first-party domain associated with the cookie that's been removed."
|
|
9707
|
+
},
|
|
9708
|
+
"partitionKey": {
|
|
9709
|
+
"$ref": "PartitionKey",
|
|
9710
|
+
"optional": true,
|
|
9711
|
+
"description": "The storage partition, if the cookie is part of partitioned storage. null if not partitioned."
|
|
9670
9712
|
}
|
|
9671
9713
|
}
|
|
9672
9714
|
}
|
|
@@ -17254,6 +17296,10 @@
|
|
|
17254
17296
|
"$ref": "ThemeColor",
|
|
17255
17297
|
"optional": true
|
|
17256
17298
|
},
|
|
17299
|
+
"ntp_card_background": {
|
|
17300
|
+
"$ref": "ThemeColor",
|
|
17301
|
+
"optional": true
|
|
17302
|
+
},
|
|
17257
17303
|
"ntp_text": {
|
|
17258
17304
|
"$ref": "ThemeColor",
|
|
17259
17305
|
"optional": true
|
|
@@ -9321,6 +9321,18 @@
|
|
|
9321
9321
|
],
|
|
9322
9322
|
"description": "A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set without a 'SameSite' attribute, 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'."
|
|
9323
9323
|
},
|
|
9324
|
+
{
|
|
9325
|
+
"id": "PartitionKey",
|
|
9326
|
+
"type": "object",
|
|
9327
|
+
"description": "The description of the storage partition of a cookie. This object may be omitted (null) if a cookie is not partitioned.",
|
|
9328
|
+
"properties": {
|
|
9329
|
+
"topLevelSite": {
|
|
9330
|
+
"type": "string",
|
|
9331
|
+
"optional": true,
|
|
9332
|
+
"description": "The first-party URL of the cookie, if the cookie is in storage partitioned by the top-level site."
|
|
9333
|
+
}
|
|
9334
|
+
}
|
|
9335
|
+
},
|
|
9324
9336
|
{
|
|
9325
9337
|
"id": "Cookie",
|
|
9326
9338
|
"type": "object",
|
|
@@ -9374,6 +9386,11 @@
|
|
|
9374
9386
|
"firstPartyDomain": {
|
|
9375
9387
|
"type": "string",
|
|
9376
9388
|
"description": "The first-party domain of the cookie."
|
|
9389
|
+
},
|
|
9390
|
+
"partitionKey": {
|
|
9391
|
+
"$ref": "PartitionKey",
|
|
9392
|
+
"optional": true,
|
|
9393
|
+
"description": "The cookie's storage partition, if any. null if not partitioned."
|
|
9377
9394
|
}
|
|
9378
9395
|
}
|
|
9379
9396
|
},
|
|
@@ -9441,6 +9458,11 @@
|
|
|
9441
9458
|
"type": "string",
|
|
9442
9459
|
"optional": true,
|
|
9443
9460
|
"description": "The first-party domain which the cookie to retrieve is associated. This attribute is required if First-Party Isolation is enabled."
|
|
9461
|
+
},
|
|
9462
|
+
"partitionKey": {
|
|
9463
|
+
"$ref": "PartitionKey",
|
|
9464
|
+
"optional": true,
|
|
9465
|
+
"description": "The storage partition, if the cookie is part of partitioned storage. By default, only non-partitioned cookies are returned."
|
|
9444
9466
|
}
|
|
9445
9467
|
}
|
|
9446
9468
|
},
|
|
@@ -9508,6 +9530,11 @@
|
|
|
9508
9530
|
"type": "string",
|
|
9509
9531
|
"optional": "omit-key-if-missing",
|
|
9510
9532
|
"description": "Restricts the retrieved cookies to those whose first-party domains match this one. This attribute is required if First-Party Isolation is enabled. To not filter by a specific first-party domain, use `null` or `undefined`."
|
|
9533
|
+
},
|
|
9534
|
+
"partitionKey": {
|
|
9535
|
+
"$ref": "PartitionKey",
|
|
9536
|
+
"optional": true,
|
|
9537
|
+
"description": "Selects a specific storage partition to look up cookies. Defaults to null, in which case only non-partitioned cookies are retrieved. If an object iis passed, partitioned cookies are also included, and filtered based on the keys present in the given PartitionKey description. An empty object ({}) returns all cookies (partitioned + unpartitioned), a non-empty object (e.g. {topLevelSite: '...'}) only returns cookies whose partition match all given attributes."
|
|
9511
9538
|
}
|
|
9512
9539
|
}
|
|
9513
9540
|
},
|
|
@@ -9592,6 +9619,11 @@
|
|
|
9592
9619
|
"type": "string",
|
|
9593
9620
|
"optional": true,
|
|
9594
9621
|
"description": "The first-party domain of the cookie. This attribute is required if First-Party Isolation is enabled."
|
|
9622
|
+
},
|
|
9623
|
+
"partitionKey": {
|
|
9624
|
+
"$ref": "PartitionKey",
|
|
9625
|
+
"optional": true,
|
|
9626
|
+
"description": "The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used."
|
|
9595
9627
|
}
|
|
9596
9628
|
}
|
|
9597
9629
|
},
|
|
@@ -9638,6 +9670,11 @@
|
|
|
9638
9670
|
"type": "string",
|
|
9639
9671
|
"optional": true,
|
|
9640
9672
|
"description": "The first-party domain associated with the cookie. This attribute is required if First-Party Isolation is enabled."
|
|
9673
|
+
},
|
|
9674
|
+
"partitionKey": {
|
|
9675
|
+
"$ref": "PartitionKey",
|
|
9676
|
+
"optional": true,
|
|
9677
|
+
"description": "The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used."
|
|
9641
9678
|
}
|
|
9642
9679
|
}
|
|
9643
9680
|
},
|
|
@@ -9667,6 +9704,11 @@
|
|
|
9667
9704
|
"firstPartyDomain": {
|
|
9668
9705
|
"type": "string",
|
|
9669
9706
|
"description": "The first-party domain associated with the cookie that's been removed."
|
|
9707
|
+
},
|
|
9708
|
+
"partitionKey": {
|
|
9709
|
+
"$ref": "PartitionKey",
|
|
9710
|
+
"optional": true,
|
|
9711
|
+
"description": "The storage partition, if the cookie is part of partitioned storage. null if not partitioned."
|
|
9670
9712
|
}
|
|
9671
9713
|
}
|
|
9672
9714
|
}
|
|
@@ -11424,6 +11424,11 @@
|
|
|
11424
11424
|
"type": "number",
|
|
11425
11425
|
"optional": true,
|
|
11426
11426
|
"description": "The scale of the resulting image. Defaults to <code>devicePixelRatio</code>."
|
|
11427
|
+
},
|
|
11428
|
+
"resetScrollPosition": {
|
|
11429
|
+
"type": "boolean",
|
|
11430
|
+
"optional": true,
|
|
11431
|
+
"description": "If true, temporarily resets the scroll position of the document to 0. Only takes effect if rect is also specified."
|
|
11427
11432
|
}
|
|
11428
11433
|
}
|
|
11429
11434
|
},
|