@docusaurus/plugin-content-docs 0.0.0-4525 → 0.0.0-4533

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/index.js CHANGED
@@ -214,7 +214,7 @@ async function pluginContentDocs(context, options) {
214
214
  function createMDXLoaderRule() {
215
215
  const contentDirs = versionsMetadata.flatMap(versions_1.getDocsDirPaths);
216
216
  return {
217
- test: /(\.mdx?)$/,
217
+ test: /\.mdx?$/i,
218
218
  include: contentDirs
219
219
  // Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
220
220
  .map(utils_1.addTrailingPathSeparator),
package/lib/lastUpdate.js CHANGED
@@ -10,20 +10,21 @@ exports.getFileLastUpdate = void 0;
10
10
  const tslib_1 = require("tslib");
11
11
  const shelljs_1 = (0, tslib_1.__importDefault)(require("shelljs"));
12
12
  const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
13
- const GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX = /^(\d+),(.+)$/;
13
+ const GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX = /^(?<timestamp>\d+),(?<author>.+)$/;
14
14
  let showedGitRequirementError = false;
15
15
  async function getFileLastUpdate(filePath) {
16
16
  if (!filePath) {
17
17
  return null;
18
18
  }
19
19
  function getTimestampAndAuthor(str) {
20
+ var _a;
20
21
  if (!str) {
21
22
  return null;
22
23
  }
23
- const temp = str.match(GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX);
24
- return !temp || temp.length < 3
25
- ? null
26
- : { timestamp: +temp[1], author: temp[2] };
24
+ const temp = (_a = str.match(GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX)) === null || _a === void 0 ? void 0 : _a.groups;
25
+ return temp
26
+ ? { timestamp: Number(temp.timestamp), author: temp.author }
27
+ : null;
27
28
  }
28
29
  // Wrap in try/catch in case the shell commands fail
29
30
  // (e.g. project doesn't use Git, etc).
@@ -10,13 +10,13 @@ exports.stripPathNumberPrefixes = exports.stripNumberPrefix = exports.DisabledNu
10
10
  // Best-effort to avoid parsing some patterns as number prefix
11
11
  const IgnoredPrefixPatterns = (() => {
12
12
  // ignore common date-like patterns: https://github.com/facebook/docusaurus/issues/4640
13
- const DateLikePrefixRegex = /^((\d{2}|\d{4})[-_.]\d{2}([-_.](\d{2}|\d{4}))?)(.*)$/;
13
+ const DateLikePrefixRegex = /^(?:\d{2}|\d{4})[-_.]\d{2}(?:[-_.](?:\d{2}|\d{4}))?.*$/;
14
14
  // ignore common versioning patterns: https://github.com/facebook/docusaurus/issues/4653
15
15
  // note: we could try to parse float numbers in filenames but that is
16
16
  // probably not worth it as a version such as "8.0" can be interpreted as both
17
17
  // a version and a float. User can configure her own NumberPrefixParser if
18
18
  // she wants 8.0 to be interpreted as a float
19
- const VersionLikePrefixRegex = /^(\d+[-_.]\d+)(.*)$/;
19
+ const VersionLikePrefixRegex = /^\d+[-_.]\d+.*$/;
20
20
  return new RegExp(`${DateLikePrefixRegex.source}|${VersionLikePrefixRegex.source}`);
21
21
  })();
22
22
  const NumberPrefixRegex = /^(?<numberPrefix>\d+)(?<separator>\s*[-_.]+\s*)(?<suffix>.*)$/;
@@ -20,7 +20,7 @@ const sidebarItemAutogeneratedSchema = sidebarItemBaseSchema.append({
20
20
  type: 'autogenerated',
21
21
  dirName: utils_validation_1.Joi.string()
22
22
  .required()
23
- .pattern(/^[^/](.*[^/])?$/)
23
+ .pattern(/^[^/](?:.*[^/])?$/)
24
24
  .message('"dirName" must be a dir path relative to the docs folder root, and should not start or end with slash'),
25
25
  });
26
26
  const sidebarItemDocSchema = sidebarItemBaseSchema.append({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-docs",
3
- "version": "0.0.0-4525",
3
+ "version": "0.0.0-4533",
4
4
  "description": "Docs plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@docusaurus/core": "0.0.0-4525",
26
- "@docusaurus/logger": "0.0.0-4525",
27
- "@docusaurus/mdx-loader": "0.0.0-4525",
28
- "@docusaurus/utils": "0.0.0-4525",
29
- "@docusaurus/utils-validation": "0.0.0-4525",
25
+ "@docusaurus/core": "0.0.0-4533",
26
+ "@docusaurus/logger": "0.0.0-4533",
27
+ "@docusaurus/mdx-loader": "0.0.0-4533",
28
+ "@docusaurus/utils": "0.0.0-4533",
29
+ "@docusaurus/utils-validation": "0.0.0-4533",
30
30
  "combine-promises": "^1.1.0",
31
31
  "fs-extra": "^10.0.0",
32
32
  "import-fresh": "^3.2.2",
@@ -36,11 +36,11 @@
36
36
  "shelljs": "^0.8.4",
37
37
  "tslib": "^2.3.1",
38
38
  "utility-types": "^3.10.0",
39
- "webpack": "^5.61.0"
39
+ "webpack": "^5.68.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@docusaurus/module-type-aliases": "0.0.0-4525",
43
- "@docusaurus/types": "0.0.0-4525",
42
+ "@docusaurus/module-type-aliases": "0.0.0-4533",
43
+ "@docusaurus/types": "0.0.0-4533",
44
44
  "@types/js-yaml": "^4.0.0",
45
45
  "@types/picomatch": "^2.2.1",
46
46
  "commander": "^5.1.0",
@@ -56,5 +56,5 @@
56
56
  "engines": {
57
57
  "node": ">=14"
58
58
  },
59
- "gitHead": "c1122ee21d114f85261bed9b8296ab3501454098"
59
+ "gitHead": "5ab127cc566e3d1af8653a162eafbfbd64d0764e"
60
60
  }
package/src/index.ts CHANGED
@@ -333,7 +333,7 @@ export default async function pluginContentDocs(
333
333
  function createMDXLoaderRule(): RuleSetRule {
334
334
  const contentDirs = versionsMetadata.flatMap(getDocsDirPaths);
335
335
  return {
336
- test: /(\.mdx?)$/,
336
+ test: /\.mdx?$/i,
337
337
  include: contentDirs
338
338
  // Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
339
339
  .map(addTrailingPathSeparator),
package/src/lastUpdate.ts CHANGED
@@ -10,7 +10,7 @@ import logger from '@docusaurus/logger';
10
10
 
11
11
  type FileLastUpdateData = {timestamp?: number; author?: string};
12
12
 
13
- const GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX = /^(\d+),(.+)$/;
13
+ const GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX = /^(?<timestamp>\d+),(?<author>.+)$/;
14
14
 
15
15
  let showedGitRequirementError = false;
16
16
 
@@ -25,10 +25,10 @@ export async function getFileLastUpdate(
25
25
  return null;
26
26
  }
27
27
 
28
- const temp = str.match(GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX);
29
- return !temp || temp.length < 3
30
- ? null
31
- : {timestamp: +temp[1], author: temp[2]};
28
+ const temp = str.match(GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX)?.groups;
29
+ return temp
30
+ ? {timestamp: Number(temp.timestamp), author: temp.author}
31
+ : null;
32
32
  }
33
33
 
34
34
  // Wrap in try/catch in case the shell commands fail
@@ -11,14 +11,14 @@ import type {NumberPrefixParser} from '@docusaurus/plugin-content-docs';
11
11
  const IgnoredPrefixPatterns = (() => {
12
12
  // ignore common date-like patterns: https://github.com/facebook/docusaurus/issues/4640
13
13
  const DateLikePrefixRegex =
14
- /^((\d{2}|\d{4})[-_.]\d{2}([-_.](\d{2}|\d{4}))?)(.*)$/;
14
+ /^(?:\d{2}|\d{4})[-_.]\d{2}(?:[-_.](?:\d{2}|\d{4}))?.*$/;
15
15
 
16
16
  // ignore common versioning patterns: https://github.com/facebook/docusaurus/issues/4653
17
17
  // note: we could try to parse float numbers in filenames but that is
18
18
  // probably not worth it as a version such as "8.0" can be interpreted as both
19
19
  // a version and a float. User can configure her own NumberPrefixParser if
20
20
  // she wants 8.0 to be interpreted as a float
21
- const VersionLikePrefixRegex = /^(\d+[-_.]\d+)(.*)$/;
21
+ const VersionLikePrefixRegex = /^\d+[-_.]\d+.*$/;
22
22
 
23
23
  return new RegExp(
24
24
  `${DateLikePrefixRegex.source}|${VersionLikePrefixRegex.source}`,
@@ -36,7 +36,7 @@ const sidebarItemAutogeneratedSchema =
36
36
  type: 'autogenerated',
37
37
  dirName: Joi.string()
38
38
  .required()
39
- .pattern(/^[^/](.*[^/])?$/)
39
+ .pattern(/^[^/](?:.*[^/])?$/)
40
40
  .message(
41
41
  '"dirName" must be a dir path relative to the docs folder root, and should not start or end with slash',
42
42
  ),