@@ -15,8 +15,8 @@ const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
1515const { RawEnvPlugin} = require ( './tools/wp-raw-patch-plugin' ) ;
1616const patchCodemirror = require ( './tools/wp-patch-codemirror' ) ;
1717const {
18- escapeForRe, getManifestOvrName , transESM2var, transSourceMap,
19- BUILD , CHANNEL , CM_PACKAGE_PATH , DEV , MANIFEST , MV3 , ROOT , TARGET , ZIP , nukeHtmlSpaces ,
18+ escapeForRe, nukeHtmlSpaces , transESM2var, transSourceMap,
19+ BUILD , CHANNEL , CM_PACKAGE_PATH , DEV , FLAVOR , MANIFEST , MV3 , ROOT , TARGET , ZIP ,
2020} = require ( './tools/util' ) ;
2121
2222global . localStorage = { } ; // workaround for node 25 and HtmlWebpackPlugin's `...global`
@@ -354,27 +354,21 @@ function makeContentScript(name) {
354354}
355355
356356function makeManifest ( files ) {
357- let [ base , ovr ] = ( files [ 0 ] . sourceFilename . endsWith ( MANIFEST ) ? files : files . reverse ( ) )
357+ let [ base , ... mods ] = ( files [ 0 ] . sourceFilename . endsWith ( MANIFEST ) ? files : files . reverse ( ) )
358358 . map ( file => file . data . toString ( ) ) ;
359359 base = JSON . parse ( MV3 ? base . replace ( '"browser_action"' , '"action"' ) : base ) ;
360- ovr = JSON . parse ( ovr ) ;
361- for ( const [ key , val ] of Object . entries ( ovr ) ) {
362- const old = base [ key ] ;
363- if ( Array . isArray ( old ) ) old . push ( ...val ) ;
364- else if ( old && typeof old === 'object' ) Object . assign ( old , val ) ;
365- else base [ key ] = val ;
360+ for ( let ovr of mods ) {
361+ ovr = JSON . parse ( ovr ) ;
362+ for ( const [ key , val ] of Object . entries ( ovr ) ) {
363+ const old = base [ key ] ;
364+ if ( Array . isArray ( old ) ) old . push ( ...val ) ;
365+ else if ( old && typeof old === 'object' ) Object . assign ( old , val ) ;
366+ else base [ key ] = val ;
367+ }
366368 }
367369 let ver = base . version ;
368370 if ( BUILD === 'firefox' ) {
369371 delete base . key ;
370- base . options_ui = {
371- /*
372- * Linking to dashboard, not to options, because this is aimed at users who removed the icon
373- * from the toolbar (they rarely use Stylus) so they visit about:addons instead.
374- */
375- page : 'manage.html' ,
376- open_in_tab : true ,
377- } ;
378372 }
379373 if ( CHANNEL ) {
380374 base . name += ` (${ CHANNEL } )` ;
@@ -469,7 +463,7 @@ module.exports = [
469463 patterns : [
470464 { context : SRC , from : 'icon/**' , to : DST } ,
471465 { context : SRC + 'content' , from : 'install*.js' , to : DST + JS } ,
472- { context : SRC , from : getManifestOvrName ( MV3 , true ) , to : MANIFEST ,
466+ { context : SRC , from : MANIFEST . replace ( '.' , `?(- ${ FLAVOR } *).` ) , to : MANIFEST ,
473467 transformAll : makeManifest } ,
474468 { context : SRC , from : '_locales/**' , to : DST } ,
475469 { context : THEME_PATH , from : '*.css' , to : DST + CM_PATH } ,
0 commit comments