@docusaurus/plugin-content-pages 4.0.0-canary-6869 → 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/content.js +7 -7
- package/lib/index.js +5 -5
- package/package.json +8 -8
- package/src/content.ts +1 -1
- package/src/index.ts +1 -1
package/lib/content.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.createPagesContentPaths = createPagesContentPaths;
|
|
|
10
10
|
exports.loadPagesContent = loadPagesContent;
|
|
11
11
|
const tslib_1 = require("tslib");
|
|
12
12
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
|
-
const
|
|
13
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
14
14
|
const utils_1 = require("@docusaurus/utils");
|
|
15
15
|
const glob_1 = require("@docusaurus/glob");
|
|
16
16
|
const frontMatter_1 = require("./frontMatter");
|
|
@@ -18,7 +18,7 @@ function createPagesContentPaths({ context, options, }) {
|
|
|
18
18
|
const { siteDir, localizationDir } = context;
|
|
19
19
|
const shouldTranslate = (0, utils_1.getLocaleConfig)(context.i18n).translate;
|
|
20
20
|
return {
|
|
21
|
-
contentPath:
|
|
21
|
+
contentPath: node_path_1.default.resolve(siteDir, options.path),
|
|
22
22
|
contentPathLocalized: shouldTranslate
|
|
23
23
|
? (0, utils_1.getPluginI18nPath)({
|
|
24
24
|
localizationDir,
|
|
@@ -54,7 +54,7 @@ async function processPageSourceFile(relativeSource, params) {
|
|
|
54
54
|
const { editUrl } = options;
|
|
55
55
|
// Lookup in localized folder in priority
|
|
56
56
|
const contentPath = await (0, utils_1.getFolderContainingFile)((0, utils_1.getContentPathList)(contentPaths), relativeSource);
|
|
57
|
-
const source =
|
|
57
|
+
const source = node_path_1.default.join(contentPath, relativeSource);
|
|
58
58
|
const aliasedSourcePath = (0, utils_1.aliasedSitePath)(source, siteDir);
|
|
59
59
|
const filenameSlug = (0, utils_1.encodePath)((0, utils_1.fileToPath)(relativeSource));
|
|
60
60
|
if (!isMarkdownSource(relativeSource)) {
|
|
@@ -77,12 +77,12 @@ async function processPageSourceFile(relativeSource, params) {
|
|
|
77
77
|
const slug = frontMatter.slug ?? filenameSlug;
|
|
78
78
|
const permalink = (0, utils_1.normalizeUrl)([baseUrl, options.routeBasePath, slug]);
|
|
79
79
|
const pagesDirPath = await (0, utils_1.getFolderContainingFile)((0, utils_1.getContentPathList)(contentPaths), relativeSource);
|
|
80
|
-
const pagesSourceAbsolute =
|
|
80
|
+
const pagesSourceAbsolute = node_path_1.default.join(pagesDirPath, relativeSource);
|
|
81
81
|
function getPagesEditUrl() {
|
|
82
|
-
const pagesPathRelative =
|
|
82
|
+
const pagesPathRelative = node_path_1.default.relative(pagesDirPath, node_path_1.default.resolve(pagesSourceAbsolute));
|
|
83
83
|
if (typeof editUrl === 'function') {
|
|
84
84
|
return editUrl({
|
|
85
|
-
pagesDirPath: (0, utils_1.posixPath)(
|
|
85
|
+
pagesDirPath: (0, utils_1.posixPath)(node_path_1.default.relative(siteDir, pagesDirPath)),
|
|
86
86
|
pagesPath: (0, utils_1.posixPath)(pagesPathRelative),
|
|
87
87
|
permalink,
|
|
88
88
|
locale: i18n.currentLocale,
|
|
@@ -97,7 +97,7 @@ async function processPageSourceFile(relativeSource, params) {
|
|
|
97
97
|
: contentPaths.contentPath;
|
|
98
98
|
const contentPathEditUrl = (0, utils_1.normalizeUrl)([
|
|
99
99
|
editUrl,
|
|
100
|
-
(0, utils_1.posixPath)(
|
|
100
|
+
(0, utils_1.posixPath)(node_path_1.default.relative(siteDir, fileContentPath)),
|
|
101
101
|
]);
|
|
102
102
|
return (0, utils_1.getEditUrl)(pagesPathRelative, contentPathEditUrl);
|
|
103
103
|
}
|
package/lib/index.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.validateOptions = void 0;
|
|
|
10
10
|
exports.default = pluginContentPages;
|
|
11
11
|
const tslib_1 = require("tslib");
|
|
12
12
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
|
-
const
|
|
13
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
14
14
|
const utils_1 = require("@docusaurus/utils");
|
|
15
15
|
const glob_1 = require("@docusaurus/glob");
|
|
16
16
|
const mdx_loader_1 = require("@docusaurus/mdx-loader");
|
|
@@ -21,8 +21,8 @@ function pluginContentPages(context, options) {
|
|
|
21
21
|
const { siteConfig, siteDir, generatedFilesDir } = context;
|
|
22
22
|
const contentPaths = (0, content_1.createPagesContentPaths)({ context, options });
|
|
23
23
|
const contentHelpers = (0, contentHelpers_1.createContentHelpers)();
|
|
24
|
-
const pluginDataDirRoot =
|
|
25
|
-
const dataDir =
|
|
24
|
+
const pluginDataDirRoot = node_path_1.default.join(generatedFilesDir, 'docusaurus-plugin-content-pages');
|
|
25
|
+
const dataDir = node_path_1.default.join(pluginDataDirRoot, options.id);
|
|
26
26
|
function createPagesMDXLoaderRule() {
|
|
27
27
|
const { admonitions, rehypePlugins, remarkPlugins, recmaPlugins, beforeDefaultRehypePlugins, beforeDefaultRemarkPlugins, } = options;
|
|
28
28
|
const contentDirs = (0, utils_1.getContentPathList)(contentPaths);
|
|
@@ -38,14 +38,14 @@ function pluginContentPages(context, options) {
|
|
|
38
38
|
recmaPlugins,
|
|
39
39
|
beforeDefaultRehypePlugins,
|
|
40
40
|
beforeDefaultRemarkPlugins,
|
|
41
|
-
staticDirs: siteConfig.staticDirectories.map((dir) =>
|
|
41
|
+
staticDirs: siteConfig.staticDirectories.map((dir) => node_path_1.default.resolve(siteDir, dir)),
|
|
42
42
|
siteDir,
|
|
43
43
|
isMDXPartial: (0, glob_1.createAbsoluteFilePathMatcher)(options.exclude, contentDirs),
|
|
44
44
|
metadataPath: (mdxPath) => {
|
|
45
45
|
// Note that metadataPath must be the same/in-sync as
|
|
46
46
|
// the path from createData for each MDX.
|
|
47
47
|
const aliasedSource = (0, utils_1.aliasedSitePath)(mdxPath, siteDir);
|
|
48
|
-
return
|
|
48
|
+
return node_path_1.default.join(dataDir, `${(0, utils_1.docuHash)(aliasedSource)}.json`);
|
|
49
49
|
},
|
|
50
50
|
// createAssets converts relative paths to require() calls
|
|
51
51
|
createAssets: ({ frontMatter }) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-pages",
|
|
3
|
-
"version": "4.0.0-canary-
|
|
3
|
+
"version": "4.0.0-canary-6872",
|
|
4
4
|
"description": "Pages plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-pages.d.ts",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "4.0.0-canary-
|
|
22
|
-
"@docusaurus/glob": "4.0.0-canary-
|
|
23
|
-
"@docusaurus/mdx-loader": "4.0.0-canary-
|
|
24
|
-
"@docusaurus/types": "4.0.0-canary-
|
|
25
|
-
"@docusaurus/utils": "4.0.0-canary-
|
|
26
|
-
"@docusaurus/utils-validation": "4.0.0-canary-
|
|
21
|
+
"@docusaurus/core": "4.0.0-canary-6872",
|
|
22
|
+
"@docusaurus/glob": "4.0.0-canary-6872",
|
|
23
|
+
"@docusaurus/mdx-loader": "4.0.0-canary-6872",
|
|
24
|
+
"@docusaurus/types": "4.0.0-canary-6872",
|
|
25
|
+
"@docusaurus/utils": "4.0.0-canary-6872",
|
|
26
|
+
"@docusaurus/utils-validation": "4.0.0-canary-6872",
|
|
27
27
|
"fs-extra": "^11.4.0",
|
|
28
28
|
"tslib": "^2.8.1",
|
|
29
29
|
"webpack": "^5.111.0"
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=24.21"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "97ddb0451f086d8a1c20967f0d324d667dc58ebf"
|
|
39
39
|
}
|
package/src/content.ts
CHANGED