@docusaurus/core 0.0.0-5033 → 0.0.0-5037

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.
@@ -9,7 +9,7 @@ import path from 'path';
9
9
  import fs from 'fs-extra';
10
10
  // eslint-disable-next-line no-restricted-imports
11
11
  import _ from 'lodash';
12
- import logger from '@docusaurus/logger';
12
+ import chalk from 'chalk';
13
13
  import * as eta from 'eta';
14
14
  import { StaticRouter } from 'react-router-dom';
15
15
  import ReactDOMServer from 'react-dom/server';
@@ -32,12 +32,17 @@ export default async function render(locals) {
32
32
  return await doRender(locals);
33
33
  }
34
34
  catch (err) {
35
- logger.error `Docusaurus server-side rendering could not render static page with path path=${locals.path}.`;
35
+ // We are not using logger in this file, because it seems to fail with some
36
+ // compilers / some polyfill methods. This is very likely a bug, but in the
37
+ // long term, when we output native ES modules in SSR, the bug will be gone.
38
+ // prettier-ignore
39
+ console.error(chalk.red(`${chalk.bold('[ERROR]')} Docusaurus server-side rendering could not render static page with path ${chalk.cyan.underline(locals.path)}.`));
36
40
  const isNotDefinedErrorRegex = /(?:window|document|localStorage|navigator|alert|location|buffer|self) is not defined/i;
37
41
  if (isNotDefinedErrorRegex.test(err.message)) {
38
- logger.info `It looks like you are using code that should run on the client-side only.
39
- To get around it, try using code=${'<BrowserOnly>'} (url=${'https://docusaurus.io/docs/docusaurus-core/#browseronly'}) or code=${'ExecutionEnvironment'} (url=${'https://docusaurus.io/docs/docusaurus-core/#executionenvironment'}).
40
- It might also require to wrap your client code in code=${'useEffect'} hook and/or import a third-party library dynamically (if any).`;
42
+ // prettier-ignore
43
+ console.info(`${chalk.cyan.bold('[INFO]')} It looks like you are using code that should run on the client-side only.
44
+ To get around it, try using ${chalk.cyan('`<BrowserOnly>`')} (${chalk.cyan.underline('https://docusaurus.io/docs/docusaurus-core/#browseronly')}) or ${chalk.cyan('`ExecutionEnvironment`')} (${chalk.cyan.underline('https://docusaurus.io/docs/docusaurus-core/#executionenvironment')}).
45
+ It might also require to wrap your client code in ${chalk.cyan('`useEffect`')} hook and/or import a third-party library dynamically (if any).`);
41
46
  }
42
47
  throw err;
43
48
  }
@@ -76,7 +81,12 @@ async function doRender(locals) {
76
81
  const metaAttributes = metaStrings.filter(Boolean);
77
82
  const { generatedFilesDir } = locals;
78
83
  const manifestPath = path.join(generatedFilesDir, 'client-manifest.json');
79
- const manifest = await fs.readJSON(manifestPath);
84
+ // Using readJSON seems to fail for users of some plugins, possibly because of
85
+ // the eval sandbox having a different `Buffer` instance (native one instead
86
+ // of polyfilled one)
87
+ const manifest = await fs
88
+ .readFile(manifestPath, 'utf-8')
89
+ .then(JSON.parse);
80
90
  // Get all required assets for this particular page based on client
81
91
  // manifest information.
82
92
  const modulesToBeLoaded = [...manifest.entrypoints, ...Array.from(modules)];
@@ -110,7 +120,8 @@ async function doRender(locals) {
110
120
  });
111
121
  }
112
122
  catch (err) {
113
- logger.error `Minification of page path=${locals.path} failed.`;
123
+ // prettier-ignore
124
+ console.error(chalk.red(`${chalk.bold('[ERROR]')} Minification of page ${chalk.cyan.underline(locals.path)} failed.`));
114
125
  throw err;
115
126
  }
116
127
  }
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-5033",
4
+ "version": "0.0.0-5037",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -33,29 +33,30 @@
33
33
  "url": "https://github.com/facebook/docusaurus/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@babel/core": "^7.17.12",
37
- "@babel/generator": "^7.17.12",
36
+ "@babel/core": "^7.18.0",
37
+ "@babel/generator": "^7.18.0",
38
38
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
39
- "@babel/plugin-transform-runtime": "^7.17.12",
40
- "@babel/preset-env": "^7.17.12",
39
+ "@babel/plugin-transform-runtime": "^7.18.0",
40
+ "@babel/preset-env": "^7.18.0",
41
41
  "@babel/preset-react": "^7.17.12",
