From 32e0ddb6a712c7bf8bdaa10caa3ada2983ad2ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Daoust?= Date: Thu, 1 Feb 2024 09:56:06 +0100 Subject: [PATCH] Look for new WASM proposal specs at phase 3+ (#1182) This updates the find-specs script to also look for new WASM proposals in: https://github.com/WebAssembly/proposals/blob/main/README.md Only phase 3+ proposals are being considered, in accordance with: https://github.com/w3c/browser-specs/issues/1181#issue-2109574914 ... which itself derives from: https://github.com/web-platform-tests/interop/issues/589#issuecomment-1778823232 The script now filters out specs that cannot be fetched (some WASM proposals at phase 3+ do not have a proper spec). Fix #529. --- src/find-specs.js | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/find-specs.js b/src/find-specs.js index a3e4f133..5b85d5e7 100644 --- a/src/find-specs.js +++ b/src/find-specs.js @@ -98,18 +98,28 @@ const hasPublishedContent = (candidate) => fetch(candidate.spec).then(({ok, url} // ECMA proposals are in markdown pages on GitHub. We only watch stage 3 // proposals, which are in the first table on the page. - const extractStage3Proposals = _=> + // Same thing for Web Assembly proposals: let's extract phase 3+ proposals. + const extractEcmaStage3Proposals = _=> [...document.querySelector("table").querySelectorAll("tr td:first-child a")].map(a => a.href); + const extractWasmProposals = _ => + [...document.querySelectorAll("table")] + .filter(table => table.previousElementSibling.nodeName === "H3" && table.previousElementSibling.textContent.match(/Phase (3|4|5)/)) + .map(table => [...table.querySelectorAll("tr td:first-child a")].map(a => a.href)) + .flat(); let ecmaProposals; let ecmaIntlProposals; + let wasmProposals; const browser = await puppeteer.launch(); try { const page = await browser.newPage(); await page.goto("https://github.com/tc39/proposals/blob/main/README.md"); - ecmaProposals = await page.evaluate(extractStage3Proposals); + ecmaProposals = await page.evaluate(extractEcmaStage3Proposals); await page.goto("https://github.com/tc39/proposals/blob/main/ecma402/README.md"); - ecmaIntlProposals = await page.evaluate(extractStage3Proposals); + ecmaIntlProposals = await page.evaluate(extractEcmaStage3Proposals); + + await page.goto("https://github.com/WebAssembly/proposals/blob/main/README.md"); + wasmProposals = await page.evaluate(extractWasmProposals); } finally { await browser.close(); @@ -214,13 +224,28 @@ const hasPublishedContent = (candidate) => fetch(candidate.spec).then(({ok, url} .filter(hasUntrackedURL) .filter(isInScope)); + // Check for new WASM phase 3+ proposals + candidates = candidates.concat(wasmProposals.map(s => { return {repo: s.replace('https://github.com/', ''), spec: s.replace(/^https:\/\/github.com\/WebAssembly\/([^/]+)/i, 'https://webassembly.github.io/$1/core/bikeshed/')}}) + .filter(hasUntrackedURL) + .filter(isInScope)); // Add information from Chrome Feature status candidates = candidates.map(c => { return {...c, impl: { chrome: (chromeFeatures.find(f => f.standards.spec && f.standards.spec.startsWith(c.spec)) || {}).id}};}); + // Filter out specs that cannot be fetched (e.g., because the URL we computed + // for the spec simply does not exist yet + for (const candidate of candidates) { + const exists = await fetch(candidate.spec).then(r => r.status === 200); + if (!exists) { + candidate.spec = null; + } + } + candidates = candidates.filter(candidate => !!candidate.spec); + const candidate_list = candidates.sort((c1, c2) => c1.spec.localeCompare(c2.spec)) .map(c => `- [ ] ${c.spec} from [${c.repo}](https://github.com/${c.repo})` + (c.impl.chrome ? ` [chrome status](https://www.chromestatus.com/features/${c.impl.chrome})` : '')).join("\n"); core.exportVariable("candidate_list", candidate_list); + console.log(); console.log(candidate_list); if (monitorAdditions.length) { const today = new Date().toJSON().slice(0, 10);