@docusaurus/core 4.0.0-canary-6820 → 4.0.0-canary-6821

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.
@@ -4,14 +4,13 @@
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 CommanderStatic } from 'commander';
8
- type CLIProgram = CommanderStatic;
7
+ import { Command } from 'commander';
9
8
  type CLIArgs = [string, string, ...string[]];
10
9
  export declare function runCLI(cliArgs: CLIArgs): Promise<void>;
11
10
  export declare function createCLIProgram({ cli, cliArgs, siteDir, config, }: {
12
- cli: CLIProgram;
11
+ cli: Command;
13
12
  cliArgs: CLIArgs;
14
13
  siteDir: string;
15
14
  config: string | undefined;
16
- }): Promise<CLIProgram>;
15
+ }): Promise<Command>;
17
16
  export {};
@@ -8,9 +8,8 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.runCLI = runCLI;
10
10
  exports.createCLIProgram = createCLIProgram;
11
- const tslib_1 = require("tslib");
12
11
  const logger_1 = require("@docusaurus/logger");
13
- const commander_1 = tslib_1.__importDefault(require("commander"));
12
+ const commander_1 = require("commander");
14
13
  const utils_1 = require("@docusaurus/utils");
15
14
  const build_1 = require("./build/build");
16
15
  const clear_1 = require("./clear");
@@ -48,7 +47,7 @@ const DEFAULT_SITE_DIR = process.env.DOCUSAURUS_CLI_SITE_DIR ?? '.';
48
47
  const DEFAULT_CONFIG = process.env.DOCUSAURUS_CLI_CONFIG ?? undefined;
49
48
  async function runCLI(cliArgs) {
50
49
  const program = await createCLIProgram({
51
- cli: commander_1.default,
50
+ cli: new commander_1.Command(),
52
51
  cliArgs,
53
52
  siteDir: DEFAULT_SITE_DIR,
54
53
  config: DEFAULT_CONFIG,
@@ -57,6 +56,11 @@ async function runCLI(cliArgs) {
57
56
  }
58
57
  async function createCLIProgram({ cli, cliArgs, siteDir, config, }) {
59
58
  const command = cliArgs[2];
59
+ // Preserve Commander 5 behavior for plugins using extendCli: options remain
60
+ // properties of the command passed to action handlers, and commands may read
61
+ // undeclared positional arguments from command.args. Subcommands created with
62
+ // .command() inherit these settings, including nested plugin commands.
63
+ cli.storeOptionsAsProperties(true).allowExcessArguments(true);
60
64
  cli.version(utils_1.DOCUSAURUS_VERSION).usage('<command> [options]');
61
65
  cli
62
66
  .command('build [siteDir]')
@@ -143,7 +147,7 @@ async function createCLIProgram({ cli, cliArgs, siteDir, config, }) {
143
147
  .option('--overwrite', 'overwrite existing heading IDs, re-generate them from the heading text (default: false)')
144
148
  .option('--maintain-case', "keep the headings' casing, otherwise make all lowercase (default: false)")
145
149
  .action(writeHeadingIds_1.writeHeadingIds);
146
- cli.arguments('<command>').action((cmd) => {
150
+ cli.arguments('[command]').action((cmd) => {
147
151
  cli.outputHelp();
148
152
  if (!cmd) {
149
153
  throw new Error(logger_1.logger.interpolate `Missing Docusaurus CLI command.`);
@@ -4,9 +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 { CommanderStatic } from 'commander';
7
+ import type { Command } from 'commander';
8
8
  export declare function externalCommand({ cli, siteDir: siteDirInput, config, }: {
9
- cli: CommanderStatic;
9
+ cli: Command;
10
10
  siteDir: string;
11
11
  config: string | undefined;
12
12
  }): Promise<void>;
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": "4.0.0-canary-6820",
4
+ "version": "4.0.0-canary-6821",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -33,18 +33,18 @@
33
33
  "url": "https://github.com/facebook/docusaurus/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@docusaurus/babel": "4.0.0-canary-6820",
37
- "@docusaurus/bundler": "4.0.0-canary-6820",
38
- "@docusaurus/logger": "4.0.0-canary-6820",
39
- "@docusaurus/mdx-loader": "4.0.0-canary-6820",
40
- "@docusaurus/utils": "4.0.0-canary-6820",
41
- "@docusaurus/utils-common": "4.0.0-canary-6820",
42
- "@docusaurus/utils-validation": "4.0.0-canary-6820",
36
+ "@docusaurus/babel": "4.0.0-canary-6821",
37
+ "@docusaurus/bundler": "4.0.0-canary-6821",
38
+ "@docusaurus/logger": "4.0.0-canary-6821",
39
+ "@docusaurus/mdx-loader": "4.0.0-canary-6821",
40
+ "@docusaurus/utils": "4.0.0-canary-6821",
41
+ "@docusaurus/utils-common": "4.0.0-canary-6821",
42
+ "@docusaurus/utils-validation": "4.0.0-canary-6821",
43
43
  "boxen": "^6.2.1",
44
44
  "chokidar": "^3.6.0",
45
45
  "cli-table3": "^0.6.5",
46
46
  "combine-promises": "^1.2.0",
47
- "commander": "^5.1.0",
47
+ "commander": "^15.0.0",
48
48
  "core-js": "^3.50.0",
49
49
  "detect-port": "^2.1.0",
50
50
  "escape-html": "^1.0.3",
@@ -76,8 +76,8 @@
76
76
  "webpack-merge": "^6.0.1"
77
77
  },
78
78
  "devDependencies": {
79
- "@docusaurus/module-type-aliases": "4.0.0-canary-6820",
80
- "@docusaurus/types": "4.0.0-canary-6820",
79
+ "@docusaurus/module-type-aliases": "4.0.0-canary-6821",
80
+ "@docusaurus/types": "4.0.0-canary-6821",
81
81
  "@total-typescript/shoehorn": "^0.1.2",
82
82
  "@types/escape-html": "^1.0.4",
83
83
  "@types/history": "^4.7.11",
@@ -91,7 +91,7 @@
91
91
  "tree-node-cli": "^3.0.0"
92
92
  },
93
93
  "peerDependencies": {
94
- "@docusaurus/faster": "4.0.0-canary-6820",
94
+ "@docusaurus/faster": "4.0.0-canary-6821",
95
95
  "@mdx-js/react": "^3.1.1",
96
96
  "react": "^19.3.0",
97
97
  "react-dom": "^19.3.0"
@@ -104,5 +104,5 @@
104
104
  "engines": {
105
105
  "node": ">=26.9"
106
106
  },
107
- "gitHead": "548b203e01abc1df60907285520e3b000a9af3eb"
107
+ "gitHead": "9391ea0602707f2012a14a4dfd56f813413f5332"
108
108
  }