Skip to content

Commit b96e86c

Browse files
committed
deps: minimatch@10.1.1
1 parent d347329 commit b96e86c

File tree

13 files changed

+175
-62
lines changed

13 files changed

+175
-62
lines changed

node_modules/minimatch/LICENSE

Lines changed: 0 additions & 15 deletions
This file was deleted.

node_modules/minimatch/LICENSE.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Blue Oak Model License
2+
3+
Version 1.0.0
4+
5+
## Purpose
6+
7+
This license gives everyone as much permission to work with
8+
this software as possible, while protecting contributors
9+
from liability.
10+
11+
## Acceptance
12+
13+
In order to receive this license, you must agree to its
14+
rules. The rules of this license are both obligations
15+
under that agreement and conditions to your license.
16+
You must not do anything with this software that triggers
17+
a rule that you cannot or will not follow.
18+
19+
## Copyright
20+
21+
Each contributor licenses you to do everything with this
22+
software that would otherwise infringe that contributor's
23+
copyright in it.
24+
25+
## Notices
26+
27+
You must ensure that everyone who gets a copy of
28+
any part of this software from you, with or without
29+
changes, also gets the text of this license or a link to
30+
<https://blueoakcouncil.org/license/1.0.0>.
31+
32+
## Excuse
33+
34+
If anyone notifies you in writing that you have not
35+
complied with [Notices](#notices), you can keep your
36+
license by taking all practical steps to comply within 30
37+
days after the notice. If you do not do so, your license
38+
ends immediately.
39+
40+
## Patent
41+
42+
Each contributor licenses you to do everything with this
43+
software that would otherwise infringe any patent claims
44+
they can license or become able to license.
45+
46+
## Reliability
47+
48+
No contributor can revoke this license.
49+
50+
## No Liability
51+
52+
**_As far as the law allows, this software comes as is,
53+
without any warranty or condition, and no contributor
54+
will be liable to anyone for any damages related to this
55+
software or this license, under any kind of legal claim._**

node_modules/minimatch/dist/commonjs/ast.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,9 @@ class AST {
415415
if (this.#root === this)
416416
this.#fillNegs();
417417
if (!this.type) {
418-
const noEmpty = this.isStart() && this.isEnd();
418+
const noEmpty = this.isStart() &&
419+
this.isEnd() &&
420+
!this.#parts.some(s => typeof s !== 'string');
419421
const src = this.#parts
420422
.map(p => {
421423
const [re, _, hasMagic, uflag] = typeof p === 'string'
@@ -571,10 +573,7 @@ class AST {
571573
}
572574
}
573575
if (c === '*') {
574-
if (noEmpty && glob === '*')
575-
re += starNoEmpty;
576-
else
577-
re += star;
576+
re += noEmpty && glob === '*' ? starNoEmpty : star;
578577
hasMagic = true;
579578
continue;
580579
}

node_modules/minimatch/dist/commonjs/escape.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@ exports.escape = void 0;
44
/**
55
* Escape all magic characters in a glob pattern.
66
*
7-
* If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}
7+
* If the {@link MinimatchOptions.windowsPathsNoEscape}
88
* option is used, then characters are escaped by wrapping in `[]`, because
99
* a magic character wrapped in a character class can only be satisfied by
1010
* that exact character. In this mode, `\` is _not_ escaped, because it is
1111
* not interpreted as a magic character, but instead as a path separator.
12+
*
13+
* If the {@link MinimatchOptions.magicalBraces} option is used,
14+
* then braces (`{` and `}`) will be escaped.
1215
*/
13-
const escape = (s, { windowsPathsNoEscape = false, } = {}) => {
16+
const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false, } = {}) => {
1417
// don't need to escape +@! because we escape the parens
1518
// that make those magic, and escaping ! as [!] isn't valid,
1619
// because [!]] is a valid glob class meaning not ']'.
20+
if (magicalBraces) {
21+
return windowsPathsNoEscape
22+
? s.replace(/[?*()[\]{}]/g, '[$&]')
23+
: s.replace(/[?*()[\]\\{}]/g, '\\$&');
24+
}
1725
return windowsPathsNoEscape
1826
? s.replace(/[?*()[\]]/g, '[$&]')
1927
: s.replace(/[?*()[\]\\]/g, '\\$&');

node_modules/minimatch/dist/commonjs/index.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ class Minimatch {
640640
}
641641
}
642642
// resolve and reduce . and .. portions in the file as well.
643-
// dont' need to do the second phase, because it's only one string[]
643+
// don't need to do the second phase, because it's only one string[]
644644
const { optimizationLevel = 1 } = this.options;
645645
if (optimizationLevel >= 2) {
646646
file = this.levelTwoFileOptimize(file);
@@ -893,14 +893,25 @@ class Minimatch {
893893
}
894894
}
895895
else if (next === undefined) {
896-
pp[i - 1] = prev + '(?:\\/|' + twoStar + ')?';
896+
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + ')?';
897897
}
898898
else if (next !== exports.GLOBSTAR) {
899899
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
900900
pp[i + 1] = exports.GLOBSTAR;
901901
}
902902
});
903-
return pp.filter(p => p !== exports.GLOBSTAR).join('/');
903+
const filtered = pp.filter(p => p !== exports.GLOBSTAR);
904+
// For partial matches, we need to make the pattern match
905+
// any prefix of the full path. We do this by generating
906+
// alternative patterns that match progressively longer prefixes.
907+
if (this.partial && filtered.length >= 1) {
908+
const prefixes = [];
909+
for (let i = 1; i <= filtered.length; i++) {
910+
prefixes.push(filtered.slice(0, i).join('/'));
911+
}
912+
return '(?:' + prefixes.join('|') + ')';
913+
}
914+
return filtered.join('/');
904915
})
905916
.join('|');
906917
// need to wrap in parens if we had more than one thing with |,
@@ -909,6 +920,10 @@ class Minimatch {
909920
// must match entire pattern
910921
// ending in a * or ** will make it less strict.
911922
re = '^' + open + re + close + '$';
923+
// In partial mode, '/' should always match as it's a valid prefix for any pattern
924+
if (this.partial) {
925+
re = '^(?:\\/|' + open + re.slice(1, -1) + close + ')$';
926+
}
912927
// can match anything, as long as it's not this.
913928
if (this.negate)
914929
re = '^(?!' + re + ').+$';

node_modules/minimatch/dist/commonjs/unescape.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,35 @@ exports.unescape = void 0;
44
/**
55
* Un-escape a string that has been escaped with {@link escape}.
66
*
7-
* If the {@link windowsPathsNoEscape} option is used, then square-brace
8-
* escapes are removed, but not backslash escapes. For example, it will turn
9-
* the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
10-
* becuase `\` is a path separator in `windowsPathsNoEscape` mode.
7+
* If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
8+
* square-bracket escapes are removed, but not backslash escapes.
119
*
12-
* When `windowsPathsNoEscape` is not set, then both brace escapes and
10+
* For example, it will turn the string `'[*]'` into `*`, but it will not
11+
* turn `'\\*'` into `'*'`, because `\` is a path separator in
12+
* `windowsPathsNoEscape` mode.
13+
*
14+
* When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
1315
* backslash escapes are removed.
1416
*
1517
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
1618
* or unescaped.
19+
*
20+
* When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
21+
* unescaped.
1722
*/
18-
const unescape = (s, { windowsPathsNoEscape = false, } = {}) => {
23+
const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {}) => {
24+
if (magicalBraces) {
25+
return windowsPathsNoEscape
26+
? s.replace(/\[([^\/\\])\]/g, '$1')
27+
: s
28+
.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2')
29+
.replace(/\\([^\/])/g, '$1');
30+
}
1931
return windowsPathsNoEscape
20-
? s.replace(/\[([^\/\\])\]/g, '$1')
21-
: s.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2').replace(/\\([^\/])/g, '$1');
32+
? s.replace(/\[([^\/\\{}])\]/g, '$1')
33+
: s
34+
.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, '$1$2')
35+
.replace(/\\([^\/{}])/g, '$1');
2236
};
2337
exports.unescape = unescape;
2438
//# sourceMappingURL=unescape.js.map

