@docusaurus/plugin-content-docs 0.0.0-5089 → 0.0.0-5093
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 +5 -4
- package/lib/index.js +1 -0
- package/lib/options.js +2 -10
- package/lib/versions/files.d.ts +2 -3
- package/lib/versions/files.js +3 -5
- package/lib/versions/index.js +1 -2
- package/package.json +9 -10
- package/src/cli.ts +5 -4
- package/src/index.ts +1 -0
- package/src/options.ts +2 -11
- package/src/plugin-content-docs.d.ts +0 -1
- package/src/versions/files.ts +4 -8
- package/src/versions/index.ts +1 -2
- package/src/deps.d.ts +0 -13
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
|
-
|
|
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
|
-
|
|
76
|
-
locale,
|
|
77
|
+
localizationDir,
|
|
77
78
|
pluginId,
|
|
78
79
|
versionName: version,
|
|
79
80
|
});
|
package/lib/index.js
CHANGED
package/lib/options.js
CHANGED
|
@@ -11,7 +11,6 @@ const tslib_1 = require("tslib");
|
|
|
11
11
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
12
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
13
13
|
const utils_1 = require("@docusaurus/utils");
|
|
14
|
-
const remark_admonitions_1 = tslib_1.__importDefault(require("remark-admonitions"));
|
|
15
14
|
const generator_1 = require("./sidebars/generator");
|
|
16
15
|
const numberPrefix_1 = require("./numberPrefix");
|
|
17
16
|
exports.DEFAULT_OPTIONS = {
|
|
@@ -33,7 +32,7 @@ exports.DEFAULT_OPTIONS = {
|
|
|
33
32
|
beforeDefaultRehypePlugins: [],
|
|
34
33
|
showLastUpdateTime: false,
|
|
35
34
|
showLastUpdateAuthor: false,
|
|
36
|
-
admonitions:
|
|
35
|
+
admonitions: true,
|
|
37
36
|
includeCurrentVersion: true,
|
|
38
37
|
disableVersioning: false,
|
|
39
38
|
lastVersion: undefined,
|
|
@@ -90,9 +89,7 @@ const OptionsSchema = utils_validation_1.Joi.object({
|
|
|
90
89
|
rehypePlugins: utils_validation_1.RehypePluginsSchema.default(exports.DEFAULT_OPTIONS.rehypePlugins),
|
|
91
90
|
beforeDefaultRemarkPlugins: utils_validation_1.RemarkPluginsSchema.default(exports.DEFAULT_OPTIONS.beforeDefaultRemarkPlugins),
|
|
92
91
|
beforeDefaultRehypePlugins: utils_validation_1.RehypePluginsSchema.default(exports.DEFAULT_OPTIONS.beforeDefaultRehypePlugins),
|
|
93
|
-
admonitions: utils_validation_1.
|
|
94
|
-
.try(utils_validation_1.AdmonitionsSchema, utils_validation_1.Joi.boolean().invalid(true))
|
|
95
|
-
.default(exports.DEFAULT_OPTIONS.admonitions),
|
|
92
|
+
admonitions: utils_validation_1.AdmonitionsSchema.default(exports.DEFAULT_OPTIONS.admonitions),
|
|
96
93
|
showLastUpdateTime: utils_validation_1.Joi.bool().default(exports.DEFAULT_OPTIONS.showLastUpdateTime),
|
|
97
94
|
showLastUpdateAuthor: utils_validation_1.Joi.bool().default(exports.DEFAULT_OPTIONS.showLastUpdateAuthor),
|
|
98
95
|
includeCurrentVersion: utils_validation_1.Joi.bool().default(exports.DEFAULT_OPTIONS.includeCurrentVersion),
|
|
@@ -123,11 +120,6 @@ function validateOptions({ validate, options: userOptions, }) {
|
|
|
123
120
|
}
|
|
124
121
|
}
|
|
125
122
|
const normalizedOptions = validate(OptionsSchema, options);
|
|
126
|
-
if (normalizedOptions.admonitions) {
|
|
127
|
-
normalizedOptions.remarkPlugins = normalizedOptions.remarkPlugins.concat([
|
|
128
|
-
[remark_admonitions_1.default, normalizedOptions.admonitions],
|
|
129
|
-
]);
|
|
130
|
-
}
|
|
131
123
|
return normalizedOptions;
|
|
132
124
|
}
|
|
133
125
|
exports.validateOptions = validateOptions;
|
package/lib/versions/files.d.ts
CHANGED
|
@@ -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({
|
|
14
|
-
|
|
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;
|
package/lib/versions/files.js
CHANGED
|
@@ -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({
|
|
32
|
+
function getDocsDirPathLocalized({ localizationDir, pluginId, versionName, }) {
|
|
33
33
|
return (0, utils_1.getPluginI18nPath)({
|
|
34
|
-
|
|
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
|
-
|
|
114
|
-
locale: context.i18n.currentLocale,
|
|
112
|
+
localizationDir: context.localizationDir,
|
|
115
113
|
pluginId: options.id,
|
|
116
114
|
versionName,
|
|
117
115
|
});
|
package/lib/versions/index.js
CHANGED
|
@@ -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
|
-
|
|
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-
|
|
3
|
+
"version": "0.0.0-5093",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,20 +25,19 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@docusaurus/core": "0.0.0-
|
|
29
|
-
"@docusaurus/logger": "0.0.0-
|
|
30
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
31
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
32
|
-
"@docusaurus/types": "0.0.0-
|
|
33
|
-
"@docusaurus/utils": "0.0.0-
|
|
34
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
28
|
+
"@docusaurus/core": "0.0.0-5093",
|
|
29
|
+
"@docusaurus/logger": "0.0.0-5093",
|
|
30
|
+
"@docusaurus/mdx-loader": "0.0.0-5093",
|
|
31
|
+
"@docusaurus/module-type-aliases": "0.0.0-5093",
|
|
32
|
+
"@docusaurus/types": "0.0.0-5093",
|
|
33
|
+
"@docusaurus/utils": "0.0.0-5093",
|
|
34
|
+
"@docusaurus/utils-validation": "0.0.0-5093",
|
|
35
35
|
"@types/react-router-config": "^5.0.6",
|
|
36
36
|
"combine-promises": "^1.1.0",
|
|
37
37
|
"fs-extra": "^10.1.0",
|
|
38
38
|
"import-fresh": "^3.3.0",
|
|
39
39
|
"js-yaml": "^4.1.0",
|
|
40
40
|
"lodash": "^4.17.21",
|
|
41
|
-
"remark-admonitions": "^1.2.1",
|
|
42
41
|
"tslib": "^2.4.0",
|
|
43
42
|
"utility-types": "^3.10.0",
|
|
44
43
|
"webpack": "^5.72.1"
|
|
@@ -59,5 +58,5 @@
|
|
|
59
58
|
"engines": {
|
|
60
59
|
"node": ">=16.14"
|
|
61
60
|
},
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "2aa3114f2c53ba37b785f22ac723059c7a4a75be"
|
|
63
62
|
}
|
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
|
-
|
|
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
|
-
|
|
118
|
-
locale,
|
|
119
|
+
localizationDir,
|
|
119
120
|
pluginId,
|
|
120
121
|
versionName: version,
|
|
121
122
|
});
|
package/src/index.ts
CHANGED
package/src/options.ts
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
URISchema,
|
|
15
15
|
} from '@docusaurus/utils-validation';
|
|
16
16
|
import {GlobExcludeDefault} from '@docusaurus/utils';
|
|
17
|
-
import admonitions from 'remark-admonitions';
|
|
18
17
|
import {DefaultSidebarItemsGenerator} from './sidebars/generator';
|
|
19
18
|
import {
|
|
20
19
|
DefaultNumberPrefixParser,
|
|
@@ -42,7 +41,7 @@ export const DEFAULT_OPTIONS: Omit<PluginOptions, 'id' | 'sidebarPath'> = {
|
|
|
42
41
|
beforeDefaultRehypePlugins: [],
|
|
43
42
|
showLastUpdateTime: false,
|
|
44
43
|
showLastUpdateAuthor: false,
|
|
45
|
-
admonitions:
|
|
44
|
+
admonitions: true,
|
|
46
45
|
includeCurrentVersion: true,
|
|
47
46
|
disableVersioning: false,
|
|
48
47
|
lastVersion: undefined,
|
|
@@ -123,9 +122,7 @@ const OptionsSchema = Joi.object<PluginOptions>({
|
|
|
123
122
|
beforeDefaultRehypePlugins: RehypePluginsSchema.default(
|
|
124
123
|
DEFAULT_OPTIONS.beforeDefaultRehypePlugins,
|
|
125
124
|
),
|
|
126
|
-
admonitions:
|
|
127
|
-
.try(AdmonitionsSchema, Joi.boolean().invalid(true))
|
|
128
|
-
.default(DEFAULT_OPTIONS.admonitions),
|
|
125
|
+
admonitions: AdmonitionsSchema.default(DEFAULT_OPTIONS.admonitions),
|
|
129
126
|
showLastUpdateTime: Joi.bool().default(DEFAULT_OPTIONS.showLastUpdateTime),
|
|
130
127
|
showLastUpdateAuthor: Joi.bool().default(
|
|
131
128
|
DEFAULT_OPTIONS.showLastUpdateAuthor,
|
|
@@ -167,11 +164,5 @@ export function validateOptions({
|
|
|
167
164
|
|
|
168
165
|
const normalizedOptions = validate(OptionsSchema, options);
|
|
169
166
|
|
|
170
|
-
if (normalizedOptions.admonitions) {
|
|
171
|
-
normalizedOptions.remarkPlugins = normalizedOptions.remarkPlugins.concat([
|
|
172
|
-
[admonitions, normalizedOptions.admonitions],
|
|
173
|
-
]);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
167
|
return normalizedOptions;
|
|
177
168
|
}
|
|
@@ -206,7 +206,6 @@ declare module '@docusaurus/plugin-content-docs' {
|
|
|
206
206
|
docTagsListComponent: string;
|
|
207
207
|
/** Root component of the generated category index page. */
|
|
208
208
|
docCategoryGeneratedIndexComponent: string;
|
|
209
|
-
admonitions: {[key: string]: unknown};
|
|
210
209
|
sidebarItemsGenerator: import('./sidebars/types').SidebarItemsGeneratorOption;
|
|
211
210
|
/**
|
|
212
211
|
* URL route for the tags section of your doc version. Will be appended to
|
package/src/versions/files.ts
CHANGED
|
@@ -55,19 +55,16 @@ export function getVersionSidebarsPath(
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export function getDocsDirPathLocalized({
|
|
58
|
-
|
|
59
|
-
locale,
|
|
58
|
+
localizationDir,
|
|
60
59
|
pluginId,
|
|
61
60
|
versionName,
|
|
62
61
|
}: {
|
|
63
|
-
|
|
64
|
-
locale: string;
|
|
62
|
+
localizationDir: string;
|
|
65
63
|
pluginId: string;
|
|
66
64
|
versionName: string;
|
|
67
65
|
}): string {
|
|
68
66
|
return getPluginI18nPath({
|
|
69
|
-
|
|
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
|
-
|
|
179
|
-
locale: context.i18n.currentLocale,
|
|
175
|
+
localizationDir: context.localizationDir,
|
|
180
176
|
pluginId: options.id,
|
|
181
177
|
versionName,
|
|
182
178
|
});
|
package/src/versions/index.ts
CHANGED
|
@@ -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
|
-
|
|
53
|
-
locale: context.i18n.currentLocale,
|
|
52
|
+
localizationDir: context.localizationDir,
|
|
54
53
|
versionName: CURRENT_VERSION_NAME,
|
|
55
54
|
pluginId: options.id,
|
|
56
55
|
})
|
package/src/deps.d.ts
DELETED
|
@@ -1,13 +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
|
-
declare module 'remark-admonitions' {
|
|
9
|
-
type Options = {[key: string]: unknown};
|
|
10
|
-
|
|
11
|
-
const plugin: (options?: Options) => void;
|
|
12
|
-
export = plugin;
|
|
13
|
-
}
|