webext-schema 1.5.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 CHANGED
@@ -1,19 +1,15 @@
1
1
  /**
2
2
  * index.js
3
3
  */
4
- 'use strict';
4
+
5
5
  /* api */
6
- const { Schema } = require('./modules/schema');
7
- const { logErr, throwErr } = require('./modules/common');
8
- const { parseCommand } = require('./modules/update');
9
- const process = require('process');
6
+ import { logErr, throwErr } from './modules/common.js';
7
+ import { parseCommand } from './modules/update.js';
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
- module.exports = {
18
- Schema
19
- };
package/modules/common.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * common.js
3
3
  */
4
- 'use strict';
4
+
5
5
  /* constants */
6
6
  const TYPE_FROM = 8;
7
7
  const TYPE_TO = -1;
@@ -12,7 +12,7 @@ const TYPE_TO = -1;
12
12
  * @param {!object} e - Error
13
13
  * @throws - Error
14
14
  */
15
- const throwErr = e => {
15
+ export const throwErr = e => {
16
16
  throw e;
17
17
  };
18
18
 
@@ -22,7 +22,7 @@ const throwErr = e => {
22
22
  * @param {!object} e - Error
23
23
  * @returns {boolean} - false
24
24
  */
25
- const logErr = e => {
25
+ export const logErr = e => {
26
26
  console.error(e);
27
27
  return false;
28
28
  };
@@ -33,7 +33,7 @@ const logErr = e => {
33
33
  * @param {*} msg - message
34
34
  * @returns {boolean} - false
35
35
  */
36
- const logWarn = msg => {
36
+ export const logWarn = msg => {
37
37
  msg && console.warn(msg);
38
38
  return false;
39
39
  };
@@ -44,7 +44,7 @@ const logWarn = msg => {
44
44
  * @param {*} msg - message
45
45
  * @returns {*} - message
46
46
  */
47
- const logMsg = msg => {
47
+ export const logMsg = msg => {
48
48
  msg && console.log(msg);
49
49
  return msg;
50
50
  };
@@ -55,7 +55,7 @@ const logMsg = msg => {
55
55
  * @param {*} o - object to check
56
56
  * @returns {string} - type of object
57
57
  */
58
- const getType = o =>
58
+ export const getType = o =>
59
59
  Object.prototype.toString.call(o).slice(TYPE_FROM, TYPE_TO);
60
60
 
61
61
  /**
@@ -64,7 +64,7 @@ const getType = o =>
64
64
  * @param {*} o - object to check;
65
65
  * @returns {boolean} - result
66
66
  */
67
- const isObjectNotEmpty = o => {
67
+ export const isObjectNotEmpty = o => {
68
68
  const items = /Object/i.test(getType(o)) && Object.keys(o);
69
69
  return !!(items && items.length);
70
70
  };
@@ -75,53 +75,4 @@ const isObjectNotEmpty = o => {
75
75
  * @param {*} o - object to check
76
76
  * @returns {boolean} - result
77
77
  */
78
- 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
- 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
- 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
- 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(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"')
113
- .replace(/&amp;/g, '&');
114
- };
115
-
116
- module.exports = {
117
- escapeChar,
118
- getType,
119
- isObjectNotEmpty,
120
- isString,
121
- logErr,
122
- logMsg,
123
- logWarn,
124
- stringifyPositiveInt,
125
- stripHtmlTags,
126
- throwErr
127
- };
78
+ export const isString = o => typeof o === 'string' || o instanceof String;
@@ -1,19 +1,11 @@
1
1
  /**
2
2
  * constants.js
3
3
  */
4
- 'use strict';
4
+
5
5
  /* api */
6
- const os = require('os');
6
+ import os from 'os';
7
7
 
8
8
  /* constants */
9
- const CHAR = 'utf8';
10
- const DIR_HOME = os.homedir();
11
- const INDENT = 2;
12
- const IS_BE = os.endianness() === 'BE';
13
- const IS_LE = os.endianness() === 'LE';
14
- const IS_MAC = os.platform() === 'darwin';
15
- const IS_WIN = os.platform() === 'win32';
16
-
17
- module.exports = {
18
- CHAR, DIR_HOME, INDENT, IS_BE, IS_LE, IS_MAC, IS_WIN
19
- };
9
+ export const CHAR = 'utf8';
10
+ export const INDENT = 2;
11
+ export const IS_WIN = os.platform() === 'win32';
@@ -1,16 +1,15 @@
1
1
  /**
2
2
  * file-util.js
3
3
  */
4
- 'use strict';
4
+
5
5
  /* api */
6
- const { URL, fileURLToPath } = require('url');
7
- const { getType, isString } = require('./common');
8
- const fs = require('fs');
9
- const path = require('path');
10
- const { promises: fsPromise } = fs;
6
+ import { IS_WIN } from './constant.js';
7
+ import { URL, fileURLToPath } from 'url';
8
+ import { getType, isString } from './common.js';
9
+ import fs, { promises as fsPromise } from 'fs';
10
+ import path from 'path';
11
11
 
12
12
  /* constants */
13
- const { IS_WIN } = require('./constant');
14
13
  const MASK_BIT = 0o111;
15
14
  const PERM_DIR = 0o777;
16
15
  const PERM_FILE = 0o666;
@@ -22,7 +21,7 @@ const SUBST = 'index';
22
21
  * @param {string} uri - URI
23
22
  * @returns {?string} - file path
24
23
  */
25
- const convertUriToFilePath = uri => {
24
+ export const convertUriToFilePath = uri => {
26
25
  if (!isString(uri)) {
27
26
  throw new TypeError(`Expected String but got ${getType(uri)}.`);
28
27
  }
@@ -40,7 +39,7 @@ const convertUriToFilePath = uri => {
40
39
  * @param {string} file - file path
41
40
  * @returns {?string} - absolute file path
42
41
  */
43
- const getAbsPath = file => {
42
+ export const getAbsPath = file => {
44
43
  if (!isString(file)) {
45
44
  throw new TypeError(`Expected String but got ${getType(file)}.`);
46
45
  }
@@ -54,7 +53,7 @@ const getAbsPath = file => {
54
53
  * @param {string} file - file path
55
54
  * @returns {object} - file stat
56
55
  */
57
- const getStat = file =>
56
+ export const getStat = file =>
58
57
  isString(file) && fs.existsSync(file) ? fs.statSync(file) : null;
59
58
 
60
59
  /**
@@ -63,7 +62,7 @@ const getStat = file =>
63
62
  * @param {string} dir - directory path
64
63
  * @returns {boolean} - result
65
64
  */
66
- const isDir = dir => {
65
+ export const isDir = dir => {
67
66
  const stat = getStat(dir);
68
67
  return stat ? stat.isDirectory() : false;
69
68
  };
@@ -75,7 +74,7 @@ const isDir = dir => {
75
74
  * @param {string} baseDir - base directory path
76
75
  * @returns {boolean} - result
77
76
  */
78
- const isSubDir = (dir, baseDir) =>
77
+ export const isSubDir = (dir, baseDir) =>
79
78
  isDir(dir) && isDir(baseDir) && dir.startsWith(baseDir);
80
79
 
81
80
  /**
@@ -84,7 +83,7 @@ const isSubDir = (dir, baseDir) =>
84
83
  * @param {string} file - file path
85
84
  * @returns {boolean} - result
86
85
  */
87
- const isFile = file => {
86
+ export const isFile = file => {
88
87
  const stat = getStat(file);
89
88
  return stat ? stat.isFile() : false;
90
89
  };
@@ -98,7 +97,7 @@ const isFile = file => {
98
97
  * @param {number} [mask] - mask bit
99
98
  * @returns {boolean} - result
100
99
  */
101
- const isExecutable = (file, mask = MASK_BIT) => {
100
+ export const isExecutable = (file, mask = MASK_BIT) => {
102
101
  let res;
103
102
  const stat = getStat(file);
104
103
  if (stat) {
@@ -114,7 +113,7 @@ const isExecutable = (file, mask = MASK_BIT) => {
114
113
  * @param {string} file - file path
115
114
  * @returns {number} - timestamp
116
115
  */
117
- const getFileTimestamp = file => {
116
+ export const getFileTimestamp = file => {
118
117
  const stat = getStat(file);
119
118
  return stat ? stat.mtime.getTime() : 0;
120
119
  };
@@ -126,7 +125,7 @@ const getFileTimestamp = file => {
126
125
  * @param {string} [subst] - substitute file name
127
126
  * @returns {string} - file name
128
127
  */
129
- const getFileNameFromFilePath = (file, subst = SUBST) => {
128
+ export const getFileNameFromFilePath = (file, subst = SUBST) => {
130
129
  let name;
131
130
  if (isString(file) && isFile(file) &&
132
131
  /^([^.]+)(?:\..+)?$/.test(path.basename(file))) {
@@ -142,7 +141,7 @@ const getFileNameFromFilePath = (file, subst = SUBST) => {
142
141
  * @param {string} baseDir - base directory path
143
142
  * @returns {void}
144
143
  */
145
- const removeDir = (dir, baseDir) => {
144
+ export const removeDir = (dir, baseDir) => {
146
145
  if (isDir(dir)) {
147
146
  if (!isSubDir(dir, baseDir)) {
148
147
  throw new Error(`${dir} is not a subdirectory of ${baseDir}.`);
@@ -167,7 +166,7 @@ const removeDir = (dir, baseDir) => {
167
166
  * @param {string} baseDir - base directory path
168
167
  * @returns {void}
169
168
  */
170
- const removeDirectory = async (dir, baseDir) => {
169
+ export const removeDirectory = async (dir, baseDir) => {
171
170
  await removeDir(dir, baseDir);
172
171
  };
173
172
 
@@ -178,7 +177,7 @@ const removeDirectory = async (dir, baseDir) => {
178
177
  * @param {number} [mode] - permission
179
178
  * @returns {string} - directory path
180
179
  */
181
- const createDirectory = async (dir, mode = PERM_DIR) => {
180
+ export const createDirectory = async (dir, mode = PERM_DIR) => {
182
181
  if (!isString(dir)) {
183
182
  throw new TypeError(`Expected String but got ${getType(dir)}.`);
184
183
  }
@@ -205,7 +204,7 @@ const createDirectory = async (dir, mode = PERM_DIR) => {
205
204
  * @param {number|string} [opt.mode] - file permission
206
205
  * @returns {string} - file path
207
206
  */
208
- const createFile = async (file, value, opt = {
207
+ export const createFile = async (file, value, opt = {
209
208
  encoding: null, flag: 'w', mode: PERM_FILE
210
209
  }) => {
211
210
  if (!isString(file)) {
@@ -231,27 +230,10 @@ const createFile = async (file, value, opt = {
231
230
  * @param {string} [opt.flag] - flag
232
231
  * @returns {string|Buffer} - file content
233
232
  */
234
- const readFile = async (file, opt = { encoding: null, flag: 'r' }) => {
233
+ export const readFile = async (file, opt = { encoding: null, flag: 'r' }) => {
235
234
  if (!isFile(file)) {
236
235
  throw new Error(`${file} is not a file.`);
237
236
  }
238
237
  const value = await fsPromise.readFile(file, opt);
239
238
  return value;
240
239
  };
241
-
242
- module.exports = {
243
- convertUriToFilePath,
244
- createDirectory,
245
- createFile,
246
- getAbsPath,
247
- getFileNameFromFilePath,
248
- getFileTimestamp,
249
- getStat,
250
- isDir,
251
- isExecutable,
252
- isFile,
253
- isSubDir,
254
- removeDir,
255
- removeDirectory,
256
- readFile
257
- };
package/modules/schema.js CHANGED
@@ -1,19 +1,18 @@
1
1
  /**
2
2
  * schema.js
3
3
  */
4
- 'use strict';
5
- /* api */
6
- const { getType, isObjectNotEmpty, isString } = require('./common');
7
- const camelize = require('camelize');
8
- const decamelize = require('decamelize');
9
- const fs = require('fs');
10
- const path = require('path');
11
- const sinon = require('sinon');
12
4
 
13
- /* constants */
14
- const { CHAR } = require('./constant');
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
+ import fs from 'fs';
12
+ import path from 'path';
13
+ import sinon from 'sinon';
15
14
 
16
- class Schema {
15
+ export class Schema {
17
16
  /**
18
17
  * construct
19
18
  *
@@ -267,9 +266,8 @@ class Schema {
267
266
  */
268
267
  _parseSchemaContent() {
269
268
  const fileName = this._channel === 'mail' ? 'mailext.json' : 'webext.json';
270
- const file = path.resolve(
271
- path.join(__dirname, '../', 'schemas', this._channel, fileName)
272
- );
269
+ const dirName = path.dirname(convertUriToFilePath(import.meta.url));
270
+ const file = path.join(dirName, '../', 'schemas', this._channel, fileName);
273
271
  const content = fs.readFileSync(file, {
274
272
  encoding: CHAR,
275
273
  flag: 'r'
@@ -379,7 +377,3 @@ class Schema {
379
377
  return this._browser;
380
378
  }
381
379
  }
382
-
383
- module.exports = {
384
- Schema
385
- };
package/modules/update.js CHANGED
@@ -1,23 +1,22 @@
1
1
  /**
2
2
  * update.js
3
3
  */
4
- 'use strict';
4
+
5
5
  /* api */
6
- const { URL } = require('url');
7
- const JSON5 = require('json5');
8
- const { createFile } = require('./file-util');
9
- const { getType, isString, throwErr } = require('./common');
10
- const { version } = require('../package.json');
11
- const commander = require('commander');
12
- const fetch = require('node-fetch');
13
- const path = require('path');
14
- const process = require('process');
6
+ import { CHAR, INDENT } from './constant.js';
7
+ import { URL } from 'url';
8
+ import JSON5 from 'json5';
9
+ import { createFile } from './file-util.js';
10
+ import { getType, isString, throwErr } from './common.js';
11
+ import commander from 'commander';
12
+ import fetch from 'node-fetch';
13
+ import path from 'path';
14
+ import process from 'process';
15
15
 
16
16
  /* constants */
17
- const { CHAR, INDENT } = require('./constant');
18
17
  const DIR_CWD = process.cwd();
19
18
  const PERM_FILE = 0o644;
20
- const ESR_VER = 91;
19
+ export const ESR_VER = 91;
21
20
 
22
21
  /**
23
22
  * fetch text
@@ -25,7 +24,7 @@ const ESR_VER = 91;
25
24
  * @param {string} url - URL
26
25
  * @returns {string} - content text
27
26
  */
28
- const fetchText = async url => {
27
+ export const fetchText = async url => {
29
28
  if (!isString(url)) {
30
29
  throw new TypeError(`Expected String but got ${getType(url)}.`);
31
30
  }
@@ -44,7 +43,7 @@ const fetchText = async url => {
44
43
  * @param {string} channel - release channel
45
44
  * @returns {string} - channel URL
46
45
  */
47
- const getChannelUrl = channel => {
46
+ export const getChannelUrl = channel => {
48
47
  let dir;
49
48
  switch (channel) {
50
49
  case 'central':
@@ -72,7 +71,7 @@ const getChannelUrl = channel => {
72
71
  * @param {string} baseUrl - base URL
73
72
  * @returns {object} - schema data
74
73
  */
75
- const getSchemaData = async (file, baseUrl) => {
74
+ export const getSchemaData = async (file, baseUrl) => {
76
75
  if (!isString(file)) {
77
76
  throw new TypeError(`Expected String but got ${getType(file)}.`);
78
77
  }
@@ -93,7 +92,7 @@ const getSchemaData = async (file, baseUrl) => {
93
92
  * @param {string} baseUrl - base URL
94
93
  * @returns {Array} - schema file list
95
94
  */
96
- const getFileList = async baseUrl => {
95
+ export const getFileList = async baseUrl => {
97
96
  if (!isString(baseUrl)) {
98
97
  throw new TypeError(`Expected String but got ${getType(baseUrl)}.`);
99
98
  }
@@ -119,7 +118,7 @@ const getFileList = async baseUrl => {
119
118
  * @param {string} baseUrl - base URL
120
119
  * @returns {Promise.<Array>} - schemas data in array
121
120
  */
122
- const getAllSchemaData = async baseUrl => {
121
+ export const getAllSchemaData = async baseUrl => {
123
122
  if (!isString(baseUrl)) {
124
123
  throw new TypeError(`Expected String but got ${getType(baseUrl)}.`);
125
124
  }
@@ -138,7 +137,7 @@ const getAllSchemaData = async baseUrl => {
138
137
  * @param {Array} arr - array of schema file names
139
138
  * @returns {Promise.<Array>} - schema data in array
140
139
  */
141
- const getListedSchemaData = async (baseUrl, arr) => {
140
+ export const getListedSchemaData = async (baseUrl, arr) => {
142
141
  if (!isString(baseUrl)) {
143
142
  throw new TypeError(`Expected String but got ${getType(baseUrl)}.`);
144
143
  }
@@ -158,7 +157,7 @@ const getListedSchemaData = async (baseUrl, arr) => {
158
157
  * @param {string} baseUrl - base URL
159
158
  * @returns {Promise.<Array>} - results of each handler
160
159
  */
161
- const getMailExtSchemaData = async baseUrl => {
160
+ export const getMailExtSchemaData = async baseUrl => {
162
161
  if (!isString(baseUrl)) {
163
162
  throw new TypeError(`Expected String but got ${getType(baseUrl)}.`);
164
163
  }
@@ -183,7 +182,7 @@ const getMailExtSchemaData = async baseUrl => {
183
182
  * @param {string} channel - release channel
184
183
  * @returns {object} - schema
185
184
  */
186
- const createUnifiedSchema = async channel => {
185
+ export const createUnifiedSchema = async channel => {
187
186
  const channelUrl = getChannelUrl(channel);
188
187
  const schema = {};
189
188
  let arr;
@@ -227,7 +226,7 @@ const createUnifiedSchema = async channel => {
227
226
  * @param {boolean} info - console info
228
227
  * @returns {string} - file path
229
228
  */
230
- const saveSchemaFile = async (channel, info) => {
229
+ export const saveSchemaFile = async (channel, info) => {
231
230
  if (!isString(channel)) {
232
231
  throw new TypeError(`Expected String but got ${getType(channel)}.`);
233
232
  }
@@ -235,7 +234,7 @@ const saveSchemaFile = async (channel, info) => {
235
234
  const content = `${JSON.stringify(schema, null, INDENT)}\n`;
236
235
  const fileName = channel === 'mail' ? 'mailext' : 'webext';
237
236
  const filePath =
238
- path.resolve(path.join(DIR_CWD, 'schemas', channel, `${fileName}.json`));
237
+ path.resolve(DIR_CWD, 'schemas', channel, `${fileName}.json`);
239
238
  const file = await createFile(filePath, content, {
240
239
  encoding: CHAR, flag: 'w', mode: PERM_FILE
241
240
  });
@@ -251,7 +250,7 @@ const saveSchemaFile = async (channel, info) => {
251
250
  * @param {object} cmdOpts - command options
252
251
  * @returns {Promise.<Array|Error>} - promise chain
253
252
  */
254
- const updateSchemas = (cmdOpts = {}) => {
253
+ export const updateSchemas = (cmdOpts = {}) => {
255
254
  const { channel, info } = cmdOpts;
256
255
  const func = [];
257
256
  if (channel) {
@@ -274,35 +273,19 @@ const updateSchemas = (cmdOpts = {}) => {
274
273
  * @param {Array} args - process.argv
275
274
  * @returns {void}
276
275
  */
277
- const parseCommand = args => {
276
+ export const parseCommand = args => {
278
277
  const reg = /^(?:(?:--)?help|-[h|v]|--version|u(?:pdate)?)$/;
279
278
  if (Array.isArray(args) && args.some(arg => reg.test(arg))) {
280
279
  commander.exitOverride();
281
- commander.version(version, '-v, --version');
280
+ commander.version(process.env.npm_package_version, '-v, --version');
282
281
  commander.command('update').alias('u').description('update schemas')
283
282
  .option('-c, --channel <name>', 'specify the release channel')
284
283
  .option('-i, --info', 'console info')
285
284
  .action(updateSchemas);
286
- try {
287
- commander.parse(args);
288
- } catch (e) {
289
- // fail through
290
- }
285
+ commander.parse(args);
291
286
  }
292
287
  };
293
288
 
294
- module.exports = {
295
- ESR_VER,
296
- commander,
297
- createUnifiedSchema,
298
- fetchText,
299
- getAllSchemaData,
300
- getChannelUrl,
301
- getFileList,
302
- getListedSchemaData,
303
- getMailExtSchemaData,
304
- getSchemaData,
305
- parseCommand,
306
- saveSchemaFile,
307
- updateSchemas
289
+ export {
290
+ commander
308
291
  };
package/package.json CHANGED
@@ -10,10 +10,11 @@
10
10
  },
11
11
  "license": "MPL-2.0",
12
12
  "main": "index.js",
13
+ "type": "module",
13
14
  "scripts": {
14
15
  "lint": "eslint --fix .",
15
16
  "start": "node index",
16
- "test": "nyc --reporter=text mocha test/*.test.js --exit",
17
+ "test": "c8 --reporter=text mocha test/*.test.js --exit",
17
18
  "update": "node index update -i",
18
19
  "update:beta": "node index update -c beta -i",
19
20
  "update:central": "node index update -c central -i",
@@ -23,22 +24,23 @@
23
24
  },
24
25
  "dependencies": {
25
26
  "camelize": "^1.0.0",
26
- "commander": "^8.1.0",
27
- "decamelize": "^5.0.0",
27
+ "commander": "^8.2.0",
28
+ "decamelize": "^6.0.0",
28
29
  "json5": "^2.2.0",
29
- "node-fetch": "^2.6.1",
30
+ "node-fetch": "^3.0.0",
30
31
  "sinon": "^11.1.2"
31
32
  },
32
33
  "devDependencies": {
34
+ "c8": "^7.9.0",
33
35
  "chai": "^4.3.4",
34
36
  "eslint": "^7.32.0",
35
37
  "eslint-config-standard": "^16.0.3",
36
38
  "eslint-plugin-import": "^2.24.2",
37
- "eslint-plugin-jsdoc": "^36.0.8",
39
+ "eslint-plugin-jsdoc": "^36.1.0",
38
40
  "eslint-plugin-node": "^11.1.0",
39
41
  "eslint-plugin-promise": "^5.1.0",
40
- "mocha": "^9.1.1",
41
- "nyc": "^15.1.0"
42
+ "mocha": "^9.1.2",
43
+ "nock": "^13.1.3"
42
44
  },
43
- "version": "1.5.2"
45
+ "version": "2.0.0"
44
46
  }
@@ -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 +11466,11 @@
11424
11466
  "type": "number",
11425
11467
  "optional": true,
11426
11468
  "description": "The scale of the resulting image. Defaults to <code>devicePixelRatio</code>."
11469
+ },
11470
+ "resetScrollPosition": {
11471
+ "type": "boolean",
11472
+ "optional": true,
11473
+ "description": "If true, temporarily resets the scroll position of the document to 0. Only takes effect if rect is also specified."
11427
11474
  }
11428
11475
  }
11429
11476
  },
@@ -17249,6 +17296,10 @@
17249
17296
  "$ref": "ThemeColor",
17250
17297
  "optional": true
17251
17298
  },
17299
+ "ntp_card_background": {
17300
+ "$ref": "ThemeColor",
17301
+ "optional": true
17302
+ },
17252
17303
  "ntp_text": {
17253
17304
  "$ref": "ThemeColor",
17254
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
  }
@@ -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
@@ -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
  },