@@ -7,6 +7,12 @@ const debugGenerator = require('heimdalljs-logger');
77const logger = debugGenerator ( 'ember-cli-htmlbars:utils' ) ;
88const addDependencyTracker = require ( './addDependencyTracker' ) ;
99
10+ const INLINE_PRECOMPILE_MODULES = Object . freeze ( {
11+ 'ember-cli-htmlbars' : 'hbs' ,
12+ 'ember-cli-htmlbars-inline-precompile' : 'default' ,
13+ 'htmlbars-inline-precompile' : 'default' ,
14+ } ) ;
15+
1016function isInlinePrecompileBabelPluginRegistered ( plugins ) {
1117 return plugins . some ( plugin => {
1218 if ( Array . isArray ( plugin ) ) {
@@ -40,6 +46,27 @@ function isColocatedBabelPluginRegistered(plugins) {
4046 ) ;
4147}
4248
49+ function buildParalleizedBabelPlugin ( pluginInfo , templateCompilerPath ) {
50+ let parallelBabelInfo = {
51+ requireFile : require . resolve ( './require-from-worker' ) ,
52+ buildUsing : 'build' ,
53+ params : {
54+ templateCompilerPath,
55+ parallelConfigs : pluginInfo . parallelConfigs ,
56+ modules : INLINE_PRECOMPILE_MODULES ,
57+ } ,
58+ } ;
59+
60+ // parallelBabelInfo will not be used in the cache unless it is explicitly included
61+ let cacheKey = makeCacheKey ( templateCompilerPath , pluginInfo , JSON . stringify ( parallelBabelInfo ) ) ;
62+
63+ return {
64+ _parallelBabel : parallelBabelInfo ,
65+ baseDir : ( ) => __dirname ,
66+ cacheKey : ( ) => cacheKey ,
67+ } ;
68+ }
69+
4370function buildOptions ( projectConfig , templateCompilerPath , pluginInfo ) {
4471 let EmberENV = projectConfig . EmberENV || { } ;
4572
@@ -171,7 +198,7 @@ function setup(pluginInfo, options) {
171198
172199 let plugin = [
173200 require . resolve ( 'babel-plugin-htmlbars-inline-precompile' ) ,
174- { precompile, modules : options . modules } ,
201+ { precompile, modules : INLINE_PRECOMPILE_MODULES } ,
175202 'ember-cli-htmlbars:inline-precompile' ,
176203 ] ;
177204
@@ -256,4 +283,5 @@ module.exports = {
256283 setupPlugins,
257284 isColocatedBabelPluginRegistered,
258285 isInlinePrecompileBabelPluginRegistered,
286+ buildParalleizedBabelPlugin,
259287} ;
0 commit comments