mausmark 0.4.0 → 0.4.1

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/README.md CHANGED
@@ -100,7 +100,7 @@ output images, you don't need to change anything.
100
100
  description with `joinedText(index)`.
101
101
  - CommonMark image descriptions should be read the same way; they are
102
102
  plain text now. A reference inside one stays a LINK or IMAGE node
103
- for your renderer to resolve; see `altText()` in `dom-example.js`.
103
+ for your renderer to resolve.
104
104
 
105
105
  For more details, see the [release notes](RELEASE-NOTES.md).
106
106
 
@@ -147,13 +147,8 @@ HTML, custom nodes, list markers, and entity decoding:
147
147
  const parser = await createParser()
148
148
  console.log(plainText(parser.parse("# Hello\n\nA **wrapped** paragraph.")))
149
149
 
150
- For a complete renderer, the package includes `dom-example.js`. It
151
- builds DOM nodes directly: text goes in through text nodes and
152
- attributes through `setAttribute`, so it never has to escape HTML by
153
- hand. It covers every node type, including entity decoding, reference
154
- lookup, tight lists, fence info strings and image alt text, and it
155
- leaves raw HTML inert. It is an example, not an export: copy it and
156
- adapt it.
150
+ For a starting point that renders to the DOM, the package includes
151
+ `dom-example.js`, an incomplete renderer meant to be copied and adapted.
157
152
 
158
153
  Things to decide when building a richer renderer:
159
154
 
package/RELEASE-NOTES.md CHANGED
@@ -1,14 +1,25 @@
1
+ # Mausmark v0.4.1
2
+
3
+ - Simplified the DOM renderer example and fixed rendering of email
4
+ autolinks and literal-text line joins.
5
+ - Fixed: Node and browser bindings preserve a leading UTF-8 BOM when
6
+ decoding source ranges instead of silently stripping it.
7
+ - Faster emphasis classification in native ARM64 builds.
8
+ - Added real-browser regression coverage and browser benchmark
9
+ tooling.
10
+ - Package exports and WASM ABI remain unchanged.
11
+
1
12
  # Mausmark v0.4.0
2
13
 
3
14
  - Image descriptions are alt text, not inline formatting. CommonMark
4
- keeps the text between the markup (`![a *b*](/i)` → `a b`);
5
- Markdown keeps the literal source, one chunk per line. Reference nodes
6
- remain until the renderer resolves them or restores literal brackets.
15
+ keeps the text between the markup (`![a *b*](/i)` → `a b`); Markdown
16
+ keeps the literal source, one chunk per line. Reference nodes remain
17
+ until the renderer resolves them or restores literal brackets.
7
18
  - Image descriptions nested deeper than 32 levels now stay literal.
8
- - New `mausmark/references` export: `normalizeReferenceLabel(label,
9
- 'markdown' | 'commonmark')`.
10
- - DOM example: `renderToDom(doc, parent, {referenceMatching})`, explicit
11
- empty titles, entities decoded in alt text.
19
+ - New `mausmark/references` export:
20
+ `normalizeReferenceLabel(label, 'markdown' | 'commonmark')`.
21
+ - DOM example: `renderToDom(doc, parent, {referenceMatching})`,
22
+ explicit empty titles, entities decoded in alt text.
12
23
  - Fixed: CommonMark list markers indented four or more columns no
13
24
  longer interrupt a paragraph.
14
25
  - Fixed: an HTML block or fence on a line without `>` ends the
package/dist/core.js CHANGED
@@ -5,7 +5,7 @@ const ALIGNMENT = 16;
5
5
  const MAX_INPUT_BYTES = 64 * 1024 * 1024;
6
6
  const MAX_ARENA_BYTES = 512 * 1024 * 1024;
7
7
  const MAX_WASM_ADDRESS = 0x7fffffff;
