@docusaurus/plugin-content-blog 0.0.0-4350 → 0.0.0-4356
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.d.ts +2 -2
- package/lib/blogUtils.d.ts +2 -2
- package/lib/blogUtils.js +6 -1
- package/lib/feed.d.ts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/markdownLoader.d.ts +1 -1
- package/lib/pluginOptionSchema.d.ts +1 -1
- package/lib/types.d.ts +2 -2
- package/package.json +8 -8
- package/src/authors.ts +2 -2
- package/src/blogUtils.ts +9 -4
- package/src/feed.ts +3 -3
- package/src/index.ts +4 -4
- package/src/markdownLoader.ts +1 -1
- package/src/pluginOptionSchema.ts +1 -1
- package/src/types.ts +2 -2
package/lib/authors.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { Author, BlogContentPaths } from './types';
|
|
8
|
-
import { BlogPostFrontMatter } from './blogFrontMatter';
|
|
7
|
+
import type { Author, BlogContentPaths } from './types';
|
|
8
|
+
import type { BlogPostFrontMatter } from './blogFrontMatter';
|
|
9
9
|
export declare type AuthorsMap = Record<string, Author>;
|
|
10
10
|
export declare function validateAuthorsMap(content: unknown): AuthorsMap;
|
|
11
11
|
export declare function getAuthorsMap(params: {
|
package/lib/blogUtils.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { PluginOptions, BlogPost, BlogContentPaths, BlogMarkdownLoaderOptions, BlogTags } from './types';
|
|
8
|
-
import { LoadContext } from '@docusaurus/types';
|
|
7
|
+
import type { PluginOptions, BlogPost, BlogContentPaths, BlogMarkdownLoaderOptions, BlogTags } from './types';
|
|
8
|
+
import type { LoadContext } from '@docusaurus/types';
|
|
9
9
|
export declare function truncate(fileString: string, truncateMarker: RegExp): string;
|
|
10
10
|
export declare function getSourceToPermalink(blogPosts: BlogPost[]): Record<string, string>;
|
|
11
11
|
export declare function getBlogTags(blogPosts: BlogPost[]): BlogTags;
|
package/lib/blogUtils.js
CHANGED
|
@@ -94,7 +94,12 @@ async function processBlogSourceFile(blogSourceRelative, contentPaths, context,
|
|
|
94
94
|
async function getDate() {
|
|
95
95
|
// Prefer user-defined date.
|
|
96
96
|
if (frontMatter.date) {
|
|
97
|
-
|
|
97
|
+
if (typeof frontMatter.date === 'string') {
|
|
98
|
+
// Always treat dates as UTC by adding the `Z`
|
|
99
|
+
return new Date(`${frontMatter.date}Z`);
|
|
100
|
+
}
|
|
101
|
+
// YAML only converts YYYY-MM-DD to dates and leaves others as strings.
|
|
102
|
+
return frontMatter.date;
|
|
98
103
|
}
|
|
99
104
|
else if (parsedBlogFileName.date) {
|
|
100
105
|
return parsedBlogFileName.date;
|
package/lib/feed.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Feed } from 'feed';
|
|
8
|
-
import { PluginOptions, BlogPost } from './types';
|
|
9
|
-
import { DocusaurusConfig } from '@docusaurus/types';
|
|
8
|
+
import type { PluginOptions, BlogPost } from './types';
|
|
9
|
+
import type { DocusaurusConfig } from '@docusaurus/types';
|
|
10
10
|
export declare function generateBlogFeed({ blogPosts, options, siteConfig, }: {
|
|
11
11
|
blogPosts: BlogPost[];
|
|
12
12
|
options: PluginOptions;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { PluginOptions, BlogContent } from './types';
|
|
8
|
-
import { LoadContext, Plugin, OptionValidationContext, ValidationResult } from '@docusaurus/types';
|
|
7
|
+
import type { PluginOptions, BlogContent } from './types';
|
|
8
|
+
import type { LoadContext, Plugin, OptionValidationContext, ValidationResult } from '@docusaurus/types';
|
|
9
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/markdownLoader.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { BlogMarkdownLoaderOptions } from './types';
|
|
7
|
+
import type { BlogMarkdownLoaderOptions } from './types';
|
|
8
8
|
import type { LoaderContext } from 'webpack';
|
|
9
9
|
export default function markdownLoader(this: LoaderContext<BlogMarkdownLoaderOptions>, source: string): void;
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Joi } from '@docusaurus/utils-validation';
|
|
8
|
-
import { PluginOptions } from './types';
|
|
8
|
+
import type { PluginOptions } from './types';
|
|
9
9
|
export declare const DEFAULT_OPTIONS: PluginOptions;
|
|
10
10
|
export declare const PluginOptionSchema: Joi.ObjectSchema<PluginOptions>;
|
package/lib/types.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import type { RemarkAndRehypePluginOptions } from '@docusaurus/mdx-loader';
|
|
8
8
|
import type { Tag } from '@docusaurus/utils';
|
|
9
9
|
import type { BrokenMarkdownLink, ContentPaths } from '@docusaurus/utils/lib/markdownLinks';
|
|
10
|
-
import { Overwrite } from 'utility-types';
|
|
11
|
-
import { BlogPostFrontMatter } from './blogFrontMatter';
|
|
10
|
+
import type { Overwrite } from 'utility-types';
|
|
11
|
+
import type { BlogPostFrontMatter } from './blogFrontMatter';
|
|
12
12
|
export declare type BlogContentPaths = ContentPaths;
|
|
13
13
|
export interface BlogContent {
|
|
14
14
|
blogSidebarTitle: string;
|
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-4356",
|
|
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-4356",
|
|
22
|
+
"@docusaurus/logger": "0.0.0-4356",
|
|
23
|
+
"@docusaurus/mdx-loader": "0.0.0-4356",
|
|
24
|
+
"@docusaurus/utils": "0.0.0-4356",
|
|
25
|
+
"@docusaurus/utils-validation": "0.0.0-4356",
|
|
26
26
|
"escape-string-regexp": "^4.0.0",
|
|
27
27
|
"feed": "^4.2.2",
|
|
28
28
|
"fs-extra": "^10.0.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"webpack": "^5.61.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@docusaurus/types": "0.0.0-
|
|
39
|
+
"@docusaurus/types": "0.0.0-4356"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": "^16.8.4 || ^17.0.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=14"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "689533485d30a832b6a1d4108c491c90bb6165e7"
|
|
49
49
|
}
|
package/src/authors.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {Author, BlogContentPaths} from './types';
|
|
8
|
+
import type {Author, BlogContentPaths} from './types';
|
|
9
9
|
import {getDataFileData} from '@docusaurus/utils';
|
|
10
10
|
import {Joi, URISchema} from '@docusaurus/utils-validation';
|
|
11
|
-
import {
|
|
11
|
+
import type {
|
|
12
12
|
BlogPostFrontMatter,
|
|
13
13
|
BlogPostFrontMatterAuthor,
|
|
14
14
|
BlogPostFrontMatterAuthors,
|
package/src/blogUtils.ts
CHANGED
|
@@ -9,7 +9,7 @@ import fs from 'fs-extra';
|
|
|
9
9
|
import path from 'path';
|
|
10
10
|
import readingTime from 'reading-time';
|
|
11
11
|
import {keyBy, mapValues} from 'lodash';
|
|
12
|
-
import {
|
|
12
|
+
import type {
|
|
13
13
|
PluginOptions,
|
|
14
14
|
BlogPost,
|
|
15
15
|
BlogContentPaths,
|
|
@@ -30,9 +30,9 @@ import {
|
|
|
30
30
|
groupTaggedItems,
|
|
31
31
|
getContentPathList,
|
|
32
32
|
} from '@docusaurus/utils';
|
|
33
|
-
import {LoadContext} from '@docusaurus/types';
|
|
33
|
+
import type {LoadContext} from '@docusaurus/types';
|
|
34
34
|
import {validateBlogPostFrontMatter} from './blogFrontMatter';
|
|
35
|
-
import {AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
|
|
35
|
+
import {type AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
|
|
36
36
|
import logger from '@docusaurus/logger';
|
|
37
37
|
|
|
38
38
|
export function truncate(fileString: string, truncateMarker: RegExp): string {
|
|
@@ -160,7 +160,12 @@ async function processBlogSourceFile(
|
|
|
160
160
|
async function getDate(): Promise<Date> {
|
|
161
161
|
// Prefer user-defined date.
|
|
162
162
|
if (frontMatter.date) {
|
|
163
|
-
|
|
163
|
+
if (typeof frontMatter.date === 'string') {
|
|
164
|
+
// Always treat dates as UTC by adding the `Z`
|
|
165
|
+
return new Date(`${frontMatter.date}Z`);
|
|
166
|
+
}
|
|
167
|
+
// YAML only converts YYYY-MM-DD to dates and leaves others as strings.
|
|
168
|
+
return frontMatter.date;
|
|
164
169
|
} else if (parsedBlogFileName.date) {
|
|
165
170
|
return parsedBlogFileName.date;
|
|
166
171
|
}
|
package/src/feed.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {Feed, Author as FeedAuthor, Item as FeedItem} from 'feed';
|
|
9
|
-
import {PluginOptions, Author, BlogPost, FeedType} from './types';
|
|
8
|
+
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
|
|
9
|
+
import type {PluginOptions, Author, BlogPost, FeedType} from './types';
|
|
10
10
|
import {normalizeUrl, mdxToHtml} from '@docusaurus/utils';
|
|
11
|
-
import {DocusaurusConfig} from '@docusaurus/types';
|
|
11
|
+
import type {DocusaurusConfig} from '@docusaurus/types';
|
|
12
12
|
import path from 'path';
|
|
13
13
|
import fs from 'fs-extra';
|
|
14
14
|
|
package/src/index.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from '@docusaurus/utils';
|
|
23
23
|
import {translateContent, getTranslationFiles} from './translations';
|
|
24
24
|
|
|
25
|
-
import {
|
|
25
|
+
import type {
|
|
26
26
|
PluginOptions,
|
|
27
27
|
BlogTags,
|
|
28
28
|
BlogContent,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
Assets,
|
|
36
36
|
} from './types';
|
|
37
37
|
import {PluginOptionSchema} from './pluginOptionSchema';
|
|
38
|
-
import {
|
|
38
|
+
import type {
|
|
39
39
|
LoadContext,
|
|
40
40
|
ConfigureWebpackUtils,
|
|
41
41
|
Props,
|
|
@@ -44,13 +44,13 @@ import {
|
|
|
44
44
|
OptionValidationContext,
|
|
45
45
|
ValidationResult,
|
|
46
46
|
} from '@docusaurus/types';
|
|
47
|
-
import {Configuration} from 'webpack';
|
|
47
|
+
import type {Configuration} from 'webpack';
|
|
48
48
|
import {
|
|
49
49
|
generateBlogPosts,
|
|
50
50
|
getSourceToPermalink,
|
|
51
51
|
getBlogTags,
|
|
52
52
|
} from './blogUtils';
|
|
53
|
-
import {BlogPostFrontMatter} from './blogFrontMatter';
|
|
53
|
+
import type {BlogPostFrontMatter} from './blogFrontMatter';
|
|
54
54
|
import {createBlogFeedFiles} from './feed';
|
|
55
55
|
|
|
56
56
|
export default async function pluginContentBlog(
|
package/src/markdownLoader.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import {truncate, linkify} from './blogUtils';
|
|
9
9
|
import {parseQuery} from 'loader-utils';
|
|
10
|
-
import {BlogMarkdownLoaderOptions} from './types';
|
|
10
|
+
import type {BlogMarkdownLoaderOptions} from './types';
|
|
11
11
|
import type {LoaderContext} from 'webpack';
|
|
12
12
|
|
|
13
13
|
export default function markdownLoader(
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
URISchema,
|
|
14
14
|
} from '@docusaurus/utils-validation';
|
|
15
15
|
import {GlobExcludeDefault} from '@docusaurus/utils';
|
|
16
|
-
import {PluginOptions} from './types';
|
|
16
|
+
import type {PluginOptions} from './types';
|
|
17
17
|
|
|
18
18
|
export const DEFAULT_OPTIONS: PluginOptions = {
|
|
19
19
|
feedOptions: {type: ['rss', 'atom'], copyright: ''},
|
package/src/types.ts
CHANGED
|
@@ -11,8 +11,8 @@ import type {
|
|
|
11
11
|
BrokenMarkdownLink,
|
|
12
12
|
ContentPaths,
|
|
13
13
|
} from '@docusaurus/utils/lib/markdownLinks';
|
|
14
|
-
import {Overwrite} from 'utility-types';
|
|
15
|
-
import {BlogPostFrontMatter} from './blogFrontMatter';
|
|
14
|
+
import type {Overwrite} from 'utility-types';
|
|
15
|
+
import type {BlogPostFrontMatter} from './blogFrontMatter';
|
|
16
16
|
|
|
17
17
|
export type BlogContentPaths = ContentPaths;
|
|
18
18
|
|