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.
Files changed (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +950 -0
  3. package/dist/cjs/brace-expand.d.ts +42 -0
  4. package/dist/cjs/brace-expand.d.ts.map +1 -0
  5. package/dist/cjs/brace-expand.js +172 -0
  6. package/dist/cjs/brace-expand.js.map +1 -0
  7. package/dist/cjs/cache.d.ts +36 -0
  8. package/dist/cjs/cache.d.ts.map +1 -0
  9. package/dist/cjs/cache.js +91 -0
  10. package/dist/cjs/cache.js.map +1 -0
  11. package/dist/cjs/escape.d.ts +40 -0
  12. package/dist/cjs/escape.d.ts.map +1 -0
  13. package/dist/cjs/escape.js +52 -0
  14. package/dist/cjs/escape.js.map +1 -0
  15. package/dist/cjs/fast-paths.d.ts +54 -0
  16. package/dist/cjs/fast-paths.d.ts.map +1 -0
  17. package/dist/cjs/fast-paths.js +213 -0
  18. package/dist/cjs/fast-paths.js.map +1 -0
  19. package/dist/cjs/index.d.ts +150 -0
  20. package/dist/cjs/index.d.ts.map +1 -0
  21. package/dist/cjs/index.js +250 -0
  22. package/dist/cjs/index.js.map +1 -0
  23. package/dist/cjs/minimatch-class.d.ts +153 -0
  24. package/dist/cjs/minimatch-class.d.ts.map +1 -0
  25. package/dist/cjs/minimatch-class.js +618 -0
  26. package/dist/cjs/minimatch-class.js.map +1 -0
  27. package/dist/cjs/options.d.ts +31 -0
  28. package/dist/cjs/options.d.ts.map +1 -0
  29. package/dist/cjs/options.js +67 -0
  30. package/dist/cjs/options.js.map +1 -0
  31. package/dist/cjs/package.json +3 -0
  32. package/dist/cjs/types.d.ts +194 -0
  33. package/dist/cjs/types.d.ts.map +1 -0
  34. package/dist/cjs/types.js +19 -0
  35. package/dist/cjs/types.js.map +1 -0
  36. package/dist/cjs/unescape.d.ts +36 -0
  37. package/dist/cjs/unescape.d.ts.map +1 -0
  38. package/dist/cjs/unescape.js +49 -0
  39. package/dist/cjs/unescape.js.map +1 -0
  40. package/dist/cjs/utils.d.ts +62 -0
  41. package/dist/cjs/utils.d.ts.map +1 -0
  42. package/dist/cjs/utils.js +126 -0
  43. package/dist/cjs/utils.js.map +1 -0
  44. package/dist/esm/brace-expand.d.ts +42 -0
  45. package/dist/esm/brace-expand.d.ts.map +1 -0
  46. package/dist/esm/brace-expand.js +165 -0
  47. package/dist/esm/brace-expand.js.map +1 -0
  48. package/dist/esm/cache.d.ts +36 -0
  49. package/dist/esm/cache.d.ts.map +1 -0
  50. package/dist/esm/cache.js +86 -0
  51. package/dist/esm/cache.js.map +1 -0
  52. package/dist/esm/escape.d.ts +40 -0
  53. package/dist/esm/escape.d.ts.map +1 -0
  54. package/dist/esm/escape.js +49 -0
  55. package/dist/esm/escape.js.map +1 -0
  56. package/dist/esm/fast-paths.d.ts +54 -0
  57. package/dist/esm/fast-paths.d.ts.map +1 -0
  58. package/dist/esm/fast-paths.js +209 -0
  59. package/dist/esm/fast-paths.js.map +1 -0
  60. package/dist/esm/index.d.ts +150 -0
  61. package/dist/esm/index.d.ts.map +1 -0
  62. package/dist/esm/index.js +240 -0
  63. package/dist/esm/index.js.map +1 -0
  64. package/dist/esm/minimatch-class.d.ts +153 -0
  65. package/dist/esm/minimatch-class.d.ts.map +1 -0
  66. package/dist/esm/minimatch-class.js +611 -0
  67. package/dist/esm/minimatch-class.js.map +1 -0
  68. package/dist/esm/options.d.ts +31 -0
  69. package/dist/esm/options.d.ts.map +1 -0
  70. package/dist/esm/options.js +63 -0
  71. package/dist/esm/options.js.map +1 -0
  72. package/dist/esm/package.json +3 -0
  73. package/dist/esm/types.d.ts +194 -0
  74. package/dist/esm/types.d.ts.map +1 -0
  75. package/dist/esm/types.js +16 -0
  76. package/dist/esm/types.js.map +1 -0
  77. package/dist/esm/unescape.d.ts +36 -0
  78. package/dist/esm/unescape.d.ts.map +1 -0
  79. package/dist/esm/unescape.js +46 -0
  80. package/dist/esm/unescape.js.map +1 -0
  81. package/dist/esm/utils.d.ts +62 -0
  82. package/dist/esm/utils.d.ts.map +1 -0
  83. package/dist/esm/utils.js +116 -0
  84. package/dist/esm/utils.js.map +1 -0
  85. package/package.json +83 -0
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Options translator: minimatch options -> picomatch options
4
+ *
5
+ * This module handles the translation of minimatch options to picomatch options.
6
+ * Since minimatch-fast uses picomatch as its matching engine, we need to map
7
+ * the options from minimatch's API to picomatch's API.
8
+ *
9
+ * Key differences between minimatch and picomatch options:
10
+ * - noext (minimatch) -> noextglob (picomatch)
11
+ * - matchBase (minimatch) -> basename (picomatch)
12
+ *
13
+ * Some options are handled specially and not passed to picomatch:
14
+ * - nocomment: Comment patterns (handled in Minimatch class)
15
+ * - nonull: Return pattern when no matches (handled in match function)
16
+ * - flipNegate: Invert negation result (handled in match function)
17
+ *
18
+ * @author 686f6c61
19
+ * @see https://github.com/686f6c61/minimatch-fast
20
+ * @license MIT
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.translateOptions = translateOptions;
24
+ exports.mergeOptions = mergeOptions;
25
+ /**
26
+ * Translate minimatch options to picomatch options
27
+ * Handles naming differences and sets appropriate defaults
28
+ */
29
+ function translateOptions(opts = {}) {
30
+ const picoOpts = {
31
+ // Direct mappings (same name, same meaning)
32
+ dot: opts.dot,
33
+ nocase: opts.nocase,
34
+ nonegate: opts.nonegate,
35
+ noglobstar: opts.noglobstar,
36
+ nobrace: opts.nobrace,
37
+ // Renamed options
38
+ noextglob: opts.noext, // minimatch: noext -> picomatch: noextglob
39
+ basename: opts.matchBase, // minimatch: matchBase -> picomatch: basename
40
+ // Force POSIX mode - we handle Windows paths manually via normalizePath
41
+ posix: true,
42
+ // Disable picomatch's brace handling - we use 'braces' package for full expansion
43
+ // picomatch only does brace matching, not expansion
44
+ // We expand braces ourselves, so tell picomatch not to process them
45
+ // Actually, we need nobrace: true to prevent double-processing
46
+ // The expanded patterns should be matched literally by picomatch
47
+ };
48
+ // Special options that need custom handling (not passed to picomatch)
49
+ const special = {
50
+ nocomment: opts.nocomment ?? false,
51
+ nonull: opts.nonull ?? false,
52
+ flipNegate: opts.flipNegate ?? false,
53
+ windowsPathsNoEscape: opts.windowsPathsNoEscape ?? opts.allowWindowsEscape === false,
54
+ partial: opts.partial ?? false,
55
+ magicalBraces: opts.magicalBraces ?? false,
56
+ debug: opts.debug ?? false,
57
+ optimizationLevel: opts.optimizationLevel ?? 1,
58
+ };
59
+ return { picoOpts, special };
60
+ }
61
+ /**
62
+ * Merge options with defaults
63
+ */
64
+ function mergeOptions(defaults, options) {
65
+ return { ...defaults, ...options };
66
+ }
67
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAQH,4CAqCC;AAKD,oCAKC;AAnDD;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,OAAyB,EAAE;IAC1D,MAAM,QAAQ,GAAqB;QACjC,4CAA4C;QAC5C,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;QAErB,kBAAkB;QAClB,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,2CAA2C;QAClE,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,8CAA8C;QAExE,wEAAwE;QACxE,KAAK,EAAE,IAAI;QAEX,kFAAkF;QAClF,oDAAoD;QACpD,oEAAoE;QACpE,+DAA+D;QAC/D,iEAAiE;KAClE,CAAC;IAEF,sEAAsE;IACtE,MAAM,OAAO,GAAG;QACd,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,KAAK;QAClC,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;QAC5B,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK;QACpC,oBAAoB,EAClB,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,kBAAkB,KAAK,KAAK;QAChE,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,KAAK;QAC9B,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,KAAK;QAC1C,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,KAAK;QAC1B,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,IAAI,CAAC;KAC/C,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CAC1B,QAA0B,EAC1B,OAAyB;IAEzB,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,194 @@
1
+ /**
2
+ * @fileoverview Type definitions for minimatch-fast
3
+ *
4
+ * This file contains all TypeScript type definitions used throughout the package.
5
+ * These types are 100% compatible with minimatch v10.x, ensuring seamless migration
6
+ * for projects switching from the original minimatch package.
7
+ *
8
+ * @author 686f6c61
9
+ * @see https://github.com/686f6c61/minimatch-fast
10
+ * @license MIT
11
+ */
12
+ /**
13
+ * Supported platforms for path handling
14
+ */
15
+ export type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
16
+ /**
17
+ * Path separator types
18
+ */
19
+ export type Sep = '\\' | '/';
20
+ /**
21
+ * RegExp with additional metadata
22
+ */
23
+ export type MMRegExp = RegExp & {
24
+ _src?: string;
25
+ _glob?: string;
26
+ };
27
+ /**
28
+ * Symbol representing globstar pattern (**)
29
+ */
30
+ export declare const GLOBSTAR: unique symbol;
31
+ export type GlobstarSymbol = typeof GLOBSTAR;
32
+ /**
33
+ * Parse return types
34
+ */
35
+ export type ParseReturnFiltered = string | MMRegExp | GlobstarSymbol;
36
+ export type ParseReturn = ParseReturnFiltered | false;
37
+ /**
38
+ * Options for minimatch functions
39
+ * All options are optional and default to false unless otherwise specified
40
+ */
41
+ export interface MinimatchOptions {
42
+ /**
43
+ * Do not expand {a,b} and {1..3} brace sets
44
+ * @default false
45
+ */
46
+ nobrace?: boolean;
47
+ /**
48
+ * Disable pattern comments starting with #
49
+ * When false (default), patterns starting with # are treated as comments and match nothing
50
+ * @default false
51
+ */
52
+ nocomment?: boolean;
53
+ /**
54
+ * Disable negation with leading !
55
+ * When false (default), patterns starting with ! are negated
56
+ * @default false
57
+ */
58
+ nonegate?: boolean;
59
+ /**
60
+ * Enable debug output
61
+ * @default false
62
+ */
63
+ debug?: boolean;
64
+ /**
65
+ * Disable ** matching across directory separators
66
+ * When true, ** behaves like *
67
+ * @default false
68
+ */
69
+ noglobstar?: boolean;
70
+ /**
71
+ * Disable extglob patterns like +(a|b), *(a|b), ?(a|b), @(a|b), !(a|b)
72
+ * @default false
73
+ */
74
+ noext?: boolean;
75
+ /**
76
+ * Return the pattern itself when no matches are found
77
+ * Only applies to minimatch.match()
78
+ * @default false
79
+ */
80
+ nonull?: boolean;
81
+ /**
82
+ * Treat backslash as path separator only, not as escape character
83
+ * Replaces all \ with / before processing
84
+ * Useful for Windows paths
85
+ * @default false
86
+ */
87
+ windowsPathsNoEscape?: boolean;
88
+ /**
89
+ * Legacy alias: when set to false, enables windowsPathsNoEscape
90
+ * @deprecated Use windowsPathsNoEscape instead
91
+ */
92
+ allowWindowsEscape?: boolean;
93
+ /**
94
+ * Perform partial matching
95
+ * Useful when traversing directories and full path is not yet known
96
+ * @default false
97
+ */
98
+ partial?: boolean;
99
+ /**
100
+ * Match patterns without slashes against basename of the path
101
+ * e.g., *.js will match path/to/file.js
102
+ * @default false
103
+ */
104
+ matchBase?: boolean;
105
+ /**
106
+ * Preserve multiple consecutive slashes
107
+ * By default, multiple slashes are collapsed to one
108
+ * @default false
109
+ */
110
+ preserveMultipleSlashes?: boolean;
111
+ /**
112
+ * Match dotfiles (files starting with .)
113
+ * By default, * and ** do not match dotfiles unless pattern also starts with .
114
+ * @default false
115
+ */
116
+ dot?: boolean;
117
+ /**
118
+ * Perform case-insensitive matching
119
+ * @default false
120
+ */
121
+ nocase?: boolean;
122
+ /**
123
+ * When used with nocase, only use case-insensitive regex
124
+ * but leave string comparisons case-sensitive
125
+ * Has no effect without nocase: true
126
+ * @default false
127
+ */
128
+ nocaseMagicOnly?: boolean;
129
+ /**
130
+ * Treat brace expansion as "magic" for hasMagic()
131
+ * When true, patterns like {a,b} are considered to have magic
132
+ * @default false
133
+ */
134
+ magicalBraces?: boolean;
135
+ /**
136
+ * Invert the result of negation
137
+ * When true, negated patterns return true on hit and false on miss
138
+ * @default false
139
+ */
140
+ flipNegate?: boolean;
141
+ /**
142
+ * Optimization level for pattern processing
143
+ * 0 = no optimization
144
+ * 1 = basic optimization (default)
145
+ * 2+ = aggressive optimization
146
+ * @default 1
147
+ */
148
+ optimizationLevel?: number;
149
+ /**
150
+ * Override platform detection for path handling
151
+ */
152
+ platform?: Platform;
153
+ /**
154
+ * Windows-specific: disable magic root detection for drive letters
155
+ * @default false on non-Windows, true on Windows with nocase
156
+ */
157
+ windowsNoMagicRoot?: boolean;
158
+ }
159
+ /**
160
+ * Options specifically for picomatch (internal use)
161
+ */
162
+ export interface PicomatchOptions {
163
+ dot?: boolean;
164
+ nocase?: boolean;
165
+ nonegate?: boolean;
166
+ noextglob?: boolean;
167
+ noglobstar?: boolean;
168
+ nobrace?: boolean;
169
+ basename?: boolean;
170
+ posix?: boolean;
171
+ windows?: boolean;
172
+ contains?: boolean;
173
+ flags?: string;
174
+ matchBase?: boolean;
175
+ posixSlashes?: boolean;
176
+ expandRange?: (a: string, b: string) => string;
177
+ }
178
+ /**
179
+ * Result of translating minimatch options to picomatch options
180
+ */
181
+ export interface TranslatedOptions {
182
+ picoOpts: PicomatchOptions;
183
+ special: {
184
+ nocomment: boolean;
185
+ nonull: boolean;
186
+ flipNegate: boolean;
187
+ windowsPathsNoEscape: boolean;
188
+ partial: boolean;
189
+ magicalBraces: boolean;
190
+ debug: boolean;
191
+ optimizationLevel: number;
192
+ };
193
+ }
194
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB,KAAK,GACL,SAAS,GACT,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,OAAO,MAA8B,CAAC;AAC7D,MAAM,MAAM,cAAc,GAAG,OAAO,QAAQ,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,cAAc,CAAC;AACrE,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,KAAK,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;OAIG;IACH,UAAU,CAAC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,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,OAAO,EAAE;QACP,SAAS,EAAE,OAAO,CAAC;QACnB,MAAM,EAAE,OAAO,CAAC;QAChB,UAAU,EAAE,OAAO,CAAC;QACpB,oBAAoB,EAAE,OAAO,CAAC;QAC9B,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,EAAE,OAAO,CAAC;QACvB,KAAK,EAAE,OAAO,CAAC;QACf,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Type definitions for minimatch-fast
4
+ *
5
+ * This file contains all TypeScript type definitions used throughout the package.
6
+ * These types are 100% compatible with minimatch v10.x, ensuring seamless migration
7
+ * for projects switching from the original minimatch package.
8
+ *
9
+ * @author 686f6c61
10
+ * @see https://github.com/686f6c61/minimatch-fast
11
+ * @license MIT
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.GLOBSTAR = void 0;
15
+ /**
16
+ * Symbol representing globstar pattern (**)
17
+ */
18
+ exports.GLOBSTAR = Symbol('globstar **');
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AA+BH;;GAEG;AACU,QAAA,QAAQ,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @fileoverview Unescape glob magic characters
3
+ *
4
+ * This module provides functionality to unescape previously escaped glob strings,
5
+ * reversing the operation performed by the escape() function.
6
+ *
7
+ * Unescape modes:
8
+ * - Default mode: Removes backslash escaping (\\* -> *)
9
+ * - Windows mode: Removes character class escaping ([*] -> *)
10
+ *
11
+ * This is useful when you need to convert escaped patterns back to their
12
+ * original form for display or further processing.
13
+ *
14
+ * @example
15
+ * unescape('\\*.js') // Returns '*.js'
16
+ * unescape('[*].js', { windowsPathsNoEscape: true }) // Returns '*.js'
17
+ *
18
+ * @author 686f6c61
19
+ * @see https://github.com/686f6c61/minimatch-fast
20
+ * @license MIT
21
+ */
22
+ import type { MinimatchOptions } from './types.js';
23
+ /**
24
+ * Un-escape a string that has been escaped with escape().
25
+ *
26
+ * If windowsPathsNoEscape is true, square-bracket escapes are removed,
27
+ * but not backslash escapes (since backslash is a path separator in this mode).
28
+ *
29
+ * If windowsPathsNoEscape is false (default), backslash escapes are removed.
30
+ *
31
+ * @param str - The string to unescape
32
+ * @param options - Options controlling unescape behavior
33
+ * @returns Unescaped string
34
+ */
35
+ export declare function unescape(str: string, options?: Pick<MinimatchOptions, 'windowsPathsNoEscape'>): string;
36
+ //# sourceMappingURL=unescape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unescape.d.ts","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAM,GAC3D,MAAM,CAaR"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Unescape glob magic characters
4
+ *
5
+ * This module provides functionality to unescape previously escaped glob strings,
6
+ * reversing the operation performed by the escape() function.
7
+ *
8
+ * Unescape modes:
9
+ * - Default mode: Removes backslash escaping (\\* -> *)
10
+ * - Windows mode: Removes character class escaping ([*] -> *)
11
+ *
12
+ * This is useful when you need to convert escaped patterns back to their
13
+ * original form for display or further processing.
14
+ *
15
+ * @example
16
+ * unescape('\\*.js') // Returns '*.js'
17
+ * unescape('[*].js', { windowsPathsNoEscape: true }) // Returns '*.js'
18
+ *
19
+ * @author 686f6c61
20
+ * @see https://github.com/686f6c61/minimatch-fast
21
+ * @license MIT
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.unescape = unescape;
25
+ /**
26
+ * Un-escape a string that has been escaped with escape().
27
+ *
28
+ * If windowsPathsNoEscape is true, square-bracket escapes are removed,
29
+ * but not backslash escapes (since backslash is a path separator in this mode).
30
+ *
31
+ * If windowsPathsNoEscape is false (default), backslash escapes are removed.
32
+ *
33
+ * @param str - The string to unescape
34
+ * @param options - Options controlling unescape behavior
35
+ * @returns Unescaped string
36
+ */
37
+ function unescape(str, options = {}) {
38
+ const { windowsPathsNoEscape = false } = options;
39
+ if (windowsPathsNoEscape) {
40
+ // Remove square-bracket escapes: [x] -> x
41
+ // But only for single non-special characters
42
+ // Don't touch things like [abc] or [a-z]
43
+ return str.replace(/\[([^\/\\[\]{}])\]/g, '$1');
44
+ }
45
+ // Default: remove backslash escapes
46
+ // \x -> x (but not for forward slash which can't be escaped)
47
+ return str.replace(/\\([^/])/g, '$1');
48
+ }
49
+ //# sourceMappingURL=unescape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unescape.js","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAgBH,4BAgBC;AA5BD;;;;;;;;;;;GAWG;AACH,SAAgB,QAAQ,CACtB,GAAW,EACX,UAA0D,EAAE;IAE5D,MAAM,EAAE,oBAAoB,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAEjD,IAAI,oBAAoB,EAAE,CAAC;QACzB,0CAA0C;QAC1C,6CAA6C;QAC7C,yCAAyC;QACzC,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,oCAAoC;IACpC,6DAA6D;IAC7D,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @fileoverview Path utilities for cross-platform support
3
+ *
4
+ * This module provides utility functions for handling paths across different
5
+ * operating systems. It includes functions for:
6
+ * - Platform detection (Windows vs POSIX)
7
+ * - Path normalization (backslash to forward slash conversion)
8
+ * - Path splitting with UNC path support
9
+ * - Glob magic character detection
10
+ *
11
+ * These utilities ensure minimatch-fast works correctly on all platforms
12
+ * while maintaining compatibility with the original minimatch behavior.
13
+ *
14
+ * @author 686f6c61
15
+ * @see https://github.com/686f6c61/minimatch-fast
16
+ * @license MIT
17
+ */
18
+ import type { Platform, Sep } from './types';
19
+ /**
20
+ * Get the default path separator based on platform
21
+ */
22
+ export declare const sep: Sep;
23
+ /**
24
+ * Check if the given platform is Windows
25
+ */
26
+ export declare function isWindows(platform?: Platform): boolean;
27
+ /**
28
+ * Get the current platform
29
+ */
30
+ export declare function getPlatform(): Platform;
31
+ /**
32
+ * Normalize a path by converting backslashes to forward slashes
33
+ * This is critical for Windows compatibility
34
+ *
35
+ * @param path - The path to normalize
36
+ * @param windowsPathsNoEscape - If true, treat backslash as path separator
37
+ */
38
+ export declare function normalizePath(path: string, windowsPathsNoEscape: boolean): string;
39
+ /**
40
+ * Normalize a pattern by converting backslashes to forward slashes
41
+ *
42
+ * @param pattern - The pattern to normalize
43
+ * @param windowsPathsNoEscape - If true, treat backslash as path separator
44
+ */
45
+ export declare function normalizePattern(pattern: string, windowsPathsNoEscape: boolean): string;
46
+ /**
47
+ * Split a path by slashes
48
+ *
49
+ * @param path - The path to split
50
+ * @param preserveMultipleSlashes - If true, don't collapse multiple slashes
51
+ * @param isWindowsPlatform - If true, handle UNC paths
52
+ */
53
+ export declare function slashSplit(path: string, preserveMultipleSlashes: boolean, isWindowsPlatform: boolean): string[];
54
+ /**
55
+ * Check if a pattern contains glob magic characters
56
+ */
57
+ export declare function hasMagicChars(pattern: string): boolean;
58
+ /**
59
+ * Unescape a string for regex use
60
+ */
61
+ export declare function escapeRegex(str: string): string;
62
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAc7C;;GAEG;AACH,eAAO,MAAM,GAAG,EAAE,GAA8C,CAAC;AAEjE;;GAEG;AACH,wBAAgB,SAAS,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,oBAAoB,EAAE,OAAO,GAC5B,MAAM,CAUR;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,oBAAoB,EAAE,OAAO,GAC5B,MAAM,CAKR;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,uBAAuB,EAAE,OAAO,EAChC,iBAAiB,EAAE,OAAO,GACzB,MAAM,EAAE,CA4BV;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAGtD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Path utilities for cross-platform support
4
+ *
5
+ * This module provides utility functions for handling paths across different
6
+ * operating systems. It includes functions for:
7
+ * - Platform detection (Windows vs POSIX)
8
+ * - Path normalization (backslash to forward slash conversion)
9
+ * - Path splitting with UNC path support
10
+ * - Glob magic character detection
11
+ *
12
+ * These utilities ensure minimatch-fast works correctly on all platforms
13
+ * while maintaining compatibility with the original minimatch behavior.
14
+ *
15
+ * @author 686f6c61
16
+ * @see https://github.com/686f6c61/minimatch-fast
17
+ * @license MIT
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.sep = void 0;
21
+ exports.isWindows = isWindows;
22
+ exports.getPlatform = getPlatform;
23
+ exports.normalizePath = normalizePath;
24
+ exports.normalizePattern = normalizePattern;
25
+ exports.slashSplit = slashSplit;
26
+ exports.hasMagicChars = hasMagicChars;
27
+ exports.escapeRegex = escapeRegex;
28
+ /**
29
+ * Detect the current platform
30
+ */
31
+ const defaultPlatform = (typeof process === 'object' &&
32
+ process &&
33
+ typeof process.platform === 'string'
34
+ ? process.env['__MINIMATCH_TESTING_PLATFORM__'] ||
35
+ process.platform
36
+ : 'linux');
37
+ /**
38
+ * Get the default path separator based on platform
39
+ */
40
+ exports.sep = defaultPlatform === 'win32' ? '\\' : '/';
41
+ /**
42
+ * Check if the given platform is Windows
43
+ */
44
+ function isWindows(platform) {
45
+ return (platform || defaultPlatform) === 'win32';
46
+ }
47
+ /**
48
+ * Get the current platform
49
+ */
50
+ function getPlatform() {
51
+ return defaultPlatform;
52
+ }
53
+ /**
54
+ * Normalize a path by converting backslashes to forward slashes
55
+ * This is critical for Windows compatibility
56
+ *
57
+ * @param path - The path to normalize
58
+ * @param windowsPathsNoEscape - If true, treat backslash as path separator
59
+ */
60
+ function normalizePath(path, windowsPathsNoEscape) {
61
+ if (typeof path !== 'string')
62
+ return path;
63
+ // If windowsPathsNoEscape is true, convert all backslashes to forward slashes
64
+ // This matches minimatch behavior where backslash is path separator, not escape
65
+ if (windowsPathsNoEscape) {
66
+ return path.replace(/\\/g, '/');
67
+ }
68
+ return path;
69
+ }
70
+ /**
71
+ * Normalize a pattern by converting backslashes to forward slashes
72
+ *
73
+ * @param pattern - The pattern to normalize
74
+ * @param windowsPathsNoEscape - If true, treat backslash as path separator
75
+ */
76
+ function normalizePattern(pattern, windowsPathsNoEscape) {
77
+ if (windowsPathsNoEscape) {
78
+ return pattern.replace(/\\/g, '/');
79
+ }
80
+ return pattern;
81
+ }
82
+ /**
83
+ * Split a path by slashes
84
+ *
85
+ * @param path - The path to split
86
+ * @param preserveMultipleSlashes - If true, don't collapse multiple slashes
87
+ * @param isWindowsPlatform - If true, handle UNC paths
88
+ */
89
+ function slashSplit(path, preserveMultipleSlashes, isWindowsPlatform) {
90
+ // Handle empty path
91
+ if (!path) {
92
+ return [''];
93
+ }
94
+ // If preserving multiple slashes, just split on single slash
95
+ if (preserveMultipleSlashes) {
96
+ return path.split('/');
97
+ }
98
+ // Handle UNC paths on Windows (e.g., //server/share)
99
+ if (isWindowsPlatform && /^\/\/[^/]+/.test(path)) {
100
+ // Preserve the leading // for UNC paths
101
+ const parts = path.split(/\/+/);
102
+ // First element will be empty string from leading //, keep it
103
+ return ['', ...parts.filter((p, i) => i === 0 || p !== '')];
104
+ }
105
+ // Normal case: split on one or more slashes, filter empty parts except leading
106
+ const parts = path.split(/\/+/);
107
+ // Handle absolute paths (preserve leading empty string)
108
+ if (path.startsWith('/')) {
109
+ return ['', ...parts.filter((p) => p !== '')];
110
+ }
111
+ return parts.filter((p) => p !== '');
112
+ }
113
+ /**
114
+ * Check if a pattern contains glob magic characters
115
+ */
116
+ function hasMagicChars(pattern) {
117
+ // Check for glob special characters
118
+ return /[*?[\]{}()!@+]/.test(pattern);
119
+ }
120
+ /**
121
+ * Unescape a string for regex use
122
+ */
123
+ function escapeRegex(str) {
124
+ return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
125
+ }
126
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAwBH,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
+ * @fileoverview Brace expansion using the 'braces' package
3
+ *
4
+ * This module is critical because picomatch does NOT perform full brace expansion.
5
+ * picomatch only does brace matching, meaning {a,b} will match 'a' or 'b'
6
+ * but won't expand the pattern into ['a', 'b'].
7
+ *
8
+ * minimatch uses brace-expansion to fully expand patterns like:
9
+ * - {a,b,c} -> ['a', 'b', 'c']
10
+ * - {1..3} -> ['1', '2', '3']
11
+ * - {a..c} -> ['a', 'b', 'c']
12
+ * - a{b,c}d -> ['abd', 'acd']
13
+ *
14
+ * We use 'braces' package which is maintained by the same author as picomatch
15
+ * and is what micromatch uses internally.
16
+ *
17
+ * Security considerations:
18
+ * - Maximum expansion length is limited to prevent DoS attacks
19
+ * - Range expansion is limited (e.g., {1..1000000} is restricted)
20
+ *
21
+ * @author 686f6c61
22
+ * @see https://github.com/686f6c61/minimatch-fast
23
+ * @license MIT
24
+ */
25
+ import type { MinimatchOptions } from './types.js';
26
+ /**
27
+ * Expand brace patterns like {a,b,c} and {1..3}
28
+ *
29
+ * Optimized with:
30
+ * 1. Cache for repeated patterns
31
+ * 2. Fast path for simple {a,b,c} patterns
32
+ *
33
+ * @param pattern - The glob pattern to expand
34
+ * @param options - Minimatch options
35
+ * @returns Array of expanded patterns
36
+ */
37
+ export declare function braceExpand(pattern: string, options?: MinimatchOptions): string[];
38
+ /**
39
+ * Check if a pattern contains brace expansion syntax
40
+ */
41
+ export declare function hasBraces(pattern: string): boolean;
42
+ //# sourceMappingURL=brace-expand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brace-expand.d.ts","sourceRoot":"","sources":["../../src/brace-expand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAyCnD;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gBAAqB,GAC7B,MAAM,EAAE,CAsEV;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CA8BlD"}