respec 37.3.2 → 37.3.4
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 +92 -92
- package/builds/respec-aom.js.map +1 -1
- package/builds/respec-dini.js +91 -91
- package/builds/respec-dini.js.map +1 -1
- package/builds/respec-geonovum.js +72 -72
- package/builds/respec-geonovum.js.map +1 -1
- package/builds/respec-highlight.js +1 -1
- package/builds/respec-w3c.js +149 -150
- package/builds/respec-w3c.js.map +1 -1
- package/package.json +13 -12
- package/tools/respec2html.js +26 -20
- package/tools/respecDocWriter.js +15 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "respec",
|
|
3
|
-
"version": "37.3.
|
|
3
|
+
"version": "37.3.4",
|
|
4
4
|
"license": "W3C",
|
|
5
5
|
"description": "A technical specification pre-processor.",
|
|
6
6
|
"engines": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"cddlparser": "^0.6.0",
|
|
34
34
|
"chokidar": "^5.0.0",
|
|
35
35
|
"epipebomb": "^1.0.0",
|
|
36
|
-
"eslint": "^10.
|
|
36
|
+
"eslint": "^10.9.0",
|
|
37
37
|
"eslint-config-prettier": "^10.1.8",
|
|
38
38
|
"eslint-plugin-import-x": "^4.17.1",
|
|
39
39
|
"eslint-plugin-jasmine": "^4.2.2",
|
|
@@ -42,13 +42,12 @@
|
|
|
42
42
|
"highlight.js": "^11.12.0",
|
|
43
43
|
"hyperhtml": "^2.34.2",
|
|
44
44
|
"idb": "^8.0.3",
|
|
45
|
-
"jasmine": "^
|
|
46
|
-
"jasmine-core": "^
|
|
45
|
+
"jasmine": "^7.0.0",
|
|
46
|
+
"jasmine-core": "^7.0.2",
|
|
47
47
|
"karma": "^6.4.4",
|
|
48
48
|
"karma-chrome-launcher": "^3.2.0",
|
|
49
49
|
"karma-firefox-launcher": "^2.1.3",
|
|
50
50
|
"karma-jasmine": "^5.1.0",
|
|
51
|
-
"karma-jasmine-html-reporter": "^2.2.0",
|
|
52
51
|
"karma-mocha-reporter": "^2.2.5",
|
|
53
52
|
"karma-safari-launcher": "^1.0.0",
|
|
54
53
|
"lint-staged": "^17.3.0",
|
|
@@ -56,14 +55,14 @@
|
|
|
56
55
|
"pluralize": "^8.0.0",
|
|
57
56
|
"prettier": "^3.9.6",
|
|
58
57
|
"prompt": "^1.3.0",
|
|
59
|
-
"rollup": "^4.62.
|
|
58
|
+
"rollup": "^4.62.5",
|
|
60
59
|
"rollup-plugin-minify-html-literals": "^1.2.6",
|
|
61
60
|
"serve": "^14.2.6",
|
|
62
61
|
"serve-handler": "^6.1.7",
|
|
63
62
|
"simple-git-hooks": "^2.13.1",
|
|
64
63
|
"sniffy-mimetype": "^1.1.1",
|
|
65
64
|
"typescript": "^7.0.2",
|
|
66
|
-
"vnu-jar": "^26.8.
|
|
65
|
+
"vnu-jar": "^26.8.21",
|
|
67
66
|
"webidl2": "^24.5.0"
|
|
68
67
|
},
|
|
69
68
|
"scripts": {
|
|
@@ -89,10 +88,9 @@
|
|
|
89
88
|
"test:integration": "karma start ./tests/spec/karma.conf.cjs --single-run"
|
|
90
89
|
},
|
|
91
90
|
"dependencies": {
|
|
92
|
-
"colors": "1.4.0",
|
|
93
91
|
"finalhandler": "^2.1.1",
|
|
94
|
-
"marked": "^18.0.
|
|
95
|
-
"puppeteer": "^25.
|
|
92
|
+
"marked": "^18.0.10",
|
|
93
|
+
"puppeteer": "^25.8.0",
|
|
96
94
|
"sade": "^1.8.1",
|
|
97
95
|
"serve-static": "^2.2.1"
|
|
98
96
|
},
|
|
@@ -121,13 +119,13 @@
|
|
|
121
119
|
"vnu-jar"
|
|
122
120
|
],
|
|
123
121
|
"overrides": {
|
|
124
|
-
"fast-uri": "^3.1.
|
|
122
|
+
"fast-uri": "^3.1.5",
|
|
125
123
|
"flatted": ">=3.4.2",
|
|
126
124
|
"follow-redirects": ">=1.16.0",
|
|
127
125
|
"jasmine>glob": ">=10.5.0",
|
|
128
126
|
"lodash": ">=4.18.0",
|
|
129
127
|
"qs": ">=6.14.2",
|
|
130
|
-
"socket.io-parser": ">=4.2.
|
|
128
|
+
"socket.io-parser": ">=4.2.7",
|
|
131
129
|
"tmp": ">=0.2.4",
|
|
132
130
|
"ws": ">=8.17.1",
|
|
133
131
|
"@rollup/pluginutils>picomatch": "^2.3.2",
|
|
@@ -148,5 +146,8 @@
|
|
|
148
146
|
"funding": {
|
|
149
147
|
"type": "opencollective",
|
|
150
148
|
"url": "https://opencollective.com/respec"
|
|
149
|
+
},
|
|
150
|
+
"publishConfig": {
|
|
151
|
+
"registry": "https://registry.npmjs.org"
|
|
151
152
|
}
|
|
152
153
|
}
|
package/tools/respec2html.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { readFile, writeFile } from "fs/promises";
|
|
3
|
-
import colors from "colors";
|
|
4
3
|
import finalhandler from "finalhandler";
|
|
5
4
|
import http from "http";
|
|
6
5
|
import { marked } from "marked";
|
|
7
6
|
import path from "path";
|
|
8
7
|
import sade from "sade";
|
|
9
8
|
import serveStatic from "serve-static";
|
|
9
|
+
import { styleText } from "node:util";
|
|
10
10
|
import { toHTML } from "./respecDocWriter.js";
|
|
11
11
|
|
|
12
12
|
const __dirname = import.meta.dirname;
|
|
13
13
|
|
|
14
14
|
class Renderer extends marked.Renderer {
|
|
15
15
|
strong(token) {
|
|
16
|
-
return
|
|
16
|
+
return styleText("bold", this.parser.parseInline(token.tokens));
|
|
17
17
|
}
|
|
18
18
|
em(token) {
|
|
19
|
-
return
|
|
19
|
+
return styleText("italic", this.parser.parseInline(token.tokens));
|
|
20
20
|
}
|
|
21
21
|
codespan(token) {
|
|
22
|
-
return
|
|
22
|
+
return styleText("underline", unescape(token.text));
|
|
23
23
|
}
|
|
24
24
|
paragraph(token) {
|
|
25
25
|
return unescape(this.parser.parseInline(token.tokens));
|
|
26
26
|
}
|
|
27
27
|
link(token) {
|
|
28
28
|
const text = this.parser.parseInline(token.tokens);
|
|
29
|
-
return `[${text}](${
|
|
29
|
+
return `[${text}](${styleText(["blue", "dim", "underline"], token.href)})`;
|
|
30
30
|
}
|
|
31
31
|
list(token) {
|
|
32
32
|
const body = token.items.map(item => this.listitem(item)).join("");
|
|
@@ -50,8 +50,8 @@ class Logger {
|
|
|
50
50
|
*/
|
|
51
51
|
info(message, timeRemaining) {
|
|
52
52
|
if (!this.verbose) return;
|
|
53
|
-
const header =
|
|
54
|
-
const time =
|
|
53
|
+
const header = styleText(["dim", "bgWhite", "black", "bold"], "[INFO]");
|
|
54
|
+
const time = styleText("dim", `[Timeout: ${timeRemaining}ms]`);
|
|
55
55
|
console.error(header, time, message);
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -60,8 +60,8 @@ class Logger {
|
|
|
60
60
|
* @param {RsError} rsError
|
|
61
61
|
*/
|
|
62
62
|
error(rsError) {
|
|
63
|
-
const header =
|
|
64
|
-
const message =
|
|
63
|
+
const header = styleText(["bgRed", "white", "bold"], "[ERROR]");
|
|
64
|
+
const message = styleText("red", this._formatMarkdown(rsError.message));
|
|
65
65
|
console.error(header, message);
|
|
66
66
|
if (rsError.plugin) {
|
|
67
67
|
this._printDetails(rsError);
|
|
@@ -70,8 +70,8 @@ class Logger {
|
|
|
70
70
|
|
|
71
71
|
/** @param {RsError} rsError */
|
|
72
72
|
warn(rsError) {
|
|
73
|
-
const header =
|
|
74
|
-
const message =
|
|
73
|
+
const header = styleText(["bgYellow", "black", "bold"], "[WARNING]");
|
|
74
|
+
const message = styleText("yellow", this._formatMarkdown(rsError.message));
|
|
75
75
|
console.error(header, message);
|
|
76
76
|
if (rsError.plugin) {
|
|
77
77
|
this._printDetails(rsError);
|
|
@@ -80,14 +80,14 @@ class Logger {
|
|
|
80
80
|
|
|
81
81
|
/** @param {Error | string} error */
|
|
82
82
|
fatal(error) {
|
|
83
|
-
const header =
|
|
84
|
-
const message =
|
|
83
|
+
const header = styleText(["bgRed", "white", "bold"], "[FATAL]");
|
|
84
|
+
const message = styleText("red", error.stack || error);
|
|
85
85
|
console.error(header, message);
|
|
86
86
|
// Errors thrown by respecDocWriter keep the original in `cause`, so the
|
|
87
87
|
// underlying stack is only reachable by walking the chain.
|
|
88
88
|
let cause = error instanceof Error ? error.cause : undefined;
|
|
89
89
|
for (let depth = 0; cause instanceof Error && depth < 5; depth++) {
|
|
90
|
-
console.error(
|
|
90
|
+
console.error(styleText("red", `Caused by: ${cause.stack}`));
|
|
91
91
|
cause = cause.cause;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -105,7 +105,11 @@ class Logger {
|
|
|
105
105
|
const longestTitle = shouldPrintStacktrace ? "Stacktrace" : "Plugin";
|
|
106
106
|
const padWidth = longestTitle.length + 1;
|
|
107
107
|
const paddedTitle = `${title}:`.padStart(padWidth);
|
|
108
|
-
console.error(
|
|
108
|
+
console.error(
|
|
109
|
+
" ",
|
|
110
|
+
styleText("bold", paddedTitle),
|
|
111
|
+
this._formatMarkdown(value)
|
|
112
|
+
);
|
|
109
113
|
};
|
|
110
114
|
print("Count", rsError.elements && String(rsError.elements.length));
|
|
111
115
|
print("Plugin", rsError.plugin);
|
|
@@ -113,7 +117,7 @@ class Logger {
|
|
|
113
117
|
if (shouldPrintStacktrace) {
|
|
114
118
|
let stacktrace = `${rsError.stack}`;
|
|
115
119
|
if (rsError.cause) {
|
|
116
|
-
stacktrace += `\n ${
|
|
120
|
+
stacktrace += `\n ${styleText("bold", "Caused by:")} ${rsError.cause.stack.split("\n").join("\n ")}`;
|
|
117
121
|
}
|
|
118
122
|
print("Stacktrace", stacktrace);
|
|
119
123
|
}
|
|
@@ -173,18 +177,20 @@ class StaticServer {
|
|
|
173
177
|
|
|
174
178
|
const cli = sade("respec [source] [destination]", true)
|
|
175
179
|
.describe("Converts a ReSpec source file to HTML and writes to destination.")
|
|
176
|
-
.example(`input.html output.html ${
|
|
180
|
+
.example(`input.html output.html ${styleText("dim", "# Output to a file.")}`)
|
|
177
181
|
.example(
|
|
178
|
-
`http://example.com/spec.html stdout ${
|
|
182
|
+
`http://example.com/spec.html stdout ${styleText("dim", "# Output to stdout.")}`
|
|
179
183
|
)
|
|
180
184
|
.example(
|
|
181
|
-
`http://example.com/spec.html output.html -e -w ${
|
|
185
|
+
`http://example.com/spec.html output.html -e -w ${styleText(
|
|
186
|
+
"dim",
|
|
182
187
|
"# Halt on errors or warning."
|
|
183
188
|
)}`
|
|
184
189
|
)
|
|
185
190
|
.example("--src http://example.com/spec.html --out spec.html")
|
|
186
191
|
.example(
|
|
187
|
-
`--localhost index.html out.html ${
|
|
192
|
+
`--localhost index.html out.html ${styleText(
|
|
193
|
+
"dim",
|
|
188
194
|
"# Generate file using a local web server."
|
|
189
195
|
)}`
|
|
190
196
|
);
|
package/tools/respecDocWriter.js
CHANGED
|
@@ -7,6 +7,13 @@ import { readFile } from "fs/promises";
|
|
|
7
7
|
|
|
8
8
|
const noop = () => {};
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Time allowed for the browser process to start, separate from processing.
|
|
12
|
+
* Cold CI runners regularly need longer than puppeteer's 30s default,
|
|
13
|
+
* which surfaced as "Timed out ... waiting for the WS endpoint URL".
|
|
14
|
+
*/
|
|
15
|
+
const LAUNCH_TIMEOUT = 120000;
|
|
16
|
+
|
|
10
17
|
/**
|
|
11
18
|
* Fetches a ReSpec "src" URL, and writes the processed static HTML to an "out" path.
|
|
12
19
|
* @param {string} src A URL or filepath that is the ReSpec source.
|
|
@@ -41,7 +48,11 @@ export async function toHTML(src, options = {}) {
|
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
const log = msg => options.onProgress(msg, timer.remaining);
|
|
44
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Starts once the browser is up, so a slow launch does not eat the caller's
|
|
53
|
+
* processing budget. `timeout` documents time before *processing* times out.
|
|
54
|
+
*/
|
|
55
|
+
let timer = createTimer(timeout);
|
|
45
56
|
|
|
46
57
|
/** @type {RsError[]} */
|
|
47
58
|
const errors = [];
|
|
@@ -65,7 +76,10 @@ export async function toHTML(src, options = {}) {
|
|
|
65
76
|
args,
|
|
66
77
|
devtools,
|
|
67
78
|
headless: true,
|
|
79
|
+
timeout: LAUNCH_TIMEOUT,
|
|
68
80
|
});
|
|
81
|
+
// Charge only document processing against the caller's timeout.
|
|
82
|
+
timer = createTimer(timeout);
|
|
69
83
|
|
|
70
84
|
try {
|
|
71
85
|
const page = await browser.newPage();
|