@docusaurus/core 0.0.0-4937 → 0.0.0-4944
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/lib/commands/build.d.ts +5 -1
- package/lib/commands/build.js +18 -9
- package/lib/commands/deploy.d.ts +5 -2
- package/lib/commands/deploy.js +2 -2
- package/lib/commands/serve.d.ts +6 -1
- package/lib/commands/serve.js +2 -3
- package/lib/commands/start.d.ts +7 -1
- package/lib/commands/start.js +3 -4
- package/lib/commands/swizzle/actions.d.ts +2 -2
- package/lib/commands/swizzle/common.d.ts +2 -2
- package/lib/commands/swizzle/index.d.ts +2 -2
- package/lib/commands/writeTranslations.d.ts +3 -4
- package/lib/commands/writeTranslations.js +1 -1
- package/lib/server/configValidation.js +2 -2
- package/lib/server/getHostPort.d.ts +14 -0
- package/lib/server/{choosePort.js → getHostPort.js} +9 -2
- package/lib/server/index.d.ts +4 -4
- package/lib/server/index.js +2 -2
- package/package.json +10 -10
- package/lib/commands/commandUtils.d.ts +0 -9
- package/lib/commands/commandUtils.js +0 -20
- package/lib/server/choosePort.d.ts +0 -12
package/lib/commands/build.d.ts
CHANGED
|
@@ -4,5 +4,9 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { type LoadContextOptions } from '../server';
|
|
8
|
+
export declare type BuildCLIOptions = Pick<LoadContextOptions, 'config' | 'locale' | 'outDir'> & {
|
|
9
|
+
bundleAnalyzer?: boolean;
|
|
10
|
+
minify?: boolean;
|
|
11
|
+
};
|
|
8
12
|
export declare function build(siteDir: string, cliOptions: Partial<BuildCLIOptions>, forceTerminate?: boolean): Promise<string>;
|
package/lib/commands/build.js
CHANGED
|
@@ -49,8 +49,8 @@ forceTerminate = true) {
|
|
|
49
49
|
}
|
|
50
50
|
const context = await (0, server_1.loadContext)({
|
|
51
51
|
siteDir,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
outDir: cliOptions.outDir,
|
|
53
|
+
config: cliOptions.config,
|
|
54
54
|
locale: cliOptions.locale,
|
|
55
55
|
localizePath: cliOptions.locale ? false : undefined,
|
|
56
56
|
});
|
|
@@ -82,13 +82,13 @@ async function buildLocale({ siteDir, locale, cliOptions, forceTerminate, isLast
|
|
|
82
82
|
logger_1.default.info `name=${`[${locale}]`} Creating an optimized production build...`;
|
|
83
83
|
const props = await (0, server_1.load)({
|
|
84
84
|
siteDir,
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
outDir: cliOptions.outDir,
|
|
86
|
+
config: cliOptions.config,
|
|
87
87
|
locale,
|
|
88
88
|
localizePath: cliOptions.locale ? false : undefined,
|
|
89
89
|
});
|
|
90
90
|
// Apply user webpack config.
|
|
91
|
-
const { outDir, generatedFilesDir, plugins, siteConfig: { baseUrl, onBrokenLinks, staticDirectories }, routes, } = props;
|
|
91
|
+
const { outDir, generatedFilesDir, plugins, siteConfig: { baseUrl, onBrokenLinks, staticDirectories: staticDirectoriesOption, }, routes, } = props;
|
|
92
92
|
const clientManifestPath = path_1.default.join(generatedFilesDir, 'client-manifest.json');
|
|
93
93
|
let clientConfig = (0, webpack_merge_1.default)(await (0, client_1.default)(props, cliOptions.minify), {
|
|
94
94
|
plugins: [
|
|
@@ -114,14 +114,23 @@ async function buildLocale({ siteDir, locale, cliOptions, forceTerminate, isLast
|
|
|
114
114
|
headTags[staticPagePath] = tags;
|
|
115
115
|
},
|
|
116
116
|
});
|
|
117
|
+
// The staticDirectories option can contain empty directories, or non-existent
|
|
118
|
+
// directories (e.g. user deleted `static`). Instead of issuing an error, we
|
|
119
|
+
// just silently filter them out, because user could have never configured it
|
|
120
|
+
// in the first place (the default option should always "work").
|
|
121
|
+
const staticDirectories = (await Promise.all(staticDirectoriesOption.map(async (dir) => {
|
|
122
|
+
const staticDir = path_1.default.resolve(siteDir, dir);
|
|
123
|
+
if ((await fs_extra_1.default.pathExists(staticDir)) &&
|
|
124
|
+
(await fs_extra_1.default.readdir(staticDir)).length > 0) {
|
|
125
|
+
return staticDir;
|
|
126
|
+
}
|
|
127
|
+
return '';
|
|
128
|
+
}))).filter(Boolean);
|
|
117
129
|
if (staticDirectories.length > 0) {
|
|
118
|
-
await Promise.all(staticDirectories.map((dir) => fs_extra_1.default.ensureDir(dir)));
|
|
119
130
|
serverConfig = (0, webpack_merge_1.default)(serverConfig, {
|
|
120
131
|
plugins: [
|
|
121
132
|
new copy_webpack_plugin_1.default({
|
|
122
|
-
patterns: staticDirectories
|
|
123
|
-
.map((dir) => path_1.default.resolve(siteDir, dir))
|
|
124
|
-
.map((dir) => ({ from: dir, to: outDir })),
|
|
133
|
+
patterns: staticDirectories.map((dir) => ({ from: dir, to: outDir })),
|
|
125
134
|
}),
|
|
126
135
|
],
|
|
127
136
|
});
|
package/lib/commands/deploy.d.ts
CHANGED
|
@@ -4,5 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
8
|
-
export declare
|
|
7
|
+
import { type LoadContextOptions } from '../server';
|
|
8
|
+
export declare type DeployCLIOptions = Pick<LoadContextOptions, 'config' | 'locale' | 'outDir'> & {
|
|
9
|
+
skipBuild?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function deploy(siteDir: string, cliOptions: Partial<DeployCLIOptions>): Promise<void>;
|
package/lib/commands/deploy.js
CHANGED
|
@@ -37,8 +37,8 @@ function shellExecLog(cmd) {
|
|
|
37
37
|
async function deploy(siteDir, cliOptions) {
|
|
38
38
|
const { outDir, siteConfig, siteConfigPath } = await (0, server_1.loadContext)({
|
|
39
39
|
siteDir,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
config: cliOptions.config,
|
|
41
|
+
outDir: cliOptions.outDir,
|
|
42
42
|
});
|
|
43
43
|
if (typeof siteConfig.trailingSlash === 'undefined') {
|
|
44
44
|
logger_1.default.warn(`When deploying to GitHub Pages, it is better to use an explicit "trailingSlash" site config.
|
package/lib/commands/serve.d.ts
CHANGED
|
@@ -4,5 +4,10 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { LoadContextOptions } from '../server';
|
|
8
|
+
import { type HostPortOptions } from '../server/getHostPort';
|
|
9
|
+
export declare type ServeCLIOptions = HostPortOptions & Pick<LoadContextOptions, 'config'> & {
|
|
10
|
+
dir?: string;
|
|
11
|
+
build?: boolean;
|
|
12
|
+
};
|
|
8
13
|
export declare function serve(siteDir: string, cliOptions: Partial<ServeCLIOptions>): Promise<void>;
|
package/lib/commands/serve.js
CHANGED
|
@@ -14,7 +14,7 @@ const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
|
14
14
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
15
15
|
const config_1 = require("../server/config");
|
|
16
16
|
const build_1 = require("./build");
|
|
17
|
-
const
|
|
17
|
+
const getHostPort_1 = require("../server/getHostPort");
|
|
18
18
|
const utils_1 = require("@docusaurus/utils");
|
|
19
19
|
async function serve(siteDir, cliOptions) {
|
|
20
20
|
const buildDir = cliOptions.dir ?? utils_1.DEFAULT_BUILD_DIR_NAME;
|
|
@@ -25,8 +25,7 @@ async function serve(siteDir, cliOptions) {
|
|
|
25
25
|
outDir: dir,
|
|
26
26
|
}, false);
|
|
27
27
|
}
|
|
28
|
-
const host = (0,
|
|
29
|
-
const port = await (0, commandUtils_1.getCLIOptionPort)(cliOptions.port, host);
|
|
28
|
+
const { host, port } = await (0, getHostPort_1.getHostPort)(cliOptions);
|
|
30
29
|
if (port === null) {
|
|
31
30
|
process.exit();
|
|
32
31
|
}
|
package/lib/commands/start.d.ts
CHANGED
|
@@ -4,5 +4,11 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { type LoadContextOptions } from '../server';
|
|
8
|
+
import { type HostPortOptions } from '../server/getHostPort';
|
|
9
|
+
export declare type StartCLIOptions = HostPortOptions & Pick<LoadContextOptions, 'locale' | 'config'> & {
|
|
10
|
+
hotOnly?: boolean;
|
|
11
|
+
open?: boolean;
|
|
12
|
+
poll?: boolean | number;
|
|
13
|
+
};
|
|
8
14
|
export declare function start(siteDir: string, cliOptions: Partial<StartCLIOptions>): Promise<void>;
|
package/lib/commands/start.js
CHANGED
|
@@ -23,7 +23,7 @@ const webpack_merge_1 = tslib_1.__importDefault(require("webpack-merge"));
|
|
|
23
23
|
const server_1 = require("../server");
|
|
24
24
|
const client_1 = tslib_1.__importDefault(require("../webpack/client"));
|
|
25
25
|
const utils_2 = require("../webpack/utils");
|
|
26
|
-
const
|
|
26
|
+
const getHostPort_1 = require("../server/getHostPort");
|
|
27
27
|
const translations_1 = require("../server/translations/translations");
|
|
28
28
|
async function start(siteDir, cliOptions) {
|
|
29
29
|
process.env.NODE_ENV = 'development';
|
|
@@ -32,7 +32,7 @@ async function start(siteDir, cliOptions) {
|
|
|
32
32
|
function loadSite() {
|
|
33
33
|
return (0, server_1.load)({
|
|
34
34
|
siteDir,
|
|
35
|
-
|
|
35
|
+
config: cliOptions.config,
|
|
36
36
|
locale: cliOptions.locale,
|
|
37
37
|
localizePath: undefined, // Should this be configurable?
|
|
38
38
|
});
|
|
@@ -40,8 +40,7 @@ async function start(siteDir, cliOptions) {
|
|
|
40
40
|
// Process all related files as a prop.
|
|
41
41
|
const props = await loadSite();
|
|
42
42
|
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
43
|
-
const host = (0,
|
|
44
|
-
const port = await (0, commandUtils_1.getCLIOptionPort)(cliOptions.port, host);
|
|
43
|
+
const { host, port } = await (0, getHostPort_1.getHostPort)(cliOptions);
|
|
45
44
|
if (port === null) {
|
|
46
45
|
process.exit();
|
|
47
46
|
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { SwizzleAction, SwizzleComponentConfig } from '@docusaurus/types';
|
|
8
|
-
import type {
|
|
8
|
+
import type { SwizzleCLIOptions } from './common';
|
|
9
9
|
export declare const SwizzleActions: SwizzleAction[];
|
|
10
|
-
export declare function getAction(componentConfig: SwizzleComponentConfig, options: Pick<
|
|
10
|
+
export declare function getAction(componentConfig: SwizzleComponentConfig, options: Pick<SwizzleCLIOptions, 'wrap' | 'eject'>): Promise<SwizzleAction>;
|
|
11
11
|
export declare type ActionParams = {
|
|
12
12
|
siteDir: string;
|
|
13
13
|
themePath: string;
|
|
@@ -20,13 +20,13 @@ export declare type SwizzlePlugin = {
|
|
|
20
20
|
export declare type SwizzleContext = {
|
|
21
21
|
plugins: SwizzlePlugin[];
|
|
22
22
|
};
|
|
23
|
-
export declare type
|
|
23
|
+
export declare type SwizzleCLIOptions = {
|
|
24
24
|
typescript: boolean;
|
|
25
25
|
danger: boolean;
|
|
26
26
|
list: boolean;
|
|
27
27
|
wrap: boolean;
|
|
28
28
|
eject: boolean;
|
|
29
29
|
};
|
|
30
|
-
export declare function normalizeOptions(options: Partial<
|
|
30
|
+
export declare function normalizeOptions(options: Partial<SwizzleCLIOptions>): SwizzleCLIOptions;
|
|
31
31
|
export declare function findStringIgnoringCase(str: string, values: string[]): string | undefined;
|
|
32
32
|
export declare function findClosestValue(str: string, values: string[], maxLevenshtein?: number): string | undefined;
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
8
|
-
export declare function swizzle(siteDir: string, themeNameParam: string | undefined, componentNameParam: string | undefined, optionsParam: Partial<
|
|
7
|
+
import type { SwizzleCLIOptions } from './common';
|
|
8
|
+
export declare function swizzle(siteDir: string, themeNameParam: string | undefined, componentNameParam: string | undefined, optionsParam: Partial<SwizzleCLIOptions>): Promise<void>;
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { type LoadContextOptions } from '../server';
|
|
8
8
|
import { type WriteTranslationsOptions } from '../server/translations/translations';
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
}>): Promise<void>;
|
|
9
|
+
export declare type WriteTranslationsCLIOptions = Pick<LoadContextOptions, 'config' | 'locale'> & WriteTranslationsOptions;
|
|
10
|
+
export declare function writeTranslations(siteDir: string, options: Partial<WriteTranslationsCLIOptions>): Promise<void>;
|
|
@@ -50,7 +50,7 @@ async function writePluginTranslationFiles({ siteDir, plugin, locale, options, }
|
|
|
50
50
|
async function writeTranslations(siteDir, options) {
|
|
51
51
|
const context = await (0, server_1.loadContext)({
|
|
52
52
|
siteDir,
|
|
53
|
-
|
|
53
|
+
config: options.config,
|
|
54
54
|
locale: options.locale,
|
|
55
55
|
});
|
|
56
56
|
const plugins = await (0, init_1.initPlugins)(context);
|
|
@@ -169,8 +169,8 @@ exports.ConfigSchema = utils_validation_1.Joi.object({
|
|
|
169
169
|
.items(utils_validation_1.Joi.string())
|
|
170
170
|
.default(exports.DEFAULT_CONFIG.clientModules),
|
|
171
171
|
tagline: utils_validation_1.Joi.string().allow('').default(exports.DEFAULT_CONFIG.tagline),
|
|
172
|
-
titleDelimiter: utils_validation_1.Joi.string().default(
|
|
173
|
-
noIndex: utils_validation_1.Joi.bool().default(
|
|
172
|
+
titleDelimiter: utils_validation_1.Joi.string().default(exports.DEFAULT_CONFIG.titleDelimiter),
|
|
173
|
+
noIndex: utils_validation_1.Joi.bool().default(exports.DEFAULT_CONFIG.noIndex),
|
|
174
174
|
webpack: utils_validation_1.Joi.object({
|
|
175
175
|
jsLoader: utils_validation_1.Joi.alternatives()
|
|
176
176
|
.try(utils_validation_1.Joi.string().equal('babel'), utils_validation_1.Joi.function())
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare type HostPortOptions = {
|
|
8
|
+
host?: string;
|
|
9
|
+
port?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function getHostPort(options: HostPortOptions): Promise<{
|
|
12
|
+
host: string;
|
|
13
|
+
port: number | null;
|
|
14
|
+
}>;
|
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.getHostPort = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const detect_port_1 = tslib_1.__importDefault(require("detect-port"));
|
|
13
13
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
14
|
+
const utils_1 = require("@docusaurus/utils");
|
|
14
15
|
const prompts_1 = tslib_1.__importDefault(require("prompts"));
|
|
15
16
|
const execOptions = {
|
|
16
17
|
encoding: 'utf8',
|
|
@@ -69,4 +70,10 @@ Would you like to run the app on another port instead?`),
|
|
|
69
70
|
throw err;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
async function getHostPort(options) {
|
|
74
|
+
const host = options.host ?? 'localhost';
|
|
75
|
+
const basePort = options.port ? parseInt(options.port, 10) : utils_1.DEFAULT_PORT;
|
|
76
|
+
const port = await choosePort(host, basePort);
|
|
77
|
+
return { host, port };
|
|
78
|
+
}
|
|
79
|
+
exports.getHostPort = getHostPort;
|
package/lib/server/index.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ import type { LoadContext, Props } from '@docusaurus/types';
|
|
|
8
8
|
export declare type LoadContextOptions = {
|
|
9
9
|
/** Usually the CWD; can be overridden with command argument. */
|
|
10
10
|
siteDir: string;
|
|
11
|
-
/** Can be customized with `--out-dir` option */
|
|
12
|
-
|
|
13
|
-
/** Can be customized with `--config` option */
|
|
14
|
-
|
|
11
|
+
/** Custom output directory. Can be customized with `--out-dir` option */
|
|
12
|
+
outDir?: string;
|
|
13
|
+
/** Custom config path. Can be customized with `--config` option */
|
|
14
|
+
config?: string;
|
|
15
15
|
/** Default is `i18n.defaultLocale` */
|
|
16
16
|
locale?: string;
|
|
17
17
|
/**
|
package/lib/server/index.js
CHANGED
|
@@ -26,7 +26,7 @@ const translations_1 = require("./translations/translations");
|
|
|
26
26
|
* to plugin constructors.
|
|
27
27
|
*/
|
|
28
28
|
async function loadContext(options) {
|
|
29
|
-
const { siteDir,
|
|
29
|
+
const { siteDir, outDir: baseOutDir = utils_1.DEFAULT_BUILD_DIR_NAME, locale, config: customConfigFilePath, } = options;
|
|
30
30
|
const generatedFilesDir = path_1.default.resolve(siteDir, utils_1.GENERATED_FILES_DIR_NAME);
|
|
31
31
|
const { siteConfig: initialSiteConfig, siteConfigPath } = await (0, config_1.loadSiteConfig)({
|
|
32
32
|
siteDir,
|
|
@@ -40,7 +40,7 @@ async function loadContext(options) {
|
|
|
40
40
|
pathType: 'url',
|
|
41
41
|
});
|
|
42
42
|
const outDir = (0, utils_1.localizePath)({
|
|
43
|
-
path: path_1.default.resolve(siteDir,
|
|
43
|
+
path: path_1.default.resolve(siteDir, baseOutDir),
|
|
44
44
|
i18n,
|
|
45
45
|
options,
|
|
46
46
|
pathType: 'fs',
|
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-4944",
|
|
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-
|
|
45
|
-
"@docusaurus/logger": "0.0.0-
|
|
46
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
44
|
+
"@docusaurus/cssnano-preset": "0.0.0-4944",
|
|
45
|
+
"@docusaurus/logger": "0.0.0-4944",
|
|
46
|
+
"@docusaurus/mdx-loader": "0.0.0-4944",
|
|
47
47
|
"@docusaurus/react-loadable": "5.5.2",
|
|
48
|
-
"@docusaurus/utils": "0.0.0-
|
|
49
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
50
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
48
|
+
"@docusaurus/utils": "0.0.0-4944",
|
|
49
|
+
"@docusaurus/utils-common": "0.0.0-4944",
|
|
50
|
+
"@docusaurus/utils-validation": "0.0.0-4944",
|
|
51
51
|
"@slorber/static-site-generator-webpack-plugin": "^4.0.4",
|
|
52
52
|
"@svgr/webpack": "^6.2.1",
|
|
53
53
|
"autoprefixer": "^10.4.5",
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"webpackbar": "^5.0.2"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
108
|
-
"@docusaurus/types": "0.0.0-
|
|
107
|
+
"@docusaurus/module-type-aliases": "0.0.0-4944",
|
|
108
|
+
"@docusaurus/types": "0.0.0-4944",
|
|
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": "
|
|
128
|
+
"gitHead": "040fca0321d0539c16b21edc191af3142642b8c0"
|
|
129
129
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import type { HostPortCLIOptions } from '@docusaurus/types';
|
|
8
|
-
export declare function getCLIOptionHost(hostOption: HostPortCLIOptions['host']): string;
|
|
9
|
-
export declare function getCLIOptionPort(portOption: HostPortCLIOptions['port'], host: string): Promise<number | null>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.getCLIOptionPort = exports.getCLIOptionHost = void 0;
|
|
10
|
-
const choosePort_1 = require("../server/choosePort");
|
|
11
|
-
const utils_1 = require("@docusaurus/utils");
|
|
12
|
-
function getCLIOptionHost(hostOption) {
|
|
13
|
-
return hostOption ?? 'localhost';
|
|
14
|
-
}
|
|
15
|
-
exports.getCLIOptionHost = getCLIOptionHost;
|
|
16
|
-
async function getCLIOptionPort(portOption, host) {
|
|
17
|
-
const basePort = portOption ? parseInt(portOption, 10) : utils_1.DEFAULT_PORT;
|
|
18
|
-
return (0, choosePort_1.choosePort)(host, basePort);
|
|
19
|
-
}
|
|
20
|
-
exports.getCLIOptionPort = getCLIOptionPort;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Detects if program is running on port, and prompts user to choose another if
|
|
9
|
-
* port is already being used. This feature was heavily inspired by
|
|
10
|
-
* create-react-app and uses many of the same utility functions to implement it.
|
|
11
|
-
*/
|
|
12
|
-
export declare function choosePort(host: string, defaultPort: number): Promise<number | null>;
|