@docusaurus/core 4.0.0-canary-6965 → 4.0.0-canary-6966
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.
|
@@ -5,16 +5,21 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import _ from 'lodash';
|
|
8
|
+
import { type HttpsConfig } from '../../webpack/utils/getHttpsConfig';
|
|
8
9
|
import type { StartCLIOptions } from './start';
|
|
9
10
|
import type { LoadedPlugin, RouterType } from '@docusaurus/types';
|
|
10
11
|
export type OpenUrlContext = {
|
|
11
12
|
host: string;
|
|
12
13
|
port: number;
|
|
14
|
+
httpsConfig: HttpsConfig;
|
|
13
15
|
getOpenUrl: ({ baseUrl, router, }: {
|
|
14
16
|
baseUrl: string;
|
|
15
17
|
router: RouterType;
|
|
16
18
|
}) => string;
|
|
17
19
|
};
|
|
20
|
+
export declare function createOpenUrlContext({ cliOptions, }: {
|
|
21
|
+
cliOptions: StartCLIOptions;
|
|
22
|
+
}): Promise<OpenUrlContext>;
|
|
18
23
|
type StartParams = {
|
|
19
24
|
siteDirParam: string;
|
|
20
25
|
cliOptions: Partial<StartCLIOptions>;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.createOpenUrlContext = createOpenUrlContext;
|
|
9
10
|
exports.createReloadableSite = createReloadableSite;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const node_url_1 = tslib_1.__importDefault(require("node:url"));
|
|
@@ -14,6 +15,7 @@ const utils_1 = require("@docusaurus/utils");
|
|
|
14
15
|
const logger_1 = tslib_1.__importStar(require("@docusaurus/logger"));
|
|
15
16
|
const fs_1 = require("@docusaurus/fs");
|
|
16
17
|
const getHostPort_1 = require("../../server/getHostPort");
|
|
18
|
+
const getHttpsConfig_1 = tslib_1.__importDefault(require("../../webpack/utils/getHttpsConfig"));
|
|
17
19
|
const site_1 = require("../../server/site");
|
|
18
20
|
const pluginsUtils_1 = require("../../server/plugins/pluginsUtils");
|
|
19
21
|
// This code was historically in CRA/react-dev-utils (deprecated in 2025)
|
|
@@ -32,7 +34,12 @@ function getOpenUrlOrigin(protocol, host, port) {
|
|
|
32
34
|
return localUrlForBrowser;
|
|
33
35
|
}
|
|
34
36
|
async function createOpenUrlContext({ cliOptions, }) {
|
|
35
|
-
const
|
|
37
|
+
const httpsConfig = await (0, getHttpsConfig_1.default)({
|
|
38
|
+
https: cliOptions.https,
|
|
39
|
+
sslCert: cliOptions.sslCert,
|
|
40
|
+
sslKey: cliOptions.sslKey,
|
|
41
|
+
});
|
|
42
|
+
const protocol = httpsConfig ? 'https' : 'http';
|
|
36
43
|
const { host, port } = await (0, getHostPort_1.getHostPort)(cliOptions);
|
|
37
44
|
if (port === null) {
|
|
38
45
|
return process.exit();
|
|
@@ -44,7 +51,7 @@ async function createOpenUrlContext({ cliOptions, }) {
|
|
|
44
51
|
baseUrl,
|
|
45
52
|
]);
|
|
46
53
|
};
|
|
47
|
-
return { host, port, getOpenUrl };
|
|
54
|
+
return { host, port, httpsConfig, getOpenUrl };
|
|
48
55
|
}
|
|
49
56
|
async function createLoadSiteParams({ siteDirParam, cliOptions, }) {
|
|
50
57
|
const siteDir = await (0, fs_1.realpath)(siteDirParam);
|
|
@@ -13,7 +13,6 @@ const webpack_merge_1 = tslib_1.__importDefault(require("webpack-merge"));
|
|
|
13
13
|
const bundler_1 = require("@docusaurus/bundler");
|
|
14
14
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
15
15
|
const watcher_1 = require("./watcher");
|
|
16
|
-
const getHttpsConfig_1 = tslib_1.__importDefault(require("../../webpack/utils/getHttpsConfig"));
|
|
17
16
|
const configure_1 = require("../../webpack/configure");
|
|
18
17
|
const client_1 = require("../../webpack/client");
|
|
19
18
|
// E2E_TEST=true docusaurus start
|
|
@@ -36,14 +35,9 @@ function registerWebpackE2ETestHook(compiler) {
|
|
|
36
35
|
}
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
|
-
|
|
38
|
+
function createDevServerConfig({ cliOptions, props, host, port, httpsConfig, }) {
|
|
40
39
|
const { baseUrl, siteDir, siteConfig } = props;
|
|
41
40
|
const pollingOptions = (0, watcher_1.createPollingOptions)(cliOptions);
|
|
42
|
-
const httpsConfig = await (0, getHttpsConfig_1.default)({
|
|
43
|
-
https: cliOptions.https,
|
|
44
|
-
sslCert: cliOptions.sslCert,
|
|
45
|
-
sslKey: cliOptions.sslKey,
|
|
46
|
-
});
|
|
47
41
|
// https://webpack.js.org/configuration/dev-server
|
|
48
42
|
return {
|
|
49
43
|
hot: cliOptions.hotOnly ? 'only' : true,
|
|
@@ -122,11 +116,12 @@ async function createWebpackDevServer({ props, cliOptions, openUrlContext, }) {
|
|
|
122
116
|
});
|
|
123
117
|
const compiler = props.currentBundler.instance(config);
|
|
124
118
|
registerWebpackE2ETestHook(compiler);
|
|
125
|
-
const defaultDevServerConfig =
|
|
119
|
+
const defaultDevServerConfig = createDevServerConfig({
|
|
126
120
|
cliOptions,
|
|
127
121
|
props,
|
|
128
122
|
host: openUrlContext.host,
|
|
129
123
|
port: openUrlContext.port,
|
|
124
|
+
httpsConfig: openUrlContext.httpsConfig,
|
|
130
125
|
});
|
|
131
126
|
// Allow plugin authors to customize/override devServer config
|
|
132
127
|
const devServerConfig = (0, webpack_merge_1.default)([defaultDevServerConfig, config.devServer].filter(Boolean));
|
|
@@ -9,8 +9,9 @@ type HttpsConfigOptions = {
|
|
|
9
9
|
sslCert: string;
|
|
10
10
|
sslKey: string;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type HttpsConfig = boolean | {
|
|
13
13
|
cert: Buffer;
|
|
14
14
|
key: Buffer;
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
|
+
export default function getHttpsConfig(options?: Partial<HttpsConfigOptions>): Promise<HttpsConfig>;
|
|
16
17
|
export {};
|
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": "4.0.0-canary-
|
|
4
|
+
"version": "4.0.0-canary-6966",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"url": "https://github.com/facebook/docusaurus/issues"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@docusaurus/babel": "4.0.0-canary-
|
|
31
|
-
"@docusaurus/bundler": "4.0.0-canary-
|
|
32
|
-
"@docusaurus/fs": "4.0.0-canary-
|
|
33
|
-
"@docusaurus/glob": "4.0.0-canary-
|
|
34
|
-
"@docusaurus/logger": "4.0.0-canary-
|
|
35
|
-
"@docusaurus/mdx-loader": "4.0.0-canary-
|
|
36
|
-
"@docusaurus/utils": "4.0.0-canary-
|
|
37
|
-
"@docusaurus/utils-common": "4.0.0-canary-
|
|
38
|
-
"@docusaurus/utils-validation": "4.0.0-canary-
|
|
30
|
+
"@docusaurus/babel": "4.0.0-canary-6966",
|
|
31
|
+
"@docusaurus/bundler": "4.0.0-canary-6966",
|
|
32
|
+
"@docusaurus/fs": "4.0.0-canary-6966",
|
|
33
|
+
"@docusaurus/glob": "4.0.0-canary-6966",
|
|
34
|
+
"@docusaurus/logger": "4.0.0-canary-6966",
|
|
35
|
+
"@docusaurus/mdx-loader": "4.0.0-canary-6966",
|
|
36
|
+
"@docusaurus/utils": "4.0.0-canary-6966",
|
|
37
|
+
"@docusaurus/utils-common": "4.0.0-canary-6966",
|
|
38
|
+
"@docusaurus/utils-validation": "4.0.0-canary-6966",
|
|
39
39
|
"@rspack/core": "^2.2.3",
|
|
40
40
|
"@rspack/dev-server": "^2.2.1",
|
|
41
41
|
"boxen": "^9.0.0",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"webpack-merge": "^6.0.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@docusaurus/module-type-aliases": "4.0.0-canary-
|
|
72
|
-
"@docusaurus/types": "4.0.0-canary-
|
|
71
|
+
"@docusaurus/module-type-aliases": "4.0.0-canary-6966",
|
|
72
|
+
"@docusaurus/types": "4.0.0-canary-6966",
|
|
73
73
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
74
74
|
"@types/escape-html": "^1.0.4",
|
|
75
75
|
"@types/history": "^4.7.11",
|