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 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.0.0",
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.0.1",
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.3",
45
- "nock": "13.2.1",
46
- "respec": "28.1.0",
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.63.0"
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
- return extractBikeshedIdl();
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
- return extractRespecIdl();
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
 
@@ -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
- let idl = spec.idl
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
  }