-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add projects to test typescript support with different compiler options #4597
Open
JesusTheHun
wants to merge
8
commits into
antlr:dev
Choose a base branch
from
JesusTheHun:test/typescript-compiler-options
base: dev
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
039c465
test: create ts projects using esm and cjs
JesusTheHun 2d2b26c
fix: rename declaration file index to .d.cts
JesusTheHun d20f690
misc: rename "projects" to "builds
JesusTheHun 560c4a0
build(typescript): reference the new definition file in the package.j…
JesusTheHun bf00759
test: add pnpm esm ts project
JesusTheHun 40bb02c
fix: imports should explicitly add the extension of the imported file
JesusTheHun 7cc30dc
fix: revert declaration file rename
JesusTheHun f7d2479
test: add pnpm build to test suite
JesusTheHun File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
runtime/JavaScript/spec/imports/builds/node-cjs-ts/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/node_modules | ||
|
||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const { CharStream } = require("antlr4"); | ||
|
||
const cs = new CharStream("OK"); | ||
|
||
console.log(cs.toString()); |
18 changes: 18 additions & 0 deletions
18
runtime/JavaScript/spec/imports/builds/node-cjs-ts/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "test-import-node-cjs-ts", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"type": "commonjs", | ||
"scripts": { | ||
"test": "bash test.sh" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"antlr4": "file:../../../.." | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.4.3" | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
runtime/JavaScript/spec/imports/builds/node-cjs-ts/test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
tsconfigFiles=( | ||
"tsconfig.node.commonjs.json" | ||
) | ||
|
||
failure=0 | ||
|
||
for tsconfig in "${tsconfigFiles[@]}"; do | ||
echo -n "$tsconfig " | ||
|
||
./node_modules/.bin/tsc -p $tsconfig || { failure=1 ; echo "FAIL tsc: $tsconfig"; } | ||
result=$(node ./tsOutput/index.js) | ||
[[ $result == "OK" ]] && echo "OK" | ||
[[ $result != "OK" ]] && { failure=1 ; echo "FAIL loading runtime with config: $tsconfig"; } | ||
rm -rf ./tsOutput | ||
done | ||
|
||
exit $failure |
10 changes: 10 additions & 0 deletions
10
runtime/JavaScript/spec/imports/builds/node-cjs-ts/tsconfig.node.commonjs.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"skipLibCheck": true, | ||
"outDir": "./tsOutput", | ||
"module": "commonjs", | ||
"moduleResolution": "node" | ||
}, | ||
"include": ["index.ts"], | ||
} |
3 changes: 3 additions & 0 deletions
3
runtime/JavaScript/spec/imports/builds/node-esm-ts/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/node_modules | ||
|
||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { CharStream } from "antlr4"; | ||
|
||
const cs = new CharStream("OK"); | ||
|
||
console.log(cs.toString()); |
18 changes: 18 additions & 0 deletions
18
runtime/JavaScript/spec/imports/builds/node-esm-ts/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "test-import-node-esm-ts", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"type": "module", | ||
"scripts": { | ||
"test": "bash test.sh" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"antlr4": "file:../../../.." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't we be using a local build rather than the source folder ? |
||
}, | ||
"devDependencies": { | ||
"typescript": "^5.4.3" | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
runtime/JavaScript/spec/imports/builds/node-esm-ts/test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
tsconfigFiles=( | ||
"tsconfig.node16.json" | ||
"tsconfig.bundler.es2022.json" | ||
) | ||
|
||
failure=0 | ||
|
||
for tsconfig in "${tsconfigFiles[@]}"; do | ||
echo -n "$tsconfig " | ||
|
||
./node_modules/.bin/tsc -p $tsconfig || { failure=1 ; echo "FAIL tsc: $tsconfig"; } | ||
result=$(node ./tsOutput/index.js) | ||
[[ $result == "OK" ]] && echo "OK" | ||
[[ $result != "OK" ]] && { failure=1 ; echo "FAIL loading runtime with config: $tsconfig"; } | ||
rm -rf ./tsOutput | ||
done | ||
|
||
exit $failure |
10 changes: 10 additions & 0 deletions
10
runtime/JavaScript/spec/imports/builds/node-esm-ts/tsconfig.bundler.es2022.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"skipLibCheck": true, | ||
"outDir": "./tsOutput", | ||
"module": "es2022", | ||
"moduleResolution": "bundler" | ||
}, | ||
"include": ["index.ts"], | ||
} |
10 changes: 10 additions & 0 deletions
10
runtime/JavaScript/spec/imports/builds/node-esm-ts/tsconfig.node16.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"skipLibCheck": true, | ||
"outDir": "./tsOutput", | ||
"module": "node16", | ||
"moduleResolution": "node16" | ||
}, | ||
"include": ["index.ts"], | ||
} |
3 changes: 3 additions & 0 deletions
3
runtime/JavaScript/spec/imports/builds/pnpm-esm-ts/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/node_modules | ||
|
||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { CharStream, ErrorListener } from "antlr4"; | ||
|
||
const cs = new CharStream("OK"); | ||
|
||
class MyErrorListener<T> extends ErrorListener<T> { | ||
|
||
} | ||
|
||
console.log(cs.toString()); |
20 changes: 20 additions & 0 deletions
20
runtime/JavaScript/spec/imports/builds/pnpm-esm-ts/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "test-import-pnpm-esm-ts", | ||
"version": "1.0.0", | ||
"packageManager": "pnpm@9.0.6", | ||
"description": "", | ||
"main": "index.js", | ||
"type": "module", | ||
"scripts": { | ||
"preinstall": "npx only-allow pnpm", | ||
"test": "bash test.sh" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"antlr4": "file:../../../.." | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.4.5" | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
runtime/JavaScript/spec/imports/builds/pnpm-esm-ts/pnpm-lock.yaml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
runtime/JavaScript/spec/imports/builds/pnpm-esm-ts/test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
tsconfigFiles=( | ||
"tsconfig.node16.json" | ||
"tsconfig.bundler.es2022.json" | ||
) | ||
|
||
failure=0 | ||
|
||
for tsconfig in "${tsconfigFiles[@]}"; do | ||
echo -n "$tsconfig " | ||
|
||
./node_modules/.bin/tsc -p $tsconfig || { failure=1 ; echo "FAIL tsc: $tsconfig"; } | ||
result=$(node ./tsOutput/index.js) | ||
[[ $result == "OK" ]] && echo "OK" | ||
[[ $result != "OK" ]] && { failure=1 ; echo "FAIL loading runtime with config: $tsconfig"; } | ||
rm -rf ./tsOutput | ||
done | ||
|
||
exit $failure |
10 changes: 10 additions & 0 deletions
10
runtime/JavaScript/spec/imports/builds/pnpm-esm-ts/tsconfig.bundler.es2022.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"skipLibCheck": true, | ||
"outDir": "./tsOutput", | ||
"module": "es2022", | ||
"moduleResolution": "bundler" | ||
}, | ||
"include": ["index.ts"], | ||
} |
10 changes: 10 additions & 0 deletions
10
runtime/JavaScript/spec/imports/builds/pnpm-esm-ts/tsconfig.node16.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"skipLibCheck": true, | ||
"outDir": "./tsOutput", | ||
"module": "node16", | ||
"moduleResolution": "node16" | ||
}, | ||
"include": ["index.ts"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we be using a local build rather than the source folder ?