Skip to content

Use babel-parse for import/export/jsx blocks #345

Closed
@johno

Description

@johno

This issue is intended to discuss bringing in @babel/parse to handle ES/JSX parsing.

I've discussed this a few times with @timneutkens and @ChristopherBiscardi in passing but it's something we haven't been prioritizing. Over the last week I've been thinking about it more heavily after @jescalan reported a bunch of new parse issues.

We've reached a point where most open issues with the bug label are related to parsing exports and JSX. So we ultimately need to be able to parse import/export/jsx nodes to handle the following scenarios:

  • Parse out the default export since that maps to the layout
  • Walk a JSX node to its completion (right now newlines aren't properly handled)
  • Handle all use cases where import/export/JSX blocks aren't separated by empty lines
  • Allow (eventually) for the interleaving of MDX in JSX blocks

There might be a small performance hit, but since it's build time it's not something I'm personally worried about. The big bummer will be the heavier bundle, but that really only comes into play for browser runtimes (which isn't really our targeted env anyway).

  • Anyone have any thoughts, insights, or FUD about this?
  • Is there anyone that wants to take this on?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions