@docusaurus/core 0.0.0-4679 → 0.0.0-4680
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/exports/ComponentCreator.js +5 -5
- package/lib/client/exports/Link.d.ts +1 -1
- package/lib/client/flat.js +1 -2
- package/lib/client/prefetch.js +3 -3
- package/lib/client/theme-fallback/Root/index.d.ts +2 -2
- package/lib/client/theme-fallback/Root/index.js +2 -1
- package/lib/server/index.js +3 -3
- package/lib/server/routes.js +2 -2
- package/lib/server/themes/index.js +2 -2
- package/lib/webpack/plugins/ChunkAssetPlugin.js +4 -5
- package/package.json +10 -10
|
@@ -38,8 +38,8 @@ export default function ComponentCreator(path, hash) {
|
|
|
38
38
|
]
|
|
39
39
|
*/
|
|
40
40
|
const flatChunkNames = flat(chunkNames);
|
|
41
|
-
Object.
|
|
42
|
-
const chunkRegistry = registry[
|
|
41
|
+
Object.entries(flatChunkNames).forEach(([key, chunkName]) => {
|
|
42
|
+
const chunkRegistry = registry[chunkName];
|
|
43
43
|
if (chunkRegistry) {
|
|
44
44
|
// eslint-disable-next-line prefer-destructuring
|
|
45
45
|
optsLoader[key] = chunkRegistry[0];
|
|
@@ -58,9 +58,9 @@ export default function ComponentCreator(path, hash) {
|
|
|
58
58
|
Object.keys(loaded).forEach((key) => {
|
|
59
59
|
let val = loadedModules;
|
|
60
60
|
const keyPath = key.split('.');
|
|
61
|
-
|
|
62
|
-
val = val[
|
|
63
|
-
}
|
|
61
|
+
keyPath.slice(0, -1).forEach((k) => {
|
|
62
|
+
val = val[k];
|
|
63
|
+
});
|
|
64
64
|
val[keyPath[keyPath.length - 1]] = loaded[key].default;
|
|
65
65
|
const nonDefaultKeys = Object.keys(loaded[key]).filter((k) => k !== 'default');
|
|
66
66
|
if (nonDefaultKeys && nonDefaultKeys.length) {
|
|
@@ -19,5 +19,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Partial<import("rea
|
|
|
19
19
|
readonly href?: string | undefined;
|
|
20
20
|
readonly autoAddBaseUrl?: boolean | undefined;
|
|
21
21
|
readonly 'data-noBrokenLinkCheck'?: boolean | undefined;
|
|
22
|
-
}, "children" | "replace" | "slot" | "style" | "title" | "component" | "location" | "exact" | "sensitive" | "strict" | "id" | "dir" | "rel" | "href" | "
|
|
22
|
+
}, "children" | "replace" | "slot" | "style" | "title" | "component" | "location" | "exact" | "sensitive" | "strict" | "id" | "dir" | "rel" | "href" | "key" | "type" | "isNavLink" | "className" | "to" | "innerRef" | "download" | "hrefLang" | "media" | "ping" | "target" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "activeClassName" | "activeStyle" | "isActive" | "data-noBrokenLinkCheck" | "autoAddBaseUrl"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
23
23
|
export default _default;
|
package/lib/client/flat.js
CHANGED
|
@@ -9,8 +9,7 @@ export default function flat(target) {
|
|
|
9
9
|
const delimiter = '.';
|
|
10
10
|
const output = {};
|
|
11
11
|
function step(object, prefix) {
|
|
12
|
-
Object.
|
|
13
|
-
const value = object[key];
|
|
12
|
+
Object.entries(object).forEach(([key, value]) => {
|
|
14
13
|
const newKey = prefix ? `${prefix}${delimiter}${key}` : key;
|
|
15
14
|
if (isTree(value)) {
|
|
16
15
|
step(value, newKey);
|
package/lib/client/prefetch.js
CHANGED
|
@@ -30,9 +30,9 @@ function linkPrefetchStrategy(url) {
|
|
|
30
30
|
link.setAttribute('href', url);
|
|
31
31
|
link.onload = resolve;
|
|
32
32
|
link.onerror = reject;
|
|
33
|
-
const parentElement = document.getElementsByTagName('head')[0]
|
|
34
|
-
document.getElementsByName('script')[0]
|
|
35
|
-
parentElement
|
|
33
|
+
const parentElement = document.getElementsByTagName('head')[0] ??
|
|
34
|
+
document.getElementsByName('script')[0]?.parentNode;
|
|
35
|
+
parentElement?.appendChild(link);
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
function xhrPrefetchStrategy(url) {
|
|
@@ -4,7 +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
|
-
import type
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
8
8
|
export default function Root({ children }: {
|
|
9
9
|
children: ReactNode;
|
|
10
|
-
}):
|
|
10
|
+
}): JSX.Element;
|
|
@@ -4,6 +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
|
+
import React from 'react';
|
|
7
8
|
// Wrapper at the very top of the app, that is applied constantly
|
|
8
9
|
// and does not depend on current route (unlike the layout)
|
|
9
10
|
//
|
|
@@ -12,5 +13,5 @@
|
|
|
12
13
|
//
|
|
13
14
|
// See https://github.com/facebook/docusaurus/issues/3919
|
|
14
15
|
export default function Root({ children }) {
|
|
15
|
-
return children
|
|
16
|
+
return <>{children}</>;
|
|
16
17
|
}
|
package/lib/server/index.js
CHANGED
|
@@ -234,9 +234,9 @@ export default ${JSON.stringify(siteConfig, null, 2)};`);
|
|
|
234
234
|
// Routing.
|
|
235
235
|
const { registry, routesChunkNames, routesConfig, routesPaths } = await (0, routes_1.default)(pluginsRouteConfigs, baseUrl);
|
|
236
236
|
const genRegistry = (0, utils_1.generate)(generatedFilesDir, 'registry.js', `export default {
|
|
237
|
-
${Object.
|
|
238
|
-
.sort()
|
|
239
|
-
.map((key) => ` '${key}': [${
|
|
237
|
+
${Object.entries(registry)
|
|
238
|
+
.sort((a, b) => a[0].localeCompare(b[0]))
|
|
239
|
+
.map(([key, chunk]) => ` '${key}': [${chunk.loader}, '${(0, utils_1.escapePath)(chunk.modulePath)}', require.resolveWeak('${(0, utils_1.escapePath)(chunk.modulePath)}')],`)
|
|
240
240
|
.join('\n')}};\n`);
|
|
241
241
|
const genRoutesChunkNames = (0, utils_1.generate)(generatedFilesDir, 'routesChunkNames.json', JSON.stringify(routesChunkNames, null, 2));
|
|
242
242
|
const genRoutes = (0, utils_1.generate)(generatedFilesDir, 'routes.js', routesConfig);
|
package/lib/server/routes.js
CHANGED
|
@@ -134,8 +134,8 @@ registry, value, prefix, name) {
|
|
|
134
134
|
return chunkName;
|
|
135
135
|
}
|
|
136
136
|
const newValue = {};
|
|
137
|
-
Object.
|
|
138
|
-
newValue[key] = genRouteChunkNames(registry,
|
|
137
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
138
|
+
newValue[key] = genRouteChunkNames(registry, v, key, name);
|
|
139
139
|
});
|
|
140
140
|
return newValue;
|
|
141
141
|
}
|
|
@@ -16,7 +16,7 @@ async function loadThemeAliases(themePaths, userThemePaths) {
|
|
|
16
16
|
const aliases = {};
|
|
17
17
|
for (const themePath of themePaths) {
|
|
18
18
|
const themeAliases = await (0, alias_1.default)(themePath, true);
|
|
19
|
-
Object.
|
|
19
|
+
Object.entries(themeAliases).forEach(([aliasKey, alias]) => {
|
|
20
20
|
// If this alias shadows a previous one, use @theme-init to preserve the
|
|
21
21
|
// initial one. @theme-init is only applied once: to the initial theme
|
|
22
22
|
// that provided this component
|
|
@@ -27,7 +27,7 @@ async function loadThemeAliases(themePaths, userThemePaths) {
|
|
|
27
27
|
aliases[initAlias] = aliases[aliasKey];
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
aliases[aliasKey] =
|
|
30
|
+
aliases[aliasKey] = alias;
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
for (const themePath of userThemePaths) {
|
|
@@ -24,11 +24,10 @@ class ChunkAssetPlugin {
|
|
|
24
24
|
compiler.hooks.thisCompilation.tap(pluginName, ({ mainTemplate }) => {
|
|
25
25
|
mainTemplate.hooks.requireExtensions.tap(pluginName, (source, chunk) => {
|
|
26
26
|
const chunkIdToName = chunk.getChunkMaps(false).name;
|
|
27
|
-
const chunkNameToId = Object.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
27
|
+
const chunkNameToId = Object.fromEntries(Object.entries(chunkIdToName).map(([chunkId, chunkName]) => [
|
|
28
|
+
chunkName,
|
|
29
|
+
chunkId,
|
|
30
|
+
]));
|
|
32
31
|
const buf = [source];
|
|
33
32
|
buf.push('// function to get chunk asset');
|
|
34
33
|
buf.push(
|
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-4680",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"@babel/runtime": "^7.17.2",
|
|
42
42
|
"@babel/runtime-corejs3": "^7.17.2",
|
|
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-4680",
|
|
45
|
+
"@docusaurus/logger": "0.0.0-4680",
|
|
46
|
+
"@docusaurus/mdx-loader": "0.0.0-4680",
|
|
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-4680",
|
|
49
|
+
"@docusaurus/utils-common": "0.0.0-4680",
|
|
50
|
+
"@docusaurus/utils-validation": "0.0.0-4680",
|
|
51
51
|
"@slorber/static-site-generator-webpack-plugin": "^4.0.1",
|
|
52
52
|
"@svgr/webpack": "^6.2.1",
|
|
53
53
|
"autoprefixer": "^10.4.2",
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
"webpackbar": "^5.0.2"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
110
|
-
"@docusaurus/types": "0.0.0-
|
|
109
|
+
"@docusaurus/module-type-aliases": "0.0.0-4680",
|
|
110
|
+
"@docusaurus/types": "0.0.0-4680",
|
|
111
111
|
"@types/detect-port": "^1.3.2",
|
|
112
112
|
"@types/nprogress": "^0.2.0",
|
|
113
113
|
"@types/react-dom": "^17.0.11",
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"engines": {
|
|
129
129
|
"node": ">=14"
|
|
130
130
|
},
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "367835b86a28dea97e2addba03291438a5f813f8"
|
|
132
132
|
}
|