Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM usage with getHighlighterCore errors with Buffer.isBuffer (this doesn't exist in the browser) #664

Closed
3 of 5 tasks
NullVoxPopuli opened this issue Apr 28, 2024 · 4 comments · Fixed by #666 · 4 remaining pull requests
Closed
3 of 5 tasks

WASM usage with getHighlighterCore errors with Buffer.isBuffer (this doesn't exist in the browser) #664

NullVoxPopuli opened this issue Apr 28, 2024 · 4 comments · Fixed by #666 · 4 remaining pull requests

Comments

@NullVoxPopuli
Copy link
Contributor

NullVoxPopuli commented Apr 28, 2024

Validations

Versions

"@shikijs/rehype": "^1.2.0",
"shiki": "^1.2.0",

Describe the bug

image

and the entrypoint is from this path:
image

I will be working around this for now by defining Buffer.isBuffer on window/globlaThis via this in my index.html

globalThis.Buffer = { isBuffer: () => false }

Reproduction

call await getHighlighterCore({

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests
@antfu
Copy link
Member

antfu commented Apr 29, 2024

Screenshot 2024-04-29 at 13 02 47

But the case is that Buffer should not exist in browser (we already do the check before calling Buffer.isBuffer - are you doing some shimming for your client? I don't mind doing an extra check of the Buffer.isBuffer?() if that helps

@NullVoxPopuli
Copy link
Contributor Author

I see this:
image

which is probably because Webpack is doing something silly -- not sure I can have control over it in this case 🤔 I don't have any explicit configuration that would add this ... a blank Buffer object 🤔

I don't mind doing an extra check of the Buffer.isBuffer?() if that helps

It would!

@antfu
Copy link
Member

antfu commented Apr 29, 2024

Would you like to send a quick PR? Thanks

NullVoxPopuli added a commit to NullVoxPopuli/shiki that referenced this issue Apr 29, 2024
@NullVoxPopuli
Copy link
Contributor Author

ye! #666

diegohaz pushed a commit to ariakit/ariakit that referenced this issue May 14, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [shiki](https://togithub.com/shikijs/shiki)
([source](https://togithub.com/shikijs/shiki/tree/HEAD/packages/shiki))
| [`1.3.0` ->
`1.5.1`](https://renovatebot.com/diffs/npm/shiki/1.3.0/1.5.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/shiki/1.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/shiki/1.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/shiki/1.3.0/1.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/shiki/1.3.0/1.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>shikijs/shiki (shiki)</summary>

### [`v1.5.1`](https://togithub.com/shikijs/shiki/releases/tag/v1.5.1)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.5.0...v1.5.1)

#####    🐞 Bug Fixes

- **core**: Simplify cloudflare wasm loading  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[shikijs/shiki#670
[<samp>(cd239)</samp>](https://togithub.com/shikijs/shiki/commit/cd239324)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.5.0...v1.5.1)

### [`v1.5.0`](https://togithub.com/shikijs/shiki/releases/tag/v1.5.0)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.4.0...v1.5.0)

#####    🚀 Features

- Upgrade deps, new langs  -  by
[@&#8203;antfu](https://togithub.com/antfu)
[<samp>(d5b04)</samp>](https://togithub.com/shikijs/shiki/commit/d5b04703)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.4.0...v1.5.0)

### [`v1.4.0`](https://togithub.com/shikijs/shiki/releases/tag/v1.4.0)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.3.0...v1.4.0)

#####    🚀 Features

- Upgrade deps, new langs and themes  -  by
[@&#8203;antfu](https://togithub.com/antfu)
[<samp>(26f37)</samp>](https://togithub.com/shikijs/shiki/commit/26f37f08)

#####    🐞 Bug Fixes

- **core**: Check existance of `Buffer.isBuffer`, fix
[#&#8203;664](https://togithub.com/shikijs/shiki/issues/664)  -  by
[@&#8203;NullVoxPopuli](https://togithub.com/NullVoxPopuli) in
[shikijs/shiki#666
and
[shikijs/shiki#664
[<samp>(86d52)</samp>](https://togithub.com/shikijs/shiki/commit/86d5271e)
- **monaco**: Options for tokenize limit  -  by
[@&#8203;hddhyq](https://togithub.com/hddhyq),
[@&#8203;antfu](https://togithub.com/antfu) and **Anthony Fu** in
[shikijs/shiki#657
[<samp>(a606d)</samp>](https://togithub.com/shikijs/shiki/commit/a606d449)
- **transformers**: Allow SQL comment syntax in notation transformer,
fix [#&#8203;654](https://togithub.com/shikijs/shiki/issues/654)  -  by
[@&#8203;senicko](https://togithub.com/senicko) in
[shikijs/shiki#655
and
[shikijs/shiki#654
[<samp>(cc135)</samp>](https://togithub.com/shikijs/shiki/commit/cc13539e)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.3.0...v1.4.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ariakit/ariakit).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMjEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjM0MC4xMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment