@@ -5,6 +5,7 @@ const Convert = require('./convert-source-map');
55const fs = require ( '../file-system' ) ;
66const SourceInclusion = require ( './source-inclusion' ) . SourceInclusion ;
77const DependencyInclusion = require ( './dependency-inclusion' ) . DependencyInclusion ;
8+ const Configuration = require ( '../configuration' ) . Configuration ;
89const Utils = require ( './utils' ) ;
910
1011exports . Bundle = class {
@@ -25,7 +26,7 @@ exports.Bundle = class {
2526 this . excludes = ( this . includes . exclude || [ ] ) . map ( x => this . createMatcher ( x ) ) ;
2627 this . includes = this . includes . include . map ( x => new SourceInclusion ( this , x ) ) ;
2728 }
28- this . buildOptions = bundler . interpretBuildOptions ( config . options , bundler . buildOptions ) ;
29+ this . buildOptions = new Configuration ( config . options , bundler . buildOptions . getAllOptions ( ) ) ;
2930 this . requiresBuild = true ;
3031 this . fileCache = { } ;
3132 }
@@ -148,7 +149,7 @@ exports.Bundle = class {
148149
149150 for ( let i = 0 ; i < files . length ; ++ i ) {
150151 let currentFile = files [ i ] ;
151- let sourceMap = buildOptions . sourcemaps ? currentFile . sourceMap : undefined ;
152+ let sourceMap = buildOptions . isApplicable ( ' sourcemaps' ) ? currentFile . sourceMap : undefined ;
152153
153154 function fileIsDependency ( file ) {
154155 return file
@@ -210,7 +211,7 @@ exports.Bundle = class {
210211 concat . add ( undefined , this . writeLoaderCode ( platform ) ) ;
211212 contents = concat . content ;
212213
213- if ( buildOptions . rev ) {
214+ if ( buildOptions . isApplicable ( ' rev' ) ) {
214215 //Generate a unique hash based off of the bundle contents
215216 //Must generate hash after we write the loader config so that any other bundle changes (hash changes) can cause a new hash for the vendor file
216217 this . hash = generateHash ( concat . content ) ;
@@ -222,7 +223,7 @@ exports.Bundle = class {
222223 if ( platform . index ) {
223224 this . setIndexFileConfigTarget ( platform , path . posix . join ( outputDir , bundleFileName ) ) ;
224225 }
225- } else if ( buildOptions . rev ) {
226+ } else if ( buildOptions . isApplicable ( ' rev' ) ) {
226227 //Generate a unique hash based off of the bundle contents
227228 //Must generate hash after we write the loader config so that any other bundle changes (hash changes) can cause a new hash for the vendor file
228229 this . hash = generateHash ( concat . content ) ;
@@ -237,8 +238,8 @@ exports.Bundle = class {
237238
238239 console . log ( `Writing ${ bundleFileName } ...` ) ;
239240
240- if ( buildOptions . minify ) {
241- let minificationOptions = { fromString : true } ;
241+ if ( buildOptions . isApplicable ( ' minify' ) ) {
242+ let minificationOptions = Object . assign ( { fromString : true } , buildOptions . getValue ( 'minify' ) ) ;
242243
243244 if ( needsSourceMap ) {
244245 minificationOptions . inSourceMap = Convert . fromJSON ( concat . sourceMap ) . toObject ( ) ;
0 commit comments