1+ /* eslint-env node */
12'use strict' ;
23
34const fs = require ( 'fs' ) ;
@@ -7,7 +8,6 @@ const merge = require('ember-cli-lodash-subset').merge;
78const md5Hex = require ( 'md5-hex' ) ;
89const path = require ( 'path' ) ;
910const Plugin = require ( 'broccoli-plugin' ) ;
10- const SilentError = require ( 'silent-error' ) ;
1111
1212const stringify = require ( 'json-stable-stringify' ) ;
1313
@@ -23,7 +23,6 @@ module.exports = class FastBootConfig extends Plugin {
2323 this . project = options . project ;
2424
2525 this . name = options . name ;
26- this . assetMapEnabled = options . assetMapEnabled ;
2726 this . ui = options . ui ;
2827 this . fastbootAppConfig = options . fastbootAppConfig ;
2928 this . outputPaths = options . outputPaths ;
@@ -39,22 +38,6 @@ module.exports = class FastBootConfig extends Plugin {
3938 this . htmlFile = 'index.html' ;
4039 }
4140
42- let defaultAssetMapPath = 'assets/assetMap.json' ;
43- let assetRev = this . project . addons . find ( addon => addon . name === 'broccoli-asset-rev' ) ;
44-
45- if ( assetRev && assetRev . options ) {
46- this . assetMapEnabled = ! ! ( assetRev . options . enabled && assetRev . options . generateAssetMap ) ;
47-
48- if ( assetRev . options . assetMapPath ) {
49- this . assetMapPath = assetRev . options . assetMapPath ;
50- }
51-
52- if ( assetRev . options . fingerprintAssetMap ) {
53- defaultAssetMapPath = 'assets/assetMap-*.json'
54- }
55- }
56-
57- this . assetMapPath = this . assetMapPath || options . assetMapPath || defaultAssetMapPath ;
5841 }
5942
6043
@@ -145,19 +128,6 @@ module.exports = class FastBootConfig extends Plugin {
145128 this . moduleWhitelist = uniq ( moduleWhitelist ) ;
146129 }
147130
148- readAssetManifest ( ) {
149- let assetMapPath = path . join ( this . inputPaths [ 0 ] , this . assetMapPath ) ;
150-
151- try {
152- let assetMap = JSON . parse ( fs . readFileSync ( assetMapPath ) ) ;
153- return assetMap ;
154- } catch ( e ) {
155- if ( this . assetMapEnabled ) {
156- throw new SilentError ( "assetMap.json not found at: %s. Make sure `generateAssetMap` is set to true" , assetMapPath ) ;
157- }
158- }
159- }
160-
161131 updateFastBootManifest ( manifest ) {
162132 this . project . addons . forEach ( addon => {
163133 if ( addon . updateFastBootManifest ) {
@@ -187,21 +157,7 @@ module.exports = class FastBootConfig extends Plugin {
187157 htmlFile : this . htmlFile
188158 } ;
189159
190- manifest = this . updateFastBootManifest ( manifest ) ;
191-
192- let rewrittenAssets = this . readAssetManifest ( ) ;
193-
194- if ( rewrittenAssets ) {
195- // update the vendor file with the fingerprinted file
196- let rewrittenVendorFiles = manifest [ 'vendorFiles' ] . map ( file => rewrittenAssets . assets [ file ] || file ) ;
197- manifest [ 'vendorFiles' ] = rewrittenVendorFiles ;
198-
199- // update the app files array with fingerprinted files
200- let rewrittenAppFiles = manifest [ 'appFiles' ] . map ( file => rewrittenAssets . assets [ file ] || file ) ;
201- manifest [ 'appFiles' ] = rewrittenAppFiles ;
202- }
203-
204- this . manifest = manifest ;
160+ this . manifest = this . updateFastBootManifest ( manifest ) ;
205161 }
206162
207163 buildHostWhitelist ( ) {
0 commit comments