@docusaurus/utils 3.10.2 → 4.0.0-canary-6809
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/constants.js +1 -1
- package/lib/constants.js.map +1 -1
- package/lib/contentVisibilityUtils.js +1 -1
- package/lib/contentVisibilityUtils.js.map +1 -1
- package/lib/dataFileUtils.js.map +1 -1
- package/lib/emitUtils.js.map +1 -1
- package/lib/globUtils.d.ts +5 -3
- package/lib/globUtils.d.ts.map +1 -1
- package/lib/globUtils.js +9 -4
- package/lib/globUtils.js.map +1 -1
- package/lib/hashUtils.js.map +1 -1
- package/lib/i18nUtils.js.map +1 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -10
- package/lib/index.js.map +1 -1
- package/lib/jsUtils.js.map +1 -1
- package/lib/lastUpdateUtils.js +2 -2
- package/lib/lastUpdateUtils.js.map +1 -1
- package/lib/markdownHeadingIdUtils.js.map +1 -1
- package/lib/markdownLinks.js +1 -1
- package/lib/markdownLinks.js.map +1 -1
- package/lib/markdownUtils.d.ts.map +1 -1
- package/lib/markdownUtils.js +58 -20
- package/lib/markdownUtils.js.map +1 -1
- package/lib/moduleUtils.d.ts +3 -1
- package/lib/moduleUtils.d.ts.map +1 -1
- package/lib/moduleUtils.js +25 -14
- package/lib/moduleUtils.js.map +1 -1
- package/lib/pathUtils.d.ts.map +1 -1
- package/lib/pathUtils.js.map +1 -1
- package/lib/routeUtils.js.map +1 -1
- package/lib/slugger.js.map +1 -1
- package/lib/tags.js.map +1 -1
- package/lib/urlUtils.d.ts +3 -3
- package/lib/urlUtils.d.ts.map +1 -1
- package/lib/urlUtils.js +20 -25
- package/lib/urlUtils.js.map +1 -1
- package/lib/vcs/gitUtils.d.ts.map +1 -1
- package/lib/vcs/gitUtils.js +27 -60
- package/lib/vcs/gitUtils.js.map +1 -1
- package/lib/vcs/vcs.js.map +1 -1
- package/lib/vcs/vcsGitEager.d.ts.map +1 -1
- package/lib/vcs/vcsGitEager.js +3 -2
- package/lib/vcs/vcsGitEager.js.map +1 -1
- package/lib/vcs/vcsHardcoded.js.map +1 -1
- package/lib/webpackUtils.d.ts.map +1 -1
- package/lib/webpackUtils.js +0 -1
- package/lib/webpackUtils.js.map +1 -1
- package/package.json +23 -25
- package/src/constants.ts +1 -1
- package/src/contentVisibilityUtils.ts +1 -1
- package/src/dataFileUtils.ts +1 -1
- package/src/globUtils.ts +10 -4
- package/src/index.ts +0 -8
- package/src/lastUpdateUtils.ts +2 -2
- package/src/markdownHeadingIdUtils.ts +2 -2
- package/src/markdownLinks.ts +1 -1
- package/src/markdownUtils.ts +83 -20
- package/src/moduleUtils.ts +35 -14
- package/src/urlUtils.ts +25 -29
- package/src/vcs/gitUtils.ts +34 -91
- package/src/vcs/vcsGitEager.ts +4 -2
- package/src/webpackUtils.ts +0 -1
- package/lib/regExpUtils.d.ts +0 -8
- package/lib/regExpUtils.d.ts.map +0 -1
- package/lib/regExpUtils.js +0 -15
- package/lib/regExpUtils.js.map +0 -1
- package/src/regExpUtils.ts +0 -12
package/src/vcs/vcsGitEager.ts
CHANGED
|
@@ -56,6 +56,7 @@ type InitializeResult =
|
|
|
56
56
|
| {
|
|
57
57
|
type: 'success';
|
|
58
58
|
filesMap: GitFileInfoMap;
|
|
59
|
+
siteDir: string;
|
|
59
60
|
}
|
|
60
61
|
| {
|
|
61
62
|
type: 'error';
|
|
@@ -74,7 +75,7 @@ async function initialize({
|
|
|
74
75
|
return {type: 'error', reason: 'not-in-worktree'};
|
|
75
76
|
}
|
|
76
77
|
const filesMap = await loadAllGitFilesInfoMap(siteDir);
|
|
77
|
-
return {type: 'success', filesMap};
|
|
78
|
+
return {type: 'success', filesMap, siteDir};
|
|
78
79
|
} catch (error) {
|
|
79
80
|
return {type: 'error', reason: 'unknown', cause: error as Error};
|
|
80
81
|
}
|
|
@@ -86,7 +87,8 @@ export function createVcsGitEagerConfig(): VcsConfig {
|
|
|
86
87
|
async function getGitFileInfo(filePath: string): Promise<GitFileInfo | null> {
|
|
87
88
|
const init = (await initPromise)!;
|
|
88
89
|
if (init.type === 'success') {
|
|
89
|
-
|
|
90
|
+
const key = resolve(init.siteDir, filePath);
|
|
91
|
+
return init.filesMap.get(key) ?? null;
|
|
90
92
|
} else if (init.reason === 'not-in-worktree') {
|
|
91
93
|
throw new Error(
|
|
92
94
|
`This Docusaurus site is outside any Git worktree.
|
package/src/webpackUtils.ts
CHANGED
|
@@ -18,7 +18,6 @@ export type WebpackCompilerName = 'server' | 'client';
|
|
|
18
18
|
export function getWebpackLoaderCompilerName(
|
|
19
19
|
context: LoaderContext<unknown>,
|
|
20
20
|
): WebpackCompilerName {
|
|
21
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
22
21
|
const compilerName = context._compiler?.name;
|
|
23
22
|
switch (compilerName) {
|
|
24
23
|
case 'server':
|
package/lib/regExpUtils.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
export declare function escapeRegexp(string: string): string;
|
|
8
|
-
//# sourceMappingURL=regExpUtils.d.ts.map
|
package/lib/regExpUtils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"regExpUtils.d.ts","sourceRoot":"","sources":["../src/regExpUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
package/lib/regExpUtils.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.escapeRegexp = escapeRegexp;
|
|
10
|
-
const tslib_1 = require("tslib");
|
|
11
|
-
const escape_string_regexp_1 = tslib_1.__importDefault(require("escape-string-regexp"));
|
|
12
|
-
function escapeRegexp(string) {
|
|
13
|
-
return (0, escape_string_regexp_1.default)(string);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=regExpUtils.js.map
|
package/lib/regExpUtils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"regExpUtils.js","sourceRoot":"","sources":["../src/regExpUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAIH,oCAEC;;AAJD,wFAAsD;AAEtD,SAAgB,YAAY,CAAC,MAAc;IACzC,OAAO,IAAA,8BAAkB,EAAC,MAAM,CAAC,CAAC;AACpC,CAAC"}
|
package/src/regExpUtils.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import escapeStringRegexp from 'escape-string-regexp';
|
|
9
|
-
|
|
10
|
-
export function escapeRegexp(string: string): string {
|
|
11
|
-
return escapeStringRegexp(string);
|
|
12
|
-
}
|