@docusaurus/plugin-content-docs 0.0.0-5088 → 0.0.0-5092

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/cli.js CHANGED
@@ -50,12 +50,14 @@ async function cliDocsVersionCommand(version, { id: pluginId, path: docsPath, si
50
50
  logger_1.default.info `Versioned docs will be created for the following locales: name=${i18n.locales}`;
51
51
  }
52
52
  await Promise.all(i18n.locales.map(async (locale) => {
53
+ // TODO duplicated logic from core, so duplicate comment as well: we need
54
+ // to support customization per-locale in the future
55
+ const localizationDir = path_1.default.resolve(siteDir, i18n.path, locale);
53
56
  // Copy docs files.
54
57
  const docsDir = locale === i18n.defaultLocale
55
58
  ? path_1.default.resolve(siteDir, docsPath)
56
59
  : (0, files_1.getDocsDirPathLocalized)({
57
- siteDir,
58
- locale,
60
+ localizationDir,
59
61
  pluginId,
60
62
  versionName: constants_1.CURRENT_VERSION_NAME,
61
63
  });
@@ -72,8 +74,7 @@ async function cliDocsVersionCommand(version, { id: pluginId, path: docsPath, si
72
74
  const newVersionDir = locale === i18n.defaultLocale
73
75
  ? (0, files_1.getVersionDocsDirPath)(siteDir, pluginId, version)
74
76
  : (0, files_1.getDocsDirPathLocalized)({
75
- siteDir,
76
- locale,
77
+ localizationDir,
77
78
  pluginId,
78
79
  versionName: version,
79
80
  });
@@ -10,9 +10,8 @@ import type { VersionContext } from './index';
10
10
  export declare function getVersionDocsDirPath(siteDir: string, pluginId: string, versionName: string): string;
11
11
  /** `[siteDir]/community_versioned_sidebars/version-1.0.0-sidebars.json` */
12
12
  export declare function getVersionSidebarsPath(siteDir: string, pluginId: string, versionName: string): string;
13
- export declare function getDocsDirPathLocalized({ siteDir, locale, pluginId, versionName, }: {
14
- siteDir: string;
15
- locale: string;
13
+ export declare function getDocsDirPathLocalized({ localizationDir, pluginId, versionName, }: {
14
+ localizationDir: string;
16
15
  pluginId: string;
17
16
  versionName: string;
18
17
  }): string;
@@ -29,10 +29,9 @@ function getVersionSidebarsPath(siteDir, pluginId, versionName) {
29
29
  return path_1.default.join(siteDir, addPluginIdPrefix(constants_1.VERSIONED_SIDEBARS_DIR, pluginId), `version-${versionName}-sidebars.json`);
30
30
  }
31
31
  exports.getVersionSidebarsPath = getVersionSidebarsPath;
32
- function getDocsDirPathLocalized({ siteDir, locale, pluginId, versionName, }) {
32
+ function getDocsDirPathLocalized({ localizationDir, pluginId, versionName, }) {
33
33
  return (0, utils_1.getPluginI18nPath)({
34
- siteDir,
35
- locale,
34
+ localizationDir,
36
35
  pluginName: 'docusaurus-plugin-content-docs',
37
36
  pluginId,
38
37
  subPaths: [
@@ -110,8 +109,7 @@ exports.readVersionNames = readVersionNames;
110
109
  async function getVersionMetadataPaths({ versionName, context, options, }) {
111
110
  const isCurrent = versionName === constants_1.CURRENT_VERSION_NAME;
112
111
  const contentPathLocalized = getDocsDirPathLocalized({
113
- siteDir: context.siteDir,
114
- locale: context.i18n.currentLocale,
112
+ localizationDir: context.localizationDir,
115
113
  pluginId: options.id,
116
114
  versionName,
117
115
  });
@@ -22,8 +22,7 @@ function getVersionEditUrls({ contentPath, contentPathLocalized, context, option
22
22
  const editDirPath = options.editCurrentVersion ? options.path : contentPath;
23
23
  const editDirPathLocalized = options.editCurrentVersion
24
24
  ? (0, files_1.getDocsDirPathLocalized)({
25
- siteDir: context.siteDir,
26
- locale: context.i18n.currentLocale,
25
+ localizationDir: context.localizationDir,
27
26
  versionName: constants_1.CURRENT_VERSION_NAME,
28
27
  pluginId: options.id,
29
28
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-docs",
3
- "version": "0.0.0-5088",
3
+ "version": "0.0.0-5092",
4
4
  "description": "Docs plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "sideEffects": false,
@@ -25,13 +25,13 @@
25
25
  },
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
- "@docusaurus/core": "0.0.0-5088",
29
- "@docusaurus/logger": "0.0.0-5088",
30
- "@docusaurus/mdx-loader": "0.0.0-5088",
31
- "@docusaurus/module-type-aliases": "0.0.0-5088",
32
- "@docusaurus/types": "0.0.0-5088",
33
- "@docusaurus/utils": "0.0.0-5088",
34
- "@docusaurus/utils-validation": "0.0.0-5088",
28
+ "@docusaurus/core": "0.0.0-5092",
29
+ "@docusaurus/logger": "0.0.0-5092",
30
+ "@docusaurus/mdx-loader": "0.0.0-5092",
31
+ "@docusaurus/module-type-aliases": "0.0.0-5092",
32
+ "@docusaurus/types": "0.0.0-5092",
33
+ "@docusaurus/utils": "0.0.0-5092",
34
+ "@docusaurus/utils-validation": "0.0.0-5092",
35
35
  "@types/react-router-config": "^5.0.6",
36
36
  "combine-promises": "^1.1.0",
37
37
  "fs-extra": "^10.1.0",
@@ -59,5 +59,5 @@
59
59
  "engines": {
60
60
  "node": ">=16.14"
61
61
  },
62
- "gitHead": "2bfdf449c6b02c743a32e46a285eca3072b999e5"
62
+ "gitHead": "c49187bfebd3f8692e0a0c5a77df884a1dbf2786"
63
63
  }
package/src/cli.ts CHANGED
@@ -85,13 +85,15 @@ export async function cliDocsVersionCommand(
85
85
 
86
86
  await Promise.all(
87
87
  i18n.locales.map(async (locale) => {
88
+ // TODO duplicated logic from core, so duplicate comment as well: we need
89
+ // to support customization per-locale in the future
90
+ const localizationDir = path.resolve(siteDir, i18n.path, locale);
88
91
  // Copy docs files.
89
92
  const docsDir =
90
93
  locale === i18n.defaultLocale
91
94
  ? path.resolve(siteDir, docsPath)
92
95
  : getDocsDirPathLocalized({
93
- siteDir,
94
- locale,
96
+ localizationDir,
95
97
  pluginId,
96
98
  versionName: CURRENT_VERSION_NAME,
97
99
  });
@@ -114,8 +116,7 @@ export async function cliDocsVersionCommand(
114
116
  locale === i18n.defaultLocale
115
117
  ? getVersionDocsDirPath(siteDir, pluginId, version)
116
118
  : getDocsDirPathLocalized({
117
- siteDir,
118
- locale,
119
+ localizationDir,
119
120
  pluginId,
120
121
  versionName: version,
121
122
  });
@@ -55,19 +55,16 @@ export function getVersionSidebarsPath(
55
55
  }
56
56
 
57
57
  export function getDocsDirPathLocalized({
58
- siteDir,
59
- locale,
58
+ localizationDir,
60
59
  pluginId,
61
60
  versionName,
62
61
  }: {
63
- siteDir: string;
64
- locale: string;
62
+ localizationDir: string;
65
63
  pluginId: string;
66
64
  versionName: string;
67
65
  }): string {
68
66
  return getPluginI18nPath({
69
- siteDir,
70
- locale,
67
+ localizationDir,
71
68
  pluginName: 'docusaurus-plugin-content-docs',
72
69
  pluginId,
73
70
  subPaths: [
@@ -175,8 +172,7 @@ export async function getVersionMetadataPaths({
175
172
  > {
176
173
  const isCurrent = versionName === CURRENT_VERSION_NAME;
177
174
  const contentPathLocalized = getDocsDirPathLocalized({
178
- siteDir: context.siteDir,
179
- locale: context.i18n.currentLocale,
175
+ localizationDir: context.localizationDir,
180
176
  pluginId: options.id,
181
177
  versionName,
182
178
  });
@@ -49,8 +49,7 @@ function getVersionEditUrls({
49
49
  const editDirPath = options.editCurrentVersion ? options.path : contentPath;
50
50
  const editDirPathLocalized = options.editCurrentVersion
51
51
  ? getDocsDirPathLocalized({
52
- siteDir: context.siteDir,
53
- locale: context.i18n.currentLocale,
52
+ localizationDir: context.localizationDir,
54
53
  versionName: CURRENT_VERSION_NAME,
55
54
  pluginId: options.id,
56
55
  })