webext-schema 5.5.5 → 5.5.7

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/modules/update.js CHANGED
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * update.js
3
3
  */
4
- /* eslint-disable no-await-in-loop */
5
4
 
6
5
  /* api */
7
6
  import path from 'node:path';
@@ -116,15 +115,15 @@ export const getAllSchemaData = async (baseUrl, info) => {
116
115
  if (!isString(baseUrl)) {
117
116
  throw new TypeError(`Expected String but got ${getType(baseUrl)}.`);
118
117
  }
119
- const schemas = [];
120
118
  const items = await getFileList(baseUrl);
119
+ const func = [];
121
120
  for (const item of items) {
122
121
  if (info) {
123
122
  console.info(`Fetching ${item}`);
124
123
  }
125
- const schema = await getSchemaData(item, baseUrl);
126
- schemas.push(schema);
124
+ func.push(getSchemaData(item, baseUrl));
127
125
  }
126
+ const schemas = await Promise.all(func);
128
127
  return schemas;
129
128
  };
130
129
 
@@ -142,14 +141,14 @@ export const getListedSchemaData = async (baseUrl, arr, info) => {
142
141
  if (!Array.isArray(arr)) {
143
142
  throw new TypeError(`Expected Array but got ${getType(arr)}.`);
144
143
  }
145
- const schemas = [];
144
+ const func = [];
146
145
  for (const item of arr) {
147
146
  if (info) {
148
147
  console.info(`Fetching ${item}`);
149
148
  }
150
- const schema = await getSchemaData(item, baseUrl);
151
- schemas.push(schema);
149
+ func.push(getSchemaData(item, baseUrl));
152
150
  }
151
+ const schemas = await Promise.all(func);
153
152
  return schemas;
154
153
  };
155
154
 
@@ -169,16 +168,16 @@ export const getMailExtSchemaData = async (baseUrl, info) => {
169
168
  'commands.json',
170
169
  'pkcs11.json'
171
170
  ];
172
- const schemas = [];
171
+ const func = [];
173
172
  for (const item of items) {
174
173
  if (!excludeFile.includes(item)) {
175
174
  if (info) {
176
175
  console.info(`Fetching ${item}`);
177
176
  }
178
- const schema = await getSchemaData(item, schemaUrl);
179
- schemas.push(schema);
177
+ func.push(getSchemaData(item, schemaUrl));
180
178
  }
181
179
  }
180
+ const schemas = await Promise.all(func);
182
181
  return schemas;
183
182
  };
184
183
 
@@ -191,35 +190,47 @@ export const getMailExtSchemaData = async (baseUrl, info) => {
191
190
  export const createUnifiedSchema = async (channel, info) => {
192
191
  const channelUrl = getChannelUrl(channel);
193
192
  const schema = {};
194
- let arr;
195
193
  if (channel === 'mail') {
196
194
  const browserItems = [
197
195
  'commands.json',
198
196
  'pkcs11.json'
199
197
  ];
198
+ const browserUrl =
199
+ `${getChannelUrl('central')}browser/components/extensions/schemas/`;
200
+ const browserSchemas =
201
+ await getListedSchemaData(browserUrl, browserItems, info);
202
+ for (const item of browserSchemas) {
203
+ const { file, schema: itemSchema } = item;
204
+ schema[file] = itemSchema;
205
+ }
200
206
  const toolkitItems = [
201
207
  'content_scripts.json', 'experiments.json', 'extension.json', 'i18n.json',
202
208
  'management.json', 'permissions.json', 'runtime.json', 'theme.json'
203
209
  ];
204
- const browserBaseUrl =
205
- `${getChannelUrl('central')}browser/components/extensions/schemas/`;
206
- const toolkitBaseUrl =
210
+ const toolkitUrl =
207
211
  `${getChannelUrl('central')}toolkit/components/extensions/schemas/`;
208
- arr = await Promise.all([
209
- getListedSchemaData(browserBaseUrl, browserItems, info),
210
- getListedSchemaData(toolkitBaseUrl, toolkitItems, info),
211
- getMailExtSchemaData(`${channelUrl}mail/components/extensions/`, info)
212
- ]);
212
+ const toolkitSchemas =
213
+ await getListedSchemaData(toolkitUrl, toolkitItems, info);
214
+ for (const item of toolkitSchemas) {
215
+ const { file, schema: itemSchema } = item;
216
+ schema[file] = itemSchema;
217
+ }
218
+ const mailUrl = `${channelUrl}mail/components/extensions/`;
219
+ const mailSchemas = await getMailExtSchemaData(mailUrl, info);
220
+ for (const item of mailSchemas) {
221
+ const { file, schema: itemSchema } = item;
222
+ schema[file] = itemSchema;
223
+ }
213
224
  } else {
214
- arr = await Promise.all([
215
- getAllSchemaData(`${channelUrl}browser/components/extensions/schemas/`,
216
- info),
217
- getAllSchemaData(`${channelUrl}toolkit/components/extensions/schemas/`,
218
- info)
219
- ]);
220
- }
221
- for (const items of arr) {
222
- for (const item of items) {
225
+ const browserUrl = `${channelUrl}browser/components/extensions/schemas/`;
226
+ const browserSchemas = await getAllSchemaData(browserUrl, info);
227
+ for (const item of browserSchemas) {
228
+ const { file, schema: itemSchema } = item;
229
+ schema[file] = itemSchema;
230
+ }
231
+ const toolkitUrl = `${channelUrl}toolkit/components/extensions/schemas/`;
232
+ const toolkitSchemas = await getAllSchemaData(toolkitUrl, info);
233
+ for (const item of toolkitSchemas) {
223
234
  const { file, schema: itemSchema } = item;
224
235
  schema[file] = itemSchema;
225
236
  }
package/package.json CHANGED
@@ -26,19 +26,19 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/firefox-webext-browser": "^120.0.4",
29
- "@types/node": "^22.14.0",
29
+ "@types/node": "^22.15.3",
30
30
  "@types/sinon": "^17.0.4",
31
31
  "c8": "^10.1.3",
32
- "eslint": "^9.24.0",
33
- "eslint-plugin-jsdoc": "^50.6.9",
32
+ "eslint": "^9.25.1",
33
+ "eslint-plugin-jsdoc": "^50.6.11",
34
34
  "eslint-plugin-regexp": "^2.7.0",
35
- "eslint-plugin-unicorn": "^58.0.0",
35
+ "eslint-plugin-unicorn": "^59.0.0",
36
36
  "globals": "^16.0.0",
37
- "mocha": "^11.1.0",
37
+ "mocha": "^11.2.2",
38
38
  "neostandard": "^0.12.1",
39
39
  "npm-run-all2": "^7.0.2",
40
40
  "typescript": "^5.8.3",
41
- "undici": "^7.7.0"
41
+ "undici": "^7.8.0"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "npm run tsc && npm run lint && npm run test",
@@ -58,5 +58,5 @@
58
58
  "update-mail": "node index update --channel=mail -i",
59
59
  "update-release": "node index update --channel=release -i"
60
60
  },
61
- "version": "5.5.5"
61
+ "version": "5.5.7"
62
62
  }