From c05803715a63d7c59412a98f6c6cf0e7521f3cb1 Mon Sep 17 00:00:00 2001 From: "Peter (Somogyvari) Metz" Date: Thu, 20 Jul 2017 18:12:31 -0700 Subject: [PATCH] feat(browser): added browserify UMD tasks to the build, still need to update the STG template --- package.json | 7 +++++++ rollup.config.js | 7 +++++++ src/index.ts | 11 ++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 rollup.config.js diff --git a/package.json b/package.json index a18003df..152b633f 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,8 @@ "antlr4ts-benchmark-lr": "cd benchmark && antlr4ts -visitor JavaLR.g4 -DbaseImportPath=../../../src -o gen/lr", "antlr4ts-benchmark-lr-atn": "cd benchmark && antlr4ts -visitor -Xforce-atn JavaLR.g4 -DbaseImportPath=../../../src -o gen/lr-atn", "tsc": "tsc", + "browserify": "./node_modules/.bin/browserify ./target/src/index.js --transform [ babelify --presets [ es2015 ] ] --debug --outfile target/antlr4ts.umd.js --standalone antlr4ts", + "browserify-min": "./node_modules/.bin/browserify ./target/src/index.js --transform [ rollupify --config rollup.config.js ] --transform [ babelify --presets [ es2015 ] ] --outfile target/antlr4ts.umd.tree-shaken.js --standalone antlr4ts", "buildrts": "cd test/runtime && tsc", "test": "mocha", "cover": "istanbul cover node_modules/mocha/bin/_mocha", @@ -52,9 +54,14 @@ "devDependencies": { "@types/mocha": "^2.2.32", "@types/node": "^6.0.41", + "babel-preset-es2015": "^6.24.1", + "babelify": "^7.3.0", + "browserify": "^14.4.0", "istanbul": "^0.4.5", "mocha": "^3.1.0", "mocha-typescript": "^1.0.10", + "rollup-plugin-babel": "^2.7.1", + "rollupify": "^0.4.0", "source-map-support": "^0.4.3", "std-mocks": "^1.0.1", "typedoc": "^0.5.1", diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 00000000..ef45f0b1 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,7 @@ +module.exports = { + plugins: [ + require('rollup-plugin-babel')({ + exclude: 'node_modules/**' + }) + ] +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index e729b35d..07193719 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,6 @@ export * from './ANTLRErrorListener'; export * from './ANTLRErrorStrategy'; -// export * from './ANTLRFileStream'; export * from './ANTLRInputStream'; export * from './BailErrorStrategy'; export * from './BufferedTokenStream'; @@ -43,8 +42,14 @@ export * from './TokenFactory'; export * from './TokenSource'; export * from './TokenStream'; export * from './TokenStreamRewriter'; -// export * from './UnbufferedCharStream'; -// export * from './UnbufferedTokenStream'; export * from './Vocabulary'; export * from './VocabularyImpl'; export * from './WritableToken'; + +export * from './misc/Utils'; +export { NotNull, Override } from './Decorators'; +export * from './index'; +export * from './atn/index'; +export * from './dfa/index'; +export * from './misc/index'; +export * from './tree/index';