reffy 6.2.0 → 6.2.1

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 (43) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +158 -158
  3. package/index.js +11 -11
  4. package/package.json +53 -53
  5. package/reffy.js +248 -248
  6. package/src/browserlib/canonicalize-url.mjs +50 -50
  7. package/src/browserlib/create-outline.mjs +352 -352
  8. package/src/browserlib/extract-cssdfn.mjs +319 -319
  9. package/src/browserlib/extract-dfns.mjs +686 -686
  10. package/src/browserlib/extract-elements.mjs +205 -205
  11. package/src/browserlib/extract-headings.mjs +48 -48
  12. package/src/browserlib/extract-ids.mjs +28 -28
  13. package/src/browserlib/extract-links.mjs +28 -28
  14. package/src/browserlib/extract-references.mjs +203 -203
  15. package/src/browserlib/extract-webidl.mjs +134 -134
  16. package/src/browserlib/get-absolute-url.mjs +21 -21
  17. package/src/browserlib/get-generator.mjs +26 -26
  18. package/src/browserlib/get-lastmodified-date.mjs +13 -13
  19. package/src/browserlib/get-title.mjs +11 -11
  20. package/src/browserlib/informative-selector.mjs +16 -16
  21. package/src/browserlib/map-ids-to-headings.mjs +136 -136
  22. package/src/browserlib/reffy.json +53 -53
  23. package/src/cli/check-missing-dfns.js +609 -609
  24. package/src/cli/generate-idlnames.js +430 -430
  25. package/src/cli/generate-idlparsed.js +139 -139
  26. package/src/cli/merge-crawl-results.js +128 -128
  27. package/src/cli/parse-webidl.js +430 -430
  28. package/src/lib/css-grammar-parse-tree.schema.json +109 -109
  29. package/src/lib/css-grammar-parser.js +440 -440
  30. package/src/lib/fetch.js +55 -55
  31. package/src/lib/nock-server.js +119 -119
  32. package/src/lib/specs-crawler.js +605 -603
  33. package/src/lib/util.js +898 -898
  34. package/src/specs/missing-css-rules.json +197 -197
  35. package/src/specs/spec-equivalents.json +149 -149
  36. package/src/browserlib/extract-editors.mjs~ +0 -14
  37. package/src/browserlib/generate-es-dfn-report.sh~ +0 -4
  38. package/src/cli/csstree-grammar-check.js +0 -28
  39. package/src/cli/csstree-grammar-check.js~ +0 -10
  40. package/src/cli/csstree-grammar-parser.js +0 -11
  41. package/src/cli/csstree-grammar-parser.js~ +0 -1
  42. package/src/cli/extract-editors.js~ +0 -38
  43. package/src/cli/process-specs.js~ +0 -28
