Export the enums from the main entrypoint #64

Closed
illright wants to merge 2 commits from main into main
illright commented 2023-11-08 14:56:45 +01:00 (Migrated from github.com)

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

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 commented 2023-11-08 15:27:59 +01:00 (Migrated from github.com)

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

These enums aren't public. What are you doing that needs access to them?
illright commented 2023-11-08 15:35:28 +01:00 (Migrated from github.com)

The @lezer/generator package is accessing them

The `@lezer/generator` package is accessing them
marijnh commented 2023-11-08 16:01:17 +01:00 (Migrated from github.com)

Yes, and its build system can handle that.

Yes, and its build system can handle that.
illright commented 2023-11-08 16:52:19 +01:00 (Migrated from github.com)

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

Wouldn't it be better if any build system could handle that? Are there any downsides to the solution I proposed?
marijnh commented 2023-11-08 17:15:19 +01:00 (Migrated from github.com)

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

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

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/lr!64
No description provided.