@docusaurus/core 0.0.0-4611 → 0.0.0-4618

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.
@@ -6,6 +6,6 @@
6
6
  */
7
7
  /// <reference types="@docusaurus/module-type-aliases" />
8
8
  /// <reference types="react" />
9
- import type { HeadProps } from '@docusaurus/Head';
10
- declare function Head(props: HeadProps): JSX.Element;
9
+ import type { Props } from '@docusaurus/Head';
10
+ declare function Head(props: Props): JSX.Element;
11
11
  export default Head;
@@ -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);
@@ -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>;
@@ -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.shouldWarnAboutNodeVersion = exports.getDefaultLocaleConfig = void 0;
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
- const shouldLocalizePath = typeof options.localizePath === 'undefined'
61
- ? // By default, we don't localize the path of defaultLocale
62
- i18n.currentLocale !== i18n.defaultLocale
63
- : options.localizePath;
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, path_1.default.sep, i18n.currentLocale, path_1.default.sep);
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, '/', i18n.currentLocale, '/']);
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-4611",
4
+ "version": "0.0.0-4618",
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-4611",
45
- "@docusaurus/logger": "0.0.0-4611",
46
- "@docusaurus/mdx-loader": "0.0.0-4611",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4618",
45
+ "@docusaurus/logger": "0.0.0-4618",
46
+ "@docusaurus/mdx-loader": "0.0.0-4618",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4611",
49
- "@docusaurus/utils-common": "0.0.0-4611",
50
- "@docusaurus/utils-validation": "0.0.0-4611",
48
+ "@docusaurus/utils": "0.0.0-4618",
49
+ "@docusaurus/utils-common": "0.0.0-4618",
50
+ "@docusaurus/utils-validation": "0.0.0-4618",
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-4611",
109
- "@docusaurus/types": "0.0.0-4611",
108
+ "@docusaurus/module-type-aliases": "0.0.0-4618",
109
+ "@docusaurus/types": "0.0.0-4618",
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": "6a09283902da2fc8e205f36a018b80d8c8140d1f"
129
+ "gitHead": "6de2fcfeb8e5fb2ee2f52363b5575d5d6e24537a"
130
130
  }