@docusaurus/core 0.0.0-4614 → 0.0.0-4615
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.js +2 -3
- package/lib/server/i18n.d.ts +0 -1
- package/lib/server/i18n.js +8 -14
- package/package.json +10 -10
package/lib/commands/build.js
CHANGED
|
@@ -75,6 +75,7 @@ forceTerminate = true) {
|
|
|
75
75
|
}
|
|
76
76
|
exports.default = build;
|
|
77
77
|
async function buildLocale({ siteDir, locale, cliOptions, forceTerminate, isLastLocale, }) {
|
|
78
|
+
var _a;
|
|
78
79
|
process.env.BABEL_ENV = 'production';
|
|
79
80
|
process.env.NODE_ENV = 'production';
|
|
80
81
|
logger_1.default.info `name=${`[${locale}]`} Creating an optimized production build...`;
|
|
@@ -141,9 +142,7 @@ async function buildLocale({ siteDir, locale, cliOptions, forceTerminate, isLast
|
|
|
141
142
|
// Run webpack to build JS bundle (client) and static html files (server).
|
|
142
143
|
await (0, utils_1.compile)([clientConfig, serverConfig]);
|
|
143
144
|
// Remove server.bundle.js because it is not needed.
|
|
144
|
-
if (serverConfig.output
|
|
145
|
-
serverConfig.output.filename &&
|
|
146
|
-
typeof serverConfig.output.filename === 'string') {
|
|
145
|
+
if (typeof ((_a = serverConfig.output) === null || _a === void 0 ? void 0 : _a.filename) === 'string') {
|
|
147
146
|
const serverBundle = path_1.default.join(outDir, serverConfig.output.filename);
|
|
148
147
|
if (await fs_extra_1.default.pathExists(serverBundle)) {
|
|
149
148
|
await fs_extra_1.default.unlink(serverBundle);
|
package/lib/server/i18n.d.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { I18n, DocusaurusConfig, I18nLocaleConfig } from '@docusaurus/types';
|
|
8
8
|
export declare function getDefaultLocaleConfig(locale: string): I18nLocaleConfig;
|
|
9
|
-
export declare function shouldWarnAboutNodeVersion(version: number, locales: string[]): boolean;
|
|
10
9
|
export declare function loadI18n(config: DocusaurusConfig, options?: {
|
|
11
10
|
locale?: string;
|
|
12
11
|
}): Promise<I18n>;
|
package/lib/server/i18n.js
CHANGED
|
@@ -6,7 +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.localizePath = exports.loadI18n = exports.
|
|
9
|
+
exports.localizePath = exports.loadI18n = exports.getDefaultLocaleConfig = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
12
12
|
const utils_1 = require("@docusaurus/utils");
|
|
@@ -24,12 +24,6 @@ function getDefaultLocaleConfig(locale) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
exports.getDefaultLocaleConfig = getDefaultLocaleConfig;
|
|
27
|
-
function shouldWarnAboutNodeVersion(version, locales) {
|
|
28
|
-
const isOnlyEnglish = locales.length === 1 && locales.includes('en');
|
|
29
|
-
const isOlderNodeVersion = version < 14;
|
|
30
|
-
return isOlderNodeVersion && !isOnlyEnglish;
|
|
31
|
-
}
|
|
32
|
-
exports.shouldWarnAboutNodeVersion = shouldWarnAboutNodeVersion;
|
|
33
27
|
async function loadI18n(config, options = {}) {
|
|
34
28
|
var _a;
|
|
35
29
|
const { i18n: i18nConfig } = config;
|
|
@@ -57,20 +51,20 @@ Note: Docusaurus only support running one locale at a time.`;
|
|
|
57
51
|
}
|
|
58
52
|
exports.loadI18n = loadI18n;
|
|
59
53
|
function localizePath({ pathType, path: originalPath, i18n, options = {}, }) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
var _a;
|
|
55
|
+
const shouldLocalizePath =
|
|
56
|
+
// By default, we don't localize the path of defaultLocale
|
|
57
|
+
(_a = options.localizePath) !== null && _a !== void 0 ? _a : i18n.currentLocale !== i18n.defaultLocale;
|
|
64
58
|
if (!shouldLocalizePath) {
|
|
65
59
|
return originalPath;
|
|
66
60
|
}
|
|
67
61
|
// FS paths need special care, for Windows support
|
|
68
62
|
if (pathType === 'fs') {
|
|
69
|
-
return path_1.default.join(originalPath,
|
|
63
|
+
return path_1.default.join(originalPath, i18n.currentLocale);
|
|
70
64
|
}
|
|
71
|
-
// Url paths
|
|
65
|
+
// Url paths; add a trailing slash so it's a valid base URL
|
|
72
66
|
if (pathType === 'url') {
|
|
73
|
-
return (0, utils_1.normalizeUrl)([originalPath,
|
|
67
|
+
return (0, utils_1.normalizeUrl)([originalPath, i18n.currentLocale, '/']);
|
|
74
68
|
}
|
|
75
69
|
// should never happen
|
|
76
70
|
throw new Error(`Unhandled path type "${pathType}".`);
|
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-4615",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"@babel/runtime": "^7.17.2",
|
|
42
42
|
"@babel/runtime-corejs3": "^7.17.2",
|
|
43
43
|
"@babel/traverse": "^7.17.3",
|
|
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-4615",
|
|
45
|
+
"@docusaurus/logger": "0.0.0-4615",
|
|
46
|
+
"@docusaurus/mdx-loader": "0.0.0-4615",
|
|
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-4615",
|
|
49
|
+
"@docusaurus/utils-common": "0.0.0-4615",
|
|
50
|
+
"@docusaurus/utils-validation": "0.0.0-4615",
|
|
51
51
|
"@slorber/static-site-generator-webpack-plugin": "^4.0.1",
|
|
52
52
|
"@svgr/webpack": "^6.2.1",
|
|
53
53
|
"autoprefixer": "^10.4.2",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"webpackbar": "^5.0.2"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
109
|
-
"@docusaurus/types": "0.0.0-
|
|
108
|
+
"@docusaurus/module-type-aliases": "0.0.0-4615",
|
|
109
|
+
"@docusaurus/types": "0.0.0-4615",
|
|
110
110
|
"@types/detect-port": "^1.3.2",
|
|
111
111
|
"@types/nprogress": "^0.2.0",
|
|
112
112
|
"@types/react-dom": "^17.0.11",
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"engines": {
|
|
127
127
|
"node": ">=14"
|
|
128
128
|
},
|
|
129
|
-
"gitHead": "
|
|
129
|
+
"gitHead": "02bd619fc85e38d320177f4d96f39864109300c8"
|
|
130
130
|
}
|