minimatch-fast 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +950 -0
- package/dist/cjs/brace-expand.d.ts +42 -0
- package/dist/cjs/brace-expand.d.ts.map +1 -0
- package/dist/cjs/brace-expand.js +172 -0
- package/dist/cjs/brace-expand.js.map +1 -0
- package/dist/cjs/cache.d.ts +36 -0
- package/dist/cjs/cache.d.ts.map +1 -0
- package/dist/cjs/cache.js +91 -0
- package/dist/cjs/cache.js.map +1 -0
- package/dist/cjs/escape.d.ts +40 -0
- package/dist/cjs/escape.d.ts.map +1 -0
- package/dist/cjs/escape.js +52 -0
- package/dist/cjs/escape.js.map +1 -0
- package/dist/cjs/fast-paths.d.ts +54 -0
- package/dist/cjs/fast-paths.d.ts.map +1 -0
- package/dist/cjs/fast-paths.js +213 -0
- package/dist/cjs/fast-paths.js.map +1 -0
- package/dist/cjs/index.d.ts +150 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +250 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/minimatch-class.d.ts +153 -0
- package/dist/cjs/minimatch-class.d.ts.map +1 -0
- package/dist/cjs/minimatch-class.js +618 -0
- package/dist/cjs/minimatch-class.js.map +1 -0
- package/dist/cjs/options.d.ts +31 -0
- package/dist/cjs/options.d.ts.map +1 -0
- package/dist/cjs/options.js +67 -0
- package/dist/cjs/options.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/types.d.ts +194 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +19 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/unescape.d.ts +36 -0
- package/dist/cjs/unescape.d.ts.map +1 -0
- package/dist/cjs/unescape.js +49 -0
- package/dist/cjs/unescape.js.map +1 -0
- package/dist/cjs/utils.d.ts +62 -0
- package/dist/cjs/utils.d.ts.map +1 -0
- package/dist/cjs/utils.js +126 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/brace-expand.d.ts +42 -0
- package/dist/esm/brace-expand.d.ts.map +1 -0
- package/dist/esm/brace-expand.js +165 -0
- package/dist/esm/brace-expand.js.map +1 -0
- package/dist/esm/cache.d.ts +36 -0
- package/dist/esm/cache.d.ts.map +1 -0
- package/dist/esm/cache.js +86 -0
- package/dist/esm/cache.js.map +1 -0
- package/dist/esm/escape.d.ts +40 -0
- package/dist/esm/escape.d.ts.map +1 -0
- package/dist/esm/escape.js +49 -0
- package/dist/esm/escape.js.map +1 -0
- package/dist/esm/fast-paths.d.ts +54 -0
- package/dist/esm/fast-paths.d.ts.map +1 -0
- package/dist/esm/fast-paths.js +209 -0
- package/dist/esm/fast-paths.js.map +1 -0
- package/dist/esm/index.d.ts +150 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +240 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/minimatch-class.d.ts +153 -0
- package/dist/esm/minimatch-class.d.ts.map +1 -0
- package/dist/esm/minimatch-class.js +611 -0
- package/dist/esm/minimatch-class.js.map +1 -0
- package/dist/esm/options.d.ts +31 -0
- package/dist/esm/options.d.ts.map +1 -0
- package/dist/esm/options.js +63 -0
- package/dist/esm/options.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/types.d.ts +194 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +16 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/unescape.d.ts +36 -0
- package/dist/esm/unescape.d.ts.map +1 -0
- package/dist/esm/unescape.js +46 -0
- package/dist/esm/unescape.js.map +1 -0
- package/dist/esm/utils.d.ts +62 -0
- package/dist/esm/utils.d.ts.map +1 -0
- package/dist/esm/utils.js +116 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fast-paths.js","sourceRoot":"","sources":["../../src/fast-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This is the main entry point for the minimatch-fast package. It provides
|
|
5
|
+
* a 100% API-compatible replacement for minimatch while using picomatch
|
|
6
|
+
* internally for better performance and security.
|
|
7
|
+
*
|
|
8
|
+
* The package exports:
|
|
9
|
+
* - minimatch(): Main function for testing if a path matches a pattern
|
|
10
|
+
* - minimatch.match(): Filter an array of paths
|
|
11
|
+
* - minimatch.filter(): Create a filter function for Array.filter()
|
|
12
|
+
* - minimatch.makeRe(): Convert a pattern to a RegExp
|
|
13
|
+
* - minimatch.braceExpand(): Expand brace patterns
|
|
14
|
+
* - minimatch.escape(): Escape glob special characters
|
|
15
|
+
* - minimatch.unescape(): Unescape glob special characters
|
|
16
|
+
* - minimatch.defaults(): Create a new minimatch with default options
|
|
17
|
+
* - Minimatch: Class for repeated matching against the same pattern
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import minimatch from 'minimatch-fast';
|
|
22
|
+
*
|
|
23
|
+
* // Basic matching
|
|
24
|
+
* minimatch('bar.js', '*.js'); // true
|
|
25
|
+
* minimatch('src/deep/file.ts', '**\/*.ts'); // true
|
|
26
|
+
*
|
|
27
|
+
* // Filter an array
|
|
28
|
+
* minimatch.match(['a.js', 'b.txt'], '*.js'); // ['a.js']
|
|
29
|
+
*
|
|
30
|
+
* // Create filter function
|
|
31
|
+
* const jsFiles = files.filter(minimatch.filter('*.js'));
|
|
32
|
+
*
|
|
33
|
+
* // Use Minimatch class for repeated matching (more efficient)
|
|
34
|
+
* const mm = new minimatch.Minimatch('**\/*.js');
|
|
35
|
+
* mm.match('src/index.js'); // true
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @author 686f6c61
|
|
39
|
+
* @see https://github.com/686f6c61/minimatch-fast
|
|
40
|
+
* @license MIT
|
|
41
|
+
*/
|
|
42
|
+
import type { MinimatchOptions, MMRegExp, Platform, Sep, ParseReturn, ParseReturnFiltered, GlobstarSymbol } from './types.js';
|
|
43
|
+
import { GLOBSTAR } from './types.js';
|
|
44
|
+
import { Minimatch } from './minimatch-class.js';
|
|
45
|
+
export type { MinimatchOptions, MMRegExp, Platform, Sep, ParseReturn, ParseReturnFiltered, GlobstarSymbol, };
|
|
46
|
+
export { Minimatch, GLOBSTAR };
|
|
47
|
+
export { escape } from './escape.js';
|
|
48
|
+
export { unescape } from './unescape.js';
|
|
49
|
+
/**
|
|
50
|
+
* Path separator for the current platform
|
|
51
|
+
*/
|
|
52
|
+
export declare const sep: Sep;
|
|
53
|
+
/**
|
|
54
|
+
* Test if a path matches a glob pattern
|
|
55
|
+
*
|
|
56
|
+
* This function is optimized with:
|
|
57
|
+
* 1. Fast paths for common simple patterns (*.js, *, ???)
|
|
58
|
+
* 2. LRU cache for compiled Minimatch instances
|
|
59
|
+
*
|
|
60
|
+
* @param path - The path to test
|
|
61
|
+
* @param pattern - The glob pattern
|
|
62
|
+
* @param options - Matching options
|
|
63
|
+
* @returns true if the path matches the pattern
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* minimatch('foo.js', '*.js'); // true
|
|
68
|
+
* minimatch('src/foo.js', '**\/*.js'); // true
|
|
69
|
+
* minimatch('.hidden', '*'); // false
|
|
70
|
+
* minimatch('.hidden', '*', { dot: true }); // true
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function minimatch(path: string, pattern: string, options?: MinimatchOptions): boolean;
|
|
74
|
+
export declare namespace minimatch {
|
|
75
|
+
var sep: Sep;
|
|
76
|
+
var GLOBSTAR: typeof import("./types.js").GLOBSTAR;
|
|
77
|
+
var Minimatch: typeof import("./minimatch-class.js").Minimatch;
|
|
78
|
+
var filter: typeof import("./index.js").filter;
|
|
79
|
+
var defaults: typeof import("./index.js").defaults;
|
|
80
|
+
var braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
|
|
81
|
+
var makeRe: typeof import("./index.js").makeRe;
|
|
82
|
+
var match: typeof import("./index.js").match;
|
|
83
|
+
var escape: typeof import("./escape.js").escape;
|
|
84
|
+
var unescape: typeof import("./unescape.js").unescape;
|
|
85
|
+
var clearCache: typeof import("./cache.js").clearCache;
|
|
86
|
+
var getCacheSize: typeof import("./cache.js").getCacheSize;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Create a filter function for use with Array.filter()
|
|
90
|
+
*
|
|
91
|
+
* Uses cached Minimatch instance for better performance.
|
|
92
|
+
*
|
|
93
|
+
* @param pattern - The glob pattern
|
|
94
|
+
* @param options - Matching options
|
|
95
|
+
* @returns A function that tests paths against the pattern
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const jsFilter = minimatch.filter('*.js');
|
|
100
|
+
* ['a.js', 'b.txt', 'c.js'].filter(jsFilter); // ['a.js', 'c.js']
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function filter(pattern: string, options?: MinimatchOptions): (path: string) => boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Create a minimatch function with default options
|
|
106
|
+
*
|
|
107
|
+
* @param def - Default options to apply to all calls
|
|
108
|
+
* @returns A new minimatch function with defaults applied
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const mm = minimatch.defaults({ dot: true });
|
|
113
|
+
* mm('.hidden', '*'); // true (dot files included)
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function defaults(def: MinimatchOptions): typeof minimatch;
|
|
117
|
+
/**
|
|
118
|
+
* Convert a glob pattern to a regular expression
|
|
119
|
+
*
|
|
120
|
+
* Uses cached Minimatch instance for better performance.
|
|
121
|
+
*
|
|
122
|
+
* @param pattern - The glob pattern
|
|
123
|
+
* @param options - Matching options
|
|
124
|
+
* @returns RegExp or false if pattern is invalid
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const re = minimatch.makeRe('*.js');
|
|
129
|
+
* re.test('foo.js'); // true
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare function makeRe(pattern: string, options?: MinimatchOptions): false | MMRegExp;
|
|
133
|
+
/**
|
|
134
|
+
* Match a list of paths against a glob pattern
|
|
135
|
+
*
|
|
136
|
+
* Uses cached Minimatch instance for better performance.
|
|
137
|
+
*
|
|
138
|
+
* @param list - Array of paths to filter
|
|
139
|
+
* @param pattern - The glob pattern
|
|
140
|
+
* @param options - Matching options
|
|
141
|
+
* @returns Array of matching paths
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* minimatch.match(['a.js', 'b.txt', 'c.js'], '*.js'); // ['a.js', 'c.js']
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export declare function match(list: string[], pattern: string, options?: MinimatchOptions): string[];
|
|
149
|
+
export default minimatch;
|
|
150
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,WAAW,EACX,mBAAmB,EACnB,cAAc,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AASjD,YAAY,EACV,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,WAAW,EACX,mBAAmB,EACnB,cAAc,GACf,CAAC;AAGF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,GAAG,EAAE,GAAa,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CA2BT;yBA/Be,SAAS;;;;;;+BA6Hd,MAAM,YACN,gBAAgB,KACxB,MAAM,EAAE;;;;;;;;AAzFX;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CACpB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gBAAqB,GAC7B,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAI3B;AAGD;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,SAAS,CAgChE;AAwBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CACpB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gBAAqB,GAC7B,KAAK,GAAG,QAAQ,CAElB;AAGD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gBAAqB,GAC7B,MAAM,EAAE,CAUV;AA0BD,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview minimatch-fast - Drop-in replacement for minimatch
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point for the minimatch-fast package. It provides
|
|
5
|
+
* a 100% API-compatible replacement for minimatch while using picomatch
|
|
6
|
+
* internally for better performance and security.
|
|
7
|
+
*
|
|
8
|
+
* The package exports:
|
|
9
|
+
* - minimatch(): Main function for testing if a path matches a pattern
|
|
10
|
+
* - minimatch.match(): Filter an array of paths
|
|
11
|
+
* - minimatch.filter(): Create a filter function for Array.filter()
|
|
12
|
+
* - minimatch.makeRe(): Convert a pattern to a RegExp
|
|
13
|
+
* - minimatch.braceExpand(): Expand brace patterns
|
|
14
|
+
* - minimatch.escape(): Escape glob special characters
|
|
15
|
+
* - minimatch.unescape(): Unescape glob special characters
|
|
16
|
+
* - minimatch.defaults(): Create a new minimatch with default options
|
|
17
|
+
* - Minimatch: Class for repeated matching against the same pattern
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import minimatch from 'minimatch-fast';
|
|
22
|
+
*
|
|
23
|
+
* // Basic matching
|
|
24
|
+
* minimatch('bar.js', '*.js'); // true
|
|
25
|
+
* minimatch('src/deep/file.ts', '**\/*.ts'); // true
|
|
26
|
+
*
|
|
27
|
+
* // Filter an array
|
|
28
|
+
* minimatch.match(['a.js', 'b.txt'], '*.js'); // ['a.js']
|
|
29
|
+
*
|
|
30
|
+
* // Create filter function
|
|
31
|
+
* const jsFiles = files.filter(minimatch.filter('*.js'));
|
|
32
|
+
*
|
|
33
|
+
* // Use Minimatch class for repeated matching (more efficient)
|
|
34
|
+
* const mm = new minimatch.Minimatch('**\/*.js');
|
|
35
|
+
* mm.match('src/index.js'); // true
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @author 686f6c61
|
|
39
|
+
* @see https://github.com/686f6c61/minimatch-fast
|
|
40
|
+
* @license MIT
|
|
41
|
+
*/
|
|
42
|
+
import { GLOBSTAR } from './types.js';
|
|
43
|
+
import { Minimatch } from './minimatch-class.js';
|
|
44
|
+
import { braceExpand } from './brace-expand.js';
|
|
45
|
+
import { escape } from './escape.js';
|
|
46
|
+
import { unescape } from './unescape.js';
|
|
47
|
+
import { sep as pathSep } from './utils.js';
|
|
48
|
+
import { getOrCreateMatcher, clearCache, getCacheSize } from './cache.js';
|
|
49
|
+
import { tryFastPath, mightUseFastPath } from './fast-paths.js';
|
|
50
|
+
// Re-export class and symbols
|
|
51
|
+
export { Minimatch, GLOBSTAR };
|
|
52
|
+
export { escape } from './escape.js';
|
|
53
|
+
export { unescape } from './unescape.js';
|
|
54
|
+
/**
|
|
55
|
+
* Path separator for the current platform
|
|
56
|
+
*/
|
|
57
|
+
export const sep = pathSep;
|
|
58
|
+
/**
|
|
59
|
+
* Test if a path matches a glob pattern
|
|
60
|
+
*
|
|
61
|
+
* This function is optimized with:
|
|
62
|
+
* 1. Fast paths for common simple patterns (*.js, *, ???)
|
|
63
|
+
* 2. LRU cache for compiled Minimatch instances
|
|
64
|
+
*
|
|
65
|
+
* @param path - The path to test
|
|
66
|
+
* @param pattern - The glob pattern
|
|
67
|
+
* @param options - Matching options
|
|
68
|
+
* @returns true if the path matches the pattern
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* minimatch('foo.js', '*.js'); // true
|
|
73
|
+
* minimatch('src/foo.js', '**\/*.js'); // true
|
|
74
|
+
* minimatch('.hidden', '*'); // false
|
|
75
|
+
* minimatch('.hidden', '*', { dot: true }); // true
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export function minimatch(path, pattern, options = {}) {
|
|
79
|
+
// Validate pattern type
|
|
80
|
+
if (typeof pattern !== 'string') {
|
|
81
|
+
throw new TypeError('glob pattern must be a string');
|
|
82
|
+
}
|
|
83
|
+
// Handle empty pattern
|
|
84
|
+
if (pattern === '') {
|
|
85
|
+
return path === '';
|
|
86
|
+
}
|
|
87
|
+
// Handle comments
|
|
88
|
+
if (!options.nocomment && pattern.charAt(0) === '#') {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
// Try fast path for simple patterns (no path separators, no complex features)
|
|
92
|
+
// Fast paths avoid creating Minimatch instance entirely
|
|
93
|
+
if (!options.matchBase && mightUseFastPath(pattern)) {
|
|
94
|
+
const fastResult = tryFastPath(path, pattern, options);
|
|
95
|
+
if (fastResult !== null) {
|
|
96
|
+
return fastResult;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Use cached Minimatch instance for full matching
|
|
100
|
+
return getOrCreateMatcher(pattern, options).match(path);
|
|
101
|
+
}
|
|
102
|
+
// Attach static properties to minimatch function
|
|
103
|
+
minimatch.sep = sep;
|
|
104
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
105
|
+
minimatch.Minimatch = Minimatch;
|
|
106
|
+
/**
|
|
107
|
+
* Create a filter function for use with Array.filter()
|
|
108
|
+
*
|
|
109
|
+
* Uses cached Minimatch instance for better performance.
|
|
110
|
+
*
|
|
111
|
+
* @param pattern - The glob pattern
|
|
112
|
+
* @param options - Matching options
|
|
113
|
+
* @returns A function that tests paths against the pattern
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* const jsFilter = minimatch.filter('*.js');
|
|
118
|
+
* ['a.js', 'b.txt', 'c.js'].filter(jsFilter); // ['a.js', 'c.js']
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export function filter(pattern, options = {}) {
|
|
122
|
+
// Use cached matcher for repeated matching
|
|
123
|
+
const mm = getOrCreateMatcher(pattern, options);
|
|
124
|
+
return (path) => mm.match(path);
|
|
125
|
+
}
|
|
126
|
+
minimatch.filter = filter;
|
|
127
|
+
/**
|
|
128
|
+
* Create a minimatch function with default options
|
|
129
|
+
*
|
|
130
|
+
* @param def - Default options to apply to all calls
|
|
131
|
+
* @returns A new minimatch function with defaults applied
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const mm = minimatch.defaults({ dot: true });
|
|
136
|
+
* mm('.hidden', '*'); // true (dot files included)
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export function defaults(def) {
|
|
140
|
+
if (!def || typeof def !== 'object' || !Object.keys(def).length) {
|
|
141
|
+
return minimatch;
|
|
142
|
+
}
|
|
143
|
+
const orig = minimatch;
|
|
144
|
+
const m = (path, pattern, options = {}) => orig(path, pattern, { ...def, ...options });
|
|
145
|
+
return Object.assign(m, {
|
|
146
|
+
Minimatch: Minimatch.defaults(def),
|
|
147
|
+
filter: (pattern, options = {}) => orig.filter(pattern, { ...def, ...options }),
|
|
148
|
+
defaults: (options) => orig.defaults({ ...def, ...options }),
|
|
149
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, { ...def, ...options }),
|
|
150
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, { ...def, ...options }),
|
|
151
|
+
match: (list, pattern, options = {}) => orig.match(list, pattern, { ...def, ...options }),
|
|
152
|
+
escape: (s, options = {}) => escape(s, { ...def, ...options }),
|
|
153
|
+
unescape: (s, options = {}) => unescape(s, { ...def, ...options }),
|
|
154
|
+
sep: orig.sep,
|
|
155
|
+
GLOBSTAR,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
minimatch.defaults = defaults;
|
|
159
|
+
/**
|
|
160
|
+
* Expand brace patterns like {a,b,c} and {1..3}
|
|
161
|
+
*
|
|
162
|
+
* @param pattern - The pattern to expand
|
|
163
|
+
* @param options - Expansion options
|
|
164
|
+
* @returns Array of expanded patterns
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* minimatch.braceExpand('{a,b,c}'); // ['a', 'b', 'c']
|
|
169
|
+
* minimatch.braceExpand('{1..3}'); // ['1', '2', '3']
|
|
170
|
+
* minimatch.braceExpand('file.{js,ts}'); // ['file.js', 'file.ts']
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
minimatch.braceExpand = function (pattern, options = {}) {
|
|
174
|
+
return braceExpand(pattern, options);
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Convert a glob pattern to a regular expression
|
|
178
|
+
*
|
|
179
|
+
* Uses cached Minimatch instance for better performance.
|
|
180
|
+
*
|
|
181
|
+
* @param pattern - The glob pattern
|
|
182
|
+
* @param options - Matching options
|
|
183
|
+
* @returns RegExp or false if pattern is invalid
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* const re = minimatch.makeRe('*.js');
|
|
188
|
+
* re.test('foo.js'); // true
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
export function makeRe(pattern, options = {}) {
|
|
192
|
+
return getOrCreateMatcher(pattern, options).makeRe();
|
|
193
|
+
}
|
|
194
|
+
minimatch.makeRe = makeRe;
|
|
195
|
+
/**
|
|
196
|
+
* Match a list of paths against a glob pattern
|
|
197
|
+
*
|
|
198
|
+
* Uses cached Minimatch instance for better performance.
|
|
199
|
+
*
|
|
200
|
+
* @param list - Array of paths to filter
|
|
201
|
+
* @param pattern - The glob pattern
|
|
202
|
+
* @param options - Matching options
|
|
203
|
+
* @returns Array of matching paths
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* minimatch.match(['a.js', 'b.txt', 'c.js'], '*.js'); // ['a.js', 'c.js']
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
export function match(list, pattern, options = {}) {
|
|
211
|
+
const mm = getOrCreateMatcher(pattern, options);
|
|
212
|
+
const result = list.filter((f) => mm.match(f));
|
|
213
|
+
// If nonull option is set and no matches, return the pattern
|
|
214
|
+
if (mm.options.nonull && result.length === 0) {
|
|
215
|
+
return [pattern];
|
|
216
|
+
}
|
|
217
|
+
return result;
|
|
218
|
+
}
|
|
219
|
+
minimatch.match = match;
|
|
220
|
+
/**
|
|
221
|
+
* Escape special glob characters in a string
|
|
222
|
+
*/
|
|
223
|
+
minimatch.escape = escape;
|
|
224
|
+
/**
|
|
225
|
+
* Unescape special glob characters in a string
|
|
226
|
+
*/
|
|
227
|
+
minimatch.unescape = unescape;
|
|
228
|
+
/**
|
|
229
|
+
* Clear the pattern cache.
|
|
230
|
+
* Useful for testing or when memory pressure is high.
|
|
231
|
+
*/
|
|
232
|
+
minimatch.clearCache = clearCache;
|
|
233
|
+
/**
|
|
234
|
+
* Get the current cache size.
|
|
235
|
+
* Useful for monitoring and testing.
|
|
236
|
+
*/
|
|
237
|
+
minimatch.getCacheSize = getCacheSize;
|
|
238
|
+
// Default export
|
|
239
|
+
export default minimatch;
|
|
240
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAWH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAahE,8BAA8B;AAC9B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,GAAG,GAAQ,OAAO,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,SAAS,CACvB,IAAY,EACZ,OAAe,EACf,UAA4B,EAAE;IAE9B,wBAAwB;IACxB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAAC,+BAA+B,CAAC,CAAC;IACvD,CAAC;IAED,uBAAuB;IACvB,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,IAAI,KAAK,EAAE,CAAC;I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Q,CAAC;AAE9B;;;GAGG;AACH,SAAS,CAAC,UAAU,GAAG,UAAU,CAAC;AAElC;;;GAGG;AACH,SAAS,CAAC,YAAY,GAAG,YAAY,CAAC;AAEtC,iBAAiB;AACjB,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Minimatch class - core pattern matching implementation
|
|
3
|
+
*
|
|
4
|
+
* This is the heart of minimatch-fast. The Minimatch class provides 100% API
|
|
5
|
+
* compatibility with minimatch's Minimatch class while using picomatch
|
|
6
|
+
* internally for faster and more secure pattern matching.
|
|
7
|
+
*
|
|
8
|
+
* Key features:
|
|
9
|
+
* - Pattern compilation and caching for efficient repeated matching
|
|
10
|
+
* - Full support for glob patterns: *, **, ?, [], {}, extglob
|
|
11
|
+
* - Brace expansion using the 'braces' package
|
|
12
|
+
* - Negation patterns with !
|
|
13
|
+
* - Comment patterns with #
|
|
14
|
+
* - Cross-platform path handling (Windows and POSIX)
|
|
15
|
+
*
|
|
16
|
+
* Architecture:
|
|
17
|
+
* 1. Constructor receives pattern and options
|
|
18
|
+
* 2. Pattern is parsed and expanded (braces)
|
|
19
|
+
* 3. Picomatch matchers are created for each expanded pattern
|
|
20
|
+
* 4. match() method tests paths against all matchers
|
|
21
|
+
*
|
|
22
|
+
* Compatibility layer:
|
|
23
|
+
* Some edge cases require special handling to match minimatch's exact behavior:
|
|
24
|
+
* - Dotfiles (. and ..) are never matched by wildcards
|
|
25
|
+
* - Negated character classes [^...] don't match dotfiles
|
|
26
|
+
* - Backslash escapes in character classes ([\b] = literal 'b')
|
|
27
|
+
*
|
|
28
|
+
* @author 686f6c61
|
|
29
|
+
* @see https://github.com/686f6c61/minimatch-fast
|
|
30
|
+
* @license MIT
|
|
31
|
+
*/
|
|
32
|
+
import type { MinimatchOptions, MMRegExp, ParseReturn, ParseReturnFiltered, Platform } from './types.js';
|
|
33
|
+
/**
|
|
34
|
+
* Minimatch class for glob pattern matching
|
|
35
|
+
*/
|
|
36
|
+
export declare class Minimatch {
|
|
37
|
+
/** Original pattern passed to constructor */
|
|
38
|
+
pattern: string;
|
|
39
|
+
/** Options used for matching */
|
|
40
|
+
options: MinimatchOptions;
|
|
41
|
+
/** 2D array of parsed pattern parts after brace expansion */
|
|
42
|
+
set: ParseReturnFiltered[][];
|
|
43
|
+
/** Whether the pattern is negated (starts with !) */
|
|
44
|
+
negate: boolean;
|
|
45
|
+
/** Whether the pattern is a comment (starts with #) */
|
|
46
|
+
comment: boolean;
|
|
47
|
+
/** Whether the pattern is empty */
|
|
48
|
+
empty: boolean;
|
|
49
|
+
/** Whether to preserve multiple consecutive slashes */
|
|
50
|
+
preserveMultipleSlashes: boolean;
|
|
51
|
+
/** Whether to do partial matching */
|
|
52
|
+
partial: boolean;
|
|
53
|
+
/** Result of brace expansion on the pattern */
|
|
54
|
+
globSet: string[];
|
|
55
|
+
/** Brace-expanded patterns split into path portions */
|
|
56
|
+
globParts: string[][];
|
|
57
|
+
/** Whether to perform case-insensitive matching */
|
|
58
|
+
nocase: boolean;
|
|
59
|
+
/** Whether running on Windows */
|
|
60
|
+
isWindows: boolean;
|
|
61
|
+
/** Target platform */
|
|
62
|
+
platform: Platform;
|
|
63
|
+
/** Windows-specific magic root handling */
|
|
64
|
+
windowsNoMagicRoot: boolean;
|
|
65
|
+
/** Compiled regular expression (lazily computed) */
|
|
66
|
+
regexp: false | null | MMRegExp;
|
|
67
|
+
/** Whether backslash is treated as path separator */
|
|
68
|
+
windowsPathsNoEscape: boolean;
|
|
69
|
+
/** Whether negation is disabled */
|
|
70
|
+
nonegate: boolean;
|
|
71
|
+
private _picoOpts;
|
|
72
|
+
private _matchers;
|
|
73
|
+
private _debugFn;
|
|
74
|
+
private _hasNegatedCharClassCached;
|
|
75
|
+
private _requiresTrailingSlashCached;
|
|
76
|
+
private _patternBasename;
|
|
77
|
+
/**
|
|
78
|
+
* Create a new Minimatch instance
|
|
79
|
+
*
|
|
80
|
+
* @param pattern - The glob pattern to match against
|
|
81
|
+
* @param options - Matching options
|
|
82
|
+
*/
|
|
83
|
+
constructor(pattern: string, options?: MinimatchOptions);
|
|
84
|
+
/**
|
|
85
|
+
* Enable debug output
|
|
86
|
+
*/
|
|
87
|
+
private debug;
|
|
88
|
+
/**
|
|
89
|
+
* Check if the pattern contains glob magic characters
|
|
90
|
+
*/
|
|
91
|
+
hasMagic(): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Build the pattern matching set
|
|
94
|
+
*/
|
|
95
|
+
private make;
|
|
96
|
+
/**
|
|
97
|
+
* Parse negation from the pattern
|
|
98
|
+
*/
|
|
99
|
+
private parseNegate;
|
|
100
|
+
/**
|
|
101
|
+
* Perform brace expansion on the pattern
|
|
102
|
+
*/
|
|
103
|
+
braceExpand(): string[];
|
|
104
|
+
/**
|
|
105
|
+
* Split a path by slashes
|
|
106
|
+
*/
|
|
107
|
+
slashSplit(p: string): string[];
|
|
108
|
+
/**
|
|
109
|
+
* Preprocess glob parts (optimization, normalization)
|
|
110
|
+
*/
|
|
111
|
+
private preprocess;
|
|
112
|
+
/**
|
|
113
|
+
* Parse a single pattern part into a regex or string
|
|
114
|
+
*/
|
|
115
|
+
private parse;
|
|
116
|
+
/**
|
|
117
|
+
* Test if a path matches the pattern
|
|
118
|
+
*
|
|
119
|
+
* @param path - The path to test
|
|
120
|
+
* @param partial - Whether to do partial matching
|
|
121
|
+
* @returns true if the path matches
|
|
122
|
+
*/
|
|
123
|
+
match(path: string, partial?: boolean): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Pre-process pattern for minimatch compatibility
|
|
126
|
+
* Handles edge cases where picomatch behaves differently
|
|
127
|
+
*/
|
|
128
|
+
private preprocessPattern;
|
|
129
|
+
/**
|
|
130
|
+
* Create a regular expression from the pattern
|
|
131
|
+
*
|
|
132
|
+
* @returns RegExp or false if pattern is invalid
|
|
133
|
+
*/
|
|
134
|
+
makeRe(): false | MMRegExp;
|
|
135
|
+
/**
|
|
136
|
+
* Match a file array against a pattern array
|
|
137
|
+
* This is for internal use and advanced matching scenarios
|
|
138
|
+
*
|
|
139
|
+
* @param file - Array of path segments
|
|
140
|
+
* @param pattern - Array of pattern parts
|
|
141
|
+
* @param partial - Whether to do partial matching
|
|
142
|
+
* @returns true if file matches pattern
|
|
143
|
+
*/
|
|
144
|
+
matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Create a new Minimatch class with default options
|
|
147
|
+
*
|
|
148
|
+
* @param def - Default options to apply
|
|
149
|
+
* @returns New Minimatch class with defaults
|
|
150
|
+
*/
|
|
151
|
+
static defaults(def: MinimatchOptions): typeof Minimatch;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=minimatch-class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimatch-class.d.ts","sourceRoot":"","sources":["../../src/minimatch-class.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,KAAK,EACV,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,QAAQ,EAET,MAAM,YAAY,CAAC;AAiBpB;;GAEG;AACH,qBAAa,SAAS;IACpB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAEhB,gCAAgC;IAChC,OAAO,EAAE,gBAAgB,CAAC;IAE1B,6DAA6D;IAC7D,GAAG,EAAE,mBAAmB,EAAE,EAAE,CAAC;IAE7B,qDAAqD;IACrD,MAAM,EAAE,OAAO,CAAC;IAEhB,uDAAuD;IACvD,OAAO,EAAE,OAAO,CAAC;IAEjB,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAC;IAEf,uDAAuD;IACvD,uBAAuB,EAAE,OAAO,CAAC;IAEjC,qCAAqC;IACrC,OAAO,EAAE,OAAO,CAAC;IAEjB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,uDAAuD;IAC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