Skip to content

Commit

Permalink
Merge pull request #501 from Turbo87/parallel
Browse files Browse the repository at this point in the history
Enable parallel file processing for `ember-cli-babel`
  • Loading branch information
Turbo87 authored Apr 13, 2022
2 parents 7a12a17 + 2f03441 commit 3214aa9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
6 changes: 5 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ module.exports = function(defaults) {
classes: ['description'],
components: ['foo-bar', 'no-minify']
}
}
},

'ember-cli-babel': {
throwUnlessParallelizable: true,
},
});

/*
Expand Down
29 changes: 21 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ module.exports = {
let options = app.options || {};
let config = options['ember-hbs-minifier'] || {};

let HbsMinifierPlugin = require('./hbs-minifier-plugin').createRegistryPlugin(config);
registry.add('htmlbars-ast-plugin', {
name: 'hbs-minifier-plugin',
plugin: HbsMinifierPlugin,
baseDir() { return __dirname; },
cacheKey() { return cacheKeyForConfig(config); }
});
let pluginObj = this._buildPlugin(config);

pluginObj.parallelBabel = {
requireFile: __filename,
buildUsing: '_buildPlugin',
params: config,
};

registry.add('htmlbars-ast-plugin', pluginObj);
},

included(app) {
Expand All @@ -27,7 +29,18 @@ module.exports = {
Refer PR: https://github.com/ember-cli/ember-cli/pull/7059
*/
this._setupPreprocessorRegistry(app);
}
},

_buildPlugin(config) {
let HbsMinifierPlugin = require('./hbs-minifier-plugin').createRegistryPlugin(config);

return {
name: 'hbs-minifier-plugin',
plugin: HbsMinifierPlugin,
baseDir() { return __dirname; },
cacheKey() { return cacheKeyForConfig(config); }
};
},
};

function cacheKeyForConfig(config) {
Expand Down

0 comments on commit 3214aa9

Please sign in to comment.