8
- const decoder = new TextDecoder();
8
+ const decoder = new TextDecoder('utf-8', { ignoreBOM: true });
9
9
  function align(value) {
10
10
  if (!Number.isSafeInteger(value) || value < 0 || value > MAX_WASM_ADDRESS - (ALIGNMENT - 1)) {
11
11
  throw new Error('mausmark: invalid WASM heap base');
package/dist/node.js CHANGED
@@ -7,10 +7,6 @@ function createSourceDecoder(source) {
7
7
  const buffer = Buffer.from(source.buffer, source.byteOffset, source.byteLength);
8
8
  return (offset, length) => {
9
9
  const end = offset + length;
10
- // TextDecoder removes a leading UTF-8 BOM from each decoded range.
11
- if (length >= 3 && buffer[offset] === 0xef && buffer[offset + 1] === 0xbb && buffer[offset + 2] === 0xbf) {
12
- offset += 3;
13
- }
14
10
  return buffer.toString('utf8', offset, end);
15
11
  };
16
12
  }
package/dom-example.js CHANGED
@@ -1,4 +1,6 @@
1
- // A small Markdown-to-DOM renderer over a mausmark document. Copy it and adapt it.
1
+ // A small DOM renderer showing how to walk the tree. It is a starting point,
2
+ // not a package export or a complete renderer: copy it and tweak the
3
+ // node-to-element switch.
2
4
  //
3
5
  // import {createParser} from "mausmark"
4
6
  // import {renderToDom} from "./dom-example.js"
@@ -6,27 +8,44 @@
6
8
  // const parser = await createParser()
7
9
  // renderToDom(parser.parse(markdown), document.querySelector("article"))
8
10
  //
9
- // Text goes in through text nodes and attributes through setAttribute, so
10
- // nothing here escapes HTML by hand. That removes escaping, not policy: with
11
- // untrusted input you still decide which URL schemes to allow (`javascript:`
12
- // passes through as written) and what to do with raw HTML (shown as text here).
11
+ // Code goes in through textContent, mixed content through text nodes, and
12
+ // link/image fields through setAttribute, so nothing is escaped by hand.
13
+ //
14
+ // Limitations:
15
+ // - Reference labels match with toLowerCase(), not Unicode case folding and
16
+ // whitespace collapse; see normalizeReferenceLabel in mausmark/references.
17
+ // - Image descriptions are read as plain text; a reference nested in one is
18
+ // not resolved.
19
+ // - Empty and absent titles are both omitted.
20
+ // - Entities and backslash escapes are not decoded.
21
+ // - No URL-scheme policy: javascript: URLs pass through to href/src. Add one
22
+ // before rendering untrusted input.
13
23
 
14
24
  import {Join, ListFlags, NodeType, ReferenceStyle} from "mausmark";
15
- import {normalizeReferenceLabel} from "mausmark/references";
16
25
 
17
26
  /** @import {MausmarkDocument} from "mausmark" */
18
- /** @import {ReferenceMatching} from "mausmark/references" */
27
+ /** @import {LinkFields} from "mausmark" */
19
28
 
20
29
  /**
21
- * Append the rendered document to `parent`.
30
+ * Append the rendered document to `parent`, leaving existing content intact.
22
31
  * @param {MausmarkDocument} doc
23
32
  * @param {ParentNode} parent
24
- * @param {{referenceMatching?: ReferenceMatching}} options Renderer lookup policy,
25
- * independent of the input dialect. Defaults to original Markdown matching.
26
33
  */
27
- export function renderToDom(doc, parent, {referenceMatching = "markdown"} = {}) {
28
- normalizeReferenceLabel("", referenceMatching); // validate even a reference-free document
29
- const definitions = collectDefinitions(doc, referenceMatching);
34
+ export function renderToDom(doc, parent) {
35
+ /** @type {Record<string, LinkFields>} */
36
+ const references = Object.create(null);
37
+ for (let index = 0; index < doc.nodeCount; index += 1) {
38
+ if (doc.type(index) !== NodeType.REF_DEF) continue;
39
+ const link = doc.link(index);
40
+ references[link.label.toLowerCase()] ??= link; // first definition wins
41
+ }
42
+
43
+ /** @param {string} text @param {ParentNode} into */
44
+ function text(text, into) {
45
+ if (text) {
46
+ into.appendChild(document.createTextNode(text));
47
+ }
48
+ }
30
49
 
31
50
  /** @param {number} index @param {ParentNode} into */
32
51
  function children(index, into) {
@@ -39,152 +58,179 @@ export function renderToDom(doc, parent, {referenceMatching = "markdown"} = {})
39
58
  function element(tag, index, into) {
40
59
  const el = document.createElement(tag);
41
60
  children(index, el);
42
- into.append(el);
61
+ into.appendChild(el);
43
62
  return el;
44
63
  }
45
64
 
46
- // An undefined reference is not a link: put its brackets back as text.
47
- /** @param {number} index @param {ParentNode} into */
48
- function literalReference(index, into) {
49
- const {label, style} = doc.link(index);
50
- if (doc.type(index) === NodeType.IMAGE) {
51
- into.append("![" + altText(doc, index, definitions, referenceMatching));
52
- } else {
53
- into.append("[");
54
- children(index, into);
55
- }
56
- into.append("]");
57
- if (style === ReferenceStyle.FULL) {
58
- into.append("[" + unescapeLink(label) + "]");
59
- } else if (style === ReferenceStyle.COLLAPSED) {
60
- into.append("[]");
61
- }
62
- }
63
-
64
65
  /** @param {number} index @param {ParentNode} into */
65
66
  function render(index, into) {
66
67
  switch (doc.type(index)) {
68
+
67
69
  case NodeType.DOC:
68
70
  case NodeType.SPAN:
69
71
  children(index, into);
70
72
  return;
73
+
71
74
  case NodeType.BRACE_SPAN:
72
- // Remove these two append calls to omit delimiters. Alternatively,
73
- // interpret doc.text(index) yourself and skip children entirely.
74
- into.append("{");
75
+ // Omit the delimiters for a transparent container, or interpret
76
+ // doc.text(index) yourself instead of traversing the children.
77
+ text("{", into);
75
78
  children(index, into);
76
- into.append("}");
79
+ text("}", into);
77
80
  return;
81
+
78
82
  case NodeType.PARAGRAPH:
79
83
  element("p", index, into);
80
84
  return;
85
+
81
86
  case NodeType.HEADING:
82
87
  element("h" + doc.level(index), index, into);
83
88
  return;
89
+
84
90
  case NodeType.BLOCKQUOTE:
85
91
  element("blockquote", index, into);
86
92
  return;
93
+
87
94
  case NodeType.LIST: {
88
- const list = element(doc.flags(index) & ListFlags.ORDERED ? "ol" : "ul", index, into);
89
- // The start number's digits; empty in the Markdown dialect, where it has no meaning.
95
+ const list = element((doc.flags(index) & ListFlags.ORDERED) ? "ol" : "ul", index, into);
96
+ // CommonMark ordered lists retain their starting digits.
90
97
  const start = doc.text(index);
91
98
  if (start !== "" && Number(start) !== 1) {
92
99
  list.setAttribute("start", String(Number(start)));
93
100
  }
94
101
  return;
95
102
  }
103
+
96
104
  case NodeType.LIST_ITEM: {
97
105
  const item = document.createElement("li");
98
- const loose = doc.flags(index) & ListFlags.LOOSE;
99
106
  for (const child of doc.children(index)) {
100
- // A tight item's paragraphs render without <p> wrappers.
101
- if (!loose && doc.type(child) === NodeType.PARAGRAPH) {
107
+ // Tight lists omit paragraph wrappers inside each item.
108
+ if (!(doc.flags(index) & ListFlags.LOOSE) && doc.type(child) === NodeType.PARAGRAPH) {
102
109
  children(child, item);
103
110
  } else {
104
111
  render(child, item);
105
112
  }
106
113
  }
107
- into.append(item);
114
+ into.appendChild(item);
108
115
  return;
109
116
  }
117
+
110
118
  case NodeType.CODE_BLOCK: {
111
119
  const code = document.createElement("code");
112
- // A fenced block's info string is its leading LABEL field, which
113
- // children() and joinedText() skip.
114
- const hasInfo = index + 1 < doc.subtreeEnd(index) && doc.type(index + 1) === NodeType.LABEL;
115
- const language = hasInfo ? decodeEntities(doc.joinedText(index + 1)).trim().split(/\s+/)[0] : "";
116
- if (language) {
117
- code.className = "language-" + language;
120
+
121
+ // A fenced block's leading LABEL field holds its info string.
122
+ {
123
+ const hasInfo = (index + 1 < doc.subtreeEnd(index)) && (doc.type(index + 1) === NodeType.LABEL);
124
+ const language = (
125
+ hasInfo
126
+ ? doc.joinedText(index + 1).trim().split(/\s+/)[0]
127
+ : ""
128
+ );
129
+ if (language) {
130
+ code.className = "language-" + language;
131
+ }
118
132
  }
119
- code.append(doc.joinedText(index));
133
+
134
+ code.textContent = doc.joinedText(index);
120
135
  const pre = document.createElement("pre");
121
- pre.append(code);
122
- into.append(pre);
136
+ pre.appendChild(code);
137
+ into.appendChild(pre);
123
138
  return;
124
139
  }
140
+
141
+ case NodeType.CODE_SPAN: {
142
+ const code = document.createElement("code");
143
+ code.textContent = doc.joinedText(index);
144
+ into.appendChild(code);
145
+ return;
146
+ }
147
+
125
148
  case NodeType.THEMATIC_BREAK:
126
- into.append(document.createElement("hr"));
149
+ into.appendChild(document.createElement("hr"));
127
150
  return;
151
+
128
152
  case NodeType.EMPH:
129
153
  element("em", index, into);
130
154
  return;
155
+
131
156
  case NodeType.STRONG:
132
157
  element("strong", index, into);
133
158
  return;
134
- case NodeType.CODE_SPAN: {
135
- const code = document.createElement("code");
136
- code.append(doc.joinedText(index));
137
- into.append(code);
138
- return;
139
- }
140
- case NodeType.LINK: {
141
- const target = resolve(doc, index, definitions, referenceMatching);
142
- if (!target) {
143
- literalReference(index, into);
144
- return;
145
- }
146
- const a = document.createElement("a");
147
- a.setAttribute("href", target.url);
148
- if (target.titlePresent) {
149
- a.setAttribute("title", target.title);
150
- }
151
- children(index, a);
152
- into.append(a);
153
- return;
154
- }
159
+
160
+ case NodeType.LINK:
155
161
  case NodeType.IMAGE: {
156
- const target = resolve(doc, index, definitions, referenceMatching);
162
+ const image = doc.type(index) === NodeType.IMAGE;
163
+ const raw = doc.link(index);
164
+ const {style} = raw;
165
+ const isReference = style === ReferenceStyle.FULL || style === ReferenceStyle.COLLAPSED || style === ReferenceStyle.SHORTCUT;
166
+ const target = (
167
+ isReference
168
+ ? references[raw.label.toLowerCase()]
169
+ : raw
170
+ );
171
+
157
172
  if (!target) {
158
- literalReference(index, into);
173
+ // An undefined reference is not a link: put its brackets back as text.
174
+ if (image) {
175
+ text("![" + doc.joinedText(index), into);
176
+ } else {
177
+ text("[", into);
178
+ children(index, into);
179
+ }
180
+ text(
181
+ (
182
+ style === ReferenceStyle.FULL
183
+ ? "][" + raw.label + "]"
184
+ : (
185
+ style === ReferenceStyle.COLLAPSED
186
+ ? "][]"
187
+ : "]"
188
+ )
189
+ ),
190
+ into
191
+ );
159
192
  return;
160
193
  }
161
- const img = document.createElement("img");
162
- img.setAttribute("src", target.url);
163
- img.setAttribute("alt", altText(doc, index, definitions, referenceMatching));
164
- if (target.titlePresent) {
165
- img.setAttribute("title", target.title);
194
+
195
+ const {url, title} = target;
196
+ const el = document.createElement(image ? "img" : "a");
197
+ el.setAttribute(
198
+ image ? "src" : "href",
199
+ (
200
+ style === ReferenceStyle.AUTOLINK_EMAIL
201
+ ? "mailto:" + url
202
+ : url
203
+ )
204
+ );
205
+
206
+ if (title) el.setAttribute("title", title);
207
+
208
+ if (image) {
209
+ el.setAttribute("alt", doc.joinedText(index));
210
+ } else {
211
+ children(index, el);
166
212
  }
167
- into.append(img);
213
+
214
+ into.appendChild(el);
168
215
  return;
169
216
  }
217
+
170
218
  case NodeType.HTML_BLOCK:
171
219
  case NodeType.HTML_INLINE:
172
- // Raw HTML stays inert text. To render trusted HTML instead, parse
173
- // joinedText() with a <template> element, after sanitizing it.
174
- into.append(doc.joinedText(index));
175
- return;
176
220
  case NodeType.CUSTOM:
177
- // A raw multiline custom block: yours to interpret.
178
- into.append(doc.joinedText(index));
221
+ // Other source-backed content stays text; customize as needed.
222
+ text(doc.joinedText(index), into);
179
223
  return;
224
+
180
225
  case NodeType.TEXT:
181
- into.append(joinPrefix(doc.level(index)) + decodeEntities(doc.text(index)));
182
- return;
183
- case NodeType.LITERAL_TEXT:
184
- into.append(doc.text(index)); // must not be entity-decoded
226
+ case NodeType.LITERAL_TEXT: {
227
+ const join = doc.level(index);
228
+ text((join === Join.NL ? "\n" : (join === Join.SPACE ? " " : "")) + doc.text(index), into);
185
229
  return;
230
+ }
231
+
186
232
  case NodeType.HARD_BREAK:
187
- into.append(document.createElement("br"));
233
+ into.appendChild(document.createElement("br"));
188
234
  return;
189
235
  // REF_DEFS and REF_DEF produce no output.
190
236
  }
@@ -192,136 +238,3 @@ export function renderToDom(doc, parent, {referenceMatching = "markdown"} = {})
192
238
 
193
239
  render(0, parent);
194
240
  }
195
-
196
- // A text chunk's join code is what comes before it: Join.NL is a soft line break.
197
- /** @param {number} join */
198
- function joinPrefix(join) {
199
- return join === Join.NL ? "\n" : join === Join.SPACE ? " " : "";
200
- }
201
-
202
- // A <textarea>'s content is RCDATA: assigning innerHTML decodes character
203
- // references but never creates elements, whatever the input.
204
- /** @param {string} text */
205
- function decodeEntities(text) {
206
- if (!text.includes("&")) {
207
- return text;
208
- }
209
- const area = document.createElement("textarea");
210
- area.innerHTML = text;
211
- return area.value;
212
- }
213
-
214
- // An image description is alt text held as chunks: the literal source in
215
- // Markdown, the text between the markup in CommonMark. Chunks follow the text
216
- // rule above: TEXT decodes entities, LITERAL_TEXT (an escaped `&`, code, inline
217
- // HTML) does not. Reference nodes remain until the renderer resolves them.
218
- /**
219
- * @param {MausmarkDocument} doc
220
- * @param {number} index
221
- * @param {Map<string, {url: string, title: string, titlePresent: boolean}>} definitions
222
- * @param {ReferenceMatching} matching
223
- * @returns {string}
224
- */
225
- function altText(doc, index, definitions, matching) {
226
- let text = "", run = "", end = -1;
227
- function flush() { text += decodeEntities(run); run = ""; }
228
- for (const child of doc.children(index)) {
229
- const type = doc.type(child);
230
- if (type === NodeType.TEXT) {
231
- if (doc.level(child) !== Join.NONE || doc.offset(child) !== end) flush();
232
- run += joinPrefix(doc.level(child)) + doc.text(child);
233
- end = doc.offset(child) + doc.length(child);
234
- } else {
235
- flush(); end = -1;
236
- if (type === NodeType.LINK || type === NodeType.IMAGE) {
237
- const content = altText(doc, child, definitions, matching);
238
- if (resolve(doc, child, definitions, matching)) text += content;
239
- else {
240
- const {label, style} = doc.link(child);
241
- text += (type === NodeType.IMAGE ? "![" : "[") + content + "]";
242
- if (style === ReferenceStyle.FULL) text += "[" + unescapeLink(label) + "]";
243
- else if (style === ReferenceStyle.COLLAPSED) text += "[]";
244
- }
245
- } else text += joinPrefix(doc.level(child)) + doc.text(child);
246
- }
247
- }
248
- flush();
249
- return text;
250
- }
251
-
252
- // link().title is '' for both absent and empty titles; the leading field run
253
- // preserves that distinction. Do not inspect nested content for title fields.
254
- /** @param {MausmarkDocument} doc @param {number} index */
255
- function titlePresent(doc, index) {
256
- for (let child = index + 1; child < doc.subtreeEnd(index); child = doc.subtreeEnd(child)) {
257
- const type = doc.type(child);
258
- if (type === NodeType.TITLE) return true;
259
- if (type !== NodeType.URL && type !== NodeType.LABEL) break;
260
- }
261
- return false;
262
- }
263
-
264
- // Reference links arrive unresolved. Definitions can sit anywhere, including
265
- // inside lists and quotes, so scan every node; the first definition of a label wins.
266
- /** @param {MausmarkDocument} doc @param {ReferenceMatching} matching */
267
- function collectDefinitions(doc, matching) {
268
- /** @type {Map<string, {url: string, title: string, titlePresent: boolean}>} */
269
- const definitions = new Map();
270
- for (let index = 0; index < doc.nodeCount; index += 1) {
271
- if (doc.type(index) !== NodeType.REF_DEF) continue;
272
-
273
- const {label, url, title} = doc.link(index);
274
- const key = normalizeReferenceLabel(label, matching);
275
- if (key === null) continue;
276
- if (!definitions.has(key)) {
277
- definitions.set(key, {url, title, titlePresent: titlePresent(doc, index)});
278
- }
279
- }
280
- return definitions;
281
- }
282
-
283
- // Where a LINK or IMAGE points, or null for a reference with no definition.
284
- /**
285
- * @param {MausmarkDocument} doc
286
- * @param {number} index
287
- * @param {Map<string, {url: string, title: string, titlePresent: boolean}>} definitions
288
- * @param {ReferenceMatching} matching
289
- */
290
- function resolve(doc, index, definitions, matching) {
291
- const {url, title, label, style} = doc.link(index);
292
- // Autolinks take entities but no backslash escapes.
293
- if (style === ReferenceStyle.AUTOLINK_EMAIL) {
294
- return {
295
- url: "mailto:" + decodeEntities(url),
296
- title: "", titlePresent: false
297
- };
298
- }
299
- if (style === ReferenceStyle.AUTOLINK_URI) {
300
- return {
301
- url: decodeEntities(url),
302
- title: "", titlePresent: false
303
- };
304
- }
305
- if (style === ReferenceStyle.INLINE) {
306
- return {
307
- url: unescapeLink(url),
308
- title: unescapeLink(title), titlePresent: titlePresent(doc, index)
309
- };
310
- }
311
- const key = normalizeReferenceLabel(label, matching);
312
- const definition = key === null ? undefined : definitions.get(key);
313
- if (!definition) return null;
314
-
315
- return {
316
- url: unescapeLink(definition.url),
317
- title: unescapeLink(definition.title), titlePresent: definition.titlePresent
318
- };
319
- }
320
-
321
- // Fields are raw source. This renderer decodes entities before resolving
322
- // backslash escapes; the browser percent-encodes URLs when it resolves them.
323
- // Keeping interpretation here leaves the AST lossless for other consumers.
324
- /** @param {string} text */
325
- function unescapeLink(text) {
326
- return decodeEntities(text).replace(/\\([!-/:-@[-`{-~])/g, "$1");
327
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mausmark",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "A fast, dependency-free Markdown parser compiled to WebAssembly",
5
5
  "type": "module",
6
6
  "exports": {
@@ -32,15 +32,18 @@
32
32
  "build:js": "./build.sh codegen && tsc -p tsconfig.json",
33
33
  "build": "npm run clean && npm run build:wasm && npm run build:js",
34
34
  "check:wasm-size": "node test/wasm_size.mjs",
35
- "test:package": "node --test test/npm-package.test.mjs test/wasm-size.test.mjs test/source-retention.test.mjs test/test-registration.test.mjs test/reference-matching.test.mjs",
35
+ "test:package": "node --test test/npm-package.test.mjs test/dom-example.test.mjs test/text-decoding.test.mjs test/webdriver.test.mjs test/browser-benchmark.test.mjs test/wasm-size.test.mjs test/source-retention.test.mjs test/test-registration.test.mjs test/reference-matching.test.mjs",
36
36
  "test:types": "tsc -p tsconfig.test.json --noEmit && tsc -p tsconfig.references.json",
37
+ "test:browser": "node test/browser/run.mjs",
38
+ "bench:browser": "npm run build && ./build.sh wasm && node benchmark/browser/run.mjs",
39
+ "setup:chrome": "node test/browser/setup-chrome.mjs",
37
40
  "test:layers": "node --test test/layers.test.mjs",
38
41
  "test:build": "node --test test/build.test.mjs",
39
42
  "check:unicode": "node tools/unicode.mjs --check && node tools/case-fold.mjs --check",
40
43
  "test:unicode": "node --test test/unicode.test.mjs test/case-fold.test.mjs",
41
44
  "check:entities": "node tools/entities.mjs --check",
42
45
  "test:entities": "node --test test/entities.test.mjs",
43
- "test": "npm run test:build && npm run test:layers && npm run build && npm run check:wasm-size && npm run test:package && npm run test:types",
46
+ "test": "npm run test:build && npm run test:layers && npm run build && npm run check:wasm-size && npm run test:package && npm run test:types && npm run test:browser",
44
47
  "prepack": "npm test"
45
48
  },
46
49
  "engines": {