@@ -2,7 +2,12 @@ import * as path from 'path';
22import minimatch from 'minimatch' ;
33
44import fs from './wrapped-fs' ;
5- import { Filesystem , FilesystemEntry } from './filesystem' ;
5+ import {
6+ Filesystem ,
7+ FilesystemDirectoryEntry ,
8+ FilesystemEntry ,
9+ FilesystemLinkEntry ,
10+ } from './filesystem' ;
611import * as disk from './disk' ;
712import { crawl as crawlFilesystem , determineFileType } from './crawlfs' ;
813import { IOptions } from 'glob' ;
@@ -192,7 +197,11 @@ export function getRawHeader(archivePath: string) {
192197 return disk . readArchiveHeaderSync ( archivePath ) ;
193198}
194199
195- export function listPackage ( archivePath : string , options : { isPack : boolean } ) {
200+ export interface ListOptions {
201+ isPack : boolean ;
202+ }
203+
204+ export function listPackage ( archivePath : string , options : ListOptions ) {
196205 return disk . readFilesystemSync ( archivePath ) . listFiles ( options ) ;
197206}
198207
@@ -272,6 +281,18 @@ export function uncacheAll() {
272281 disk . uncacheAll ( ) ;
273282}
274283
284+ // Legacy type exports to maintain compatibility with pre-TypeScript rewrite
285+ // (https://github.com/electron/asar/blob/50b0c62e5b24c3d164687e6470b8658e09b09eea/lib/index.d.ts)
286+ // These don't match perfectly and are technically still a breaking change but they're close enough
287+ // to keep _most_ build pipelines out there from breaking.
288+ export { EntryMetadata } from './filesystem' ;
289+ export { InputMetadata , DirectoryRecord , FileRecord , ArchiveHeader } from './disk' ;
290+ export type InputMetadataType = 'directory' | 'file' | 'link' ;
291+ export type DirectoryMetadata = FilesystemDirectoryEntry ;
292+ export type FileMetadata = FilesystemEntry ;
293+ export type LinkMetadata = FilesystemLinkEntry ;
294+
295+ // Export everything in default, too
275296export default {
276297 createPackage,
277298 createPackageWithOptions,
0 commit comments