Skip to content

Commit

Permalink
Update minimatch to avoid type hackery
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Feb 26, 2023
1 parent dbb7676 commit 1d4922c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"dependencies": {
"lunr": "^2.3.9",
"marked": "^4.2.12",
"minimatch": "^6.1.6",
"minimatch": "^7.1.3",
"shiki": "^0.14.1"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/converter/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export class Converter extends ChildableComponent<
/** @internal */
@BindOption("externalPattern")
externalPattern!: string[];
private externalPatternCache?: InstanceType<typeof Minimatch>[];
private excludeCache?: InstanceType<typeof Minimatch>[];
private externalPatternCache?: Minimatch[];
private excludeCache?: Minimatch[];

/** @internal */
@BindOption("excludeExternals")
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/package-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function expandPackages(
logger: Logger,
packageJsonDir: string,
workspaces: string[],
exclude: InstanceType<typeof Minimatch>[]
exclude: Minimatch[]
): string[] {
// Technically npm and Yarn workspaces don't support recursive nesting,
// however we support the passing of paths to either packages or
Expand Down
9 changes: 2 additions & 7 deletions src/lib/utils/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import { normalizePath } from "./fs";
*
* Handle a few Windows-Unix path gotchas.
*/
export function createMinimatch(
patterns: string[]
): InstanceType<typeof Minimatch>[] {
export function createMinimatch(patterns: string[]): Minimatch[] {
return patterns.map(
(pattern) =>
new Minimatch(normalizePath(pattern).replace(/^\w:\//, ""), {
Expand All @@ -18,10 +16,7 @@ export function createMinimatch(
);
}

export function matchesAny(
patterns: readonly InstanceType<typeof Minimatch>[],
path: string
) {
export function matchesAny(patterns: readonly Minimatch[], path: string) {
const normPath = normalizePath(path).replace(/^\w:\//, "");
return patterns.some((pat) => pat.match(normPath));
}
Expand Down

0 comments on commit 1d4922c

Please sign in to comment.