@docusaurus/plugin-content-docs 0.0.0-6067 → 0.0.0-6069
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/index.js +38 -35
- package/package.json +11 -11
- package/src/index.ts +50 -47
package/lib/index.js
CHANGED
|
@@ -47,42 +47,45 @@ async function pluginContentDocs(context, options) {
|
|
|
47
47
|
.flatMap(utils_1.getContentPathList)
|
|
48
48
|
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
|
|
49
49
|
.map(utils_1.addTrailingPathSeparator);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
50
|
+
return (0, mdx_loader_1.createMDXLoaderRule)({
|
|
51
|
+
include: contentDirs,
|
|
52
|
+
options: {
|
|
53
|
+
useCrossCompilerCache: siteConfig.future.experimental_faster.mdxCrossCompilerCache,
|
|
54
|
+
admonitions: options.admonitions,
|
|
55
|
+
remarkPlugins,
|
|
56
|
+
rehypePlugins,
|
|
57
|
+
recmaPlugins,
|
|
58
|
+
beforeDefaultRehypePlugins,
|
|
59
|
+
beforeDefaultRemarkPlugins,
|
|
60
|
+
staticDirs: siteConfig.staticDirectories.map((dir) => path_1.default.resolve(siteDir, dir)),
|
|
61
|
+
siteDir,
|
|
62
|
+
isMDXPartial: (0, utils_1.createAbsoluteFilePathMatcher)(options.exclude, contentDirs),
|
|
63
|
+
metadataPath: (mdxPath) => {
|
|
64
|
+
// Note that metadataPath must be the same/in-sync as
|
|
65
|
+
// the path from createData for each MDX.
|
|
66
|
+
const aliasedPath = (0, utils_1.aliasedSitePath)(mdxPath, siteDir);
|
|
67
|
+
return path_1.default.join(dataDir, `${(0, utils_1.docuHash)(aliasedPath)}.json`);
|
|
68
|
+
},
|
|
69
|
+
// createAssets converts relative paths to require() calls
|
|
70
|
+
createAssets: ({ frontMatter }) => ({
|
|
71
|
+
image: frontMatter.image,
|
|
72
|
+
}),
|
|
73
|
+
markdownConfig: siteConfig.markdown,
|
|
74
|
+
resolveMarkdownLink: ({ linkPathname, sourceFilePath }) => {
|
|
75
|
+
const version = (0, versions_1.getVersionFromSourceFilePath)(sourceFilePath, versionsMetadata);
|
|
76
|
+
const permalink = (0, utils_1.resolveMarkdownLinkPathname)(linkPathname, {
|
|
77
|
+
sourceFilePath,
|
|
78
|
+
sourceToPermalink: contentHelpers.sourceToPermalink,
|
|
79
|
+
siteDir,
|
|
80
|
+
contentPaths: version,
|
|
81
|
+
});
|
|
82
|
+
if (permalink === null) {
|
|
83
|
+
logger_1.default.report(siteConfig.onBrokenMarkdownLinks) `Docs markdown link couldn't be resolved: (url=${linkPathname}) in source file path=${sourceFilePath} for version number=${version.versionName}`;
|
|
84
|
+
}
|
|
85
|
+
return permalink;
|
|
86
|
+
},
|
|
83
87
|
},
|
|
84
|
-
};
|
|
85
|
-
return (0, mdx_loader_1.createMDXLoaderRule)({ include: contentDirs, options: loaderOptions });
|
|
88
|
+
});
|
|
86
89
|
}
|
|
87
90
|
const docsMDXLoaderRule = await createDocsMDXLoaderRule();
|
|
88
91
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-6069",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@docusaurus/core": "0.0.0-
|
|
39
|
-
"@docusaurus/logger": "0.0.0-
|
|
40
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
41
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
42
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
43
|
-
"@docusaurus/types": "0.0.0-
|
|
44
|
-
"@docusaurus/utils": "0.0.0-
|
|
45
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
46
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
38
|
+
"@docusaurus/core": "0.0.0-6069",
|
|
39
|
+
"@docusaurus/logger": "0.0.0-6069",
|
|
40
|
+
"@docusaurus/mdx-loader": "0.0.0-6069",
|
|
41
|
+
"@docusaurus/module-type-aliases": "0.0.0-6069",
|
|
42
|
+
"@docusaurus/theme-common": "0.0.0-6069",
|
|
43
|
+
"@docusaurus/types": "0.0.0-6069",
|
|
44
|
+
"@docusaurus/utils": "0.0.0-6069",
|
|
45
|
+
"@docusaurus/utils-common": "0.0.0-6069",
|
|
46
|
+
"@docusaurus/utils-validation": "0.0.0-6069",
|
|
47
47
|
"@types/react-router-config": "^5.0.7",
|
|
48
48
|
"combine-promises": "^1.1.0",
|
|
49
49
|
"fs-extra": "^11.1.1",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=18.0"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "7258877748d2a7c1682c5c92dae3a17734a7e59e"
|
|
71
71
|
}
|
package/src/index.ts
CHANGED
|
@@ -25,10 +25,7 @@ import {
|
|
|
25
25
|
getTagsFile,
|
|
26
26
|
getTagsFilePathsToWatch,
|
|
27
27
|
} from '@docusaurus/utils-validation';
|
|
28
|
-
import {
|
|
29
|
-
createMDXLoaderRule,
|
|
30
|
-
type Options as MDXLoaderOptions,
|
|
31
|
-
} from '@docusaurus/mdx-loader';
|
|
28
|
+
import {createMDXLoaderRule} from '@docusaurus/mdx-loader';
|
|
32
29
|
import {loadSidebars, resolveSidebarPathOption} from './sidebars';
|
|
33
30
|
import {CategoryMetadataFilenamePattern} from './sidebars/generator';
|
|
34
31
|
import {
|
|
@@ -107,50 +104,56 @@ export default async function pluginContentDocs(
|
|
|
107
104
|
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
|
|
108
105
|
.map(addTrailingPathSeparator);
|
|
109
106
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
107
|
+
return createMDXLoaderRule({
|
|
108
|
+
include: contentDirs,
|
|
109
|
+
options: {
|
|
110
|
+
useCrossCompilerCache:
|
|
111
|
+
siteConfig.future.experimental_faster.mdxCrossCompilerCache,
|
|
112
|
+
admonitions: options.admonitions,
|
|
113
|
+
remarkPlugins,
|
|
114
|
+
rehypePlugins,
|
|
115
|
+
recmaPlugins,
|
|
116
|
+
beforeDefaultRehypePlugins,
|
|
117
|
+
beforeDefaultRemarkPlugins,
|
|
118
|
+
staticDirs: siteConfig.staticDirectories.map((dir) =>
|
|
119
|
+
path.resolve(siteDir, dir),
|
|
120
|
+
),
|
|
121
|
+
siteDir,
|
|
122
|
+
isMDXPartial: createAbsoluteFilePathMatcher(
|
|
123
|
+
options.exclude,
|
|
124
|
+
contentDirs,
|
|
125
|
+
),
|
|
126
|
+
metadataPath: (mdxPath: string) => {
|
|
127
|
+
// Note that metadataPath must be the same/in-sync as
|
|
128
|
+
// the path from createData for each MDX.
|
|
129
|
+
const aliasedPath = aliasedSitePath(mdxPath, siteDir);
|
|
130
|
+
return path.join(dataDir, `${docuHash(aliasedPath)}.json`);
|
|
131
|
+
},
|
|
132
|
+
// createAssets converts relative paths to require() calls
|
|
133
|
+
createAssets: ({frontMatter}: {frontMatter: DocFrontMatter}) => ({
|
|
134
|
+
image: frontMatter.image,
|
|
135
|
+
}),
|
|
136
|
+
markdownConfig: siteConfig.markdown,
|
|
137
|
+
resolveMarkdownLink: ({linkPathname, sourceFilePath}) => {
|
|
138
|
+
const version = getVersionFromSourceFilePath(
|
|
139
|
+
sourceFilePath,
|
|
140
|
+
versionsMetadata,
|
|
141
|
+
);
|
|
142
|
+
const permalink = resolveMarkdownLinkPathname(linkPathname, {
|
|
143
|
+
sourceFilePath,
|
|
144
|
+
sourceToPermalink: contentHelpers.sourceToPermalink,
|
|
145
|
+
siteDir,
|
|
146
|
+
contentPaths: version,
|
|
147
|
+
});
|
|
148
|
+
if (permalink === null) {
|
|
149
|
+
logger.report(
|
|
150
|
+
siteConfig.onBrokenMarkdownLinks,
|
|
151
|
+
)`Docs markdown link couldn't be resolved: (url=${linkPathname}) in source file path=${sourceFilePath} for version number=${version.versionName}`;
|
|
152
|
+
}
|
|
153
|
+
return permalink;
|
|
154
|
+
},
|
|
150
155
|
},
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
return createMDXLoaderRule({include: contentDirs, options: loaderOptions});
|
|
156
|
+
});
|
|
154
157
|
}
|
|
155
158
|
|
|
156
159
|
const docsMDXLoaderRule = await createDocsMDXLoaderRule();
|