@docusaurus/plugin-content-blog 0.0.0-4428 → 0.0.0-4433

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/feed.d.ts CHANGED
@@ -4,15 +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 { Feed } from 'feed';
8
7
  import type { BlogPost } from './types';
9
8
  import type { DocusaurusConfig } from '@docusaurus/types';
10
9
  import type { PluginOptions } from '@docusaurus/plugin-content-blog';
11
- export declare function generateBlogFeed({ blogPosts, options, siteConfig, }: {
12
- blogPosts: BlogPost[];
13
- options: PluginOptions;
14
- siteConfig: DocusaurusConfig;
15
- }): Promise<Feed | null>;
16
10
  export declare function createBlogFeedFiles({ blogPosts, options, siteConfig, outDir, }: {
17
11
  blogPosts: BlogPost[];
18
12
  options: PluginOptions;
package/lib/feed.js CHANGED
@@ -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.createBlogFeedFiles = exports.generateBlogFeed = void 0;
9
+ exports.createBlogFeedFiles = void 0;
10
10
  const tslib_1 = require("tslib");
11
11
  const feed_1 = require("feed");
12
12
  const utils_1 = require("@docusaurus/utils");
@@ -32,8 +32,7 @@ async function generateBlogFeed({ blogPosts, options, siteConfig, }) {
32
32
  const { feedOptions, routeBasePath } = options;
33
33
  const { url: siteUrl, baseUrl, title, favicon } = siteConfig;
34
34
  const blogBaseUrl = (0, utils_1.normalizeUrl)([siteUrl, baseUrl, routeBasePath]);
35
- const updated = (blogPosts[0] && blogPosts[0].metadata.date) ||
36
- new Date('2015-10-25T16:29:00.000-07:00'); // weird legacy magic date
35
+ const updated = blogPosts[0] && blogPosts[0].metadata.date;
37
36
  const feed = new feed_1.Feed({
38
37
  id: blogBaseUrl,
39
38
  title: feedOptions.title || `${title} Blog`,
@@ -69,7 +68,6 @@ async function generateBlogFeed({ blogPosts, options, siteConfig, }) {
69
68
  });
70
69
  return feed;
71
70
  }
72
- exports.generateBlogFeed = generateBlogFeed;
73
71
  async function createBlogFeedFile({ feed, feedType, generatePath, }) {
74
72
  const [feedContent, feedPath] = (() => {
75
73
  switch (feedType) {
@@ -84,7 +82,7 @@ async function createBlogFeedFile({ feed, feedType, generatePath, }) {
84
82
  }
85
83
  })();
86
84
  try {
87
- await fs_extra_1.default.outputFile(path_1.default.join(generatePath, feedPath), feedContent);
85
+ await fs_extra_1.default.outputFile((0, utils_1.posixPath)(path_1.default.join(generatePath, feedPath)), feedContent);
88
86
  }
89
87
  catch (err) {
90
88
  throw new Error(`Generating ${feedType} feed failed: ${err}.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-blog",
3
- "version": "0.0.0-4428",
3
+ "version": "0.0.0-4433",
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-4428",
22
- "@docusaurus/logger": "0.0.0-4428",
23
- "@docusaurus/mdx-loader": "0.0.0-4428",
24
- "@docusaurus/utils": "0.0.0-4428",
25
- "@docusaurus/utils-validation": "0.0.0-4428",
21
+ "@docusaurus/core": "0.0.0-4433",
22
+ "@docusaurus/logger": "0.0.0-4433",
23
+ "@docusaurus/mdx-loader": "0.0.0-4433",
24
+ "@docusaurus/utils": "0.0.0-4433",
25
+ "@docusaurus/utils-validation": "0.0.0-4433",
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-4428"
39
+ "@docusaurus/types": "0.0.0-4433"
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": "db57493754afaf674482b15cc704ef8d5424e7ec"
48
+ "gitHead": "ffbadadb02dbb89e253b79dfb6c06609cae500b5"
49
49
  }
package/src/feed.ts CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
9
9
  import type {BlogPost} from './types';
10
- import {normalizeUrl, mdxToHtml} from '@docusaurus/utils';
10
+ import {normalizeUrl, mdxToHtml, posixPath} from '@docusaurus/utils';
11
11
  import type {DocusaurusConfig} from '@docusaurus/types';
12
12
  import path from 'path';
13
13
  import fs from 'fs-extra';
@@ -30,7 +30,7 @@ function mdxToFeedContent(mdxContent: string): string | undefined {
30
30
  }
31
31
  }
32
32
 
33
- export async function generateBlogFeed({
33
+ async function generateBlogFeed({
34
34
  blogPosts,
35
35
  options,
36
36
  siteConfig,
@@ -47,9 +47,7 @@ export async function generateBlogFeed({
47
47
  const {url: siteUrl, baseUrl, title, favicon} = siteConfig;
48
48
  const blogBaseUrl = normalizeUrl([siteUrl, baseUrl, routeBasePath]);
49
49
 
50
- const updated =
51
- (blogPosts[0] && blogPosts[0].metadata.date) ||
52
- new Date('2015-10-25T16:29:00.000-07:00'); // weird legacy magic date
50
+ const updated = blogPosts[0] && blogPosts[0].metadata.date;
53
51
 
54
52
  const feed = new Feed({
55
53
  id: blogBaseUrl,
@@ -118,7 +116,10 @@ async function createBlogFeedFile({
118
116
  }
119
117
  })();
120
118
  try {
121
- await fs.outputFile(path.join(generatePath, feedPath), feedContent);
119
+ await fs.outputFile(
120
+ posixPath(path.join(generatePath, feedPath)),
121
+ feedContent,
122
+ );
122
123
  } catch (err) {
123
124
  throw new Error(`Generating ${feedType} feed failed: ${err}.`);
124
125
  }