@docusaurus/plugin-content-blog 0.0.0-4307 → 0.0.0-4315
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.d.ts +1 -1
- package/lib/index.js +8 -7
- package/package.json +8 -8
- package/src/index.ts +12 -12
package/lib/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { PluginOptions, BlogContent } from './types';
|
|
8
8
|
import { LoadContext, Plugin, OptionValidationContext, ValidationResult } from '@docusaurus/types';
|
|
9
|
-
export default function pluginContentBlog(context: LoadContext, options: PluginOptions): Plugin<BlogContent
|
|
9
|
+
export default function pluginContentBlog(context: LoadContext, options: PluginOptions): Promise<Plugin<BlogContent>>;
|
|
10
10
|
export declare function validateOptions({ validate, options, }: OptionValidationContext<PluginOptions>): ValidationResult<PluginOptions>;
|
package/lib/index.js
CHANGED
|
@@ -15,7 +15,8 @@ const translations_1 = require("./translations");
|
|
|
15
15
|
const pluginOptionSchema_1 = require("./pluginOptionSchema");
|
|
16
16
|
const blogUtils_1 = require("./blogUtils");
|
|
17
17
|
const feed_1 = require("./feed");
|
|
18
|
-
|
|
18
|
+
const authors_1 = require("./authors");
|
|
19
|
+
async function pluginContentBlog(context, options) {
|
|
19
20
|
var _a;
|
|
20
21
|
if (options.admonitions) {
|
|
21
22
|
options.remarkPlugins = options.remarkPlugins.concat([
|
|
@@ -37,16 +38,16 @@ function pluginContentBlog(context, options) {
|
|
|
37
38
|
const pluginDataDirRoot = path_1.default.join(generatedFilesDir, 'docusaurus-plugin-content-blog');
|
|
38
39
|
const dataDir = path_1.default.join(pluginDataDirRoot, pluginId);
|
|
39
40
|
const aliasedSource = (source) => `~blog/${(0, utils_1.posixPath)(path_1.default.relative(pluginDataDirRoot, source))}`;
|
|
41
|
+
const authorsMapFilePath = await (0, authors_1.getAuthorsMapFilePath)({
|
|
42
|
+
authorsMapPath: options.authorsMapPath,
|
|
43
|
+
contentPaths,
|
|
44
|
+
});
|
|
40
45
|
return {
|
|
41
46
|
name: 'docusaurus-plugin-content-blog',
|
|
42
47
|
getPathsToWatch() {
|
|
43
|
-
const { include
|
|
48
|
+
const { include } = options;
|
|
44
49
|
const contentMarkdownGlobs = (0, blogUtils_1.getContentPathList)(contentPaths).flatMap((contentPath) => include.map((pattern) => `${contentPath}/${pattern}`));
|
|
45
|
-
|
|
46
|
-
// const authorsMapFilePath = await getAuthorsMapFilePath({authorsMapPath,contentPaths,});
|
|
47
|
-
// simplified impl, better than nothing for now:
|
|
48
|
-
const authorsMapFilePath = path_1.default.join(contentPaths.contentPath, authorsMapPath);
|
|
49
|
-
return [authorsMapFilePath, ...contentMarkdownGlobs];
|
|
50
|
+
return [authorsMapFilePath, ...contentMarkdownGlobs].filter(Boolean);
|
|
50
51
|
},
|
|
51
52
|
async getTranslationFiles() {
|
|
52
53
|
return (0, translations_1.getTranslationFiles)(options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-blog",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4315",
|
|
4
4
|
"description": "Blog plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-blog.d.ts",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "0.0.0-
|
|
22
|
-
"@docusaurus/logger": "0.0.0-
|
|
23
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
24
|
-
"@docusaurus/utils": "0.0.0-
|
|
25
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
21
|
+
"@docusaurus/core": "0.0.0-4315",
|
|
22
|
+
"@docusaurus/logger": "0.0.0-4315",
|
|
23
|
+
"@docusaurus/mdx-loader": "0.0.0-4315",
|
|
24
|
+
"@docusaurus/utils": "0.0.0-4315",
|
|
25
|
+
"@docusaurus/utils-validation": "0.0.0-4315",
|
|
26
26
|
"escape-string-regexp": "^4.0.0",
|
|
27
27
|
"feed": "^4.2.2",
|
|
28
28
|
"fs-extra": "^10.0.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"webpack": "^5.61.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@docusaurus/types": "0.0.0-
|
|
40
|
+
"@docusaurus/types": "0.0.0-4315"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": "^16.8.4 || ^17.0.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=14"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "74ad9e9368fb6683a9494d7157f79df21cc5ee25"
|
|
50
50
|
}
|
package/src/index.ts
CHANGED
|
@@ -51,11 +51,12 @@ import {
|
|
|
51
51
|
} from './blogUtils';
|
|
52
52
|
import {BlogPostFrontMatter} from './blogFrontMatter';
|
|
53
53
|
import {createBlogFeedFiles} from './feed';
|
|
54
|
+
import {getAuthorsMapFilePath} from './authors';
|
|
54
55
|
|
|
55
|
-
export default function pluginContentBlog(
|
|
56
|
+
export default async function pluginContentBlog(
|
|
56
57
|
context: LoadContext,
|
|
57
58
|
options: PluginOptions,
|
|
58
|
-
): Plugin<BlogContent
|
|
59
|
+
): Promise<Plugin<BlogContent>> {
|
|
59
60
|
if (options.admonitions) {
|
|
60
61
|
options.remarkPlugins = options.remarkPlugins.concat([
|
|
61
62
|
[admonitions, options.admonitions],
|
|
@@ -89,24 +90,23 @@ export default function pluginContentBlog(
|
|
|
89
90
|
const aliasedSource = (source: string) =>
|
|
90
91
|
`~blog/${posixPath(path.relative(pluginDataDirRoot, source))}`;
|
|
91
92
|
|
|
93
|
+
const authorsMapFilePath = await getAuthorsMapFilePath({
|
|
94
|
+
authorsMapPath: options.authorsMapPath,
|
|
95
|
+
contentPaths,
|
|
96
|
+
});
|
|
97
|
+
|
|
92
98
|
return {
|
|
93
99
|
name: 'docusaurus-plugin-content-blog',
|
|
94
100
|
|
|
95
101
|
getPathsToWatch() {
|
|
96
|
-
const {include
|
|
102
|
+
const {include} = options;
|
|
97
103
|
const contentMarkdownGlobs = getContentPathList(contentPaths).flatMap(
|
|
98
104
|
(contentPath) => include.map((pattern) => `${contentPath}/${pattern}`),
|
|
99
105
|
);
|
|
100
106
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const authorsMapFilePath = path.join(
|
|
105
|
-
contentPaths.contentPath,
|
|
106
|
-
authorsMapPath,
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
return [authorsMapFilePath, ...contentMarkdownGlobs];
|
|
107
|
+
return [authorsMapFilePath, ...contentMarkdownGlobs].filter(
|
|
108
|
+
Boolean,
|
|
109
|
+
) as string[];
|
|
110
110
|
},
|
|
111
111
|
|
|
112
112
|
async getTranslationFiles() {
|