@docusaurus/core 0.0.0-4968 → 0.0.0-4979
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.
|
@@ -14,17 +14,22 @@ export function dispatchLifecycleAction(lifecycleAction, ...args) {
|
|
|
14
14
|
});
|
|
15
15
|
return () => callbacks.forEach((cb) => cb?.());
|
|
16
16
|
}
|
|
17
|
+
function scrollAfterNavigation(location) {
|
|
18
|
+
const { hash } = location;
|
|
19
|
+
if (!hash) {
|
|
20
|
+
window.scrollTo(0, 0);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const id = decodeURIComponent(hash.substring(1));
|
|
24
|
+
const element = document.getElementById(id);
|
|
25
|
+
element?.scrollIntoView();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
17
28
|
function ClientLifecyclesDispatcher({ children, location, previousLocation, }) {
|
|
18
29
|
useLayoutEffect(() => {
|
|
19
30
|
if (previousLocation !== location) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
window.scrollTo(0, 0);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
const id = decodeURIComponent(hash.substring(1));
|
|
26
|
-
const element = document.getElementById(id);
|
|
27
|
-
element?.scrollIntoView();
|
|
31
|
+
if (previousLocation) {
|
|
32
|
+
scrollAfterNavigation(location);
|
|
28
33
|
}
|
|
29
34
|
dispatchLifecycleAction('onRouteDidUpdate', { previousLocation, location });
|
|
30
35
|
}
|
|
@@ -20,7 +20,6 @@ import { createStatefulLinksCollector, LinksCollectorProvider, } from './LinksCo
|
|
|
20
20
|
import logger from '@docusaurus/logger';
|
|
21
21
|
// eslint-disable-next-line no-restricted-imports
|
|
22
22
|
import _ from 'lodash';
|
|
23
|
-
import { DOCUSAURUS_VERSION } from '@docusaurus/utils';
|
|
24
23
|
const getCompiledSSRTemplate = _.memoize((template) => eta.compile(template.trim(), {
|
|
25
24
|
rmWhitespace: true,
|
|
26
25
|
}));
|
|
@@ -45,7 +44,7 @@ It might also require to wrap your client code in code=${'useEffect'} hook and/o
|
|
|
45
44
|
}
|
|
46
45
|
// Renderer for static-site-generator-webpack-plugin (async rendering).
|
|
47
46
|
async function doRender(locals) {
|
|
48
|
-
const { routesLocation, headTags, preBodyTags, postBodyTags, onLinksCollected, onHeadTagsCollected, baseUrl, ssrTemplate, noIndex, } = locals;
|
|
47
|
+
const { routesLocation, headTags, preBodyTags, postBodyTags, onLinksCollected, onHeadTagsCollected, baseUrl, ssrTemplate, noIndex, DOCUSAURUS_VERSION, } = locals;
|
|
49
48
|
const location = routesLocation[locals.path];
|
|
50
49
|
await preload(location);
|
|
51
50
|
const modules = new Set();
|
package/lib/webpack/server.js
CHANGED
|
@@ -56,6 +56,7 @@ async function createServerConfig({ props, onLinksCollected, onHeadTagsCollected
|
|
|
56
56
|
onHeadTagsCollected,
|
|
57
57
|
ssrTemplate: ssrTemplate ?? ssr_html_template_1.default,
|
|
58
58
|
noIndex,
|
|
59
|
+
DOCUSAURUS_VERSION: utils_1.DOCUSAURUS_VERSION,
|
|
59
60
|
},
|
|
60
61
|
paths: ssgPaths,
|
|
61
62
|
preferFoldersOutput: trailingSlash,
|
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-4979",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"@babel/runtime": "^7.17.9",
|
|
42
42
|
"@babel/runtime-corejs3": "^7.17.9",
|
|
43
43
|
"@babel/traverse": "^7.17.10",
|
|
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-4979",
|
|
45
|
+
"@docusaurus/logger": "0.0.0-4979",
|
|
46
|
+
"@docusaurus/mdx-loader": "0.0.0-4979",
|
|
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-4979",
|
|
49
|
+
"@docusaurus/utils-common": "0.0.0-4979",
|
|
50
|
+
"@docusaurus/utils-validation": "0.0.0-4979",
|
|
51
51
|
"@slorber/static-site-generator-webpack-plugin": "^4.0.4",
|
|
52
52
|
"@svgr/webpack": "^6.2.1",
|
|
53
53
|
"autoprefixer": "^10.4.5",
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"webpackbar": "^5.0.2"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
108
|
-
"@docusaurus/types": "0.0.0-
|
|
107
|
+
"@docusaurus/module-type-aliases": "0.0.0-4979",
|
|
108
|
+
"@docusaurus/types": "0.0.0-4979",
|
|
109
109
|
"@types/detect-port": "^1.3.2",
|
|
110
110
|
"@types/react-dom": "^18.0.3",
|
|
111
111
|
"@types/react-router-config": "^5.0.6",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"engines": {
|
|
126
126
|
"node": ">=14"
|
|
127
127
|
},
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "5d72bb168065ed27934945f158c6418790d6d874"
|
|
129
129
|
}
|