@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.
Files changed (69) hide show
  1. package/lib/constants.js +1 -1
  2. package/lib/constants.js.map +1 -1
  3. package/lib/contentVisibilityUtils.js +1 -1
  4. package/lib/contentVisibilityUtils.js.map +1 -1
  5. package/lib/dataFileUtils.js.map +1 -1
  6. package/lib/emitUtils.js.map +1 -1
  7. package/lib/globUtils.d.ts +5 -3
  8. package/lib/globUtils.d.ts.map +1 -1
  9. package/lib/globUtils.js +9 -4
  10. package/lib/globUtils.js.map +1 -1
  11. package/lib/hashUtils.js.map +1 -1
  12. package/lib/i18nUtils.js.map +1 -1
  13. package/lib/index.d.ts +0 -2
  14. package/lib/index.d.ts.map +1 -1
  15. package/lib/index.js +2 -10
  16. package/lib/index.js.map +1 -1
  17. package/lib/jsUtils.js.map +1 -1
  18. package/lib/lastUpdateUtils.js +2 -2
  19. package/lib/lastUpdateUtils.js.map +1 -1
  20. package/lib/markdownHeadingIdUtils.js.map +1 -1
  21. package/lib/markdownLinks.js +1 -1
  22. package/lib/markdownLinks.js.map +1 -1
  23. package/lib/markdownUtils.d.ts.map +1 -1
  24. package/lib/markdownUtils.js +58 -20
  25. package/lib/markdownUtils.js.map +1 -1
  26. package/lib/moduleUtils.d.ts +3 -1
  27. package/lib/moduleUtils.d.ts.map +1 -1
  28. package/lib/moduleUtils.js +25 -14
  29. package/lib/moduleUtils.js.map +1 -1
  30. package/lib/pathUtils.d.ts.map +1 -1
  31. package/lib/pathUtils.js.map +1 -1
  32. package/lib/routeUtils.js.map +1 -1
  33. package/lib/slugger.js.map +1 -1
  34. package/lib/tags.js.map +1 -1
  35. package/lib/urlUtils.d.ts +3 -3
  36. package/lib/urlUtils.d.ts.map +1 -1
  37. package/lib/urlUtils.js +20 -25
  38. package/lib/urlUtils.js.map +1 -1
  39. package/lib/vcs/gitUtils.d.ts.map +1 -1
  40. package/lib/vcs/gitUtils.js +27 -60
  41. package/lib/vcs/gitUtils.js.map +1 -1
  42. package/lib/vcs/vcs.js.map +1 -1
  43. package/lib/vcs/vcsGitEager.d.ts.map +1 -1
  44. package/lib/vcs/vcsGitEager.js +3 -2
  45. package/lib/vcs/vcsGitEager.js.map +1 -1
  46. package/lib/vcs/vcsHardcoded.js.map +1 -1
  47. package/lib/webpackUtils.d.ts.map +1 -1
  48. package/lib/webpackUtils.js +0 -1
  49. package/lib/webpackUtils.js.map +1 -1
  50. package/package.json +23 -25
  51. package/src/constants.ts +1 -1
  52. package/src/contentVisibilityUtils.ts +1 -1
  53. package/src/dataFileUtils.ts +1 -1
  54. package/src/globUtils.ts +10 -4
  55. package/src/index.ts +0 -8
  56. package/src/lastUpdateUtils.ts +2 -2
  57. package/src/markdownHeadingIdUtils.ts +2 -2
  58. package/src/markdownLinks.ts +1 -1
  59. package/src/markdownUtils.ts +83 -20
  60. package/src/moduleUtils.ts +35 -14
  61. package/src/urlUtils.ts +25 -29
  62. package/src/vcs/gitUtils.ts +34 -91
  63. package/src/vcs/vcsGitEager.ts +4 -2
  64. package/src/webpackUtils.ts +0 -1
  65. package/lib/regExpUtils.d.ts +0 -8
  66. package/lib/regExpUtils.d.ts.map +0 -1
  67. package/lib/regExpUtils.js +0 -15
  68. package/lib/regExpUtils.js.map +0 -1
  69. package/src/regExpUtils.ts +0 -12
@@ -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
- return init.filesMap.get(filePath) ?? null;
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.
@@ -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':
@@ -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
@@ -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"}
@@ -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
@@ -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"}
@@ -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
- }