@shikijs/core 1.5.0 → 1.5.2
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/dist/index.mjs +9 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1178,6 +1178,7 @@ function splitWhitespaceTokens(tokens) {
|
|
|
1178
1178
|
return line.flatMap((token) => {
|
|
1179
1179
|
if (token.content.match(/^\s+$/))
|
|
1180
1180
|
return token;
|
|
1181
|
+
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
|
1181
1182
|
const match = token.content.match(/^(\s*)(.*?)(\s*)$/);
|
|
1182
1183
|
if (!match)
|
|
1183
1184
|
return token;
|
|
@@ -4979,6 +4980,14 @@ function loadWasm(options) {
|
|
|
4979
4980
|
else if (isArrayBuffer(instance)) {
|
|
4980
4981
|
instance = await _makeArrayBufferLoader(instance)(info);
|
|
4981
4982
|
}
|
|
4983
|
+
// import("shiki/onig.wasm") returns `{ default: WebAssembly.Module }` on cloudflare workers
|
|
4984
|
+
// https://developers.cloudflare.com/workers/wrangler/bundling/
|
|
4985
|
+
else if (instance instanceof WebAssembly.Module) {
|
|
4986
|
+
instance = await _makeArrayBufferLoader(instance)(info);
|
|
4987
|
+
}
|
|
4988
|
+
else if ('default' in instance && instance.default instanceof WebAssembly.Module) {
|
|
4989
|
+
instance = await _makeArrayBufferLoader(instance.default)(info);
|
|
4990
|
+
}
|
|
4982
4991
|
}
|
|
4983
4992
|
if ('instance' in instance)
|
|
4984
4993
|
instance = instance.instance;
|