Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable parallel file processing for ember-cli-babel #501

Merged
merged 2 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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