respec 35.9.0 → 36.0.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.
@@ -1,4 +1,4 @@
1
- // ReSpec Worker v1.0.0
1
+ // ReSpec Worker
2
2
  // hljs is either inlined by core/worker.js (preferred) or loaded below via
3
3
  // importScripts as a fallback when the inline fetch was not possible.
4
4
  if (typeof self.hljs === "undefined" && self.RESPEC_HIGHLIGHT_URL) {
@@ -9,28 +9,16 @@ if (typeof self.hljs === "undefined" && self.RESPEC_HIGHLIGHT_URL) {
9
9
  }
10
10
  }
11
11
 
12
- self.addEventListener("message", ({ data: originalData }) => {
13
- const data = Object.assign({}, originalData);
14
- switch (data.action) {
15
- case "highlight-load-lang": {
16
- const { langURL, propName, lang } = data;
17
- importScripts(langURL);
18
- self.hljs.registerLanguage(lang, self[propName]);
19
- break;
20
- }
21
- case "highlight": {
22
- const { code } = data;
23
- const langs = data.languages.length ? data.languages : undefined;
24
- try {
25
- const { value, language } = self.hljs.highlightAuto(code, langs);
26
- Object.assign(data, { value, language });
27
- } catch (err) {
28
- console.error("Could not transform some code?", err);
29
- // Post back the original code
30
- Object.assign(data, { value: code, language: "" });
31
- }
32
- break;
33
- }
12
+ self.addEventListener("message", ({ data }) => {
13
+ if (data.action !== "highlight") return;
14
+ const { code } = data;
15
+ const langs = data.languages?.length ? data.languages : undefined;
16
+ try {
17
+ const { value, language } = self.hljs.highlightAuto(code, langs);
18
+ Object.assign(data, { value, language });
19
+ } catch (err) {
20
+ console.error("Could not transform some code?", err);
21
+ Object.assign(data, { value: code, language: "" });
34
22
  }
35
23
  self.postMessage(data);
36
24
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "respec",
3
- "version": "35.9.0",
3
+ "version": "36.0.0",
4
4
  "license": "W3C",
5
5
  "description": "A technical specification pre-processor.",
6
6
  "engines": {
@@ -24,13 +24,13 @@
24
24
  "Robin Berjon"
25
25
  ],
26
26
  "devDependencies": {
27
- "@rollup/plugin-alias": "^5.1.1",
27
+ "@eslint/js": "^9.8.0",
28
28
  "@rollup/plugin-commonjs": "^29.0.2",
29
29
  "@rollup/plugin-node-resolve": "^16.0.3",
30
30
  "@rollup/plugin-terser": "^1.0.0",
31
31
  "@types/pluralize": "0.0.33",
32
- "@eslint/js": "^9.8.0",
33
32
  "boxen": "^8.0.1",
33
+ "cddlparser": "^0.6.0",
34
34
  "chokidar": "^5.0.0",
35
35
  "clean-css": "^5.3.3",
36
36
  "epipebomb": "^1.0.0",
@@ -39,12 +39,12 @@
39
39
  "eslint-plugin-import": "^2.32.0",
40
40
  "eslint-plugin-jasmine": "^4.2.2",
41
41
  "eslint-plugin-prettier": "^5.5.5",
42
- "globals": "^16.0.0",
42
+ "globals": "^17.5.0",
43
43
  "highlight.js": "^11.11.1",
44
44
  "hyperhtml": "^2.34.2",
45
45
  "idb": "^8.0.3",
46
- "jasmine": "^6.1.0",
47
- "jasmine-core": "^6.1.0",
46
+ "jasmine": "^6.2.0",
47
+ "jasmine-core": "^6.2.0",
48
48
  "karma": "^6.4.4",
49
49
  "karma-chrome-launcher": "^3.2.0",
50
50
  "karma-firefox-launcher": "^2.1.3",
@@ -52,17 +52,19 @@
52
52
  "karma-jasmine-html-reporter": "^2.2.0",
53
53
  "karma-mocha-reporter": "^2.2.5",
54
54
  "karma-safari-launcher": "^1.0.0",
55
+ "lint-staged": "^16.4.0",
55
56
  "loading-indicator": "^2.0.0",
56
57
  "pluralize": "^8.0.0",
57
- "prettier": "^3.8.1",
58
+ "prettier": "^3.8.2",
58
59
  "prompt": "^1.3.0",
59
- "rollup": "^4.59.0",
60
+ "rollup": "^4.60.1",
60
61
  "rollup-plugin-minify-html-literals": "^1.2.6",
61
- "serve": "^14.2.5",
62
+ "serve": "^14.2.6",
62
63
  "serve-handler": "^6.1.7",
64
+ "simple-git-hooks": "^2.13.1",
63
65
  "sniffy-mimetype": "^1.1.1",
64
- "typescript": "^5.9.3",
65
- "vnu-jar": "^26.3.8",
66
+ "typescript": "^6.0.3",
67
+ "vnu-jar": "^26.4.11",
66
68
  "webidl2": "^24.5.0"
67
69
  },
68
70
  "scripts": {
@@ -76,7 +78,7 @@
76
78
  "build:dini": "pnpm builder dini",
77
79
  "builddeps": "rollup -c js/deps/rollup.config.js --bundleConfigAsCjs && rollup -c worker/rollup.config.js --bundleConfigAsCjs",
78
80
  "lint": "tsc -p src/jsconfig.json && eslint .",
79
- "prepare": "pnpm builddeps",
81
+ "prepare": "pnpm builddeps && simple-git-hooks",
80
82
  "builder": "node ./tools/builder.cjs",
81
83
  "release": "node ./tools/release.cjs",
82
84
  "server": "serve",
@@ -90,8 +92,8 @@
90
92
  "dependencies": {
91
93
  "colors": "1.4.0",
92
94
  "finalhandler": "^2.1.1",
93
- "marked": "^16.3.0",
94
- "puppeteer": "^24.37.5",
95
+ "marked": "^18.0.0",
96
+ "puppeteer": "^24.40.0",
95
97
  "sade": "^1.8.1",
96
98
  "serve-static": "^2.2.1"
97
99
  },
@@ -100,17 +102,43 @@
100
102
  "tools/respec2html.js",
101
103
  "tools/respecDocWriter.js"
102
104
  ],
105
+ "simple-git-hooks": {
106
+ "pre-commit": "npx lint-staged"
107
+ },
108
+ "lint-staged": {
109
+ "*.js": "eslint --fix",
110
+ "*.{js,json,md,html,css}": "prettier --write"
111
+ },
103
112
  "prettier": {
104
113
  "trailingComma": "es5",
105
114
  "arrowParens": "avoid"
106
115
  },
107
116
  "pnpm": {
108
117
  "onlyBuiltDependencies": [
109
- "puppeteer"
118
+ "puppeteer",
119
+ "simple-git-hooks"
110
120
  ],
111
121
  "ignoredBuiltDependencies": [
112
122
  "vnu-jar"
113
- ]
123
+ ],
124
+ "overrides": {
125
+ "flatted": ">=3.4.2",
126
+ "jasmine>glob": ">=10.5.0",
127
+ "lodash": ">=4.18.0",
128
+ "qs": ">=6.14.2",
129
+ "socket.io-parser": ">=4.2.6",
130
+ "tmp": ">=0.2.4",
131
+ "ws": ">=8.17.1",
132
+ "eslint-plugin-import>minimatch": "^3.1.4",
133
+ "eslint>minimatch": "^3.1.4",
134
+ "eslint>brace-expansion": "^1.1.13",
135
+ "minimatch>brace-expansion": "^1.1.13",
136
+ "karma>minimatch": "^3.1.4",
137
+ "jasmine>minimatch": "^9.0.7",
138
+ "@rollup/pluginutils>picomatch": "^2.3.2",
139
+ "@rollup/plugin-commonjs>picomatch": "^4.0.4",
140
+ "anymatch>picomatch": "^2.3.2"
141
+ }
114
142
  },
115
143
  "funding": {
116
144
  "type": "opencollective",
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFile, writeFile } from "fs/promises";
3
3
  import colors from "colors";
4
- import { fileURLToPath } from "url";
5
4
  import finalhandler from "finalhandler";
6
5
  import http from "http";
7
6
  import { marked } from "marked";
@@ -10,7 +9,7 @@ import sade from "sade";
10
9
  import serveStatic from "serve-static";
11
10
  import { toHTML } from "./respecDocWriter.js";
12
11
 
13
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
+ const __dirname = import.meta.dirname;
14
13
 
15
14
  class Renderer extends marked.Renderer {
16
15
  strong(token) {
@@ -1,13 +1,10 @@
1
1
  /**
2
2
  * Exports toHTML() method, allowing programmatic control of the spec generator.
3
3
  */
4
- import { fileURLToPath } from "url";
5
4
  import path from "path";
6
5
  import puppeteer from "puppeteer";
7
6
  import { readFile } from "fs/promises";
8
7
 
9
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
-
11
8
  const noop = () => {};
12
9
 
13
10
  /**
@@ -142,7 +139,12 @@ async function useLocalReSpec(page, log) {
142
139
  const url = new URL(request.url());
143
140
  const respecProfileRegex = /\/(respec-[\w-]+)(?:\.js)?$/;
144
141
  const profile = url.pathname.match(respecProfileRegex)[1];
145
- const localPath = path.join(__dirname, "..", "builds", `${profile}.js`);
142
+ const localPath = path.join(
143
+ import.meta.dirname,
144
+ "..",
145
+ "builds",
146
+ `${profile}.js`
147
+ );
146
148
  const relPath = path.relative(process.cwd(), localPath);
147
149
  log(`Intercepted ${url} to respond with ${relPath}`);
148
150
  await request.respond({
@@ -276,7 +278,7 @@ async function evaluateHTML(version, timer) {
276
278
  return new Promise((resolve, reject) => {
277
279
  promise.then(resolve, reject);
278
280
  const msg = `Timeout: document.respec.ready didn't resolve in ${ms}ms.`;
279
- setTimeout(() => reject(msg), ms);
281
+ setTimeout(() => reject(new Error(msg)), ms);
280
282
  });
281
283
  }
282
284
  }