question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

allow custom recma plugins before `recmaJsxBuild`

See original GitHub issue

Initial checklist

Problem

I am developing a custom Recma plugin.

My issue is that during development, I usually compiled my mdx with jsx: true, because that makes it easier to look at the output and debug the process. However, I was (stupidly) unaware that the resulting AST is completely different, depending on this setting.

While I will probably rework my plugin to work with jsx: false, this does seem to complicate things for plugin developers. Should a plugin work in both cases (basically needing to build 2 plugins and decide which one to use at runtime) ?

Solution

I think that this issue could be resolved by using the recmaplugins before recmaJsxBuild (code), that way any plugin works regardless of whether the output should be jsx or not.

However, this means that the plugins also get used before recmaStringify (not entirely sure what it does). I gues it might be a possibility to use recmaStringify before recmaJsxBuild as well, since recmaJsxBuild is currently not always used ?


I understand this change is probably not something you can quickly commit to, as existing plugins need to be adapted as well and this would thus need a discussion with the plugin authors ? As far as I am aware, the only plugins for recma are those by @remcohaszing, but I might be mistaken ?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
0phoffcommented, Jul 5, 2022

Something like {remark,rehype}-mdx-{deck,whatever-you-like}

Makes sense, thank you!


Does your plugin really need to import things? MDX already has several ways of passing and importing components: could you let users do that and benefit from the existing passing methods?

In my current recma plugin, it is optional.
If you enable the import, it imports the wrapper component for you, but if you disable it, you can either import manually, or use component prop/MDXProvider for it.
The end use is to upgrade my MDXP package for writing slides in mdx, and for that scenario I want the automatic import ! 😃

0reactions
wooormcommented, Jul 5, 2022

Something like {remark,rehype}-mdx-{deck,whatever-you-like}. See https://mdxjs.com/docs/extending-mdx/#list-of-plugins for existing and inspirational plugins. And add yours there when it’s ready.

Cool idea! Perhaps that solves https://github.com/mdx-js/mdx/issues/454.

Does your plugin really need to import things? MDX already has several ways of passing and importing components: could you let users do that and benefit from the existing passing methods?

Read more comments on GitHub >

github_iconTop Results From Across the Web

RECMA
RECMA is the only independent company to publish wide range of evaluation, reports and databases dedicated to the media industry professionals. Find out...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found