@docusaurus/plugin-content-blog 0.0.0-4751 → 0.0.0-4754

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/blogUtils.js CHANGED
@@ -13,7 +13,7 @@ const path_1 = tslib_1.__importDefault(require("path"));
13
13
  const reading_time_1 = tslib_1.__importDefault(require("reading-time"));
14
14
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
15
15
  const utils_1 = require("@docusaurus/utils");
16
- const blogFrontMatter_1 = require("./blogFrontMatter");
16
+ const frontMatter_1 = require("./frontMatter");
17
17
  const authors_1 = require("./authors");
18
18
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
19
19
  function truncate(fileString, truncateMarker) {
@@ -107,7 +107,7 @@ async function parseBlogPostMarkdownFile(blogSourceAbsolute) {
107
107
  });
108
108
  return {
109
109
  ...result,
110
- frontMatter: (0, blogFrontMatter_1.validateBlogPostFrontMatter)(result.frontMatter),
110
+ frontMatter: (0, frontMatter_1.validateBlogPostFrontMatter)(result.frontMatter),
111
111
  };
112
112
  }
113
113
  catch (err) {
File without changes
File without changes
package/lib/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { BlogContent } from './types';
8
- import type { LoadContext, Plugin, OptionValidationContext, ValidationResult } from '@docusaurus/types';
8
+ import type { LoadContext, Plugin } from '@docusaurus/types';
9
9
  import type { PluginOptions } from '@docusaurus/plugin-content-blog';
10
10
  export default function pluginContentBlog(context: LoadContext, options: PluginOptions): Promise<Plugin<BlogContent>>;
11
- export declare function validateOptions({ validate, options, }: OptionValidationContext<PluginOptions>): ValidationResult<PluginOptions>;
11
+ export { validateOptions } from './options';
package/lib/index.js CHANGED
@@ -12,7 +12,6 @@ const path_1 = tslib_1.__importDefault(require("path"));
12
12
  const remark_admonitions_1 = tslib_1.__importDefault(require("remark-admonitions"));
13
13
  const utils_1 = require("@docusaurus/utils");
14
14
  const translations_1 = require("./translations");
15
- const pluginOptionSchema_1 = require("./pluginOptionSchema");
16
15
  const blogUtils_1 = require("./blogUtils");
17
16
  const feed_1 = require("./feed");
18
17
  async function pluginContentBlog(context, options) {
@@ -382,8 +381,5 @@ async function pluginContentBlog(context, options) {
382
381
  };
383
382
  }
384
383
  exports.default = pluginContentBlog;
385
- function validateOptions({ validate, options, }) {
386
- const validatedOptions = validate(pluginOptionSchema_1.PluginOptionSchema, options);
387
- return validatedOptions;
388
- }
389
- exports.validateOptions = validateOptions;
384
+ var options_1 = require("./options");
385
+ Object.defineProperty(exports, "validateOptions", { enumerable: true, get: function () { return options_1.validateOptions; } });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import type { PluginOptions, Options } from '@docusaurus/plugin-content-blog';
8
+ import type { OptionValidationContext } from '@docusaurus/types';
9
+ export declare const DEFAULT_OPTIONS: PluginOptions;
10
+ export declare function validateOptions({ validate, options, }: OptionValidationContext<Options, PluginOptions>): PluginOptions;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.PluginOptionSchema = exports.DEFAULT_OPTIONS = void 0;
9
+ exports.validateOptions = exports.DEFAULT_OPTIONS = void 0;
10
10
  const utils_validation_1 = require("@docusaurus/utils-validation");
11
11
  const utils_1 = require("@docusaurus/utils");
12
12
  exports.DEFAULT_OPTIONS = {
@@ -39,7 +39,7 @@ exports.DEFAULT_OPTIONS = {
39
39
  readingTime: ({ content, defaultReadingTime }) => defaultReadingTime({ content }),
40
40
  sortPosts: 'descending',
41
41
  };
42
- exports.PluginOptionSchema = utils_validation_1.Joi.object({
42
+ const PluginOptionSchema = utils_validation_1.Joi.object({
43
43
  path: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.path),
44
44
  archiveBasePath: utils_validation_1.Joi.string()
45
45
  .default(exports.DEFAULT_OPTIONS.archiveBasePath)
@@ -100,4 +100,9 @@ exports.PluginOptionSchema = utils_validation_1.Joi.object({
100
100
  sortPosts: utils_validation_1.Joi.string()
101
101
  .valid('descending', 'ascending')
102
102
  .default(exports.DEFAULT_OPTIONS.sortPosts),
103
- });
103
+ }).default(exports.DEFAULT_OPTIONS);
104
+ function validateOptions({ validate, options, }) {
105
+ const validatedOptions = validate(PluginOptionSchema, options);
106
+ return validatedOptions;
107
+ }
108
+ exports.validateOptions = validateOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-blog",
3
- "version": "0.0.0-4751",
3
+ "version": "0.0.0-4754",
4
4
  "description": "Blog plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-content-blog.d.ts",
@@ -18,12 +18,12 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/core": "0.0.0-4751",
22
- "@docusaurus/logger": "0.0.0-4751",
23
- "@docusaurus/mdx-loader": "0.0.0-4751",
24
- "@docusaurus/utils": "0.0.0-4751",
25
- "@docusaurus/utils-common": "0.0.0-4751",
26
- "@docusaurus/utils-validation": "0.0.0-4751",
21
+ "@docusaurus/core": "0.0.0-4754",
22
+ "@docusaurus/logger": "0.0.0-4754",
23
+ "@docusaurus/mdx-loader": "0.0.0-4754",
24
+ "@docusaurus/utils": "0.0.0-4754",
25
+ "@docusaurus/utils-common": "0.0.0-4754",
26
+ "@docusaurus/utils-validation": "0.0.0-4754",
27
27
  "cheerio": "^1.0.0-rc.10",
28
28
  "feed": "^4.2.2",
29
29
  "fs-extra": "^10.0.1",
@@ -35,7 +35,7 @@
35
35
  "webpack": "^5.70.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@docusaurus/types": "0.0.0-4751",
38
+ "@docusaurus/types": "0.0.0-4754",
39
39
  "escape-string-regexp": "^4.0.0"
40
40
  },
41
41
  "peerDependencies": {
@@ -45,5 +45,5 @@
45
45
  "engines": {
46
46
  "node": ">=14"
47
47
  },
48
- "gitHead": "31dce3a6b7ba78c70754f80693c87a706d47500f"
48
+ "gitHead": "6c1c0d9bb0878c738732b8678af70a8dc04ee0a4"
49
49
  }
package/src/blogUtils.ts CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  getContentPathList,
32
32
  } from '@docusaurus/utils';
33
33
  import type {LoadContext} from '@docusaurus/types';
34
- import {validateBlogPostFrontMatter} from './blogFrontMatter';
34
+ import {validateBlogPostFrontMatter} from './frontMatter';
35
35
  import {type AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
36
36
  import logger from '@docusaurus/logger';
37
37
  import type {
File without changes
package/src/index.ts CHANGED
@@ -30,14 +30,7 @@ import type {
30
30
  BlogContentPaths,
31
31
  BlogMarkdownLoaderOptions,
32
32
  } from './types';
33
- import {PluginOptionSchema} from './pluginOptionSchema';
34
- import type {
35
- LoadContext,
36
- Plugin,
37
- HtmlTags,
38
- OptionValidationContext,
39
- ValidationResult,
40
- } from '@docusaurus/types';
33
+ import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types';
41
34
  import {
42
35
  generateBlogPosts,
43
36
  getSourceToPermalink,
@@ -572,10 +565,4 @@ export default async function pluginContentBlog(
572
565
  };
573
566
  }
574
567
 
575
- export function validateOptions({
576
- validate,
577
- options,
578
- }: OptionValidationContext<PluginOptions>): ValidationResult<PluginOptions> {
579
- const validatedOptions = validate(PluginOptionSchema, options);
580
- return validatedOptions;
581
- }
568
+ export {validateOptions} from './options';
@@ -13,7 +13,8 @@ import {
13
13
  URISchema,
14
14
  } from '@docusaurus/utils-validation';
15
15
  import {GlobExcludeDefault} from '@docusaurus/utils';
16
- import type {PluginOptions} from '@docusaurus/plugin-content-blog';
16
+ import type {PluginOptions, Options} from '@docusaurus/plugin-content-blog';
17
+ import type {OptionValidationContext} from '@docusaurus/types';
17
18
 
18
19
  export const DEFAULT_OPTIONS: PluginOptions = {
19
20
  feedOptions: {type: ['rss', 'atom'], copyright: ''},
@@ -46,7 +47,7 @@ export const DEFAULT_OPTIONS: PluginOptions = {
46
47
  sortPosts: 'descending',
47
48
  };
48
49
 
49
- export const PluginOptionSchema = Joi.object<PluginOptions>({
50
+ const PluginOptionSchema = Joi.object<PluginOptions>({
50
51
  path: Joi.string().default(DEFAULT_OPTIONS.path),
51
52
  archiveBasePath: Joi.string()
52
53
  .default(DEFAULT_OPTIONS.archiveBasePath)
@@ -125,4 +126,15 @@ export const PluginOptionSchema = Joi.object<PluginOptions>({
125
126
  sortPosts: Joi.string()
126
127
  .valid('descending', 'ascending')
127
128
  .default(DEFAULT_OPTIONS.sortPosts),
128
- });
129
+ }).default(DEFAULT_OPTIONS);
130
+
131
+ export function validateOptions({
132
+ validate,
133
+ options,
134
+ }: OptionValidationContext<Options, PluginOptions>): PluginOptions {
135
+ const validatedOptions = validate(
136
+ PluginOptionSchema,
137
+ options,
138
+ ) as PluginOptions;
139
+ return validatedOptions;
140
+ }
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { Joi } from '@docusaurus/utils-validation';
8
- import type { PluginOptions } from '@docusaurus/plugin-content-blog';
9
- export declare const DEFAULT_OPTIONS: PluginOptions;
10
- export declare const PluginOptionSchema: Joi.ObjectSchema<PluginOptions>;