diff --git a/lib/get-babel-options.js b/lib/get-babel-options.js deleted file mode 100644 index b41d4db..0000000 --- a/lib/get-babel-options.js +++ /dev/null @@ -1,36 +0,0 @@ -var clone = require('clone'); - -function getAddonOptions(addonContext) { - var baseOptions = (addonContext.parent && addonContext.parent.options) || (addonContext.app && addonContext.app.options); - return baseOptions && baseOptions.babel || {}; -} - -function getBabelOptions(addonContext) { - var options = clone(getAddonOptions(addonContext)); - - // Ensure modules aren't compiled unless explicitly set to compile - options.blacklist = options.blacklist || ['es6.modules']; - - // do not enable non-standard transforms - if (!('nonStandard' in options)) { - options.nonStandard = false; - } - - // Don't include the `includePolyfill` flag, since Babel doesn't care - delete options.includePolyfill; - - // disable module transpilation so that we can use rollup to build a single - // loaderless sw.js - delete options.compileModules; - if (options.blacklist.indexOf('es6.modules') < 0) { - options.blacklist.push('es6.modules'); - } - - // Ember-CLI inserts its own 'use strict' directive - options.blacklist.push('useStrict'); - options.highlightCode = false; - - return options; -} - -module.exports = getBabelOptions; diff --git a/lib/service-worker-builder.js b/lib/service-worker-builder.js index 3d83251..4f927ac 100644 --- a/lib/service-worker-builder.js +++ b/lib/service-worker-builder.js @@ -1,11 +1,9 @@ 'use strict'; -const Babel = require('broccoli-babel-transpiler'); const EntryPoint = require('./entry-point'); const Funnel = require('broccoli-funnel'); const Rollup = require('./rollup-with-dependencies'); const existsSync = require('exists-sync'); -const getBabelOptions = require('./get-babel-options'); const mergeTrees = require('broccoli-merge-trees'); const path = require('path'); const rollupReplace = require('rollup-plugin-replace'); @@ -117,7 +115,7 @@ module.exports = class ServiceWorkerBuilder { } _babelTranspile(tree) { - let babelOptions = getBabelOptions(this.app.project); - return new Babel(tree, babelOptions); + let emberCliBabel = this.app.project.addons.filter((a) => a.name === 'ember-cli-babel')[0]; + return emberCliBabel.transpileTree(tree, { 'ember-cli-babel': { compileModules: false } }); } } diff --git a/node-tests/fixtures/simple-app/package.json b/node-tests/fixtures/simple-app/package.json index 2390111..49a0f13 100644 --- a/node-tests/fixtures/simple-app/package.json +++ b/node-tests/fixtures/simple-app/package.json @@ -21,11 +21,11 @@ "ember-ajax": "^2.4.1", "ember-cli": "2.12.0", "ember-cli-app-version": "^2.0.0", - "ember-cli-babel": "^5.1.7", + "ember-cli-babel": "^6.9.0", "ember-cli-dependency-checker": "^1.3.0", "ember-cli-eslint": "^3.0.0", "ember-cli-htmlbars": "^1.1.1", - "ember-cli-htmlbars-inline-precompile": "^0.3.6", + "ember-cli-htmlbars-inline-precompile": "^1.0.0", "ember-cli-inject-live-reload": "^1.4.1", "ember-cli-qunit": "^3.1.0", "ember-cli-shims": "^1.0.2", diff --git a/package.json b/package.json index 7fde45a..6ecc803 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "service worker" ], "dependencies": { - "broccoli-babel-transpiler": "^6.1.2", "broccoli-file-creator": "^1.1.1", "broccoli-funnel": "^1.0.3", "broccoli-merge-trees": "1.1.1",