reffy 14.2.1 → 14.2.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reffy",
3
- "version": "14.2.1",
3
+ "version": "14.2.3",
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",
package/src/lib/util.js CHANGED
@@ -61,23 +61,16 @@ function requireFromWorkingDirectory(filename) {
61
61
 
62
62
 
63
63
  /**
64
- * Determine the path to the "node_modules" folder to resolve relative links
65
- * in the ES6 browser lib modules. The path depends on whether Reffy is run
66
- * directly, or installed as a library.
64
+ * Path to the "webidl2" folder to resolve relative links in the ES6 browser
65
+ * lib modules. The path depends on whether Reffy is run directly, or installed
66
+ * as a library.
67
67
  *
68
- * @function
69
- * @return {String} Path to the node_modules folder.
68
+ * Code relies on the "require.resolve" function, but note that, when given a
69
+ * simple module name, that function returns the path to the file targeted by
70
+ * the "main" property in "package.json" which, in the case of the webidl2
71
+ * module, is "dist/webidl2.js".
70
72
  */
71
- function getModulesFolder() {
72
- const rootFolder = path.resolve(__dirname, '../..');
73
- let folder = path.resolve(rootFolder, 'node_modules');
74
- if (existsSync(folder)) {
75
- return folder;
76
- }
77
- folder = path.resolve(rootFolder, '..');
78
- return folder;
79
- }
80
- const modulesFolder = getModulesFolder();
73
+ const webidl2Folder = path.resolve(path.dirname(require.resolve('webidl2')), '..');
81
74
 
82
75
 
83
76
  /**
@@ -381,7 +374,7 @@ async function processSpecification(spec, processFunction, args, options) {
381
374
  body = Buffer.from(browserlib);
382
375
  }
383
376
  else if (request.url.includes(webidl2Path)) {
384
- const file = path.resolve(modulesFolder, 'webidl2',
377
+ const file = path.resolve(webidl2Folder,
385
378
  request.url.substring(request.url.indexOf(webidl2Path) + webidl2Path.length));
386
379
  body = await fs.readFile(file);
387
380
  }
@@ -33,13 +33,15 @@ module.exports = {
33
33
  dfn.linkingText[0] !== 'MessageEventSource');
34
34
  }
35
35
 
36
- // The /TR version of the WebCrypto API does not follow the usual dfn data
37
- // model. Definitions get extracted as "exported" as a result. This
38
- // creates collisions. The nightly version of the API respects the dfn
39
- // data model, so let's force /TR dfns to be "non-exported" (most don't
40
- // have the right "type" in any case). Also see discussion in:
36
+ // The /TR versions of WebCrypto API, Publication Manifest and Audiobooks
37
+ // do not follow the usual dfn data model. Definitions get extracted as
38
+ // "exported" as a result. This creates collisions. The nightly versions
39
+ // of the specs respect the dfn data model and these specs don't export
40
+ // terms in practice. Also see discussion in:
41
41
  // https://github.com/w3c/reffy/issues/1250
42
- else if (spec.crawled.includes('/TR/WebCryptoAPI/')) {
42
+ else if (spec.crawled.includes('/TR/WebCryptoAPI/') ||
43
+ spec.crawled.includes('/TR/pub-manifest/') ||
44
+ spec.crawled.includes('/TR/audiobooks/')) {
43
45
  spec.dfns.forEach(dfn => dfn.access = 'private');
44
46
  }
45
47
  }