@@ -184,6 +184,46 @@ describe('diff commands', () => {
184184 expect ( diffMeta . deletes [ 'old-only.txt' ] ) . toBe ( 1 ) ;
185185 } ) ;
186186
187+ test ( 'diff compresses large manifest entries' , async ( ) => {
188+ const originPath = path . join ( tempRoot , 'origin-large-manifest.ppk' ) ;
189+ const nextPath = path . join ( tempRoot , 'next-large-manifest.ppk' ) ;
190+ const outputPath = path . join ( tempRoot , 'out' , 'large-manifest-diff.ppk' ) ;
191+ const originEntries : Record < string , string | Buffer > = {
192+ 'index.bundlejs' : 'old-bundle' ,
193+ } ;
194+ const nextEntries : Record < string , string | Buffer > = {
195+ 'index.bundlejs' : 'new-bundle' ,
196+ } ;
197+
198+ for ( let i = 0 ; i < 24 ; i ++ ) {
199+ const content = `same-content-${ i } ` ;
200+ originEntries [ `assets/old/path/asset-${ i } .txt` ] = content ;
201+ nextEntries [ `assets/new/path/renamed-asset-${ i } .txt` ] = content ;
202+ }
203+
204+ await createZip ( originPath , originEntries ) ;
205+ await createZip ( nextPath , nextEntries ) ;
206+
207+ await diffCommands . diff (
208+ createContext ( [ originPath , nextPath ] , {
209+ output : outputPath ,
210+ customDiff : ( ) => Buffer . from ( 'patch' ) ,
211+ } ) ,
212+ ) ;
213+
214+ const result = await readZipContent ( outputPath ) ;
215+ expect ( result . compressionMethods [ '__diff.json' ] ) . toBe ( 8 ) ;
216+
217+ const diffMeta = JSON . parse (
218+ result . files [ '__diff.json' ] . toString ( 'utf-8' ) ,
219+ ) as {
220+ copies : Record < string , string > ;
221+ } ;
222+ expect ( diffMeta . copies [ 'assets/new/path/renamed-asset-0.txt' ] ) . toBe (
223+ 'assets/old/path/asset-0.txt' ,
224+ ) ;
225+ } ) ;
226+
187227 test ( 'diff throws when origin bundle file is missing' , async ( ) => {
188228 const originPath = path . join ( tempRoot , 'origin-no-bundle.ppk' ) ;
189229 const nextPath = path . join ( tempRoot , 'next.ppk' ) ;
0 commit comments