@docusaurus/plugin-content-blog 0.0.0-6062 → 0.0.0-6064

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 CHANGED
@@ -12,6 +12,7 @@ exports.groupBlogPostsByAuthorKey = groupBlogPostsByAuthorKey;
12
12
  const tslib_1 = require("tslib");
13
13
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
14
14
  const utils_1 = require("@docusaurus/utils");
15
+ const authorsSocials_1 = require("./authorsSocials");
15
16
  function normalizeImageUrl({ imageURL, baseUrl, }) {
16
17
  return imageURL?.startsWith('/')
17
18
  ? (0, utils_1.normalizeUrl)([baseUrl, imageURL])
@@ -66,7 +67,10 @@ function getFrontMatterAuthors(params) {
66
67
  // becoming a name and may end up unnoticed
67
68
  return { key: authorInput };
68
69
  }
69
- return authorInput;
70
+ return {
71
+ ...authorInput,
72
+ socials: (0, authorsSocials_1.normalizeSocials)(authorInput.socials ?? {}),
73
+ };
70
74
  }
71
75
  return Array.isArray(frontMatter.authors)
72
76
  ? frontMatter.authors.map(normalizeAuthor)
@@ -27,6 +27,10 @@ const PredefinedPlatformNormalizers = {
27
27
  };
28
28
  function normalizeSocialEntry([platform, value]) {
29
29
  const normalizer = PredefinedPlatformNormalizers[platform.toLowerCase()];
30
+ if (typeof value !== 'string') {
31
+ throw new Error(`Author socials should be usernames/userIds/handles, or fully qualified HTTP(s) absolute URLs.
32
+ Social platform '${platform}' has illegal value '${value}'`);
33
+ }
30
34
  const isAbsoluteUrl = value.startsWith('http://') || value.startsWith('https://');
31
35
  if (isAbsoluteUrl) {
32
36
  return [platform, value];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-blog",
3
- "version": "0.0.0-6062",
3
+ "version": "0.0.0-6064",
4
4
  "description": "Blog plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-content-blog.d.ts",
@@ -31,14 +31,14 @@
31
31
  },
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@docusaurus/core": "0.0.0-6062",
35
- "@docusaurus/logger": "0.0.0-6062",
36
- "@docusaurus/mdx-loader": "0.0.0-6062",
37
- "@docusaurus/theme-common": "0.0.0-6062",
38
- "@docusaurus/types": "0.0.0-6062",
39
- "@docusaurus/utils": "0.0.0-6062",
40
- "@docusaurus/utils-common": "0.0.0-6062",
41
- "@docusaurus/utils-validation": "0.0.0-6062",
34
+ "@docusaurus/core": "0.0.0-6064",
35
+ "@docusaurus/logger": "0.0.0-6064",
36
+ "@docusaurus/mdx-loader": "0.0.0-6064",
37
+ "@docusaurus/theme-common": "0.0.0-6064",
38
+ "@docusaurus/types": "0.0.0-6064",
39
+ "@docusaurus/utils": "0.0.0-6064",
40
+ "@docusaurus/utils-common": "0.0.0-6064",
41
+ "@docusaurus/utils-validation": "0.0.0-6064",
42
42
  "cheerio": "1.0.0-rc.12",
43
43
  "feed": "^4.2.2",
44
44
  "fs-extra": "^11.1.1",
@@ -62,5 +62,5 @@
62
62
  "@total-typescript/shoehorn": "^0.1.2",
63
63
  "tree-node-cli": "^1.6.0"
64
64
  },
65
- "gitHead": "f32caf7a9bd354b43ea373b232021955fb95af2d"
65
+ "gitHead": "f9f463e54c7ff8013cb938f94857af8e4bff5a72"
66
66
  }
package/src/authors.ts CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
  import _ from 'lodash';
9
9
  import {normalizeUrl} from '@docusaurus/utils';
10
+ import {normalizeSocials} from './authorsSocials';
10
11
  import type {
11
12
  Author,
12
13
  AuthorsMap,
@@ -107,7 +108,10 @@ function getFrontMatterAuthors(params: AuthorsParam): Author[] {
107
108
  // becoming a name and may end up unnoticed
108
109
  return {key: authorInput};
109
110
  }
110
- return authorInput;
111
+ return {
112
+ ...authorInput,
113
+ socials: normalizeSocials(authorInput.socials ?? {}),
114
+ };
111
115
  }
112
116
 
113
117
  return Array.isArray(frontMatter.authors)
@@ -41,6 +41,12 @@ type SocialEntry = [string, string];
41
41
 
42
42
  function normalizeSocialEntry([platform, value]: SocialEntry): SocialEntry {
43
43
  const normalizer = PredefinedPlatformNormalizers[platform.toLowerCase()];
44
+ if (typeof value !== 'string') {
45
+ throw new Error(
46
+ `Author socials should be usernames/userIds/handles, or fully qualified HTTP(s) absolute URLs.
47
+ Social platform '${platform}' has illegal value '${value}'`,
48
+ );
49
+ }
44
50
  const isAbsoluteUrl =
45
51
  value.startsWith('http://') || value.startsWith('https://');
46
52
  if (isAbsoluteUrl) {