-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Backport the prismjs 1.27.0 upgrade to 3.x #58
Comments
|
Here you go:
I think many of us on 3.x haven't upgraded because our packages/tools are not ESM compatible yet. There's little I can add to the existing discourse on this subject except to say that it shouldn't be trivialised when we have major parts of the ecosystem (think Jest, TypeScript) struggling to land support. |
Thanks
|
Released! |
@wooorm I'm not using react-syntax-highlighter myself. I'm using Storybook, which uses react-syntax-highlighter |
And thanks for this backport. |
Perhaps you can ask Storybook folks, though? |
Storybook will most probably switch from react-syntax-highlighter to something else in the future since we ran into other blockers with it: storybookjs/storybook#18090 |
I don’t exactly get what’s going on there, but it seems to reference Prism actually running in the browser? I don’t think this package, nor |
Hmm, I don't know where the "real" Prism JS came from but it was a race condition caused by it for sure. I could spend more time investigating the dependency problem for sure. |
I see the dependency here: /~https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/package.json and Storybook is using it here: /~https://github.com/storybookjs/storybook/blob/ca2441260bdf2eaf29e6cf58d34bde60856ca7e9/lib/components/src/syntaxhighlighter/syntaxhighlighter.tsx. So I'm also not sure how it's possible since /~https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/src/prism-light.js not importing it. |
There is some code to prevent Prism from doing weird stuff: Lines 40 to 56 in c5744cb
It could be that that’s not working (on a past version?)? |
Yeah it seem like it. There is another approach which I really like: /~https://github.com/FormidableLabs/prism-react-renderer/blob/master/patches/prismjs%2B1.26.0.patch Essentially it removes unused code instead of working around it. It also cuts the bundle size quite significantly. Maybe this approach could be considered in this repo as well? |
Landed that idea, thanks! |
react-syntax-highlighter is still using refractor 3 for now. As prismjs 1.27.0 fixes an XSS vulnerability, would you agree to backport that upgrade to a 3.x version of refractor ?
The text was updated successfully, but these errors were encountered: