@docusaurus/plugin-content-blog 0.0.0-4291 → 0.0.0-4297
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 +3 -3
- package/lib/blogUtils.js +3 -3
- package/package.json +8 -8
- package/src/authors.ts +3 -5
- package/src/blogUtils.ts +3 -11
package/lib/authors.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.getBlogPostAuthors = exports.getAuthorsMap = exports.getAuthorsMapFilePath = exports.readAuthorsMapFile = exports.validateAuthorsMapFile = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
|
|
12
|
-
const
|
|
12
|
+
const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
|
|
13
13
|
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
14
14
|
const utils_1 = require("@docusaurus/utils");
|
|
15
15
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
@@ -37,7 +37,7 @@ async function readAuthorsMapFile(filePath) {
|
|
|
37
37
|
}
|
|
38
38
|
catch (e) {
|
|
39
39
|
// TODO replace later by error cause: see https://v8.dev/features/error-cause
|
|
40
|
-
|
|
40
|
+
logger_1.default.error('The author list file looks invalid!');
|
|
41
41
|
throw e;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -63,7 +63,7 @@ async function getAuthorsMap(params) {
|
|
|
63
63
|
}
|
|
64
64
|
catch (e) {
|
|
65
65
|
// TODO replace later by error cause, see https://v8.dev/features/error-cause
|
|
66
|
-
|
|
66
|
+
logger_1.default.error `Couldn't read blog authors map at path=${filePath}`;
|
|
67
67
|
throw e;
|
|
68
68
|
}
|
|
69
69
|
}
|
package/lib/blogUtils.js
CHANGED
|
@@ -9,13 +9,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.getContentPathList = exports.linkify = exports.generateBlogPosts = exports.parseBlogFileName = exports.getBlogTags = exports.getSourceToPermalink = exports.truncate = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
|
|
12
|
-
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
13
12
|
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
14
13
|
const reading_time_1 = (0, tslib_1.__importDefault)(require("reading-time"));
|
|
15
14
|
const lodash_1 = require("lodash");
|
|
16
15
|
const utils_1 = require("@docusaurus/utils");
|
|
17
16
|
const blogFrontMatter_1 = require("./blogFrontMatter");
|
|
18
17
|
const authors_1 = require("./authors");
|
|
18
|
+
const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
|
|
19
19
|
function truncate(fileString, truncateMarker) {
|
|
20
20
|
return fileString.split(truncateMarker, 1).shift();
|
|
21
21
|
}
|
|
@@ -88,7 +88,7 @@ async function processBlogSourceFile(blogSourceRelative, contentPaths, context,
|
|
|
88
88
|
return undefined;
|
|
89
89
|
}
|
|
90
90
|
if (frontMatter.id) {
|
|
91
|
-
|
|
91
|
+
logger_1.default.warn `name=${'id'} header option is deprecated in path=${blogSourceRelative} file. Please use name=${'slug'} option instead.`;
|
|
92
92
|
}
|
|
93
93
|
const parsedBlogFileName = parseBlogFileName(blogSourceRelative);
|
|
94
94
|
async function getDate() {
|
|
@@ -179,7 +179,7 @@ async function generateBlogPosts(contentPaths, context, options) {
|
|
|
179
179
|
return await processBlogSourceFile(blogSourceFile, contentPaths, context, options, authorsMap);
|
|
180
180
|
}
|
|
181
181
|
catch (e) {
|
|
182
|
-
|
|
182
|
+
logger_1.default.error `Processing of blog source file failed for path path=${blogSourceFile}.`;
|
|
183
183
|
throw e;
|
|
184
184
|
}
|
|
185
185
|
}))).filter(Boolean);
|
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-4297",
|
|
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/
|
|
23
|
-
"@docusaurus/
|
|
24
|
-
"@docusaurus/utils
|
|
25
|
-
"
|
|
21
|
+
"@docusaurus/core": "0.0.0-4297",
|
|
22
|
+
"@docusaurus/logger": "0.0.0-4297",
|
|
23
|
+
"@docusaurus/mdx-loader": "0.0.0-4297",
|
|
24
|
+
"@docusaurus/utils": "0.0.0-4297",
|
|
25
|
+
"@docusaurus/utils-validation": "0.0.0-4297",
|
|
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-4297"
|
|
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": "84ae34c33c664bf856f3a92047919a074e087d77"
|
|
50
50
|
}
|
package/src/authors.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import fs from 'fs-extra';
|
|
9
|
-
import
|
|
9
|
+
import logger from '@docusaurus/logger';
|
|
10
10
|
import path from 'path';
|
|
11
11
|
import {Author, BlogContentPaths} from './types';
|
|
12
12
|
import {findFolderContainingFile} from '@docusaurus/utils';
|
|
@@ -48,7 +48,7 @@ export async function readAuthorsMapFile(
|
|
|
48
48
|
return validateAuthorsMapFile(unsafeContent);
|
|
49
49
|
} catch (e) {
|
|
50
50
|
// TODO replace later by error cause: see https://v8.dev/features/error-cause
|
|
51
|
-
|
|
51
|
+
logger.error('The author list file looks invalid!');
|
|
52
52
|
throw e;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -88,9 +88,7 @@ export async function getAuthorsMap(
|
|
|
88
88
|
return await readAuthorsMapFile(filePath);
|
|
89
89
|
} catch (e) {
|
|
90
90
|
// TODO replace later by error cause, see https://v8.dev/features/error-cause
|
|
91
|
-
|
|
92
|
-
chalk.red(`Couldn't read blog authors map at path ${filePath}`),
|
|
93
|
-
);
|
|
91
|
+
logger.error`Couldn't read blog authors map at path=${filePath}`;
|
|
94
92
|
throw e;
|
|
95
93
|
}
|
|
96
94
|
}
|
package/src/blogUtils.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import fs from 'fs-extra';
|
|
9
|
-
import chalk from 'chalk';
|
|
10
9
|
import path from 'path';
|
|
11
10
|
import readingTime from 'reading-time';
|
|
12
11
|
import {keyBy, mapValues} from 'lodash';
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
import {LoadContext} from '@docusaurus/types';
|
|
34
33
|
import {validateBlogPostFrontMatter} from './blogFrontMatter';
|
|
35
34
|
import {AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
|
|
35
|
+
import logger from '@docusaurus/logger';
|
|
36
36
|
|
|
37
37
|
export function truncate(fileString: string, truncateMarker: RegExp): string {
|
|
38
38
|
return fileString.split(truncateMarker, 1).shift()!;
|
|
@@ -151,11 +151,7 @@ async function processBlogSourceFile(
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
if (frontMatter.id) {
|
|
154
|
-
|
|
155
|
-
chalk.yellow(
|
|
156
|
-
`"id" header option is deprecated in ${blogSourceRelative} file. Please use "slug" option instead.`,
|
|
157
|
-
),
|
|
158
|
-
);
|
|
154
|
+
logger.warn`name=${'id'} header option is deprecated in path=${blogSourceRelative} file. Please use name=${'slug'} option instead.`;
|
|
159
155
|
}
|
|
160
156
|
|
|
161
157
|
const parsedBlogFileName = parseBlogFileName(blogSourceRelative);
|
|
@@ -276,11 +272,7 @@ export async function generateBlogPosts(
|
|
|
276
272
|
authorsMap,
|
|
277
273
|
);
|
|
278
274
|
} catch (e) {
|
|
279
|
-
|
|
280
|
-
chalk.red(
|
|
281
|
-
`Processing of blog source file failed for path "${blogSourceFile}"`,
|
|
282
|
-
),
|
|
283
|
-
);
|
|
275
|
+
logger.error`Processing of blog source file failed for path path=${blogSourceFile}.`;
|
|
284
276
|
throw e;
|
|
285
277
|
}
|
|
286
278
|
}),
|