File tree 13 files changed +130
-3
lines changed
13 files changed +130
-3
lines changed Original file line number Diff line number Diff line change 42
42
},
43
43
"scripts" : {
44
44
"build" : " webpack" ,
45
- "test" : " jasmine" ,
45
+ "test" : " jasmine && npm run test:projects" ,
46
+ "test:projects" : " bash test-projects.sh" ,
46
47
"coverage" : " c8 jasmine" ,
47
48
"lint" : " eslint src/antlr4/"
48
49
},
51
52
},
52
53
"exports" : {
53
54
"." : {
55
+ "types" : " ./src/antlr4/index.d.cts" ,
54
56
"node" : {
55
- "types" : " ./src/antlr4/index.d.ts" ,
56
57
"import" : " ./dist/antlr4.node.mjs" ,
57
58
"require" : " ./dist/antlr4.node.cjs" ,
58
59
"default" : " ./dist/antlr4.node.mjs"
59
60
},
60
61
"browser" : {
61
- "types" : " ./src/antlr4/index.d.ts" ,
62
62
"import" : " ./dist/antlr4.web.mjs" ,
63
63
"require" : " ./dist/antlr4.web.cjs" ,
64
64
"default" : " ./dist/antlr4.web.mjs"
Original file line number Diff line number Diff line change
1
+ /node_modules
2
+
3
+ package-lock.json
Original file line number Diff line number Diff line change
1
+ const { CharStream } = require ( "antlr4" ) ;
2
+
3
+ const cs = new CharStream ( "OK" ) ;
4
+
5
+ console . log ( cs . toString ( ) ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " test-import-node-cjs-ts" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " " ,
5
+ "main" : " index.js" ,
6
+ "type" : " commonjs" ,
7
+ "scripts" : {
8
+ "test" : " bash test.sh"
9
+ },
10
+ "author" : " " ,
11
+ "license" : " ISC" ,
12
+ "dependencies" : {
13
+ "antlr4" : " file:../../../.."
14
+ },
15
+ "devDependencies" : {
16
+ "typescript" : " ^5.4.3"
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ tsconfigFiles=(
4
+ " tsconfig.node.commonjs.json"
5
+ )
6
+
7
+ failure=0
8
+
9
+ for tsconfig in " ${tsconfigFiles[@]} " ; do
10
+ echo -n " $tsconfig "
11
+
12
+ ./node_modules/.bin/tsc -p $tsconfig || { failure=1 ; echo " FAIL tsc: $tsconfig " ; }
13
+ result=$( node ./tsOutput/index.js)
14
+ [[ $result == " OK" ]] && echo " OK"
15
+ [[ $result != " OK" ]] && { failure=1 ; echo " FAIL runtime: $tsconfig " ; }
16
+ rm -rf ./tsOutput
17
+ done
18
+
19
+ exit $failure
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "baseUrl" : " ." ,
4
+ "skipLibCheck" : true ,
5
+ "outDir" : " ./tsOutput" ,
6
+ "module" : " commonjs" ,
7
+ "moduleResolution" : " node"
8
+ },
9
+ "include" : [" index.ts" ],
10
+ }
Original file line number Diff line number Diff line change
1
+ /node_modules
2
+
3
+ package-lock.json
Original file line number Diff line number Diff line change
1
+ import { CharStream } from "antlr4" ;
2
+
3
+ const cs = new CharStream ( "OK" ) ;
4
+
5
+ console . log ( cs . toString ( ) ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " test-import-node-esm-ts" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " " ,
5
+ "main" : " index.js" ,
6
+ "type" : " module" ,
7
+ "scripts" : {
8
+ "test" : " bash test.sh"
9
+ },
10
+ "author" : " " ,
11
+ "license" : " ISC" ,
12
+ "dependencies" : {
13
+ "antlr4" : " file:../../../.."
14
+ },
15
+ "devDependencies" : {
16
+ "typescript" : " ^5.4.3"
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ tsconfigFiles=(
4
+ " tsconfig.node16.json"
5
+ " tsconfig.bundler.es2022.json"
6
+ )
7
+
8
+ failure=0
9
+
10
+ for tsconfig in " ${tsconfigFiles[@]} " ; do
11
+ echo -n " $tsconfig "
12
+
13
+ ./node_modules/.bin/tsc -p $tsconfig || { failure=1 ; echo " FAIL tsc: $tsconfig " ; }
14
+ result=$( node ./tsOutput/index.js)
15
+ [[ $result == " OK" ]] && echo " OK"
16
+ [[ $result != " OK" ]] && { failure=1 ; echo " FAIL runtime: $tsconfig " ; }
17
+ rm -rf ./tsOutput
18
+ done
19
+
20
+ exit $failure
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "baseUrl" : " ." ,
4
+ "skipLibCheck" : true ,
5
+ "outDir" : " ./tsOutput" ,
6
+ "module" : " es2022" ,
7
+ "moduleResolution" : " bundler"
8
+ },
9
+ "include" : [" index.ts" ],
10
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "baseUrl" : " ." ,
4
+ "skipLibCheck" : true ,
5
+ "outDir" : " ./tsOutput" ,
6
+ "module" : " node16" ,
7
+ "moduleResolution" : " node16"
8
+ },
9
+ "include" : [" index.ts" ],
10
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ cd spec/imports/setups/node-esm-ts
4
+ npm run test
5
+ cd ../node-cjs-ts
6
+ npm run test
You can’t perform that action at this time.
0 commit comments