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

chore: add exports util with tests #1045

Conversation

davinhazard
Copy link
Contributor

PR App Fix RM-XYZ

🧰 Changes

  • Adds a util for parsing out the export names from an MDX string
  • Adds tests for a few different cases

🧬 QA & Testing

Copy link
Collaborator

@kellyjosephprice kellyjosephprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

import { isMDXEsm } from '../processor/utils';
import { MdxjsEsm } from 'mdast-util-mdx';

const EXPORT_NAME_REGEX = /export\s+(?:const|let|var|function)\s+(\w+)/;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine for now, but in the future we may need to pull this info from the ast.

@kellyjosephprice
Copy link
Collaborator

I think you can ignore the visual tests. The docker image versions were too loose, and it's failing on installing a compatible npm. I have a fix in this PR: #1044

@davinhazard davinhazard merged commit e5180a4 into next Jan 21, 2025
12 of 13 checks passed
@davinhazard davinhazard deleted the davin/rm-11740-markdown-engine-return-exports-the-same-way-tags-are branch January 21, 2025 22:47
rafegoldberg pushed a commit that referenced this pull request Jan 22, 2025
## Version 7.12.0
### ✨ New & Improved

* add exports ([#1044](#1044)) ([bf9ed34](bf9ed34))
* global vars ([#1039](#1039)) ([ecb7f61](ecb7f61))

### 🛠 Fixes & Updates

* add exports util with tests ([#1045](#1045)) ([e5180a4](e5180a4))

<!--SKIP CI-->
@rafegoldberg
Copy link
Contributor

This PR was released!

🚀 Changes included in v7.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants