@docusaurus/core 0.0.0-5776 → 0.0.0-5781

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.
@@ -218,6 +218,9 @@ cli.arguments('<command>').action((cmd) => {
218
218
  logger.error` Unknown command name=${cmd}.`;
219
219
  });
220
220
 
221
+ // === The above is the commander configuration ===
222
+ // They don't start any code execution yet until cli.parse() is called below
223
+
221
224
  /**
222
225
  * @param {string | undefined} command
223
226
  */
@@ -237,12 +240,29 @@ function isInternalCommand(command) {
237
240
  );
238
241
  }
239
242
 
240
- if (!isInternalCommand(process.argv.slice(2)[0])) {
241
- await externalCommand(cli);
242
- }
243
+ // process.argv always looks like this:
244
+ // [
245
+ // '/path/to/node',
246
+ // '/path/to/docusaurus.mjs',
247
+ // '<subcommand>',
248
+ // ...subcommandArgs
249
+ // ]
243
250
 
244
- if (!process.argv.slice(2).length) {
251
+ // There is no subcommand
252
+ // TODO: can we use commander to handle this case?
253
+ if (process.argv.length < 3 || process.argv[2]?.startsWith('--')) {
245
254
  cli.outputHelp();
255
+ process.exit(1);
256
+ }
257
+
258
+ // There is an unrecognized subcommand
259
+ // Let plugins extend the CLI before parsing
260
+ if (!isInternalCommand(process.argv[2])) {
261
+ // TODO: in this step, we must assume default site structure because there's
262
+ // no way to know the siteDir/config yet. Maybe the root cli should be
263
+ // responsible for parsing these arguments?
264
+ // https://github.com/facebook/docusaurus/issues/8903
265
+ await externalCommand(cli);
246
266
  }
247
267
 
248
268
  cli.parse(process.argv);
@@ -5,8 +5,9 @@
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 { DocusaurusConfig, I18nConfig } from '@docusaurus/types';
8
+ import type { DocusaurusConfig, I18nConfig, MarkdownConfig } from '@docusaurus/types';
9
9
  export declare const DEFAULT_I18N_CONFIG: I18nConfig;
10
+ export declare const DEFAULT_MARKDOWN_CONFIG: MarkdownConfig;
10
11
  export declare const DEFAULT_CONFIG: Pick<DocusaurusConfig, 'i18n' | 'onBrokenLinks' | 'onBrokenMarkdownLinks' | 'onDuplicateRoutes' | 'plugins' | 'themes' | 'presets' | 'headTags' | 'stylesheets' | 'scripts' | 'clientModules' | 'customFields' | 'themeConfig' | 'titleDelimiter' | 'noIndex' | 'tagline' | 'baseUrlIssueBanner' | 'staticDirectories' | 'markdown'>;
11
12
  export declare const ConfigSchema: Joi.ObjectSchema<DocusaurusConfig>;
12
13
  export declare function validateConfig(config: unknown, siteConfigPath: string): DocusaurusConfig;
@@ -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.validateConfig = exports.ConfigSchema = exports.DEFAULT_CONFIG = exports.DEFAULT_I18N_CONFIG = void 0;
9
+ exports.validateConfig = exports.ConfigSchema = exports.DEFAULT_CONFIG = exports.DEFAULT_MARKDOWN_CONFIG = exports.DEFAULT_I18N_CONFIG = void 0;
10
10
  const utils_1 = require("@docusaurus/utils");
11
11
  const utils_validation_1 = require("@docusaurus/utils-validation");
12
12
  const DEFAULT_I18N_LOCALE = 'en';
@@ -16,6 +16,17 @@ exports.DEFAULT_I18N_CONFIG = {
16
16
  locales: [DEFAULT_I18N_LOCALE],
17
17
  localeConfigs: {},
18
18
  };
19
+ exports.DEFAULT_MARKDOWN_CONFIG = {
20
+ format: 'mdx',
21
+ mermaid: false,
22
+ preprocessor: undefined,
23
+ parseFrontMatter: utils_1.DEFAULT_PARSE_FRONT_MATTER,
24
+ mdx1Compat: {
25
+ comments: true,
26
+ admonitions: true,
27
+ headingIds: true,
28
+ },
29
+ };
19
30
  exports.DEFAULT_CONFIG = {
20
31
  i18n: exports.DEFAULT_I18N_CONFIG,
21
32
  onBrokenLinks: 'throw',
@@ -35,16 +46,7 @@ exports.DEFAULT_CONFIG = {
35
46
  tagline: '',
36
47
  baseUrlIssueBanner: true,
37
48
  staticDirectories: [utils_1.DEFAULT_STATIC_DIR_NAME],
38
- markdown: {
39
- format: 'mdx',
40
- mermaid: false,
41
- preprocessor: undefined,
42
- mdx1Compat: {
43
- comments: true,
44
- admonitions: true,
45
- headingIds: true,
46
- },
47
- },
49
+ markdown: exports.DEFAULT_MARKDOWN_CONFIG,
48
50
  };
49
51
  function createPluginSchema(theme) {
50
52
  return (utils_validation_1.Joi.alternatives()
@@ -214,6 +216,7 @@ exports.ConfigSchema = utils_validation_1.Joi.object({
214
216
  format: utils_validation_1.Joi.string()
215
217
  .equal('mdx', 'md', 'detect')
216
218
  .default(exports.DEFAULT_CONFIG.markdown.format),
219
+ parseFrontMatter: utils_validation_1.Joi.function().default(() => exports.DEFAULT_CONFIG.markdown.parseFrontMatter),
217
220
  mermaid: utils_validation_1.Joi.boolean().default(exports.DEFAULT_CONFIG.markdown.mermaid),
218
221
  preprocessor: utils_validation_1.Joi.function()
219
222
  .arity(1)
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-5776",
4
+ "version": "0.0.0-5781",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -43,13 +43,13 @@
43
43
  "@babel/runtime": "^7.22.6",
44
44
  "@babel/runtime-corejs3": "^7.22.6",
45
45
  "@babel/traverse": "^7.22.8",
46
- "@docusaurus/cssnano-preset": "0.0.0-5776",
47
- "@docusaurus/logger": "0.0.0-5776",
48
- "@docusaurus/mdx-loader": "0.0.0-5776",
46
+ "@docusaurus/cssnano-preset": "0.0.0-5781",
47
+ "@docusaurus/logger": "0.0.0-5781",
48
+ "@docusaurus/mdx-loader": "0.0.0-5781",
49
49
  "@docusaurus/react-loadable": "5.5.2",
50
- "@docusaurus/utils": "0.0.0-5776",
51
- "@docusaurus/utils-common": "0.0.0-5776",
52
- "@docusaurus/utils-validation": "0.0.0-5776",
50
+ "@docusaurus/utils": "0.0.0-5781",
51
+ "@docusaurus/utils-common": "0.0.0-5781",
52
+ "@docusaurus/utils-validation": "0.0.0-5781",
53
53
  "@slorber/static-site-generator-webpack-plugin": "^4.0.7",
54
54
  "@svgr/webpack": "^6.5.1",
55
55
  "autoprefixer": "^10.4.14",
@@ -104,8 +104,8 @@
104
104
  "webpackbar": "^5.0.2"
105
105
  },
106
106
  "devDependencies": {
107
- "@docusaurus/module-type-aliases": "0.0.0-5776",
108
- "@docusaurus/types": "0.0.0-5776",
107
+ "@docusaurus/module-type-aliases": "0.0.0-5781",
108
+ "@docusaurus/types": "0.0.0-5781",
109
109
  "@types/detect-port": "^1.3.3",
110
110
  "@types/react-dom": "^18.2.7",
111
111
  "@types/react-router-config": "^5.0.7",
@@ -124,5 +124,5 @@
124
124
  "engines": {
125
125
  "node": ">=18.0"
126
126
  },
127
- "gitHead": "651d33bcb60ba72ed7455d217aaa290797b6d8fb"
127
+ "gitHead": "18240ff945c64b1e9efb1bb390b7ab748452c5ce"
128
128
  }