@nestjs/cli 10.4.1 → 10.4.3
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/actions/build.action.js +4 -7
- package/actions/start.action.d.ts +0 -1
- package/actions/start.action.js +1 -12
- package/lib/compiler/assets-manager.js +14 -2
- package/lib/compiler/helpers/copy-path-resolve.js +2 -2
- package/lib/utils/is-module-available.d.ts +1 -0
- package/lib/utils/is-module-available.js +13 -0
- package/package.json +17 -17
package/actions/build.action.js
CHANGED
|
@@ -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
|
-
|
|
112
|
-
|
|
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
|
}
|
package/actions/start.action.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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,
|
|
@@ -73,7 +75,17 @@ class AssetsManager {
|
|
|
73
75
|
this.watchers.push(watcher);
|
|
74
76
|
}
|
|
75
77
|
else {
|
|
76
|
-
const
|
|
78
|
+
const matchedPaths = (0, glob_1.sync)(item.glob, { ignore: item.exclude });
|
|
79
|
+
const files = item.glob.endsWith('*')
|
|
80
|
+
? matchedPaths.filter((matched) => (0, fs_1.statSync)(matched).isFile())
|
|
81
|
+
: matchedPaths.flatMap((matched) => {
|
|
82
|
+
if ((0, fs_1.statSync)(matched).isDirectory()) {
|
|
83
|
+
return (0, glob_1.sync)(`${matched}/**/*`, {
|
|
84
|
+
ignore: item.exclude,
|
|
85
|
+
}).filter((file) => (0, fs_1.statSync)(file).isFile());
|
|
86
|
+
}
|
|
87
|
+
return matched;
|
|
88
|
+
});
|
|
77
89
|
for (const path of files) {
|
|
78
90
|
this.actionOnFile({ ...option, path, action: 'change' });
|
|
79
91
|
}
|
|
@@ -16,8 +16,8 @@ function dealWith(inPath, up) {
|
|
|
16
16
|
if (!up) {
|
|
17
17
|
return inPath;
|
|
18
18
|
}
|
|
19
|
-
if (depth(inPath) < up) {
|
|
20
|
-
throw new Error('
|
|
19
|
+
if (depth(inPath) < up - 1) {
|
|
20
|
+
throw new Error('Path outside of project folder is not allowed');
|
|
21
21
|
}
|
|
22
22
|
return path.join(...path.normalize(inPath).split(path.sep).slice(up));
|
|
23
23
|
}
|
|
@@ -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.
|
|
3
|
+
"version": "10.4.3",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@cli)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -51,38 +51,38 @@
|
|
|
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",
|
|
58
|
-
"typescript": "5.
|
|
59
|
-
"webpack": "5.
|
|
57
|
+
"typescript": "5.3.3",
|
|
58
|
+
"webpack": "5.93.0",
|
|
60
59
|
"webpack-node-externals": "3.0.0"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
|
-
"@commitlint/cli": "19.
|
|
62
|
+
"@commitlint/cli": "19.4.0",
|
|
64
63
|
"@commitlint/config-angular": "19.3.0",
|
|
65
64
|
"@swc/cli": "0.4.0",
|
|
66
|
-
"@swc/core": "1.
|
|
67
|
-
"@types/inquirer": "9.0.
|
|
65
|
+
"@swc/core": "1.7.6",
|
|
66
|
+
"@types/inquirer": "9.0.7",
|
|
68
67
|
"@types/jest": "29.5.12",
|
|
69
|
-
"@types/node": "20.14.
|
|
68
|
+
"@types/node": "20.14.14",
|
|
70
69
|
"@types/node-emoji": "1.8.2",
|
|
71
70
|
"@types/webpack-node-externals": "3.0.4",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "
|
|
73
|
-
"@typescript-eslint/parser": "
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "8.0.1",
|
|
72
|
+
"@typescript-eslint/parser": "8.0.1",
|
|
74
73
|
"delete-empty": "3.0.0",
|
|
75
|
-
"eslint": "8.
|
|
74
|
+
"eslint": "9.8.0",
|
|
76
75
|
"eslint-config-prettier": "9.1.0",
|
|
77
76
|
"gulp": "5.0.0",
|
|
78
77
|
"gulp-clean": "0.4.0",
|
|
79
|
-
"husky": "9.
|
|
78
|
+
"husky": "9.1.4",
|
|
80
79
|
"jest": "29.7.0",
|
|
81
|
-
"lint-staged": "15.2.
|
|
82
|
-
"prettier": "3.3.
|
|
83
|
-
"release-it": "17.
|
|
84
|
-
"ts-jest": "29.
|
|
85
|
-
"ts-loader": "9.5.1"
|
|
80
|
+
"lint-staged": "15.2.8",
|
|
81
|
+
"prettier": "3.3.3",
|
|
82
|
+
"release-it": "17.6.0",
|
|
83
|
+
"ts-jest": "29.2.3",
|
|
84
|
+
"ts-loader": "9.5.1",
|
|
85
|
+
"ts-node": "10.9.2"
|
|
86
86
|
},
|
|
87
87
|
"lint-staged": {
|
|
88
88
|
"**/*.{ts,json}": []
|