@nestjs/cli 12.0.0-alpha.4 → 12.0.0-alpha.5

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.
package/bin/nest.js CHANGED
@@ -1,21 +1,18 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from 'module';
3
- import { fileURLToPath } from 'url';
4
- import { dirname } from 'path';
5
2
  import { Command } from 'commander';
3
+ import { createRequire } from 'module';
6
4
  import { CommandLoader } from '../commands/index.js';
7
5
  import { loadLocalBinCommandLoader, localBinExists, } from '../lib/utils/local-binaries.js';
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = dirname(__filename);
10
6
  const require = createRequire(import.meta.url);
11
7
  const bootstrap = async () => {
12
8
  const program = new Command();
9
+ program.__nestCliEsm = true;
13
10
  program
14
11
  .version(require('../package.json').version, '-v, --version', 'Output the current version.')
15
12
  .usage('<command> [options]')
16
13
  .helpOption('-h, --help', 'Output usage information.');
17
14
  if (localBinExists()) {
18
- const localCommandLoader = loadLocalBinCommandLoader();
15
+ const localCommandLoader = await loadLocalBinCommandLoader();
19
16
  await localCommandLoader.load(program);
20
17
  }
21
18
  else {
@@ -9,6 +9,13 @@ import { NewCommand } from './new.command.js';
9
9
  import { StartCommand } from './start.command.js';
10
10
  export class CommandLoader {
11
11
  static async load(program) {
12
+ if (!program.__nestCliEsm) {
13
+ console.error(`\n${ERROR_PREFIX} The globally installed ${red('@nestjs/cli')} is outdated and ` +
14
+ 'incompatible with the local version (which requires ESM).\n' +
15
+ 'Please upgrade your global installation:\n\n' +
16
+ ` ${red('npm i -g @nestjs/cli')}\n`);
17
+ process.exit(1);
18
+ }
12
19
  new NewCommand(new NewAction()).load(program);
13
20
  new BuildCommand(new BuildAction()).load(program);
14
21
  new StartCommand(new StartAction()).load(program);
@@ -1,3 +1,3 @@
1
1
  import { CommandLoader } from '../../commands/index.js';
2
2
  export declare function localBinExists(): boolean;
3
- export declare function loadLocalBinCommandLoader(): typeof CommandLoader;
3
+ export declare function loadLocalBinCommandLoader(): Promise<typeof CommandLoader>;
@@ -1,12 +1,12 @@
1
1
  import { existsSync } from 'fs';
2
- import { createRequire } from 'module';
3
- import { join, posix } from 'path';
4
- const require = createRequire(import.meta.url);
2
+ import { join } from 'path';
3
+ import { pathToFileURL } from 'url';
5
4
  const localBinPathSegments = [process.cwd(), 'node_modules', '@nestjs', 'cli'];
6
5
  export function localBinExists() {
7
6
  return existsSync(join(...localBinPathSegments));
8
7
  }
9
- export function loadLocalBinCommandLoader() {
10
- const commandsFile = require(posix.join(...localBinPathSegments, 'commands'));
8
+ export async function loadLocalBinCommandLoader() {
9
+ const commandsPath = join(...localBinPathSegments, 'commands', 'index.js');
10
+ const commandsFile = await import(pathToFileURL(commandsPath).href);
11
11
  return commandsFile.CommandLoader;
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/cli",
3
- "version": "12.0.0-alpha.4",
3
+ "version": "12.0.0-alpha.5",
4
4
  "type": "module",
5
5
  "description": "Nest - modern, fast, powerful node.js web framework (@cli)",
6
6
  "publishConfig": {
@@ -40,13 +40,13 @@
40
40
  },
41
41
  "homepage": "https://github.com/nestjs/nest-cli#readme",
42
42
  "dependencies": {
43
- "@angular-devkit/core": "21.2.0",
44
- "@angular-devkit/schematics": "21.2.0",
45
- "@angular-devkit/schematics-cli": "21.2.0",
43
+ "@angular-devkit/core": "21.2.1",
44
+ "@angular-devkit/schematics": "21.2.1",
45
+ "@angular-devkit/schematics-cli": "21.2.1",
46
46
  "@inquirer/prompts": "8.3.0",
47
47
  "@nestjs/schematics": "^12.0.0-alpha.0",
48
48
  "ansis": "4.2.0",
49
- "chokidar": "4.0.3",
49
+ "chokidar": "5.0.0",
50
50
  "cli-table3": "0.6.5",
51
51
  "commander": "14.0.3",
52
52
  "glob": "13.0.6",
@@ -62,10 +62,10 @@
62
62
  "@rspack/core": "^1.7.7",
63
63
  "@swc/cli": "0.8.0",
64
64
  "@swc/core": "1.15.18",
65
- "@types/node": "24.10.13",
65
+ "@types/node": "25.3.5",
66
66
  "@types/webpack-node-externals": "3.0.4",
67
67
  "delete-empty": "3.0.0",
68
- "eslint": "10.0.2",
68
+ "eslint": "10.0.3",
69
69
  "eslint-config-prettier": "10.1.8",
70
70
  "fork-ts-checker-webpack-plugin": "9.1.0",
71
71
  "gulp": "5.0.1",
@@ -77,7 +77,7 @@
77
77
  "ts-loader": "9.5.4",
78
78
  "tsconfig-paths-webpack-plugin": "4.2.0",
79
79
  "typescript-eslint": "8.56.1",
80
- "vitest": "3.2.4",
80
+ "vitest": "4.0.18",
81
81
  "webpack": "5.105.4",
82
82
  "webpack-node-externals": "3.0.0"
83
83
  },
@@ -85,13 +85,13 @@
85
85
  "**/*.{ts,json}": []
86
86
  },
87
87
  "peerDependencies": {
88
- "@rspack/core": "^1.0.0",
89
- "@swc/cli": "^0.1.62 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0",
90
- "@swc/core": "^1.3.62",
91
- "fork-ts-checker-webpack-plugin": "^9.0.0",
92
- "ts-loader": "^9.0.0",
93
- "tsconfig-paths-webpack-plugin": "^4.0.0",
94
- "webpack": "^5.0.0",
88
+ "@rspack/core": "^1.7.7",
89
+ "@swc/cli": "^0.8.0",
90
+ "@swc/core": "^1.15.18",
91
+ "fork-ts-checker-webpack-plugin": "^9.1.0",
92
+ "ts-loader": "^9.5.4",
93
+ "tsconfig-paths-webpack-plugin": "^4.2.0",
94
+ "webpack": "^5.105.4",
95
95
  "webpack-node-externals": "^3.0.0"
96
96
  },
97
97
  "peerDependenciesMeta": {