diff --git a/packages/babel-compiler/babel-compiler.js b/packages/babel-compiler/babel-compiler.js index d54ed73fdc..7a06290419 100644 --- a/packages/babel-compiler/babel-compiler.js +++ b/packages/babel-compiler/babel-compiler.js @@ -1,3 +1,5 @@ +var semver = Npm.require("semver"); + /** * A compiler that can be instantiated with features and used inside * Plugin.registerCompiler @@ -13,6 +15,10 @@ var BCp = BabelCompiler.prototype; var excludedFileExtensionPattern = /\.(es5|min)\.js$/i; var hasOwn = Object.prototype.hasOwnProperty; +// There's no way to tell the current Meteor version, but we can infer +// whether it's Meteor 1.4.4 or earlier by checking the Node version. +var isMeteorPre144 = semver.lt(process.version, "4.8.1"); + BCp.processFilesForTarget = function (inputFiles) { // Reset this cache for each batch processed. this._babelrcCache = null; @@ -103,6 +109,19 @@ BCp.processOneFileForTarget = function (inputFile, source) { throw e; } + if (isMeteorPre144) { + // Versions of meteor-tool earlier than 1.4.4 do not understand that + // module.importSync is synonymous with the deprecated module.import + // and thus fail to register dependencies for importSync calls. + // This string replacement may seem a bit hacky, but it will tide us + // over until everyone has updated to Meteor 1.4.4. + // https://github.com/meteor/meteor/issues/8572 + result.code = result.code.replace( + /\bmodule\.importSync\b/g, + "module.import" + ); + } + toBeAdded.data = result.code; toBeAdded.hash = result.hash; toBeAdded.sourceMap = result.map; diff --git a/packages/babel-compiler/package.js b/packages/babel-compiler/package.js index 0a80fcbb09..44bc595b9c 100644 --- a/packages/babel-compiler/package.js +++ b/packages/babel-compiler/package.js @@ -6,7 +6,7 @@ Package.describe({ // isn't possible because you can't publish a non-recommended // release with package versions that don't have a pre-release // identifier at the end (eg, -dev) - version: '6.18.0' + version: '6.18.1' }); Npm.depends({ diff --git a/packages/ecmascript/package.js b/packages/ecmascript/package.js index 4214093ea2..4c27300bbe 100644 --- a/packages/ecmascript/package.js +++ b/packages/ecmascript/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'ecmascript', - version: '0.7.1', + version: '0.7.2', summary: 'Compiler plugin that supports ES2015+ in all .js files', documentation: 'README.md' });