diff --git a/lib/babel-plugin-strip-heimdall.js b/lib/babel-plugin-strip-heimdall.js deleted file mode 100644 index 0ba209ca549..00000000000 --- a/lib/babel-plugin-strip-heimdall.js +++ /dev/null @@ -1,63 +0,0 @@ -var path = require('path'); - -function stripNode(node, path, removeNode) { - if (node.type === 'CallExpression' && - node.callee && - node.callee.type === 'MemberExpression' && - node.callee.object.name === 'heimdall') { - - // strips anything like `heimdall.stop(token)` - // except for within switch statements - if (path.body && path.body.length) { - var index = path.body.indexOf(removeNode); - - if (index !== -1) { - path.body.splice(index, 1); - } - - // strips `heimdall.stop(token);` within switch statements - } else if (path.type === 'SwitchCase' && path.consequent && path.consequent.length) { - let index = path.consequent.indexOf(removeNode); - - if (index !== -1) { - path.consequent.splice(index, 1); - } - } else { - // debugger; - } - - // catch things like `token = heimdall.start('') - } else if (node.type === 'AssignmentExpression') { - if (node.right) { - stripNode(node.right, path, removeNode); - } - } -} - -function stripHeimdall(babel) { - return new babel.Plugin('strip-heimdall', { - visitor: { - ExpressionStatement: function(node, path) { - // strip stops - stripNode(node.expression, path, node); - }, - - VariableDeclaration: function(node, path) { - //strip `let token = heimdall.start('');` - if (node.declarations && node.declarations.length === 1) { - var d = node.declarations[0]; - - if (d.init) { - stripNode(d.init, path, node); - } - } - } - } - }); -} - -stripHeimdall.baseDir = function() { - return path.join(__dirname, '..'); -}; - -module.exports = stripHeimdall; diff --git a/lib/strip-class-callcheck.js b/lib/strip-class-callcheck.js deleted file mode 100644 index 887babd91b9..00000000000 --- a/lib/strip-class-callcheck.js +++ /dev/null @@ -1,31 +0,0 @@ -var path = require('path'); - -function stripClassCallCheck(babel) { - return new babel.Plugin('strip-class-call-check', { - visitor: { - ExpressionStatement: function(node, path) { - if (node.expression.type === 'CallExpression' && - node.expression.callee && - node.expression.callee.type === 'MemberExpression' && - node.expression.callee.object.name === 'babelHelpers' && - node.expression.callee.property.name === 'classCallCheck') { - - console.log('\n\n\n\n\n\n\n\n\n\n================\nSTRIPPING\n===============\n\n') - - if (path.body && path.body.length) { - path.body = path.body.filter(function(item) { - return item !== node; - }); - } - } - } - } - }); -} - -stripClassCallCheck.baseDir = function() { - return path.join(__dirname, '..'); -}; - - -module.exports = stripClassCallCheck; diff --git a/lib/stripped-build-plugins.js b/lib/stripped-build-plugins.js index 93b5c215d1d..8bb773fd373 100644 --- a/lib/stripped-build-plugins.js +++ b/lib/stripped-build-plugins.js @@ -2,8 +2,7 @@ var fs = require('fs'); var path = require('path'); var filterImports = require('babel-plugin-filter-imports'); var featureFlags = require('babel-plugin-feature-flags'); -var stripHeimdall = require('./babel-plugin-strip-heimdall'); -var stripClassCallback = require('./strip-class-callcheck'); +var stripHeimdall = require('babel5-plugin-strip-heimdall'); module.exports = function(environment) { var featuresJsonPath = __dirname + '/../config/features.json'; @@ -22,8 +21,7 @@ module.exports = function(environment) { featureFlags({ import: { module: 'ember-data/-private/features' }, features: features - }), - { transformer: stripClassCallback, position: 'after' } + }) ]; if (environment === 'production') { diff --git a/package.json b/package.json index 5879c8f8f65..50b82674175 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "amd-name-resolver": "0.0.5", "babel-plugin-feature-flags": "^0.2.1", "babel-plugin-filter-imports": "^0.2.0", + "babel5-plugin-strip-heimdall": "5.0.0", "broccoli-babel-transpiler": "^5.5.0", "broccoli-file-creator": "^1.0.0", "broccoli-merge-trees": "^1.0.0",