@nestjs/cli 11.0.16 → 12.0.0-alpha.1

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.
Files changed (184) hide show
  1. package/actions/abstract.action.d.ts +1 -2
  2. package/actions/abstract.action.js +1 -5
  3. package/actions/add.action.d.ts +3 -4
  4. package/actions/add.action.js +38 -52
  5. package/actions/build.action.d.ts +11 -10
  6. package/actions/build.action.js +85 -72
  7. package/actions/generate.action.d.ts +3 -3
  8. package/actions/generate.action.js +56 -59
  9. package/actions/index.d.ts +7 -7
  10. package/actions/index.js +7 -23
  11. package/actions/info.action.d.ts +12 -28
  12. package/actions/info.action.js +47 -55
  13. package/actions/new.action.d.ts +3 -3
  14. package/actions/new.action.js +75 -105
  15. package/actions/start.action.d.ts +4 -7
  16. package/actions/start.action.js +36 -46
  17. package/bin/nest.js +14 -10
  18. package/commands/abstract.command.d.ts +3 -3
  19. package/commands/abstract.command.js +2 -5
  20. package/commands/add.command.d.ts +3 -3
  21. package/commands/add.command.js +13 -20
  22. package/commands/build.command.d.ts +3 -3
  23. package/commands/build.command.js +25 -54
  24. package/commands/command.input.js +1 -2
  25. package/commands/command.loader.d.ts +2 -2
  26. package/commands/command.loader.js +18 -22
  27. package/commands/context/add.context.d.ts +7 -0
  28. package/commands/context/add.context.js +1 -0
  29. package/commands/context/build.context.d.ts +13 -0
  30. package/commands/context/build.context.js +1 -0
  31. package/commands/context/generate.context.d.ts +15 -0
  32. package/commands/context/generate.context.js +1 -0
  33. package/commands/context/index.d.ts +5 -0
  34. package/commands/context/index.js +5 -0
  35. package/commands/context/new.context.d.ts +11 -0
  36. package/commands/context/new.context.js +1 -0
  37. package/commands/context/start.context.d.ts +19 -0
  38. package/commands/context/start.context.js +1 -0
  39. package/commands/generate.command.d.ts +3 -3
  40. package/commands/generate.command.js +26 -54
  41. package/commands/index.d.ts +3 -2
  42. package/commands/index.js +3 -18
  43. package/commands/info.command.d.ts +3 -3
  44. package/commands/info.command.js +2 -6
  45. package/commands/new.command.d.ts +3 -3
  46. package/commands/new.command.js +24 -33
  47. package/commands/start.command.d.ts +3 -3
  48. package/commands/start.command.js +34 -71
  49. package/lib/compiler/assets-manager.d.ts +1 -1
  50. package/lib/compiler/assets-manager.js +27 -33
  51. package/lib/compiler/base-compiler.d.ts +5 -5
  52. package/lib/compiler/base-compiler.js +10 -13
  53. package/lib/compiler/compiler.d.ts +6 -6
  54. package/lib/compiler/compiler.js +7 -9
  55. package/lib/compiler/defaults/rspack-defaults.d.ts +2 -0
  56. package/lib/compiler/defaults/rspack-defaults.js +138 -0
  57. package/lib/compiler/defaults/swc-defaults.d.ts +1 -1
  58. package/lib/compiler/defaults/swc-defaults.js +1 -5
  59. package/lib/compiler/defaults/webpack-defaults.d.ts +3 -3
  60. package/lib/compiler/defaults/webpack-defaults.js +36 -18
  61. package/lib/compiler/helpers/append-extension.js +3 -6
  62. package/lib/compiler/helpers/copy-path-resolve.js +2 -5
  63. package/lib/compiler/helpers/delete-out-dir.d.ts +1 -1
  64. package/lib/compiler/helpers/delete-out-dir.js +5 -8
  65. package/lib/compiler/helpers/get-builder.d.ts +9 -7
  66. package/lib/compiler/helpers/get-builder.js +3 -6
  67. package/lib/compiler/helpers/get-rspack-config-path.d.ts +9 -0
  68. package/lib/compiler/helpers/get-rspack-config-path.js +15 -0
  69. package/lib/compiler/helpers/get-tsc-config.path.d.ts +2 -3
  70. package/lib/compiler/helpers/get-tsc-config.path.js +6 -9
  71. package/lib/compiler/helpers/get-value-or-default.d.ts +2 -3
  72. package/lib/compiler/helpers/get-value-or-default.js +3 -8
  73. package/lib/compiler/helpers/get-webpack-config-path.d.ts +2 -3
  74. package/lib/compiler/helpers/get-webpack-config-path.js +4 -7
  75. package/lib/compiler/helpers/manual-restart.js +4 -8
  76. package/lib/compiler/helpers/tsconfig-provider.d.ts +1 -1
  77. package/lib/compiler/helpers/tsconfig-provider.js +8 -11
  78. package/lib/compiler/hooks/tsconfig-paths.hook.js +13 -13
  79. package/lib/compiler/interfaces/readonly-visitor.interface.js +1 -2
  80. package/lib/compiler/plugins/plugin-metadata-generator.d.ts +1 -1
  81. package/lib/compiler/plugins/plugin-metadata-generator.js +10 -13
  82. package/lib/compiler/plugins/plugin-metadata-printer.d.ts +1 -1
  83. package/lib/compiler/plugins/plugin-metadata-printer.js +5 -9
  84. package/lib/compiler/plugins/plugins-loader.d.ts +2 -2
  85. package/lib/compiler/plugins/plugins-loader.js +13 -13
  86. package/lib/compiler/rspack-compiler.d.ts +19 -0
  87. package/lib/compiler/rspack-compiler.js +105 -0
  88. package/lib/compiler/swc/constants.d.ts +0 -1
  89. package/lib/compiler/swc/constants.js +9 -13
  90. package/lib/compiler/swc/forked-type-checker.js +13 -18
  91. package/lib/compiler/swc/swc-compiler.d.ts +4 -4
  92. package/lib/compiler/swc/swc-compiler.js +41 -39
  93. package/lib/compiler/swc/type-checker-host.js +12 -18
  94. package/lib/compiler/typescript-loader.js +5 -7
  95. package/lib/compiler/watch-compiler.d.ts +5 -5
  96. package/lib/compiler/watch-compiler.js +14 -18
  97. package/lib/compiler/webpack-compiler.d.ts +6 -7
  98. package/lib/compiler/webpack-compiler.js +30 -22
  99. package/lib/configuration/configuration.d.ts +9 -4
  100. package/lib/configuration/configuration.js +1 -2
  101. package/lib/configuration/configuration.loader.d.ts +1 -1
  102. package/lib/configuration/configuration.loader.js +1 -2
  103. package/lib/configuration/defaults.d.ts +2 -1
  104. package/lib/configuration/defaults.js +8 -10
  105. package/lib/configuration/index.d.ts +3 -3
  106. package/lib/configuration/index.js +3 -19
  107. package/lib/configuration/nest-configuration.loader.d.ts +3 -3
  108. package/lib/configuration/nest-configuration.loader.js +11 -20
  109. package/lib/package-managers/abstract.package-manager.d.ts +4 -4
  110. package/lib/package-managers/abstract.package-manager.js +19 -30
  111. package/lib/package-managers/index.d.ts +8 -8
  112. package/lib/package-managers/index.js +8 -24
  113. package/lib/package-managers/npm.package-manager.d.ts +2 -2
  114. package/lib/package-managers/npm.package-manager.js +6 -10
  115. package/lib/package-managers/package-manager-commands.js +1 -2
  116. package/lib/package-managers/package-manager.factory.d.ts +2 -2
  117. package/lib/package-managers/package-manager.factory.js +16 -20
  118. package/lib/package-managers/package-manager.js +2 -5
  119. package/lib/package-managers/pnpm.package-manager.d.ts +2 -2
  120. package/lib/package-managers/pnpm.package-manager.js +6 -10
  121. package/lib/package-managers/project.dependency.js +1 -2
  122. package/lib/package-managers/yarn.package-manager.d.ts +2 -2
  123. package/lib/package-managers/yarn.package-manager.js +6 -10
  124. package/lib/questions/questions.d.ts +5 -1
  125. package/lib/questions/questions.js +2 -7
  126. package/lib/readers/file-system.reader.d.ts +1 -1
  127. package/lib/readers/file-system.reader.js +6 -9
  128. package/lib/readers/index.d.ts +2 -2
  129. package/lib/readers/index.js +2 -18
  130. package/lib/readers/reader.js +3 -5
  131. package/lib/runners/abstract.runner.js +10 -12
  132. package/lib/runners/git.runner.d.ts +1 -1
  133. package/lib/runners/git.runner.js +2 -6
  134. package/lib/runners/index.d.ts +3 -3
  135. package/lib/runners/index.js +3 -19
  136. package/lib/runners/npm.runner.d.ts +1 -1
  137. package/lib/runners/npm.runner.js +2 -6
  138. package/lib/runners/pnpm.runner.d.ts +1 -1
  139. package/lib/runners/pnpm.runner.js +2 -6
  140. package/lib/runners/runner.factory.d.ts +6 -6
  141. package/lib/runners/runner.factory.js +15 -20
  142. package/lib/runners/runner.js +2 -5
  143. package/lib/runners/schematic.runner.d.ts +1 -1
  144. package/lib/runners/schematic.runner.js +5 -7
  145. package/lib/runners/yarn.runner.d.ts +1 -1
  146. package/lib/runners/yarn.runner.js +2 -6
  147. package/lib/schematics/abstract.collection.d.ts +3 -3
  148. package/lib/schematics/abstract.collection.js +3 -5
  149. package/lib/schematics/collection.factory.d.ts +2 -2
  150. package/lib/schematics/collection.factory.js +9 -13
  151. package/lib/schematics/collection.js +2 -5
  152. package/lib/schematics/custom.collection.d.ts +2 -2
  153. package/lib/schematics/custom.collection.js +4 -8
  154. package/lib/schematics/index.d.ts +4 -4
  155. package/lib/schematics/index.js +4 -20
  156. package/lib/schematics/nest.collection.d.ts +3 -3
  157. package/lib/schematics/nest.collection.js +104 -108
  158. package/lib/schematics/schematic.option.js +7 -9
  159. package/lib/ui/banner.js +1 -4
  160. package/lib/ui/emojis.d.ts +17 -17
  161. package/lib/ui/emojis.js +19 -22
  162. package/lib/ui/errors.js +1 -5
  163. package/lib/ui/index.d.ts +5 -5
  164. package/lib/ui/index.js +5 -21
  165. package/lib/ui/messages.js +15 -19
  166. package/lib/ui/prefixes.js +3 -6
  167. package/lib/utils/formatting.js +1 -4
  168. package/lib/utils/get-default-tsconfig-path.js +4 -7
  169. package/lib/utils/gracefully-exit-on-prompt-error.js +1 -4
  170. package/lib/utils/is-esm-project.d.ts +5 -0
  171. package/lib/utils/is-esm-project.js +16 -0
  172. package/lib/utils/is-module-available.js +3 -4
  173. package/lib/utils/load-configuration.d.ts +1 -1
  174. package/lib/utils/load-configuration.js +4 -7
  175. package/lib/utils/local-binaries.d.ts +1 -1
  176. package/lib/utils/local-binaries.js +8 -11
  177. package/lib/utils/os-info.utils.js +1 -4
  178. package/lib/utils/project-utils.d.ts +1 -3
  179. package/lib/utils/project-utils.js +16 -28
  180. package/lib/utils/remaining-flags.d.ts +2 -2
  181. package/lib/utils/remaining-flags.js +2 -5
  182. package/lib/utils/tree-kill.js +7 -10
  183. package/lib/utils/type-assertions.js +1 -4
  184. package/package.json +59 -38
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultTsconfigPath = getDefaultTsconfigPath;
4
- const fs = require("fs");
5
- const path_1 = require("path");
1
+ import * as fs from 'fs';
2
+ import { join } from 'path';
6
3
  const TSCONFIG_BUILD_JSON = 'tsconfig.build.json';
