reffy 20.0.13 → 20.0.15
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/LICENSE +21 -21
- package/README.md +151 -151
- package/index.js +29 -29
- package/package.json +5 -5
- package/reffy.js +324 -324
- package/schemas/browserlib/extract-algorithms.json +52 -52
- package/schemas/browserlib/extract-cssdfn.json +108 -108
- package/schemas/browserlib/extract-dfns.json +90 -90
- package/schemas/browserlib/extract-elements.json +17 -17
- package/schemas/browserlib/extract-events.json +31 -31
- package/schemas/browserlib/extract-headings.json +19 -19
- package/schemas/browserlib/extract-ids.json +7 -7
- package/schemas/browserlib/extract-links.json +12 -12
- package/schemas/browserlib/extract-refs.json +12 -12
- package/schemas/common.json +876 -876
- package/schemas/files/extracts/algorithms.json +12 -12
- package/schemas/files/extracts/css.json +16 -16
- package/schemas/files/extracts/dfns.json +12 -12
- package/schemas/files/extracts/elements.json +12 -12
- package/schemas/files/extracts/events.json +12 -12
- package/schemas/files/extracts/headings.json +12 -12
- package/schemas/files/extracts/ids.json +12 -12
- package/schemas/files/extracts/links.json +12 -12
- package/schemas/files/extracts/refs.json +12 -12
- package/schemas/files/index.json +59 -59
- package/schemas/postprocessing/events.json +50 -50
- package/schemas/postprocessing/idlnames-parsed.json +27 -27
- package/schemas/postprocessing/idlnames.json +17 -17
- package/schemas/postprocessing/idlparsed.json +67 -67
- package/src/browserlib/clone-and-clean.mjs +24 -24
- package/src/browserlib/create-outline.mjs +353 -353
- package/src/browserlib/extract-algorithms.mjs +723 -723
- package/src/browserlib/extract-cddl.mjs +125 -125
- package/src/browserlib/extract-dfns.mjs +1093 -1093
- package/src/browserlib/extract-headings.mjs +76 -76
- package/src/browserlib/extract-ids.mjs +28 -28
- package/src/browserlib/extract-links.mjs +45 -45
- package/src/browserlib/extract-references.mjs +308 -308
- package/src/browserlib/extract-webidl.mjs +89 -89
- package/src/browserlib/get-absolute-url.mjs +29 -29
- package/src/browserlib/get-code-elements.mjs +20 -20
- package/src/browserlib/get-generator.mjs +26 -26
- package/src/browserlib/get-lastmodified-date.mjs +13 -13
- package/src/browserlib/get-revision.mjs +12 -12
- package/src/browserlib/get-title.mjs +14 -14
- package/src/browserlib/informative-selector.mjs +24 -24
- package/src/browserlib/map-ids-to-headings.mjs +173 -173
- package/src/browserlib/reffy.json +85 -85
- package/src/browserlib/trim-spaces.mjs +35 -35
- package/src/cli/check-missing-dfns.js +587 -587
- package/src/cli/merge-crawl-results.js +132 -132
- package/src/cli/parse-webidl.js +447 -447
- package/src/lib/css-grammar-parse-tree.schema.json +109 -109
- package/src/lib/css-grammar-parser.js +440 -440
- package/src/lib/fetch.js +51 -51
- package/src/lib/markdown-report.js +360 -360
- package/src/lib/mock-server.js +218 -218
- package/src/lib/post-processor.js +322 -322
- package/src/lib/throttled-queue.js +129 -129
- package/src/postprocessing/annotate-links.js +41 -41
- package/src/postprocessing/csscomplete.js +48 -48
- package/src/postprocessing/idlnames.js +391 -391
- package/src/postprocessing/idlparsed.js +179 -179
- package/src/postprocessing/patch-dfns.js +51 -51
- package/src/specs/missing-css-rules.json +197 -197
- package/src/specs/spec-equivalents.json +149 -149
- package/src/browserlib/extract-editors.mjs~ +0 -14
- package/src/browserlib/extract-events.mjs~ +0 -3
- package/src/browserlib/generate-es-dfn-report.sh~ +0 -4
- package/src/browserlib/get-revision.mjs~ +0 -7
- package/src/cli/csstree-grammar-check.js +0 -28
- package/src/cli/csstree-grammar-check.js~ +0 -10
- package/src/cli/csstree-grammar-parser.js +0 -11
- package/src/cli/csstree-grammar-parser.js~ +0 -1
- package/src/cli/extract-editors.js~ +0 -38
- package/src/cli/process-specs.js~ +0 -28
- package/src/postprocessing/annotate-links.js~ +0 -8
- package/src/postprocessing/events.js~ +0 -245
package/src/lib/fetch.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wrapper around the fetch module to setup a few config parameters from
|
|
3
|
-
* config.json
|
|
4
|
-
*
|
|
5
|
-
* @module finder
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import os from 'node:os';
|
|
9
|
-
import path from 'node:path';
|
|
10
|
-
import baseFetch from 'fetch-filecache-for-crawling';
|
|
11
|
-
import { loadJSON } from './util.js';
|
|
12
|
-
|
|
13
|
-
// Read configuration parameters from `config.json` file
|
|
14
|
-
let config = await loadJSON('config.json');
|
|
15
|
-
if (!config) {
|
|
16
|
-
config = {};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Fetch function that applies fetch parameters defined in `config.json`
|
|
22
|
-
* unless parameters are already set.
|
|
23
|
-
*
|
|
24
|
-
* By default, force the HTTP refresh strategy to "once", so that only one
|
|
25
|
-
* HTTP request gets sent on a given URL per crawl.
|
|
26
|
-
*
|
|
27
|
-
* @function
|
|
28
|
-
* @param {String} url URL to fetch
|
|
29
|
-
* @param {Object} options Fetch options (and options for node-fetch, and
|
|
30
|
-
* options for fetch-filecache-for-crawling)
|
|
31
|
-
* @return {Promise(Response)} Promise to get an HTTP response
|
|
32
|
-
*/
|
|
33
|
-
export default async function fetch(url, options) {
|
|
34
|
-
options = Object.assign({headers: {}}, options);
|
|
35
|
-
['cacheFolder', 'resetCache', 'cacheRefresh', 'logToConsole'].forEach(param => {
|
|
36
|
-
let fetchParam = (param === 'cacheRefresh') ? 'refresh' : param;
|
|
37
|
-
if (config[param] && !options.hasOwnProperty(fetchParam)) {
|
|
38
|
-
options[fetchParam] = config[param];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
if (!options.refresh) {
|
|
42
|
-
options.refresh = 'once';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Use cache folder in tmp folder by default
|
|
46
|
-
if (!options.cacheFolder) {
|
|
47
|
-
options.cacheFolder = path.resolve(os.tmpdir(), 'reffy-cache');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return baseFetch(url, options);
|
|
51
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper around the fetch module to setup a few config parameters from
|
|
3
|
+
* config.json
|
|
4
|
+
*
|
|
5
|
+
* @module finder
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import os from 'node:os';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import baseFetch from 'fetch-filecache-for-crawling';
|
|
11
|
+
import { loadJSON } from './util.js';
|
|
12
|
+
|
|
13
|
+
// Read configuration parameters from `config.json` file
|
|
14
|
+
let config = await loadJSON('config.json');
|
|
15
|
+
if (!config) {
|
|
16
|
+
config = {};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Fetch function that applies fetch parameters defined in `config.json`
|
|
22
|
+
* unless parameters are already set.
|
|
23
|
+
*
|
|
24
|
+
* By default, force the HTTP refresh strategy to "once", so that only one
|
|
25
|
+
* HTTP request gets sent on a given URL per crawl.
|
|
26
|
+
*
|
|
27
|
+
* @function
|
|
28
|
+
* @param {String} url URL to fetch
|
|
29
|
+
* @param {Object} options Fetch options (and options for node-fetch, and
|
|
30
|
+
* options for fetch-filecache-for-crawling)
|
|
31
|
+
* @return {Promise(Response)} Promise to get an HTTP response
|
|
32
|
+
*/
|
|
33
|
+
export default async function fetch(url, options) {
|
|
34
|
+
options = Object.assign({headers: {}}, options);
|
|
35
|
+
['cacheFolder', 'resetCache', 'cacheRefresh', 'logToConsole'].forEach(param => {
|
|
36
|
+
let fetchParam = (param === 'cacheRefresh') ? 'refresh' : param;
|
|
37
|
+
if (config[param] && !options.hasOwnProperty(fetchParam)) {
|
|
38
|
+
options[fetchParam] = config[param];
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
if (!options.refresh) {
|
|
42
|
+
options.refresh = 'once';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Use cache folder in tmp folder by default
|
|
46
|
+
if (!options.cacheFolder) {
|
|
47
|
+
options.cacheFolder = path.resolve(os.tmpdir(), 'reffy-cache');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return baseFetch(url, options);
|
|
51
|
+
}
|