@docusaurus/plugin-content-blog 4.0.0-canary-6870 → 4.0.0-canary-6872

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
@@ -18,7 +18,7 @@ exports.generateBlogPosts = generateBlogPosts;
18
18
  exports.applyProcessBlogPosts = applyProcessBlogPosts;
19
19
  const tslib_1 = require("tslib");
20
20
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
21
- const path_1 = tslib_1.__importDefault(require("path"));
21
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
22
22
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
23
23
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
24
24
  const utils_1 = require("@docusaurus/utils");
@@ -166,7 +166,7 @@ async function processBlogSourceFile(blogSourceRelative, contentPaths, context,
166
166
  const { routeBasePath, tagsBasePath: tagsRouteBasePath, truncateMarker, showReadingTime, editUrl, } = options;
167
167
  // Lookup in localized folder in priority
168
168
  const blogDirPath = await (0, utils_1.getFolderContainingFile)((0, utils_1.getContentPathList)(contentPaths), blogSourceRelative);
169
- const blogSourceAbsolute = path_1.default.join(blogDirPath, blogSourceRelative);
169
+ const blogSourceAbsolute = node_path_1.default.join(blogDirPath, blogSourceRelative);
170
170
  const { frontMatter, content, contentTitle, excerpt } = await parseBlogPostMarkdownFile({
171
171
  filePath: blogSourceAbsolute,
172
172
  parseFrontMatter,
@@ -193,10 +193,10 @@ async function processBlogSourceFile(blogSourceRelative, contentPaths, context,
193
193
  const slug = frontMatter.slug ?? parsedBlogFileName.slug;
194
194
  const permalink = (0, utils_1.normalizeUrl)([baseUrl, routeBasePath, slug]);
195
195
  function getBlogEditUrl() {
196
- const blogPathRelative = path_1.default.relative(blogDirPath, path_1.default.resolve(blogSourceAbsolute));
196
+ const blogPathRelative = node_path_1.default.relative(blogDirPath, node_path_1.default.resolve(blogSourceAbsolute));
197
197
  if (typeof editUrl === 'function') {
198
198
  return editUrl({
199
- blogDirPath: (0, utils_1.posixPath)(path_1.default.relative(siteDir, blogDirPath)),
199
+ blogDirPath: (0, utils_1.posixPath)(node_path_1.default.relative(siteDir, blogDirPath)),
200
200
  blogPath: (0, utils_1.posixPath)(blogPathRelative),
201
201
  permalink,
202
202
  locale: i18n.currentLocale,
@@ -211,7 +211,7 @@ async function processBlogSourceFile(blogSourceRelative, contentPaths, context,
211
211
  : contentPaths.contentPath;
212
212
  const contentPathEditUrl = (0, utils_1.normalizeUrl)([
213
213
  editUrl,
214
- (0, utils_1.posixPath)(path_1.default.relative(siteDir, fileContentPath)),
214
+ (0, utils_1.posixPath)(node_path_1.default.relative(siteDir, fileContentPath)),
215
215
  ]);
216
216
  return (0, utils_1.getEditUrl)(blogPathRelative, contentPathEditUrl);
217
217
  }
package/lib/feed.js CHANGED
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.createBlogFeedFiles = createBlogFeedFiles;
10
10
  exports.createFeedHtmlHeadTags = createFeedHtmlHeadTags;
11
11
  const tslib_1 = require("tslib");
12
- const path_1 = tslib_1.__importDefault(require("path"));
12
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
13
13
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
14
14
  const feed_1 = require("feed");
15
15
  const srcset_1 = require("srcset");
@@ -107,18 +107,18 @@ async function defaultCreateFeedItems({ blogPosts, siteConfig, outDir, }) {
107
107
  }));
108
108
  }
109
109
  async function resolveXsltFilePaths({ xsltFilePath, contentPaths, }) {
110
- const xsltAbsolutePath = path_1.default.isAbsolute(xsltFilePath)
110
+ const xsltAbsolutePath = node_path_1.default.isAbsolute(xsltFilePath)
111
111
  ? xsltFilePath
112
112
  : ((await (0, utils_1.getDataFilePath)({ filePath: xsltFilePath, contentPaths })) ??
113
- path_1.default.resolve(contentPaths.contentPath, xsltFilePath));
113
+ node_path_1.default.resolve(contentPaths.contentPath, xsltFilePath));
114
114
  if (!(await fs_extra_1.default.pathExists(xsltAbsolutePath))) {
115
- throw new Error(logger_1.default.interpolate `Blog feed XSLT file not found at path=${path_1.default.relative(process.cwd(), xsltAbsolutePath)}`);
115
+ throw new Error(logger_1.default.interpolate `Blog feed XSLT file not found at path=${node_path_1.default.relative(process.cwd(), xsltAbsolutePath)}`);
116
116
  }
117
- const parsedPath = path_1.default.parse(xsltAbsolutePath);
118
- const cssAbsolutePath = path_1.default.resolve(parsedPath.dir, `${parsedPath.name}.css`);
117
+ const parsedPath = node_path_1.default.parse(xsltAbsolutePath);
118
+ const cssAbsolutePath = node_path_1.default.resolve(parsedPath.dir, `${parsedPath.name}.css`);
119
119
  if (!(await fs_extra_1.default.pathExists(cssAbsolutePath))) {
120
- throw new Error(logger_1.default.interpolate `Blog feed XSLT file was found at path=${path_1.default.relative(process.cwd(), xsltAbsolutePath)}
121
- But its expected co-located CSS file could not be found at path=${path_1.default.relative(process.cwd(), cssAbsolutePath)}
120
+ throw new Error(logger_1.default.interpolate `Blog feed XSLT file was found at path=${node_path_1.default.relative(process.cwd(), xsltAbsolutePath)}
121
+ But its expected co-located CSS file could not be found at path=${node_path_1.default.relative(process.cwd(), cssAbsolutePath)}
122
122
  If you want to provide a custom XSLT file, you must provide a CSS file with the exact same name.`);
123
123
  }
124
124
  return { xsltAbsolutePath, cssAbsolutePath };
@@ -128,8 +128,8 @@ async function generateXsltFiles({ xsltFilePath, generatePath, contentPaths, })
128
128
  xsltFilePath,
129
129
  contentPaths,
130
130
  });
131
- const xsltOutputPath = path_1.default.join(generatePath, path_1.default.basename(xsltAbsolutePath));
132
- const cssOutputPath = path_1.default.join(generatePath, path_1.default.basename(cssAbsolutePath));
131
+ const xsltOutputPath = node_path_1.default.join(generatePath, node_path_1.default.basename(xsltAbsolutePath));
132
+ const cssOutputPath = node_path_1.default.join(generatePath, node_path_1.default.basename(cssAbsolutePath));
133
133
  await fs_extra_1.default.copy(xsltAbsolutePath, xsltOutputPath);
134
134
  await fs_extra_1.default.copy(cssAbsolutePath, cssOutputPath);
135
135
  }
@@ -137,7 +137,7 @@ async function generateXsltFiles({ xsltFilePath, generatePath, contentPaths, })
137
137
  // Good enough for now: we probably don't need a full XML parser just for that
138
138
  // See also https://darekkay.com/blog/rss-styling/
139
139
  function injectXslt({ feedContent, xsltFilePath, }) {
140
- return feedContent.replace('<?xml version="1.0" encoding="utf-8"?>', `<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="${path_1.default.basename(xsltFilePath)}"?>`);
140
+ return feedContent.replace('<?xml version="1.0" encoding="utf-8"?>', `<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="${node_path_1.default.basename(xsltFilePath)}"?>`);
141
141
  }
142
142
  const FeedConfigs = {
143
143
  rss: {
@@ -165,7 +165,7 @@ async function createBlogFeedFile({ feed, feedType, generatePath, feedOptions, c
165
165
  await generateXsltFiles({ xsltFilePath, contentPaths, generatePath });
166
166
  feedContent = injectXslt({ feedContent, xsltFilePath });
167
167
  }
168
- const outputPath = path_1.default.join(generatePath, feedConfig.outputFileName);
168
+ const outputPath = node_path_1.default.join(generatePath, feedConfig.outputFileName);
169
169
  await fs_extra_1.default.outputFile(outputPath, feedContent);
170
170
  }
171
171
  catch (err) {
@@ -195,7 +195,7 @@ async function createBlogFeedFiles({ blogPosts: allBlogPosts, options, siteConfi
195
195
  await Promise.all(feedTypes.map((feedType) => createBlogFeedFile({
196
196
  feed,
197
197
  feedType,
198
- generatePath: path_1.default.join(outDir, options.routeBasePath),
198
+ generatePath: node_path_1.default.join(outDir, options.routeBasePath),
199
199
  feedOptions: options.feedOptions,
200
200
  contentPaths,
201
201
  })));
package/lib/index.js CHANGED
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.validateOptions = void 0;
10
10
  exports.default = pluginContentBlog;
11
11
  const tslib_1 = require("tslib");
12
- const path_1 = tslib_1.__importDefault(require("path"));
12
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
13
13
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
14
14
  const combine_promises_1 = tslib_1.__importDefault(require("combine-promises"));
15
15
  const utils_1 = require("@docusaurus/utils");
@@ -34,7 +34,7 @@ async function pluginContentBlog(context, options) {
34
34
  const { baseUrl } = siteConfig;
35
35
  const shouldTranslate = (0, utils_1.getLocaleConfig)(context.i18n).translate;
36
36
  const contentPaths = {
37
- contentPath: path_1.default.resolve(siteDir, options.path),
37
+ contentPath: node_path_1.default.resolve(siteDir, options.path),
38
38
  contentPathLocalized: shouldTranslate
39
39
  ? (0, utils_1.getPluginI18nPath)({
40
40
  localizationDir,
@@ -44,12 +44,12 @@ async function pluginContentBlog(context, options) {
44
44
  : undefined,
45
45
  };
46
46
  const pluginId = options.id;
47
- const pluginDataDirRoot = path_1.default.join(generatedFilesDir, PluginName);
48
- const dataDir = path_1.default.join(pluginDataDirRoot, pluginId);
47
+ const pluginDataDirRoot = node_path_1.default.join(generatedFilesDir, PluginName);
48
+ const dataDir = node_path_1.default.join(pluginDataDirRoot, pluginId);
49
49
  // TODO Docusaurus v4 breaking change
50
50
  // module aliasing should be automatic
51
51
  // we should never find local absolute FS paths in the codegen registry
52
- const aliasedSource = (source) => `~blog/${(0, utils_1.posixPath)(path_1.default.relative(pluginDataDirRoot, source))}`;
52
+ const aliasedSource = (source) => `~blog/${(0, utils_1.posixPath)(node_path_1.default.relative(pluginDataDirRoot, source))}`;
53
53
  const authorsMapFilePath = await (0, utils_1.getDataFilePath)({
54
54
  filePath: options.authorsMapPath,
55
55
  contentPaths,
@@ -69,14 +69,14 @@ async function pluginContentBlog(context, options) {
69
69
  ...beforeDefaultRemarkPlugins,
70
70
  ],
71
71
  beforeDefaultRehypePlugins,
72
- staticDirs: siteConfig.staticDirectories.map((dir) => path_1.default.resolve(siteDir, dir)),
72
+ staticDirs: siteConfig.staticDirectories.map((dir) => node_path_1.default.resolve(siteDir, dir)),
73
73
  siteDir,
74
74
  isMDXPartial: (0, glob_1.createAbsoluteFilePathMatcher)(options.exclude, contentDirs),
75
75
  metadataPath: (mdxPath) => {
76
76
  // Note that metadataPath must be the same/in-sync as
77
77
  // the path from createData for each MDX.
78
78
  const aliasedPath = (0, utils_1.aliasedSitePath)(mdxPath, siteDir);
79
- return path_1.default.join(dataDir, `${(0, utils_1.docuHash)(aliasedPath)}.json`);
79
+ return node_path_1.default.join(dataDir, `${(0, utils_1.docuHash)(aliasedPath)}.json`);
80
80
  },
81
81
  // For blog posts a title in markdown is always removed
82
82
  // Blog posts title are rendered separately
@@ -107,7 +107,7 @@ async function pluginContentBlog(context, options) {
107
107
  truncateMarker,
108
108
  };
109
109
  return {
110
- loader: path_1.default.resolve(__dirname, './markdownLoader.js'),
110
+ loader: node_path_1.default.resolve(__dirname, './markdownLoader.js'),
111
111
  options: markdownLoaderOptions,
112
112
  };
113
113
  }
package/lib/options.js CHANGED
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.XSLTBuiltInPaths = exports.DEFAULT_OPTIONS = void 0;
10
10
  exports.validateOptions = validateOptions;
11
11
  const tslib_1 = require("tslib");
12
- const path_1 = tslib_1.__importDefault(require("path"));
12
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
13
13
  const utils_validation_1 = require("@docusaurus/utils-validation");
14
14
  const utils_1 = require("@docusaurus/utils");
15
15
  const glob_1 = require("@docusaurus/glob");
@@ -65,8 +65,8 @@ exports.DEFAULT_OPTIONS = {
65
65
  onUntruncatedBlogPosts: 'warn',
66
66
  };
67
67
  exports.XSLTBuiltInPaths = {
68
- rss: path_1.default.resolve(__dirname, '..', 'assets', 'rss.xsl'),
69
- atom: path_1.default.resolve(__dirname, '..', 'assets', 'atom.xsl'),
68
+ rss: node_path_1.default.resolve(__dirname, '..', 'assets', 'rss.xsl'),
69
+ atom: node_path_1.default.resolve(__dirname, '..', 'assets', 'atom.xsl'),
70
70
  };
71
71
  function normalizeXsltOption(option, type) {
72
72
  if (typeof option === 'string') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-blog",
3
- "version": "4.0.0-canary-6870",
3
+ "version": "4.0.0-canary-6872",
4
4
  "description": "Blog plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-content-blog.d.ts",
@@ -31,16 +31,16 @@
31
31
  },
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@docusaurus/core": "4.0.0-canary-6870",
35
- "@docusaurus/glob": "4.0.0-canary-6870",
36
- "@docusaurus/logger": "4.0.0-canary-6870",
37
- "@docusaurus/mdx-loader": "4.0.0-canary-6870",
38
- "@docusaurus/module-type-aliases": "4.0.0-canary-6870",
39
- "@docusaurus/theme-common": "4.0.0-canary-6870",
40
- "@docusaurus/types": "4.0.0-canary-6870",
41
- "@docusaurus/utils": "4.0.0-canary-6870",
42
- "@docusaurus/utils-common": "4.0.0-canary-6870",
43
- "@docusaurus/utils-validation": "4.0.0-canary-6870",
34
+ "@docusaurus/core": "4.0.0-canary-6872",
35
+ "@docusaurus/glob": "4.0.0-canary-6872",
36
+ "@docusaurus/logger": "4.0.0-canary-6872",
37
+ "@docusaurus/mdx-loader": "4.0.0-canary-6872",
38
+ "@docusaurus/module-type-aliases": "4.0.0-canary-6872",
39
+ "@docusaurus/theme-common": "4.0.0-canary-6872",
40
+ "@docusaurus/types": "4.0.0-canary-6872",
41
+ "@docusaurus/utils": "4.0.0-canary-6872",
42
+ "@docusaurus/utils-common": "4.0.0-canary-6872",
43
+ "@docusaurus/utils-validation": "4.0.0-canary-6872",
44
44
  "cheerio": "^1.2.0",
45
45
  "combine-promises": "^1.2.0",
46
46
  "feed": "^5.2.1",
@@ -69,5 +69,5 @@
69
69
  "tree-node-cli": "^3.0.0",
70
70
  "unified": "^11.0.5"
71
71
  },
72
- "gitHead": "ea3b6292c97af2e26f559f112cf9ea75a58a09c8"
72
+ "gitHead": "97ddb0451f086d8a1c20967f0d324d667dc58ebf"
73
73
  }
package/src/blogUtils.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import fs from 'fs-extra';
9
- import path from 'path';
9
+ import path from 'node:path';
10
10
  import _ from 'lodash';
11
11
  import logger from '@docusaurus/logger';
12
12
  import {
package/src/feed.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import path from 'path';
8
+ import path from 'node:path';
9
9
  import fs from 'fs-extra';
10
10
  import {Feed, type Author as FeedAuthor} from 'feed';
11
11
  import {parseSrcset, stringifySrcset} from 'srcset';
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import path from 'path';
8
+ import path from 'node:path';
9
9
  import logger from '@docusaurus/logger';
10
10
  import combinePromises from 'combine-promises';
11
11
 
package/src/options.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import path from 'path';
8
+ import path from 'node:path';
9
9
  import {
10
10
  Joi,
11
11
  RemarkPluginsSchema,