@@ -9,14 +9,23 @@ const defaultOptions = {
99 components : { } ,
1010 componentOptions : { } ,
1111 manifestSync : [ 'version' ] ,
12- modesToZip : [ 'production' ]
12+ modesToZip : [ 'production' ] ,
13+ manifestTransformer : null
1314}
1415const performanceAssetFilterList = [
1516 ( file ) => ! / \. m a p $ / . test ( file ) ,
1617 ( file ) => ! file . endsWith ( '.zip' ) ,
1718 ( file ) => ! / ^ i c o n s \/ / . test ( file )
1819]
1920
21+ function getManifestJsonString ( pluginOptions , jsonContent ) {
22+ if ( pluginOptions . manifestTransformer ) {
23+ const jsonContentCopy = Object . assign ( { } , jsonContent ) ;
24+ jsonContent = pluginOptions . manifestTransformer ( jsonContentCopy )
25+ }
26+ return JSON . stringify ( jsonContent , null , 2 )
27+ }
28+
2029module . exports = ( api , options ) => {
2130 const appRootPath = api . getCwd ( )
2231 const pluginOptions = options . pluginOptions . browserExtension
@@ -97,7 +106,7 @@ module.exports = (api, options) => {
97106 }
98107
99108 if ( isProduction ) {
100- return resolve ( JSON . stringify ( jsonContent , null , 2 ) )
109+ return resolve ( getManifestJsonString ( pluginOptions , jsonContent ) )
101110 }
102111
103112 jsonContent . content_security_policy =
@@ -113,13 +122,13 @@ module.exports = (api, options) => {
113122 }
114123
115124 jsonContent . key = stdout
116- resolve ( JSON . stringify ( jsonContent , null , 2 ) )
125+ resolve ( getManifestJsonString ( pluginOptions , jsonContent ) )
117126 } )
118127 } catch ( error ) {
119128 logger . warn (
120129 'No key.pem file found. This is fine for dev, however you may have problems publishing without one'
121130 )
122- resolve ( JSON . stringify ( jsonContent , null , 2 ) )
131+ resolve ( getManifestJsonString ( pluginOptions , jsonContent ) )
123132 }
124133 } )
125134 }
0 commit comments