Skip to content

Commit

Permalink
fix: use local glob types (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikian authored Oct 30, 2024
1 parent 7c10c67 commit e313c0a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/asar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/crawlfs.ts
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
11 changes: 11 additions & 0 deletions src/types/ambient.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}
13 changes: 1 addition & 12 deletions src/types/glob.d.ts → src/types/glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e313c0a

Please sign in to comment.