dfahlander / typeson-registry

The type registry for typeson

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ES6 Modules

brettz9 opened this issue · comments

Not sure if/when I may get to it, but wanted to get your opinion on reworking the source files (and possibly tests also) into ES6 modules?

Chrome is already shipping ES6 module support without a flag (and it looks like Safari/iOS Safari too per http://caniuse.com/#feat=es6-module ), so I'm eager for the possibility of being able to directly import the source files in my ES6 module code in the browser (and in Node too when it gets to it)... Babel should work fine for builds into dist...

Hi David...

For typeson alpha 10, I've made a switch to ES6 modules for source representation though converting to CommonJS for compatibility in that regard with past versions. While Webpack can also convert to ES6 modules, I find it is more satisfying to use the standard syntax internally and Rollup is quite smooth I've found for not only converting to CommonJS but even to ES6 modules which can have npm references resolved for browsers that support them (along with uglification and source map preservation).

While I was already making some significant internal changes, I also came up with what are unfortunately a number of breaking changes which I felt would be more sustainable into the future; they relate to changing the type names and/or file names to follow a consistent, predictable pattern so that people importing specific types or presets don't have to look up the names every time they import. I also made some changes like lower-casing type names intended to support variable names that might end up being destructured with fewer conflicts--e.g., renaming "Infinity" to "infinity".

brettz9/typeson-registry@1b50d5b...e1fb2b6#diff-8b1c3fd0d4a6765c16dfd18509182f9d

If such changes are ok with you, I'd like to go ahead and put this as version 1.0.0 (which I've not yet released).