@docusaurus/plugin-content-blog 0.0.0-4470 → 0.0.0-4479
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/authors.js +5 -5
- package/lib/blogFrontMatter.js +2 -2
- package/package.json +8 -8
- package/src/authors.ts +5 -5
- package/src/blogFrontMatter.ts +3 -3
- package/src/plugin-content-blog.d.ts +2 -2
package/lib/authors.js
CHANGED
|
@@ -31,7 +31,7 @@ async function getAuthorsMap(params) {
|
|
|
31
31
|
}, validateAuthorsMap);
|
|
32
32
|
}
|
|
33
33
|
exports.getAuthorsMap = getAuthorsMap;
|
|
34
|
-
// Legacy v1/early-v2
|
|
34
|
+
// Legacy v1/early-v2 front matter fields
|
|
35
35
|
// We may want to deprecate those in favor of using only frontMatter.authors
|
|
36
36
|
function getFrontMatterAuthorLegacy(frontMatter) {
|
|
37
37
|
var _a, _b, _c;
|
|
@@ -86,7 +86,7 @@ ${Object.keys(authorsMap)
|
|
|
86
86
|
}
|
|
87
87
|
function toAuthor(frontMatterAuthor) {
|
|
88
88
|
return {
|
|
89
|
-
// Author def from authorsMap can be locally overridden by
|
|
89
|
+
// Author def from authorsMap can be locally overridden by front matter
|
|
90
90
|
...getAuthorsMapAuthor(frontMatterAuthor.key),
|
|
91
91
|
...frontMatterAuthor,
|
|
92
92
|
};
|
|
@@ -97,10 +97,10 @@ function getBlogPostAuthors(params) {
|
|
|
97
97
|
const authorLegacy = getFrontMatterAuthorLegacy(params.frontMatter);
|
|
98
98
|
const authors = getFrontMatterAuthors(params);
|
|
99
99
|
if (authorLegacy) {
|
|
100
|
-
// Technically, we could allow mixing legacy/authors
|
|
100
|
+
// Technically, we could allow mixing legacy/authors front matter, but do we really want to?
|
|
101
101
|
if (authors.length > 0) {
|
|
102
|
-
throw new Error(`To declare blog post authors, use the 'authors'
|
|
103
|
-
Don't mix 'authors' with other existing 'author_*'
|
|
102
|
+
throw new Error(`To declare blog post authors, use the 'authors' front matter in priority.
|
|
103
|
+
Don't mix 'authors' with other existing 'author_*' front matter. Choose one or the other, not both at the same time.`);
|
|
104
104
|
}
|
|
105
105
|
return [authorLegacy];
|
|
106
106
|
}
|
package/lib/blogFrontMatter.js
CHANGED
|
@@ -25,7 +25,7 @@ const BlogFrontMatterSchema = utils_validation_1.JoiFrontMatter.object({
|
|
|
25
25
|
tags: utils_validation_1.FrontMatterTagsSchema,
|
|
26
26
|
draft: utils_validation_1.JoiFrontMatter.boolean(),
|
|
27
27
|
date: utils_validation_1.JoiFrontMatter.date().raw(),
|
|
28
|
-
// New multi-authors
|
|
28
|
+
// New multi-authors front matter:
|
|
29
29
|
authors: utils_validation_1.JoiFrontMatter.alternatives()
|
|
30
30
|
.try(utils_validation_1.JoiFrontMatter.string(), BlogPostFrontMatterAuthorSchema, utils_validation_1.JoiFrontMatter.array()
|
|
31
31
|
.items(utils_validation_1.JoiFrontMatter.string(), BlogPostFrontMatterAuthorSchema)
|
|
@@ -36,7 +36,7 @@ const BlogFrontMatterSchema = utils_validation_1.JoiFrontMatter.object({
|
|
|
36
36
|
.messages({
|
|
37
37
|
'alternatives.match': FrontMatterAuthorErrorMessage,
|
|
38
38
|
}),
|
|
39
|
-
// Legacy author
|
|
39
|
+
// Legacy author front matter
|
|
40
40
|
author: utils_validation_1.JoiFrontMatter.string(),
|
|
41
41
|
author_title: utils_validation_1.JoiFrontMatter.string(),
|
|
42
42
|
author_url: utils_validation_1.URISchema,
|
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-4479",
|
|
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-4479",
|
|
22
|
+
"@docusaurus/logger": "0.0.0-4479",
|
|
23
|
+
"@docusaurus/mdx-loader": "0.0.0-4479",
|
|
24
|
+
"@docusaurus/utils": "0.0.0-4479",
|
|
25
|
+
"@docusaurus/utils-validation": "0.0.0-4479",
|
|
26
26
|
"feed": "^4.2.2",
|
|
27
27
|
"fs-extra": "^10.0.0",
|
|
28
28
|
"lodash": "^4.17.20",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"webpack": "^5.61.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@docusaurus/types": "0.0.0-
|
|
36
|
+
"@docusaurus/types": "0.0.0-4479",
|
|
37
37
|
"escape-string-regexp": "^4.0.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=14"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "c85b2f2a43cfed30c1621ccb21057dfd19770a33"
|
|
47
47
|
}
|
package/src/authors.ts
CHANGED
|
@@ -54,7 +54,7 @@ type AuthorsParam = {
|
|
|
54
54
|
authorsMap: AuthorsMap | undefined;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
// Legacy v1/early-v2
|
|
57
|
+
// Legacy v1/early-v2 front matter fields
|
|
58
58
|
// We may want to deprecate those in favor of using only frontMatter.authors
|
|
59
59
|
function getFrontMatterAuthorLegacy(
|
|
60
60
|
frontMatter: BlogPostFrontMatter,
|
|
@@ -123,7 +123,7 @@ ${Object.keys(authorsMap)
|
|
|
123
123
|
|
|
124
124
|
function toAuthor(frontMatterAuthor: BlogPostFrontMatterAuthor): Author {
|
|
125
125
|
return {
|
|
126
|
-
// Author def from authorsMap can be locally overridden by
|
|
126
|
+
// Author def from authorsMap can be locally overridden by front matter
|
|
127
127
|
...getAuthorsMapAuthor(frontMatterAuthor.key),
|
|
128
128
|
...frontMatterAuthor,
|
|
129
129
|
};
|
|
@@ -137,11 +137,11 @@ export function getBlogPostAuthors(params: AuthorsParam): Author[] {
|
|
|
137
137
|
const authors = getFrontMatterAuthors(params);
|
|
138
138
|
|
|
139
139
|
if (authorLegacy) {
|
|
140
|
-
// Technically, we could allow mixing legacy/authors
|
|
140
|
+
// Technically, we could allow mixing legacy/authors front matter, but do we really want to?
|
|
141
141
|
if (authors.length > 0) {
|
|
142
142
|
throw new Error(
|
|
143
|
-
`To declare blog post authors, use the 'authors'
|
|
144
|
-
Don't mix 'authors' with other existing 'author_*'
|
|
143
|
+
`To declare blog post authors, use the 'authors' front matter in priority.
|
|
144
|
+
Don't mix 'authors' with other existing 'author_*' front matter. Choose one or the other, not both at the same time.`,
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
147
|
return [authorLegacy];
|
package/src/blogFrontMatter.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
|
-
JoiFrontMatter as Joi, // Custom instance for
|
|
9
|
+
JoiFrontMatter as Joi, // Custom instance for front matter
|
|
10
10
|
URISchema,
|
|
11
11
|
validateFrontMatter,
|
|
12
12
|
FrontMatterTagsSchema,
|
|
@@ -35,7 +35,7 @@ const BlogFrontMatterSchema = Joi.object<BlogPostFrontMatter>({
|
|
|
35
35
|
draft: Joi.boolean(),
|
|
36
36
|
date: Joi.date().raw(),
|
|
37
37
|
|
|
38
|
-
// New multi-authors
|
|
38
|
+
// New multi-authors front matter:
|
|
39
39
|
authors: Joi.alternatives()
|
|
40
40
|
.try(
|
|
41
41
|
Joi.string(),
|
|
@@ -50,7 +50,7 @@ const BlogFrontMatterSchema = Joi.object<BlogPostFrontMatter>({
|
|
|
50
50
|
.messages({
|
|
51
51
|
'alternatives.match': FrontMatterAuthorErrorMessage,
|
|
52
52
|
}),
|
|
53
|
-
// Legacy author
|
|
53
|
+
// Legacy author front matter
|
|
54
54
|
author: Joi.string(),
|
|
55
55
|
author_title: Joi.string(),
|
|
56
56
|
author_url: URISchema,
|
|
@@ -30,11 +30,11 @@ declare module '@docusaurus/plugin-content-blog' {
|
|
|
30
30
|
tags?: FrontMatterTag[];
|
|
31
31
|
slug?: string;
|
|
32
32
|
draft?: boolean;
|
|
33
|
-
date?: Date | string; // Yaml
|
|
33
|
+
date?: Date | string; // Yaml automatically convert some string patterns as Date, but not all
|
|
34
34
|
|
|
35
35
|
authors?: BlogPostFrontMatterAuthors;
|
|
36
36
|
|
|
37
|
-
// We may want to deprecate those older author
|
|
37
|
+
// We may want to deprecate those older author front matter fields later:
|
|
38
38
|
author?: string;
|
|
39
39
|
author_title?: string;
|
|
40
40
|
author_url?: string;
|