From 67244f27c913f3e85190de641279e1a952d001ed Mon Sep 17 00:00:00 2001 From: Gokhan Kurt Date: Fri, 23 Feb 2024 18:14:59 +0300 Subject: [PATCH 1/2] fix(javascript): fix types not being recognized for NodeNext module resolution Signed-off-by: Gokhan Kurt --- runtime/JavaScript/package.json | 15 ++++++++++++--- .../src/antlr4/{index.d.ts => index.d.cts} | 14 +++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) rename runtime/JavaScript/src/antlr4/{index.d.ts => index.d.cts} (68%) diff --git a/runtime/JavaScript/package.json b/runtime/JavaScript/package.json index 6744ebb4a8..ad0f93aec3 100644 --- a/runtime/JavaScript/package.json +++ b/runtime/JavaScript/package.json @@ -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", @@ -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" @@ -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", "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", "import": "./dist/antlr4.web.mjs", "require": "./dist/antlr4.web.cjs", "default": "./dist/antlr4.web.mjs" diff --git a/runtime/JavaScript/src/antlr4/index.d.ts b/runtime/JavaScript/src/antlr4/index.d.cts similarity index 68% rename from runtime/JavaScript/src/antlr4/index.d.ts rename to runtime/JavaScript/src/antlr4/index.d.cts index 3c6c9bcf8b..cf0e262bdd 100644 --- a/runtime/JavaScript/src/antlr4/index.d.ts +++ b/runtime/JavaScript/src/antlr4/index.d.cts @@ -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"; From 02f839584349db9b7c1cb394bbebe5768822dd9e Mon Sep 17 00:00:00 2001 From: Gokhan Kurt Date: Fri, 26 Jul 2024 13:18:25 +0300 Subject: [PATCH 2/2] remove unnecessary exports --- runtime/JavaScript/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/runtime/JavaScript/package.json b/runtime/JavaScript/package.json index 7bab482501..ad3e3e472d 100644 --- a/runtime/JavaScript/package.json +++ b/runtime/JavaScript/package.json @@ -57,9 +57,6 @@ "exports": { ".": { "types": "./src/antlr4/index.d.cts", - "import": "./dist/antlr4.node.mjs", - "require": "./dist/antlr4.node.cjs", - "default": "./dist/antlr4.node.mjs", "node": { "import": "./dist/antlr4.node.mjs", "require": "./dist/antlr4.node.cjs",