Files
meteor/packages/babel-compiler/babel.js
Ben Newman 6407e4dafb Update meteor-babel to version 7.0.0-beta.49-1.
Also switching from babelOptions.sourceMap to babelOptions.sourceMaps,
finally: https://babeljs.io/docs/usage/api/#options
2018-05-25 18:43:13 -04:00

52 lines
1.4 KiB
JavaScript

var meteorBabel = null;
function getMeteorBabel() {
return meteorBabel || (meteorBabel = Npm.require("meteor-babel"));
}
/**
* Returns a new object containing default options appropriate for
*/
function getDefaultOptions(extraFeatures) {
// See https://github.com/meteor/babel/blob/master/options.js for more
// information about what the default options are.
return getMeteorBabel().getDefaultOptions(extraFeatures);
}
Babel = {
getDefaultOptions: getDefaultOptions,
// Deprecated, now a no-op.
validateExtraFeatures: Function.prototype,
parse: function (source) {
return getMeteorBabel().parse(source);
},
compile: function (source, babelOptions, cacheOptions) {
return getMeteorBabel().compile(
source,
babelOptions || getDefaultOptions(),
cacheOptions,
);
},
// This method is deprecated in favor of passing
// cacheDeps.cacheDirectory to Babel.compile (see above).
setCacheDir: function (cacheDir) {
getMeteorBabel().setCacheDir(cacheDir);
},
minify: function (source, options) {
var options = options || getMeteorBabel().getMinifierOptions();
return getMeteorBabel().minify(source, options);
},
getMinifierOptions: function (extraFeatures) {
return getMeteorBabel().getMinifierOptions(extraFeatures);
},
getMinimumModernBrowserVersions: function () {
return Npm.require("meteor-babel/modern-versions.js").get();
}
};