@docusaurus/core 0.0.0-5031 → 0.0.0-5034
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/bin/docusaurus.mjs +4 -0
- package/lib/client/serverEntry.js +18 -7
- package/lib/commands/start.d.ts +1 -0
- package/lib/commands/start.js +1 -1
- package/package.json +13 -12
package/bin/docusaurus.mjs
CHANGED
|
@@ -126,6 +126,10 @@ cli
|
|
|
126
126
|
'--poll [interval]',
|
|
127
127
|
'use polling rather than watching for reload (default: false). Can specify a poll interval in milliseconds',
|
|
128
128
|
)
|
|
129
|
+
.option(
|
|
130
|
+
'--no-minify',
|
|
131
|
+
'build website without minimizing JS bundles (default: false)',
|
|
132
|
+
)
|
|
129
133
|
.action(async (siteDir, options) =>
|
|
130
134
|
start(await resolveDir(siteDir), options),
|
|
131
135
|
);
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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/lib/commands/start.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export declare type StartCLIOptions = HostPortOptions & Pick<LoadContextOptions,
|
|
|
10
10
|
hotOnly?: boolean;
|
|
11
11
|
open?: boolean;
|
|
12
12
|
poll?: boolean | number;
|
|
13
|
+
minify?: boolean;
|
|
13
14
|
};
|
|
14
15
|
export declare function start(siteDir: string, cliOptions: Partial<StartCLIOptions>): Promise<void>;
|
package/lib/commands/start.js
CHANGED
|
@@ -93,7 +93,7 @@ async function start(siteDir, cliOptions) {
|
|
|
93
93
|
...{ pollingOptions },
|
|
94
94
|
});
|
|
95
95
|
['add', 'change', 'unlink', 'addDir', 'unlinkDir'].forEach((event) => fsWatcher.on(event, reload));
|
|
96
|
-
let config = (0, webpack_merge_1.default)(await (0, client_1.default)(props), {
|
|
96
|
+
let config = (0, webpack_merge_1.default)(await (0, client_1.default)(props, cliOptions.minify), {
|
|
97
97
|
watchOptions: {
|
|
98
98
|
ignored: /node_modules\/(?!@docusaurus)/,
|
|
99
99
|
poll: cliOptions.poll,
|
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-5034",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"docusaurus": "bin/docusaurus.mjs"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.
|
|
27
|
+
"build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js",
|
|
28
28
|
"watch": "run-p -c copy:watch build:watch",
|
|
29
29
|
"build:watch": "tsc --build --watch",
|
|
30
|
-
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.
|
|
30
|
+
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
31
31
|
},
|
|
32
32
|
"bugs": {
|
|
33
33
|
"url": "https://github.com/facebook/docusaurus/issues"
|
|
@@ -43,19 +43,20 @@
|
|
|
43
43
|
"@babel/runtime": "^7.17.9",
|
|
44
44
|
"@babel/runtime-corejs3": "^7.17.9",
|
|
45
45
|
"@babel/traverse": "^7.17.12",
|
|
46
|
-
"@docusaurus/cssnano-preset": "0.0.0-
|
|
47
|
-
"@docusaurus/logger": "0.0.0-
|
|
48
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
46
|
+
"@docusaurus/cssnano-preset": "0.0.0-5034",
|
|
47
|
+
"@docusaurus/logger": "0.0.0-5034",
|
|
48
|
+
"@docusaurus/mdx-loader": "0.0.0-5034",
|
|
49
49
|
"@docusaurus/react-loadable": "5.5.2",
|
|
50
|
-
"@docusaurus/utils": "0.0.0-
|
|
51
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
52
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
50
|
+
"@docusaurus/utils": "0.0.0-5034",
|
|
51
|
+
"@docusaurus/utils-common": "0.0.0-5034",
|
|
52
|
+
"@docusaurus/utils-validation": "0.0.0-5034",
|
|
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",
|
|
@@ -106,8 +107,8 @@
|
|
|
106
107
|
"webpackbar": "^5.0.2"
|
|
107
108
|
},
|
|
108
109
|
"devDependencies": {
|
|
109
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
110
|
-
"@docusaurus/types": "0.0.0-
|
|
110
|
+
"@docusaurus/module-type-aliases": "0.0.0-5034",
|
|
111
|
+
"@docusaurus/types": "0.0.0-5034",
|
|
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": "
|
|
131
|
+
"gitHead": "6c84b6fc46bf2e62af92b1b0c1e36391faec3b04"
|
|
131
132
|
}
|