reffy 11.2.2 → 11.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reffy",
3
- "version": "11.2.2",
3
+ "version": "11.3.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",
@@ -33,22 +33,22 @@
33
33
  "bin": "./reffy.js",
34
34
  "dependencies": {
35
35
  "abortcontroller-polyfill": "1.7.5",
36
- "ajv": "8.11.2",
36
+ "ajv": "8.12.0",
37
37
  "ajv-formats": "2.1.1",
38
- "commander": "9.4.1",
38
+ "commander": "9.5.0",
39
39
  "fetch-filecache-for-crawling": "4.1.0",
40
- "puppeteer": "19.4.1",
40
+ "puppeteer": "19.5.0",
41
41
  "semver": "^7.3.5",
42
- "web-specs": "2.39.0",
42
+ "web-specs": "2.41.0",
43
43
  "webidl2": "24.2.2"
44
44
  },
45
45
  "devDependencies": {
46
46
  "chai": "4.3.7",
47
47
  "mocha": "10.2.0",
48
48
  "nock": "13.2.9",
49
- "respec": "32.6.0",
49
+ "respec": "32.6.1",
50
50
  "respec-hljs": "2.1.1",
51
- "rollup": "3.7.5"
51
+ "rollup": "3.9.1"
52
52
  },
53
53
  "scripts": {
54
54
  "test": "mocha --recursive tests/"
@@ -552,11 +552,14 @@ const getDfnName = dfn => {
552
552
  if (dfn.getAttribute('data-lt')) {
553
553
  const names = dfn.getAttribute('data-lt').split('|').map(normalize);
554
554
  let name = names.find(n =>
555
- n.startsWith('<') || // Looks like a "type"
556
- n.startsWith('@') || // Looks like an "at-rule"
557
- n.startsWith(':') || // Looks like a "descriptor"
558
- n.endsWith('()') || // Looks like a "function"
559
- n === dfn.textContent.trim()); // Looks like the right term
555
+ n.startsWith('<') || // Looks like a "type"
556
+ n.startsWith('@') || // Looks like an "at-rule"
557
+ n.startsWith(':') || // Looks like a "descriptor"
558
+ n.endsWith('()')); // Looks like a "function"
559
+ if (!name) {
560
+ // No specific type found in the list, look for the actual term
561
+ name = names.find(n => n === dfn.textContent.trim());
562
+ }
560
563
  if (!name) {
561
564
  if (names.length > 1) {
562
565
  throw new Error(`Found multiple linking texts for dfn without any obvious one: ${names.join(', ')}`);
package/src/lib/util.js CHANGED
@@ -719,7 +719,7 @@ function completeWithAlternativeUrls(spec) {
719
719
  * in the given list of specs that passes the given predicate.
720
720
  *
721
721
  * "Fullest" means "not a delta spec, unless that is the only level that passes
722
- * the predicate".
722
+ * the predicate, and not an outdated spec either (before current one)".
723
723
  *
724
724
  * @function
725
725
  * @public
@@ -736,7 +736,8 @@ function isLatestLevelThatPasses(spec, list, predicate) {
736
736
  return false;
737
737
  }
738
738
  if (spec.seriesComposition === 'delta') {
739
- while (spec.seriesPrevious) {
739
+ while (spec.seriesPrevious &&
740
+ spec.shortname !== spec.series.currentSpecification) {
740
741
  spec = list.find(s => s.shortname === spec.seriesPrevious);
741
742
  if (!spec) {
742
743
  break;
@@ -747,16 +748,32 @@ function isLatestLevelThatPasses(spec, list, predicate) {
747
748
  }
748
749
  return true;
749
750
  }
750
- while (spec.seriesNext) {
751
- spec = list.find(s => s.shortname === spec.seriesNext);
752
- if (!spec) {
751
+
752
+ let next = spec;
753
+ while (next.seriesNext) {
754
+ next = list.find(s => s.shortname === next.seriesNext);
755
+ if (!next) {
753
756
  break;
754
757
  }
755
- if ((spec.seriesComposition === 'full') && predicate(spec)) {
758
+ if ((next.seriesComposition === 'full') && predicate(next)) {
756
759
  return false;
757
760
  }
758
761
  }
759
- return true;
762
+
763
+ // Make sure that spec is the current one or is more recent than the
764
+ // current one.
765
+ while (spec) {
766
+ if (spec.shortname === spec.series.currentSpecification) {
767
+ return true;
768
+ }
769
+ if (!spec.seriesPrevious) {
770
+ return false;
771
+ }
772
+ spec = list.find(s => s.shortname === spec.seriesPrevious);
773
+ }
774
+
775
+ // Spec passes predicate but is too old to be considered
776
+ return false;
760
777
  }
761
778
 
762
779