node_modules/minimatch/dist/esm/ast.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,9 @@ export class AST {
412412
if (this.#root === this)
413413
this.#fillNegs();
414414
if (!this.type) {
415-
const noEmpty = this.isStart() && this.isEnd();
415+
const noEmpty = this.isStart() &&
416+
this.isEnd() &&
417+
!this.#parts.some(s => typeof s !== 'string');
416418
const src = this.#parts
417419
.map(p => {
418420
const [re, _, hasMagic, uflag] = typeof p === 'string'
@@ -568,10 +570,7 @@ export class AST {
568570
}
569571
}
570572
if (c === '*') {
571-
if (noEmpty && glob === '*')
572-
re += starNoEmpty;
573-
else
574-
re += star;
573+
re += noEmpty && glob === '*' ? starNoEmpty : star;
575574
hasMagic = true;
576575
continue;
577576
}

node_modules/minimatch/dist/esm/escape.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
/**
22
* Escape all magic characters in a glob pattern.
33
*
4-
* If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}
4+
* If the {@link MinimatchOptions.windowsPathsNoEscape}
55
* option is used, then characters are escaped by wrapping in `[]`, because
66
* a magic character wrapped in a character class can only be satisfied by
77
* that exact character. In this mode, `\` is _not_ escaped, because it is
88
* not interpreted as a magic character, but instead as a path separator.
9+
*
10+
* If the {@link MinimatchOptions.magicalBraces} option is used,
11+
* then braces (`{` and `}`) will be escaped.
912
*/
10-
export const escape = (s, { windowsPathsNoEscape = false, } = {}) => {
13+
export const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false, } = {}) => {
1114
// don't need to escape +@! because we escape the parens
1215
// that make those magic, and escaping ! as [!] isn't valid,
1316
// because [!]] is a valid glob class meaning not ']'.
17+
if (magicalBraces) {
18+
return windowsPathsNoEscape
19+
? s.replace(/[?*()[\]{}]/g, '[$&]')
20+
: s.replace(/[?*()[\]\\{}]/g, '\\$&');
21+
}
1422
return windowsPathsNoEscape
1523
? s.replace(/[?*()[\]]/g, '[$&]')
1624
: s.replace(/[?*()[\]\\]/g, '\\$&');

node_modules/minimatch/dist/esm/index.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ export class Minimatch {
631631
}
632632
}
633633
// resolve and reduce . and .. portions in the file as well.
634-
// dont' need to do the second phase, because it's only one string[]
634+
// don't need to do the second phase, because it's only one string[]
635635
const { optimizationLevel = 1 } = this.options;
636636
if (optimizationLevel >= 2) {
637637
file = this.levelTwoFileOptimize(file);
@@ -884,14 +884,25 @@ export class Minimatch {
884884
}
885885
}
886886
else if (next === undefined) {
887-
pp[i - 1] = prev + '(?:\\/|' + twoStar + ')?';
887+
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + ')?';
888888
}
889889
else if (next !== GLOBSTAR) {
890890
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
891891
pp[i + 1] = GLOBSTAR;
892892
}
893893
});
894-
return pp.filter(p => p !== GLOBSTAR).join('/');
894+
const filtered = pp.filter(p => p !== GLOBSTAR);
895+
// For partial matches, we need to make the pattern match
896+
// any prefix of the full path. We do this by generating
897+
// alternative patterns that match progressively longer prefixes.
898+
if (this.partial && filtered.length >= 1) {
899+
const prefixes = [];
900+
for (let i = 1; i <= filtered.length; i++) {
901+
prefixes.push(filtered.slice(0, i).join('/'));
902+
}
903+
return '(?:' + prefixes.join('|') + ')';
904+
}
905+
return filtered.join('/');
895906
})
896907
.join('|');
897908
// need to wrap in parens if we had more than one thing with |,
@@ -900,6 +911,10 @@ export class Minimatch {
900911
// must match entire pattern
901912
// ending in a * or ** will make it less strict.
902913
re = '^' + open + re + close + '$';
914+
// In partial mode, '/' should always match as it's a valid prefix for any pattern
915+
if (this.partial) {
916+
re = '^(?:\\/|' + open + re.slice(1, -1) + close + ')$';
917+
}
903918
// can match anything, as long as it's not this.
904919
if (this.negate)
905920
re = '^(?!' + re + ').+$';
Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
11
/**
22
* Un-escape a string that has been escaped with {@link escape}.
33
*
4-
* If the {@link windowsPathsNoEscape} option is used, then square-brace
5-
* escapes are removed, but not backslash escapes. For example, it will turn
6-
* the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
7-
* becuase `\` is a path separator in `windowsPathsNoEscape` mode.
4+
* If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
5+
* square-bracket escapes are removed, but not backslash escapes.
86
*
9-
* When `windowsPathsNoEscape` is not set, then both brace escapes and
7+
* For example, it will turn the string `'[*]'` into `*`, but it will not
8+
* turn `'\\*'` into `'*'`, because `\` is a path separator in
9+
* `windowsPathsNoEscape` mode.
10+
*
11+
* When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
1012
* backslash escapes are removed.
1113
*
1214
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
1315
* or unescaped.
16+
*
17+
* When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
18+
* unescaped.
1419
*/
15-
export const unescape = (s, { windowsPathsNoEscape = false, } = {}) => {
20+
export const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {}) => {
21+
if (magicalBraces) {
22+
return windowsPathsNoEscape
23+
? s.replace(/\[([^\/\\])\]/g, '$1')
24+
: s
25+
.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2')
26+
.replace(/\\([^\/])/g, '$1');
27+
}
1628
return windowsPathsNoEscape
17-
? s.replace(/\[([^\/\\])\]/g, '$1')
18-
: s.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2').replace(/\\([^\/])/g, '$1');
29+
? s.replace(/\[([^\/\\{}])\]/g, '$1')
30+
: s
31+
.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, '$1$2')
32+
.replace(/\\([^\/{}])/g, '$1');
1933
};
2034
//# sourceMappingURL=unescape.js.map

0 commit comments

Comments
 (0)