Skip to content

Commit 58d8571

Browse files
authored
fix: disable wasm highlighter for big endian platforms (#769)
1 parent 3d00fa8 commit 58d8571

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@node-core/doc-kit",
33
"type": "module",
4-
"version": "1.3.3",
4+
"version": "1.3.4",
55
"repository": {
66
"type": "git",
77
"url": "git+https://github.com/nodejs/doc-kit.git"

src/utils/highlighter.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
import { endianness } from 'node:os';
4+
35
import createHighlighter from '@node-core/rehype-shiki';
46
import { h as createElement } from 'hastscript';
57
import { SKIP, visit } from 'unist-util-visit';
@@ -40,7 +42,10 @@ export const highlighter = await createHighlighter({
4042
// riscv64 with sv39 has limited virtual memory space, where creating
4143
// too many (>20) wasm memory instances fails.
4244
// https://github.com/nodejs/node/pull/60591
43-
wasm: process.arch !== 'riscv64',
45+
//
46+
// The wasm highlighter is currently not compatible with big endian.
47+
// https://github.com/nodejs/node/pull/62512#issuecomment-4243469950
48+
wasm: process.arch !== 'riscv64' && endianness() === 'LE',
4449
});
4550

4651
/**

0 commit comments

Comments
 (0)