ElMassimo / iles

🏝 The joyful site generator
https://iles.pages.dev
MIT License
1.08k stars 31 forks source link

Adding @islands/prism module break site generation #104

Closed YuukanOO closed 2 years ago

YuukanOO commented 2 years ago

Description πŸ“–

Tested on a fresh project after a clean init. When activating the @islands/prism module in the iles.config.ts and adding an mdx file with some code in it, it fails with a [plugin:iles:mdx:compile] Cannot handle unknown node raw error.

Reproduction 🐞

Tested with this repo: https://github.com/YuukanOO/iles-app

$ npm init iles@next
$ cd iles-app
$ npm install

Add @islands/prism in the modules section on the iles.config.ts and a sample .mdx file with code in it:

---
title: Testing PrismJS
category: tips
---

Hehe

```js
const a = 5;

Three backticks are there but it doesn't seem to work in Github editor :/
$ npm run dev
Dependencies Info _Run `npx iles info` and `pnpm list` (or `npm list`) and provide the output:_ ``` iles v0.7.32 vite v2.8.6 ``` ``` iles-app@0.0.0 /Users/julien/Documents/Sources/tmp/iles-app β”œβ”€β”€ @islands/prism@0.1.1 β”œβ”€β”€ iles@0.7.32 β”œβ”€β”€ typescript@4.6.2 └── vue-tsc@0.29.8 ```

Logs πŸ“œ

Output ``` 18:33:13 [vite] Internal server error: Cannot handle unknown node `raw` Plugin: iles:mdx:compile File: /Users/julien/Documents/Sources/tmp/iles-app/src/pages/something.mdx at Object.unknown (file:///Users/julien/Documents/Sources/tmp/iles-app/node_modules/hast-util-to-estree/index.js:155:9) at Object.one [as handle] (file:///Users/julien/Documents/Sources/tmp/iles-app/node_modules/zwitch/index.js:52:17) at all (file:///Users/julien/Documents/Sources/tmp/iles-app/node_modules/hast-util-to-estree/index.js:583:28) at Object.root (file:///Users/julien/Documents/Sources/tmp/iles-app/node_modules/hast-util-to-estree/index.js:508:20) at Object.one [as handle] (file:///Users/julien/Documents/Sources/tmp/iles-app/node_modules/zwitch/index.js:52:17) at toEstree (file:///Users/julien/Documents/Sources/tmp/iles-app/node_modules/hast-util-to-estree/index.js:119:24) at file:///Users/julien/Documents/Sources/tmp/iles-app/node_modules/xdm/lib/plugin/rehype-recma.js:15:20 at wrapped (file:///Users/julien/Documents/Sources/tmp/iles-app/node_modules/trough/index.js:115:27) at next (file:///Users/julien/Documents/Sources/tmp/iles-app/node_modules/trough/index.js:65:23) at done (file:///Users/julien/Documents/Sources/tmp/iles-app/node_modules/trough/index.js:148:7) ```

Screenshots πŸ“·

image

ElMassimo commented 2 years ago

Hi Julien, thanks for reporting and providing a reproduction! πŸ˜ƒ

Released a fix in @islands/mdx@0.7.6.

You can run npm update to bump that package, which should fix the error.

YuukanOO commented 2 years ago

Nice! Thanks for being so fast! πŸ˜‰