Financial-Times/polyfill-service — pull request #227 by triblondon (2014-12-19 17:06:13+00:00)
Title: Support ES6 polyfill sources with 6to5, closes #179

This was actually surprisingly easy, though I cheated by assuming we don't want to serve untranspiled ES6 to any browser. There's an argument that Firefox 36 might already qualify, having ES6 support that's already better than the 6to5 transpiler. However, while we can guarantee the consistent logic of the transpiler and cope with language features it doesn't support, browsers with varying degrees of ES6 support are harder to cope with so we should probably have a higher bar. At this point I don't think there are any browsers that we should serve raw ES6 to.

I've jotted down a few thoughts in a comment about how we could model the more complex set of sources that would result from having ES version as a dimension along with whether to minify and whether to gate (resulting in a minimum of eight versions of every polyfill variant!). But for now, I think we have a licence to assume we want to level down everything to ES5 before splitting into minified and gated variations.

I also added some better error handling on startup, so that it's easier to spot misconfigured or syntactically invalid polyfills.