@docusaurus/core 0.0.0-4819 → 0.0.0-4820
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/client/App.js +1 -1
- package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.d.ts → BaseUrlIssueBanner/index.d.ts} +10 -5
- package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.js → BaseUrlIssueBanner/index.js} +14 -8
- package/lib/client/{baseUrlIssueBanner → BaseUrlIssueBanner}/styles.module.css +0 -0
- package/lib/client/exports/BrowserOnly.d.ts +3 -4
- package/lib/client/exports/BrowserOnly.js +1 -1
- package/lib/client/exports/Interpolate.js +7 -11
- package/lib/client/exports/Link.js +20 -25
- package/lib/server/brokenLinks.js +1 -1
- package/lib/server/i18n.js +1 -1
- package/lib/server/index.js +4 -9
- package/lib/server/routes.d.ts +6 -6
- package/lib/server/routes.js +7 -6
- package/lib/server/siteMetadata.js +1 -2
- package/lib/webpack/server.js +3 -2
- package/package.json +10 -10
package/lib/client/App.js
CHANGED
|
@@ -10,7 +10,7 @@ import renderRoutes from './exports/renderRoutes';
|
|
|
10
10
|
import { BrowserContextProvider } from './browserContext';
|
|
11
11
|
import { DocusaurusContextProvider } from './docusaurusContext';
|
|
12
12
|
import PendingNavigation from './PendingNavigation';
|
|
13
|
-
import BaseUrlIssueBanner from './
|
|
13
|
+
import BaseUrlIssueBanner from './BaseUrlIssueBanner';
|
|
14
14
|
import SiteMetadataDefaults from './SiteMetadataDefaults';
|
|
15
15
|
import Root from '@theme/Root';
|
|
16
16
|
import SiteMetadata from '@theme/SiteMetadata';
|
package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.d.ts → BaseUrlIssueBanner/index.d.ts}
RENAMED
|
@@ -6,17 +6,22 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
8
|
import './styles.module.css';
|
|
9
|
+
declare const InsertBannerWindowAttribute = "__DOCUSAURUS_INSERT_BASEURL_BANNER";
|
|
9
10
|
declare global {
|
|
10
11
|
interface Window {
|
|
11
|
-
|
|
12
|
+
[InsertBannerWindowAttribute]: boolean;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* We want to help the users with a bad baseUrl configuration (very common
|
|
16
|
-
* error) Help message is inlined, and hidden if JS or CSS is able to load
|
|
17
|
+
* error). Help message is inlined, and hidden if JS or CSS is able to load.
|
|
18
|
+
*
|
|
19
|
+
* This component only inserts the base URL banner for the homepage, to avoid
|
|
20
|
+
* polluting every statically rendered page.
|
|
21
|
+
*
|
|
17
22
|
* Note: it might create false positives (ie network failures): not a big deal
|
|
18
|
-
*
|
|
19
|
-
* pages
|
|
23
|
+
*
|
|
20
24
|
* @see https://github.com/facebook/docusaurus/pull/3621
|
|
21
25
|
*/
|
|
22
|
-
export default function
|
|
26
|
+
export default function MaybeBaseUrlIssueBanner(): JSX.Element | null;
|
|
27
|
+
export {};
|
|
@@ -60,7 +60,7 @@ function insertBanner() {
|
|
|
60
60
|
}
|
|
61
61
|
`;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function BaseUrlIssueBanner() {
|
|
64
64
|
const { siteConfig: { baseUrl }, } = useDocusaurusContext();
|
|
65
65
|
// useLayoutEffect fires before DOMContentLoaded.
|
|
66
66
|
// It gives the opportunity to avoid inserting the banner in the first place
|
|
@@ -68,7 +68,10 @@ function BaseUrlIssueBannerEnabled() {
|
|
|
68
68
|
window[InsertBannerWindowAttribute] = false;
|
|
69
69
|
}, []);
|
|
70
70
|
return (<>
|
|
71
|
-
{!ExecutionEnvironment.canUseDOM && (
|
|
71
|
+
{!ExecutionEnvironment.canUseDOM && (
|
|
72
|
+
// Safe to use `ExecutionEnvironment`, because `Head` is purely
|
|
73
|
+
// side-effect and doesn't affect hydration
|
|
74
|
+
<Head>
|
|
72
75
|
<script>{createInlineScript(baseUrl)}</script>
|
|
73
76
|
</Head>)}
|
|
74
77
|
<div id={BannerContainerId}/>
|
|
@@ -76,17 +79,20 @@ function BaseUrlIssueBannerEnabled() {
|
|
|
76
79
|
}
|
|
77
80
|
/**
|
|
78
81
|
* We want to help the users with a bad baseUrl configuration (very common
|
|
79
|
-
* error) Help message is inlined, and hidden if JS or CSS is able to load
|
|
82
|
+
* error). Help message is inlined, and hidden if JS or CSS is able to load.
|
|
83
|
+
*
|
|
84
|
+
* This component only inserts the base URL banner for the homepage, to avoid
|
|
85
|
+
* polluting every statically rendered page.
|
|
86
|
+
*
|
|
80
87
|
* Note: it might create false positives (ie network failures): not a big deal
|
|
81
|
-
*
|
|
82
|
-
* pages
|
|
88
|
+
*
|
|
83
89
|
* @see https://github.com/facebook/docusaurus/pull/3621
|
|
84
90
|
*/
|
|
85
|
-
export default function
|
|
91
|
+
export default function MaybeBaseUrlIssueBanner() {
|
|
86
92
|
const { siteConfig: { baseUrl, baseUrlIssueBanner }, } = useDocusaurusContext();
|
|
87
93
|
const { pathname } = useLocation();
|
|
88
|
-
// returns true for the homepage during
|
|
94
|
+
// returns true for the homepage during SSR
|
|
89
95
|
const isHomePage = pathname === baseUrl;
|
|
90
96
|
const enabled = baseUrlIssueBanner && isHomePage;
|
|
91
|
-
return enabled ? <
|
|
97
|
+
return enabled ? <BaseUrlIssueBanner /> : null;
|
|
92
98
|
}
|
|
File without changes
|
|
@@ -4,8 +4,7 @@
|
|
|
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 types="@docusaurus/module-type-aliases" />
|
|
7
8
|
/// <reference types="react" />
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
fallback?: JSX.Element;
|
|
11
|
-
}): JSX.Element | null;
|
|
9
|
+
import type { Props } from '@docusaurus/BrowserOnly';
|
|
10
|
+
export default function BrowserOnly({ children, fallback, }: Props): JSX.Element | null;
|
|
@@ -16,7 +16,7 @@ export default function BrowserOnly({ children, fallback, }) {
|
|
|
16
16
|
throw new Error(`Docusaurus error: The children of <BrowserOnly> must be a "render function", e.g. <BrowserOnly>{() => <span>{window.location.href}</span>}</BrowserOnly>.
|
|
17
17
|
Current type: ${isValidElement(children) ? 'React element' : typeof children}`);
|
|
18
18
|
}
|
|
19
|
-
return <>{children()}</>;
|
|
19
|
+
return <>{children?.()}</>;
|
|
20
20
|
}
|
|
21
21
|
return fallback ?? null;
|
|
22
22
|
}
|
|
@@ -10,13 +10,12 @@ Minimal implementation of a React interpolate component.
|
|
|
10
10
|
We don't ship a markdown parser nor a feature-complete i18n library on purpose.
|
|
11
11
|
More details here: https://github.com/facebook/docusaurus/pull/4295
|
|
12
12
|
*/
|
|
13
|
-
const ValueRegexp = /\{\w+\}/g;
|
|
14
13
|
const ValueFoundMarker = '{}'; // does not care much
|
|
15
14
|
export function interpolate(text, values) {
|
|
16
15
|
const elements = [];
|
|
17
|
-
const processedText = text.replace(
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const processedText = text.replace(
|
|
17
|
+
// eslint-disable-next-line prefer-named-capture-group
|
|
18
|
+
/\{(\w+)\}/g, (match, key) => {
|
|
20
19
|
const value = values?.[key];
|
|
21
20
|
if (typeof value !== 'undefined') {
|
|
22
21
|
const element = isValidElement(value)
|
|
@@ -39,13 +38,10 @@ export function interpolate(text, values) {
|
|
|
39
38
|
.reduce((str, value, index) => str.concat(value).concat(elements[index] ?? ''), '');
|
|
40
39
|
}
|
|
41
40
|
// JSX interpolation: returns ReactNode
|
|
42
|
-
return processedText.split(ValueFoundMarker).
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{elements[index]}
|
|
47
|
-
</React.Fragment>,
|
|
48
|
-
], []);
|
|
41
|
+
return processedText.split(ValueFoundMarker).map((value, index) => (<React.Fragment key={index}>
|
|
42
|
+
{value}
|
|
43
|
+
{elements[index]}
|
|
44
|
+
</React.Fragment>));
|
|
49
45
|
}
|
|
50
46
|
export default function Interpolate({ children, values, }) {
|
|
51
47
|
if (typeof children !== 'string') {
|
|
@@ -54,32 +54,27 @@ function Link({ isNavLink, to, href, activeClassName, isActive, 'data-noBrokenLi
|
|
|
54
54
|
const LinkComponent = (isNavLink ? NavLink : RRLink);
|
|
55
55
|
const IOSupported = ExecutionEnvironment.canUseIntersectionObserver;
|
|
56
56
|
const ioRef = useRef();
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (el === entry.target) {
|
|
61
|
-
// If element is in viewport, stop observing and run callback.
|
|
62
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
|
|
63
|
-
if (entry.isIntersecting || entry.intersectionRatio > 0) {
|
|
64
|
-
ioRef.current.unobserve(el);
|
|
65
|
-
ioRef.current.disconnect();
|
|
66
|
-
cb();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
// Add element to the observer.
|
|
72
|
-
ioRef.current.observe(el);
|
|
73
|
-
};
|
|
74
|
-
const handleRef = (ref) => {
|
|
75
|
-
innerRef.current = ref;
|
|
76
|
-
if (IOSupported && ref && isInternal) {
|
|
57
|
+
const handleRef = (el) => {
|
|
58
|
+
innerRef.current = el;
|
|
59
|
+
if (IOSupported && el && isInternal) {
|
|
77
60
|
// If IO supported and element reference found, set up Observer.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
61
|
+
ioRef.current = new window.IntersectionObserver((entries) => {
|
|
62
|
+
entries.forEach((entry) => {
|
|
63
|
+
if (el === entry.target) {
|
|
64
|
+
// If element is in viewport, stop observing and run callback.
|
|
65
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
|
|
66
|
+
if (entry.isIntersecting || entry.intersectionRatio > 0) {
|
|
67
|
+
ioRef.current.unobserve(el);
|
|
68
|
+
ioRef.current.disconnect();
|
|
69
|
+
if (targetLink != null) {
|
|
70
|
+
window.docusaurus.prefetch(targetLink);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
82
75
|
});
|
|
76
|
+
// Add element to the observer.
|
|
77
|
+
ioRef.current.observe(el);
|
|
83
78
|
}
|
|
84
79
|
};
|
|
85
80
|
const onMouseEnter = () => {
|
|
@@ -104,7 +99,7 @@ function Link({ isNavLink, to, href, activeClassName, isActive, 'data-noBrokenLi
|
|
|
104
99
|
}, [ioRef, targetLink, IOSupported, isInternal]);
|
|
105
100
|
const isAnchorLink = targetLink?.startsWith('#') ?? false;
|
|
106
101
|
const isRegularHtmlLink = !targetLink || !isInternal || isAnchorLink;
|
|
107
|
-
if (
|
|
102
|
+
if (!isRegularHtmlLink && !noBrokenLinkCheck) {
|
|
108
103
|
linksCollector.collectLink(targetLink);
|
|
109
104
|
}
|
|
110
105
|
return isRegularHtmlLink ? (
|
|
@@ -34,7 +34,7 @@ function getPageBrokenLinks({ pagePath, pageLinks, routes, }) {
|
|
|
34
34
|
// component, but we load route components with string paths.
|
|
35
35
|
// We don't actually access component here, so it's fine.
|
|
36
36
|
.map((l) => (0, react_router_config_1.matchRoutes)(routes, l))
|
|
37
|
-
.
|
|
37
|
+
.flat();
|
|
38
38
|
return matchedRoutes.length === 0;
|
|
39
39
|
}
|
|
40
40
|
return pageLinks.map(resolveLink).filter((l) => isBrokenLink(l.resolvedLink));
|
package/lib/server/i18n.js
CHANGED
|
@@ -38,7 +38,7 @@ Note: Docusaurus only support running one locale at a time.`;
|
|
|
38
38
|
...i18nConfig.localeConfigs[locale],
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
const localeConfigs = locales.
|
|
41
|
+
const localeConfigs = Object.fromEntries(locales.map((locale) => [locale, getLocaleConfig(locale)]));
|
|
42
42
|
return {
|
|
43
43
|
defaultLocale: i18nConfig.defaultLocale,
|
|
44
44
|
locales,
|
package/lib/server/index.js
CHANGED
|
@@ -12,7 +12,6 @@ const utils_1 = require("@docusaurus/utils");
|
|
|
12
12
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
13
13
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
14
14
|
const config_1 = require("./config");
|
|
15
|
-
const ssr_html_template_1 = tslib_1.__importDefault(require("../webpack/templates/ssr.html.template"));
|
|
16
15
|
const clientModules_1 = require("./clientModules");
|
|
17
16
|
const plugins_1 = require("./plugins");
|
|
18
17
|
const routes_1 = require("./routes");
|
|
@@ -61,7 +60,6 @@ async function loadContext(options) {
|
|
|
61
60
|
outDir,
|
|
62
61
|
baseUrl,
|
|
63
62
|
i18n,
|
|
64
|
-
ssrTemplate: siteConfig.ssrTemplate ?? ssr_html_template_1.default,
|
|
65
63
|
codeTranslations,
|
|
66
64
|
};
|
|
67
65
|
}
|
|
@@ -75,11 +73,11 @@ exports.loadContext = loadContext;
|
|
|
75
73
|
async function load(options) {
|
|
76
74
|
const { siteDir } = options;
|
|
77
75
|
const context = await loadContext(options);
|
|
78
|
-
const { generatedFilesDir, siteConfig, siteConfigPath, outDir, baseUrl, i18n,
|
|
76
|
+
const { generatedFilesDir, siteConfig, siteConfigPath, outDir, baseUrl, i18n, codeTranslations: siteCodeTranslations, } = context;
|
|
79
77
|
const { plugins, pluginsRouteConfigs, globalData } = await (0, plugins_1.loadPlugins)(context);
|
|
80
78
|
const clientModules = (0, clientModules_1.loadClientModules)(plugins);
|
|
81
79
|
const { headTags, preBodyTags, postBodyTags } = (0, htmlTags_1.loadHtmlTags)(plugins);
|
|
82
|
-
const { registry, routesChunkNames, routesConfig, routesPaths } =
|
|
80
|
+
const { registry, routesChunkNames, routesConfig, routesPaths } = (0, routes_1.loadRoutes)(pluginsRouteConfigs, baseUrl, siteConfig.onDuplicateRoutes);
|
|
83
81
|
const codeTranslations = {
|
|
84
82
|
...(await (0, translations_1.getPluginsDefaultCodeTranslationMessages)(plugins)),
|
|
85
83
|
...siteCodeTranslations,
|
|
@@ -92,8 +90,6 @@ DO NOT hand-modify files in this folder because they will be overwritten in the
|
|
|
92
90
|
next build. You can clear all build artifacts (including this folder) with the
|
|
93
91
|
\`docusaurus clear\` command.
|
|
94
92
|
`);
|
|
95
|
-
// Site config must be generated after plugins
|
|
96
|
-
// We want the generated config to have been normalized by the plugins!
|
|
97
93
|
const genSiteConfig = (0, utils_1.generate)(generatedFilesDir, utils_1.DEFAULT_CONFIG_FILE_NAME, `/*
|
|
98
94
|
* AUTOGENERATED - DON'T EDIT
|
|
99
95
|
* Your edits in this file will be overwritten in the next build!
|
|
@@ -105,14 +101,14 @@ export default ${JSON.stringify(siteConfig, null, 2)};
|
|
|
105
101
|
${clientModules
|
|
106
102
|
// import() is async so we use require() because client modules can have
|
|
107
103
|
// CSS and the order matters for loading CSS.
|
|
108
|
-
.map((
|
|
104
|
+
.map((clientModule) => ` require('${(0, utils_1.escapePath)(clientModule)}'),`)
|
|
109
105
|
.join('\n')}
|
|
110
106
|
];
|
|
111
107
|
`);
|
|
112
108
|
const genRegistry = (0, utils_1.generate)(generatedFilesDir, 'registry.js', `export default {
|
|
113
109
|
${Object.entries(registry)
|
|
114
110
|
.sort((a, b) => a[0].localeCompare(b[0]))
|
|
115
|
-
.map(([
|
|
111
|
+
.map(([chunkName, modulePath]) => ` '${chunkName}': [() => import(/* webpackChunkName: '${chunkName}' */ '${modulePath}'), '${modulePath}', require.resolveWeak('${modulePath}')],`)
|
|
116
112
|
.join('\n')}};
|
|
117
113
|
`);
|
|
118
114
|
const genRoutesChunkNames = (0, utils_1.generate)(generatedFilesDir, 'routesChunkNames.json', JSON.stringify(routesChunkNames, null, 2));
|
|
@@ -148,7 +144,6 @@ ${Object.entries(registry)
|
|
|
148
144
|
headTags,
|
|
149
145
|
preBodyTags,
|
|
150
146
|
postBodyTags,
|
|
151
|
-
ssrTemplate,
|
|
152
147
|
codeTranslations,
|
|
153
148
|
};
|
|
154
149
|
}
|
package/lib/server/routes.d.ts
CHANGED
|
@@ -10,12 +10,12 @@ declare type LoadedRoutes = {
|
|
|
10
10
|
routesConfig: string;
|
|
11
11
|
/** @see {ChunkNames} */
|
|
12
12
|
routesChunkNames: RouteChunkNames;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* A map from chunk name to module paths. Module paths would have backslash
|
|
15
|
+
* escaped already, so they can be directly printed.
|
|
16
|
+
*/
|
|
14
17
|
registry: {
|
|
15
|
-
[chunkName: string]:
|
|
16
|
-
loader: string;
|
|
17
|
-
modulePath: string;
|
|
18
|
-
};
|
|
18
|
+
[chunkName: string]: string;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* Collect all page paths for injecting it later in the plugin lifecycle.
|
|
@@ -47,5 +47,5 @@ export declare function handleDuplicateRoutes(pluginsRouteConfigs: RouteConfig[]
|
|
|
47
47
|
* chunk names.
|
|
48
48
|
* - `registry`, a mapping from chunk names to options for react-loadable.
|
|
49
49
|
*/
|
|
50
|
-
export declare function loadRoutes(routeConfigs: RouteConfig[], baseUrl: string, onDuplicateRoutes: ReportingSeverity):
|
|
50
|
+
export declare function loadRoutes(routeConfigs: RouteConfig[], baseUrl: string, onDuplicateRoutes: ReportingSeverity): LoadedRoutes;
|
|
51
51
|
export {};
|
package/lib/server/routes.js
CHANGED
|
@@ -111,10 +111,7 @@ function genChunkNames(routeModule, prefix, name, res) {
|
|
|
111
111
|
// This is a leaf node, no need to recurse
|
|
112
112
|
const modulePath = getModulePath(routeModule);
|
|
113
113
|
const chunkName = genChunkName(modulePath, prefix, name);
|
|
114
|
-
res.registry[chunkName] =
|
|
115
|
-
loader: `() => import(/* webpackChunkName: '${chunkName}' */ '${(0, utils_1.escapePath)(modulePath)}')`,
|
|
116
|
-
modulePath,
|
|
117
|
-
};
|
|
114
|
+
res.registry[chunkName] = (0, utils_1.escapePath)(modulePath);
|
|
118
115
|
return chunkName;
|
|
119
116
|
}
|
|
120
117
|
if (Array.isArray(routeModule)) {
|
|
@@ -182,7 +179,7 @@ ${JSON.stringify(routeConfig)}`);
|
|
|
182
179
|
* chunk names.
|
|
183
180
|
* - `registry`, a mapping from chunk names to options for react-loadable.
|
|
184
181
|
*/
|
|
185
|
-
|
|
182
|
+
function loadRoutes(routeConfigs, baseUrl, onDuplicateRoutes) {
|
|
186
183
|
handleDuplicateRoutes(routeConfigs, onDuplicateRoutes);
|
|
187
184
|
const res = {
|
|
188
185
|
// To be written by `genRouteCode`
|
|
@@ -191,11 +188,15 @@ async function loadRoutes(routeConfigs, baseUrl, onDuplicateRoutes) {
|
|
|
191
188
|
registry: {},
|
|
192
189
|
routesPaths: [(0, utils_1.normalizeUrl)([baseUrl, '404.html'])],
|
|
193
190
|
};
|
|
191
|
+
// `genRouteCode` would mutate `res`
|
|
192
|
+
const routeConfigSerialized = routeConfigs
|
|
193
|
+
.map((r) => genRouteCode(r, res))
|
|
194
|
+
.join(',\n');
|
|
194
195
|
res.routesConfig = `import React from 'react';
|
|
195
196
|
import ComponentCreator from '@docusaurus/ComponentCreator';
|
|
196
197
|
|
|
197
198
|
export default [
|
|
198
|
-
${indent(
|
|
199
|
+
${indent(routeConfigSerialized)},
|
|
199
200
|
{
|
|
200
201
|
path: '*',
|
|
201
202
|
component: ComponentCreator('*'),
|
|
@@ -59,8 +59,7 @@ function checkDocusaurusPackagesVersion(siteMetadata) {
|
|
|
59
59
|
versionInfo.name?.startsWith('@docusaurus/') &&
|
|
60
60
|
versionInfo.version &&
|
|
61
61
|
versionInfo.version !== docusaurusVersion) {
|
|
62
|
-
//
|
|
63
|
-
// It still could work with different versions
|
|
62
|
+
// Should we throw instead? It still could work with different versions
|
|
64
63
|
logger_1.default.error `Invalid name=${plugin} version number=${versionInfo.version}.
|
|
65
64
|
All official @docusaurus/* packages should have the exact same version as @docusaurus/core (number=${docusaurusVersion}).
|
|
66
65
|
Maybe you want to check, or regenerate your yarn.lock or package-lock.json file?`;
|
package/lib/webpack/server.js
CHANGED
|
@@ -13,10 +13,11 @@ const base_1 = require("./base");
|
|
|
13
13
|
const WaitPlugin_1 = tslib_1.__importDefault(require("./plugins/WaitPlugin"));
|
|
14
14
|
const LogPlugin_1 = tslib_1.__importDefault(require("./plugins/LogPlugin"));
|
|
15
15
|
const utils_1 = require("@docusaurus/utils");
|
|
16
|
+
const ssr_html_template_1 = tslib_1.__importDefault(require("./templates/ssr.html.template"));
|
|
16
17
|
// Forked for Docusaurus: https://github.com/slorber/static-site-generator-webpack-plugin
|
|
17
18
|
const static_site_generator_webpack_plugin_1 = tslib_1.__importDefault(require("@slorber/static-site-generator-webpack-plugin"));
|
|
18
19
|
async function createServerConfig({ props, onLinksCollected = () => { }, }) {
|
|
19
|
-
const { baseUrl, routesPaths, generatedFilesDir, headTags, preBodyTags, postBodyTags,
|
|
20
|
+
const { baseUrl, routesPaths, generatedFilesDir, headTags, preBodyTags, postBodyTags, siteConfig: { noIndex, trailingSlash, ssrTemplate }, } = props;
|
|
20
21
|
const config = await (0, base_1.createBaseConfig)(props, true);
|
|
21
22
|
const routesLocation = {};
|
|
22
23
|
// Array of paths to be rendered. Relative to output directory
|
|
@@ -52,7 +53,7 @@ async function createServerConfig({ props, onLinksCollected = () => { }, }) {
|
|
|
52
53
|
preBodyTags,
|
|
53
54
|
postBodyTags,
|
|
54
55
|
onLinksCollected,
|
|
55
|
-
ssrTemplate,
|
|
56
|
+
ssrTemplate: ssrTemplate ?? ssr_html_template_1.default,
|
|
56
57
|
noIndex,
|
|
57
58
|
},
|
|
58
59
|
paths: ssgPaths,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/core",
|
|
3
3
|
"description": "Easy to Maintain Open Source Documentation Websites",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-4820",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"@babel/runtime": "^7.17.8",
|
|
42
42
|
"@babel/runtime-corejs3": "^7.17.8",
|
|
43
43
|
"@babel/traverse": "^7.17.3",
|
|
44
|
-
"@docusaurus/cssnano-preset": "0.0.0-
|
|
45
|
-
"@docusaurus/logger": "0.0.0-
|
|
46
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
44
|
+
"@docusaurus/cssnano-preset": "0.0.0-4820",
|
|
45
|
+
"@docusaurus/logger": "0.0.0-4820",
|
|
46
|
+
"@docusaurus/mdx-loader": "0.0.0-4820",
|
|
47
47
|
"@docusaurus/react-loadable": "5.5.2",
|
|
48
|
-
"@docusaurus/utils": "0.0.0-
|
|
49
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
50
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
48
|
+
"@docusaurus/utils": "0.0.0-4820",
|
|
49
|
+
"@docusaurus/utils-common": "0.0.0-4820",
|
|
50
|
+
"@docusaurus/utils-validation": "0.0.0-4820",
|
|
51
51
|
"@slorber/static-site-generator-webpack-plugin": "^4.0.4",
|
|
52
52
|
"@svgr/webpack": "^6.2.1",
|
|
53
53
|
"autoprefixer": "^10.4.4",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"webpackbar": "^5.0.2"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
109
|
-
"@docusaurus/types": "0.0.0-
|
|
108
|
+
"@docusaurus/module-type-aliases": "0.0.0-4820",
|
|
109
|
+
"@docusaurus/types": "0.0.0-4820",
|
|
110
110
|
"@types/detect-port": "^1.3.2",
|
|
111
111
|
"@types/nprogress": "^0.2.0",
|
|
112
112
|
"@types/react-dom": "^17.0.14",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"engines": {
|
|
128
128
|
"node": ">=14"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "87f0e211c7d10df53211b9b3ddd6872e8d206c0f"
|
|
131
131
|
}
|