7
4
  const TSCONFIG_JSON = 'tsconfig.json';
8
- function getDefaultTsconfigPath() {
9
- return fs.existsSync((0, path_1.join)(process.cwd(), TSCONFIG_BUILD_JSON))
5
+ export function getDefaultTsconfigPath() {
6
+ return fs.existsSync(join(process.cwd(), TSCONFIG_BUILD_JSON))
10
7
  ? TSCONFIG_BUILD_JSON
11
8
  : TSCONFIG_JSON;
12
9
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gracefullyExitOnPromptError = gracefullyExitOnPromptError;
4
- function gracefullyExitOnPromptError(err) {
1
+ export function gracefullyExitOnPromptError(err) {
5
2
  if (err.name === 'ExitPromptError') {
6
3
  process.exit(1);
7
4
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Detect whether the target project uses ESM output.
3
+ * Checks the project's package.json for `"type": "module"`.
4
+ */
5
+ export declare function isEsmProject(cwd?: string): boolean;
@@ -0,0 +1,16 @@
1
+ import { readFileSync } from 'fs';
2
+ import { join } from 'path';
3
+ /**
4
+ * Detect whether the target project uses ESM output.
5
+ * Checks the project's package.json for `"type": "module"`.
6
+ */
7
+ export function isEsmProject(cwd = process.cwd()) {
8
+ try {
9
+ const raw = readFileSync(join(cwd, 'package.json'), 'utf-8');
10
+ const pkg = JSON.parse(raw);
11
+ return pkg.type === 'module';
12
+ }
13
+ catch {
14
+ return false;
15
+ }
16
+ }
@@ -1,7 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isModuleAvailable = isModuleAvailable;
4
- function isModuleAvailable(path) {
1
+ import { createRequire } from 'module';
2
+ const require = createRequire(import.meta.url);
3
+ export function isModuleAvailable(path) {
5
4
  try {
6
5
  require.resolve(path);
7
6
  return true;
@@ -1,2 +1,2 @@
1
- import { Configuration } from '../configuration';
1
+ import { Configuration } from '../configuration/index.js';
2
2
  export declare function loadConfiguration(): Promise<Required<Configuration>>;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadConfiguration = loadConfiguration;
4
- const nest_configuration_loader_1 = require("../configuration/nest-configuration.loader");
5
- const readers_1 = require("../readers");
6
- async function loadConfiguration() {
7
- const loader = new nest_configuration_loader_1.NestConfigurationLoader(new readers_1.FileSystemReader(process.cwd()));
1
+ import { NestConfigurationLoader } from '../configuration/nest-configuration.loader.js';
2
+ import { FileSystemReader } from '../readers/index.js';
3
+ export async function loadConfiguration() {
4
+ const loader = new NestConfigurationLoader(new FileSystemReader(process.cwd()));
8
5
  return loader.load();
9
6
  }
@@ -1,3 +1,3 @@
1
- import { CommandLoader } from '../../commands';
1
+ import { CommandLoader } from '../../commands/index.js';
2
2
  export declare function localBinExists(): boolean;
3
3
  export declare function loadLocalBinCommandLoader(): typeof CommandLoader;
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.localBinExists = localBinExists;
4
- exports.loadLocalBinCommandLoader = loadLocalBinCommandLoader;
5
- const fs_1 = require("fs");
6
- const path_1 = require("path");
1
+ import { existsSync } from 'fs';
2
+ import { createRequire } from 'module';
3
+ import { join, posix } from 'path';
4
+ const require = createRequire(import.meta.url);
7
5
  const localBinPathSegments = [process.cwd(), 'node_modules', '@nestjs', 'cli'];
8
- function localBinExists() {
9
- return (0, fs_1.existsSync)((0, path_1.join)(...localBinPathSegments));
6
+ export function localBinExists() {
7
+ return existsSync(join(...localBinPathSegments));
10
8
  }
11
- function loadLocalBinCommandLoader() {
12
- // eslint-disable-next-line @typescript-eslint/no-var-requires
13
- const commandsFile = require(path_1.posix.join(...localBinPathSegments, 'commands'));
9
+ export function loadLocalBinCommandLoader() {
10
+ const commandsFile = require(posix.join(...localBinPathSegments, 'commands'));
14
11
  return commandsFile.CommandLoader;
15
12
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = osName;
4
- function osName(platform, release) {
1
+ export default function osName(platform, release) {
5
2
  switch (platform) {
6
3
  case 'darwin':
7
4
  return Number(release.split('.')[0]) > 15 ? 'macOS' : 'OS X';
@@ -1,5 +1,4 @@
1
- import { Input } from '../../commands';
2
- import { Configuration, ProjectConfiguration } from '../configuration';
1
+ import { Configuration, ProjectConfiguration } from '../configuration/index.js';
3
2
  export declare function shouldAskForProject(schematic: string, configurationProjects: {
4
3
  [key: string]: ProjectConfiguration;
5
4
  }, appName: string): boolean;
@@ -8,4 +7,3 @@ export declare function shouldGenerateFlat(configuration: Required<Configuration
8
7
  export declare function getSpecFileSuffix(configuration: Required<Configuration>, appName: string, specFileSuffixValue: string): string;
9
8
  export declare function askForProjectName(promptQuestion: string, projects: string[]): Promise<string | void>;
10
9
  export declare function moveDefaultProjectToStart(configuration: Configuration, defaultProjectName: string, defaultLabel: string): string[];
11
- export declare function hasValidOptionFlag(queriedOptionName: string, options: Input[], queriedValue?: string | number | boolean): boolean;
@@ -1,28 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shouldAskForProject = shouldAskForProject;
4
- exports.shouldGenerateSpec = shouldGenerateSpec;
5
- exports.shouldGenerateFlat = shouldGenerateFlat;
6
- exports.getSpecFileSuffix = getSpecFileSuffix;
7
- exports.askForProjectName = askForProjectName;
8
- exports.moveDefaultProjectToStart = moveDefaultProjectToStart;
9
- exports.hasValidOptionFlag = hasValidOptionFlag;
10
- const prompts_1 = require("@inquirer/prompts");
11
- const get_value_or_default_1 = require("../compiler/helpers/get-value-or-default");
12
- const questions_1 = require("../questions/questions");
13
- const gracefully_exit_on_prompt_error_1 = require("./gracefully-exit-on-prompt-error");
14
- function shouldAskForProject(schematic, configurationProjects, appName) {
1
+ import { select } from '@inquirer/prompts';
2
+ import { getValueOrDefault } from '../compiler/helpers/get-value-or-default.js';
3
+ import { generateSelect } from '../questions/questions.js';
4
+ import { gracefullyExitOnPromptError } from './gracefully-exit-on-prompt-error.js';
5
+ export function shouldAskForProject(schematic, configurationProjects, appName) {
15
6
  return (['app', 'sub-app', 'library', 'lib'].includes(schematic) === false &&
16
7
  configurationProjects &&
17
8
  Object.entries(configurationProjects).length !== 0 &&
18
9
  !appName);
19
10
  }
20
- function shouldGenerateSpec(configuration, schematic, appName, specValue, specPassedAsInput) {
11
+ export function shouldGenerateSpec(configuration, schematic, appName, specValue, specPassedAsInput) {
21
12
  if (specPassedAsInput === true || specPassedAsInput === undefined) {
22
13
  // CLI parameters has the highest priority
23
14
  return specValue;
24
15
  }
25
- let specConfiguration = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'generateOptions.spec', appName || '');
16
+ let specConfiguration = getValueOrDefault(configuration, 'generateOptions.spec', appName || '');
26
17
  if (typeof specConfiguration === 'boolean') {
27
18
  return specConfiguration;
28
19
  }
@@ -33,7 +24,7 @@ function shouldGenerateSpec(configuration, schematic, appName, specValue, specPa
33
24
  if (typeof specConfiguration === 'object' && appName) {
34
25
  // The appName has a generateOption spec, but not for the schematic trying to generate
35
26
  // Check if the global generateOptions has a spec to use instead
36
- specConfiguration = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'generateOptions.spec', '');
27
+ specConfiguration = getValueOrDefault(configuration, 'generateOptions.spec', '');
37
28
  if (typeof specConfiguration === 'boolean') {
38
29
  return specConfiguration;
39
30
  }
@@ -44,33 +35,33 @@ function shouldGenerateSpec(configuration, schematic, appName, specValue, specPa
44
35
  }
45
36
  return specValue;
46
37
  }
47
- function shouldGenerateFlat(configuration, appName, flatValue) {
38
+ export function shouldGenerateFlat(configuration, appName, flatValue) {
48
39
  // CLI parameters have the highest priority
49
40
  if (flatValue === true) {
50
41
  return flatValue;
51
42
  }
52
- const flatConfiguration = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'generateOptions.flat', appName || '');
43
+ const flatConfiguration = getValueOrDefault(configuration, 'generateOptions.flat', appName || '');
53
44
  if (typeof flatConfiguration === 'boolean') {
54
45
  return flatConfiguration;
55
46
  }
56
47
  return flatValue;
57
48
  }
58
- function getSpecFileSuffix(configuration, appName, specFileSuffixValue) {
49
+ export function getSpecFileSuffix(configuration, appName, specFileSuffixValue) {
59
50
  // CLI parameters have the highest priority
60
51
  if (specFileSuffixValue) {
61
52
  return specFileSuffixValue;
62
53
  }
63
- const specFileSuffixConfiguration = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'generateOptions.specFileSuffix', appName || '', undefined, undefined, 'spec');
54
+ const specFileSuffixConfiguration = getValueOrDefault(configuration, 'generateOptions.specFileSuffix', appName || '', undefined, undefined, 'spec');
64
55
  if (typeof specFileSuffixConfiguration === 'string') {
65
56
  return specFileSuffixConfiguration;
66
57
  }
67
58
  return specFileSuffixValue;
68
59
  }
69
- async function askForProjectName(promptQuestion, projects) {
70
- const projectNameSelect = (0, questions_1.generateSelect)('appName')(promptQuestion)(projects);
71
- return (0, prompts_1.select)(projectNameSelect).catch(gracefully_exit_on_prompt_error_1.gracefullyExitOnPromptError);
60
+ export async function askForProjectName(promptQuestion, projects) {
61
+ const projectNameSelect = generateSelect('appName')(promptQuestion)(projects);
62
+ return select(projectNameSelect).catch(gracefullyExitOnPromptError);
72
63
  }
73
- function moveDefaultProjectToStart(configuration, defaultProjectName, defaultLabel) {
64
+ export function moveDefaultProjectToStart(configuration, defaultProjectName, defaultLabel) {
74
65
  let projects = configuration.projects != null ? Object.keys(configuration.projects) : [];
75
66
  if (configuration.sourceRoot !== 'src') {
76
67
  projects = projects.filter((p) => p !== defaultProjectName.replace(defaultLabel, ''));
@@ -78,6 +69,3 @@ function moveDefaultProjectToStart(configuration, defaultProjectName, defaultLab
78
69
  projects.unshift(defaultProjectName);
79
70
  return projects;
80
71
  }
81
- function hasValidOptionFlag(queriedOptionName, options, queriedValue = true) {
82
- return options.some((option) => option.name === queriedOptionName && option.value === queriedValue);
83
- }
@@ -1,2 +1,2 @@
1
- import { CommanderStatic } from 'commander';
2
- export declare function getRemainingFlags(cli: CommanderStatic): any[];
1
+ import { Command } from 'commander';
2
+ export declare function getRemainingFlags(cli: Command): any[];
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRemainingFlags = getRemainingFlags;
4
- function getRemainingFlags(cli) {
1
+ export function getRemainingFlags(cli) {
5
2
  const rawArgs = [...cli.rawArgs];
6
3
  return rawArgs
7
4
  .splice(Math.max(rawArgs.findIndex((item) => item.startsWith('--')), 0))
@@ -15,7 +12,7 @@ function getRemainingFlags(cli) {
15
12
  const prevKeyRaw = array[index - 1];
16
13
  if (prevKeyRaw) {
17
14
  const previousKey = camelCase(prevKeyRaw.replace(/--/g, '').replace('no', ''));
18
- if (cli[previousKey] === item) {
15
+ if (cli.getOptionValue(previousKey) === item) {
19
16
  return false;
20
17
  }
21
18
  }
@@ -1,21 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.treeKillSync = treeKillSync;
4
- const child_process_1 = require("child_process");
5
- function treeKillSync(pid, signal) {
1
+ import { execSync, spawnSync } from 'child_process';
2
+ export function treeKillSync(pid, signal) {
6
3
  if (process.platform === 'win32') {
7
- (0, child_process_1.execSync)('taskkill /pid ' + pid + ' /T /F');
4
+ execSync('taskkill /pid ' + pid + ' /T /F');
8
5
  return;
9
6
  }
10
- const childs = getAllChilds(pid);
11
- childs.forEach(function (pid) {
7
+ const children = getAllChildren(pid);
8
+ children.forEach(function (pid) {
12
9
  killPid(pid, signal);
13
10
  });
14
11
  killPid(pid, signal);
15
12
  return;
16
13
  }
17
14
  function getAllPid() {
18
- const result = (0, child_process_1.spawnSync)('ps', ['-A', '-o', 'pid,ppid'], {
15
+ const result = spawnSync('ps', ['-A', '-o', 'pid,ppid'], {
19
16
  encoding: 'utf-8',
20
17
  stdio: 'pipe',
21
18
  });
@@ -38,7 +35,7 @@ function getAllPid() {
38
35
  return input != null;
39
36
  });
40
37
  }
41
- function getAllChilds(pid) {
38
+ function getAllChildren(pid) {
42
39
  const allpid = getAllPid();
43
40
  const ppidHash = {};
44
41
  const result = [];
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertNonArray = assertNonArray;
4
- function assertNonArray(value) {
1
+ export function assertNonArray(value) {
5
2
  if (Array.isArray(value)) {
6
3
  throw new TypeError('Expected a non-array value');
7
4
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@nestjs/cli",
3
- "version": "11.0.16",
3
+ "version": "12.0.0-alpha.1",
4
+ "type": "module",
4
5
  "description": "Nest - modern, fast, powerful node.js web framework (@cli)",
5
6
  "publishConfig": {
6
7
  "access": "public"
@@ -15,18 +16,19 @@
15
16
  "build": "tsc",
16
17
  "clean": "gulp clean:bundle",
17
18
  "format": "prettier --write \"**/*.ts\"",
18
- "lint": "eslint '{lib,commands,actions}/**/*.ts' --fix",
19
+ "lint": "eslint 'lib/**/*.ts' 'commands/**/*.ts' 'actions/**/*.ts' --fix",
19
20
  "start": "node bin/nest.js",
20
21
  "prepack": "npm run build",
21
22
  "prepublish:next": "npm run build",
22
23
  "publish:next": "npm publish --access public --tag next",
23
24
  "prepublish:npm": "npm run build",
24
25
  "publish:npm": "npm publish --access public",
25
- "test": "jest --config test/jest-config.json",
26
- "test:dev": "npm run clean && jest --config test/jest-config.json --watchAll",
26
+ "test": "vitest run",
27
+ "test:e2e": "vitest run -c vitest.e2e.config.ts",
28
+ "test:dev": "npm run clean && vitest --watch",
27
29
  "prerelease": "npm run build",
28
30
  "release": "release-it",
29
- "prepare": "husky"
31
+ "prepare": "husky && node tools/postinstall.cjs"
30
32
  },
31
33
  "repository": {
32
34
  "type": "git",
@@ -38,64 +40,83 @@
38
40
  },
39
41
  "homepage": "https://github.com/nestjs/nest-cli#readme",
40
42
  "dependencies": {
41
- "@angular-devkit/core": "19.2.19",
42
- "@angular-devkit/schematics": "19.2.19",
43
- "@angular-devkit/schematics-cli": "19.2.19",
44
- "@inquirer/prompts": "7.10.1",
45
- "@nestjs/schematics": "^11.0.1",
43
+ "@angular-devkit/core": "21.2.0",
44
+ "@angular-devkit/schematics": "21.2.0",
45
+ "@angular-devkit/schematics-cli": "21.2.0",
46
+ "@inquirer/prompts": "8.3.0",
47
+ "@nestjs/schematics": "^12.0.0-alpha.0",
46
48
  "ansis": "4.2.0",
47
49
  "chokidar": "4.0.3",
48
50
  "cli-table3": "0.6.5",
49
- "commander": "4.1.1",
50
- "fork-ts-checker-webpack-plugin": "9.1.0",
51
- "glob": "13.0.0",
52
- "node-emoji": "1.11.0",
53
- "ora": "5.4.1",
51
+ "commander": "14.0.3",
52
+ "glob": "13.0.6",
53
+ "node-emoji": "2.2.0",
54
+ "ora": "9.3.0",
54
55
  "tsconfig-paths": "4.2.0",
55
- "tsconfig-paths-webpack-plugin": "4.2.0",
56
- "typescript": "5.9.3",
57
- "webpack": "5.104.1",
58
- "webpack-node-externals": "3.0.0"
56
+ "typescript": "5.9.3"
59
57
  },
60
58
  "devDependencies": {
61
- "@commitlint/cli": "20.3.1",
62
- "@commitlint/config-angular": "20.3.1",
63
- "@swc/cli": "0.7.10",
64
- "@swc/core": "1.15.8",
65
- "@types/inquirer": "9.0.9",
66
- "@types/jest": "29.5.14",
67
- "@types/node": "24.10.8",
68
- "@types/node-emoji": "1.8.2",
59
+ "@commitlint/cli": "20.4.3",
60
+ "@commitlint/config-angular": "20.4.3",
61
+ "@swc/cli": "0.8.0",
62
+ "@swc/core": "1.15.18",
63
+ "@types/node": "24.10.13",
69
64
  "@types/webpack-node-externals": "3.0.4",
70
- "@typescript-eslint/eslint-plugin": "8.53.0",
71
- "@typescript-eslint/parser": "8.53.0",
65
+ "@eslint/js": "10.0.1",
72
66
  "delete-empty": "3.0.0",
73
- "eslint": "9.39.2",
67
+ "eslint": "10.0.2",
74
68
  "eslint-config-prettier": "10.1.8",
69
+ "typescript-eslint": "8.56.1",
70
+ "fork-ts-checker-webpack-plugin": "9.1.0",
75
71
  "gulp": "5.0.1",
76
72
  "gulp-clean": "0.4.0",
77
73
  "husky": "9.1.7",
78
- "jest": "29.7.0",
79
- "lint-staged": "16.2.7",
80
- "prettier": "3.8.0",
81
- "release-it": "19.2.3",
82
- "ts-jest": "29.4.6",
74
+ "lint-staged": "16.3.2",
75
+ "prettier": "3.8.1",
76
+ "release-it": "19.2.4",
83
77
  "ts-loader": "9.5.4",
84
- "ts-node": "10.9.2"
78
+ "tsconfig-paths-webpack-plugin": "4.2.0",
79
+ "vitest": "3.2.4",
80
+ "webpack": "5.105.4",
81
+ "webpack-node-externals": "3.0.0"
85
82
  },
86
83
  "lint-staged": {
87
84
  "**/*.{ts,json}": []
88
85
  },
89
86
  "peerDependencies": {
90
- "@swc/cli": "^0.1.62 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0",
91
- "@swc/core": "^1.3.62"
87
+ "@rspack/core": "^1.0.0",
88
+ "@swc/cli": "^0.1.62 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0",
89
+ "@swc/core": "^1.3.62",
90
+ "fork-ts-checker-webpack-plugin": "^9.0.0",
91
+ "ts-loader": "^9.0.0",
92
+ "tsconfig-paths-webpack-plugin": "^4.0.0",
93
+ "webpack": "^5.0.0",
94
+ "webpack-node-externals": "^3.0.0"
92
95
  },
93
96
  "peerDependenciesMeta": {
97
+ "@rspack/core": {
98
+ "optional": true
99
+ },
94
100
  "@swc/cli": {
95
101
  "optional": true
96
102
  },
97
103
  "@swc/core": {
98
104
  "optional": true
105
+ },
106
+ "fork-ts-checker-webpack-plugin": {
107
+ "optional": true
108
+ },
109
+ "ts-loader": {
110
+ "optional": true
111
+ },
112
+ "tsconfig-paths-webpack-plugin": {
113
+ "optional": true
114
+ },
115
+ "webpack": {
116
+ "optional": true
117
+ },
118
+ "webpack-node-externals": {
119
+ "optional": true
99
120
  }
100
121
  }
101
122
  }