reffy 13.1.2 → 14.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/package.json +6 -6
- package/reffy.js +14 -2
- package/src/lib/mock-server.js +16 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reffy",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.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",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"ajv-formats": "2.1.1",
|
|
37
37
|
"commander": "11.0.0",
|
|
38
38
|
"fetch-filecache-for-crawling": "5.0.0",
|
|
39
|
-
"puppeteer": "20.
|
|
39
|
+
"puppeteer": "20.9.0",
|
|
40
40
|
"semver": "^7.3.5",
|
|
41
|
-
"web-specs": "2.
|
|
42
|
-
"webidl2": "24.4.
|
|
41
|
+
"web-specs": "2.65.0",
|
|
42
|
+
"webidl2": "24.4.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"chai": "4.3.7",
|
|
46
46
|
"mocha": "10.2.0",
|
|
47
|
-
"respec": "34.1.
|
|
47
|
+
"respec": "34.1.6",
|
|
48
48
|
"respec-hljs": "2.1.1",
|
|
49
|
-
"rollup": "3.
|
|
49
|
+
"rollup": "3.27.0",
|
|
50
50
|
"undici": "^5.22.1"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
package/reffy.js
CHANGED
|
@@ -56,7 +56,9 @@ function parseModuleOption(input) {
|
|
|
56
56
|
|
|
57
57
|
function parseSpecOption(input) {
|
|
58
58
|
if (input === 'all') {
|
|
59
|
-
return specs
|
|
59
|
+
return specs
|
|
60
|
+
.filter(s => s.standing !== 'discontinued')
|
|
61
|
+
.map(s => s.shortname)
|
|
60
62
|
}
|
|
61
63
|
else {
|
|
62
64
|
const list = requireFromWorkingDirectory(input);
|
|
@@ -118,6 +120,9 @@ will dump ~100MB of data to the console:
|
|
|
118
120
|
if (options.spec) {
|
|
119
121
|
crawlOptions.specs = options.spec.map(parseSpecOption).flat();
|
|
120
122
|
}
|
|
123
|
+
else {
|
|
124
|
+
crawlOptions.specs = parseSpecOption('all');
|
|
125
|
+
}
|
|
121
126
|
if (options.post) {
|
|
122
127
|
crawlOptions.post = options.post.map(parsePostOption).flat();
|
|
123
128
|
}
|
|
@@ -259,7 +264,8 @@ Usage notes for some of the options:
|
|
|
259
264
|
a published version.
|
|
260
265
|
|
|
261
266
|
-s, --spec <specs...>
|
|
262
|
-
If specs to crawl are not specified, all specs in browser-specs
|
|
267
|
+
If specs to crawl are not specified, all specs in browser-specs that are not
|
|
268
|
+
identified as being discontinued get crawled:
|
|
263
269
|
https://github.com/w3c/browser-specs/
|
|
264
270
|
|
|
265
271
|
Valid spec values may be a shortname, a URL, or a relative path to a file that
|
|
@@ -273,6 +279,12 @@ Usage notes for some of the options:
|
|
|
273
279
|
crawl all specs plus one custom spec that does not exist in browser-specs:
|
|
274
280
|
$ reffy -o reports/test -s all https://example.org/myspec
|
|
275
281
|
|
|
282
|
+
When "all" is used, to force a crawl on some of the discontinued specs too,
|
|
283
|
+
include their shortname explicitly (or point to a JSON file that lists their
|
|
284
|
+
shortnames). For instance, to also crawl the discontinued DOM Level 2 Style
|
|
285
|
+
spec, run:
|
|
286
|
+
$ reffy -o reports/test -s all DOM-Level-2-Style
|
|
287
|
+
|
|
276
288
|
-t, --terse
|
|
277
289
|
This flag cannot be combined with the --output option and cannot be set if
|
|
278
290
|
more than one processing module gets run. When set, the crawler writes the
|
package/src/lib/mock-server.js
CHANGED
|
@@ -148,15 +148,23 @@ mockAgent
|
|
|
148
148
|
.get("https://www.w3.org")
|
|
149
149
|
.intercept({ method: "GET", path: "/TR/ididnotchange/" })
|
|
150
150
|
.reply(({ headers }) => {
|
|
151
|
-
// NB: the headers parameters is not an instance
|
|
152
|
-
// examples,
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
// NB: Before Node.js v18.17.0, the headers parameters is not an instance
|
|
152
|
+
// of Headers as suggested in examples, but rather an array that alternates
|
|
153
|
+
// header names and header values. Bug detailed at:
|
|
154
|
+
// https://github.com/nodejs/undici/issues/2078
|
|
155
|
+
// Bug fix was integrated in Node.js v18.17.0.
|
|
156
|
+
// Code below can be simplified when support for Node.js v18 gets dropped.
|
|
157
|
+
let value;
|
|
158
|
+
if (Array.isArray(headers)) {
|
|
159
|
+
const pos = headers.findIndex(h => h === 'If-Modified-Since');
|
|
160
|
+
if (pos === -1) {
|
|
161
|
+
return { statusCode: 200, data: 'Unexpected If-Modified-Since header' };
|
|
162
|
+
}
|
|
163
|
+
value = headers[pos+1];
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
value = headers['If-Modified-Since'];
|
|
158
167
|
}
|
|
159
|
-
const value = headers[pos+1];
|
|
160
168
|
if (value === "Fri, 11 Feb 2022 00:00:42 GMT") {
|
|
161
169
|
return { statusCode: 304 };
|
|
162
170
|
} else {
|