@@ -94,7 +94,10 @@ const constructBerryEntry = entryLines => {
9494 . replaceAll ( ':' , '' )
9595 . split ( ',' ) ;
9696
97- const endFields = entryLines . splice ( - 4 ) ;
97+ const version = entryLines [ 1 ] . split ( 'version: ' ) [ 1 ] ;
98+ const isLocal = version . includes ( 'use.local' ) ;
99+
100+ const endFields = entryLines . splice ( isLocal ? - 3 : - 4 ) ;
98101 const peerBlockStart = entryLines . findIndex ( entry => entry . includes ( 'peerDependencies:' ) ) ;
99102 const peerFields =
100103 peerBlockStart !== - 1 ? entryLines . splice ( - ( entryLines . length - peerBlockStart ) ) : undefined ;
@@ -113,15 +116,15 @@ const constructBerryEntry = entryLines => {
113116 )
114117 : undefined ;
115118
116- const integrity = endFields [ 0 ] . split ( 'checksum: ' ) [ 1 ] ;
119+ const integrity = ! isLocal && endFields [ 0 ] . split ( 'checksum: ' ) [ 1 ] ;
117120 const resolution = entryLines [ 2 ] . split ( 'resolution: ' ) [ 1 ] ;
118121
119122 const entryObject = {
120- version : entryLines [ 1 ] . split ( 'version: ' ) [ 1 ] ,
123+ version,
121124 resolved : resolution . includes ( '@workspace:' ) ? 'workspace' : resolution ,
122125 integrity,
123- language : endFields [ 1 ] . split ( 'languageName: ' ) [ 1 ] ,
124- link : endFields [ 2 ] . split ( 'linkType: ' ) [ 1 ] ,
126+ language : endFields [ isLocal ? 0 : 1 ] . split ( 'languageName: ' ) [ 1 ] ,
127+ link : endFields [ isLocal ? 1 : 2 ] . split ( 'linkType: ' ) [ 1 ] ,
125128 dependencies,
126129 peerDependencies
127130 } ;
@@ -167,6 +170,7 @@ export const parseLock = content => {
167170 } , [ ] ) ;
168171
169172 const result = entryChunks
173+ . filter ( entryLines => entryLines . length >= 4 )
170174 . map ( entryLines =>
171175 metadata . version === 1 ? constructClassicEntry ( entryLines ) : constructBerryEntry ( entryLines )
172176 )
0 commit comments