webext-schema 5.1.3 → 5.1.4
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 -1
- package/modules/file-util.js +2 -2
- package/modules/schema.js +13 -10
- package/modules/update.js +5 -5
- package/package.json +7 -1
- package/schemas/central/webext.json +41 -2
- package/tsconfig.json +12 -0
- package/types/index.d.ts +1 -0
- package/types/modules/common.d.ts +7 -0
- package/types/modules/constant.d.ts +3 -0
- package/types/modules/file-util.d.ts +21 -0
- package/types/modules/schema.d.ts +26 -0
- package/types/modules/update.d.ts +14 -0
package/index.js
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/* api */
|
|
10
|
+
import process from 'node:process';
|
|
10
11
|
import { logErr, throwErr } from './modules/common.js';
|
|
11
12
|
import { parseCommand } from './modules/update.js';
|
|
12
|
-
import process from 'node:process';
|
|
13
13
|
export { Schema } from './modules/schema.js';
|
|
14
14
|
|
|
15
15
|
/* process */
|
package/modules/file-util.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/* api */
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { getType, isString } from './common.js';
|
|
8
6
|
import fs, { promises as fsPromise } from 'node:fs';
|
|
9
7
|
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { getType, isString } from './common.js';
|
|
10
10
|
import { IS_WIN } from './constant.js';
|
|
11
11
|
|
|
12
12
|
/* constants */
|
package/modules/schema.js
CHANGED
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/* api */
|
|
6
|
-
import { CHAR } from './constant.js';
|
|
7
|
-
import { convertUriToFilePath } from './file-util.js';
|
|
8
|
-
import { getType, isObjectNotEmpty, isString } from './common.js';
|
|
9
|
-
import camelize from 'camelize';
|
|
10
|
-
import decamelize from 'decamelize';
|
|
11
6
|
import fs from 'node:fs';
|
|
12
7
|
import path from 'node:path';
|
|
8
|
+
import camelize from 'camelize';
|
|
9
|
+
import decamelize from 'decamelize';
|
|
13
10
|
import sinon from 'sinon';
|
|
11
|
+
import { getType, isObjectNotEmpty, isString } from './common.js';
|
|
12
|
+
import { convertUriToFilePath } from './file-util.js';
|
|
13
|
+
import { CHAR } from './constant.js';
|
|
14
14
|
|
|
15
15
|
export class Schema {
|
|
16
|
+
/* private */
|
|
17
|
+
#channel;
|
|
18
|
+
|
|
16
19
|
/**
|
|
17
20
|
* construct
|
|
18
21
|
*
|
|
@@ -24,7 +27,7 @@ export class Schema {
|
|
|
24
27
|
*/
|
|
25
28
|
constructor(...args) {
|
|
26
29
|
const [arg1, arg2] = args;
|
|
27
|
-
this
|
|
30
|
+
this.#channel =
|
|
28
31
|
isString(arg1) && /(?:(?:centra|mai)l|beta|esr|release)/.test(arg1)
|
|
29
32
|
? arg1
|
|
30
33
|
: 'beta';
|
|
@@ -40,12 +43,12 @@ export class Schema {
|
|
|
40
43
|
|
|
41
44
|
/* getter / setter */
|
|
42
45
|
get channel() {
|
|
43
|
-
return this
|
|
46
|
+
return this.#channel;
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
set channel(ch) {
|
|
47
50
|
if (isString(ch) && /(?:(?:centra|mai)l|beta|esr|release)/.test(ch)) {
|
|
48
|
-
this
|
|
51
|
+
this.#channel = ch;
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -264,9 +267,9 @@ export class Schema {
|
|
|
264
267
|
* @returns {object} - schema
|
|
265
268
|
*/
|
|
266
269
|
_parseSchemaContent() {
|
|
267
|
-
const fileName = this
|
|
270
|
+
const fileName = this.#channel === 'mail' ? 'mailext.json' : 'webext.json';
|
|
268
271
|
const dirName = path.dirname(convertUriToFilePath(import.meta.url));
|
|
269
|
-
const file = path.join(dirName, '../', 'schemas', this
|
|
272
|
+
const file = path.join(dirName, '../', 'schemas', this.#channel, fileName);
|
|
270
273
|
const content = fs.readFileSync(file, {
|
|
271
274
|
encoding: CHAR,
|
|
272
275
|
flag: 'r'
|
package/modules/update.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/* api */
|
|
6
|
-
import { CHAR, INDENT } from './constant.js';
|
|
7
|
-
import JSON5 from 'json5';
|
|
8
|
-
import { createFile } from './file-util.js';
|
|
9
|
-
import { getType, isString } from './common.js';
|
|
10
|
-
import { program as commander } from 'commander';
|
|
11
6
|
import path from 'node:path';
|
|
12
7
|
import process from 'node:process';
|
|
8
|
+
import JSON5 from 'json5';
|
|
9
|
+
import { program as commander } from 'commander';
|
|
10
|
+
import { getType, isString } from './common.js';
|
|
11
|
+
import { createFile } from './file-util.js';
|
|
12
|
+
import { CHAR, INDENT } from './constant.js';
|
|
13
13
|
|
|
14
14
|
/* constants */
|
|
15
15
|
const DIR_CWD = process.cwd();
|
package/package.json
CHANGED
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
13
|
"main": "index.js",
|
|
14
|
+
"types": "types/index.d.ts",
|
|
14
15
|
"dependencies": {
|
|
16
|
+
"@types/node": "^18.14.0",
|
|
17
|
+
"@types/sinon": "^10.0.13",
|
|
15
18
|
"camelize": "^1.0.1",
|
|
16
19
|
"commander": "^10.0.0",
|
|
17
20
|
"decamelize": "^6.0.0",
|
|
@@ -30,9 +33,11 @@
|
|
|
30
33
|
"eslint-plugin-unicorn": "^45.0.2",
|
|
31
34
|
"mocha": "^10.2.0",
|
|
32
35
|
"npm-run-all": "^4.1.5",
|
|
36
|
+
"typescript": "^4.9.5",
|
|
33
37
|
"undici": "^5.19.1"
|
|
34
38
|
},
|
|
35
39
|
"scripts": {
|
|
40
|
+
"build": "npm run tsc && npm run lint && npm run test",
|
|
36
41
|
"lint": "eslint --fix .",
|
|
37
42
|
"start": "node index",
|
|
38
43
|
"test": "npm run test-central",
|
|
@@ -41,6 +46,7 @@
|
|
|
41
46
|
"test-esr": "c8 mocha --require=test/mocha/setup.js --channel=esr --exit test/*.test.js",
|
|
42
47
|
"test-release": "c8 mocha --require=test/mocha/setup.js --channel=release --exit test/*.test.js",
|
|
43
48
|
"test_all": "npm-run-all -s test-*",
|
|
49
|
+
"tsc": "node -e \"fs.rmSync('types',{recursive:true,force:true})\" && npx tsc",
|
|
44
50
|
"update": "node index update -i",
|
|
45
51
|
"update-beta": "node index update --channel=beta -i",
|
|
46
52
|
"update-central": "node index update --channel=central -i",
|
|
@@ -48,5 +54,5 @@
|
|
|
48
54
|
"update-mail": "node index update --channel=mail -i",
|
|
49
55
|
"update-release": "node index update --channel=release -i"
|
|
50
56
|
},
|
|
51
|
-
"version": "5.1.
|
|
57
|
+
"version": "5.1.4"
|
|
52
58
|
}
|
|
@@ -9721,13 +9721,24 @@
|
|
|
9721
9721
|
}
|
|
9722
9722
|
]
|
|
9723
9723
|
},
|
|
9724
|
+
{
|
|
9725
|
+
"$extend": "OptionalPermission",
|
|
9726
|
+
"choices": [
|
|
9727
|
+
{
|
|
9728
|
+
"type": "string",
|
|
9729
|
+
"enum": [
|
|
9730
|
+
"declarativeNetRequestFeedback"
|
|
9731
|
+
],
|
|
9732
|
+
"min_manifest_version": 3
|
|
9733
|
+
}
|
|
9734
|
+
]
|
|
9735
|
+
},
|
|
9724
9736
|
{
|
|
9725
9737
|
"$extend": "PermissionNoPrompt",
|
|
9726
9738
|
"choices": [
|
|
9727
9739
|
{
|
|
9728
9740
|
"type": "string",
|
|
9729
9741
|
"enum": [
|
|
9730
|
-
"declarativeNetRequestFeedback",
|
|
9731
9742
|
"declarativeNetRequestWithHostAccess"
|
|
9732
9743
|
],
|
|
9733
9744
|
"min_manifest_version": 3
|
|
@@ -12415,7 +12426,7 @@
|
|
|
12415
12426
|
"mainthreadio",
|
|
12416
12427
|
"fileio",
|
|
12417
12428
|
"fileioall",
|
|
12418
|
-
"
|
|
12429
|
+
"nomarkerstacks",
|
|
12419
12430
|
"screenshots",
|
|
12420
12431
|
"seqstyle",
|
|
12421
12432
|
"stackwalk",
|
|
@@ -13572,6 +13583,14 @@
|
|
|
13572
13583
|
"$ref": "ExtensionURL"
|
|
13573
13584
|
}
|
|
13574
13585
|
},
|
|
13586
|
+
"type": {
|
|
13587
|
+
"optional": true,
|
|
13588
|
+
"type": "string",
|
|
13589
|
+
"enum": [
|
|
13590
|
+
"module",
|
|
13591
|
+
"classic"
|
|
13592
|
+
]
|
|
13593
|
+
},
|
|
13575
13594
|
"persistent": {
|
|
13576
13595
|
"optional": true,
|
|
13577
13596
|
"type": "boolean",
|
|
@@ -20148,6 +20167,26 @@
|
|
|
20148
20167
|
},
|
|
20149
20168
|
"description": "list of reasons that cause the request to be considered weak, if state is \"weak\"",
|
|
20150
20169
|
"optional": true
|
|
20170
|
+
},
|
|
20171
|
+
"usedEch": {
|
|
20172
|
+
"type": "boolean",
|
|
20173
|
+
"description": "True if the TLS connection used Encrypted Client Hello.",
|
|
20174
|
+
"optional": true
|
|
20175
|
+
},
|
|
20176
|
+
"usedDelegatedCredentials": {
|
|
20177
|
+
"type": "boolean",
|
|
20178
|
+
"description": "True if the TLS connection used Delegated Credentials.",
|
|
20179
|
+
"optional": true
|
|
20180
|
+
},
|
|
20181
|
+
"usedOcsp": {
|
|
20182
|
+
"type": "boolean",
|
|
20183
|
+
"description": "True if the TLS connection made OCSP requests.",
|
|
20184
|
+
"optional": true
|
|
20185
|
+
},
|
|
20186
|
+
"usedPrivateDns": {
|
|
20187
|
+
"type": "boolean",
|
|
20188
|
+
"description": "True if the TLS connection used a privacy-preserving DNS transport like DNS-over-HTTPS.",
|
|
20189
|
+
"optional": true
|
|
20151
20190
|
}
|
|
20152
20191
|
}
|
|
20153
20192
|
},
|
package/tsconfig.json
ADDED
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Schema } from "./modules/schema.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function throwErr(e: object): never;
|
|
2
|
+
export function logErr(e: object): boolean;
|
|
3
|
+
export function logWarn(msg: any): boolean;
|
|
4
|
+
export function logMsg(msg: any): any;
|
|
5
|
+
export function getType(o: any): string;
|
|
6
|
+
export function isObjectNotEmpty(o: any): boolean;
|
|
7
|
+
export function isString(o: any): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function convertUriToFilePath(uri: string): string | null;
|
|
2
|
+
export function getAbsPath(file: string): string | null;
|
|
3
|
+
export function getStat(file: string): object;
|
|
4
|
+
export function isDir(dir: string): boolean;
|
|
5
|
+
export function isSubDir(dir: string, baseDir: string): boolean;
|
|
6
|
+
export function isFile(file: string): boolean;
|
|
7
|
+
export function isExecutable(file: string, mask?: number): boolean;
|
|
8
|
+
export function getFileTimestamp(file: string): number;
|
|
9
|
+
export function getFileNameFromFilePath(file: string, subst?: string): string;
|
|
10
|
+
export function removeDir(dir: string, baseDir: string): void;
|
|
11
|
+
export function removeDirectory(dir: string, baseDir: string): void;
|
|
12
|
+
export function createDirectory(dir: string, mode?: number): string;
|
|
13
|
+
export function createFile(file: string, value: string | Buffer | Uint8Array, opt?: {
|
|
14
|
+
encoding?: string;
|
|
15
|
+
flag?: string;
|
|
16
|
+
mode?: number | string;
|
|
17
|
+
}): string;
|
|
18
|
+
export function readFile(file: string, opt?: {
|
|
19
|
+
encoding?: string;
|
|
20
|
+
flag?: string;
|
|
21
|
+
}): string | Buffer;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class Schema {
|
|
2
|
+
constructor(...args?: (string | object)[]);
|
|
3
|
+
_sandbox: sinon.SinonSandbox;
|
|
4
|
+
_importMap: Map<any, any>;
|
|
5
|
+
_refMap: Map<any, any>;
|
|
6
|
+
_browser: {
|
|
7
|
+
_sandbox: sinon.SinonSandbox;
|
|
8
|
+
};
|
|
9
|
+
_schema: any;
|
|
10
|
+
set channel(arg: any);
|
|
11
|
+
get channel(): any;
|
|
12
|
+
_getTargetFromNamespace(key: string): object;
|
|
13
|
+
_assignImportMap(): void;
|
|
14
|
+
_assignRefMap(): void;
|
|
15
|
+
_mockEvents(target: object, events: any[]): object;
|
|
16
|
+
_mockFunctions(target: object, funcs: any[]): object;
|
|
17
|
+
_mockProperties(target: object, props: object, namespace: string): object;
|
|
18
|
+
_mockTypes(target: object, types: any[], namespace: string): object;
|
|
19
|
+
_parseSchemaContent(): object;
|
|
20
|
+
get(name: string): any[];
|
|
21
|
+
getAll(): object;
|
|
22
|
+
list(): any[];
|
|
23
|
+
mock(): object;
|
|
24
|
+
#private;
|
|
25
|
+
}
|
|
26
|
+
import sinon from "sinon";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const ESR_VER: 102;
|
|
2
|
+
export function fetchText(url: string): string;
|
|
3
|
+
export function getChannelUrl(channel: string): string;
|
|
4
|
+
export function getSchemaData(file: string, baseUrl: string): object;
|
|
5
|
+
export function getFileList(baseUrl: string): any[];
|
|
6
|
+
export function getAllSchemaData(baseUrl: string): Promise<any[]>;
|
|
7
|
+
export function getListedSchemaData(baseUrl: string, arr: any[]): Promise<any[]>;
|
|
8
|
+
export function getMailExtSchemaData(baseUrl: string): Promise<any[]>;
|
|
9
|
+
export function createUnifiedSchema(channel: string): object;
|
|
10
|
+
export function saveSchemaFile(channel: string, info: boolean): string;
|
|
11
|
+
export function updateSchemas(cmdOpts?: object): void;
|
|
12
|
+
export function parseCommand(args: any[]): void;
|
|
13
|
+
export { commander };
|
|
14
|
+
import { program as commander } from "commander";
|