@docusaurus/core 0.0.0-4738 → 0.0.0-4739

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.
@@ -63,19 +63,21 @@ export default function ComponentCreator(path, hash) {
63
63
  // Clone the original object since we don't want to alter the original.
64
64
  const loadedModules = JSON.parse(JSON.stringify(chunkNames));
65
65
  Object.keys(loaded).forEach((key) => {
66
+ const newComp = loaded[key].default;
67
+ if (!newComp) {
68
+ throw new Error(`The page component at ${path} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);
69
+ }
70
+ Object.keys(loaded[key])
71
+ .filter((k) => k !== 'default')
72
+ .forEach((nonDefaultKey) => {
73
+ newComp[nonDefaultKey] = loaded[key][nonDefaultKey];
74
+ });
66
75
  let val = loadedModules;
67
76
  const keyPath = key.split('.');
68
77
  keyPath.slice(0, -1).forEach((k) => {
69
78
  val = val[k];
70
79
  });
71
- val[keyPath[keyPath.length - 1]] = loaded[key].default;
72
- const nonDefaultKeys = Object.keys(loaded[key]).filter((k) => k !== 'default');
73
- if (nonDefaultKeys?.length) {
74
- nonDefaultKeys.forEach((nonDefaultKey) => {
75
- val[keyPath[keyPath.length - 1]][nonDefaultKey] =
76
- loaded[key][nonDefaultKey];
77
- });
78
- }
80
+ val[keyPath[keyPath.length - 1]] = newComp;
79
81
  });
80
82
  const Component = loadedModules.component;
81
83
  delete loadedModules.component;
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-4738",
4
+ "version": "0.0.0-4739",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.17.7",
42
42
  "@babel/runtime-corejs3": "^7.17.7",
43
43
  "@babel/traverse": "^7.17.3",
44
- "@docusaurus/cssnano-preset": "0.0.0-4738",
45
- "@docusaurus/logger": "0.0.0-4738",
46
- "@docusaurus/mdx-loader": "0.0.0-4738",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4739",
45
+ "@docusaurus/logger": "0.0.0-4739",
46
+ "@docusaurus/mdx-loader": "0.0.0-4739",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4738",
49
- "@docusaurus/utils-common": "0.0.0-4738",
50
- "@docusaurus/utils-validation": "0.0.0-4738",
48
+ "@docusaurus/utils": "0.0.0-4739",
49
+ "@docusaurus/utils-common": "0.0.0-4739",
50
+ "@docusaurus/utils-validation": "0.0.0-4739",
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-4738",
110
- "@docusaurus/types": "0.0.0-4738",
109
+ "@docusaurus/module-type-aliases": "0.0.0-4739",
110
+ "@docusaurus/types": "0.0.0-4739",
111
111
  "@types/detect-port": "^1.3.2",
112
112
  "@types/nprogress": "^0.2.0",
113
113
  "@types/react-dom": "^17.0.13",
@@ -128,5 +128,5 @@
128
128
  "engines": {
129
129
  "node": ">=14"
130
130
  },
131
- "gitHead": "a9c78632ceba2532982c6b12e97de11b055e6c45"
131
+ "gitHead": "5902cd7b653725a71940b98169190908d22cffe9"
132
132
  }