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

fix(javascript): fix types not being recognized for NodeNext module resolution #4540

Merged
merged 3 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions runtime/JavaScript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"browser": "dist/antlr4.web.mjs",
"main": "dist/antlr4.node.cjs",
"module": "dist/antlr4.node.mjs",
"types": "src/antlr4/index.d.ts",
"types": "src/antlr4/index.d.cts",
"repository": "antlr/antlr4.git",
"keywords": [
"lexer",
Expand All @@ -15,6 +15,11 @@
"antlr4",
"grammar"
],
"files": [
"dist",
"src/**/*.d.cts",
"src/**/*.d.ts"
],
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/antlr/antlr4/issues"
Expand Down Expand Up @@ -51,14 +56,18 @@
},
"exports": {
".": {
"types": "./src/antlr4/index.d.cts",
"import": "./dist/antlr4.node.mjs",
"require": "./dist/antlr4.node.cjs",
"default": "./dist/antlr4.node.mjs",
"node": {
"types": "./src/antlr4/index.d.ts",
"types": "./src/antlr4/index.d.cts",
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should be removed ?

"import": "./dist/antlr4.node.mjs",
"require": "./dist/antlr4.node.cjs",
"default": "./dist/antlr4.node.mjs"
},
"browser": {
"types": "./src/antlr4/index.d.ts",
"types": "./src/antlr4/index.d.cts",
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should be removed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, removed it and tested with different module resolutions like NodeNext, Bundler and Node. Seems working.

"import": "./dist/antlr4.web.mjs",
"require": "./dist/antlr4.web.cjs",
"default": "./dist/antlr4.web.mjs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export * from "./CommonTokenStream";
export * from "./Recognizer";
export * from "./Lexer";
export * from "./Parser";
export * from './Token';
export * from "./Token";
export * from "./atn";
export * from "./dfa";
export * from "./context";
export * from './misc';
export * from './tree';
export * from './state';
export * from './error';
export * from './utils';
export * from './TokenStreamRewriter';
export * from "./misc";
export * from "./tree";
export * from "./state";
export * from "./error";
export * from "./utils";
export * from "./TokenStreamRewriter";
Loading