@@ -1,149 +1,149 @@
1
- {
2
- "https://www.w3.org/TR/webmessaging/": [
3
- "https://html.spec.whatwg.org/"
4
- ],
5
- "https://www.w3.org/TR/2dcontext/": [
6
- "https://html.spec.whatwg.org/",
7
- "https://www.whatwg.org/specs/web-apps/current-work/multipage/",
8
- "https://www.w3.org/TR/2dcontext2/"
9
- ],
10
- "https://www.w3.org/TR/workers/": [
11
- "https://html.spec.whatwg.org/"
12
- ],
13
- "https://html.spec.whatwg.org/multipage/": [
14
- "https://w3c.github.io/html/",
15
- "https://www.w3.org/TR/html/",
16
- "https://www.w3.org/TR/html5/",
17
- "https://www.w3.org/TR/html51/",
18
- "https://www.w3.org/TR/html52/",
19
- "https://html.spec.whatwg.org/",
20
- "https://www.whatwg.org/specs/web-apps/current-work/multipage/",
21
- "https://www.w3.org/TR/eventsource/",
22
- "https://www.w3.org/TR/webmessaging/",
23
- "https://www.w3.org/TR/2dcontext/",
24
- "https://www.w3.org/TR/2dcontext2/",
25
- "https://www.w3.org/TR/webstorage/",
26
- "https://www.w3.org/TR/workers/",
27
- "https://www.w3.org/TR/websockets/",
28
- "https://www.w3.org/html/wg/drafts/html/master/webappapis.html"
29
- ],
30
- "https://www.w3.org/TR/dom41/": [
31
- "https://dom.spec.whatwg.org/",
32
- "https://www.w3.org/TR/dom/",
33
- "https://www.w3.org/TR/DOM-Level-3-Core/",
34
- "https://www.w3.org/TR/domcore/",
35
- "https://www.w3.org/TR/REC-DOM-Level-1/"
36
- ],
37
- "https://www.w3.org/TR/html52/": [
38
- "https://www.w3.org/TR/html/",
39
- "https://www.w3.org/TR/html5/",
40
- "https://www.w3.org/TR/html51/",
41
- "https://www.w3.org/TR/html52/",
42
- "https://html.spec.whatwg.org/",
43
- "https://html.spec.whatwg.org/multipage/"
44
- ],
45
- "https://dom.spec.whatwg.org/": [
46
- "https://www.w3.org/TR/dom/",
47
- "https://www.w3.org/TR/dom41/",
48
- "https://www.w3.org/TR/DOM-Level-3-Core/",
49
- "https://www.w3.org/TR/domcore/",
50
- "https://www.w3.org/TR/REC-DOM-Level-1/"
51
- ],
52
- "https://www.khronos.org/registry/webgl/specs/latest/1.0/": [
53
- "https://www.khronos.org/registry/webgl/specs/1.0/",
54
- "https://www.khronos.org/registry/webgl/specs/latest/"
55
- ],
56
- "https://www.w3.org/TR/notifications/": [
57
- "https://notifications.spec.whatwg.org/"
58
- ],
59
- "https://www.w3.org/TR/geolocation-API/": [
60
- "https://dev.w3.org/geo/api/spec-source.html"
61
- ],
62
- "https://www.w3.org/TR/uievents/": [
63
- "https://w3c.github.io/uievents/"
64
- ],
65
- "https://www.w3.org/TR/mediacapture-streams/": [
66
- "https://w3c.github.io/mediacapture-main/getusermedia.html"
67
- ],
68
- "https://www.w3.org/TR/vibration/": [
69
- "https://dev.w3.org/2009/dap/vibration/"
70
- ],
71
- "https://www.w3.org/TR/html-media-capture/": [
72
- "https://dev.w3.org/2009/dap/camera/"
73
- ],
74
- "https://www.w3.org/TR/service-workers-1/": [
75
- "https://w3c.github.io/ServiceWorker/",
76
- "https://www.w3.org/TR/service-workers/"
77
- ],
78
- "https://www.w3.org/TR/webvtt1/": [
79
- "https://dev.w3.org/html5/webvtt/"
80
- ],
81
- "https://www.w3.org/TR/WebCryptoAPI/": [
82
- "https://w3c.github.io/webcrypto/"
83
- ],
84
- "https://www.w3.org/TR/pointerlock-2/": [
85
- "https://www.w3.org/TR/pointerlock/"
86
- ],
87
- "https://www.w3.org/TR/hr-time-3/": [
88
- "https://www.w3.org/TR/hr-time/",
89
- "https://www.w3.org/TR/hr-time-2/"
90
- ],
91
- "https://www.w3.org/TR/navigation-timing-2/": [
92
- "https://www.w3.org/TR/navigation-timing/"
93
- ],
94
- "https://www.w3.org/TR/pointerevents2/": [
95
- "https://www.w3.org/TR/pointerevents/"
96
- ],
97
- "https://www.w3.org/TR/page-visibility-2/": [
98
- "https://www.w3.org/TR/page-visibility/"
99
- ],
100
- "https://www.w3.org/TR/user-timing-2/": [
101
- "https://www.w3.org/TR/user-timing/"
102
- ],
103
- "https://www.w3.org/TR/performance-timeline-2/": [
104
- "https://www.w3.org/TR/performance-timeline/"
105
- ],
106
- "https://www.w3.org/TR/IndexedDB-2/": [
107
- "https://www.w3.org/TR/IndexedDB/"
108
- ],
109
- "https://www.w3.org/TR/resource-timing-2/": [
110
- "https://www.w3.org/TR/resource-timing-1/",
111
- "https://www.w3.org/TR/resource-timing/"
112
- ],
113
- "https://www.w3.org/TR/input-events-2/": [
114
- "https://www.w3.org/TR/input-events-1/"
115
- ],
116
- "https://www.w3.org/TR/SVG2/": [
117
- "https://www.w3.org/TR/SVG/",
118
- "https://www.w3.org/TR/SVG11/"
119
- ],
120
- "https://w3c.github.io/staticrange/": [
121
- "https://w3c.github.io/staticrange/index.html"
122
- ],
123
- "https://www.w3.org/TR/geometry-1/": [
124
- "https://drafts.fxtf.org/geometry/"
125
- ],
126
- "https://www.w3.org/TR/css-values-3/": [
127
- "https://www.w3.org/TR/css3-values/",
128
- "https://www.w3.org/TR/css-values/"
129
- ],
130
- "https://www.w3.org/TR/css-syntax-3/": [
131
- "https://www.w3.org/TR/css-syntax/"
132
- ],
133
- "https://www.w3.org/TR/css-fonts-4/": [
134
- "https://www.w3.org/TR/css3-fonts/",
135
- "https://www.w3.org/TR/css-fonts-3/"
136
- ],
137
- "https://www.w3.org/TR/css3-selectors/": [
138
- "https://www.w3.org/TR/selectors/"
139
- ],
140
- "https://www.w3.org/TR/compositing-1/": [
141
- "https://www.w3.org/TR/compositing/"
142
- ],
143
- "https://www.w3.org/TR/css-writing-modes-3/": [
144
- "https://www.w3.org/TR/css3-writing-modes/"
145
- ],
146
- "https://www.w3.org/TR/cssom-view-1/": [
147
- "https://www.w3.org/TR/cssom-view/"
148
- ]
149
- }
1
+ {
2
+ "https://www.w3.org/TR/webmessaging/": [
3
+ "https://html.spec.whatwg.org/"
4
+ ],
5
+ "https://www.w3.org/TR/2dcontext/": [
6
+ "https://html.spec.whatwg.org/",
7
+ "https://www.whatwg.org/specs/web-apps/current-work/multipage/",
8
+ "https://www.w3.org/TR/2dcontext2/"
9
+ ],
10
+ "https://www.w3.org/TR/workers/": [
11
+ "https://html.spec.whatwg.org/"
12
+ ],
13
+ "https://html.spec.whatwg.org/multipage/": [
14
+ "https://w3c.github.io/html/",
15
+ "https://www.w3.org/TR/html/",
16
+ "https://www.w3.org/TR/html5/",
17
+ "https://www.w3.org/TR/html51/",
18
+ "https://www.w3.org/TR/html52/",
19
+ "https://html.spec.whatwg.org/",
20
+ "https://www.whatwg.org/specs/web-apps/current-work/multipage/",
21
+ "https://www.w3.org/TR/eventsource/",
22
+ "https://www.w3.org/TR/webmessaging/",
23
+ "https://www.w3.org/TR/2dcontext/",
24
+ "https://www.w3.org/TR/2dcontext2/",
25
+ "https://www.w3.org/TR/webstorage/",
26
+ "https://www.w3.org/TR/workers/",
27
+ "https://www.w3.org/TR/websockets/",
28
+ "https://www.w3.org/html/wg/drafts/html/master/webappapis.html"
29
+ ],
30
+ "https://www.w3.org/TR/dom41/": [
31
+ "https://dom.spec.whatwg.org/",
32
+ "https://www.w3.org/TR/dom/",
33
+ "https://www.w3.org/TR/DOM-Level-3-Core/",
34
+ "https://www.w3.org/TR/domcore/",
35
+ "https://www.w3.org/TR/REC-DOM-Level-1/"
36
+ ],
37
+ "https://www.w3.org/TR/html52/": [
38
+ "https://www.w3.org/TR/html/",
39
+ "https://www.w3.org/TR/html5/",
40
+ "https://www.w3.org/TR/html51/",
41
+ "https://www.w3.org/TR/html52/",
42
+ "https://html.spec.whatwg.org/",
43
+ "https://html.spec.whatwg.org/multipage/"
44
+ ],
45
+ "https://dom.spec.whatwg.org/": [
46
+ "https://www.w3.org/TR/dom/",
47
+ "https://www.w3.org/TR/dom41/",
48
+ "https://www.w3.org/TR/DOM-Level-3-Core/",
49
+ "https://www.w3.org/TR/domcore/",
50
+ "https://www.w3.org/TR/REC-DOM-Level-1/"
51
+ ],
52
+ "https://www.khronos.org/registry/webgl/specs/latest/1.0/": [
53
+ "https://www.khronos.org/registry/webgl/specs/1.0/",
54
+ "https://www.khronos.org/registry/webgl/specs/latest/"
55
+ ],
56
+ "https://www.w3.org/TR/notifications/": [
57
+ "https://notifications.spec.whatwg.org/"
58
+ ],
59
+ "https://www.w3.org/TR/geolocation-API/": [
60
+ "https://dev.w3.org/geo/api/spec-source.html"
61
+ ],
62
+ "https://www.w3.org/TR/uievents/": [
63
+ "https://w3c.github.io/uievents/"
64
+ ],
65
+ "https://www.w3.org/TR/mediacapture-streams/": [
66
+ "https://w3c.github.io/mediacapture-main/getusermedia.html"
67
+ ],
68
+ "https://www.w3.org/TR/vibration/": [
69
+ "https://dev.w3.org/2009/dap/vibration/"
70
+ ],
71
+ "https://www.w3.org/TR/html-media-capture/": [
72
+ "https://dev.w3.org/2009/dap/camera/"
73
+ ],
74
+ "https://www.w3.org/TR/service-workers-1/": [
75
+ "https://w3c.github.io/ServiceWorker/",
76
+ "https://www.w3.org/TR/service-workers/"
77
+ ],
78
+ "https://www.w3.org/TR/webvtt1/": [
79
+ "https://dev.w3.org/html5/webvtt/"
80
+ ],
81
+ "https://www.w3.org/TR/WebCryptoAPI/": [
82
+ "https://w3c.github.io/webcrypto/"
83
+ ],
84
+ "https://www.w3.org/TR/pointerlock-2/": [
85
+ "https://www.w3.org/TR/pointerlock/"
86
+ ],
87
+ "https://www.w3.org/TR/hr-time-3/": [
88
+ "https://www.w3.org/TR/hr-time/",
89
+ "https://www.w3.org/TR/hr-time-2/"
90
+ ],
91
+ "https://www.w3.org/TR/navigation-timing-2/": [
92
+ "https://www.w3.org/TR/navigation-timing/"
93
+ ],
94
+ "https://www.w3.org/TR/pointerevents2/": [
95
+ "https://www.w3.org/TR/pointerevents/"
96
+ ],
97
+ "https://www.w3.org/TR/page-visibility-2/": [
98
+ "https://www.w3.org/TR/page-visibility/"
99
+ ],
100
+ "https://www.w3.org/TR/user-timing-2/": [
101
+ "https://www.w3.org/TR/user-timing/"
102
+ ],
103
+ "https://www.w3.org/TR/performance-timeline-2/": [
104
+ "https://www.w3.org/TR/performance-timeline/"
105
+ ],
106
+ "https://www.w3.org/TR/IndexedDB-2/": [
107
+ "https://www.w3.org/TR/IndexedDB/"
108
+ ],
109
+ "https://www.w3.org/TR/resource-timing-2/": [
110
+ "https://www.w3.org/TR/resource-timing-1/",
111
+ "https://www.w3.org/TR/resource-timing/"
112
+ ],
113
+ "https://www.w3.org/TR/input-events-2/": [
114
+ "https://www.w3.org/TR/input-events-1/"
115
+ ],
116
+ "https://www.w3.org/TR/SVG2/": [
117
+ "https://www.w3.org/TR/SVG/",
118
+ "https://www.w3.org/TR/SVG11/"
119
+ ],
120
+ "https://w3c.github.io/staticrange/": [
121
+ "https://w3c.github.io/staticrange/index.html"
122
+ ],
123
+ "https://www.w3.org/TR/geometry-1/": [
124
+ "https://drafts.fxtf.org/geometry/"
125
+ ],
126
+ "https://www.w3.org/TR/css-values-3/": [
127
+ "https://www.w3.org/TR/css3-values/",
128
+ "https://www.w3.org/TR/css-values/"
129
+ ],
130
+ "https://www.w3.org/TR/css-syntax-3/": [
131
+ "https://www.w3.org/TR/css-syntax/"
132
+ ],
133
+ "https://www.w3.org/TR/css-fonts-4/": [
134
+ "https://www.w3.org/TR/css3-fonts/",
135
+ "https://www.w3.org/TR/css-fonts-3/"
136
+ ],
137
+ "https://www.w3.org/TR/css3-selectors/": [
138
+ "https://www.w3.org/TR/selectors/"
139
+ ],
140
+ "https://www.w3.org/TR/compositing-1/": [
141
+ "https://www.w3.org/TR/compositing/"
142
+ ],
143
+ "https://www.w3.org/TR/css-writing-modes-3/": [
144
+ "https://www.w3.org/TR/css3-writing-modes/"
145
+ ],
146
+ "https://www.w3.org/TR/cssom-view-1/": [
147
+ "https://www.w3.org/TR/cssom-view/"
148
+ ]
149
+ }
@@ -1,14 +0,0 @@
1
- export default function () {
2
- const dateEl = document.querySelector('.head time');
3
- const statusAndDate = [...document.querySelectorAll('.head h2')]
4
- .map(el => el.textContent).join(' ').trim();
5
- const lastModified = new Date(Date.parse(document.lastModified));
6
- const date = dateEl ? dateEl.textContent.trim() :
7
- (statusAndDate ? statusAndDate.split(/\s+/).slice(-3).join(' ') :
8
- [
9
- lastModified.toLocaleDateString('en-US', { day: 'numeric' }),
10
- lastModified.toLocaleDateString('en-US', { month: 'long' }),
11
- lastModified.toLocaleDateString('en-US', { year: 'numeric' })
12
- ].join(' '));
13
- return date;
14
- }
@@ -1,4 +0,0 @@
1
- echo "# Interfaces" && jq '.dfns[]|select(.type == "interface")|"- [" + .linkingText[0] + "](" + .href + ")"' es/dfns/ecmascript.json |tr -d '"'
2
- echo
3
- echo "# Attributes" && jq '.dfns[]|select(.type == "attribute")|"- [" + .["for"][0] + "." + .linkingText[0] + "](" + .href + ")"' es/dfns/ecmascript.json |tr -d '"'
4
- echo
@@ -1,28 +0,0 @@
1
- const fs = require("fs");
2
- const { definitionSyntax } = require('css-tree');
3
-
4
- function parse(value, file) {
5
- try {
6
- if (value && !value === definitionSyntax.generate(definitionSyntax.parse(value))) {
7
- console.error("Discrepancy when parsing " + value + " in " + file);
8
- }
9
- } catch (e) {
10
- console.error("Error parsing " + value + " in " + file + ": " + e.message);
11
- }
12
- }
13
-
14
- if (require.main === module) {
15
- const file = process.argv[2];
16
- if (!file) {
17
- console.error('Required file parameter missing');
18
- process.exit(2);
19
- }
20
- const data = fs.readFileSync(file, "utf-8");
21
- const {properties, descriptors, valuespaces} = JSON.parse(data);
22
- for (let dataset of [properties, descriptors, valuespaces].map(Object.values)) {
23
- for (let dfn of dataset) {
24
- parse(dfn.value);
25
- parse(dfn.newValue);
26
- }
27
- }
28
- }
@@ -1,10 +0,0 @@
1
- const { definitionSyntax } = require('css-tree');
2
-
3
- if (require.main === module) {
4
- const file = process.argv[2];
5
- if (!file) {
6
- console.error('Required file parameter missing');
7
- process.exit(2);
8
- }
9
- console.log(JSON.stringify(definitionSyntax.parse(input), null, 2));
10
- }
@@ -1,11 +0,0 @@
1
- const { definitionSyntax } = require('css-tree');
2
-
3
- if (require.main === module) {
4
- const input = process.argv.slice(2).join(" ");
5
- if (!input) {
6
- console.error('Required input parameter missing');
7
- process.exit(2);
8
- }
9
- console.log(JSON.stringify(definitionSyntax.parse(input), null, 2));
10
- }
11
-
@@ -1 +0,0 @@
1
- const { definitionSyntax } = require('css-tree');
@@ -1,38 +0,0 @@
1
- async function processSpec(spec, crawlOptions) {
2
- spec.crawled = crawlOptions.publishedVersion ?
3
- (spec.release ? spec.release : spec.nightly) :
4
- spec.nightly;
5
- spec.date = "";
6
- spec.links = {};
7
- spec.refs = {};
8
- spec.idl = {};
9
- if (spec.error) {
10
- return spec;
11
- }
12
-
13
- try {
14
- const result = await processSpecification(spec.crawled, (spec) => {
15
- const idToHeading = window.reffy.mapIdsToHeadings();
16
- return {
17
- crawled: window.location.toString(),
18
- title: window.reffy.getTitle(),
19
- generator: window.reffy.getGenerator(),
20
- date: window.reffy.getLastModifiedDate(),
21
- editors: window.reffy.extractEditors()
22
- };
23
- }, [spec]);
24
-
25
- // Copy results back into initial spec object
26
- spec.crawled = result.crawled;
27
- spec.title = result.title ? result.title : spec.title;
28
- spec.generator = result.generator;
29
- spec.date = result.date;
30
- spec.editors = result.editors;
31
- }
32
- catch (err) {
33
- spec.title = spec.title || '[Could not be determined, see error]';
34
- spec.error = err.toString() + (err.stack ? ' ' + err.stack : '');
35
- }
36
-
37
- return spec;
38
- }
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * The spec processor takes a list of spec URLs as input, gathers some knowledge
4
- * about these specs (published versions, URL of the Editor's Draft, etc.),
5
- * fetches these specs, parses them, extracts relevant information that they
6
- * contain (such as the WebIDL they define, the list of specifications that they
7
- * reference, and links to external specs), and produces a crawl report with the
8
- * results of these investigations.
9
- *
10
- * The spec processor can be called directly through:
11
- *
12
- * `node process-specs.js [listfile] [crawl folder] [option]`
13
- *
14
- * where `listfile` is the name of a JSON file that contains the list of specs
15
- * to crawl, `crawl folder` is the name of the folder where the crawl report
16
- * will be created, and `option` is an optional parameter that can be set to
17
- * `tr` to tell the crawler to crawl the published version of W3C specifications
18
- * instead of the Editor's Draft.
19
- *
20
- * The JSON file that contains the list of specs to crawl must be an array whose
21
- * individual items are either:
22
- * 1. a string that gets interpreted as the URL or the shortname of the spec to
23
- * crawl. The spec must exist in w3c/browser-specs
24
- * 2. an object that follows the w3c/browser-specs model:
25
- * https://github.com/w3c/browser-specs#spec-object
26
- *
27
- * @module crawler
28
- */