@nestjs/cli 10.4.0 → 10.4.2

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.
@@ -16,6 +16,7 @@ const configuration_1 = require("../lib/configuration");
16
16
  const defaults_1 = require("../lib/configuration/defaults");
17
17
  const readers_1 = require("../lib/readers");
18
18
  const ui_1 = require("../lib/ui");
19
+ const is_module_available_1 = require("../lib/utils/is-module-available");
19
20
  const abstract_action_1 = require("./abstract.action");
20
21
  class BuildAction extends abstract_action_1.AbstractAction {
21
22
  constructor() {
@@ -108,15 +109,11 @@ class BuildAction extends abstract_action_1.AbstractAction {
108
109
  }
109
110
  getWebpackConfigFactoryByPath(webpackPath, defaultPath) {
110
111
  const pathToWebpackFile = (0, path_1.join)(process.cwd(), webpackPath);
111
- try {
112
- return require(pathToWebpackFile);
113
- }
114
- catch (err) {
115
- if (webpackPath !== defaultPath) {
116
- throw err;
117
- }
112
+ const isWebpackFileAvailable = (0, is_module_available_1.isModuleAvailable)(pathToWebpackFile);
113
+ if (!isWebpackFileAvailable && webpackPath === defaultPath) {
118
114
  return ({}) => ({});
119
115
  }
116
+ return require(pathToWebpackFile);
120
117
  }
121
118
  }
122
119
  exports.BuildAction = BuildAction;
@@ -4,5 +4,4 @@ export declare class StartAction extends BuildAction {
4
4
  handle(commandInputs: Input[], commandOptions: Input[]): Promise<void>;
5
5
  createOnSuccessHook(entryFile: string, sourceRoot: string, debugFlag: boolean | string | undefined, outDirName: string, binaryToRun: string): () => void;
6
6
  private spawnChildProcess;
7
- private getSourceMapSupportPkg;
8
7
  }
@@ -89,22 +89,11 @@ class StartAction extends build_action_1.BuildAction {
89
89
  const inspectFlag = typeof debug === 'string' ? `--inspect=${debug}` : '--inspect';
90
90
  processArgs.unshift(inspectFlag);
91
91
  }
92
- const sourceMapsRegisterPath = this.getSourceMapSupportPkg();
93
- if (sourceMapsRegisterPath !== undefined) {
94
- processArgs.unshift(`-r "${sourceMapsRegisterPath}"`);
95
- }
92
+ processArgs.unshift('--enable-source-maps');
96
93
  return (0, child_process_1.spawn)(binaryToRun, processArgs, {
97
94
  stdio: 'inherit',
98
95
  shell: true,
99
96
  });
100
97
  }
101
- getSourceMapSupportPkg() {
102
- try {
103
- return require.resolve('source-map-support/register');
104
- }
105
- catch {
106
- return undefined;
107
- }
108
- }
109
98
  }
110
99
  exports.StartAction = StartAction;
@@ -45,7 +45,9 @@ class AssetsManager {
45
45
  let includePath = typeof item === 'string' ? item : item.include;
46
46
  let excludePath = typeof item !== 'string' && item.exclude ? item.exclude : undefined;
47
47
  includePath = (0, path_1.join)(sourceRoot, includePath).replace(/\\/g, '/');
48
- excludePath = excludePath ? (0, path_1.join)(sourceRoot, excludePath).replace(/\\/g, '/') : undefined;
48
+ excludePath = excludePath
49
+ ? (0, path_1.join)(sourceRoot, excludePath).replace(/\\/g, '/')
50
+ : undefined;
49
51
  return {
50
52
  outDir: typeof item !== 'string' ? item.outDir || outDir : outDir,
51
53
  glob: includePath,
@@ -122,7 +122,7 @@ class SwcCompiler extends base_compiler_1.BaseCompiler {
122
122
  }
123
123
  catch (err) {
124
124
  console.error(ui_1.ERROR_PREFIX +
125
- ' Failed to load "@swc/cli" and "@swc/core" packages. Please, install them by running "npm i -D @swc/cli @swc/core".');
125
+ ' Failed to load "@swc/cli" and/or "@swc/core" required packages. Please, make sure to install them as development dependencies.');
126
126
  process.exit(1);
127
127
  }
128
128
  }
@@ -0,0 +1 @@
1
+ export declare function isModuleAvailable(path: string): boolean;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isModuleAvailable = void 0;
4
+ function isModuleAvailable(path) {
5
+ try {
6
+ require.resolve(path);
7
+ return true;
8
+ }
9
+ catch {
10
+ return false;
11
+ }
12
+ }
13
+ exports.isModuleAvailable = isModuleAvailable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/cli",
3
- "version": "10.4.0",
3
+ "version": "10.4.2",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@cli)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -51,7 +51,6 @@
51
51
  "inquirer": "8.2.6",
52
52
  "node-emoji": "1.11.0",
53
53
  "ora": "5.4.1",
54
- "source-map-support": "0.5.21",
55
54
  "tree-kill": "1.2.2",
56
55
  "tsconfig-paths": "4.2.0",
57
56
  "tsconfig-paths-webpack-plugin": "4.1.0",
@@ -63,14 +62,14 @@
63
62
  "@commitlint/cli": "19.3.0",
64
63
  "@commitlint/config-angular": "19.3.0",
65
64
  "@swc/cli": "0.4.0",
66
- "@swc/core": "1.6.6",
65
+ "@swc/core": "1.6.7",
67
66
  "@types/inquirer": "9.0.3",
68
67
  "@types/jest": "29.5.12",
69
68
  "@types/node": "20.14.9",
70
69
  "@types/node-emoji": "1.8.2",
71
70
  "@types/webpack-node-externals": "3.0.4",
72
- "@typescript-eslint/eslint-plugin": "7.10.0",
73
- "@typescript-eslint/parser": "7.10.0",
71
+ "@typescript-eslint/eslint-plugin": "7.15.0",
72
+ "@typescript-eslint/parser": "7.15.0",
74
73
  "delete-empty": "3.0.0",
75
74
  "eslint": "8.57.0",
76
75
  "eslint-config-prettier": "9.1.0",
@@ -82,7 +81,8 @@
82
81
  "prettier": "3.3.2",
83
82
  "release-it": "17.4.1",
84
83
  "ts-jest": "29.1.5",
85
- "ts-loader": "9.5.1"
84
+ "ts-loader": "9.5.1",
85
+ "ts-node": "10.9.2"
86
86
  },
87
87
  "lint-staged": {
88
88
  "**/*.{ts,json}": []