reffy 6.3.0 → 6.4.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/package.json +2 -2
- package/reffy.js +1 -1
- package/src/lib/specs-crawler.js +1 -1
- package/src/lib/util.js +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reffy",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "W3C/WHATWG spec dependencies exploration companion. Features a short set of tools to study spec references as well as WebIDL term definitions and references found in W3C specifications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"bin": "./reffy.js",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"abortcontroller-polyfill": "1.7.3",
|
|
35
|
-
"browser-specs": "2.27.0",
|
|
36
35
|
"commander": "9.0.0",
|
|
37
36
|
"fetch-filecache-for-crawling": "4.1.0",
|
|
38
37
|
"puppeteer": "13.1.3",
|
|
39
38
|
"semver": "^7.3.5",
|
|
39
|
+
"web-specs": "1.0.0",
|
|
40
40
|
"webidl2": "24.2.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
package/reffy.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
const commander = require('commander');
|
|
25
25
|
const satisfies = require('semver/functions/satisfies');
|
|
26
|
-
const specs = require('
|
|
26
|
+
const specs = require('web-specs');
|
|
27
27
|
const { version, engines } = require('./package.json');
|
|
28
28
|
const { requireFromWorkingDirectory } = require('./src/lib/util');
|
|
29
29
|
const { crawlSpecs } = require('./src/lib/specs-crawler');
|
package/src/lib/specs-crawler.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
const fs = require('fs');
|
|
14
14
|
const path = require('path');
|
|
15
|
-
const specs = require('
|
|
15
|
+
const specs = require('web-specs');
|
|
16
16
|
const cssDfnParser = require('./css-grammar-parser');
|
|
17
17
|
const { generateIdlParsed, saveIdlParsed } = require('../cli/generate-idlparsed');
|
|
18
18
|
const { generateIdlNames, saveIdlNames } = require('../cli/generate-idlnames');
|
package/src/lib/util.js
CHANGED
|
@@ -21,8 +21,6 @@ const reffyModules = require('../browserlib/reffy.json');
|
|
|
21
21
|
*/
|
|
22
22
|
const maxPathDepth = 20;
|
|
23
23
|
|
|
24
|
-
let prefetchedResponses = {};
|
|
25
|
-
|
|
26
24
|
/**
|
|
27
25
|
* Returns a range array from 0 to the number provided (not included)
|
|
28
26
|
*/
|
|
@@ -334,6 +332,7 @@ async function processSpecification(spec, processFunction, args, options) {
|
|
|
334
332
|
processFunction = processFunction || function () {};
|
|
335
333
|
args = args || [];
|
|
336
334
|
options = options || {};
|
|
335
|
+
let prefetchedResponse = {};
|
|
337
336
|
|
|
338
337
|
if (!browser) {
|
|
339
338
|
throw new Error('Browser instance not initialized, setupBrowser() must be called before processSpecification().');
|
|
@@ -410,7 +409,7 @@ async function processSpecification(spec, processFunction, args, options) {
|
|
|
410
409
|
await cdp.send('Fetch.continueRequest', { requestId });
|
|
411
410
|
return;
|
|
412
411
|
}
|
|
413
|
-
const response =
|
|
412
|
+
const response = prefetchedResponse[request.url] ?? await fetch(request.url, { signal: controller.signal, headers: request.headers });
|
|
414
413
|
|
|
415
414
|
const body = await response.buffer();
|
|
416
415
|
|
|
@@ -479,7 +478,7 @@ async function processSpecification(spec, processFunction, args, options) {
|
|
|
479
478
|
if (response.status === 304) {
|
|
480
479
|
return {status: "notmodified"};
|
|
481
480
|
}
|
|
482
|
-
|
|
481
|
+
prefetchedResponse[spec.url] = response;
|
|
483
482
|
} catch (err) {
|
|
484
483
|
throw new Error(`Loading ${spec.url} triggered network error ${err}`);
|
|
485
484
|
}
|