@@ -52,7 +52,7 @@ export const ZipConstants = {
5252}
5353
5454type ZipType = 'file' | 'project'
55- type PayloadLimits = Record < ZipType , number >
55+ type PayloadLimits = Record < ZipType , number > & { [ K in ZipType ] : number }
5656
5757export class ZipUtil {
5858 protected _pickedSourceFiles : Set < string > = new Set < string > ( )
@@ -199,7 +199,7 @@ export class ZipUtil {
199199
200200 await this . processSourceFiles ( zip , languageCount , projectPaths , workspaceFolders , excludePatterns )
201201 if ( options ?. metadataDir ) {
202- await this . processMetadataDir ( zip , options ? .metadataDir )
202+ await this . processMetadataDir ( zip , options . metadataDir )
203203 }
204204 if ( options ?. includeNonWorkspaceFiles ) {
205205 this . processOtherFiles ( zip , languageCount )
@@ -274,10 +274,7 @@ export class ZipUtil {
274274 ) {
275275 const fileSize = Buffer . from ( fileContent ) . length
276276
277- if (
278- this . aboveByteLimit ( this . _totalSize , 'project' ) ||
279- this . willReachProjectByteLimit ( this . _totalSize , fileSize )
280- ) {
277+ if ( this . willReachProjectByteLimit ( this . _totalSize , fileSize ) ) {
281278 throw new ProjectSizeExceededError ( )
282279 }
283280 this . _pickedSourceFiles . add ( uri . fsPath )
@@ -291,10 +288,7 @@ export class ZipUtil {
291288 protected async processBinaryFile ( zip : ZipStream , uri : vscode . Uri , zipEntryPath : string ) {
292289 const fileSize = ( await fs . stat ( uri . fsPath ) ) . size
293290
294- if (
295- this . aboveByteLimit ( this . _totalSize , 'project' ) ||
296- this . willReachProjectByteLimit ( this . _totalSize , fileSize )
297- ) {
291+ if ( this . willReachProjectByteLimit ( this . _totalSize , fileSize ) ) {
298292 throw new ProjectSizeExceededError ( )
299293 }
300294 this . _pickedSourceFiles . add ( uri . fsPath )
0 commit comments