respec 35.1.1 → 35.2.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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "respec",
3
- "version": "35.1.1",
3
+ "version": "35.2.0",
4
4
  "license": "W3C",
5
5
  "description": "A technical specification pre-processor.",
6
6
  "engines": {
7
7
  "node": ">=20.12.1"
8
8
  },
9
- "packageManager": "pnpm@9.0.6",
9
+ "packageManager": "pnpm@9.14.2",
10
10
  "bin": {
11
11
  "respec": "tools/respec2html.js",
12
12
  "respec2html": "tools/respec2html.js"
@@ -24,26 +24,26 @@
24
24
  "Robin Berjon"
25
25
  ],
26
26
  "devDependencies": {
27
- "@rollup/plugin-alias": "^5.1.0",
28
- "@rollup/plugin-commonjs": "^25.0.8",
29
- "@rollup/plugin-node-resolve": "^15.2.3",
27
+ "@rollup/plugin-alias": "^5.1.1",
28
+ "@rollup/plugin-commonjs": "^28.0.1",
29
+ "@rollup/plugin-node-resolve": "^15.3.0",
30
30
  "@rollup/plugin-terser": "^0.4.4",
31
31
  "@types/pluralize": "0.0.33",
32
- "boxen": "^7.1.1",
33
- "chokidar": "^3.6.0",
32
+ "boxen": "^8.0.1",
33
+ "chokidar": "^4.0.1",
34
34
  "clean-css": "^5.3.3",
35
35
  "epipebomb": "^1.0.0",
36
36
  "eslint": "^8.57.0",
37
37
  "eslint-config-prettier": "^9.1.0",
38
- "eslint-plugin-import": "^2.29.1",
39
- "eslint-plugin-jasmine": "^4.1.3",
40
- "eslint-plugin-prettier": "^5.1.3",
41
- "highlight.js": "^11.9.0",
38
+ "eslint-plugin-import": "^2.31.0",
39
+ "eslint-plugin-jasmine": "^4.2.2",
40
+ "eslint-plugin-prettier": "^5.2.1",
41
+ "highlight.js": "^11.10.0",
42
42
  "hyperhtml": "^2.34.2",
43
43
  "idb": "^8.0.0",
44
- "jasmine": "^5.1.0",
45
- "jasmine-core": "^5.1.2",
46
- "karma": "^6.4.3",
44
+ "jasmine": "^5.4.0",
45
+ "jasmine-core": "^5.4.0",
46
+ "karma": "^6.4.4",
47
47
  "karma-chrome-launcher": "^3.2.0",
48
48
  "karma-firefox-launcher": "^2.1.3",
49
49
  "karma-jasmine": "^5.1.0",
@@ -52,15 +52,15 @@
52
52
  "karma-safari-launcher": "^1.0.0",
53
53
  "loading-indicator": "^2.0.0",
54
54
  "pluralize": "^8.0.0",
55
- "prettier": "^3.3.0",
55
+ "prettier": "^3.4.0",
56
56
  "prompt": "^1.3.0",
57
- "rollup": "^4.18.0",
57
+ "rollup": "^4.27.4",
58
58
  "rollup-plugin-minify-html-literals": "^1.2.6",
59
- "serve": "^14.2.3",
60
- "serve-handler": "^6.1.5",
59
+ "serve": "^14.2.4",
60
+ "serve-handler": "^6.1.6",
61
61
  "sniffy-mimetype": "^1.1.1",
62
- "typescript": "^5.4.5",
63
- "vnu-jar": "^23.4.11",
62
+ "typescript": "^5.7.2",
63
+ "vnu-jar": "^24.10.17",
64
64
  "webidl2": "^24.4.1"
65
65
  },
66
66
  "scripts": {
@@ -87,11 +87,11 @@
87
87
  },
88
88
  "dependencies": {
89
89
  "colors": "1.4.0",
90
- "finalhandler": "^1.2.0",
90
+ "finalhandler": "^1.3.1",
91
91
  "marked": "^12.0.2",
92
- "puppeteer": "^22.10.0",
92
+ "puppeteer": "^23.9.0",
93
93
  "sade": "^1.8.1",
94
- "serve-static": "^1.15.0"
94
+ "serve-static": "^1.16.2"
95
95
  },
96
96
  "files": [
97
97
  "builds/",
@@ -90,15 +90,32 @@ class Logger {
90
90
 
91
91
  /** @param {import("./respecDocWriter").ReSpecError} rsError */
92
92
  _printDetails(rsError) {
93
+ const shouldPrintStacktrace = this._shouldPrintStacktrace(rsError);
93
94
  const print = (title, value) => {
94
95
  if (!value) return;
95
- const padWidth = "Plugin".length + 1; // "Plugin" is the longest title
96
+ const longestTitle = shouldPrintStacktrace ? "Stacktrace" : "Plugin";
97
+ const padWidth = longestTitle.length + 1;
96
98
  const paddedTitle = `${title}:`.padStart(padWidth);
97
99
  console.error(" ", colors.bold(paddedTitle), this._formatMarkdown(value));
98
100
  };
99
101
  print("Count", rsError.elements && String(rsError.elements.length));
100
102
  print("Plugin", rsError.plugin);
101
103
  print("Hint", rsError.hint);
104
+ if (shouldPrintStacktrace) {
105
+ let stacktrace = `${rsError.stack}`;
106
+ if (rsError.cause) {
107
+ stacktrace += `\n ${colors.bold("Caused by:")} ${rsError.cause.stack.split("\n").join("\n ")}`;
108
+ }
109
+ print("Stacktrace", stacktrace);
110
+ }
111
+ }
112
+
113
+ _shouldPrintStacktrace(rsError) {
114
+ return (
115
+ this.verbose &&
116
+ !!rsError.stack &&
117
+ (!!rsError.cause?.stack || rsError.plugin === "unknown")
118
+ );
102
119
  }
103
120
  }
104
121
 
@@ -309,6 +309,25 @@ function handleConsoleMessages(page, onError, onWarning) {
309
309
  if (typeof obj === "string") {
310
310
  // Old ReSpec versions might report errors as strings.
311
311
  return JSON.stringify({ message: String(obj) });
312
+ } else if (obj instanceof Error && !obj.plugin) {
313
+ let cause;
314
+ if (obj.cause instanceof Error) {
315
+ cause = {
316
+ name: obj.cause.name,
317
+ message: obj.cause.message,
318
+ stack: obj.cause.stack,
319
+ };
320
+ }
321
+ return JSON.stringify({
322
+ message: obj.message,
323
+ plugin: "unknown",
324
+ name: obj.name,
325
+ cause,
326
+ stack: obj.stack?.replace(
327
+ obj.message,
328
+ `${obj.message.slice(0, 30)}…`
329
+ ),
330
+ });
312
331
  } else {
313
332
  // Ideally: `obj instanceof RsError` and `RsError instanceof Error`.
314
333
  return JSON.stringify(obj);
@@ -335,6 +354,7 @@ function handleConsoleMessages(page, onError, onWarning) {
335
354
  switch (type) {
336
355
  case "error":
337
356
  return onError(JSON.parse(text));
357
+ case "warn":
338
358
  case "warning":
339
359
  return onWarning(JSON.parse(text));
340
360
  }