@nestjs/cli 9.1.8 → 9.1.9
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.
|
@@ -2,8 +2,11 @@ import { Configuration } from '../configuration';
|
|
|
2
2
|
import { AssetsManager } from './assets-manager';
|
|
3
3
|
import { PluginsLoader } from './plugins-loader';
|
|
4
4
|
import webpack = require('webpack');
|
|
5
|
+
declare type WebpackConfigFactory = (config: webpack.Configuration, webpackRef: typeof webpack) => webpack.Configuration;
|
|
6
|
+
declare type WebpackConfigFactoryOrConfig = WebpackConfigFactory | webpack.Configuration;
|
|
5
7
|
export declare class WebpackCompiler {
|
|
6
8
|
private readonly pluginsLoader;
|
|
7
9
|
constructor(pluginsLoader: PluginsLoader);
|
|
8
|
-
run(configuration: Required<Configuration>, webpackConfigFactoryOrConfig:
|
|
10
|
+
run(configuration: Required<Configuration>, webpackConfigFactoryOrConfig: WebpackConfigFactoryOrConfig | WebpackConfigFactoryOrConfig[], tsConfigPath: string, appName: string, isDebugEnabled: boolean | undefined, watchMode: boolean | undefined, assetsManager: AssetsManager, onSuccess?: () => void): void;
|
|
9
11
|
}
|
|
12
|
+
export {};
|
|
@@ -27,11 +27,29 @@ class WebpackCompiler {
|
|
|
27
27
|
const entryFile = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'entryFile', appName);
|
|
28
28
|
const entryFileRoot = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'root', appName) || '';
|
|
29
29
|
const defaultOptions = (0, webpack_defaults_1.webpackDefaultsFactory)(pathToSource, entryFileRoot, entryFile, isDebugEnabled, tsConfigPath, plugins);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
let compiler;
|
|
31
|
+
let watchOptions;
|
|
32
|
+
let watch;
|
|
33
|
+
if (Array.isArray(webpackConfigFactoryOrConfig)) {
|
|
34
|
+
const webpackConfigurations = webpackConfigFactoryOrConfig.map((configOrFactory) => {
|
|
35
|
+
const unwrappedConfig = typeof configOrFactory !== 'function'
|
|
36
|
+
? configOrFactory
|
|
37
|
+
: configOrFactory(defaultOptions, webpack);
|
|
38
|
+
return Object.assign(Object.assign(Object.assign({}, defaultOptions), { mode: watchMode ? 'development' : defaultOptions.mode }), unwrappedConfig);
|
|
39
|
+
});
|
|
40
|
+
compiler = webpack(webpackConfigurations);
|
|
41
|
+
watchOptions = webpackConfigurations.map((config) => config.watchOptions || {});
|
|
42
|
+
watch = webpackConfigurations.some((config) => config.watch);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const projectWebpackOptions = typeof webpackConfigFactoryOrConfig !== 'function'
|
|
46
|
+
? webpackConfigFactoryOrConfig
|
|
47
|
+
: webpackConfigFactoryOrConfig(defaultOptions, webpack);
|
|
48
|
+
const webpackConfiguration = Object.assign(Object.assign(Object.assign({}, defaultOptions), { mode: watchMode ? 'development' : defaultOptions.mode }), projectWebpackOptions);
|
|
49
|
+
compiler = webpack(webpackConfiguration);
|
|
50
|
+
watchOptions = webpackConfiguration.watchOptions;
|
|
51
|
+
watch = webpackConfiguration.watch;
|
|
52
|
+
}
|
|
35
53
|
const afterCallback = (err, stats) => {
|
|
36
54
|
if (err && stats === undefined) {
|
|
37
55
|
// Could not complete the compilation
|
|
@@ -53,18 +71,18 @@ class WebpackCompiler {
|
|
|
53
71
|
onSuccess();
|
|
54
72
|
}
|
|
55
73
|
}
|
|
56
|
-
else if (!watchMode && !
|
|
74
|
+
else if (!watchMode && !watch) {
|
|
57
75
|
console.log(statsOutput);
|
|
58
76
|
return process.exit(1);
|
|
59
77
|
}
|
|
60
78
|
console.log(statsOutput);
|
|
61
79
|
};
|
|
62
|
-
if (watchMode ||
|
|
80
|
+
if (watchMode || watch) {
|
|
63
81
|
compiler.hooks.watchRun.tapAsync('Rebuild info', (params, callback) => {
|
|
64
82
|
console.log(`\n${ui_1.INFO_PREFIX} Webpack is building your sources...\n`);
|
|
65
83
|
callback();
|
|
66
84
|
});
|
|
67
|
-
compiler.watch(
|
|
85
|
+
compiler.watch(watchOptions || {}, afterCallback);
|
|
68
86
|
}
|
|
69
87
|
else {
|
|
70
88
|
compiler.run(afterCallback);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/cli",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.9",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@cli)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"webpack-node-externals": "3.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@commitlint/cli": "17.
|
|
66
|
-
"@commitlint/config-angular": "17.
|
|
65
|
+
"@commitlint/cli": "17.4.2",
|
|
66
|
+
"@commitlint/config-angular": "17.4.2",
|
|
67
67
|
"@types/copyfiles": "2.4.1",
|
|
68
68
|
"@types/inquirer": "8.2.5",
|
|
69
|
-
"@types/jest": "29.2.
|
|
69
|
+
"@types/jest": "29.2.6",
|
|
70
70
|
"@types/node": "18.11.18",
|
|
71
71
|
"@types/node-emoji": "1.8.2",
|
|
72
72
|
"@types/ora": "3.2.0",
|
|
@@ -74,20 +74,20 @@
|
|
|
74
74
|
"@types/rimraf": "3.0.2",
|
|
75
75
|
"@types/shelljs": "0.8.11",
|
|
76
76
|
"@types/webpack-node-externals": "2.5.3",
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
78
|
-
"@typescript-eslint/parser": "5.
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "5.49.0",
|
|
78
|
+
"@typescript-eslint/parser": "5.49.0",
|
|
79
79
|
"delete-empty": "3.0.0",
|
|
80
|
-
"eslint": "8.
|
|
81
|
-
"eslint-config-prettier": "8.
|
|
82
|
-
"eslint-plugin-import": "2.
|
|
80
|
+
"eslint": "8.32.0",
|
|
81
|
+
"eslint-config-prettier": "8.6.0",
|
|
82
|
+
"eslint-plugin-import": "2.27.5",
|
|
83
83
|
"gulp": "4.0.2",
|
|
84
84
|
"gulp-clean": "0.4.0",
|
|
85
|
-
"husky": "8.0.
|
|
85
|
+
"husky": "8.0.3",
|
|
86
86
|
"jest": "29.3.1",
|
|
87
87
|
"lint-staged": "13.1.0",
|
|
88
|
-
"prettier": "2.8.
|
|
88
|
+
"prettier": "2.8.3",
|
|
89
89
|
"release-it": "15.6.0",
|
|
90
|
-
"ts-jest": "29.0.
|
|
90
|
+
"ts-jest": "29.0.5",
|
|
91
91
|
"ts-loader": "9.4.2",
|
|
92
92
|
"ts-node": "10.9.1"
|
|
93
93
|
},
|