respec 37.7.3 → 37.8.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/builds/respec-aom.js +106 -106
- package/builds/respec-aom.js.map +1 -1
- package/builds/respec-dini.js +92 -92
- package/builds/respec-dini.js.map +1 -1
- package/builds/respec-pele.js +1 -0
- package/builds/respec-w3c.js +344 -241
- package/builds/respec-w3c.js.map +1 -1
- package/package.json +2 -1
- package/tools/respecDocWriter.js +11 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "respec",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.8.0",
|
|
4
4
|
"license": "W3C",
|
|
5
5
|
"description": "A technical specification pre-processor.",
|
|
6
6
|
"engines": {
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"karma-safari-launcher": "^1.0.0",
|
|
53
53
|
"lint-staged": "^17.6.2",
|
|
54
54
|
"loading-indicator": "^2.0.0",
|
|
55
|
+
"pele": "1.13.0",
|
|
55
56
|
"pluralize": "^8.0.0",
|
|
56
57
|
"prettier": "^3.10.1",
|
|
57
58
|
"prompt": "^1.3.0",
|
package/tools/respecDocWriter.js
CHANGED
|
@@ -163,6 +163,8 @@ async function useLocalReSpec(page, log) {
|
|
|
163
163
|
log(`Intercepted ${url} to respond with ${relPath}`);
|
|
164
164
|
await request.respond({
|
|
165
165
|
contentType: "text/javascript; charset=utf-8",
|
|
166
|
+
// ReSpec fetches the diagram renderer, and a cross-origin fetch needs this header.
|
|
167
|
+
headers: { "Access-Control-Allow-Origin": "*" },
|
|
166
168
|
body: await readFile(localPath),
|
|
167
169
|
});
|
|
168
170
|
});
|
|
@@ -170,17 +172,23 @@ async function useLocalReSpec(page, log) {
|
|
|
170
172
|
|
|
171
173
|
/** @param {import("puppeteer").HTTPRequest} req */
|
|
172
174
|
function isRespecScript(req) {
|
|
173
|
-
|
|
175
|
+
// ReSpec loads its diagram renderer with fetch, not a script element.
|
|
176
|
+
if (
|
|
177
|
+
req.method() !== "GET" ||
|
|
178
|
+
!["script", "fetch"].includes(req.resourceType())
|
|
179
|
+
) {
|
|
174
180
|
return false;
|
|
175
181
|
}
|
|
176
182
|
|
|
177
183
|
const { host, pathname: path } = new URL(req.url());
|
|
184
|
+
// useLocalReSpec needs a bundle name in the path, so reject other files here.
|
|
185
|
+
const isBundle = /\/respec-[\w-]+(?:\.js)?$/.test(path);
|
|
178
186
|
switch (host) {
|
|
179
187
|
case "www.w3.org":
|
|
180
|
-
return path.startsWith("/Tools/respec/");
|
|
188
|
+
return isBundle && path.startsWith("/Tools/respec/");
|
|
181
189
|
case "w3c.github.io":
|
|
182
190
|
case "speced.github.io":
|
|
183
|
-
return path.startsWith("/respec/builds/");
|
|
191
|
+
return isBundle && path.startsWith("/respec/builds/");
|
|
184
192
|
default:
|
|
185
193
|
// localhost, file://, and everything else
|
|
186
194
|
return /\/builds\/respec-[\w-]+\.js$/.test(path);
|