@docusaurus/utils 0.0.0-4825 → 0.0.0-4834
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/lib/globUtils.d.ts +2 -1
- package/lib/globUtils.d.ts.map +1 -1
- package/lib/globUtils.js +6 -1
- package/lib/globUtils.js.map +1 -1
- package/package.json +4 -4
- package/src/globUtils.ts +6 -1
package/lib/globUtils.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ declare type Matcher = (str: string) => boolean;
|
|
|
17
17
|
* A very thin wrapper around `Micromatch.makeRe`.
|
|
18
18
|
*
|
|
19
19
|
* @see {@link createAbsoluteFilePathMatcher}
|
|
20
|
-
* @param patterns A list of glob patterns.
|
|
20
|
+
* @param patterns A list of glob patterns. If the list is empty, it defaults to
|
|
21
|
+
* matching none.
|
|
21
22
|
* @returns A matcher handle that tells if a file path is matched by any of the
|
|
22
23
|
* patterns.
|
|
23
24
|
*/
|
package/lib/globUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globUtils.d.ts","sourceRoot":"","sources":["../src/globUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,0CAA0C;AAC1C,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,QAAQ,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,UAK9B,CAAC;AAEF,aAAK,OAAO,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"globUtils.d.ts","sourceRoot":"","sources":["../src/globUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,0CAA0C;AAC1C,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,QAAQ,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,UAK9B,CAAC;AAEF,aAAK,OAAO,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;AAExC;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CASzD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAAE,EAClB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAmBT"}
|
package/lib/globUtils.js
CHANGED
|
@@ -29,11 +29,16 @@ exports.GlobExcludeDefault = [
|
|
|
29
29
|
* A very thin wrapper around `Micromatch.makeRe`.
|
|
30
30
|
*
|
|
31
31
|
* @see {@link createAbsoluteFilePathMatcher}
|
|
32
|
-
* @param patterns A list of glob patterns.
|
|
32
|
+
* @param patterns A list of glob patterns. If the list is empty, it defaults to
|
|
33
|
+
* matching none.
|
|
33
34
|
* @returns A matcher handle that tells if a file path is matched by any of the
|
|
34
35
|
* patterns.
|
|
35
36
|
*/
|
|
36
37
|
function createMatcher(patterns) {
|
|
38
|
+
if (patterns.length === 0) {
|
|
39
|
+
// `/(?:)/.test("foo")` is `true`
|
|
40
|
+
return () => false;
|
|
41
|
+
}
|
|
37
42
|
const regexp = new RegExp(patterns.map((pattern) => micromatch_1.default.makeRe(pattern).source).join('|'));
|
|
38
43
|
return (str) => regexp.test(str);
|
|
39
44
|
}
|
package/lib/globUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globUtils.js","sourceRoot":"","sources":["../src/globUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,qEAAqE;AAErE,oEAAoC,CAAC,qCAAqC;AAC1E,wDAAwB;AAExB,0CAA0C;AAC1C,iCAAyC;AAAjC,yHAAA,OAAO,OAAU;AAEzB;;;;GAIG;AACU,QAAA,kBAAkB,GAAG;IAChC,8BAA8B;IAC9B,UAAU;IACV,2BAA2B;IAC3B,iBAAiB;CAClB,CAAC;AAIF
|
|
1
|
+
{"version":3,"file":"globUtils.js","sourceRoot":"","sources":["../src/globUtils.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rD,CAAC;IAED,OAAO,CAAC,gBAAwB,EAAE,EAAE,CAClC,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACnD,CAAC;AAtBD,sEAsBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/utils",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4834",
|
|
4
4
|
"description": "Node utility functions for Docusaurus packages.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/logger": "0.0.0-
|
|
21
|
+
"@docusaurus/logger": "0.0.0-4834",
|
|
22
22
|
"@svgr/webpack": "^6.2.1",
|
|
23
23
|
"file-loader": "^6.2.0",
|
|
24
24
|
"fs-extra": "^10.0.1",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"node": ">=14"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@docusaurus/types": "0.0.0-
|
|
41
|
+
"@docusaurus/types": "0.0.0-4834",
|
|
42
42
|
"@types/dedent": "^0.7.0",
|
|
43
43
|
"@types/github-slugger": "^1.3.0",
|
|
44
44
|
"@types/micromatch": "^4.0.2",
|
|
45
45
|
"@types/react-dom": "^17.0.14",
|
|
46
46
|
"dedent": "^0.7.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "1d9bc61905d4fa9b83867a74f78d59bb6cd95559"
|
|
49
49
|
}
|
package/src/globUtils.ts
CHANGED
|
@@ -31,11 +31,16 @@ type Matcher = (str: string) => boolean;
|
|
|
31
31
|
* A very thin wrapper around `Micromatch.makeRe`.
|
|
32
32
|
*
|
|
33
33
|
* @see {@link createAbsoluteFilePathMatcher}
|
|
34
|
-
* @param patterns A list of glob patterns.
|
|
34
|
+
* @param patterns A list of glob patterns. If the list is empty, it defaults to
|
|
35
|
+
* matching none.
|
|
35
36
|
* @returns A matcher handle that tells if a file path is matched by any of the
|
|
36
37
|
* patterns.
|
|
37
38
|
*/
|
|
38
39
|
export function createMatcher(patterns: string[]): Matcher {
|
|
40
|
+
if (patterns.length === 0) {
|
|
41
|
+
// `/(?:)/.test("foo")` is `true`
|
|
42
|
+
return () => false;
|
|
43
|
+
}
|
|
39
44
|
const regexp = new RegExp(
|
|
40
45
|
patterns.map((pattern) => Micromatch.makeRe(pattern).source).join('|'),
|
|
41
46
|
);
|