reffy 18.4.0 → 18.4.2

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": "18.4.0",
3
+ "version": "18.4.2",
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",
@@ -37,16 +37,16 @@
37
37
  "ajv-formats": "3.0.1",
38
38
  "commander": "13.1.0",
39
39
  "fetch-filecache-for-crawling": "5.1.1",
40
- "puppeteer": "24.2.1",
40
+ "puppeteer": "24.4.0",
41
41
  "semver": "^7.3.5",
42
- "web-specs": "3.41.0",
42
+ "web-specs": "3.43.0",
43
43
  "webidl2": "24.4.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "mocha": "11.1.0",
47
47
  "respec": "35.2.2",
48
48
  "respec-hljs": "2.1.1",
49
- "rollup": "4.34.8",
49
+ "rollup": "4.35.0",
50
50
  "undici": "^7.0.0"
51
51
  },
52
52
  "overrides": {
@@ -341,7 +341,9 @@ export default function (spec, idToHeading = {}) {
341
341
  // (pending a proper dfns curation process, see:
342
342
  // https://github.com/w3c/webref/issues/789)
343
343
  .filter(node => {
344
- const link = node.querySelector('a[href^="http"]');
344
+ const link =
345
+ node.querySelector('a[href^="http"]') ??
346
+ node.closest('a[href^="http"]');
345
347
  return !link ||
346
348
  (node.textContent.trim() !== link.textContent.trim()) ||
347
349
  (link.href === 'https://www.w3.org/TR/CSS2/syndata.html#vendor-keywords');
@@ -169,13 +169,40 @@ mockAgent
169
169
  }
170
170
  });
171
171
 
172
+ mockAgent
173
+ .get("https://www.w3.org")
174
+ .intercept({ method: "GET", path: "/TR/iredirect/" })
175
+ .reply(200,
176
+ `<!DOCTYPE html><script>window.location = '/TR/recentlyupdated/';</script>`,
177
+ {
178
+ headers: {
179
+ "Content-Type": "text/html",
180
+ "Last-Modified": "Fri, 11 Feb 2022 00:00:42 GMT"
181
+ }
182
+ }
183
+ );
184
+
185
+ mockAgent
186
+ .get("https://www.w3.org")
187
+ .intercept({ method: "GET", path: "/TR/recentlyupdated/" })
188
+ .reply(200,
189
+ `<html><title>Recently updated</title>
190
+ <h1>Recently updated</h1>`,
191
+ {
192
+ headers: {
193
+ "Content-Type": "text/html",
194
+ "Last-Modified": (new Date()).toString()
195
+ }
196
+ }
197
+ );
198
+
172
199
  mockAgent
173
200
  .get("https://drafts.csswg.org")
174
201
  .intercept({ method: "GET", path: "/server-hiccup/" })
175
202
  .reply(200,
176
203
  `<html><title>Server hiccup</title>
177
204
  <h1> Index of Server Hiccup Module Level 42 </h1>`,
178
- { header: { "Content-Type": "text/html" } })
205
+ { headers: { "Content-Type": "text/html" } })
179
206
  .persist();
180
207
 
181
208
  /*nock.emitter.on('error', function (err) {
@@ -138,8 +138,15 @@ async function crawlSpec(spec, crawlOptions) {
138
138
  if (result.crawled) {
139
139
  spec.crawled = result.crawled;
140
140
  }
141
- if (result.crawlCacheInfo) {
142
- spec.crawlCacheInfo = result.crawlCacheInfo;
141
+ if (result.crawlCacheInfo &&
142
+ (result.crawled === spec.url ||
143
+ result.crawled === spec.nightly?.url)) {
144
+ // Note: Some redirection took place. That happens when, e.g., a
145
+ // WICG spec gets moved to another group, until we update the URL
146
+ // in browser-specs. Redirection is done through scripting. Reffy
147
+ // follows the redirect but the cache info it receives from
148
+ // Puppeteer is for the initial URL. We cannot rely on it!
149
+ spec.crawlCacheInfo = result.crawlCacheInfo;
143
150
  }
144
151
  crawlOptions.modules.forEach(mod => {
145
152
  if (result[mod.property]) {