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

Return start position of export statements #112

Open
overlookmotel opened this issue Mar 22, 2022 · 1 comment
Open

Return start position of export statements #112

overlookmotel opened this issue Mar 22, 2022 · 1 comment

Comments

@overlookmotel
Copy link

overlookmotel commented Mar 22, 2022

It appears that #36 is stalled for now and is a tricky problem to solve.

Would it be possible just to return the start position of export statements?

My aim is to parse export statements in a file without parsing the entire file. With just the start position, this would be achievable without a lot of overhead:

  1. Get start position of export statement from es-module-lexer.
  2. Get slice of file content from start position of the export statement to end of the file.
  3. Pass that slice to a parser with instruction to bail out after 1 statement.

From #36, it sounds like finding the start of export statements is the easy part, and would be inexpensive, but it's finding the end which is hard.

Would you consider supporting this as a stopgap until full export parsing is supported?

@guybedford
Copy link
Owner

We now support export binding information from #119.

Extending this to full export statement tracking is a logical next step.

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

No branches or pull requests

2 participants