reffy 6.0.0 → 6.1.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/index.js +5 -1
- package/package.json +6 -6
- package/src/browserlib/extract-webidl.mjs +12 -3
- package/src/lib/specs-crawler.js +1 -5
- package/src/lib/util.js +7 -0
package/index.js
CHANGED
|
@@ -3,5 +3,9 @@ module.exports = {
|
|
|
3
3
|
crawlSpecs: require("./src/lib/specs-crawler").crawlList,
|
|
4
4
|
expandCrawlResult: require("./src/lib/util").expandCrawlResult,
|
|
5
5
|
mergeCrawlResults: require("./src/lib/util").mergeCrawlResults,
|
|
6
|
-
isLatestLevelThatPasses: require("./src/lib/util").isLatestLevelThatPasses
|
|
6
|
+
isLatestLevelThatPasses: require("./src/lib/util").isLatestLevelThatPasses,
|
|
7
|
+
generateIdlNames: require("./src/cli/generate-idlnames").generateIdlNames,
|
|
8
|
+
saveIdlNames: require("./src/cli/generate-idlnames").saveIdlNames,
|
|
9
|
+
generateIdlParsed: require("./src/cli/generate-idlparsed").generateIdlParsed,
|
|
10
|
+
saveIdlParsed: require("./src/cli/generate-idlparsed").saveIdlParsed
|
|
7
11
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reffy",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.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",
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
"browser-specs": "2.21.0",
|
|
36
36
|
"commander": "8.3.0",
|
|
37
37
|
"fetch-filecache-for-crawling": "4.0.2",
|
|
38
|
-
"puppeteer": "13.
|
|
38
|
+
"puppeteer": "13.1.1",
|
|
39
39
|
"semver": "^7.3.5",
|
|
40
40
|
"webidl2": "24.2.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"chai": "4.3.4",
|
|
44
|
-
"mocha": "9.1.
|
|
45
|
-
"nock": "13.2.
|
|
46
|
-
"respec": "28.
|
|
44
|
+
"mocha": "9.1.4",
|
|
45
|
+
"nock": "13.2.2",
|
|
46
|
+
"respec": "28.2.2",
|
|
47
47
|
"respec-hljs": "2.1.1",
|
|
48
|
-
"rollup": "2.
|
|
48
|
+
"rollup": "2.65.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"test": "mocha --recursive tests/"
|
|
@@ -11,19 +11,28 @@ import informativeSelector from './informative-selector.mjs';
|
|
|
11
11
|
*/
|
|
12
12
|
export default function () {
|
|
13
13
|
const generator = getGenerator();
|
|
14
|
+
let idl = '';
|
|
14
15
|
if (generator === 'bikeshed') {
|
|
15
|
-
|
|
16
|
+
idl = extractBikeshedIdl();
|
|
16
17
|
}
|
|
17
18
|
else if (document.title.startsWith('Web IDL')) {
|
|
18
19
|
// IDL content in the Web IDL spec are... examples,
|
|
19
20
|
// not real definitions
|
|
20
|
-
return '';
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
23
|
// Most non-ReSpec specs still follow the ReSpec conventions
|
|
24
24
|
// for IDL definitions
|
|
25
|
-
|
|
25
|
+
idl = extractRespecIdl();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (idl) {
|
|
29
|
+
// Remove trailing spaces and use spaces throughout
|
|
30
|
+
idl = idl
|
|
31
|
+
.replace(/\s+$/gm, '\n')
|
|
32
|
+
.replace(/\t/g, ' ')
|
|
33
|
+
.trim();
|
|
26
34
|
}
|
|
35
|
+
return idl;
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
|
package/src/lib/specs-crawler.js
CHANGED
|
@@ -226,11 +226,7 @@ async function saveSpecResults(spec, settings) {
|
|
|
226
226
|
// (https://github.com/w3c/webref)
|
|
227
227
|
// Source: ${spec.title} (${spec.crawled})`;
|
|
228
228
|
idlHeader = idlHeader.replace(/^\s+/gm, '').trim() + '\n\n';
|
|
229
|
-
|
|
230
|
-
.replace(/\s+$/gm, '\n')
|
|
231
|
-
.replace(/\t/g, ' ')
|
|
232
|
-
.trim();
|
|
233
|
-
idl = idlHeader + idl + '\n';
|
|
229
|
+
const idl = idlHeader + spec.idl + '\n';
|
|
234
230
|
await fs.promises.writeFile(
|
|
235
231
|
path.join(folders.idl, spec.shortname + '.idl'), idl);
|
|
236
232
|
return `idl/${spec.shortname}.idl`;
|
package/src/lib/util.js
CHANGED
|
@@ -740,6 +740,13 @@ async function expandCrawlResult(crawl, baseFolder, properties) {
|
|
|
740
740
|
const filename = path.join(baseFolder, spec[property]);
|
|
741
741
|
contents = await fs.readFile(filename, 'utf8');
|
|
742
742
|
}
|
|
743
|
+
|
|
744
|
+
// Force UNIX-style line endings
|
|
745
|
+
// (Git may auto-convert LF to CRLF on Windows machines and we
|
|
746
|
+
// want to store multiline IDL fragments as values of properties
|
|
747
|
+
// in parsed IDL trees)
|
|
748
|
+
contents = contents.replace(/\r\n/g, '\n');
|
|
749
|
+
|
|
743
750
|
if (spec[property].endsWith('.json')) {
|
|
744
751
|
contents = JSON.parse(contents);
|
|
745
752
|
}
|