@docusaurus/core 0.0.0-4677 → 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.
@@ -38,8 +38,8 @@ export default function ComponentCreator(path, hash) {
38
38
  ]
39
39
  */
40
40
  const flatChunkNames = flat(chunkNames);
41
- Object.keys(flatChunkNames).forEach((key) => {
42
- const chunkRegistry = registry[flatChunkNames[key]];
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
- for (let i = 0; i < keyPath.length - 1; i += 1) {
62
- val = val[keyPath[i]];
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" | "type" | "key" | "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>>;
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;
@@ -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.keys(object).forEach((key) => {
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);
@@ -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].parentNode;
35
- parentElement.appendChild(link);
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 { ReactNode } from 'react';
7
+ import { type ReactNode } from 'react';
8
8
  export default function Root({ children }: {
9
9
  children: ReactNode;
10
- }): ReactNode;
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
  }
@@ -49,7 +49,7 @@ Report it here: https://github.com/facebook/docusaurus/discussions/5468
49
49
  [tableStatusLabel('forbidden')]: [
50
50
  '',
51
51
  `
52
- This component should not meant to be swizzled.
52
+ This component is not meant to be swizzled.
53
53
  `,
54
54
  ],
55
55
  });
@@ -66,7 +66,7 @@ function actionsTable() {
66
66
  Creates a wrapper around the original theme component.
67
67
  Allows rendering other components before/after the original theme component.
68
68
 
69
- ${logger_1.default.green('Tip')}: prefer ${logger_1.default.code('--wrap')} whenever possible to reduces the amount of code to maintain.
69
+ ${logger_1.default.green('Tip')}: prefer ${logger_1.default.code('--wrap')} whenever possible to reduce the amount of code to maintain.
70
70
  `,
71
71
  ],
72
72
  });
@@ -75,9 +75,9 @@ ${logger_1.default.green('Tip')}: prefer ${logger_1.default.code('--wrap')} when
75
75
  logger_1.default.code('--eject'),
76
76
  `
77
77
  Ejects the full source code of the original theme component.
78
- Allows overriding the original component entirely with your own UI and logic.
78
+ Allows overriding of the original component entirely with your own UI and logic.
79
79
 
80
- ${logger_1.default.green('Tip')}: ${logger_1.default.code('--eject')} can be useful to completely redesign a component.
80
+ ${logger_1.default.green('Tip')}: ${logger_1.default.code('--eject')} can be useful for completely redesigning a component.
81
81
  `,
82
82
  ],
83
83
  });
@@ -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.keys(registry)
238
- .sort()
239
- .map((key) => ` '${key}': [${registry[key].loader}, '${(0, utils_1.escapePath)(registry[key].modulePath)}', require.resolveWeak('${(0, utils_1.escapePath)(registry[key].modulePath)}')],`)
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);
@@ -134,8 +134,8 @@ registry, value, prefix, name) {
134
134
  return chunkName;
135
135
  }
136
136
  const newValue = {};
137
- Object.keys(value).forEach((key) => {
138
- newValue[key] = genRouteChunkNames(registry, value[key], key, name);
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.keys(themeAliases).forEach((aliasKey) => {
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] = themeAliases[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.create(null);
28
- Object.keys(chunkIdToName).forEach((chunkId) => {
29
- const chunkName = chunkIdToName[chunkId];
30
- chunkNameToId[chunkName] = chunkId;
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-4677",
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-4677",
45
- "@docusaurus/logger": "0.0.0-4677",
46
- "@docusaurus/mdx-loader": "0.0.0-4677",
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-4677",
49
- "@docusaurus/utils-common": "0.0.0-4677",
50
- "@docusaurus/utils-validation": "0.0.0-4677",
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-4677",
110
- "@docusaurus/types": "0.0.0-4677",
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": "e4f370386120aba552fb9783ac8bcea85bf7fe53"
131
+ "gitHead": "367835b86a28dea97e2addba03291438a5f813f8"
132
132
  }