reffy 10.0.2 → 10.0.4

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": "10.0.2",
3
+ "version": "10.0.4",
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",
@@ -34,9 +34,9 @@
34
34
  "abortcontroller-polyfill": "1.7.3",
35
35
  "commander": "9.4.0",
36
36
  "fetch-filecache-for-crawling": "4.1.0",
37
- "puppeteer": "17.1.3",
37
+ "puppeteer": "18.0.5",
38
38
  "semver": "^7.3.5",
39
- "web-specs": "2.24.0",
39
+ "web-specs": "2.25.0",
40
40
  "webidl2": "24.2.2"
41
41
  },
42
42
  "devDependencies": {
@@ -45,7 +45,7 @@
45
45
  "nock": "13.2.9",
46
46
  "respec": "32.2.4",
47
47
  "respec-hljs": "2.1.1",
48
- "rollup": "2.79.0"
48
+ "rollup": "2.79.1"
49
49
  },
50
50
  "scripts": {
51
51
  "test": "mocha --recursive tests/"
@@ -13,6 +13,7 @@ export default function (spec, idToHeading) {
13
13
  const headingLevel = headingNumber ? headingNumber.split(".").length : undefined;
14
14
  return {
15
15
  id: n.parentNode.id,
16
+ href: getAbsoluteUrl(n.parentNode, { singlePage }),
16
17
  title: n.textContent.replace(headingNumber, '').trim(),
17
18
  level: headingLevel,
18
19
  number: headingNumber
@@ -101,7 +101,10 @@ function parseReferences(referenceList, options) {
101
101
  if (!desc || !ref.name) {
102
102
  return;
103
103
  }
104
- ref.url = desc.querySelector('a[href^="http"]')?.href ?? "";
104
+ const url = desc.querySelector('a[href*="://"]')?.href;
105
+ if (url) {
106
+ ref.url = url;
107
+ }
105
108
  if (options.filterInformative &&
106
109
  desc.textContent.match(/non-normative/i)) {
107
110
  return informativeRef.push(ref);
@@ -16,6 +16,9 @@ export default function (node, { singlePage, attribute } =
16
16
  const page = singlePage ? null :
17
17
  node.closest('[data-reffy-page]')?.getAttribute('data-reffy-page');
18
18
  const url = new URL(page ?? window.location.href);
19
- url.hash = '#' + node.getAttribute(attribute);
19
+ const hashid = node.getAttribute(attribute);
20
+ if (hashid) {
21
+ url.hash = '#' + hashid;
22
+ }
20
23
  return url.toString();
21
24
  }
@@ -79,11 +79,13 @@ export default function () {
79
79
  const match = trimmedText.match(reNumber);
80
80
  const number = match ? match[1] : null;
81
81
 
82
- mappingTable[nodeid] = {
83
- id,
84
- href,
85
- title: trimmedText.replace(reNumber, '').trim().replace(/\s+/g, ' ')
86
- };
82
+ const mapping = {};
83
+ if (id) {
84
+ mapping.id = id;
85
+ }
86
+ mapping.href = href;
87
+ mapping.title = trimmedText.replace(reNumber, '').trim().replace(/\s+/g, ' ');
88
+ mappingTable[nodeid] = mapping;
87
89
 
88
90
  if (number) {
89
91
  // Store the number without the final "."
@@ -120,11 +122,13 @@ function esMapIdToHeadings() {
120
122
  const match = trimmedText.match(reNumber);
121
123
  const number = match ? match[1] : null;
122
124
 
123
- mappingTable[nodeid] = {
124
- id: section.id,
125
- href,
126
- title: trimmedText.replace(reNumber, '').trim().replace(/\s+/g, ' ')
127
- };
125
+ const mapping = {};
126
+ if (section.id) {
127
+ mapping.id = section.id;
128
+ }
129
+ mapping.href = href;
130
+ mapping.title = trimmedText.replace(reNumber, '').trim().replace(/\s+/g, ' ');
131
+ mappingTable[nodeid] = mapping;
128
132
 
129
133
  if (number) {
130
134
  // Store the number without the final "."
@@ -362,6 +362,7 @@ function parseType(idltype, idlReport, contextName) {
362
362
  "short", "unsigned short",
363
363
  "long", "unsigned long", "long long", "unsigned long long",
364
364
  "float", "unrestricted float", "double", "unrestricted double",
365
+ "bigint",
365
366
  "DOMString", "ByteString", "USVString",
366
367
  "object"
367
368
  ];
@@ -249,6 +249,14 @@ function dependsOn(mod) {
249
249
  return mod.dependsOn;
250
250
  }
251
251
 
252
+ /**
253
+ * Return the name of the property that will be set in the spec crawl result
254
+ * when the post-processing module runs, if any
255
+ */
256
+ function getProperty(mod) {
257
+ mod = getModule(mod);
258
+ return mod.property ?? mod.name;
259
+ }
252
260
 
253
261
  function appliesAtLevel(mod, level) {
254
262
  mod = getModule(mod);
@@ -266,5 +274,6 @@ module.exports = {
266
274
  run, save,
267
275
  extractsPerSeries,
268
276
  dependsOn,
277
+ getProperty,
269
278
  appliesAtLevel
270
279
  };
@@ -130,7 +130,7 @@ async function crawlSpec(spec, crawlOptions) {
130
130
  }
131
131
  });
132
132
  crawlOptions.post?.forEach(mod => {
133
- const prop = mod.property ?? mod.name;
133
+ const prop = postProcessor.getProperty(mod);
134
134
  if (postProcessor.appliesAtLevel(mod, 'spec') && result[prop]) {
135
135
  spec[prop] = result[prop];
136
136
  }