This breaks json3.js into separate CommonJS modules that are stitched together with webpack. The source files are usable as separate modules—requiring them imports the make* factories that return the exported methods—but it's a little tricky with runInContext, has, and our export system. For now, I just added a webpack WrapperPlugin that wraps the build in build/assets/{header, footer}.js.
Various functions from build.js have also been moved into their own modules. I investigated switching to gulp (4.0 adds a lot of nice conveniences), but held off for now...we're using a lot of custom, non-streaming transforms, and I don't think we need one-off gulp-json3-* plugins. getCompiler and friends have been removed entirely; Bower can download and cache the Closure Compiler for us.
@d10 I'd love your feedback, whenever you have some spare cycles. I expect this will need a lot more polish before it's ready for merging. :smile_cat:
There is a slight increase in the size of the minified version, but I think it's acceptable—especially if we can do custom builds in the future that remove some of the corner cases (e.g., Date#toJSON fixes).
This breaks
json3.js
into separate CommonJS modules that are stitched together with webpack. The source files are usable as separate modules—requiring them imports themake*
factories that return the exported methods—but it's a little tricky withrunInContext
,has
, and our export system. For now, I just added a webpackWrapperPlugin
that wraps the build inbuild/assets/{header, footer}.js
.Various functions from
build.js
have also been moved into their own modules. I investigated switching to gulp (4.0 adds a lot of nice conveniences), but held off for now...we're using a lot of custom, non-streaming transforms, and I don't think we need one-offgulp-json3-*
plugins.getCompiler
and friends have been removed entirely; Bower can download and cache the Closure Compiler for us.@d10 I'd love your feedback, whenever you have some spare cycles. I expect this will need a lot more polish before it's ready for merging. :smile_cat:
There is a slight increase in the size of the minified version, but I think it's acceptable—especially if we can do custom builds in the future that remove some of the corner cases (e.g.,
Date#toJSON
fixes).master
feature/webpack