Closed shishkin closed 1 year ago
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
@shishkin Component doesn't use JSDOM internally, it's a problem with isomorphic-dompurify - https://github.com/kkomelin/isomorphic-dompurify/blob/master/package.json#L35 Only what can I suggest to override the sanitize
function exported by isomorphic-dompurify
(ref: https://github.com/asyncapi/asyncapi-react/blob/next/library/src/components/Markdown.tsx#L17) and to something like that:
function sanitize(html: string) {
return html;
}`
of course you need to remember that it's not the safe. Another option is to find some equivalent for jsdom
(and maybe for isomorphic-dompurify
) in Deno ecosystem.
I see. I guess isomorphic-dompurify
should support native ES imports. I'll create an issue there.
And would it be possible to remove react-icons
? I think this package is an overkill for the single us of HiChevronRight
. It can easily be replaced with just an angle bracket or static SVG:
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m8.25 4.5l7.5 7.5l-7.5 7.5"/></svg>
@shishkin
And would it be possible to remove react-icons? I think this package is an overkill for the single us of HiChevronRight. It can easily be replaced with just an angle bracket or static SVG:
We can, however component is treeshakable https://github.com/asyncapi/asyncapi-react/blob/next/library/package.json#L42, so it means that for bundled apps we only leave HiChevronRight
icon. Do you want open issue/PR for that?
We can, however component is treeshakable https://github.com/asyncapi/asyncapi-react/blob/next/library/package.json#L42, so it means that for bundled apps we only leave
HiChevronRight
icon.
Yes, I understand the total bundle only has that single SVG. I still think it's worth minimizing dependencies, especially in the ESM world.
Do you want open issue/PR for that?
Submitted https://github.com/asyncapi/asyncapi-react/pull/692.
@shishkin Can we close that issue, or you wanna wait for fixing ESM problem in the isomorphic-dompurify
package? :)
Yes, we can close this now. I was finally able to server-render this component on Deno by overriding dependencies.
I've filed an issue to isomorphic-dompurify
but it seems more complex to resolve in isomorphic case though.
I've searched for similar issues but could not find anything. I'm trying to get this component work on Deno with Lume. I followed the Next.js guide with @asyncapi/react-component loaded via esm.sh. But I ran into issues with dependencies like JSDOM, isomorphic-dompurify and react-icons. While I was able to replace
react-icons
with https://github.com/UrielCh/react-icons, I'm stuck with JSDOM and isomorphic-dompurify.JSDOM calls into unsupported Deno API:
And isomorphic-dompurify seems to have messed up export maps.
So, this is not a "bug" against this project but merely a call for help and maybe a suggestion to add a test case for the component to render in Deno. All help is appreciated.