42
42
  "@babel/preset-typescript": "^7.17.12",
43
- "@babel/runtime": "^7.17.9",
44
- "@babel/runtime-corejs3": "^7.17.9",
45
- "@babel/traverse": "^7.17.12",
46
- "@docusaurus/cssnano-preset": "0.0.0-5033",
47
- "@docusaurus/logger": "0.0.0-5033",
48
- "@docusaurus/mdx-loader": "0.0.0-5033",
43
+ "@babel/runtime": "^7.18.0",
44
+ "@babel/runtime-corejs3": "^7.18.0",
45
+ "@babel/traverse": "^7.18.0",
46
+ "@docusaurus/cssnano-preset": "0.0.0-5037",
47
+ "@docusaurus/logger": "0.0.0-5037",
48
+ "@docusaurus/mdx-loader": "0.0.0-5037",
49
49
  "@docusaurus/react-loadable": "5.5.2",
50
- "@docusaurus/utils": "0.0.0-5033",
51
- "@docusaurus/utils-common": "0.0.0-5033",
52
- "@docusaurus/utils-validation": "0.0.0-5033",
50
+ "@docusaurus/utils": "0.0.0-5037",
51
+ "@docusaurus/utils-common": "0.0.0-5037",
52
+ "@docusaurus/utils-validation": "0.0.0-5037",
53
53
  "@slorber/static-site-generator-webpack-plugin": "^4.0.4",
54
54
  "@svgr/webpack": "^6.2.1",
55
55
  "autoprefixer": "^10.4.7",
56
56
  "babel-loader": "^8.2.5",
57
57
  "babel-plugin-dynamic-import-node": "2.3.0",
58
58
  "boxen": "^6.2.1",
59
+ "chalk": "^4.1.2",
59
60
  "chokidar": "^3.5.3",
60
61
  "clean-css": "^5.3.0",
61
62
  "cli-table3": "^0.6.2",
@@ -65,7 +66,7 @@
65
66
  "core-js": "^3.22.5",
66
67
  "css-loader": "^6.7.1",
67
68
  "css-minimizer-webpack-plugin": "^3.4.1",
68
- "cssnano": "^5.1.8",
69
+ "cssnano": "^5.1.9",
69
70
  "del": "^6.1.0",
70
71
  "detect-port": "^1.3.0",
71
72
  "escape-html": "^1.0.3",
@@ -79,16 +80,16 @@
79
80
  "leven": "^3.1.0",
80
81
  "lodash": "^4.17.21",
81
82
  "mini-css-extract-plugin": "^2.6.0",
82
- "postcss": "^8.4.13",
83
+ "postcss": "^8.4.14",
83
84
  "postcss-loader": "^6.2.1",
84
85
  "prompts": "^2.4.2",
85
86
  "react-dev-utils": "^12.0.1",
86
87
  "react-helmet-async": "^1.3.0",
87
88
  "react-loadable": "npm:@docusaurus/react-loadable@5.5.2",
88
89
  "react-loadable-ssr-addon-v5-slorber": "^1.0.1",
89
- "react-router": "^5.2.0",
90
+ "react-router": "^5.3.3",
90
91
  "react-router-config": "^5.1.1",
91
- "react-router-dom": "^5.2.0",
92
+ "react-router-dom": "^5.3.3",
92
93
  "remark-admonitions": "^1.2.1",
93
94
  "rtl-detect": "^1.0.4",
94
95
  "semver": "^7.3.7",
@@ -106,8 +107,8 @@
106
107
  "webpackbar": "^5.0.2"
107
108
  },
108
109
  "devDependencies": {
109
- "@docusaurus/module-type-aliases": "0.0.0-5033",
110
- "@docusaurus/types": "0.0.0-5033",
110
+ "@docusaurus/module-type-aliases": "0.0.0-5037",
111
+ "@docusaurus/types": "0.0.0-5037",
111
112
  "@types/detect-port": "^1.3.2",
112
113
  "@types/react-dom": "^18.0.4",
113
114
  "@types/react-router-config": "^5.0.6",
@@ -127,5 +128,5 @@
127
128
  "engines": {
128
129
  "node": ">=14"
129
130
  },
130
- "gitHead": "65ba5cbcf521bd2d0d6d3c00b1d59827970b78d4"
131
+ "gitHead": "923ee2cb13be47d28b5286d469ccab06d85a87df"
131
132
  }