reffy 20.0.13 → 20.0.14

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.
Files changed (78) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +151 -151
  3. package/index.js +29 -29
  4. package/package.json +3 -3
  5. package/reffy.js +324 -324
  6. package/schemas/browserlib/extract-algorithms.json +52 -52
  7. package/schemas/browserlib/extract-cssdfn.json +108 -108
  8. package/schemas/browserlib/extract-dfns.json +90 -90
  9. package/schemas/browserlib/extract-elements.json +17 -17
  10. package/schemas/browserlib/extract-events.json +31 -31
  11. package/schemas/browserlib/extract-headings.json +19 -19
  12. package/schemas/browserlib/extract-ids.json +7 -7
  13. package/schemas/browserlib/extract-links.json +12 -12
  14. package/schemas/browserlib/extract-refs.json +12 -12
  15. package/schemas/common.json +876 -876
  16. package/schemas/files/extracts/algorithms.json +12 -12
  17. package/schemas/files/extracts/css.json +16 -16
  18. package/schemas/files/extracts/dfns.json +12 -12
  19. package/schemas/files/extracts/elements.json +12 -12
  20. package/schemas/files/extracts/events.json +12 -12
  21. package/schemas/files/extracts/headings.json +12 -12
  22. package/schemas/files/extracts/ids.json +12 -12
  23. package/schemas/files/extracts/links.json +12 -12
  24. package/schemas/files/extracts/refs.json +12 -12
  25. package/schemas/files/index.json +59 -59
  26. package/schemas/postprocessing/events.json +50 -50
  27. package/schemas/postprocessing/idlnames-parsed.json +27 -27
  28. package/schemas/postprocessing/idlnames.json +17 -17
  29. package/schemas/postprocessing/idlparsed.json +67 -67
  30. package/src/browserlib/clone-and-clean.mjs +24 -24
  31. package/src/browserlib/create-outline.mjs +353 -353
  32. package/src/browserlib/extract-algorithms.mjs +723 -723
  33. package/src/browserlib/extract-cddl.mjs +125 -125
  34. package/src/browserlib/extract-dfns.mjs +1093 -1093
  35. package/src/browserlib/extract-headings.mjs +76 -76
  36. package/src/browserlib/extract-ids.mjs +28 -28
  37. package/src/browserlib/extract-links.mjs +45 -45
  38. package/src/browserlib/extract-references.mjs +308 -308
  39. package/src/browserlib/extract-webidl.mjs +89 -89
  40. package/src/browserlib/get-absolute-url.mjs +29 -29
  41. package/src/browserlib/get-code-elements.mjs +20 -20
  42. package/src/browserlib/get-generator.mjs +26 -26
  43. package/src/browserlib/get-lastmodified-date.mjs +13 -13
  44. package/src/browserlib/get-revision.mjs +12 -12
  45. package/src/browserlib/get-title.mjs +14 -14
  46. package/src/browserlib/informative-selector.mjs +24 -24
  47. package/src/browserlib/map-ids-to-headings.mjs +173 -173
  48. package/src/browserlib/reffy.json +85 -85
  49. package/src/browserlib/trim-spaces.mjs +35 -35
  50. package/src/cli/check-missing-dfns.js +587 -587
  51. package/src/cli/merge-crawl-results.js +132 -132
  52. package/src/cli/parse-webidl.js +447 -447
  53. package/src/lib/css-grammar-parse-tree.schema.json +109 -109
  54. package/src/lib/css-grammar-parser.js +440 -440
  55. package/src/lib/fetch.js +51 -51
  56. package/src/lib/markdown-report.js +360 -360
  57. package/src/lib/mock-server.js +218 -218
  58. package/src/lib/post-processor.js +322 -322
  59. package/src/lib/throttled-queue.js +129 -129
  60. package/src/postprocessing/annotate-links.js +41 -41
  61. package/src/postprocessing/csscomplete.js +48 -48
  62. package/src/postprocessing/idlnames.js +391 -391
  63. package/src/postprocessing/idlparsed.js +179 -179
  64. package/src/postprocessing/patch-dfns.js +51 -51
  65. package/src/specs/missing-css-rules.json +197 -197
  66. package/src/specs/spec-equivalents.json +149 -149
  67. package/src/browserlib/extract-editors.mjs~ +0 -14
  68. package/src/browserlib/extract-events.mjs~ +0 -3
  69. package/src/browserlib/generate-es-dfn-report.sh~ +0 -4
  70. package/src/browserlib/get-revision.mjs~ +0 -7
  71. package/src/cli/csstree-grammar-check.js +0 -28
  72. package/src/cli/csstree-grammar-check.js~ +0 -10
  73. package/src/cli/csstree-grammar-parser.js +0 -11
  74. package/src/cli/csstree-grammar-parser.js~ +0 -1
  75. package/src/cli/extract-editors.js~ +0 -38
  76. package/src/cli/process-specs.js~ +0 -28
  77. package/src/postprocessing/annotate-links.js~ +0 -8
  78. package/src/postprocessing/events.js~ +0 -245
