@docusaurus/core 0.0.0-4990 → 0.0.0-4994

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.
@@ -22,14 +22,10 @@ export default class ErrorBoundary extends React.Component {
22
22
  const { children } = this.props;
23
23
  const { error } = this.state;
24
24
  if (error) {
25
- const fallback = this.props.fallback ?? DefaultFallback;
26
- return fallback({
27
- error,
28
- tryAgain: () => this.setState({ error: null }),
29
- });
25
+ const Fallback = this.props.fallback ?? DefaultFallback;
26
+ return (<Fallback error={error} tryAgain={() => this.setState({ error: null })}/>);
30
27
  }
31
- return (children ??
32
- // See https://github.com/facebook/docusaurus/issues/6337#issuecomment-1012913647
33
- null);
28
+ // See https://github.com/facebook/docusaurus/issues/6337#issuecomment-1012913647
29
+ return children ?? null;
34
30
  }
35
31
  }
@@ -43,19 +43,17 @@ async function eject({ siteDir, themePath, componentName, }) {
43
43
  // This should never happen
44
44
  throw new Error(logger_1.default.interpolate `No files to copy from path=${fromPath} with glob code=${globPatternPosix}`);
45
45
  }
46
- const toPath = isDirectory
47
- ? path_1.default.join(siteDir, utils_1.THEME_PATH, componentName)
48
- : path_1.default.join(siteDir, utils_1.THEME_PATH);
46
+ const toPath = path_1.default.join(siteDir, utils_1.THEME_PATH);
49
47
  await fs_extra_1.default.ensureDir(toPath);
50
48
  const createdFiles = await Promise.all(filesToCopy.map(async (sourceFile) => {
51
- const fileName = path_1.default.basename(sourceFile);
52
- const targetFile = path_1.default.join(toPath, fileName);
49
+ const targetFile = path_1.default.join(toPath, path_1.default.relative(themePath, sourceFile));
53
50
  try {
54
51
  const fileContents = await fs_extra_1.default.readFile(sourceFile, 'utf-8');
55
52
  await fs_extra_1.default.outputFile(targetFile, fileContents.trimStart().replace(/^\/\*.+?\*\/\s*/ms, ''));
56
53
  }
57
54
  catch (err) {
58
- throw new Error(logger_1.default.interpolate `Could not copy file from path=${sourceFile} to path=${targetFile}`);
55
+ logger_1.default.error `Could not copy file from path=${sourceFile} to path=${targetFile}`;
56
+ throw err;
59
57
  }
60
58
  return targetFile;
61
59
  }));
@@ -7,9 +7,11 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.getThemeSwizzleConfig = exports.normalizeSwizzleConfig = void 0;
10
+ const tslib_1 = require("tslib");
10
11
  const utils_validation_1 = require("@docusaurus/utils-validation");
11
12
  const common_1 = require("./common");
12
13
  const themes_1 = require("./themes");
14
+ const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
13
15
  function getModuleSwizzleConfig(swizzlePlugin) {
14
16
  const getSwizzleConfig = swizzlePlugin.plugin.plugin?.getSwizzleConfig ??
15
17
  swizzlePlugin.plugin.pluginModule?.module.getSwizzleConfig ??
@@ -74,8 +76,9 @@ function getThemeSwizzleConfig(themeName, plugins) {
74
76
  try {
75
77
  return normalizeSwizzleConfig(config);
76
78
  }
77
- catch (e) {
78
- throw new Error(`Invalid Swizzle config for theme ${themeName}.\n${e.message}`);
79
+ catch (err) {
80
+ logger_1.default.error `Invalid Swizzle config for theme name=${themeName}.`;
81
+ throw err;
79
82
  }
80
83
  }
81
84
  return FallbackSwizzleConfig;
@@ -210,16 +210,16 @@ function validateKeyAndCerts({ cert, key, keyFile, crtFile, }) {
210
210
  encrypted = crypto_1.default.publicEncrypt(cert, Buffer.from('test'));
211
211
  }
212
212
  catch (err) {
213
- throw new Error(`The certificate ${crtFile} is invalid.
214
- ${err}`);
213
+ logger_1.default.error `The certificate path=${crtFile} is invalid.`;
214
+ throw err;
215
215
  }
216
216
  try {
217
217
  // privateDecrypt will throw an error with an invalid key
218
218
  crypto_1.default.privateDecrypt(key, encrypted);
219
219
  }
220
220
  catch (err) {
221
- throw new Error(`The certificate key ${keyFile} is invalid.
222
- ${err}`);
221
+ logger_1.default.error `The certificate key path=${keyFile} is invalid.`;
222
+ throw err;
223
223
  }
224
224
  }
225
225
  // Read file and throw an error if it doesn't exist
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-4990",
4
+ "version": "0.0.0-4994",
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-4990",
45
- "@docusaurus/logger": "0.0.0-4990",
46
- "@docusaurus/mdx-loader": "0.0.0-4990",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4994",
45
+ "@docusaurus/logger": "0.0.0-4994",
46
+ "@docusaurus/mdx-loader": "0.0.0-4994",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4990",
49
- "@docusaurus/utils-common": "0.0.0-4990",
50
- "@docusaurus/utils-validation": "0.0.0-4990",
48
+ "@docusaurus/utils": "0.0.0-4994",
49
+ "@docusaurus/utils-common": "0.0.0-4994",
50
+ "@docusaurus/utils-validation": "0.0.0-4994",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.4",
52
52
  "@svgr/webpack": "^6.2.1",
53
53
  "autoprefixer": "^10.4.7",
@@ -104,8 +104,8 @@
104
104
  "webpackbar": "^5.0.2"
105
105
  },
106
106
  "devDependencies": {
107
- "@docusaurus/module-type-aliases": "0.0.0-4990",
108
- "@docusaurus/types": "0.0.0-4990",
107
+ "@docusaurus/module-type-aliases": "0.0.0-4994",
108
+ "@docusaurus/types": "0.0.0-4994",
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": "712531f8bdb90ef84f88e49ebaecdb200698da0a"
128
+ "gitHead": "2a32b411193e88dc4c6ea4a11d1202333beb7bc2"
129
129
  }