@docusaurus/plugin-content-blog 0.0.0-4944 → 0.0.0-4947

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.
@@ -4,9 +4,9 @@
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 type { BlogPost, BlogContentPaths, BlogMarkdownLoaderOptions, BlogTags, BlogPaginated } from './types';
7
+ import type { BlogContentPaths, BlogMarkdownLoaderOptions } from './types';
8
8
  import type { LoadContext } from '@docusaurus/types';
9
- import type { PluginOptions } from '@docusaurus/plugin-content-blog';
9
+ import type { PluginOptions, BlogPost, BlogTags, BlogPaginated } from '@docusaurus/plugin-content-blog';
10
10
  export declare function truncate(fileString: string, truncateMarker: RegExp): string;
11
11
  export declare function getSourceToPermalink(blogPosts: BlogPost[]): {
12
12
  [aliasedPath: string]: string;
package/lib/feed.d.ts CHANGED
@@ -4,9 +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 type { BlogPost } from './types';
8
7
  import type { DocusaurusConfig } from '@docusaurus/types';
9
- import type { PluginOptions } from '@docusaurus/plugin-content-blog';
8
+ import type { PluginOptions, BlogPost } from '@docusaurus/plugin-content-blog';
10
9
  export declare function createBlogFeedFiles({ blogPosts, options, siteConfig, outDir, locale, }: {
11
10
  blogPosts: BlogPost[];
12
11
  options: PluginOptions;
package/lib/index.d.ts CHANGED
@@ -4,8 +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 type { BlogContent } from './types';
8
7
  import type { LoadContext, Plugin } from '@docusaurus/types';
9
- import type { PluginOptions } from '@docusaurus/plugin-content-blog';
8
+ import type { PluginOptions, BlogContent } from '@docusaurus/plugin-content-blog';
10
9
  export default function pluginContentBlog(context: LoadContext, options: PluginOptions): Promise<Plugin<BlogContent>>;
11
10
  export { validateOptions } from './options';
@@ -4,8 +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 type { BlogContent } from './types';
8
7
  import type { TranslationFile } from '@docusaurus/types';
9
- import type { PluginOptions } from '@docusaurus/plugin-content-blog';
8
+ import type { PluginOptions, BlogContent } from '@docusaurus/plugin-content-blog';
10
9
  export declare function getTranslationFiles(options: PluginOptions): TranslationFile[];
11
10
  export declare function translateContent(content: BlogContent, translationFiles: TranslationFile[]): BlogContent;
package/lib/types.d.ts CHANGED
@@ -5,35 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { BrokenMarkdownLink, ContentPaths } from '@docusaurus/utils';
8
- import type { Tag } from '@docusaurus/types';
9
- import type { BlogPostMetadata } from '@docusaurus/plugin-content-blog';
10
- import type { Metadata as BlogPaginatedMetadata } from '@theme/BlogListPage';
11
8
  export declare type BlogContentPaths = ContentPaths;
12
- export declare type BlogContent = {
13
- blogSidebarTitle: string;
14
- blogPosts: BlogPost[];
15
- blogListPaginated: BlogPaginated[];
16
- blogTags: BlogTags;
17
- blogTagsListPath: string;
18
- };
19
- export declare type BlogTags = {
20
- [permalink: string]: BlogTag;
21
- };
22
- export declare type BlogTag = Tag & {
23
- /** Blog post permalinks. */
24
- items: string[];
25
- pages: BlogPaginated[];
26
- };
27
- export declare type BlogPost = {
28
- id: string;
29
- metadata: BlogPostMetadata;
30
- content: string;
31
- };
32
- export declare type BlogPaginated = {
33
- metadata: BlogPaginatedMetadata;
34
- /** Blog post permalinks. */
35
- items: string[];
36
- };
37
9
  export declare type BlogBrokenMarkdownLink = BrokenMarkdownLink<BlogContentPaths>;
38
10
  export declare type BlogMarkdownLoaderOptions = {
39
11
  siteDir: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-blog",
3
- "version": "0.0.0-4944",
3
+ "version": "0.0.0-4947",
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-4944",
22
- "@docusaurus/logger": "0.0.0-4944",
23
- "@docusaurus/mdx-loader": "0.0.0-4944",
24
- "@docusaurus/utils": "0.0.0-4944",
25
- "@docusaurus/utils-common": "0.0.0-4944",
26
- "@docusaurus/utils-validation": "0.0.0-4944",
21
+ "@docusaurus/core": "0.0.0-4947",
22
+ "@docusaurus/logger": "0.0.0-4947",
23
+ "@docusaurus/mdx-loader": "0.0.0-4947",
24
+ "@docusaurus/utils": "0.0.0-4947",
25
+ "@docusaurus/utils-common": "0.0.0-4947",
26
+ "@docusaurus/utils-validation": "0.0.0-4947",
27
27
  "cheerio": "^1.0.0-rc.10",
28
28
  "feed": "^4.2.2",
29
29
  "fs-extra": "^10.1.0",
@@ -36,7 +36,7 @@
36
36
  "webpack": "^5.72.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@docusaurus/types": "0.0.0-4944",
39
+ "@docusaurus/types": "0.0.0-4947",
40
40
  "escape-string-regexp": "^4.0.0"
41
41
  },
42
42
  "peerDependencies": {
@@ -46,5 +46,5 @@
46
46
  "engines": {
47
47
  "node": ">=14"
48
48
  },
49
- "gitHead": "040fca0321d0539c16b21edc191af3142642b8c0"
49
+ "gitHead": "29ca5e7b0c611abdb0a1833411adc26873aee174"
50
50
  }
package/src/blogUtils.ts CHANGED
@@ -9,13 +9,7 @@ import fs from 'fs-extra';
9
9
  import path from 'path';
10
10
  import readingTime from 'reading-time';
11
11
  import _ from 'lodash';
12
- import type {
13
- BlogPost,
14
- BlogContentPaths,
15
- BlogMarkdownLoaderOptions,
16
- BlogTags,
17
- BlogPaginated,
18
- } from './types';
12
+ import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
19
13
  import {
20
14
  parseMarkdownString,
21
15
  normalizeUrl,
@@ -37,6 +31,9 @@ import logger from '@docusaurus/logger';
37
31
  import type {
38
32
  PluginOptions,
39
33
  ReadingTimeFunction,
34
+ BlogPost,
35
+ BlogTags,
36
+ BlogPaginated,
40
37
  } from '@docusaurus/plugin-content-blog';
41
38
 
42
39
  export function truncate(fileString: string, truncateMarker: RegExp): string {
package/src/feed.ts CHANGED
@@ -6,7 +6,6 @@
6
6
  */
7
7
 
8
8
  import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
9
- import type {BlogPost} from './types';
10
9
  import {normalizeUrl, readOutputHTMLFile} from '@docusaurus/utils';
11
10
  import {load as cheerioLoad} from 'cheerio';
12
11
  import type {DocusaurusConfig} from '@docusaurus/types';
@@ -16,6 +15,7 @@ import type {
16
15
  FeedType,
17
16
  PluginOptions,
18
17
  Author,
18
+ BlogPost,
19
19
  } from '@docusaurus/plugin-content-blog';
20
20
  import {blogPostContainerID} from '@docusaurus/utils-common';
21
21
 
package/src/index.ts CHANGED
@@ -20,24 +20,13 @@ import {
20
20
  getContentPathList,
21
21
  getDataFilePath,
22
22
  DEFAULT_PLUGIN_ID,
23
+ type TagsListItem,
24
+ type TagModule,
23
25
  } from '@docusaurus/utils';
24
26
  import {translateContent, getTranslationFiles} from './translations';
25
27
 
26
- import type {
27
- BlogTag,
28
- BlogTags,
29
- BlogContent,
30
- BlogPaginated,
31
- BlogContentPaths,
32
- BlogMarkdownLoaderOptions,
33
- } from './types';
34
- import type {
35
- LoadContext,
36
- Plugin,
37
- HtmlTags,
38
- TagsListItem,
39
- TagModule,
40
- } from '@docusaurus/types';
28
+ import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
29
+ import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types';
41
30
  import {
42
31
  generateBlogPosts,
43
32
  getSourceToPermalink,
@@ -50,6 +39,10 @@ import type {
50
39
  BlogPostFrontMatter,
51
40
  BlogPostMetadata,
52
41
  Assets,
42
+ BlogTag,
43
+ BlogTags,
44
+ BlogContent,
45
+ BlogPaginated,
53
46
  } from '@docusaurus/plugin-content-blog';
54
47
 
55
48
  export default async function pluginContentBlog(
@@ -7,9 +7,9 @@
7
7
 
8
8
  declare module '@docusaurus/plugin-content-blog' {
9
9
  import type {MDXOptions} from '@docusaurus/mdx-loader';
10
- import type {FrontMatterTag} from '@docusaurus/utils';
10
+ import type {FrontMatterTag, Tag} from '@docusaurus/utils';
11
+ import type {Plugin, LoadContext} from '@docusaurus/types';
11
12
  import type {Overwrite} from 'utility-types';
12
- import type {Tag} from '@docusaurus/types';
13
13
 
14
14
  export type Assets = {
15
15
  /**
@@ -411,6 +411,62 @@ declare module '@docusaurus/plugin-content-blog' {
411
411
  title: string;
412
412
  items: {title: string; permalink: string}[];
413
413
  };
414
+
415
+ export type BlogContent = {
416
+ blogSidebarTitle: string;
417
+ blogPosts: BlogPost[];
418
+ blogListPaginated: BlogPaginated[];
419
+ blogTags: BlogTags;
420
+ blogTagsListPath: string;
421
+ };
422
+
423
+ export type BlogTags = {
424
+ [permalink: string]: BlogTag;
425
+ };
426
+
427
+ export type BlogTag = Tag & {
428
+ /** Blog post permalinks. */
429
+ items: string[];
430
+ pages: BlogPaginated[];
431
+ };
432
+
433
+ export type BlogPost = {
434
+ id: string;
435
+ metadata: BlogPostMetadata;
436
+ content: string;
437
+ };
438
+
439
+ export type BlogPaginatedMetadata = {
440
+ /** Title of the entire blog. */
441
+ readonly blogTitle: string;
442
+ /** Blog description. */
443
+ readonly blogDescription: string;
444
+ /** Permalink to the next list page. */
445
+ readonly nextPage?: string;
446
+ /** Permalink of the current page. */
447
+ readonly permalink: string;
448
+ /** Permalink to the previous list page. */
449
+ readonly previousPage?: string;
450
+ /** Index of the current page, 1-based. */
451
+ readonly page: number;
452
+ /** Posts displayed on each list page. */
453
+ readonly postsPerPage: number;
454
+ /** Total number of posts in the entire blog. */
455
+ readonly totalCount: number;
456
+ /** Total number of list pages. */
457
+ readonly totalPages: number;
458
+ };
459
+
460
+ export type BlogPaginated = {
461
+ metadata: BlogPaginatedMetadata;
462
+ /** Blog post permalinks. */
463
+ items: string[];
464
+ };
465
+
466
+ export default function pluginContentBlog(
467
+ context: LoadContext,
468
+ options: PluginOptions,
469
+ ): Promise<Plugin<BlogContent>>;
414
470
  }
415
471
 
416
472
  declare module '@theme/BlogPostPage' {
@@ -447,34 +503,16 @@ declare module '@theme/BlogPostPage' {
447
503
 
448
504
  declare module '@theme/BlogListPage' {
449
505
  import type {Content} from '@theme/BlogPostPage';
450
- import type {BlogSidebar} from '@docusaurus/plugin-content-blog';
451
-
452
- export type Metadata = {
453
- /** Title of the entire blog. */
454
- readonly blogTitle: string;
455
- /** Blog description. */
456
- readonly blogDescription: string;
457
- /** Permalink to the next list page. */
458
- readonly nextPage?: string;
459
- /** Permalink of the current page. */
460
- readonly permalink: string;
461
- /** Permalink to the previous list page. */
462
- readonly previousPage?: string;
463
- /** Index of the current page, 1-based. */
464
- readonly page: number;
465
- /** Posts displayed on each list page. */
466
- readonly postsPerPage: number;
467
- /** Total number of posts in the entire blog. */
468
- readonly totalCount: number;
469
- /** Total number of list pages. */
470
- readonly totalPages: number;
471
- };
506
+ import type {
507
+ BlogSidebar,
508
+ BlogPaginatedMetadata,
509
+ } from '@docusaurus/plugin-content-blog';
472
510
 
473
511
  export interface Props {
474
512
  /** Blog sidebar. */
475
513
  readonly sidebar: BlogSidebar;
476
514
  /** Metadata of the current listing page. */
477
- readonly metadata: Metadata;
515
+ readonly metadata: BlogPaginatedMetadata;
478
516
  /**
479
517
  * Array of blog posts included on this page. Every post's metadata is also
480
518
  * available.
@@ -487,7 +525,7 @@ declare module '@theme/BlogListPage' {
487
525
 
488
526
  declare module '@theme/BlogTagsListPage' {
489
527
  import type {BlogSidebar} from '@docusaurus/plugin-content-blog';
490
- import type {TagsListItem} from '@docusaurus/types';
528
+ import type {TagsListItem} from '@docusaurus/utils';
491
529
 
492
530
  export interface Props {
493
531
  /** Blog sidebar. */
@@ -500,10 +538,12 @@ declare module '@theme/BlogTagsListPage' {
500
538
  }
501
539
 
502
540
  declare module '@theme/BlogTagsPostsPage' {
503
- import type {BlogSidebar} from '@docusaurus/plugin-content-blog';
541
+ import type {
542
+ BlogSidebar,
543
+ BlogPaginatedMetadata,
544
+ } from '@docusaurus/plugin-content-blog';
504
545
  import type {Content} from '@theme/BlogPostPage';
505
- import type {Metadata} from '@theme/BlogListPage';
506
- import type {TagModule} from '@docusaurus/types';
546
+ import type {TagModule} from '@docusaurus/utils';
507
547
 
508
548
  export interface Props {
509
549
  /** Blog sidebar. */
@@ -511,7 +551,7 @@ declare module '@theme/BlogTagsPostsPage' {
511
551
  /** Metadata of this tag. */
512
552
  readonly tag: TagModule;
513
553
  /** Looks exactly the same as the posts list page */
514
- readonly listMetadata: Metadata;
554
+ readonly listMetadata: BlogPaginatedMetadata;
515
555
  /**
516
556
  * Array of blog posts included on this page. Every post's metadata is also
517
557
  * available.
@@ -5,9 +5,12 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import type {BlogContent, BlogPaginated} from './types';
9
8
  import type {TranslationFileContent, TranslationFile} from '@docusaurus/types';
10
- import type {PluginOptions} from '@docusaurus/plugin-content-blog';
9
+ import type {
10
+ PluginOptions,
11
+ BlogContent,
12
+ BlogPaginated,
13
+ } from '@docusaurus/plugin-content-blog';
11
14
 
12
15
  function translateListPage(
13
16
  blogListPaginated: BlogPaginated[],
package/src/types.ts CHANGED
@@ -6,42 +6,9 @@
6
6
  */
7
7
 
8
8
  import type {BrokenMarkdownLink, ContentPaths} from '@docusaurus/utils';
9
- import type {Tag} from '@docusaurus/types';
10
- import type {BlogPostMetadata} from '@docusaurus/plugin-content-blog';
11
- import type {Metadata as BlogPaginatedMetadata} from '@theme/BlogListPage';
12
9
 
13
10
  export type BlogContentPaths = ContentPaths;
14
11
 
15
- export type BlogContent = {
16
- blogSidebarTitle: string;
17
- blogPosts: BlogPost[];
18
- blogListPaginated: BlogPaginated[];
19
- blogTags: BlogTags;
20
- blogTagsListPath: string;
21
- };
22
-
23
- export type BlogTags = {
24
- [permalink: string]: BlogTag;
25
- };
26
-
27
- export type BlogTag = Tag & {
28
- /** Blog post permalinks. */
29
- items: string[];
30
- pages: BlogPaginated[];
31
- };
32
-
33
- export type BlogPost = {
34
- id: string;
35
- metadata: BlogPostMetadata;
36
- content: string;
37
- };
38
-
39
- export type BlogPaginated = {
40
- metadata: BlogPaginatedMetadata;
41
- /** Blog post permalinks. */
42
- items: string[];
43
- };
44
-
45
12
  export type BlogBrokenMarkdownLink = BrokenMarkdownLink<BlogContentPaths>;
46
13
  export type BlogMarkdownLoaderOptions = {
47
14
  siteDir: string;