@@ -1,125 +1,125 @@
1
- import getCodeElements from './get-code-elements.mjs';
2
- import trimSpaces from './trim-spaces.mjs';
3
-
4
- /**
5
- * Extract the list of CDDL definitions in the current spec.
6
- *
7
- * A spec may define more that one CDDL module. For example, the WebDriver BiDi
8
- * spec has CDDL definitions that apply to either of both the local end and the
9
- * remote end. The functions returns an array that lists all CDDL modules.
10
- *
11
- * Each CDDL module is represented as an object with the following keys whose
12
- * values are strings:
13
- * - shortname: the CDDL module shortname. Shortname is "" if the spec does not
14
- * define any module, and "all" for the dump of all CDDL definitions.
15
- * - label: A full name for the CDDL module, when defined.
16
- * - cddl: A dump of the CDDL definitions.
17
- *
18
- * If the spec defines more than one module, the first item in the array is the
19
- * "all" module that contains a dump of all CDDL definitions, regardless of the
20
- * module they are actually defined for (the assumption is that looking at the
21
- * union of all CDDL modules defined in a spec will always make sense, and that
22
- * a spec will never reuse the same rule name with a different definition for
23
- * different CDDL modules).
24
- *
25
- * @function
26
- * @public
27
- * @return {Array} A dump of the CDDL definitions per CDDL module, or an empty
28
- * array if the spec does not contain any CDDL.
29
- */
30
- export default function () {
31
- // Specs with CDDL are either recent enough that they all use the same
32
- // `<pre class="cddl">` convention, or they don't flag CDDL blocks in any
33
- // way, making it impossible to extract them.
34
- const cddlSelectors = ['pre.cddl:not(.exclude):not(.extract)'];
35
- const excludeSelectors = ['#cddl-index'];
36
-
37
- // Retrieve all elements that contains CDDL content
38
- const cddlEls = getCodeElements(cddlSelectors, { excludeSelectors });
39
-
40
- // Start by assembling the list of modules
41
- const modules = {};
42
- for (const el of cddlEls) {
43
- const elModules = getModules(el);
44
- for (const name of elModules) {
45
- // "all" does not create a module on its own, that's the name of
46
- // the CDDL module that contains all CDDL definitions.
47
- if (name !== 'all') {
48
- modules[name] = [];
49
- }
50
- }
51
- }
52
-
53
- // Assemble the CDDL per module
54
- const mergedCddl = [];
55
- for (const el of cddlEls) {
56
- const cddl = trimSpaces(el.textContent);
57
- if (!cddl) {
58
- continue;
59
- }
60
- // All CDDL appears in the "all" module.
61
- mergedCddl.push(cddl);
62
- let elModules = getModules(el);
63
- if (elModules.length === 0) {
64
- // No module means the CDDL is defined for all modules
65
- elModules = Object.keys(modules);
66
- }
67
- for (const name of elModules) {
68
- // CDDL defined for the "all" module is only defined for it
69
- if (name !== 'all') {
70
- if (!modules[name]) {
71
- modules[name] = [];
72
- }
73
- modules[name].push(cddl);
74
- }
75
- }
76
- }
77
-
78
- if (mergedCddl.length === 0) {
79
- return [];
80
- }
81
-
82
- const res = [{
83
- name: Object.keys(modules).length > 0 ? 'all' : '',
84
- cddl: mergedCddl.join('\n\n')
85
- }];
86
- for (const [name, cddl] of Object.entries(modules)) {
87
- res.push({ name, cddl: cddl.join('\n\n') });
88
- }
89
- // Remove trailing spaces and use spaces throughout
90
- for (const cddlModule of res) {
91
- cddlModule.cddl = cddlModule.cddl
92
- .replace(/\s+$/gm, '\n')
93
- .replace(/\t/g, ' ')
94
- .trim();
95
- }
96
- return res;
97
- }
98
-
99
-
100
- /**
101
- * Retrieve the list of CDDL module shortnames that the element references.
102
- *
103
- * This list of modules is either specified in a `data-cddl-module` attribute
104
- * or directly within the class attribute prefixed by `cddl-` or suffixed by
105
- * `-cddl`.
106
- */
107
- function getModules(el) {
108
- const moduleAttr = el.getAttribute('data-cddl-module');
109
- if (moduleAttr) {
110
- return moduleAttr.split(',').map(str => str.trim());
111
- }
112
-
113
- const list = [];
114
- const classes = el.classList.values()
115
- for (const name of classes) {
116
- const match = name.match(/^(.*)-cddl$|^cddl-(.*)$/);
117
- if (match) {
118
- const shortname = match[1] ?? match[2];
119
- if (!list.includes(shortname)) {
120
- list.push(shortname);
121
- }
122
- }
123
- }
124
- return list;
125
- }
1
+ import getCodeElements from './get-code-elements.mjs';
2
+ import trimSpaces from './trim-spaces.mjs';
3
+
4
+ /**
5
+ * Extract the list of CDDL definitions in the current spec.
6
+ *
7
+ * A spec may define more that one CDDL module. For example, the WebDriver BiDi
8
+ * spec has CDDL definitions that apply to either of both the local end and the
9
+ * remote end. The functions returns an array that lists all CDDL modules.
10
+ *
11
+ * Each CDDL module is represented as an object with the following keys whose
12
+ * values are strings:
13
+ * - shortname: the CDDL module shortname. Shortname is "" if the spec does not
14
+ * define any module, and "all" for the dump of all CDDL definitions.
15
+ * - label: A full name for the CDDL module, when defined.
16
+ * - cddl: A dump of the CDDL definitions.
17
+ *
18
+ * If the spec defines more than one module, the first item in the array is the
19
+ * "all" module that contains a dump of all CDDL definitions, regardless of the
20
+ * module they are actually defined for (the assumption is that looking at the
21
+ * union of all CDDL modules defined in a spec will always make sense, and that
22
+ * a spec will never reuse the same rule name with a different definition for
23
+ * different CDDL modules).
24
+ *
25
+ * @function
26
+ * @public
27
+ * @return {Array} A dump of the CDDL definitions per CDDL module, or an empty
28
+ * array if the spec does not contain any CDDL.
29
+ */
30
+ export default function () {
31
+ // Specs with CDDL are either recent enough that they all use the same
32
+ // `<pre class="cddl">` convention, or they don't flag CDDL blocks in any
33
+ // way, making it impossible to extract them.
34
+ const cddlSelectors = ['pre.cddl:not(.exclude):not(.extract)'];
35
+ const excludeSelectors = ['#cddl-index'];
36
+
37
+ // Retrieve all elements that contains CDDL content
38
+ const cddlEls = getCodeElements(cddlSelectors, { excludeSelectors });
39
+
40
+ // Start by assembling the list of modules
41
+ const modules = {};
42
+ for (const el of cddlEls) {
43
+ const elModules = getModules(el);
44
+ for (const name of elModules) {
45
+ // "all" does not create a module on its own, that's the name of
46
+ // the CDDL module that contains all CDDL definitions.
47
+ if (name !== 'all') {
48
+ modules[name] = [];
49
+ }
50
+ }
51
+ }
52
+
53
+ // Assemble the CDDL per module
54
+ const mergedCddl = [];
55
+ for (const el of cddlEls) {
56
+ const cddl = trimSpaces(el.textContent);
57
+ if (!cddl) {
58
+ continue;
59
+ }
60
+ // All CDDL appears in the "all" module.
61
+ mergedCddl.push(cddl);
62
+ let elModules = getModules(el);
63
+ if (elModules.length === 0) {
64
+ // No module means the CDDL is defined for all modules
65
+ elModules = Object.keys(modules);
66
+ }
67
+ for (const name of elModules) {
68
+ // CDDL defined for the "all" module is only defined for it
69
+ if (name !== 'all') {
70
+ if (!modules[name]) {
71
+ modules[name] = [];
72
+ }
73
+ modules[name].push(cddl);
74
+ }
75
+ }
76
+ }
77
+
78
+ if (mergedCddl.length === 0) {
79
+ return [];
80
+ }
81
+
82
+ const res = [{
83
+ name: Object.keys(modules).length > 0 ? 'all' : '',
84
+ cddl: mergedCddl.join('\n\n')
85
+ }];
86
+ for (const [name, cddl] of Object.entries(modules)) {
87
+ res.push({ name, cddl: cddl.join('\n\n') });
88
+ }
89
+ // Remove trailing spaces and use spaces throughout
90
+ for (const cddlModule of res) {
91
+ cddlModule.cddl = cddlModule.cddl
92
+ .replace(/\s+$/gm, '\n')
93
+ .replace(/\t/g, ' ')
94
+ .trim();
95
+ }
96
+ return res;
97
+ }
98
+
99
+
100
+ /**
101
+ * Retrieve the list of CDDL module shortnames that the element references.
102
+ *
103
+ * This list of modules is either specified in a `data-cddl-module` attribute
104
+ * or directly within the class attribute prefixed by `cddl-` or suffixed by
105
+ * `-cddl`.
106
+ */
107
+ function getModules(el) {
108
+ const moduleAttr = el.getAttribute('data-cddl-module');
109
+ if (moduleAttr) {
110
+ return moduleAttr.split(',').map(str => str.trim());
111
+ }
112
+
113
+ const list = [];
114
+ const classes = el.classList.values()
115
+ for (const name of classes) {
116
+ const match = name.match(/^(.*)-cddl$|^cddl-(.*)$/);
117
+ if (match) {
118
+ const shortname = match[1] ?? match[2];
119
+ if (!list.includes(shortname)) {
120
+ list.push(shortname);
121
+ }
122
+ }
123
+ }
124
+ return list;
125
+ }