Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use local glob types #339

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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