Skip to content

Export the enums from the main entrypoint#64

Closed
illright wants to merge 2 commits intolezer-parser:mainfrom
illright:main
Closed

Export the enums from the main entrypoint#64
illright wants to merge 2 commits intolezer-parser:mainfrom
illright:main

Conversation

@illright
Copy link

@illright illright commented Nov 8, 2023

Previously, the enums were exported from an additional file, ./dist/constants, which was a problem for some bundlers like esbuild because the ./dist/constants entrypoint isn't declared in the package.json. After reexporting them from the main entrypoint I found out that it still didn't work right because esbuild can't inline const enums across packages (and frankly, I wouldn't expect it to). Thus, I've changed enums to regular ones and exported them from the index, and now the generator package builds correctly with my PR for Unplugin

@marijnh
Copy link
Collaborator

marijnh commented Nov 8, 2023

These enums aren't public. What are you doing that needs access to them?

@illright
Copy link
Author

illright commented Nov 8, 2023

The @lezer/generator package is accessing them

@marijnh
Copy link
Collaborator

marijnh commented Nov 8, 2023

Yes, and its build system can handle that.

@illright
Copy link
Author

illright commented Nov 8, 2023

Wouldn't it be better if any build system could handle that? Are there any downsides to the solution I proposed?

@marijnh
Copy link
Collaborator

marijnh commented Nov 8, 2023

Yes. It makes these enums non-const, changes things around, without addressing anything I actually consider a problem.

@marijnh marijnh closed this Nov 8, 2023
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

Successfully merging this pull request may close these issues.

2 participants