@shikijs/core 1.5.0 → 1.5.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.
Files changed (2) hide show
  1. package/dist/index.mjs +8 -0
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -4979,6 +4979,14 @@ function loadWasm(options) {
4979
4979
  else if (isArrayBuffer(instance)) {
4980
4980
  instance = await _makeArrayBufferLoader(instance)(info);
4981
4981
  }
4982
+ // import("shiki/onig.wasm") returns `{ default: WebAssembly.Module }` on cloudflare workers
4983
+ // https://developers.cloudflare.com/workers/wrangler/bundling/
4984
+ else if (instance instanceof WebAssembly.Module) {
4985
+ instance = await _makeArrayBufferLoader(instance)(info);
4986
+ }
4987
+ else if ('default' in instance && instance.default instanceof WebAssembly.Module) {
4988
+ instance = await _makeArrayBufferLoader(instance.default)(info);
4989
+ }
4982
4990
  }
4983
4991
  if ('instance' in instance)
4984
4992
  instance = instance.instance;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/core",
3
3
  "type": "module",
4
- "version": "1.5.0",
4
+ "version": "1.5.1",
5
5
  "description": "Core of Shiki",
6
6
  "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",