├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── Bug_report.md │ └── Feature_request.md └── workflows │ └── ci.yml ├── .gitignore ├── .gitmodules ├── .prettierignore ├── .travis.yml ├── .yarnrc ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── NPM_OWNERS ├── README.md ├── babel.config.js ├── circle.yml ├── codecov.yml ├── docs ├── README.md ├── benchmarks.md ├── debugging.md ├── releasing.md ├── setup.md └── tests.md ├── gulpfile.js ├── lerna.json ├── package.json ├── packages ├── babel-helper-evaluate-path │ ├── .npmignore │ ├── README.md │ ├── package.json │ └── src │ │ └── index.js ├── babel-helper-flip-expressions │ ├── .npmignore │ ├── README.md │ ├── package.json │ └── src │ │ └── index.js ├── babel-helper-is-void-0 │ ├── .npmignore │ ├── README.md │ ├── package.json │ └── src │ │ └── index.js ├── babel-helper-mark-eval-scopes │ ├── README.md │ ├── __tests__ │ │ └── helper-mark-eval-scopes-test.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-helper-remove-or-void │ ├── .npmignore │ ├── README.md │ ├── package.json │ └── src │ │ └── index.js ├── babel-helper-to-multiple-sequence-expressions │ ├── .npmignore │ ├── README.md │ ├── package.json │ └── src │ │ └── index.js ├── babel-minify │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ ├── cli-tests.js.snap │ │ │ └── node-api-tests.js.snap │ │ ├── cli-tests.js │ │ ├── fixtures │ │ │ ├── .eslintrc │ │ │ ├── module │ │ │ │ └── mod.js │ │ │ ├── out-dir │ │ │ │ └── a │ │ │ │ │ └── foo.js │ │ │ └── out-file │ │ │ │ └── foo.js │ │ └── node-api-tests.js │ ├── bin │ │ └── minify.js │ ├── package.json │ └── src │ │ ├── cli.js │ │ ├── fs.js │ │ ├── index.js │ │ └── options-parser.js ├── babel-plugin-minify-builtins │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── arrow-without-block │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── builtin-methods │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── builtin-props │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── computed-props │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── deep-occurences │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── evaluate-builtins │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── in-class-methods │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── in-function-scope │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── local-binding │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── multiple-occurences │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── program-scope │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── props-polyfilled │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── side-effecty │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── without-lca │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-minify-constant-folding │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── array-literals-methods │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── basic │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── export-specifier │ │ │ │ ├── actual.js │ │ │ │ ├── babel.json │ │ │ │ └── expected.js │ │ │ ├── html-comment-escape │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-440 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-844 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── negative-zero │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── runtime-errors │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── script-escape │ │ │ │ ├── actual.js │ │ │ │ └── skip │ │ │ ├── spread-element │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── string-literal-methods │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── style-escape │ │ │ │ ├── actual.js │ │ │ │ └── skip │ │ │ └── to-string │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ ├── index.js │ │ └── replacements.js ├── babel-plugin-minify-dead-code-elimination │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── dead-code-elimination-test.js │ │ ├── fixtures │ │ │ ├── array-object-patterns │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── case-blocks │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── closures │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── conditionals-bail │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── constant-violations │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── dead-if-stmts │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── dead-vars-in-for │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── empty-if-else-blocks │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── eval-conditional │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── eval │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── externally-called-fns │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── extraneous-blocks │ │ │ │ ├── actual.js │ │ │ │ └── skip │ │ │ ├── fn-expr-name │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── fn-params │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── fn-recursion │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── fn-this │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── fns-called-only-from-within │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── global-bindings │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── hoist-vars-in-dead-blocks │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── impure-test │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── inline-fns │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── inline-in-function │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── inline-in-if │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── inline-in-loops │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── inline-one-ref-bindings │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── inlining-with-shadow │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-130 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-574 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-611 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-685 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-691-binary-in │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-78 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-81 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-871 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-922 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-981 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── join-var-decl-and-assignment │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── keep-class-name │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── keep-fn-args │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── keep-fn-name │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── loop-if-return │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── loops │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── multiple-refs │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── named-class-expr-used │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── named-class-expr │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── no-refs-bindings │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── orphaned-returns │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── redundant-returns │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── redundant-use-strict │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── regression-1 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── shadow-class-name │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── side-effect-less-statements │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── side-effecty-assignment │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-case │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── tdz │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── toplevel-class │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── track-purity │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── unreachable-code-after-return │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── unused-decl-and-assignments │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── unused-params │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── used-expressions │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── vars-to-for │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ ├── index.js │ │ └── remove-use-strict.js ├── babel-plugin-minify-flip-comparisons │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── binary-expr-constants-first │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── binary-expr-pures-first │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── binary-expr-values-first │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── conditionals-same-consequent │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-minify-guarded-expressions │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── flip-logical-expr │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── reachable-impure-stmts │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── simplify-falsy-expr │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── simplify-truthy-expr │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-minify-infinity │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── assignment-expr │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── bindings │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── destructure │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── expressions │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── fn-param │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── property │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── to-1-over-0 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-minify-mangle-names │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── basic │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── classes │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── closures-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── closures │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── constant-violations-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── constant-violations-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── constant-violations-4 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── constant-violations │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── deeply-nested │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── destructuring │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── eval-scope-ignore │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── eval-scope │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── export-decl-2 │ │ │ │ ├── actual.js │ │ │ │ ├── babel.json │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── export-decl-3 │ │ │ │ ├── actual.js │ │ │ │ ├── babel.json │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── export-decl-4 │ │ │ │ ├── actual.js │ │ │ │ ├── babel.json │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── export-decl │ │ │ │ ├── actual.js │ │ │ │ ├── babel.json │ │ │ │ └── expected.js │ │ │ ├── fn-only-thunk │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── fn-params │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── global-conflicts │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── globals-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── globals │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── hoisted │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-138 │ │ │ │ ├── actual.js │ │ │ │ ├── babel.json │ │ │ │ └── expected.js │ │ │ ├── issue-365-toplevel │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── issue-365 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-366 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-411 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-822 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── keep-class-name │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── keep-fn-name │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── labels-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── labels-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── labels │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── name-collisions │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── nested-loops │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── order-independence │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── recursion │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── reuse │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── safari-shadowing-loops-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── safari-shadowing-loops-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── safari-shadowing-loops │ │ │ │ ├── README.md │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── safari-toplevel-loops │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── shadow-outer │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── shadowing-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── shadowing │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── toplevel-and-exclude │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── toplevel │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── try-catch │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── with-block-scoping-1 │ │ │ │ ├── actual.js │ │ │ │ ├── babel.json │ │ │ │ └── expected.js │ │ │ ├── with-block-scoping-2 │ │ │ │ ├── actual.js │ │ │ │ ├── babel.json │ │ │ │ └── expected.js │ │ │ ├── with-block-scoping │ │ │ │ ├── actual.js │ │ │ │ ├── babel.json │ │ │ │ └── expected.js │ │ │ └── with-simplify │ │ │ │ ├── actual.js │ │ │ │ ├── babel.json │ │ │ │ └── expected.js │ │ ├── index.js │ │ └── mangle-names-test.js │ ├── package.json │ └── src │ │ ├── bfs-traverse.js │ │ ├── charset.js │ │ ├── counted-set.js │ │ ├── fixup-var-scoping.js │ │ ├── index.js │ │ ├── is-label-identifier.js │ │ └── scope-tracker.js ├── babel-plugin-minify-numeric-literals │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── exponential │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── extreme-float-resolution │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── float │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── integer-literals │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-minify-replace │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ └── replace-test.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-minify-simplify │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── arrow-block-empty │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── arrow-block │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── arrow-short-hand │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── bail-multiple-statements │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── block-to-sequence │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── combine-returns │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── common-conditional-expression-patterns │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── common-conditional-operations │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── convert-gaurded-nots-to-ors-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── convert-gaurded-nots-to-ors │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── do-while │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── early-return-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── early-returns │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── empty-blocks-to-empty-statements │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── empty-return │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── empty-vars-first │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── eqnull │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── flip-binary-expressions │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── flip-conditionals │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── flip-logical-expr-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── flip-logical-expr │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── for-sequence │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── handle-to-boolean-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── handle-to-boolean │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── handle-void-returns-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── handle-void-returns │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── hoist-functions │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-break-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-break-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-break-4 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-break-5 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-break │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-complex │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-conditional-return-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-conditional-return-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-conditional-return-4 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-conditional-return │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-continue-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-continue-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-continue │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-else-blocks │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-empty-blocks │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-return-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-return-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-return-4 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-return-5 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-return-6 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-return-hoisted-fn │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-return │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-sequence-test │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-gaurds │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-10 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-11 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-12 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-4 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-5 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-6 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-7 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-8 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-9 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-assignment-operator-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-assignment-operator-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-assignment-operator │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary-return-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── if-to-ternary │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── iife-to-unary │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── skip │ │ │ ├── issue-115 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-198 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-208 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-281 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-423 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-455 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-560 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-637 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── issue-689 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── keep-directives │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── merge-if-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── merge-if-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── merge-if-4 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── merge-if-5 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── merge-if │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── merge-return │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── merge-to-for-init-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── merge-to-for-init │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── remove-block-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── remove-block │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── remove-fn-expr-parens │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── remove-for-block │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── return-inside-loop │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── super-assignments │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-last-break-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-last-break │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-sequence-test │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-to-sequence │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-to-ternary-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-to-ternary-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-to-ternary-break-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-to-ternary-break │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-to-ternary-fallthrough-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-to-ternary-fallthrough │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── switch-expr-to-ternary │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── template-literals-assignments │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── throw-seq-expr │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── to-sequence-expr-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── to-sequence-expr │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── to-sequence-return-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── to-sequence-return │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── to-sequence │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── unary-conditional-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── unary-conditional │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── unary-sequence │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── whiles-to-fors-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── whiles-to-fors-3 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── whiles-to-fors │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ ├── index.js │ │ ├── pattern-match.js │ │ └── simplify-test.js │ ├── package.json │ └── src │ │ ├── assignment-expression.js │ │ ├── conditional-expression.js │ │ ├── helpers.js │ │ ├── if-statement.js │ │ ├── index.js │ │ ├── logical-expression.js │ │ └── pattern-match.js ├── babel-plugin-minify-type-constructors │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── array │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── basic │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── object-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── object │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── overriden │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ ├── index.js │ │ └── type-constructors-test.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-inline-consecutive-adds │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── array-non-int-index-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── array-non-int-index │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── array-out-of-bounds │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── array-overwrites │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── array-property-assignments-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── array-property-assignments │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── array-push │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── basic │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── circular-references-array │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── circular-references-set │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── circular-references │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── computed-properties-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── computed-properties │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── dependent-properties │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── indirect-dependent-properties-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── indirect-dependent-properties │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── last-expr-stmt │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── non-collapsable-lval │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── set-add │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ ├── array-collapser.js │ │ ├── array-property-collapser.js │ │ ├── collapser.js │ │ ├── index.js │ │ ├── object-collapser.js │ │ └── set-collapser.js ├── babel-plugin-transform-inline-environment-variables │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ └── inline-env-var-test.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-member-expression-literals │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── computed-props │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── invalid-ids │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── leading-zeros │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── member-expressions │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── numeric-literal │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── string-literal │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-merge-sibling-variables │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── block-scoped-for │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── block-scoped-outside-for │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── concat-var-for-loop │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── concat-var │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── lift-destructuring-var │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── lift-different-declars │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── lift-let-declars │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── lift-mult-declars │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── lift-no-loop-intializer │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── lift-not-initialized │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── lift-var-declars │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-minify-booleans │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ └── reduce-boolean │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-node-env-inline │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ └── node-env-inline-test.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-property-literals │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── computed-property │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── es5-unicode-property │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── invalid-es5-property │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── invalid-identifiers │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── leading-zeros │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── strip-quotes │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ ├── escape-string-literal.js │ │ ├── index.js │ │ └── property-name.js ├── babel-plugin-transform-regexp-constructors │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── const-references │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── empty-string │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── escape │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── expressions │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── forward-slash │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── newline │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── no-arguments │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── null │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── string │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── unicode-newline │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── whitespaces │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-remove-console │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── basic │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── bound-excludes │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── excludes │ │ │ │ ├── actual.js │ │ │ │ ├── expected.js │ │ │ │ └── options.json │ │ │ ├── guards │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── local-binding │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── member-expr-assignment-no-op │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── member-expr-no-op │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── replace-with-empty-block │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── top-level-stmts │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── top-level │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-remove-debugger │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── basic-2 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── basic │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── empty-block │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-remove-undefined │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── const-undefined │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── inner-blocks-let │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── let-undefined │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── let-void-0 │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── local-var-undef │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── lval-ref-fn-decl │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── mutually-recursive │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── not-referenced │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── referenced-vars-nested │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── referenced-vars │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── remove-multiple-undefined │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── rval-side-effects │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── sequence-expr-last-undef-safe │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── sequence-expr-last-undef │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── sequence-expr │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── undefined-return │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── var-declarations │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── var-in-loops │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── var-loops-kviolate │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-simplify-comparison-operators │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── already-simplified │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── equality-check │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── null-check │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ ├── strict-null │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── typeof-comparisons │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-plugin-transform-undefined-to-void │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── basic │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ │ └── member-expression │ │ │ │ ├── actual.js │ │ │ │ └── expected.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── index.js ├── babel-preset-minify │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── options-tests.js.snap │ │ ├── minify-env-tests.js │ │ ├── options-tests.js │ │ └── preset-tests.js │ ├── package.json │ └── src │ │ └── index.js └── gulp-babel-minify │ ├── .npmignore │ ├── README.md │ ├── __tests__ │ ├── __snapshots__ │ │ └── gulp-babili-test.js.snap │ └── gulp-babili-test.js │ ├── package.json │ └── src │ └── index.js ├── scripts ├── .eslintrc ├── .gitignore ├── NPM_OWNERS ├── benchmark.js ├── gcc.jar ├── npm-owner-grant.sh ├── npm-owner-update.sh ├── plugin-contribution.js ├── plugin-timing.js ├── pyflate.py └── test-files.sh ├── smoke ├── .eslintrc ├── break.js ├── circleci.sh ├── run.js └── smoke-test.js ├── utils ├── test-runner │ ├── package.json │ └── src │ │ ├── argParser.js │ │ ├── fs.js │ │ └── index.js ├── test-transform │ ├── package.json │ └── src │ │ └── test-transform.js └── unpad │ ├── package.json │ └── src │ └── unpad.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | insert_final_newline = true 5 | charset = utf-8 6 | trim_trailing_whitespace = true 7 | end_of_line = lf 8 | 9 | [*.{js,json}] 10 | indent_style = space 11 | indent_size = 2 12 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib/ 3 | scripts/benchmark_cache 4 | smoke/assets 5 | coverage 6 | fixtures 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | * text eol=lf 3 | *.jar binary 4 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @boopathi @vshanmugam 2 | packages/babel-plugin-minify-builtins/* @vshanmugam 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | coverage 4 | .test_gen_* 5 | lib/ 6 | *.log 7 | *~ 8 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | # required for yarn < 1.0.0 2 | workspaces-experimental true 3 | -------------------------------------------------------------------------------- /NPM_OWNERS: -------------------------------------------------------------------------------- 1 | amasad 2 | hzoo 3 | kangax 4 | boopathi 5 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | parsers: 3 | javascript: 4 | enable_partials: yes 5 | status: 6 | project: 7 | default: 8 | target: "80%" 9 | patch: 10 | enabled: false 11 | -------------------------------------------------------------------------------- /packages/babel-helper-evaluate-path/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-helper-flip-expressions/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-helper-flip-expressions/README.md: -------------------------------------------------------------------------------- 1 | # babel-helper-flip-expressions 2 | 3 | ## Installation 4 | 5 | ```sh 6 | npm install babel-helper-flip-expressions --save-dev 7 | ``` 8 | -------------------------------------------------------------------------------- /packages/babel-helper-is-void-0/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-helper-is-void-0/README.md: -------------------------------------------------------------------------------- 1 | # babel-helper-is-void-0 2 | 3 | ## Installation 4 | 5 | ```sh 6 | npm install babel-helper-is-void-0 --save-dev 7 | ``` 8 | -------------------------------------------------------------------------------- /packages/babel-helper-is-void-0/src/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(t) { 2 | return function isVoid0(expr) { 3 | return ( 4 | t.isUnaryExpression(expr, { operator: "void" }) && 5 | t.isNumericLiteral(expr.argument, { value: 0 }) 6 | ); 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /packages/babel-helper-mark-eval-scopes/README.md: -------------------------------------------------------------------------------- 1 | # babel-helper-mark-eval-scopes 2 | 3 | Traverse through input path and mark all scopes that contain Direct eval (`eval("")`) calls. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install babel-helper-mark-eval-scopes --save-dev 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/babel-helper-remove-or-void/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-helper-remove-or-void/README.md: -------------------------------------------------------------------------------- 1 | # babel-helper-remove-or-void 2 | 3 | ## Installation 4 | 5 | ```sh 6 | npm install babel-helper-remove-or-void --save-dev 7 | ``` 8 | -------------------------------------------------------------------------------- /packages/babel-helper-to-multiple-sequence-expressions/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-helper-to-multiple-sequence-expressions/README.md: -------------------------------------------------------------------------------- 1 | # babel-helper-to-multiple-sequence-expressions 2 | 3 | ## Installation 4 | 5 | ```sh 6 | npm install babel-helper-to-multiple-sequence-expressions --save-dev 7 | ``` 8 | -------------------------------------------------------------------------------- /packages/babel-minify/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-minify/__tests__/fixtures/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-unused-vars": "off", 4 | "no-undef": "off" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-minify/__tests__/fixtures/out-dir/a/foo.js: -------------------------------------------------------------------------------- 1 | let foo = 10; 2 | -------------------------------------------------------------------------------- /packages/babel-minify/__tests__/fixtures/out-file/foo.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | const bar = x(1); 3 | const baz = y(2); 4 | return z(bar, baz); 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-minify/bin/minify.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require("../lib/cli"); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/arrow-without-block/actual.js: -------------------------------------------------------------------------------- 1 | const a = () => Math.floor(b) + Math.floor(b); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/arrow-without-block/expected.js: -------------------------------------------------------------------------------- 1 | const a = () => Math.floor(b) + Math.floor(b); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/builtin-methods/actual.js: -------------------------------------------------------------------------------- 1 | function c() { 2 | let a = 10; 3 | const d = Number.isNaN(a); 4 | Math.max(a, b) + Math.max(b, a); 5 | return d && Number.isFinite(a); 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/builtin-methods/expected.js: -------------------------------------------------------------------------------- 1 | function c() { 2 | var _Mathmax = Math.max; 3 | let a = 10; 4 | const d = Number.isNaN(a); 5 | _Mathmax(a, b) + _Mathmax(b, a); 6 | return d && Number.isFinite(a); 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/builtin-props/actual.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | Number.NAN + Number.NAN; 3 | return Math.PI + Math.PI + Number.EPSILON + Number.NAN; 4 | } 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/builtin-props/expected.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | var _MathPI = Math.PI; 3 | var _NumberNAN = Number.NAN; 4 | _NumberNAN + _NumberNAN; 5 | return _MathPI + _MathPI + Number.EPSILON + _NumberNAN; 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/computed-props/actual.js: -------------------------------------------------------------------------------- 1 | let max = "floor"; 2 | Math[max](1.5); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/computed-props/expected.js: -------------------------------------------------------------------------------- 1 | let max = "floor"; 2 | Math[max](1.5); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/evaluate-builtins/actual.js: -------------------------------------------------------------------------------- 1 | const a = Math.max(Math.floor(2), 5); 2 | let b = 1.8; 3 | let x = Math.floor(Math.max(a, b)); 4 | foo(x); 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/evaluate-builtins/expected.js: -------------------------------------------------------------------------------- 1 | const a = Math.max(Math.floor(2), 5); 2 | let b = 1.8; 3 | let x = Math.floor(Math.max(a, b)); 4 | foo(x); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/multiple-occurences/actual.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | Math.floor(a) + Math.floor(b) + Math.min(a, b); 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/multiple-occurences/expected.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | var _Mathfloor = Math.floor; 3 | _Mathfloor(a) + _Mathfloor(b) + Math.min(a, b); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/program-scope/actual.js: -------------------------------------------------------------------------------- 1 | Math.max(c, d); 2 | function a() { 3 | Math.max(b, a) + Math.max(c, d); 4 | } 5 | Math.max(e, f); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/program-scope/expected.js: -------------------------------------------------------------------------------- 1 | Math.max(c, d); 2 | 3 | function a() { 4 | var _Mathmax = Math.max; 5 | _Mathmax(b, a) + _Mathmax(c, d); 6 | } 7 | 8 | Math.max(e, f); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/props-polyfilled/actual.js: -------------------------------------------------------------------------------- 1 | Math["a"] = "blah"; 2 | Math.a(); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/props-polyfilled/expected.js: -------------------------------------------------------------------------------- 1 | Math["a"] = "blah"; 2 | Math.a(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/side-effecty/actual.js: -------------------------------------------------------------------------------- 1 | Math.max(foo(), 1); 2 | Math.random(); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/fixtures/side-effecty/expected.js: -------------------------------------------------------------------------------- 1 | Math.max(foo(), 1); 2 | Math.random(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-builtins/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-constant-folding/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-constant-folding/__tests__/fixtures/basic/actual.js: -------------------------------------------------------------------------------- 1 | "a" + "b"; 2 | 2 * 3; 3 | 1 / 3; 4 | 4 | 3; 5 | a(), b(); 6 | var x = 1; 7 | foo(x); 8 | "b" + a + "c" + "d" + g + z + "f" + "h" + "z"; 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-constant-folding/__tests__/fixtures/basic/expected.js: -------------------------------------------------------------------------------- 1 | "ab"; 2 | 6; 3 | 1 / 3; 4 | 7; 5 | a(), b(); 6 | var x = 1; 7 | foo(1); 8 | "b" + a + "cd" + g + z + "fhz"; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-constant-folding/__tests__/fixtures/export-specifier/actual.js: -------------------------------------------------------------------------------- 1 | const a = "a"; 2 | const b = "b"; 3 | export { a, b }; 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-constant-folding/__tests__/fixtures/export-specifier/babel.json: -------------------------------------------------------------------------------- 1 | { 2 | "sourceType": "module" 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-constant-folding/__tests__/fixtures/export-specifier/expected.js: -------------------------------------------------------------------------------- 1 | const a = "a"; 2 | const b = "b"; 3 | export { a, b }; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-constant-folding/__tests__/fixtures/html-comment-escape/actual.js: -------------------------------------------------------------------------------- 1 | " d.x; 5 | return inner; 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-130/expected.js: -------------------------------------------------------------------------------- 1 | // https://github.com/babel/minify/issues/130 2 | // https://github.com/babel/minify/pull/132 3 | function outer() { 4 | return d => d.x; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-574/actual.js: -------------------------------------------------------------------------------- 1 | function foo(v) { 2 | if (v) var w = 10; 3 | if (w) console.log("hello", v); 4 | } 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-574/expected.js: -------------------------------------------------------------------------------- 1 | function foo(v) { 2 | if (v) var w = 10; 3 | if (w) console.log("hello", v); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-611/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function count() { 3 | let count = 1; 4 | bar(count); 5 | return count; 6 | } 7 | return count; 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-611/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function count() { 3 | let count = 1; 4 | bar(count); 5 | return count; 6 | } 7 | 8 | return count; 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-691-binary-in/actual.js: -------------------------------------------------------------------------------- 1 | function foo(props) { 2 | let bar = "width" in props; 3 | delete props.width; 4 | if (bar) { 5 | console.log("foo"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-691-binary-in/expected.js: -------------------------------------------------------------------------------- 1 | function foo(props) { 2 | let bar = ("width" in props); 3 | delete props.width; 4 | 5 | if (bar) { 6 | console.log("foo"); 7 | } 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-78/actual.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var B = class A { 3 | constructor(x) { 4 | console.log(x); 5 | } 6 | }; 7 | self.addEventListener(function(event) { 8 | new B(event); 9 | }); 10 | })(); 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-78/expected.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | var B = class { 3 | constructor(x) { 4 | console.log(x); 5 | } 6 | 7 | }; 8 | self.addEventListener(function (event) { 9 | new B(event); 10 | }); 11 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-871/actual.js: -------------------------------------------------------------------------------- 1 | async function example() { 2 | var foo, bar; 3 | try { 4 | [foo, bar] = await Promise.all([req(1), req(2)]); 5 | } catch (e) {} 6 | console.log(foo); 7 | } 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-871/expected.js: -------------------------------------------------------------------------------- 1 | async function example() { 2 | var foo, bar; 3 | 4 | try { 5 | [foo, bar] = await Promise.all([req(1), req(2)]); 6 | } catch (e) {} 7 | 8 | console.log(foo); 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-922/actual.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | ++i; 3 | while (false) { 4 | var i = meow(); 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-922/expected.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | ++i; 3 | var i; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-981/actual.js: -------------------------------------------------------------------------------- 1 | function f(query) { 2 | var r = /./g, 3 | part; 4 | while (part = r.exec(query)); 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/issue-981/expected.js: -------------------------------------------------------------------------------- 1 | function f(query) { 2 | var r = /./g, 3 | part; 4 | 5 | while (part = r.exec(query)); 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/join-var-decl-and-assignment/actual.js: -------------------------------------------------------------------------------- 1 | var x; 2 | x = 1; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/join-var-decl-and-assignment/expected.js: -------------------------------------------------------------------------------- 1 | var x = 1; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/keep-class-name/actual.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | class A {} 3 | exports.A = A; 4 | var B = class B {}; 5 | exports.B = B; 6 | class AA {} 7 | new AA(); 8 | })(); 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/keep-class-name/expected.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | exports.A = class A {}; 3 | exports.B = class B {}; 4 | new class AA {}(); 5 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/keep-class-name/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "keepClassName": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/keep-fn-args/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "keepFnArgs": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/keep-fn-name/actual.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function A() {} 3 | exports.A = A; 4 | var B = function B() {}; 5 | exports.B = B; 6 | onClick(function C() {}); 7 | })(); 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/keep-fn-name/expected.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | exports.A = function A() {}; 3 | 4 | exports.B = function B() {}; 5 | 6 | onClick(function C() {}); 7 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/keep-fn-name/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "keepFnName": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/multiple-refs/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var x = function() { 3 | if (!y) { 4 | y = 1; 5 | } 6 | }; 7 | x(); 8 | x(); 9 | var y = null; 10 | } 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/multiple-refs/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var x = function () { 3 | if (!y) { 4 | y = 1; 5 | } 6 | }; 7 | 8 | x(); 9 | x(); 10 | var y = null; 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/named-class-expr-used/actual.js: -------------------------------------------------------------------------------- 1 | var Foo = class Bar { 2 | constructor() { 3 | console.log(Bar); 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/named-class-expr-used/expected.js: -------------------------------------------------------------------------------- 1 | var Foo = class Bar { 2 | constructor() { 3 | console.log(Bar); 4 | } 5 | 6 | }; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/named-class-expr/actual.js: -------------------------------------------------------------------------------- 1 | var Foo = class Bar {}; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/named-class-expr/expected.js: -------------------------------------------------------------------------------- 1 | var Foo = class {}; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/no-refs-bindings/actual.js: -------------------------------------------------------------------------------- 1 | // basic 2 | function foo() { 3 | var x = 1; 4 | } 5 | 6 | // impure right 7 | function bar() { 8 | var x = f(); 9 | } 10 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/no-refs-bindings/expected.js: -------------------------------------------------------------------------------- 1 | // basic 2 | function foo() {} // impure right 3 | 4 | 5 | function bar() { 6 | f(); 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/orphaned-returns/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "tdz": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/redundant-use-strict/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | "use strict"; 3 | function bar() { 4 | "use strict"; 5 | bar(); 6 | } 7 | bar.call(); 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/redundant-use-strict/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | "use strict"; 3 | 4 | function bar() { 5 | bar(); 6 | } 7 | 8 | bar.call(); 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/shadow-class-name/actual.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var A = class A { 3 | constructor() { 4 | this.class = A; 5 | } 6 | }; 7 | var B = class B {}; 8 | exports.A = A; 9 | exports.B = B; 10 | })(); 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/shadow-class-name/expected.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | exports.A = class A { 3 | constructor() { 4 | this.class = A; 5 | } 6 | 7 | }; 8 | exports.B = class {}; 9 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/side-effect-less-statements/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | 1; 3 | } 4 | 5 | function bar() { 6 | while (wat()) 1; 7 | } 8 | 9 | function baz() { 10 | while (wat()) var x; 11 | } 12 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/side-effect-less-statements/expected.js: -------------------------------------------------------------------------------- 1 | function foo() {} 2 | 3 | function bar() { 4 | while (wat()); 5 | } 6 | 7 | function baz() { 8 | while (wat()); 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/side-effecty-assignment/actual.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | var x; 3 | x = wow(); 4 | } 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/side-effecty-assignment/expected.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | wow(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/tdz/actual.js: -------------------------------------------------------------------------------- 1 | function baz() { 2 | function bar() { 3 | if (a) console.log(a); 4 | } 5 | let a = 1; 6 | return bar; 7 | } 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/tdz/expected.js: -------------------------------------------------------------------------------- 1 | function baz() { 2 | let a = 1; 3 | return function () { 4 | if (a) console.log(a); 5 | }; 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/tdz/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "tdz": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/toplevel-class/actual.js: -------------------------------------------------------------------------------- 1 | class Foo {} 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/toplevel-class/expected.js: -------------------------------------------------------------------------------- 1 | class Foo {} -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/track-purity/actual.js: -------------------------------------------------------------------------------- 1 | function x(a) { 2 | var l = a; 3 | var x = l; 4 | foo(x); 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/track-purity/expected.js: -------------------------------------------------------------------------------- 1 | function x(a) { 2 | foo(a); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/unused-decl-and-assignments/expected.js: -------------------------------------------------------------------------------- 1 | function a() {} // bail case 2 | 3 | 4 | function b() { 5 | var x = 1; 6 | 7 | while (a) wow = x += 1; 8 | } 9 | 10 | function foo() { 11 | while (wat()); 12 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/used-expressions/actual.js: -------------------------------------------------------------------------------- 1 | var n = 1; 2 | if (foo) n; 3 | console.log(n); 4 | 5 | function bar(a) { 6 | var a = a ? a : a; 7 | } 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/fixtures/used-expressions/expected.js: -------------------------------------------------------------------------------- 1 | var n = 1; 2 | if (foo) ; 3 | console.log(n); 4 | 5 | function bar(a) { 6 | var a = a ? a : a; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-dead-code-elimination/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-flip-comparisons/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-constants-first/actual.js: -------------------------------------------------------------------------------- 1 | // constants first 2 | a === -1; 3 | 4 | x * 100; 5 | x + 100; 6 | x - 100; 7 | x / 100; 8 | x > 100; 9 | x === void 0; 10 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-constants-first/expected.js: -------------------------------------------------------------------------------- 1 | // constants first 2 | -1 === a; 3 | 100 * x; 4 | x + 100; 5 | x - 100; 6 | x / 100; 7 | 100 < x; 8 | void 0 === x; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-pures-first/actual.js: -------------------------------------------------------------------------------- 1 | // pures first 2 | 3 | a === null; 4 | 5 | a === {}; 6 | 7 | function foo() { 8 | if (foo !== null) { 9 | var bar; 10 | bar = baz; 11 | } 12 | x(); 13 | return x; 14 | } 15 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-pures-first/expected.js: -------------------------------------------------------------------------------- 1 | // pures first 2 | null === a; 3 | ({}) === a; 4 | 5 | function foo() { 6 | if (null !== foo) { 7 | var bar; 8 | bar = baz; 9 | } 10 | 11 | x(); 12 | return x; 13 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-values-first/actual.js: -------------------------------------------------------------------------------- 1 | // values first 2 | a === 1; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-values-first/expected.js: -------------------------------------------------------------------------------- 1 | // values first 2 | 1 === a; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-flip-comparisons/__tests__/fixtures/conditionals-same-consequent/actual.js: -------------------------------------------------------------------------------- 1 | x === null ? undefined : x === undefined ? undefined : x ? foo(x) : wat(); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-flip-comparisons/__tests__/fixtures/conditionals-same-consequent/expected.js: -------------------------------------------------------------------------------- 1 | null === x ? undefined : x === undefined ? undefined : x ? foo(x) : wat(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-flip-comparisons/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-guarded-expressions/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-guarded-expressions/__tests__/fixtures/flip-logical-expr/actual.js: -------------------------------------------------------------------------------- 1 | !x && foo(); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-guarded-expressions/__tests__/fixtures/flip-logical-expr/expected.js: -------------------------------------------------------------------------------- 1 | x || foo(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-guarded-expressions/__tests__/fixtures/reachable-impure-stmts/actual.js: -------------------------------------------------------------------------------- 1 | a && void alert("Side effect"); 2 | alert(func() || true); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-guarded-expressions/__tests__/fixtures/reachable-impure-stmts/expected.js: -------------------------------------------------------------------------------- 1 | a && void alert("Side effect"); 2 | alert(func() || true); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-guarded-expressions/__tests__/fixtures/simplify-falsy-expr/expected.js: -------------------------------------------------------------------------------- 1 | alert(0); 2 | if (0) for (;;); 3 | alert(false); 4 | alert(undefined); 5 | alert(null); 6 | alert(""); 7 | alert(new Foo() || false); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-guarded-expressions/__tests__/fixtures/simplify-truthy-expr/actual.js: -------------------------------------------------------------------------------- 1 | alert(1 && new Bar()); 2 | alert(true && new Bar()); 3 | alert("hello" && new Bar()); 4 | alert(!false && new Bar()); 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-guarded-expressions/__tests__/fixtures/simplify-truthy-expr/expected.js: -------------------------------------------------------------------------------- 1 | alert(new Bar()); 2 | alert(new Bar()); 3 | alert(new Bar()); 4 | alert(new Bar()); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-guarded-expressions/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/assignment-expr/actual.js: -------------------------------------------------------------------------------- 1 | Infinity = 1; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/assignment-expr/expected.js: -------------------------------------------------------------------------------- 1 | Infinity = 1; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/bindings/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | let [Infinity] = some(); 3 | return Infinity; 4 | } 5 | 6 | function bar() { 7 | let [...Infinity] = some(); 8 | } 9 | 10 | function baz() { 11 | let { inf = Infinity } = some(); 12 | } 13 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/destructure/actual.js: -------------------------------------------------------------------------------- 1 | ({ Infinity } = 1); 2 | [Infinity] = foo; 3 | [...Infinity] = foo; 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/destructure/expected.js: -------------------------------------------------------------------------------- 1 | ({ 2 | Infinity 3 | } = 1); 4 | [Infinity] = foo; 5 | [...Infinity] = foo; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/expressions/actual.js: -------------------------------------------------------------------------------- 1 | let x = [Infinity, Infinity]; 2 | 3 | let y = [ 4 | { 5 | a: Infinity 6 | }, 7 | { 8 | a: Infinity 9 | } 10 | ]; 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/expressions/expected.js: -------------------------------------------------------------------------------- 1 | let x = [1 / 0, 1 / 0]; 2 | let y = [{ 3 | a: 1 / 0 4 | }, { 5 | a: 1 / 0 6 | }]; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/fn-param/actual.js: -------------------------------------------------------------------------------- 1 | function a(Infinity) {} 2 | function b(...Infinity) {} 3 | function c({ Infinity }) {} 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/fn-param/expected.js: -------------------------------------------------------------------------------- 1 | function a(Infinity) {} 2 | 3 | function b(...Infinity) {} 4 | 5 | function c({ 6 | Infinity 7 | }) {} -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/property/actual.js: -------------------------------------------------------------------------------- 1 | var x = { Infinity: 0 }; 2 | x.Infinity; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/property/expected.js: -------------------------------------------------------------------------------- 1 | var x = { 2 | Infinity: 0 3 | }; 4 | x.Infinity; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/to-1-over-0/actual.js: -------------------------------------------------------------------------------- 1 | Infinity; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/fixtures/to-1-over-0/expected.js: -------------------------------------------------------------------------------- 1 | 1 / 0; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-infinity/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/basic/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var xxx = 1; 3 | if (xxx) { 4 | console.log(xxx); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/basic/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var a = 1; 3 | 4 | if (a) { 5 | console.log(a); 6 | } 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/classes/actual.js: -------------------------------------------------------------------------------- 1 | class A {} 2 | class B {} 3 | new A(); 4 | new B(); 5 | function a() { 6 | class A {} 7 | class B {} 8 | new A(); 9 | new B(); 10 | } 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/classes/expected.js: -------------------------------------------------------------------------------- 1 | class A {} 2 | 3 | class B {} 4 | 5 | new A(); 6 | new B(); 7 | 8 | function a() { 9 | class a {} 10 | 11 | class b {} 12 | 13 | new a(); 14 | new b(); 15 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/closures-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function bar(baz) { 3 | return function() { 4 | bam(); 5 | }; 6 | } 7 | function bam() {} 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/closures-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function a(a) { 3 | return function () { 4 | b(); 5 | }; 6 | } 7 | 8 | function b() {} 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/closures/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function bar() { 3 | var baz; 4 | if (baz) { 5 | bam(); 6 | } 7 | } 8 | function bam() {} 9 | } 10 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/closures/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function a() { 3 | var a; 4 | 5 | if (a) { 6 | b(); 7 | } 8 | } 9 | 10 | function b() {} 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations-2/actual.js: -------------------------------------------------------------------------------- 1 | !function() { 2 | var bar = 1; 3 | bar--; 4 | var bar = 10; 5 | foo(bar); 6 | function foo() { 7 | var foo = 10; 8 | foo++; 9 | var foo = 20; 10 | foo(foo); 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations-2/expected.js: -------------------------------------------------------------------------------- 1 | !function () { 2 | var a = 1; 3 | a--; 4 | var a = 10; 5 | b(a); 6 | 7 | function b() { 8 | var a = 10; 9 | a++; 10 | var a = 20; 11 | a(a); 12 | } 13 | }; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations-3/actual.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var foo = bar, 3 | foo = baz; 4 | foo; 5 | })(); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations-3/expected.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | var a = bar, 3 | a = baz; 4 | a; 5 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations/actual.js: -------------------------------------------------------------------------------- 1 | !function() { 2 | var foo = 1; 3 | foo++; 4 | var foo = 2; 5 | foo++; 6 | }; 7 | 8 | (function() { 9 | var x = y; 10 | x = z; 11 | x; 12 | })(); 13 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations/expected.js: -------------------------------------------------------------------------------- 1 | !function () { 2 | var a = 1; 3 | a++; 4 | var a = 2; 5 | a++; 6 | }; 7 | 8 | (function () { 9 | var a = y; 10 | a = z; 11 | a; 12 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/eval-scope-ignore/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var inScopeOuter = 1; 3 | (function() { 4 | var inScopeInner = 2; 5 | eval("..."); 6 | (function() { 7 | var outOfScope = 1; 8 | })(); 9 | })(); 10 | } 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/eval-scope-ignore/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var a = 1; 3 | 4 | (function () { 5 | var a = 2; 6 | eval("..."); 7 | 8 | (function () { 9 | var a = 1; 10 | })(); 11 | })(); 12 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/eval-scope-ignore/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "eval": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-2/actual.js: -------------------------------------------------------------------------------- 1 | export const Foo = foo; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-2/babel.json: -------------------------------------------------------------------------------- 1 | { 2 | "sourceType": "module" 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-2/expected.js: -------------------------------------------------------------------------------- 1 | export const Foo = foo; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-2/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "topLevel": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-3/actual.js: -------------------------------------------------------------------------------- 1 | const Foo = a; 2 | export { Foo }; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-3/babel.json: -------------------------------------------------------------------------------- 1 | { 2 | "sourceType": "module" 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-3/expected.js: -------------------------------------------------------------------------------- 1 | const b = a; 2 | export { b as Foo }; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-3/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "topLevel": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-4/actual.js: -------------------------------------------------------------------------------- 1 | const Foo = a; 2 | export { Foo as Bar }; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-4/babel.json: -------------------------------------------------------------------------------- 1 | { 2 | "sourceType": "module" 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-4/expected.js: -------------------------------------------------------------------------------- 1 | const b = a; 2 | export { b as Bar }; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl-4/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "topLevel": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl/actual.js: -------------------------------------------------------------------------------- 1 | const foo = 1; 2 | export { foo }; 3 | export const bar = 2; 4 | export function baz(bar, foo) { 5 | bar(); 6 | foo(); 7 | } 8 | export default function(bar, baz) { 9 | bar(); 10 | baz(); 11 | } 12 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl/babel.json: -------------------------------------------------------------------------------- 1 | { 2 | "sourceType": "module" 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/export-decl/expected.js: -------------------------------------------------------------------------------- 1 | const foo = 1; 2 | export { foo }; 3 | export const bar = 2; 4 | export function baz(a, b) { 5 | a(); 6 | b(); 7 | } 8 | export default function (a, b) { 9 | a(); 10 | b(); 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/fn-only-thunk/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function xx(bar, baz) { 3 | if (1) { 4 | yy(bar, baz); 5 | } 6 | } 7 | function yy() {} 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/fn-only-thunk/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function a(a, c) { 3 | if (1) { 4 | b(a, c); 5 | } 6 | } 7 | 8 | function b() {} 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/fn-params/actual.js: -------------------------------------------------------------------------------- 1 | function foo(xxx) { 2 | if (xxx) { 3 | console.log(xxx); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/fn-params/expected.js: -------------------------------------------------------------------------------- 1 | function foo(a) { 2 | if (a) { 3 | console.log(a); 4 | } 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/global-conflicts/actual.js: -------------------------------------------------------------------------------- 1 | function e() { 2 | function foo() { 3 | b = bar(); 4 | } 5 | function bar() {} 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/global-conflicts/expected.js: -------------------------------------------------------------------------------- 1 | function e() { 2 | function a() { 3 | b = c(); 4 | } 5 | 6 | function c() {} 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/globals-2/actual.js: -------------------------------------------------------------------------------- 1 | class A {} 2 | class B extends A {} 3 | (function() { 4 | class C { 5 | constructor() { 6 | new A(); 7 | new B(); 8 | C; 9 | } 10 | } 11 | })(); 12 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/globals-2/expected.js: -------------------------------------------------------------------------------- 1 | class A {} 2 | 3 | class B extends A {} 4 | 5 | (function () { 6 | class a { 7 | constructor() { 8 | new A(); 9 | new B(); 10 | a; 11 | } 12 | 13 | } 14 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/globals/actual.js: -------------------------------------------------------------------------------- 1 | var Foo = 1; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/globals/expected.js: -------------------------------------------------------------------------------- 1 | var Foo = 1; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/hoisted/actual.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function foo() { 3 | { 4 | var baz = true; 5 | 6 | { 7 | bar(); 8 | } 9 | } 10 | } 11 | 12 | function bar() {} 13 | })(); 14 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/hoisted/expected.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | function a() { 3 | { 4 | var a = true; 5 | { 6 | b(); 7 | } 8 | } 9 | } 10 | 11 | function b() {} 12 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-138/actual.js: -------------------------------------------------------------------------------- 1 | export class App extends Object {} 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-138/babel.json: -------------------------------------------------------------------------------- 1 | { 2 | "sourceType": "module" 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-138/expected.js: -------------------------------------------------------------------------------- 1 | export class App extends Object {} -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-365-toplevel/actual.js: -------------------------------------------------------------------------------- 1 | class A {} 2 | class B {} 3 | eval(""); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-365-toplevel/expected.js: -------------------------------------------------------------------------------- 1 | class A {} 2 | 3 | class B {} 4 | 5 | eval(""); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-365-toplevel/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "topLevel": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-365/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | eval(""); 3 | class A {} 4 | class B {} 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-365/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | eval(""); 3 | 4 | class A {} 5 | 6 | class B {} 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-366/actual.js: -------------------------------------------------------------------------------- 1 | function myEval(code, _var_) { 2 | eval(code); 3 | } 4 | myEval("console.log(_var_)", "myValue"); 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-366/expected.js: -------------------------------------------------------------------------------- 1 | function myEval(code, _var_) { 2 | eval(code); 3 | } 4 | 5 | myEval("console.log(_var_)", "myValue"); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-411/actual.js: -------------------------------------------------------------------------------- 1 | !(function() { 2 | function e(e) { 3 | foo(e); 4 | } 5 | return function() { 6 | return e(); 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-411/expected.js: -------------------------------------------------------------------------------- 1 | !function () { 2 | function a(a) { 3 | foo(a); 4 | } 5 | 6 | return function () { 7 | return a(); 8 | }; 9 | }(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/keep-class-name/actual.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | class Foo {} 3 | const Bar = class Bar extends Foo {}; 4 | var foo = class Baz {}; 5 | function bar() { 6 | new foo(); 7 | } 8 | bar(); 9 | })(); 10 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/keep-class-name/expected.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | class Foo {} 3 | 4 | const a = class Bar extends Foo {}; 5 | var b = class Baz {}; 6 | 7 | function c() { 8 | new b(); 9 | } 10 | 11 | c(); 12 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/keep-class-name/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "keepClassName": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/keep-fn-name/actual.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var foo = function foo() { 3 | foo(); 4 | }; 5 | function bar() { 6 | foo(); 7 | } 8 | bar(); 9 | var baz = foo; 10 | baz(); 11 | })(); 12 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/keep-fn-name/expected.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | var a = function foo() { 3 | foo(); 4 | }; 5 | 6 | function bar() { 7 | a(); 8 | } 9 | 10 | bar(); 11 | var b = a; 12 | b(); 13 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/keep-fn-name/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "keepFnName": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/labels-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | meh: for (;;) { 3 | var meh; 4 | break meh; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/labels-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | meh: for (;;) { 3 | var a; 4 | break meh; 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/labels/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | meh: for (;;) { 3 | continue meh; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/labels/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | meh: for (;;) { 3 | continue meh; 4 | } 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/name-collisions/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var x = 2; 3 | var xxx = 1; 4 | if (xxx) { 5 | console.log(xxx + x); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/name-collisions/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var a = 2; 3 | var b = 1; 4 | 5 | if (b) { 6 | console.log(b + a); 7 | } 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/nested-loops/actual.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | for (let x in foo) { 3 | for (let y in foo[x]) { 4 | alert(foo[x][y]); 5 | } 6 | } 7 | })(); 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/nested-loops/expected.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | for (let a in foo) { 3 | for (let b in foo[a]) { 4 | alert(foo[a][b]); 5 | } 6 | } 7 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/recursion/actual.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | function foo(a, b, c) { 3 | foo(a, b, c); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/recursion/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | function d(e, a, b) { 3 | d(e, a, b); 4 | } 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/shadow-outer/actual.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | function foo(a, b, c) { 3 | lol(a, b, c); 4 | } 5 | function lol() {} 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/shadow-outer/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | function a(e, a, b) { 3 | d(e, a, b); 4 | } 5 | 6 | function d() {} 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/shadowing-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function xx(bar, baz) { 3 | return function(boo, foo) { 4 | bar(boo, foo); 5 | }; 6 | } 7 | function yy() {} 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/shadowing-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function a(a, b) { 3 | return function (b, c) { 4 | a(b, c); 5 | }; 6 | } 7 | 8 | function b() {} 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/shadowing/actual.js: -------------------------------------------------------------------------------- 1 | var a = 1; 2 | function foo() { 3 | var xxx = 1; 4 | if (xxx) { 5 | console.log(xxx); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/shadowing/expected.js: -------------------------------------------------------------------------------- 1 | var a = 1; 2 | 3 | function foo() { 4 | var a = 1; 5 | 6 | if (a) { 7 | console.log(a); 8 | } 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/toplevel-and-exclude/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var bar = 1; 3 | var baz = 2; 4 | } 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/toplevel-and-exclude/expected.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | var bar = 1; 3 | var a = 2; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/toplevel-and-exclude/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": { 3 | "foo": false, 4 | "bar": true 5 | }, 6 | "topLevel": true 7 | } 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/toplevel/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "topLevel": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/try-catch/actual.js: -------------------------------------------------------------------------------- 1 | function xoo() { 2 | var e; 3 | try { 4 | } catch (e) {} 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/try-catch/expected.js: -------------------------------------------------------------------------------- 1 | function xoo() { 2 | var a; 3 | 4 | try {} catch (a) {} 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/with-block-scoping-1/babel.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "@babel/plugin-transform-block-scoping" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/with-block-scoping-2/actual.js: -------------------------------------------------------------------------------- 1 | // #issue55, #issue57 2 | (function() { 3 | (function() { 4 | for (let x in y) y[x]; 5 | f(() => { 6 | g(); 7 | }); 8 | })(); 9 | function g() {} 10 | })(); 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/with-block-scoping-2/babel.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-env" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/with-block-scoping/actual.js: -------------------------------------------------------------------------------- 1 | function f(x) { 2 | for (let i = 0; i; i++) { 3 | let n; 4 | if (n) { 5 | return; 6 | } 7 | g(() => n); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/with-block-scoping/babel.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "@babel/plugin-transform-block-scoping" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/with-simplify/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x) return; 3 | function bar() {} 4 | bar(a); 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/with-simplify/babel.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "minify-simplify" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/fixtures/with-simplify/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function b() {} 3 | 4 | x || b(a); 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-mangle-names/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-numeric-literals/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-numeric-literals/__tests__/fixtures/exponential/actual.js: -------------------------------------------------------------------------------- 1 | [1e1, 1e2, 1.5e3, -1e1, -1e2, -1.5e3, 1e-1, 1e-2, 1.5e-3, 1e-4]; 2 | [1.5e4, 15e-2, 1.5e-4]; 3 | [123000, 12345600000]; 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-numeric-literals/__tests__/fixtures/exponential/expected.js: -------------------------------------------------------------------------------- 1 | [10, 1e2, 1500, -10, -1e2, -1500, .1, .01, .0015, 1e-4]; 2 | [15e3, .15, 15e-5]; 3 | [123e3, 123456e5]; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-numeric-literals/__tests__/fixtures/extreme-float-resolution/actual.js: -------------------------------------------------------------------------------- 1 | [+0.000000000001, -0.00000000001]; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-numeric-literals/__tests__/fixtures/extreme-float-resolution/expected.js: -------------------------------------------------------------------------------- 1 | [+1e-12, -1e-11]; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-numeric-literals/__tests__/fixtures/float/actual.js: -------------------------------------------------------------------------------- 1 | [.123456, 1.23456, 12.3456, -0.123456, -1.23456, -12.3456]; 2 | [0.10, 0.010, 0.0010]; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-numeric-literals/__tests__/fixtures/float/expected.js: -------------------------------------------------------------------------------- 1 | [.123456, 1.23456, 12.3456, -.123456, -1.23456, -12.3456]; 2 | [.1, .01, .001]; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-numeric-literals/__tests__/fixtures/integer-literals/expected.js: -------------------------------------------------------------------------------- 1 | [1, 10, 100, 1e3, 1e4, -1, -10, -100, -1e3, -1e4]; 2 | [1, 10, 100, 1e3, 0xfffffff, -1, -10, -100, -1e3, -0xfffffff]; 3 | [1, 10, 100, 1e3, -1, -10, -100, -1e3]; 4 | [1, 10, 100, 1e3, -1, -10, -100, -1e3]; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-numeric-literals/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-replace/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/arrow-block-empty/actual.js: -------------------------------------------------------------------------------- 1 | const a = () => {}; 2 | const b = () => {return;}; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/arrow-block-empty/expected.js: -------------------------------------------------------------------------------- 1 | const a = () => {}; 2 | 3 | const b = () => {}; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/arrow-block/actual.js: -------------------------------------------------------------------------------- 1 | const a = () => {return (3, 4);}; 2 | const b = () => {return 3;}; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/arrow-block/expected.js: -------------------------------------------------------------------------------- 1 | const a = () => (3, 4); 2 | 3 | const b = () => 3; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/arrow-short-hand/actual.js: -------------------------------------------------------------------------------- 1 | const f = () => a; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/arrow-short-hand/expected.js: -------------------------------------------------------------------------------- 1 | const f = () => a; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/bail-multiple-statements/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if(window.self != window.top) { 3 | if(__DEV__) { 4 | console.log('lol', name); 5 | } 6 | return; 7 | } 8 | lol(); 9 | try { lol() } catch (e) {} 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/bail-multiple-statements/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (window.self != window.top) return void (__DEV__ && console.log('lol', name)); 3 | lol(); 4 | 5 | try { 6 | lol(); 7 | } catch (e) {} 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/block-to-sequence/actual.js: -------------------------------------------------------------------------------- 1 | for (var x = 0; x < 10; x++) { 2 | console.log(x); 3 | console.log(x); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/block-to-sequence/expected.js: -------------------------------------------------------------------------------- 1 | for (var x = 0; x < 10; x++) console.log(x), console.log(x); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/combine-returns/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (a) { 3 | if (a.b) { 4 | if(a.b.c) { 5 | if(a.b.c()){ 6 | return; 7 | } 8 | } 9 | } 10 | } 11 | for (; true;) wat(); 12 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/combine-returns/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (!(a && a.b && a.b.c && a.b.c())) for (; true;) wat(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/common-conditional-operations/actual.js: -------------------------------------------------------------------------------- 1 | function h1() { return a && b ? (foo(), true) : false } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/common-conditional-operations/expected.js: -------------------------------------------------------------------------------- 1 | function h1() { 2 | return !!(a && b) && (foo(), true); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/convert-gaurded-nots-to-ors-2/actual.js: -------------------------------------------------------------------------------- 1 | if (!foo && foo !== bar) { 2 | wow(); 3 | such(); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/convert-gaurded-nots-to-ors-2/expected.js: -------------------------------------------------------------------------------- 1 | !foo && foo !== bar && (wow(), such()); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/convert-gaurded-nots-to-ors/actual.js: -------------------------------------------------------------------------------- 1 | x(); 2 | if (!foo.bar) foo.bar = wat; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/convert-gaurded-nots-to-ors/expected.js: -------------------------------------------------------------------------------- 1 | x(), !foo.bar && (foo.bar = wat); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/do-while/actual.js: -------------------------------------------------------------------------------- 1 | do { 2 | foo(); 3 | } while (1); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/do-while/expected.js: -------------------------------------------------------------------------------- 1 | do foo(); while (1); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/early-return-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | wow(); 3 | if (x) { 4 | return; 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/early-return-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | wow(); 3 | x; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/empty-blocks-to-empty-statements/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | for (i in p) {} 3 | for (; ;) {} 4 | switch(1) {} 5 | try { a } catch(e) {} 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/empty-blocks-to-empty-statements/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | for (i in p); 3 | 4 | for (;;); 5 | 6 | switch (1) {} 7 | 8 | try { 9 | a; 10 | } catch (e) {} 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/empty-return/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | lol(); 3 | return; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/empty-return/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | lol(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/empty-vars-first/actual.js: -------------------------------------------------------------------------------- 1 | var x = 1, y, z = 2, zx, a; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/empty-vars-first/expected.js: -------------------------------------------------------------------------------- 1 | var y, 2 | zx, 3 | a, 4 | x = 1, 5 | z = 2; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/eqnull/actual.js: -------------------------------------------------------------------------------- 1 | x == undefined; 2 | x == void 0; 3 | x === undefined; 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/eqnull/expected.js: -------------------------------------------------------------------------------- 1 | x == null, x == null, x === undefined; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/flip-binary-expressions/actual.js: -------------------------------------------------------------------------------- 1 | if (!(!a && b == a && !b && b < a)) for(;;) a(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/flip-binary-expressions/expected.js: -------------------------------------------------------------------------------- 1 | if (a || b != a || b || !(b < a)) for (;;) a(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/flip-conditionals/actual.js: -------------------------------------------------------------------------------- 1 | !foo ? 'foo' : 'bar'; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/flip-conditionals/expected.js: -------------------------------------------------------------------------------- 1 | foo ? 'bar' : 'foo'; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/flip-logical-expr-2/actual.js: -------------------------------------------------------------------------------- 1 | if (!(1 !== foo || !bar)) for (;;); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/flip-logical-expr-2/expected.js: -------------------------------------------------------------------------------- 1 | if (1 === foo && bar) for (;;); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/flip-logical-expr/actual.js: -------------------------------------------------------------------------------- 1 | !x && foo(); 2 | if (!(null == r)) for (;;); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/flip-logical-expr/expected.js: -------------------------------------------------------------------------------- 1 | if (!x && foo(), null != r) for (;;); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/for-sequence/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | x = 1; 3 | a(); 4 | for (var a in b) wow(); 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/for-sequence/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | for (var a in x = 1, a(), b) wow(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/handle-to-boolean-2/actual.js: -------------------------------------------------------------------------------- 1 | function x(a, b) { 2 | a = a || b; 3 | return b === a || !a; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/handle-to-boolean-2/expected.js: -------------------------------------------------------------------------------- 1 | function x(a, b) { 2 | return a = a || b, b === a || !a; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/handle-to-boolean/actual.js: -------------------------------------------------------------------------------- 1 | function x(a) { 2 | return !!a; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/handle-to-boolean/expected.js: -------------------------------------------------------------------------------- 1 | function x(a) { 2 | return !!a; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/handle-void-returns-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo(a) { 2 | if (a && a.b != null) { 3 | if ((a.c--) === 1) { 4 | return; 5 | } 6 | return a.b; 7 | } 8 | return bar(a); 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/handle-void-returns-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo(a) { 2 | return a && a.b != null ? a.c-- === 1 ? void 0 : a.b : bar(a); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/handle-void-returns/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (a) { 3 | return; 4 | } 5 | 6 | return wow; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/handle-void-returns/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return a ? void 0 : wow; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/hoist-functions/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | a(); 3 | function bar() {} 4 | b(); 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/hoist-functions/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function bar() {} 3 | 4 | a(), b(); 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-break-2/actual.js: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= j; i++) { 2 | foo(); 3 | if (bar) break; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-break-2/expected.js: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= j && (foo(), !bar); i++); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-break-3/actual.js: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= j; i++) { 2 | if (bar) { 3 | break; 4 | } else { 5 | wat(); 6 | if (x) throw 1 7 | } 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-break-3/expected.js: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= j && !bar; i++) if (wat(), x) throw 1; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-break-4/actual.js: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= j; i++) { 2 | if (bar) { 3 | wat(); 4 | if (x) throw 1; 5 | } else { 6 | break; 7 | } 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-break-4/expected.js: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= j && !!bar; i++) if (wat(), x) throw 1; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-break-5/actual.js: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= j; i++) { 2 | foo(); 3 | if (bar) { 4 | break; 5 | } else { 6 | wat(); 7 | if (x) throw 1 8 | } 9 | hi(); 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-break-5/expected.js: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= j && (foo(), !bar); i++) { 2 | if (wat(), x) throw 1; 3 | hi(); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-break/actual.js: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= j; i++) { 2 | if (bar) break; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-break/expected.js: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= j && !bar; i++); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-complex/expected.js: -------------------------------------------------------------------------------- 1 | function foo(a) { 2 | return a && a.b != null ? (a.c-- === 1 && delete a.c, a.b) : bar(a); 3 | } 4 | 5 | function foo2(a) { 6 | return a ? a.b : bar(a); 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-conditional-return-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x) { 3 | delete x.x; 4 | if (bar()) return 2; 5 | } 6 | 7 | if (bar) { 8 | x(); 9 | } else { 10 | y(); 11 | } 12 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-conditional-return-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return x && (delete x.x, bar()) ? 2 : void (bar ? x() : y()); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-conditional-return-3/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x) { 3 | delete x.x; 4 | if (bar()) return; 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-conditional-return-3/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | x && (delete x.x, bar()); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-conditional-return-4/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x) { 3 | var f = wow; 4 | delete x.x; 5 | if (bar()) return; 6 | } 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-conditional-return-4/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x) { 3 | var f = wow; 4 | if (delete x.x, bar()) return; 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-conditional-return/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x) { 3 | delete x.x; 4 | if (bar()) return; 5 | } 6 | 7 | if (bar) { 8 | x(); 9 | } else { 10 | y(); 11 | } 12 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-conditional-return/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | x && (delete x.x, bar()) || (bar ? x() : y()); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-continue-2/actual.js: -------------------------------------------------------------------------------- 1 | for (;;) { 2 | a = b; 3 | if (!foo) continue; 4 | bar = foo; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-continue-2/expected.js: -------------------------------------------------------------------------------- 1 | for (;;) a = b, foo && (bar = foo); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-continue-3/actual.js: -------------------------------------------------------------------------------- 1 | function wow() { 2 | for(;;) { 3 | if (foo) { 4 | if (bar) { 5 | continue; 6 | } 7 | } 8 | wat(); 9 | } 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-continue-3/expected.js: -------------------------------------------------------------------------------- 1 | function wow() { 2 | for (;;) foo && bar || wat(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-continue/actual.js: -------------------------------------------------------------------------------- 1 | for (var p in foo) { 2 | if (p) continue; 3 | bar(); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-continue/expected.js: -------------------------------------------------------------------------------- 1 | for (var p in foo) p || bar(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-else-blocks/actual.js: -------------------------------------------------------------------------------- 1 | if (false) { 2 | let { a } = foo(); 3 | } else if (true) { 4 | const x = bar(); 5 | } else { 6 | function baz() {} 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-else-blocks/expected.js: -------------------------------------------------------------------------------- 1 | if (false) { 2 | let { 3 | a 4 | } = foo(); 5 | } else if (true) { 6 | const x = bar(); 7 | } else { 8 | function baz() {} 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-empty-blocks/actual.js: -------------------------------------------------------------------------------- 1 | if (a) { 2 | } else { 3 | foo(); 4 | } 5 | 6 | if (a) { 7 | foo(); 8 | } else if (b) { 9 | } 10 | 11 | if (a) { 12 | } else { 13 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-empty-blocks/expected.js: -------------------------------------------------------------------------------- 1 | a || foo(), a ? foo() : b, a; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (foo) { 3 | if (bar) { 4 | return false; 5 | } 6 | if (baz) { 7 | return false; 8 | } 9 | } 10 | return true; 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (foo) { 3 | if (bar) return false; 4 | if (baz) return false; 5 | } 6 | 7 | return true; 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-3/actual.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | for (;;) { 3 | x(); 4 | if (foo) return 1; 5 | else y(); 6 | } 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-3/expected.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | for (;;) { 3 | if (x(), foo) return 1; 4 | y(); 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-4/actual.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | if (!bar) return; 3 | var x = foo; 4 | if (!foo) return 5 | if (y) 6 | throw y; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-4/expected.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | if (bar) { 3 | var x = foo; 4 | if (foo && y) throw y; 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-5/actual.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | var x = foo; 3 | if (hi) { 4 | var y = z; 5 | if (!foo) return; 6 | if (x) throw y; 7 | } 8 | x(); 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-5/expected.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | var x = foo; 3 | 4 | if (hi) { 5 | var y = z; 6 | if (!foo) return; 7 | if (x) throw y; 8 | } 9 | 10 | x(); 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-6/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (a) { 3 | if (x) return; 4 | else return x; 5 | } 6 | const b = 1; 7 | return "doesn't matter if this is reached or not"; 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-6/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (a) return x ? void 0 : x; 3 | const b = 1; 4 | return "doesn't matter if this is reached or not"; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-hoisted-fn/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | bar(); 3 | if(x) return; 4 | const {a}=b; 5 | function bar () { 6 | baz(); 7 | bar(); 8 | } 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return-hoisted-fn/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function bar() { 3 | baz(), bar(); 4 | } 5 | 6 | if (bar(), !x) { 7 | const { 8 | a 9 | } = b; 10 | } 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x) { 3 | delete x.x; 4 | if (bar()) return x; 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-return/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x && (delete x.x, bar())) return x; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-sequence-test/actual.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | wow(); 3 | if (foo) { 4 | throw x(); 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-sequence-test/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | if (wow(), foo) throw x(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-gaurds/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x) a(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-gaurds/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | x && a(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-10/actual.js: -------------------------------------------------------------------------------- 1 | var x; 2 | if (a) { 3 | x = foo; 4 | } else if (b) { 5 | x = bar; 6 | } else { 7 | y = baz; 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-10/expected.js: -------------------------------------------------------------------------------- 1 | var x; 2 | a ? x = foo : b ? x = bar : y = baz; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-11/actual.js: -------------------------------------------------------------------------------- 1 | var x; 2 | if (a) { 3 | x = foo; 4 | } else if (b) { 5 | x = bar; 6 | } else { 7 | baz(); 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-11/expected.js: -------------------------------------------------------------------------------- 1 | var x; 2 | a ? x = foo : b ? x = bar : baz(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-12/actual.js: -------------------------------------------------------------------------------- 1 | if (a) { 2 | x.b = foo; 3 | } else if (b) { 4 | x.b = bar; 5 | } else { 6 | x.b = baz; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-12/expected.js: -------------------------------------------------------------------------------- 1 | x.b = a ? foo : b ? bar : baz; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (1) { 3 | return 2; 4 | } else { 5 | lol(1); 6 | lol(2); 7 | } 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return 1 ? 2 : void (lol(1), lol(2)); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-3/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if(window.self != window.top) { 3 | if(__DEV__) { 4 | console.log('lol', name); 5 | } 6 | return; 7 | } 8 | lol(); 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-3/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return window.self == window.top ? void lol() : void (__DEV__ && console.log('lol', name)); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-4/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (b) { 3 | return foo; 4 | } else { 5 | a(); 6 | b(); 7 | } 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-4/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return b ? foo : void (a(), b()); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-5/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (b) { 3 | foo(); 4 | } else { 5 | return bar; 6 | } 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-5/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return b ? void foo() : bar; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-6/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (b) { 3 | foo(); 4 | } else { 5 | return; 6 | } 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-6/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | b && foo(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-7/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (b) { 3 | return; 4 | } else { 5 | foo(); 6 | } 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-7/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | b || foo(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-8/expected.js: -------------------------------------------------------------------------------- 1 | function lawl() { 2 | var a = 1; 3 | return b ? c : a ? void bar() : d ? g ? (this['s'] = morebutts, wat) : boo : (haha(), butts); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-9/actual.js: -------------------------------------------------------------------------------- 1 | var x; 2 | if (a) { 3 | x = foo; 4 | } else if (b) { 5 | x = bar; 6 | } else { 7 | x = baz; 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-9/expected.js: -------------------------------------------------------------------------------- 1 | var x; 2 | x = a ? foo : b ? bar : baz; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-assignment-operator-2/actual.js: -------------------------------------------------------------------------------- 1 | if (a) { 2 | x.b += foo; 3 | } else if (b) { 4 | x.b -= bar; 5 | } else { 6 | x.b += baz; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-assignment-operator-2/expected.js: -------------------------------------------------------------------------------- 1 | a ? x.b += foo : b ? x.b -= bar : x.b += baz; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-assignment-operator-3/actual.js: -------------------------------------------------------------------------------- 1 | if (a) { 2 | this.a = 1; 3 | } else { 4 | this.b = 2; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-assignment-operator-3/expected.js: -------------------------------------------------------------------------------- 1 | a ? this.a = 1 : this.b = 2; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-assignment-operator/actual.js: -------------------------------------------------------------------------------- 1 | if (a) { 2 | x.b += foo; 3 | } else if (b) { 4 | x.b += bar; 5 | } else { 6 | x.b += baz; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-assignment-operator/expected.js: -------------------------------------------------------------------------------- 1 | x.b += a ? foo : b ? bar : baz; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary-return-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return foo ? (bar(foo), foo) : baz ? (bar(baz), baz) : wat ? (bar(wat), wat) : void 0; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x) a(); 3 | else b(); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/if-to-ternary/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | x ? a() : b(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/iife-to-unary/actual.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | x(); 3 | })(); 4 | y = function () { 5 | x(); 6 | }(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/iife-to-unary/expected.js: -------------------------------------------------------------------------------- 1 | !function () { 2 | x(); 3 | }(), y = function () { 4 | x(); 5 | }(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/iife-to-unary/skip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/babel/minify/8f9c7c0a32103653bd6793d0ce44730f937e1ddf/packages/babel-plugin-minify-simplify/__tests__/fixtures/iife-to-unary/skip -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-115/actual.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | a = x ? true : false; 3 | c = 1 ? (this.get(x), a = b, true) : (foo.bar, false); 4 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-115/expected.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | a = !!x, c = 1 ? (this.get(x), a = b, true) : (foo.bar, false); 3 | })(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-198/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | let a, 3 | { b } = x; 4 | while (true) { 5 | bar(a, b); 6 | } 7 | return [a, b]; 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-198/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | let a, 3 | { 4 | b 5 | } = x; 6 | 7 | for (; true;) bar(a, b); 8 | 9 | return [a, b]; 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-208/actual.js: -------------------------------------------------------------------------------- 1 | !function () { 2 | var x; 3 | { } 4 | alert(x); 5 | }() -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-208/expected.js: -------------------------------------------------------------------------------- 1 | !function () { 2 | var x; 3 | alert(x); 4 | }(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-281/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (x) 3 | return; 4 | function bar() {} 5 | bar(a); 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-281/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | function bar() {} 3 | 4 | x || bar(a); 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-423/actual.js: -------------------------------------------------------------------------------- 1 | function foo(bar) { 2 | switch (bar) { 3 | case 'a': 4 | return 1; 5 | case 'b': 6 | default: 7 | return 4; 8 | case 'c': 9 | return 3; 10 | } 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-423/expected.js: -------------------------------------------------------------------------------- 1 | function foo(bar) { 2 | return bar === 'a' ? 1 : bar === 'c' ? 3 : 4; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-455/actual.js: -------------------------------------------------------------------------------- 1 | function foo(param) { 2 | if (param === null) return; 3 | let thingA = param.a; 4 | let thingB = param.b; 5 | if (!thingA && !thingB) return; 6 | let thingC = param.c; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-455/expected.js: -------------------------------------------------------------------------------- 1 | function foo(param) { 2 | if (param !== null) { 3 | let thingA = param.a; 4 | let thingB = param.b; 5 | 6 | if (thingA || thingB) { 7 | let thingC = param.c; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-560/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | while (true) { 3 | const {x} = a; 4 | const {y} = b; 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-560/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | for (; true;) { 3 | const { 4 | x 5 | } = a; 6 | const { 7 | y 8 | } = b; 9 | } 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-637/actual.js: -------------------------------------------------------------------------------- 1 | function test(a) { 2 | const clash = () => {}; 3 | if (a) { 4 | return clash(); 5 | } else { 6 | const clash = () => {}; 7 | return clash(); 8 | } 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-637/expected.js: -------------------------------------------------------------------------------- 1 | function test(a) { 2 | const clash = () => {}; 3 | 4 | if (a) return clash();else { 5 | const clash = () => {}; 6 | 7 | return clash(); 8 | } 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-689/actual.js: -------------------------------------------------------------------------------- 1 | function foo(object, property, value) { 2 | if (object && property) { 3 | object[property] = value; 4 | return true; 5 | } 6 | return false; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/issue-689/expected.js: -------------------------------------------------------------------------------- 1 | function foo(object, property, value) { 2 | return !!(object && property) && (object[property] = value, true); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/keep-directives/actual.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | 'use strict'; 3 | foo(); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/keep-directives/expected.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | 'use strict'; 3 | 4 | foo(); 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-if-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (a) { 3 | if (b()) return false; 4 | } else if (c()) return true; 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-if-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (a) { 3 | if (b()) return false; 4 | } else if (c()) return true; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-if-3/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (a) return b; 3 | if (c) return d; 4 | return e; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-if-3/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return a ? b : c ? d : e; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-if-4/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (bar) return; 3 | if (far) return; 4 | if (faz) return; 5 | 6 | return e; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-if-4/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return bar || far || faz ? void 0 : e; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-if-5/actual.js: -------------------------------------------------------------------------------- 1 | if (x) { 2 | try { 3 | foo(); 4 | } catch (e) {} 5 | } else if (y) { 6 | if (a) { 7 | bar(); 8 | } else if (b) { 9 | baz(); 10 | } else { 11 | for (;;) 1; 12 | } 13 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-if-5/expected.js: -------------------------------------------------------------------------------- 1 | if (x) try { 2 | foo(); 3 | } catch (e) {} else if (y) if (a) bar();else if (b) baz();else for (;;) 1; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-if/actual.js: -------------------------------------------------------------------------------- 1 | if (a) { 2 | if (b) { 3 | throw 'wow'; 4 | } 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-if/expected.js: -------------------------------------------------------------------------------- 1 | if (a && b) throw 'wow'; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-return/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | if (a) return b; 3 | c = d; 4 | return z; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-return/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return a ? b : (c = d, z); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-to-for-init-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | x(); 3 | y(); 4 | for (z(); i < 10; i++) z(); 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-to-for-init-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | for (x(), y(), z(); i < 10; i++) z(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-to-for-init/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | x(); 3 | y(); 4 | for (; i < 10; i++) z(); 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/merge-to-for-init/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | for (x(), y(); i < 10; i++) z(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/remove-block-2/actual.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | if (a) { 3 | if (b) for (;;) wow(); 4 | } else c(); 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/remove-block-2/expected.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | if (!a) c();else if (b) for (;;) wow(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/remove-block/actual.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | if (a) { 3 | if (b) { 4 | for(;;) { 5 | if (a) b(); 6 | } 7 | } 8 | } else { 9 | wat(); 10 | } 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/remove-block/expected.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | if (!a) wat();else if (b) for (;;) a && b(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/remove-fn-expr-parens/actual.js: -------------------------------------------------------------------------------- 1 | x, (function() {})(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/remove-fn-expr-parens/expected.js: -------------------------------------------------------------------------------- 1 | x, function () {}(); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/remove-for-block/actual.js: -------------------------------------------------------------------------------- 1 | for (var x = 0; x < 10; x++) { 2 | console.log(x); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/remove-for-block/expected.js: -------------------------------------------------------------------------------- 1 | for (var x = 0; x < 10; x++) console.log(x); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/return-inside-loop/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | while(1) { 3 | if (a === null) { 4 | b(); 5 | return; 6 | } 7 | a(); 8 | b(); 9 | } 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/return-inside-loop/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | for (; 1;) { 3 | if (a === null) return void b(); 4 | a(), b(); 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/super-assignments/actual.js: -------------------------------------------------------------------------------- 1 | class Foo { 2 | foo() { 3 | super.foo = super.foo + 1; 4 | } 5 | }; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/super-assignments/expected.js: -------------------------------------------------------------------------------- 1 | class Foo { 2 | foo() { 3 | ++super.foo; 4 | } 5 | 6 | } 7 | 8 | ; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-last-break-2/actual.js: -------------------------------------------------------------------------------- 1 | loop: while (foo) { 2 | switch (bar) { 3 | case 47: 4 | break; 5 | } 6 | switch (baz) { 7 | default: 8 | break loop; 9 | } 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-last-break-2/expected.js: -------------------------------------------------------------------------------- 1 | loop: for (; foo;) { 2 | switch (bar) { 3 | case 47: 4 | } 5 | 6 | switch (baz) { 7 | default: 8 | break loop; 9 | } 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-last-break/actual.js: -------------------------------------------------------------------------------- 1 | switch (foo) { 2 | case 'foo': 3 | throw bar(); 4 | break; 5 | case 'bar': 6 | wow(); 7 | break; 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-last-break/expected.js: -------------------------------------------------------------------------------- 1 | switch (foo) { 2 | case 'foo': 3 | throw bar(); 4 | break; 5 | 6 | case 'bar': 7 | wow(); 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-sequence-test/actual.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | wow(); 3 | switch (foo) { 4 | case 'foo': 5 | throw x(); 6 | break; 7 | } 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-sequence-test/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | switch (wow(), foo) { 3 | case 'foo': 4 | throw x(); 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-sequence/actual.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | switch (foo) { 3 | case 'foo': 4 | bar(); 5 | foo(); 6 | break; 7 | case 'bar': 8 | wow(); 9 | return wo; 10 | break; 11 | } 12 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-sequence/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | switch (foo) { 3 | case 'foo': 4 | bar(), foo(); 5 | break; 6 | 7 | case 'bar': 8 | return wow(), wo; 9 | } 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-ternary-2/actual.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | switch (foo) { 3 | case 'foo': 4 | return 1; 5 | case foo.bar: 6 | return 2; 7 | case wow: 8 | wow(); 9 | return 3; 10 | } 11 | return 0; 12 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-ternary-2/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | return foo === 'foo' ? 1 : foo === foo.bar ? 2 : foo === wow ? (wow(), 3) : 0; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-ternary-3/actual.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | switch (foo) { 3 | case 'foo': 4 | return 1; 5 | case foo.bar: 6 | return 2; 7 | case wow: 8 | wow(); 9 | return 3; 10 | } 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-ternary-3/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | return foo === 'foo' ? 1 : foo === foo.bar ? 2 : foo === wow ? (wow(), 3) : void 0; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-ternary-break-2/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | foo === 'foo' ? foo() : foo === foo.bar ? (wow(), wat()) : foo === shh || foo === wow ? baa() : meh(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-ternary-break/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | foo === 'foo' ? foo() : foo === foo.bar ? (wow(), wat()) : foo === shh || foo === wow ? baa() : meh(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-ternary-fallthrough-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo(bar) { 2 | return bar === 'a' || bar === 'b' ? 1 : bar === 'c' ? 3 : 4; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-ternary-fallthrough/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | return foo === 'foo' ? 1 : foo === foo.bar || foo === wow ? (wow(), 3) : foo === boo ? 4 : foo === baz || foo === wat ? 5 : 0; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/switch-expr-to-ternary/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | return foo === 'foo' ? 1 : foo === foo.bar ? 2 : foo === wow ? (wow(), 3) : 0; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/template-literals-assignments/actual.js: -------------------------------------------------------------------------------- 1 | foo[`x`] = foo[`x`] + 1; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/template-literals-assignments/expected.js: -------------------------------------------------------------------------------- 1 | foo[`x`] = foo[`x`] + 1; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/throw-seq-expr/actual.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | z(); 3 | throw y; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/throw-seq-expr/expected.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | throw z(), y; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/to-sequence-expr-2/actual.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | var z; 3 | c(); 4 | for (z in { a: 1}) x(z); 5 | z(); 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/to-sequence-expr-2/expected.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | var z; 3 | 4 | for (z in c(), { 5 | a: 1 6 | }) x(z); 7 | 8 | z(); 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/to-sequence-return-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | try { 3 | x(); 4 | } catch (e) { 5 | 1; 6 | } 7 | 8 | y(); 9 | return 1; 10 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/to-sequence-return-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | try { 3 | x(); 4 | } catch (e) { 5 | 1; 6 | } 7 | 8 | return y(), 1; 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/to-sequence-return/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | y(); 3 | x(); 4 | return 1; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/to-sequence-return/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return y(), x(), 1; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/to-sequence/actual.js: -------------------------------------------------------------------------------- 1 | x(); 2 | y(); 3 | for (var x = 0; x < 10; x++) { 4 | var z = foo(); 5 | console.log(z); 6 | console.log(z); 7 | } 8 | a(); 9 | b = 1; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/to-sequence/expected.js: -------------------------------------------------------------------------------- 1 | x(), y(); 2 | 3 | for (var x = 0; x < 10; x++) { 4 | var z = foo(); 5 | console.log(z), console.log(z); 6 | } 7 | 8 | a(), b = 1; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/unary-conditional-2/actual.js: -------------------------------------------------------------------------------- 1 | !(!a && b) ? b : c -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/unary-conditional-2/expected.js: -------------------------------------------------------------------------------- 1 | !a && b ? c : b; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/unary-conditional/actual.js: -------------------------------------------------------------------------------- 1 | !(a ? b : c); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/unary-conditional/expected.js: -------------------------------------------------------------------------------- 1 | a ? !b : !c; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/unary-sequence/actual.js: -------------------------------------------------------------------------------- 1 | !(a, b, c); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/unary-sequence/expected.js: -------------------------------------------------------------------------------- 1 | a, b, !c; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/whiles-to-fors-2/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | let bar = baz; 3 | while(true) { 4 | bar(); 5 | } 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/whiles-to-fors-2/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | for (let bar = baz; true;) bar(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/whiles-to-fors-3/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var a = 1; 3 | while (true) { 4 | bar(a); 5 | } 6 | return a; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/whiles-to-fors-3/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | for (var a = 1; true;) bar(a); 3 | 4 | return a; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/whiles-to-fors/actual.js: -------------------------------------------------------------------------------- 1 | function foo(a) { 2 | while(true) { 3 | bar(); 4 | } 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/fixtures/whiles-to-fors/expected.js: -------------------------------------------------------------------------------- 1 | function foo(a) { 2 | for (; true;) bar(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-minify-simplify/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-type-constructors/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-type-constructors/__tests__/fixtures/basic/actual.js: -------------------------------------------------------------------------------- 1 | Boolean(x); 2 | Number(x); 3 | String(x); 4 | Array(); 5 | new Array(); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-type-constructors/__tests__/fixtures/basic/expected.js: -------------------------------------------------------------------------------- 1 | !!x; 2 | +x; 3 | x + ""; 4 | []; 5 | []; -------------------------------------------------------------------------------- /packages/babel-plugin-minify-type-constructors/__tests__/fixtures/object-2/actual.js: -------------------------------------------------------------------------------- 1 | new Object(); 2 | var foo = () => Object(); 3 | var bar = () => Object({ baz: 3 }); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-type-constructors/__tests__/fixtures/object-2/expected.js: -------------------------------------------------------------------------------- 1 | ({}); 2 | 3 | var foo = () => ({}); 4 | 5 | var bar = () => ({ 6 | baz: 3 7 | }); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-type-constructors/__tests__/fixtures/overriden/actual.js: -------------------------------------------------------------------------------- 1 | (function(Boolean, String, Number, Array, Object) { 2 | return Boolean(a), String(b), Number(c), Array(d), Object(d); 3 | })(MyBoolean, MyString, MyNumber, MyArray, MyObject); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-minify-type-constructors/__tests__/fixtures/overriden/expected.js: -------------------------------------------------------------------------------- 1 | (function (Boolean, String, Number, Array, Object) { 2 | return Boolean(a), String(b), Number(c), Array(d), Object(d); 3 | })(MyBoolean, MyString, MyNumber, MyArray, MyObject); -------------------------------------------------------------------------------- /packages/babel-plugin-minify-type-constructors/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-non-int-index-2/actual.js: -------------------------------------------------------------------------------- 1 | var foo = []; 2 | foo["2"] = "blah"; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-non-int-index-2/expected.js: -------------------------------------------------------------------------------- 1 | var foo = [,, "blah"]; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-non-int-index/actual.js: -------------------------------------------------------------------------------- 1 | var foo = []; 2 | foo[2.1] = "blah"; 3 | 4 | var bar = []; 5 | bar["2.1"] = "blah"; 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-non-int-index/expected.js: -------------------------------------------------------------------------------- 1 | var foo = []; 2 | foo[2.1] = "blah"; 3 | var bar = []; 4 | bar["2.1"] = "blah"; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-out-of-bounds/actual.js: -------------------------------------------------------------------------------- 1 | var foo = [1, 2]; 2 | foo[2] = "blah"; 3 | foo[2] = "ok"; 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-out-of-bounds/expected.js: -------------------------------------------------------------------------------- 1 | var foo = [1, 2]; 2 | foo[2] = "blah"; 3 | foo[2] = "ok"; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-overwrites/actual.js: -------------------------------------------------------------------------------- 1 | var foo = [1, 2, 3]; 2 | foo[2] = "blah"; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-overwrites/expected.js: -------------------------------------------------------------------------------- 1 | var foo = [1, 2, 3]; 2 | foo[2] = "blah"; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-property-assignments-2/actual.js: -------------------------------------------------------------------------------- 1 | var foo = []; 2 | foo[10] = "blah"; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-property-assignments-2/expected.js: -------------------------------------------------------------------------------- 1 | var foo = []; 2 | foo[10] = "blah"; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-property-assignments/actual.js: -------------------------------------------------------------------------------- 1 | var foo = []; 2 | foo[5] = "blah"; 3 | foo[3] = "blah"; 4 | foo[7] = "blah"; 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-property-assignments/expected.js: -------------------------------------------------------------------------------- 1 | var foo = [,,, "blah",, "blah",, "blah"]; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-push/actual.js: -------------------------------------------------------------------------------- 1 | var foo = [1, 2]; 2 | foo.push(3, 4), foo.push(5); 3 | foo.push(6); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/array-push/expected.js: -------------------------------------------------------------------------------- 1 | var foo = [1, 2, 3, 4, 5, 6]; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/basic/actual.js: -------------------------------------------------------------------------------- 1 | const foo = { 2 | z: 3.0 3 | }; 4 | foo.a = 42; 5 | foo.b = ["hi"]; 6 | foo.c = bar(); 7 | foo.d = "str"; 8 | 9 | var bar = {}; 10 | (bar.a = 0), (bar.b = 2); 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/basic/expected.js: -------------------------------------------------------------------------------- 1 | const foo = { 2 | z: 3.0, 3 | a: 42, 4 | b: ["hi"], 5 | c: bar(), 6 | d: "str" 7 | }; 8 | var bar = { 9 | a: 0, 10 | b: 2 11 | }; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/circular-references-array/actual.js: -------------------------------------------------------------------------------- 1 | var foo = []; 2 | foo[2] = foo; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/circular-references-array/expected.js: -------------------------------------------------------------------------------- 1 | var foo = []; 2 | foo[2] = foo; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/circular-references-set/actual.js: -------------------------------------------------------------------------------- 1 | var foo = new Set([1, 2]); 2 | foo.add(foo); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/circular-references-set/expected.js: -------------------------------------------------------------------------------- 1 | var foo = new Set([1, 2]); 2 | foo.add(foo); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/circular-references/actual.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | foo.bar = foo; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/circular-references/expected.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | foo.bar = foo; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/computed-properties-2/actual.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | foo[bar()] = 0; 3 | function bar() { 4 | console.log(foo); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/computed-properties-2/expected.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | foo[bar()] = 0; 3 | 4 | function bar() { 5 | console.log(foo); 6 | return 0; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/computed-properties/actual.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | foo["a"] = 0; 3 | foo[4] = 1; 4 | 5 | var bar = {}; 6 | bar[global] = 0; 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/computed-properties/expected.js: -------------------------------------------------------------------------------- 1 | var foo = { 2 | "a": 0, 3 | 4: 1 4 | }; 5 | var bar = {}; 6 | bar[global] = 0; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/dependent-properties/actual.js: -------------------------------------------------------------------------------- 1 | const foo = {}; 2 | foo.a = function() { 3 | console.log(3); 4 | }; 5 | foo.b = foo.a(); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/dependent-properties/expected.js: -------------------------------------------------------------------------------- 1 | const foo = { 2 | a: function () { 3 | console.log(3); 4 | } 5 | }; 6 | foo.b = foo.a(); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/indirect-dependent-properties/actual.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | foo.a = 4; 3 | foo.b = cat(); 4 | function cat() { 5 | return bar(); 6 | } 7 | function bar() { 8 | console.log(foo); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/indirect-dependent-properties/expected.js: -------------------------------------------------------------------------------- 1 | var foo = { 2 | a: 4 3 | }; 4 | foo.b = cat(); 5 | 6 | function cat() { 7 | return bar(); 8 | } 9 | 10 | function bar() { 11 | console.log(foo); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/last-expr-stmt/actual.js: -------------------------------------------------------------------------------- 1 | const foo = {}; 2 | foo.a = 42; 3 | console.log(foo); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/last-expr-stmt/expected.js: -------------------------------------------------------------------------------- 1 | const foo = { 2 | a: 42 3 | }; 4 | console.log(foo); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/non-collapsable-lval/actual.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | const foo = {}; 3 | foo.bar.a = 42; 4 | } 5 | 6 | function b() { 7 | const foo = {}; 8 | bar.a = 42; 9 | } 10 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/non-collapsable-lval/expected.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | const foo = {}; 3 | foo.bar.a = 42; 4 | } 5 | 6 | function b() { 7 | const foo = {}; 8 | bar.a = 42; 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/set-add/actual.js: -------------------------------------------------------------------------------- 1 | var foo = new Set(); 2 | foo.add(1), foo.add(2); 3 | foo.add(3); 4 | 5 | var bar = new Set([1, 2]); 6 | bar.add(3); 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/fixtures/set-add/expected.js: -------------------------------------------------------------------------------- 1 | var foo = new Set([1, 2, 3]); 2 | var bar = new Set([1, 2, 3]); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-consecutive-adds/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-inline-environment-variables/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/computed-props/actual.js: -------------------------------------------------------------------------------- 1 | foo[a]; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/computed-props/expected.js: -------------------------------------------------------------------------------- 1 | foo[a]; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/invalid-ids/actual.js: -------------------------------------------------------------------------------- 1 | foo["default"]; 2 | foo["import"]; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/invalid-ids/expected.js: -------------------------------------------------------------------------------- 1 | foo["default"]; 2 | foo["import"]; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/leading-zeros/actual.js: -------------------------------------------------------------------------------- 1 | data["00"] = 5; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/leading-zeros/expected.js: -------------------------------------------------------------------------------- 1 | data["00"] = 5; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/member-expressions/actual.js: -------------------------------------------------------------------------------- 1 | foo.bar; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/member-expressions/expected.js: -------------------------------------------------------------------------------- 1 | foo.bar; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/numeric-literal/actual.js: -------------------------------------------------------------------------------- 1 | foo["1"]; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/numeric-literal/expected.js: -------------------------------------------------------------------------------- 1 | foo[1]; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/string-literal/actual.js: -------------------------------------------------------------------------------- 1 | foo["bar"]; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/fixtures/string-literal/expected.js: -------------------------------------------------------------------------------- 1 | foo.bar; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-member-expression-literals/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/block-scoped-for/actual.js: -------------------------------------------------------------------------------- 1 | let i = 0; 2 | for (let x = 0; x < 10; x++) console.log(i + x); 3 | 4 | const j = 0; 5 | for (const x = 0; ; ) console.log(j + x); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/block-scoped-for/expected.js: -------------------------------------------------------------------------------- 1 | let i = 0; 2 | 3 | for (let x = 0; x < 10; x++) console.log(i + x); 4 | 5 | const j = 0; 6 | 7 | for (const x = 0;;) console.log(j + x); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/block-scoped-outside-for/actual.js: -------------------------------------------------------------------------------- 1 | let i = 0; 2 | let y = 0; 3 | for (let x = 0; x < 10; x++) console.log(i + x); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/block-scoped-outside-for/expected.js: -------------------------------------------------------------------------------- 1 | let i = 0, 2 | y = 0; 3 | 4 | for (let x = 0; x < 10; x++) console.log(i + x); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/concat-var-for-loop/actual.js: -------------------------------------------------------------------------------- 1 | var i = 0; 2 | var j = 0; 3 | for (var x = 0; x < 10; x++) console.log(i + x); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/concat-var-for-loop/expected.js: -------------------------------------------------------------------------------- 1 | for (var i = 0, j = 0, x = 0; x < 10; x++) console.log(i + x); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/concat-var/actual.js: -------------------------------------------------------------------------------- 1 | var i = 0; 2 | var x = 0; 3 | var y = 0; 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/concat-var/expected.js: -------------------------------------------------------------------------------- 1 | var i = 0, 2 | x = 0, 3 | y = 0; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-destructuring-var/actual.js: -------------------------------------------------------------------------------- 1 | for (var i = 0; i < 0; i++) { 2 | var [j] = jj(); 3 | } 4 | for (var i = 0; i < 0; i++) { 5 | var { j } = jj(); 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-destructuring-var/expected.js: -------------------------------------------------------------------------------- 1 | for (var i = 0; i < 0; i++) { 2 | var [j] = jj(); 3 | } 4 | 5 | for (var i = 0; i < 0; i++) { 6 | var { 7 | j 8 | } = jj(); 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-different-declars/actual.js: -------------------------------------------------------------------------------- 1 | for (let i = 0; i < 0; i++) { 2 | { let i = 0 }; 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-different-declars/expected.js: -------------------------------------------------------------------------------- 1 | for (let i = 0; i < 0; i++) { 2 | { 3 | let i = 0; 4 | } 5 | ; 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-let-declars/actual.js: -------------------------------------------------------------------------------- 1 | for (let i = 0; i < 0; i++) { 2 | let j = jj(); 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-let-declars/expected.js: -------------------------------------------------------------------------------- 1 | for (let i = 0, j; i < 0; i++) { 2 | j = jj(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-mult-declars/actual.js: -------------------------------------------------------------------------------- 1 | for (var i = 0; i < 0; i++) { 2 | var i = 0, 3 | k = 0; 4 | } 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-mult-declars/expected.js: -------------------------------------------------------------------------------- 1 | for (var i = 0; i < 0; i++) { 2 | var i = 0, 3 | k = 0; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-no-loop-intializer/actual.js: -------------------------------------------------------------------------------- 1 | for (;;) {} 2 | for (;;) var i = 0; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-no-loop-intializer/expected.js: -------------------------------------------------------------------------------- 1 | for (;;) {} 2 | 3 | for (;;) var i = 0; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-not-initialized/actual.js: -------------------------------------------------------------------------------- 1 | for (var i = 0; ; ) { 2 | var i; 3 | } 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-not-initialized/expected.js: -------------------------------------------------------------------------------- 1 | for (var i = 0;;) { 2 | var i; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-var-declars/actual.js: -------------------------------------------------------------------------------- 1 | for (var i = 0; i < 0; i++) { 2 | var j = jj(); 3 | } 4 | for (var i = 0; ; ) var j = 0; 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/fixtures/lift-var-declars/expected.js: -------------------------------------------------------------------------------- 1 | for (var i = 0, j; i < 0; i++) { 2 | j = jj(); 3 | } 4 | 5 | for (var i = 0, j;;) j = 0; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-merge-sibling-variables/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-minify-booleans/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-minify-booleans/__tests__/fixtures/reduce-boolean/actual.js: -------------------------------------------------------------------------------- 1 | true; 2 | false; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-minify-booleans/__tests__/fixtures/reduce-boolean/expected.js: -------------------------------------------------------------------------------- 1 | !0; 2 | !1; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-minify-booleans/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-node-env-inline/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-property-literals/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-property-literals/__tests__/fixtures/computed-property/actual.js: -------------------------------------------------------------------------------- 1 | ({ 2 | [a]: null, 3 | [ಠ_ಠ]: "foo", 4 | ["ಠ_ಠ"]: "bar" 5 | }); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-property-literals/__tests__/fixtures/computed-property/expected.js: -------------------------------------------------------------------------------- 1 | ({ 2 | [a]: null, 3 | [ಠ_ಠ]: "foo", 4 | ಠ_ಠ: "bar" 5 | }); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-property-literals/__tests__/fixtures/invalid-es5-property/actual.js: -------------------------------------------------------------------------------- 1 | // prettier-ignore 2 | ({ 3 | "\u2118": "wp", 4 | "𐊧": "foo" 5 | }); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-property-literals/__tests__/fixtures/invalid-es5-property/expected.js: -------------------------------------------------------------------------------- 1 | // prettier-ignore 2 | ({ 3 | "℘": "wp", 4 | "𐊧": "foo" 5 | }); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-property-literals/__tests__/fixtures/leading-zeros/actual.js: -------------------------------------------------------------------------------- 1 | var data = { 2 | "00": 1, 3 | "01": 2 4 | }; 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-property-literals/__tests__/fixtures/leading-zeros/expected.js: -------------------------------------------------------------------------------- 1 | var data = { 2 | "00": 1, 3 | "01": 2 4 | }; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-property-literals/__tests__/fixtures/strip-quotes/actual.js: -------------------------------------------------------------------------------- 1 | // prettier-ignore 2 | var x = { "foo": "bar", "1": "baz", test: null }; 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-property-literals/__tests__/fixtures/strip-quotes/expected.js: -------------------------------------------------------------------------------- 1 | // prettier-ignore 2 | var x = { 3 | foo: "bar", 4 | 1: "baz", 5 | test: null 6 | }; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-property-literals/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/const-references/actual.js: -------------------------------------------------------------------------------- 1 | const foo = "ab+"; 2 | const bar = "c\\w"; 3 | const flags = "g"; 4 | const ret = new RegExp(foo + bar + "d", flags); 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/const-references/expected.js: -------------------------------------------------------------------------------- 1 | const foo = "ab+"; 2 | const bar = "c\\w"; 3 | const flags = "g"; 4 | const ret = /ab+c\wd/g; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/empty-string/actual.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp(""); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/empty-string/expected.js: -------------------------------------------------------------------------------- 1 | var x = /(?:)/; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/escape/actual.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp("\\w+\\s"); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/escape/expected.js: -------------------------------------------------------------------------------- 1 | var x = /\w+\s/; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/expressions/actual.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp(foo(), "g"); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/expressions/expected.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp(foo(), "g"); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/forward-slash/actual.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp("/x/"); 2 | var y = new RegExp("\\/"); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/forward-slash/expected.js: -------------------------------------------------------------------------------- 1 | var x = /\/x\//; 2 | var y = /\//; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/newline/actual.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp("\\n"); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/newline/expected.js: -------------------------------------------------------------------------------- 1 | var x = /\n/; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/no-arguments/actual.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp(); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/no-arguments/expected.js: -------------------------------------------------------------------------------- 1 | var x = /(?:)/; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/null/actual.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp("\0"); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/null/expected.js: -------------------------------------------------------------------------------- 1 | var x = /\0/; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/string/actual.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp("ab+c"); 2 | var y = new RegExp("ab+c", "gimuy"); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/string/expected.js: -------------------------------------------------------------------------------- 1 | var x = /ab+c/; 2 | var y = /ab+c/gimuy; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/unicode-newline/actual.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp("\u2028\u2029"); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/unicode-newline/expected.js: -------------------------------------------------------------------------------- 1 | var x = /\u2028\u2029/; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/whitespaces/actual.js: -------------------------------------------------------------------------------- 1 | var x = new RegExp("\b\f\v\t\r\n\n"); 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/fixtures/whitespaces/expected.js: -------------------------------------------------------------------------------- 1 | var x = /[\b]\f\v \r\n\n/; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-regexp-constructors/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/basic/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | console.log("foo"); 3 | blah(); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/basic/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | blah(); 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/bound-excludes/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | const a = console.log; 3 | a(); 4 | const b = console.error.bind(console); 5 | b("asdf"); 6 | blah(); 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/bound-excludes/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | const a = function () {}; 3 | 4 | a(); 5 | const b = console.error.bind(console); 6 | b("asdf"); 7 | blah(); 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/bound-excludes/options.json: -------------------------------------------------------------------------------- 1 | {"exclude":["error","info"]} -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/excludes/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | console.log("foo"); 3 | console.error("bar"); 4 | blah(); 5 | console.info("blah"); 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/excludes/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | console.error("bar"); 3 | blah(); 4 | console.info("blah"); 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/excludes/options.json: -------------------------------------------------------------------------------- 1 | {"exclude":["error","info"]} -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/guards/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | true && console.log("foo"); 3 | blah(); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/guards/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | true && void 0; 3 | blah(); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/member-expr-assignment-no-op/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | console.foo = function foo() { 3 | console.log("foo"); 4 | }; 5 | console.error = myConsoleError; 6 | console.foo(); 7 | console.error("asdf"); 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/member-expr-assignment-no-op/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | console.foo = function () {}; 3 | 4 | console.error = function () {}; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/member-expr-no-op/expected.js: -------------------------------------------------------------------------------- 1 | const a = function () {}; 2 | 3 | a(); 4 | 5 | const b = function () {}; 6 | 7 | b("asdf"); 8 | var x = function () {} ? void 0 : foo(); 9 | 10 | function foo() { 11 | if (function () {}) {} 12 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/replace-with-empty-block/expected.js: -------------------------------------------------------------------------------- 1 | if (blah) {} 2 | 3 | for (;;) {} 4 | 5 | for (var blah in []) {} 6 | 7 | for (var blah of []) {} 8 | 9 | while (blah) {} 10 | 11 | do {} while (blah); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/top-level-stmts/actual.js: -------------------------------------------------------------------------------- 1 | console.log("foo"); 2 | blah(); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/top-level-stmts/expected.js: -------------------------------------------------------------------------------- 1 | blah(); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/top-level/actual.js: -------------------------------------------------------------------------------- 1 | true && console.log("foo"); 2 | blah(); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/fixtures/top-level/expected.js: -------------------------------------------------------------------------------- 1 | true && void 0; 2 | blah(); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-console/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-debugger/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-debugger/__tests__/fixtures/basic-2/actual.js: -------------------------------------------------------------------------------- 1 | debugger; 1; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-debugger/__tests__/fixtures/basic-2/expected.js: -------------------------------------------------------------------------------- 1 | 1; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-debugger/__tests__/fixtures/basic/actual.js: -------------------------------------------------------------------------------- 1 | debugger; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-debugger/__tests__/fixtures/basic/expected.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/babel/minify/8f9c7c0a32103653bd6793d0ce44730f937e1ddf/packages/babel-plugin-transform-remove-debugger/__tests__/fixtures/basic/expected.js -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-debugger/__tests__/fixtures/empty-block/actual.js: -------------------------------------------------------------------------------- 1 | if (blah) debugger; 2 | for (;;) debugger; 3 | for (var blah in []) debugger; 4 | for (var blah of []) debugger; 5 | while (blah) debugger; 6 | do debugger; while (blah); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-debugger/__tests__/fixtures/empty-block/expected.js: -------------------------------------------------------------------------------- 1 | if (blah) {} 2 | 3 | for (;;) {} 4 | 5 | for (var blah in []) {} 6 | 7 | for (var blah of []) {} 8 | 9 | while (blah) {} 10 | 11 | do {} while (blah); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-debugger/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-debugger/src/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function() { 4 | return { 5 | name: "transform-remove-debugger", 6 | visitor: { 7 | DebuggerStatement(path) { 8 | path.remove(); 9 | } 10 | } 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/const-undefined/actual.js: -------------------------------------------------------------------------------- 1 | const a = undefined; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/const-undefined/expected.js: -------------------------------------------------------------------------------- 1 | const a = undefined; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/inner-blocks-let/actual.js: -------------------------------------------------------------------------------- 1 | let a = 1; 2 | { 3 | let a = undefined; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/inner-blocks-let/expected.js: -------------------------------------------------------------------------------- 1 | let a = 1; 2 | { 3 | let a; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/let-undefined/actual.js: -------------------------------------------------------------------------------- 1 | let a = undefined; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/let-undefined/expected.js: -------------------------------------------------------------------------------- 1 | let a; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/let-void-0/actual.js: -------------------------------------------------------------------------------- 1 | let a = void 0; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/let-void-0/expected.js: -------------------------------------------------------------------------------- 1 | let a; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/local-var-undef/actual.js: -------------------------------------------------------------------------------- 1 | function foo(undefined) { 2 | a = b, undefined; 3 | return undefined; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/local-var-undef/expected.js: -------------------------------------------------------------------------------- 1 | function foo(undefined) { 2 | a = b, undefined; 3 | return undefined; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/lval-ref-fn-decl/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | bar(); 3 | var x = undefined; 4 | console.log(x); 5 | function bar() { 6 | x = 3; 7 | } 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/lval-ref-fn-decl/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | bar(); 3 | var x = undefined; 4 | console.log(x); 5 | 6 | function bar() { 7 | x = 3; 8 | } 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/mutually-recursive/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | a(); 3 | var c = undefined; 4 | function a() { 5 | b(); 6 | } 7 | function b() { 8 | a(); 9 | c = 3; 10 | } 11 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/mutually-recursive/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | a(); 3 | var c = undefined; 4 | 5 | function a() { 6 | b(); 7 | } 8 | 9 | function b() { 10 | a(); 11 | c = 3; 12 | } 13 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/not-referenced/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var x = undefined; 3 | bar(); 4 | console.log(x); 5 | function bar() { 6 | x = 3; 7 | } 8 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/not-referenced/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var x; 3 | bar(); 4 | console.log(x); 5 | 6 | function bar() { 7 | x = 3; 8 | } 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/referenced-vars-nested/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | aa = 3; 3 | var { a: aa, b: bb } = undefined; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/referenced-vars-nested/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | aa = 3; 3 | var { 4 | a: aa, 5 | b: bb 6 | } = undefined; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/referenced-vars/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | a = 3; 3 | var a = undefined; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/referenced-vars/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | a = 3; 3 | var a = undefined; 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/remove-multiple-undefined/actual.js: -------------------------------------------------------------------------------- 1 | let a = undefined, b = 3, c = undefined, d; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/remove-multiple-undefined/expected.js: -------------------------------------------------------------------------------- 1 | let a, 2 | b = 3, 3 | c, 4 | d; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/rval-side-effects/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var a = void b(); 3 | return void bar(); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/rval-side-effects/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var a = void b(); 3 | return void bar(); 4 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/sequence-expr-last-undef-safe/actual.js: -------------------------------------------------------------------------------- 1 | a = b, void 0, b = c, d.e.f(), void 0, hello.world(), void 0; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/sequence-expr-last-undef-safe/expected.js: -------------------------------------------------------------------------------- 1 | a = b, b = c, d.e.f(), hello.world(); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/sequence-expr-last-undef/actual.js: -------------------------------------------------------------------------------- 1 | if (foo.bar(), void 0) { 2 | foo.baz(); 3 | } 4 | function bar() { 5 | return a.b(), void 0; 6 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/sequence-expr-last-undef/expected.js: -------------------------------------------------------------------------------- 1 | if (foo.bar(), void 0) { 2 | foo.baz(); 3 | } 4 | 5 | function bar() { 6 | return a.b(), void 0; 7 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/sequence-expr/actual.js: -------------------------------------------------------------------------------- 1 | a = b, void 0, b = c, d.e.f(), void 0, hello.world(); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/sequence-expr/expected.js: -------------------------------------------------------------------------------- 1 | a = b, b = c, d.e.f(), hello.world(); -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/undefined-return/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return undefined; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/undefined-return/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/var-declarations/actual.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var a = undefined; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/var-declarations/expected.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var a; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/var-in-loops/actual.js: -------------------------------------------------------------------------------- 1 | for (var a = undefined;;) { 2 | var b = undefined; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/var-in-loops/expected.js: -------------------------------------------------------------------------------- 1 | for (var a;;) { 2 | var b; 3 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/var-loops-kviolate/actual.js: -------------------------------------------------------------------------------- 1 | for (var a;;) { 2 | var b = undefined; 3 | console.log(b); 4 | b = 3; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/fixtures/var-loops-kviolate/expected.js: -------------------------------------------------------------------------------- 1 | for (var a;;) { 2 | var b = undefined; 3 | console.log(b); 4 | b = 3; 5 | } -------------------------------------------------------------------------------- /packages/babel-plugin-transform-remove-undefined/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/fixtures/already-simplified/actual.js: -------------------------------------------------------------------------------- 1 | typeof 1 == "number"; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/fixtures/already-simplified/expected.js: -------------------------------------------------------------------------------- 1 | typeof 1 == "number"; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/fixtures/equality-check/actual.js: -------------------------------------------------------------------------------- 1 | a > b; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/fixtures/equality-check/expected.js: -------------------------------------------------------------------------------- 1 | a > b; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/fixtures/null-check/actual.js: -------------------------------------------------------------------------------- 1 | null === null; 2 | var x = null; 3 | x === null; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/fixtures/null-check/expected.js: -------------------------------------------------------------------------------- 1 | null == null; 2 | var x = null; 3 | x == null; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/fixtures/strict-null/actual.js: -------------------------------------------------------------------------------- 1 | var x; 2 | x === null; 3 | if (wow) x = foo(); 4 | x === null; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/fixtures/strict-null/expected.js: -------------------------------------------------------------------------------- 1 | var x; 2 | x === null; 3 | if (wow) x = foo(); 4 | x === null; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/fixtures/typeof-comparisons/actual.js: -------------------------------------------------------------------------------- 1 | 'function' === typeof a; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/fixtures/typeof-comparisons/expected.js: -------------------------------------------------------------------------------- 1 | 'function' == typeof a; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-simplify-comparison-operators/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-undefined-to-void/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-undefined-to-void/__tests__/fixtures/basic/actual.js: -------------------------------------------------------------------------------- 1 | var foo;foo === undefined; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-undefined-to-void/__tests__/fixtures/basic/expected.js: -------------------------------------------------------------------------------- 1 | var foo; 2 | foo === void 0; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-undefined-to-void/__tests__/fixtures/member-expression/actual.js: -------------------------------------------------------------------------------- 1 | var foo;foo === undefined.foo; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-undefined-to-void/__tests__/fixtures/member-expression/expected.js: -------------------------------------------------------------------------------- 1 | var foo; 2 | foo === (void 0).foo; -------------------------------------------------------------------------------- /packages/babel-plugin-transform-undefined-to-void/__tests__/index.js: -------------------------------------------------------------------------------- 1 | const runner = require("test-runner"); 2 | runner(__dirname); 3 | -------------------------------------------------------------------------------- /packages/babel-preset-minify/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /packages/gulp-babel-minify/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | __tests__ 3 | node_modules 4 | *.log 5 | -------------------------------------------------------------------------------- /scripts/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-console": "off" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /scripts/.gitignore: -------------------------------------------------------------------------------- 1 | benchmark_cache 2 | -------------------------------------------------------------------------------- /scripts/NPM_OWNERS: -------------------------------------------------------------------------------- 1 | hzoo 2 | amasad 3 | kangax 4 | boopathi 5 | -------------------------------------------------------------------------------- /scripts/gcc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/babel/minify/8f9c7c0a32103653bd6793d0ce44730f937e1ddf/scripts/gcc.jar -------------------------------------------------------------------------------- /smoke/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-console": "off" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /utils/test-runner/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-runner", 3 | "version": "0.0.4", 4 | "private": true, 5 | "main": "lib/index.js" 6 | } 7 | -------------------------------------------------------------------------------- /utils/test-runner/src/argParser.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const minimist = require("minimist"); 4 | 5 | module.exports = function parseArgs(args) { 6 | const marker = args.indexOf("--"); 7 | if (marker < 0) return {}; 8 | return minimist(args.slice(marker + 1)); 9 | }; 10 | -------------------------------------------------------------------------------- /utils/test-transform/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-transform", 3 | "version": "0.0.4", 4 | "private": true, 5 | "main": "lib/test-transform.js" 6 | } 7 | -------------------------------------------------------------------------------- /utils/unpad/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "unpad", 3 | "version": "0.0.3", 4 | "private": true, 5 | "main": "lib/unpad.js" 6 | } 7 | --------------------------------------------------------------------------------