Skip to content

Commit

Permalink
strip class call check
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Aug 30, 2016
1 parent 5c6ebe1 commit 8e3b420
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 4 deletions.
4 changes: 2 additions & 2 deletions benchmarks/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
"slugs": [
"simple-find-all"
// "simple-find-all-one"
//"simple-find-all"
"simple-find-all-one"
// "simple-find-all-tons"
// "complex-find-all"
],
Expand Down
4 changes: 3 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ var yuidoc = require('./lib/yuidoc');

module.exports = function(defaults) {
var app = new EmberApp(defaults, {
// Add options here
babel: {
externalHelpers: true
}
});

/*
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ module.exports = {
this.options.babel = this.options.babel || {};
add(this.options.babel, 'blacklist', ['es6.modules', 'useStrict']);
add(this.options.babel, 'plugins', require('./lib/stripped-build-plugins')(process.env.EMBER_ENV));
this.options.babel.externalHelpers = { outputType: "global" };

this._hasSetupBabelOptions = true;
},
Expand Down
1 change: 1 addition & 0 deletions lib/babel-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function babelOptions(libraryName, _options) {
'es6.constants',
'es6.modules'
],
externalHelpers: true,
sourceMaps: false,
modules: 'amdStrict',
moduleRoot: libraryName,
Expand Down
29 changes: 29 additions & 0 deletions lib/strip-class-callcheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
var path = require('path');

function stripClassCallCheck(babel) {
return new babel.Plugin('strip-class-call-check', {
visitor: {
ExpressionStatement: function(node, path, options) {
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') {

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;
4 changes: 3 additions & 1 deletion lib/stripped-build-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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 stripClassCallcheck = require('./strip-class-callcheck');

module.exports = function(environment) {
var featuresJsonPath = __dirname + '/../config/features.json';
Expand All @@ -21,7 +22,8 @@ module.exports = function(environment) {
featureFlags({
import: { module: 'ember-data/-private/features' },
features: features
})
}),
stripClassCallcheck
];

if (environment === 'production') {
Expand Down

0 comments on commit 8e3b420

Please sign in to comment.