zambezi / ez-build

Zambezi build tool
MIT License
2 stars 1 forks source link

Support for conditional compilation depending on target #47

Closed mstade closed 7 years ago

mstade commented 7 years ago

Description

This PR implements support for conditional compiling of JavaScript features, depending on the target environment. The builder covers the same feature set as before, i.e. ratified standards by default, stages can still be enabled via flags.

This removes the es2017 flag, since it's now a ratified standard. Those features are enabled by default. This PR should also remove any need for es2017 style flags in the future, since the preset we use to build things essentially include the same as latest and thus those features would be enabled based on target environments instead.

Motivation and Context

By using conditional compilation based on targets, it's easier to ensure we're only compiling what needs to be compiled, as opposed to taking least common denominator approach of always compiling anything back to es2015. Hopefully, this should improve the quality of the output, and over time provide performance improvements as well.

This means it's more difficult to guarantee consistent builds, since a query like last 3 versions for browser targets won't remain the same over time. Hopefully this is still not particularly tricky to reason about however.

How Was This Tested?

All current tests pass, and a few tests were added to cover the new options. However, the test suite probably needs expansion.

Types of changes

Checklist:

codecov-io commented 7 years ago

Codecov Report

Merging #47 into master will increase coverage by 0.09%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #47      +/-   ##
==========================================
+ Coverage   93.81%   93.91%   +0.09%     
==========================================
  Files          15       15              
  Lines         307      312       +5     
==========================================
+ Hits          288      293       +5     
  Misses         19       19
Impacted Files Coverage Δ
src/cli/opts.js 100% <100%> (ø) :arrow_up:
src/builder/javascript.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e2bf1b5...9362e66. Read the comment docs.

mstade commented 7 years ago

@poetro does this look alright to you now?