diff --git a/src/asar.ts b/src/asar.ts index 6b380d2..e3e5874 100644 --- a/src/asar.ts +++ b/src/asar.ts @@ -10,7 +10,7 @@ import { } from './filesystem'; import * as disk from './disk'; import { crawl as crawlFilesystem, determineFileType } from './crawlfs'; -import { IOptions } from 'glob'; +import { IOptions } from './types/glob'; /** * Whether a directory should be excluded from packing due to the `--unpack-dir" option. diff --git a/src/crawlfs.ts b/src/crawlfs.ts index 6769ef8..c5bc2a9 100644 --- a/src/crawlfs.ts +++ b/src/crawlfs.ts @@ -1,8 +1,9 @@ import { promisify } from 'util'; -import { glob as _glob, IOptions } from 'glob'; +import { glob as _glob } from 'glob'; import fs from './wrapped-fs'; import { Stats } from 'fs'; +import { IOptions } from './types/glob'; const glob = promisify(_glob); diff --git a/src/types/ambient.d.ts b/src/types/ambient.d.ts new file mode 100644 index 0000000..b17748b --- /dev/null +++ b/src/types/ambient.d.ts @@ -0,0 +1,11 @@ +/** + * TODO(erikian): remove this file once we upgrade to the latest `glob` version. + * https://github.com/electron/asar/pull/332#issuecomment-2435407933 + */ +declare module 'glob' { + export function glob( + pattern: string, + options: import('./glob').IOptions, + cb: (err: Error | null, matches: string[]) => void, + ): unknown; +} diff --git a/src/types/glob.d.ts b/src/types/glob.ts similarity index 94% rename from src/types/glob.d.ts rename to src/types/glob.ts index 7ec426b..c325205 100644 --- a/src/types/glob.d.ts +++ b/src/types/glob.ts @@ -2,17 +2,6 @@ * TODO(erikian): remove this file once we upgrade to the latest `glob` version. * https://github.com/electron/asar/pull/332#issuecomment-2435407933 */ - -declare module 'glob' { - export function glob( - pattern: string, - options: IGlobOptions, - cb: (err: Error | null, matches: string[]) => void, - ): unknown; - - export interface IOptions extends IGlobOptions {} -} - interface IMinimatchOptions { /** * Dump a ton of stuff to stderr. @@ -135,7 +124,7 @@ interface IMinimatchOptions { windowsPathsNoEscape?: boolean; } -export interface IGlobOptions extends IMinimatchOptions { +export interface IOptions extends IMinimatchOptions { cwd?: string | undefined; root?: string | undefined; dot?: boolean | undefined;