@docusaurus/core 3.9.2-canary-6437 → 3.9.2-canary-6439

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.
@@ -54,7 +54,7 @@ async function getLocalesToBuild({ siteDir, cliOptions, }) {
54
54
  customConfigFilePath: cliOptions.config,
55
55
  });
56
56
  const locales = cliOptions.locale ??
57
- (0, i18n_1.loadI18nLocaleList)({
57
+ (0, i18n_1.getLocaleList)({
58
58
  i18nConfig: siteConfig.i18n,
59
59
  currentLocale: siteConfig.i18n.defaultLocale, // Awkward but ok
60
60
  });
@@ -22,6 +22,7 @@ const ssgExecutor_1 = require("../../ssg/ssgExecutor");
22
22
  const clearPath_1 = tslib_1.__importDefault(require("../utils/clearPath"));
23
23
  const buildUtils_1 = require("./buildUtils");
24
24
  const SkipBundling = process.env.DOCUSAURUS_SKIP_BUNDLING === 'true';
25
+ const ReturnAfterLoading = process.env.DOCUSAURUS_RETURN_AFTER_LOADING === 'true';
25
26
  const ExitAfterLoading = process.env.DOCUSAURUS_EXIT_AFTER_LOADING === 'true';
26
27
  const ExitAfterBundling = process.env.DOCUSAURUS_EXIT_AFTER_BUNDLING === 'true';
27
28
  async function buildLocale({ siteDir, locale, cliOptions, }) {
@@ -37,6 +38,9 @@ async function buildLocale({ siteDir, locale, cliOptions, }) {
37
38
  locale,
38
39
  automaticBaseUrlLocalizationDisabled: (0, buildUtils_1.isAutomaticBaseUrlLocalizationDisabled)(cliOptions),
39
40
  }));
41
+ if (ReturnAfterLoading) {
42
+ return;
43
+ }
40
44
  if (ExitAfterLoading) {
41
45
  return process.exit(0);
42
46
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Joi } from '@docusaurus/utils-validation';
8
- import type { FasterConfig, FutureConfig, FutureV4Config, StorageConfig, DocusaurusConfig, I18nConfig, MarkdownConfig, MarkdownHooks } from '@docusaurus/types';
8
+ import type { DocusaurusConfig, FasterConfig, FutureConfig, FutureV4Config, I18nConfig, MarkdownConfig, MarkdownHooks, StorageConfig } from '@docusaurus/types';
9
9
  export declare const DEFAULT_I18N_CONFIG: I18nConfig;
10
10
  export declare const DEFAULT_STORAGE_CONFIG: StorageConfig;
11
11
  export declare const DEFAULT_FASTER_CONFIG: FasterConfig;
@@ -55,6 +55,7 @@ exports.DEFAULT_FASTER_CONFIG = {
55
55
  rspackBundler: false,
56
56
  rspackPersistentCache: false,
57
57
  ssgWorkerThreads: false,
58
+ gitEagerVcs: false,
58
59
  };
59
60
  // When using the "faster: true" shortcut
60
61
  exports.DEFAULT_FASTER_CONFIG_TRUE = {
@@ -66,6 +67,7 @@ exports.DEFAULT_FASTER_CONFIG_TRUE = {
66
67
  rspackBundler: true,
67
68
  rspackPersistentCache: true,
68
69
  ssgWorkerThreads: true,
70
+ gitEagerVcs: true,
69
71
  };
70
72
  exports.DEFAULT_FUTURE_V4_CONFIG = {
71
73
  removeLegacyPostBuildHeadAttribute: false,
@@ -80,6 +82,7 @@ exports.DEFAULT_FUTURE_CONFIG = {
80
82
  v4: exports.DEFAULT_FUTURE_V4_CONFIG,
81
83
  experimental_faster: exports.DEFAULT_FASTER_CONFIG,
82
84
  experimental_storage: exports.DEFAULT_STORAGE_CONFIG,
85
+ experimental_vcs: (0, utils_1.getVcsPreset)('default-v1'),
83
86
  experimental_router: 'browser',
84
87
  };
85
88
  exports.DEFAULT_MARKDOWN_HOOKS = {
@@ -204,6 +207,7 @@ const FASTER_CONFIG_SCHEMA = utils_validation_1.Joi.alternatives()
204
207
  rspackBundler: utils_validation_1.Joi.boolean().default(exports.DEFAULT_FASTER_CONFIG.rspackBundler),
205
208
  rspackPersistentCache: utils_validation_1.Joi.boolean().default(exports.DEFAULT_FASTER_CONFIG.rspackPersistentCache),
206
209
  ssgWorkerThreads: utils_validation_1.Joi.boolean().default(exports.DEFAULT_FASTER_CONFIG.ssgWorkerThreads),
210
+ gitEagerVcs: utils_validation_1.Joi.boolean().default(exports.DEFAULT_FASTER_CONFIG.gitEagerVcs),
207
211
  }), utils_validation_1.Joi.boolean()
208
212
  .required()
209
213
  .custom((bool) => bool ? exports.DEFAULT_FASTER_CONFIG_TRUE : exports.DEFAULT_FASTER_CONFIG))
@@ -228,10 +232,39 @@ const STORAGE_CONFIG_SCHEMA = utils_validation_1.Joi.object({
228
232
  })
229
233
  .optional()
230
234
  .default(exports.DEFAULT_STORAGE_CONFIG);
235
+ const VCS_CONFIG_OBJECT_SCHEMA = utils_validation_1.Joi.object({
236
+ // All the fields are required on purpose
237
+ // You either provide a full VCS config or nothing
238
+ initialize: utils_validation_1.Joi.function().maxArity(1).required(),
239
+ getFileCreationInfo: utils_validation_1.Joi.function().arity(1).required(),
240
+ getFileLastUpdateInfo: utils_validation_1.Joi.function().arity(1).required(),
241
+ });
242
+ const VCS_CONFIG_SCHEMA = utils_validation_1.Joi.custom((input) => {
243
+ if (typeof input === 'string') {
244
+ const presetName = input;
245
+ if (!utils_1.VcsPresetNames.includes(presetName)) {
246
+ throw new Error(`VCS config preset name '${input}' is not valid.`);
247
+ }
248
+ return (0, utils_1.getVcsPreset)(presetName);
249
+ }
250
+ if (typeof input === 'boolean') {
251
+ // We return the boolean on purpose
252
+ // We'll normalize it to a real VcsConfig later
253
+ // This is annoying, but we have to read the future flag to switch to the
254
+ // new "default-v2" config (not easy to do it here)
255
+ return input;
256
+ }
257
+ const { error, value } = VCS_CONFIG_OBJECT_SCHEMA.validate(input);
258
+ if (error) {
259
+ throw error;
260
+ }
261
+ return value;
262
+ }).default(true);
231
263
  const FUTURE_CONFIG_SCHEMA = utils_validation_1.Joi.object({
232
264
  v4: FUTURE_V4_SCHEMA,
233
265
  experimental_faster: FASTER_CONFIG_SCHEMA,
234
266
  experimental_storage: STORAGE_CONFIG_SCHEMA,
267
+ experimental_vcs: VCS_CONFIG_SCHEMA,
235
268
  experimental_router: utils_validation_1.Joi.string()
236
269
  .equal('browser', 'hash')
237
270
  .default(exports.DEFAULT_FUTURE_CONFIG.experimental_router),
@@ -364,6 +397,15 @@ Please migrate and move this option to code=${'siteConfig.markdown.hooks.onBroke
364
397
  // We erase the former one to ensure we don't use it anywhere
365
398
  config.onBrokenMarkdownLinks = undefined;
366
399
  }
400
+ // We normalize the VCS config when using a boolean value
401
+ if (typeof config.future.experimental_vcs === 'boolean') {
402
+ const vcsConfig = config.future.experimental_vcs
403
+ ? config.future.experimental_faster.gitEagerVcs
404
+ ? (0, utils_1.getVcsPreset)('default-v2')
405
+ : (0, utils_1.getVcsPreset)('default-v1')
406
+ : (0, utils_1.getVcsPreset)('disabled');
407
+ config.future.experimental_vcs = vcsConfig;
408
+ }
367
409
  if (config.future.experimental_faster.ssgWorkerThreads &&
368
410
  !config.future.v4.removeLegacyPostBuildHeadAttribute) {
369
411
  throw new Error(`Docusaurus config ${logger_1.default.code('future.experimental_faster.ssgWorkerThreads')} requires the future flag ${logger_1.default.code('future.v4.removeLegacyPostBuildHeadAttribute')} to be turned on.
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { I18n, DocusaurusConfig, I18nLocaleConfig, I18nConfig } from '@docusaurus/types';
8
8
  export declare function getDefaultLocaleConfig(locale: string): Omit<I18nLocaleConfig, 'translate' | 'url' | 'baseUrl'>;
9
- export declare function loadI18nLocaleList({ i18nConfig, currentLocale, }: {
9
+ export declare function getLocaleList({ i18nConfig, currentLocale, }: {
10
10
  i18nConfig: I18nConfig;
11
11
  currentLocale: string;
12
12
  }): [string, ...string[]];
@@ -7,7 +7,7 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.getDefaultLocaleConfig = getDefaultLocaleConfig;
10
- exports.loadI18nLocaleList = loadI18nLocaleList;
10
+ exports.getLocaleList = getLocaleList;
11
11
  exports.loadI18n = loadI18n;
12
12
  const tslib_1 = require("tslib");
13
13
  const path_1 = tslib_1.__importDefault(require("path"));
@@ -87,7 +87,7 @@ function getDefaultLocaleConfig(locale) {
87
87
  Make sure it is a valid BCP 47 locale name (e.g. en, fr, fr-FR, etc.) and/or provide a valid BCP 47 ${logger_1.default.code(`siteConfig.i18n.localeConfig['${locale}'].htmlLang`)} attribute.`, { cause: e });
88
88
  }
89
89
  }
90
- function loadI18nLocaleList({ i18nConfig, currentLocale, }) {
90
+ function getLocaleList({ i18nConfig, currentLocale, }) {
91
91
  if (!i18nConfig.locales.includes(currentLocale)) {
92
92
  logger_1.default.warn `The locale name=${currentLocale} was not found in your Docusaurus site configuration.
93
93
  We recommend adding the name=${currentLocale} to your site i18n config, but we will still try to run your site.
@@ -98,7 +98,7 @@ Declared site config locales are: ${i18nConfig.locales}`;
98
98
  }
99
99
  async function loadI18n({ siteDir, config, currentLocale, automaticBaseUrlLocalizationDisabled, }) {
100
100
  const { i18n: i18nConfig } = config;
101
- const locales = loadI18nLocaleList({
101
+ const locales = getLocaleList({
102
102
  i18nConfig,
103
103
  currentLocale,
104
104
  });
@@ -43,6 +43,14 @@ async function loadContext(params) {
43
43
  customConfigFilePath,
44
44
  }),
45
45
  });
46
+ // Not sure where is the best place to put this VCS initialization call?
47
+ // The sooner is probably the better
48
+ // Note: we don't await the result on purpose!
49
+ // VCS initialization can be slow for large repos, and we don't want to block
50
+ // VCS integrations should be carefully designed to avoid blocking
51
+ logger_1.PerfLogger.async('VCS init', () => {
52
+ return initialSiteConfig.future.experimental_vcs.initialize({ siteDir });
53
+ });
46
54
  const currentBundler = await (0, bundler_1.getCurrentBundler)({
47
55
  siteConfig: initialSiteConfig,
48
56
  });
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": "3.9.2-canary-6437",
4
+ "version": "3.9.2-canary-6439",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -33,13 +33,13 @@
33
33
  "url": "https://github.com/facebook/docusaurus/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@docusaurus/babel": "3.9.2-canary-6437",
37
- "@docusaurus/bundler": "3.9.2-canary-6437",
38
- "@docusaurus/logger": "3.9.2-canary-6437",
39
- "@docusaurus/mdx-loader": "3.9.2-canary-6437",
40
- "@docusaurus/utils": "3.9.2-canary-6437",
41
- "@docusaurus/utils-common": "3.9.2-canary-6437",
42
- "@docusaurus/utils-validation": "3.9.2-canary-6437",
36
+ "@docusaurus/babel": "3.9.2-canary-6439",
37
+ "@docusaurus/bundler": "3.9.2-canary-6439",
38
+ "@docusaurus/logger": "3.9.2-canary-6439",
39
+ "@docusaurus/mdx-loader": "3.9.2-canary-6439",
40
+ "@docusaurus/utils": "3.9.2-canary-6439",
41
+ "@docusaurus/utils-common": "3.9.2-canary-6439",
42
+ "@docusaurus/utils-validation": "3.9.2-canary-6439",
43
43
  "boxen": "^6.2.1",
44
44
  "chalk": "^4.1.2",
45
45
  "chokidar": "^3.5.3",
@@ -51,7 +51,7 @@
51
51
  "escape-html": "^1.0.3",
52
52
  "eta": "^2.2.0",
53
53
  "eval": "^0.1.8",
54
- "execa": "5.1.1",
54
+ "execa": "^5.1.1",
55
55
  "fs-extra": "^11.1.1",
56
56
  "html-tags": "^3.3.1",
57
57
  "html-webpack-plugin": "^5.6.0",
@@ -77,8 +77,8 @@
77
77
  "webpack-merge": "^6.0.1"
78
78
  },
79
79
  "devDependencies": {
80
- "@docusaurus/module-type-aliases": "3.9.2-canary-6437",
81
- "@docusaurus/types": "3.9.2-canary-6437",
80
+ "@docusaurus/module-type-aliases": "3.9.2-canary-6439",
81
+ "@docusaurus/types": "3.9.2-canary-6439",
82
82
  "@total-typescript/shoehorn": "^0.1.2",
83
83
  "@types/detect-port": "^1.3.3",
84
84
  "@types/react-dom": "^18.2.7",
@@ -98,5 +98,5 @@
98
98
  "engines": {
99
99
  "node": ">=20.0"
100
100
  },
101
- "gitHead": "c36f3ac2e06fc332b02fc2feaae5011d1a51ac87"
101
+ "gitHead": "67795b9b8e2c6d94284ae736bb0d974a2cf2000b"
102
102
  }