@docusaurus/plugin-content-pages 3.4.0 → 3.5.1
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.d.ts +0 -1
- package/lib/content.js +3 -4
- package/lib/frontMatter.d.ts +0 -1
- package/lib/frontMatter.js +1 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +3 -2
- package/lib/options.d.ts +0 -1
- package/lib/options.js +4 -2
- package/lib/routes.d.ts +0 -1
- package/lib/routes.js +2 -3
- package/package.json +7 -7
- package/src/index.ts +2 -0
- package/src/options.ts +3 -0
package/lib/content.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
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
|
-
/// <reference path="../src/plugin-content-pages.d.ts" />
|
|
8
7
|
import type { LoadContext } from '@docusaurus/types';
|
|
9
8
|
import type { PagesContentPaths } from './types';
|
|
10
9
|
import type { PluginOptions, LoadedContent } from '@docusaurus/plugin-content-pages';
|
package/lib/content.js
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.createPagesContentPaths = createPagesContentPaths;
|
|
10
|
+
exports.getContentPathList = getContentPathList;
|
|
11
|
+
exports.loadPagesContent = loadPagesContent;
|
|
10
12
|
const tslib_1 = require("tslib");
|
|
11
13
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
14
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -23,11 +25,9 @@ function createPagesContentPaths({ context, options, }) {
|
|
|
23
25
|
}),
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
exports.createPagesContentPaths = createPagesContentPaths;
|
|
27
28
|
function getContentPathList(contentPaths) {
|
|
28
29
|
return [contentPaths.contentPathLocalized, contentPaths.contentPath];
|
|
29
30
|
}
|
|
30
|
-
exports.getContentPathList = getContentPathList;
|
|
31
31
|
const isMarkdownSource = (source) => source.endsWith('.md') || source.endsWith('.mdx');
|
|
32
32
|
async function loadPagesContent(params) {
|
|
33
33
|
const { options } = params;
|
|
@@ -47,7 +47,6 @@ async function loadPagesContent(params) {
|
|
|
47
47
|
return res !== undefined;
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
exports.loadPagesContent = loadPagesContent;
|
|
51
50
|
async function processPageSourceFile(relativeSource, params) {
|
|
52
51
|
const { context, options, contentPaths } = params;
|
|
53
52
|
const { siteConfig, baseUrl, siteDir, i18n } = context;
|
package/lib/frontMatter.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
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
|
-
/// <reference path="../src/plugin-content-pages.d.ts" />
|
|
8
7
|
import type { PageFrontMatter } from '@docusaurus/plugin-content-pages';
|
|
9
8
|
export declare function validatePageFrontMatter(frontMatter: {
|
|
10
9
|
[key: string]: unknown;
|
package/lib/frontMatter.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.validatePageFrontMatter =
|
|
9
|
+
exports.validatePageFrontMatter = validatePageFrontMatter;
|
|
10
10
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
11
11
|
const PageFrontMatterSchema = utils_validation_1.Joi.object({
|
|
12
12
|
// See https://github.com/facebook/docusaurus/issues/4591#issuecomment-822372398
|
|
@@ -23,4 +23,3 @@ const PageFrontMatterSchema = utils_validation_1.Joi.object({
|
|
|
23
23
|
function validatePageFrontMatter(frontMatter) {
|
|
24
24
|
return (0, utils_validation_1.validateFrontMatter)(frontMatter, PageFrontMatterSchema);
|
|
25
25
|
}
|
|
26
|
-
exports.validatePageFrontMatter = validatePageFrontMatter;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
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
|
-
/// <reference path="../src/plugin-content-pages.d.ts" />
|
|
8
7
|
import type { LoadContext, Plugin } from '@docusaurus/types';
|
|
9
8
|
import type { PluginOptions, LoadedContent } from '@docusaurus/plugin-content-pages';
|
|
10
9
|
export default function pluginContentPages(context: LoadContext, options: PluginOptions): Plugin<LoadedContent | null>;
|
package/lib/index.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.validateOptions = void 0;
|
|
10
|
+
exports.default = pluginContentPages;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
13
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -37,13 +38,14 @@ function pluginContentPages(context, options) {
|
|
|
37
38
|
await (0, routes_1.createAllRoutes)({ content, options, actions });
|
|
38
39
|
},
|
|
39
40
|
configureWebpack() {
|
|
40
|
-
const { admonitions, rehypePlugins, remarkPlugins, beforeDefaultRehypePlugins, beforeDefaultRemarkPlugins, } = options;
|
|
41
|
+
const { admonitions, rehypePlugins, remarkPlugins, recmaPlugins, beforeDefaultRehypePlugins, beforeDefaultRemarkPlugins, } = options;
|
|
41
42
|
const contentDirs = (0, content_1.getContentPathList)(contentPaths);
|
|
42
43
|
function createMDXLoader() {
|
|
43
44
|
const loaderOptions = {
|
|
44
45
|
admonitions,
|
|
45
46
|
remarkPlugins,
|
|
46
47
|
rehypePlugins,
|
|
48
|
+
recmaPlugins,
|
|
47
49
|
beforeDefaultRehypePlugins,
|
|
48
50
|
beforeDefaultRemarkPlugins,
|
|
49
51
|
staticDirs: siteConfig.staticDirectories.map((dir) => path_1.default.resolve(siteDir, dir)),
|
|
@@ -83,6 +85,5 @@ function pluginContentPages(context, options) {
|
|
|
83
85
|
},
|
|
84
86
|
};
|
|
85
87
|
}
|
|
86
|
-
exports.default = pluginContentPages;
|
|
87
88
|
var options_1 = require("./options");
|
|
88
89
|
Object.defineProperty(exports, "validateOptions", { enumerable: true, get: function () { return options_1.validateOptions; } });
|
package/lib/options.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
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
|
-
/// <reference path="../src/plugin-content-pages.d.ts" />
|
|
8
7
|
import type { OptionValidationContext } from '@docusaurus/types';
|
|
9
8
|
import type { PluginOptions, Options } from '@docusaurus/plugin-content-pages';
|
|
10
9
|
export declare const DEFAULT_OPTIONS: PluginOptions;
|
package/lib/options.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.DEFAULT_OPTIONS = void 0;
|
|
10
|
+
exports.validateOptions = validateOptions;
|
|
10
11
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
11
12
|
const utils_1 = require("@docusaurus/utils");
|
|
12
13
|
exports.DEFAULT_OPTIONS = {
|
|
@@ -17,6 +18,7 @@ exports.DEFAULT_OPTIONS = {
|
|
|
17
18
|
mdxPageComponent: '@theme/MDXPage',
|
|
18
19
|
remarkPlugins: [],
|
|
19
20
|
rehypePlugins: [],
|
|
21
|
+
recmaPlugins: [],
|
|
20
22
|
beforeDefaultRehypePlugins: [],
|
|
21
23
|
beforeDefaultRemarkPlugins: [],
|
|
22
24
|
admonitions: true,
|
|
@@ -32,6 +34,7 @@ const PluginOptionSchema = utils_validation_1.Joi.object({
|
|
|
32
34
|
mdxPageComponent: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.mdxPageComponent),
|
|
33
35
|
remarkPlugins: utils_validation_1.RemarkPluginsSchema.default(exports.DEFAULT_OPTIONS.remarkPlugins),
|
|
34
36
|
rehypePlugins: utils_validation_1.RehypePluginsSchema.default(exports.DEFAULT_OPTIONS.rehypePlugins),
|
|
37
|
+
recmaPlugins: utils_validation_1.RecmaPluginsSchema.default(exports.DEFAULT_OPTIONS.recmaPlugins),
|
|
35
38
|
beforeDefaultRehypePlugins: utils_validation_1.RehypePluginsSchema.default(exports.DEFAULT_OPTIONS.beforeDefaultRehypePlugins),
|
|
36
39
|
beforeDefaultRemarkPlugins: utils_validation_1.RemarkPluginsSchema.default(exports.DEFAULT_OPTIONS.beforeDefaultRemarkPlugins),
|
|
37
40
|
admonitions: utils_validation_1.AdmonitionsSchema.default(exports.DEFAULT_OPTIONS.admonitions),
|
|
@@ -44,4 +47,3 @@ function validateOptions({ validate, options, }) {
|
|
|
44
47
|
const validatedOptions = validate(PluginOptionSchema, options);
|
|
45
48
|
return validatedOptions;
|
|
46
49
|
}
|
|
47
|
-
exports.validateOptions = validateOptions;
|
package/lib/routes.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
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
|
-
/// <reference path="../src/plugin-content-pages.d.ts" />
|
|
8
7
|
import type { PluginContentLoadedActions, RouteConfig } from '@docusaurus/types';
|
|
9
8
|
import type { PluginOptions, LoadedContent } from '@docusaurus/plugin-content-pages';
|
|
10
9
|
type CreateAllRoutesParam = {
|
package/lib/routes.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.createAllRoutes = createAllRoutes;
|
|
10
|
+
exports.buildAllRoutes = buildAllRoutes;
|
|
10
11
|
const utils_1 = require("@docusaurus/utils");
|
|
11
12
|
function createPageRouteMetadata(metadata) {
|
|
12
13
|
const lastUpdatedAt = metadata.type === 'mdx' ? metadata.lastUpdatedAt : undefined;
|
|
@@ -19,7 +20,6 @@ async function createAllRoutes(param) {
|
|
|
19
20
|
const routes = await buildAllRoutes(param);
|
|
20
21
|
routes.forEach(param.actions.addRoute);
|
|
21
22
|
}
|
|
22
|
-
exports.createAllRoutes = createAllRoutes;
|
|
23
23
|
async function buildAllRoutes({ content, actions, options, }) {
|
|
24
24
|
const { createData } = actions;
|
|
25
25
|
async function buildMDXPageRoute(metadata) {
|
|
@@ -55,4 +55,3 @@ async function buildAllRoutes({ content, actions, options, }) {
|
|
|
55
55
|
}
|
|
56
56
|
return Promise.all(content.map(buildPageRoute));
|
|
57
57
|
}
|
|
58
|
-
exports.buildAllRoutes = buildAllRoutes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-pages",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "Pages plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-pages.d.ts",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "3.
|
|
22
|
-
"@docusaurus/mdx-loader": "3.
|
|
23
|
-
"@docusaurus/types": "3.
|
|
24
|
-
"@docusaurus/utils": "3.
|
|
25
|
-
"@docusaurus/utils-validation": "3.
|
|
21
|
+
"@docusaurus/core": "3.5.1",
|
|
22
|
+
"@docusaurus/mdx-loader": "3.5.1",
|
|
23
|
+
"@docusaurus/types": "3.5.1",
|
|
24
|
+
"@docusaurus/utils": "3.5.1",
|
|
25
|
+
"@docusaurus/utils-validation": "3.5.1",
|
|
26
26
|
"fs-extra": "^11.1.1",
|
|
27
27
|
"tslib": "^2.6.0",
|
|
28
28
|
"webpack": "^5.88.1"
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "5acbc57bd62f3f808ef72007cd67d4c410d13829"
|
|
38
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -72,6 +72,7 @@ export default function pluginContentPages(
|
|
|
72
72
|
admonitions,
|
|
73
73
|
rehypePlugins,
|
|
74
74
|
remarkPlugins,
|
|
75
|
+
recmaPlugins,
|
|
75
76
|
beforeDefaultRehypePlugins,
|
|
76
77
|
beforeDefaultRemarkPlugins,
|
|
77
78
|
} = options;
|
|
@@ -82,6 +83,7 @@ export default function pluginContentPages(
|
|
|
82
83
|
admonitions,
|
|
83
84
|
remarkPlugins,
|
|
84
85
|
rehypePlugins,
|
|
86
|
+
recmaPlugins,
|
|
85
87
|
beforeDefaultRehypePlugins,
|
|
86
88
|
beforeDefaultRemarkPlugins,
|
|
87
89
|
staticDirs: siteConfig.staticDirectories.map((dir) =>
|
package/src/options.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
Joi,
|
|
10
10
|
RemarkPluginsSchema,
|
|
11
11
|
RehypePluginsSchema,
|
|
12
|
+
RecmaPluginsSchema,
|
|
12
13
|
AdmonitionsSchema,
|
|
13
14
|
RouteBasePathSchema,
|
|
14
15
|
URISchema,
|
|
@@ -25,6 +26,7 @@ export const DEFAULT_OPTIONS: PluginOptions = {
|
|
|
25
26
|
mdxPageComponent: '@theme/MDXPage',
|
|
26
27
|
remarkPlugins: [],
|
|
27
28
|
rehypePlugins: [],
|
|
29
|
+
recmaPlugins: [],
|
|
28
30
|
beforeDefaultRehypePlugins: [],
|
|
29
31
|
beforeDefaultRemarkPlugins: [],
|
|
30
32
|
admonitions: true,
|
|
@@ -41,6 +43,7 @@ const PluginOptionSchema = Joi.object<PluginOptions>({
|
|
|
41
43
|
mdxPageComponent: Joi.string().default(DEFAULT_OPTIONS.mdxPageComponent),
|
|
42
44
|
remarkPlugins: RemarkPluginsSchema.default(DEFAULT_OPTIONS.remarkPlugins),
|
|
43
45
|
rehypePlugins: RehypePluginsSchema.default(DEFAULT_OPTIONS.rehypePlugins),
|
|
46
|
+
recmaPlugins: RecmaPluginsSchema.default(DEFAULT_OPTIONS.recmaPlugins),
|
|
44
47
|
beforeDefaultRehypePlugins: RehypePluginsSchema.default(
|
|
45
48
|
DEFAULT_OPTIONS.beforeDefaultRehypePlugins,
|
|
46
49
|
),
|