@@ -1568,24 +1568,27 @@ export class Project {
1568
1568
const newLockfile = normalizeLineEndings ( initialLockfile , this . generateLockfile ( ) ) ;
1569
1569
1570
1570
if ( newLockfile !== initialLockfile ) {
1571
- const diff = structuredPatch ( lockfilePath , lockfilePath , initialLockfile , newLockfile ) ;
1572
-
1573
- opts . report . reportSeparator ( ) ;
1574
-
1575
- for ( const hunk of diff . hunks ) {
1576
- opts . report . reportInfo ( null , `@@ -${ hunk . oldStart } ,${ hunk . oldLines } +${ hunk . newStart } ,${ hunk . newLines } @@` ) ;
1577
- for ( const line of hunk . lines ) {
1578
- if ( line . startsWith ( `+` ) ) {
1579
- opts . report . reportError ( MessageName . FROZEN_LOCKFILE_EXCEPTION , formatUtils . pretty ( this . configuration , line , formatUtils . Type . ADDED ) ) ;
1580
- } else if ( line . startsWith ( `-` ) ) {
1581
- opts . report . reportError ( MessageName . FROZEN_LOCKFILE_EXCEPTION , formatUtils . pretty ( this . configuration , line , formatUtils . Type . REMOVED ) ) ;
1582
- } else {
1583
- opts . report . reportInfo ( null , formatUtils . pretty ( this . configuration , line , `grey` ) ) ;
1571
+ // @ts -expect-error 2345 need to upgrade to diff 5.0.1 or apply patch in yarn's monorepo
1572
+ const diff = structuredPatch ( lockfilePath , lockfilePath , initialLockfile , newLockfile , undefined , undefined , { maxEditLength : 100 } ) ;
1573
+
1574
+ if ( diff ) {
1575
+ opts . report . reportSeparator ( ) ;
1576
+
1577
+ for ( const hunk of diff . hunks ) {
1578
+ opts . report . reportInfo ( null , `@@ -${ hunk . oldStart } ,${ hunk . oldLines } +${ hunk . newStart } ,${ hunk . newLines } @@` ) ;
1579
+ for ( const line of hunk . lines ) {
1580
+ if ( line . startsWith ( `+` ) ) {
1581
+ opts . report . reportError ( MessageName . FROZEN_LOCKFILE_EXCEPTION , formatUtils . pretty ( this . configuration , line , formatUtils . Type . ADDED ) ) ;
1582
+ } else if ( line . startsWith ( `-` ) ) {
1583
+ opts . report . reportError ( MessageName . FROZEN_LOCKFILE_EXCEPTION , formatUtils . pretty ( this . configuration , line , formatUtils . Type . REMOVED ) ) ;
1584
+ } else {
1585
+ opts . report . reportInfo ( null , formatUtils . pretty ( this . configuration , line , `grey` ) ) ;
1586
+ }
1584
1587
}
1585
1588
}
1586
- }
1587
1589
1588
- opts . report . reportSeparator ( ) ;
1590
+ opts . report . reportSeparator ( ) ;
1591
+ }
1589
1592
1590
1593
throw new ReportError ( MessageName . FROZEN_LOCKFILE_EXCEPTION , `The lockfile would have been modified by this install, which is explicitly forbidden.` ) ;
1591
1594
}
0 commit comments