@@ -30,8 +30,6 @@ function getVersionChecker(context) {
3030 return checker ;
3131}
3232
33-
34-
3533/*
3634 * Main entrypoint for the Ember CLI addon.
3735 */
@@ -62,10 +60,11 @@ module.exports = {
6260 * See: https://ember-cli.com/user-guide/#integration
6361 */
6462 included ( app ) {
65-
6663 let assetRev = this . project . addons . find ( addon => addon . name === 'broccoli-asset-rev' ) ;
67- if ( assetRev && ! assetRev . supportsFastboot ) {
68- throw new SilentError ( "This version of ember-cli-fastboot requires a newer version of broccoli-asset-rev" ) ;
64+ if ( assetRev && ! assetRev . supportsFastboot ) {
65+ throw new SilentError (
66+ 'This version of ember-cli-fastboot requires a newer version of broccoli-asset-rev'
67+ ) ;
6968 }
7069
7170 // set autoRun to false since we will conditionally include creating app when app files
@@ -91,8 +90,8 @@ module.exports = {
9190 */
9291 importTransforms ( ) {
9392 return {
94- fastbootShim : fastbootTransform
95- }
93+ fastbootShim : fastbootTransform ,
94+ } ;
9695 } ,
9796
9897 /**
@@ -102,16 +101,15 @@ module.exports = {
102101 */
103102 contentFor ( type , config , contents ) {
104103 if ( type === 'body' ) {
105- return " <!-- EMBER_CLI_FASTBOOT_BODY -->" ;
104+ return ' <!-- EMBER_CLI_FASTBOOT_BODY -->' ;
106105 }
107106
108107 if ( type === 'head' ) {
109- return " <!-- EMBER_CLI_FASTBOOT_TITLE --><!-- EMBER_CLI_FASTBOOT_HEAD -->" ;
108+ return ' <!-- EMBER_CLI_FASTBOOT_TITLE --><!-- EMBER_CLI_FASTBOOT_HEAD -->' ;
110109 }
111110
112111 if ( type === 'app-boot' ) {
113- const isModuleUnification = this . _isModuleUnification ( ) ;
114- return fastbootAppBoot ( config . modulePrefix , JSON . stringify ( config . APP || { } ) , isModuleUnification ) ;
112+ return fastbootAppBoot ( config . modulePrefix , JSON . stringify ( config . APP || { } ) ) ;
115113 }
116114
117115 // if the fastboot addon is installed, we overwrite the config-module so that the config can be read
@@ -121,10 +119,10 @@ module.exports = {
121119 const appConfigModule = `${ config . modulePrefix } ` ;
122120 contents . splice ( 0 , contents . length ) ;
123121 contents . push (
124- ' if (typeof FastBoot !== \ 'undefined\ ') {' ,
125- ' return FastBoot.config(\'' + appConfigModule + '\');' ,
122+ " if (typeof FastBoot !== 'undefined') {" ,
123+ " return FastBoot.config('" + appConfigModule + "');" ,
126124 '} else {' ,
127- originalContents ,
125+ originalContents ,
128126 '}'
129127 ) ;
130128 return ;
@@ -144,7 +142,7 @@ module.exports = {
144142 } ,
145143
146144 _processAddons ( addons , fastbootTrees ) {
147- addons . forEach ( ( addon ) => {
145+ addons . forEach ( addon => {
148146 this . _processAddon ( addon , fastbootTrees ) ;
149147 } ) ;
150148 } ,
@@ -177,7 +175,6 @@ module.exports = {
177175 */
178176 _getFastbootTree ( ) {
179177 const appName = this . _name ;
180- const isModuleUnification = this . _isModuleUnification ( ) ;
181178
182179 let fastbootTrees = [ ] ;
183180
@@ -192,22 +189,22 @@ module.exports = {
192189
193190 // transpile the fastboot JS tree
194191 let mergedFastBootTree = new MergeTrees ( fastbootTrees , {
195- overwrite : true
192+ overwrite : true ,
196193 } ) ;
197194
198195 let funneledFastbootTrees = new Funnel ( mergedFastBootTree , {
199- destDir : appName
196+ destDir : appName ,
200197 } ) ;
201198 const processExtraTree = p . preprocessJs ( funneledFastbootTrees , '/' , this . _name , {
202- registry : this . _appRegistry
199+ registry : this . _appRegistry ,
203200 } ) ;
204201
205202 // FastBoot app factory module
206203 const writeFile = require ( 'broccoli-file-creator' ) ;
207- let appFactoryModuleTree = writeFile ( " app-factory.js" , fastbootAppFactoryModule ( appName , this . _isModuleUnification ( ) ) ) ;
204+ let appFactoryModuleTree = writeFile ( ' app-factory.js' , fastbootAppFactoryModule ( appName ) ) ;
208205
209206 let newProcessExtraTree = new MergeTrees ( [ processExtraTree , appFactoryModuleTree ] , {
210- overwrite : true
207+ overwrite : true ,
211208 } ) ;
212209
213210 function stripLeadingSlash ( filePath ) {
@@ -216,7 +213,7 @@ module.exports = {
216213
217214 let appFilePath = stripLeadingSlash ( this . app . options . outputPaths . app . js ) ;
218215 let finalFastbootTree = new Concat ( newProcessExtraTree , {
219- outputFile : appFilePath . replace ( / \. j s $ / , '-fastboot.js' )
216+ outputFile : appFilePath . replace ( / \. j s $ / , '-fastboot.js' ) ,
220217 } ) ;
221218
222219 return finalFastbootTree ;
@@ -235,7 +232,7 @@ module.exports = {
235232 let fastbootConfigTree = this . _buildFastbootConfigTree ( newTree ) ;
236233
237234 // Merge the package.json with the existing tree
238- return new MergeTrees ( [ newTree , fastbootConfigTree ] , { overwrite : true } ) ;
235+ return new MergeTrees ( [ newTree , fastbootConfigTree ] , { overwrite : true } ) ;
239236 } ,
240237
241238 /**
@@ -251,7 +248,7 @@ module.exports = {
251248
252249 if ( config instanceof Array ) {
253250 let copy = [ ] ;
254- for ( let i = 0 ; i < config . length ; i ++ ) {
251+ for ( let i = 0 ; i < config . length ; i ++ ) {
255252 copy [ i ] = this . _cloneConfigObject ( config [ i ] ) ;
256253 }
257254
@@ -305,7 +302,7 @@ module.exports = {
305302 outputPaths : this . app . options . outputPaths ,
306303 ui : this . ui ,
307304 fastbootAppConfig : fastbootAppConfig ,
308- appConfig : appConfig
305+ appConfig : appConfig ,
309306 } ) ;
310307 } ,
311308
@@ -318,26 +315,25 @@ module.exports = {
318315 // that version contains API to hook fastboot into ember-cli
319316
320317 app . use ( ( req , resp , next ) => {
321- const fastbootQueryParam = ( req . query . hasOwnProperty ( 'fastboot' ) && req . query . fastboot === 'false' ) ? false : true ;
318+ const fastbootQueryParam =
319+ req . query . hasOwnProperty ( 'fastboot' ) && req . query . fastboot === 'false' ? false : true ;
322320 const enableFastBootServe = ! process . env . FASTBOOT_DISABLED && fastbootQueryParam ;
323321
324322 if ( req . serveUrl && enableFastBootServe ) {
325323 // if it is a base page request, then have fastboot serve the base page
326324 if ( ! this . fastboot ) {
327325 const broccoliHeader = req . headers [ 'x-broccoli' ] ;
328326 const outputPath = broccoliHeader [ 'outputPath' ] ;
329- const fastbootOptions = Object . assign (
330- { } ,
331- this . fastbootOptions ,
332- { distPath : outputPath }
333- ) ;
327+ const fastbootOptions = Object . assign ( { } , this . fastbootOptions , {
328+ distPath : outputPath ,
329+ } ) ;
334330
335331 this . ui . writeLine ( chalk . green ( 'App is being served by FastBoot' ) ) ;
336332 this . fastboot = new FastBoot ( fastbootOptions ) ;
337333 }
338334
339335 let fastbootMiddleware = FastBootExpressMiddleware ( {
340- fastboot : this . fastboot
336+ fastboot : this . fastboot ,
341337 } ) ;
342338
343339 fastbootMiddleware ( req , resp , next ) ;
@@ -356,7 +352,7 @@ module.exports = {
356352 // in sandbox.
357353 this . ui . writeLine ( chalk . blue ( 'Reloading FastBoot...' ) ) ;
358354 this . fastboot . reload ( {
359- distPath : result . directory
355+ distPath : result . directory ,
360356 } ) ;
361357 }
362358 } ,
@@ -378,10 +374,6 @@ module.exports = {
378374 return checker . for ( 'ember' , 'bower' ) ;
379375 } ,
380376
381- _isModuleUnification ( ) {
382- return ( typeof this . project . isModuleUnification === 'function' ) && this . project . isModuleUnification ( ) ;
383- } ,
384-
385377 /**
386378 * Reads FastBoot configuration from application's `config/fastboot.js` file if present,
387379 * otherwise returns empty object.
@@ -398,5 +390,5 @@ module.exports = {
398390 return require ( configPath ) ( environment ) ;
399391 }
400392 return { } ;
401- }
393+ } ,
402394} ;
0 commit comments