reffy 20.0.13 → 20.0.14
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 +3 -3
- 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
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* The crawl report merger can be used to merge a new crawl report into a
|
|
4
|
-
* reference one. This tool is typically useful to make incremental updates to a
|
|
5
|
-
* reference crawl, used as knowledge database. It replaces the crawl results of
|
|
6
|
-
* a given spec by the new results where appropriate.
|
|
7
|
-
*
|
|
8
|
-
* The crawl report merge can be called directly through:
|
|
9
|
-
*
|
|
10
|
-
* `node merge-crawl-results.js [new report] [ref report] [merged report]`
|
|
11
|
-
*
|
|
12
|
-
* where `new report` is the name of the new report to merge into `ref report`
|
|
13
|
-
* to produce the `merged report` file.
|
|
14
|
-
*
|
|
15
|
-
* @module merger
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import fs from 'node:fs';
|
|
19
|
-
import { fileURLToPath } from 'node:url';
|
|
20
|
-
import process from 'node:process';
|
|
21
|
-
import { loadJSON } from '../lib/util.js';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Compares specs for ordering by URL
|
|
26
|
-
*/
|
|
27
|
-
const byURL = (a, b) => a.url.localeCompare(b.url);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Merge given crawl results with the given reference crawl results and return
|
|
32
|
-
* the new results.
|
|
33
|
-
*
|
|
34
|
-
* @function
|
|
35
|
-
* @param {String} newCrawl The crawl results to merge
|
|
36
|
-
* @param {String} refCrawl The reference crawl results
|
|
37
|
-
* @param {Object} options Merge options. Only "matchTitle" is supported for now
|
|
38
|
-
* @return {Promise} The promise to get a new crawl results that contains the
|
|
39
|
-
* results of the merge
|
|
40
|
-
*/
|
|
41
|
-
function mergeCrawlResults(newCrawl, refCrawl, options) {
|
|
42
|
-
options = options || {};
|
|
43
|
-
|
|
44
|
-
let newResults = newCrawl.results || [];
|
|
45
|
-
let refResults = refCrawl.results || [];
|
|
46
|
-
|
|
47
|
-
let results = refResults.filter(refSpec => !newResults.some(newSpec =>
|
|
48
|
-
(refSpec.url && newSpec.url && (refSpec.url === newSpec.url)) ||
|
|
49
|
-
(refSpec.html && newSpec.html && (refSpec.html === newSpec.html)) ||
|
|
50
|
-
(refSpec.latest && newSpec.latest && (refSpec.latest === newSpec.latest)) ||
|
|
51
|
-
(refSpec.shortname && newSpec.shortname && (refSpec.shortname === newSpec.shortname)) ||
|
|
52
|
-
(refSpec.versions && newSpec.versions &&
|
|
53
|
-
refSpec.versions.some(refVersion => newSpec.versions.some(newVersion => (refVersion === newVersion)))) ||
|
|
54
|
-
(options.matchTitle && refSpec.title && newSpec.title && (refSpec.title === newSpec.title))
|
|
55
|
-
)).concat(newResults);
|
|
56
|
-
|
|
57
|
-
let crawlData = {};
|
|
58
|
-
crawlData.title = newCrawl.title || refCrawl.title || 'Reffy crawl';
|
|
59
|
-
if (newCrawl.description || refCrawl.description) {
|
|
60
|
-
crawlData.description = newCrawl.description || refCrawl.description;
|
|
61
|
-
}
|
|
62
|
-
crawlData.date = (new Date()).toJSON();
|
|
63
|
-
crawlData.stats = {};
|
|
64
|
-
crawlData.results = results;
|
|
65
|
-
crawlData.results.sort(byURL);
|
|
66
|
-
crawlData.stats = {
|
|
67
|
-
crawled: crawlData.results.length,
|
|
68
|
-
errors: crawlData.results.filter(spec => !!spec.error).length
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return Promise.resolve(crawlData);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Merge the crawl results in the first JSON file with the crawl results in the
|
|
77
|
-
* second JSON file, and create a third JSON file with the results.
|
|
78
|
-
*
|
|
79
|
-
* @function
|
|
80
|
-
* @param {String} newCrawlPath The JSON file that contains the results to merge
|
|
81
|
-
* @param {String} refCrawlPath The JSON file that contains the reference results
|
|
82
|
-
* @param {String} resPath The JSON file that will contain the result of the merge
|
|
83
|
-
* @param {Object} options Merge options. Only "matchTitle" is supported for now
|
|
84
|
-
* @return {Promise} The promise to have merged the two JSON files into one
|
|
85
|
-
*/
|
|
86
|
-
async function mergeCrawlFiles(newCrawlPath, refCrawlPath, resPath, options) {
|
|
87
|
-
options = options || {};
|
|
88
|
-
|
|
89
|
-
let newCrawl = await loadJSON(newCrawlPath);
|
|
90
|
-
let refCrawl = await loadJSON(refCrawlPath);
|
|
91
|
-
return mergeCrawlResults(newCrawl, refCrawl, options)
|
|
92
|
-
.then(filedata => new Promise((resolve, reject) =>
|
|
93
|
-
fs.writeFile(resPath, JSON.stringify(filedata, null, 2),
|
|
94
|
-
err => { if (err) return reject(err); resolve(); })))
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/**************************************************
|
|
99
|
-
Export the methods for use as module
|
|
100
|
-
**************************************************/
|
|
101
|
-
export {
|
|
102
|
-
mergeCrawlResults,
|
|
103
|
-
mergeCrawlFiles
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
/**************************************************
|
|
108
|
-
Code run if the code is run as a stand-alone module
|
|
109
|
-
**************************************************/
|
|
110
|
-
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
111
|
-
let newCrawlPath = process.argv[2];
|
|
112
|
-
let refCrawlPath = process.argv[3];
|
|
113
|
-
let resPath = process.argv[4];
|
|
114
|
-
if (!newCrawlPath || !refCrawlPath || !resPath) {
|
|
115
|
-
console.error('Command needs 3 filename parameters:');
|
|
116
|
-
console.error(' 1. the crawl results to merge into the reference crawl results');
|
|
117
|
-
console.error(' 2. the reference crawl results');
|
|
118
|
-
console.error(' 3. where to save the result of the merge');
|
|
119
|
-
process.exit(2);
|
|
120
|
-
}
|
|
121
|
-
let mergeOptions = {
|
|
122
|
-
matchTitle: true
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
console.log('Merging crawl files into: ' + resPath);
|
|
126
|
-
mergeCrawlFiles(newCrawlPath, refCrawlPath, resPath, mergeOptions)
|
|
127
|
-
.then(_ => console.log('Finished'))
|
|
128
|
-
.catch(err => {
|
|
129
|
-
console.error(err);
|
|
130
|
-
process.exit(64)
|
|
131
|
-
});
|
|
132
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* The crawl report merger can be used to merge a new crawl report into a
|
|
4
|
+
* reference one. This tool is typically useful to make incremental updates to a
|
|
5
|
+
* reference crawl, used as knowledge database. It replaces the crawl results of
|
|
6
|
+
* a given spec by the new results where appropriate.
|
|
7
|
+
*
|
|
8
|
+
* The crawl report merge can be called directly through:
|
|
9
|
+
*
|
|
10
|
+
* `node merge-crawl-results.js [new report] [ref report] [merged report]`
|
|
11
|
+
*
|
|
12
|
+
* where `new report` is the name of the new report to merge into `ref report`
|
|
13
|
+
* to produce the `merged report` file.
|
|
14
|
+
*
|
|
15
|
+
* @module merger
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import fs from 'node:fs';
|
|
19
|
+
import { fileURLToPath } from 'node:url';
|
|
20
|
+
import process from 'node:process';
|
|
21
|
+
import { loadJSON } from '../lib/util.js';
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Compares specs for ordering by URL
|
|
26
|
+
*/
|
|
27
|
+
const byURL = (a, b) => a.url.localeCompare(b.url);
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Merge given crawl results with the given reference crawl results and return
|
|
32
|
+
* the new results.
|
|
33
|
+
*
|
|
34
|
+
* @function
|
|
35
|
+
* @param {String} newCrawl The crawl results to merge
|
|
36
|
+
* @param {String} refCrawl The reference crawl results
|
|
37
|
+
* @param {Object} options Merge options. Only "matchTitle" is supported for now
|
|
38
|
+
* @return {Promise} The promise to get a new crawl results that contains the
|
|
39
|
+
* results of the merge
|
|
40
|
+
*/
|
|
41
|
+
function mergeCrawlResults(newCrawl, refCrawl, options) {
|
|
42
|
+
options = options || {};
|
|
43
|
+
|
|
44
|
+
let newResults = newCrawl.results || [];
|
|
45
|
+
let refResults = refCrawl.results || [];
|
|
46
|
+
|
|
47
|
+
let results = refResults.filter(refSpec => !newResults.some(newSpec =>
|
|
48
|
+
(refSpec.url && newSpec.url && (refSpec.url === newSpec.url)) ||
|
|
49
|
+
(refSpec.html && newSpec.html && (refSpec.html === newSpec.html)) ||
|
|
50
|
+
(refSpec.latest && newSpec.latest && (refSpec.latest === newSpec.latest)) ||
|
|
51
|
+
(refSpec.shortname && newSpec.shortname && (refSpec.shortname === newSpec.shortname)) ||
|
|
52
|
+
(refSpec.versions && newSpec.versions &&
|
|
53
|
+
refSpec.versions.some(refVersion => newSpec.versions.some(newVersion => (refVersion === newVersion)))) ||
|
|
54
|
+
(options.matchTitle && refSpec.title && newSpec.title && (refSpec.title === newSpec.title))
|
|
55
|
+
)).concat(newResults);
|
|
56
|
+
|
|
57
|
+
let crawlData = {};
|
|
58
|
+
crawlData.title = newCrawl.title || refCrawl.title || 'Reffy crawl';
|
|
59
|
+
if (newCrawl.description || refCrawl.description) {
|
|
60
|
+
crawlData.description = newCrawl.description || refCrawl.description;
|
|
61
|
+
}
|
|
62
|
+
crawlData.date = (new Date()).toJSON();
|
|
63
|
+
crawlData.stats = {};
|
|
64
|
+
crawlData.results = results;
|
|
65
|
+
crawlData.results.sort(byURL);
|
|
66
|
+
crawlData.stats = {
|
|
67
|
+
crawled: crawlData.results.length,
|
|
68
|
+
errors: crawlData.results.filter(spec => !!spec.error).length
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return Promise.resolve(crawlData);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Merge the crawl results in the first JSON file with the crawl results in the
|
|
77
|
+
* second JSON file, and create a third JSON file with the results.
|
|
78
|
+
*
|
|
79
|
+
* @function
|
|
80
|
+
* @param {String} newCrawlPath The JSON file that contains the results to merge
|
|
81
|
+
* @param {String} refCrawlPath The JSON file that contains the reference results
|
|
82
|
+
* @param {String} resPath The JSON file that will contain the result of the merge
|
|
83
|
+
* @param {Object} options Merge options. Only "matchTitle" is supported for now
|
|
84
|
+
* @return {Promise} The promise to have merged the two JSON files into one
|
|
85
|
+
*/
|
|
86
|
+
async function mergeCrawlFiles(newCrawlPath, refCrawlPath, resPath, options) {
|
|
87
|
+
options = options || {};
|
|
88
|
+
|
|
89
|
+
let newCrawl = await loadJSON(newCrawlPath);
|
|
90
|
+
let refCrawl = await loadJSON(refCrawlPath);
|
|
91
|
+
return mergeCrawlResults(newCrawl, refCrawl, options)
|
|
92
|
+
.then(filedata => new Promise((resolve, reject) =>
|
|
93
|
+
fs.writeFile(resPath, JSON.stringify(filedata, null, 2),
|
|
94
|
+
err => { if (err) return reject(err); resolve(); })))
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
/**************************************************
|
|
99
|
+
Export the methods for use as module
|
|
100
|
+
**************************************************/
|
|
101
|
+
export {
|
|
102
|
+
mergeCrawlResults,
|
|
103
|
+
mergeCrawlFiles
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
/**************************************************
|
|
108
|
+
Code run if the code is run as a stand-alone module
|
|
109
|
+
**************************************************/
|
|
110
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
111
|
+
let newCrawlPath = process.argv[2];
|
|
112
|
+
let refCrawlPath = process.argv[3];
|
|
113
|
+
let resPath = process.argv[4];
|
|
114
|
+
if (!newCrawlPath || !refCrawlPath || !resPath) {
|
|
115
|
+
console.error('Command needs 3 filename parameters:');
|
|
116
|
+
console.error(' 1. the crawl results to merge into the reference crawl results');
|
|
117
|
+
console.error(' 2. the reference crawl results');
|
|
118
|
+
console.error(' 3. where to save the result of the merge');
|
|
119
|
+
process.exit(2);
|
|
120
|
+
}
|
|
121
|
+
let mergeOptions = {
|
|
122
|
+
matchTitle: true
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
console.log('Merging crawl files into: ' + resPath);
|
|
126
|
+
mergeCrawlFiles(newCrawlPath, refCrawlPath, resPath, mergeOptions)
|
|
127
|
+
.then(_ => console.log('Finished'))
|
|
128
|
+
.catch(err => {
|
|
129
|
+
console.error(err);
|
|
130
|
+
process.exit(64)
|
|
131
|
+
});
|
|
132
|
+
}
|