Skip to content

Commit

Permalink
Exclude APIs required only for tests from main bundle (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
L2jLiga authored and fabiosantoscode committed Mar 16, 2019
1 parent 6fe56db commit 1e8c6e2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 70 deletions.
2 changes: 1 addition & 1 deletion lib/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import {
noop,
} from "./utils.js";

(function(undefined) {
(function() {

function _(node, descend) {
node.DEFMETHOD("transform", function(tw, in_list) {
Expand Down
9 changes: 1 addition & 8 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export {
} from "./lib/utils.js";
export { base54 } from "./lib/scope.js";
export { Compressor } from "./lib/compress/index.js";
export { to_ascii } from "./lib/minify.js";
export { OutputStream } from "./lib/output.js";
export { parse } from "./lib/parse.js";
export {
Expand All @@ -31,11 +32,3 @@ export {
} from "./lib/propmangle.js";
export { default_options } from "./tools/node";
import "./lib/mozilla-ast.js";

// TESTS
export * from "./lib/ast.js";
export {
JS_Parse_Error,
tokenizer,
} from "./lib/parse.js";
export { to_ascii } from "./lib/minify.js";
9 changes: 9 additions & 0 deletions main.tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Core
export * from "./main";

// TESTS
export * from "./lib/ast.js";
export {
JS_Parse_Error,
tokenizer,
} from "./lib/parse.js";
62 changes: 4 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
},
"devDependencies": {
"acorn": "^6.0.4",
"cross-env": "^5.2.0",
"csv": "^5.1.0",
"escodegen": "^1.11.0",
"eslint": "^4.19.1",
Expand All @@ -46,10 +45,12 @@
"semver": "~5.6.0"
},
"scripts": {
"test": "npm run prepare --silent && istanbul instrument dist/bundle.min.js > dist/bundle.instrumented.js && node test/run-tests.js",
"test": "npm run build -- --silent --input=main.tests.js && npm run minify && node test/run-tests.js",
"lint": "eslint lib",
"lint-fix": "eslint --fix lib",
"prepare": "rimraf dist/* && rollup -c && cd dist && cross-env TERSER_NO_BUNDLE=1 ../bin/uglifyjs bundle.js -mc --source-map 'content=bundle.js.map,includeSources=true,url=bundle.min.js.map' -o bundle.min.js",
"build": "rimraf dist/* && rollup -c",
"minify": "cd dist && node ../bin/uglifyjsnobundle bundle.js -mc --source-map content=bundle.js.map,includeSources=true -o bundle.min.js",
"prepare": "npm run build && npm run minify",
"postversion": "echo 'Remember to update the changelog!'"
},
"keywords": [
Expand Down

0 comments on commit 1e8c6e2

Please sign in to comment.