"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/angular_devkit/build_webpack/src/webpack/index.ts" between
angular-cli-12.0.3.tar.gz and angular-cli-12.0.4.tar.gz

About: Angular CLI is a command line interface for Angular.

index.ts  (angular-cli-12.0.3):index.ts  (angular-cli-12.0.4)
skipping to change at line 62 skipping to change at line 62
} }
} else { } else {
return of(webpack(c)); return of(webpack(c));
} }
}; };
return createWebpack({ ...config, watch: false }).pipe( return createWebpack({ ...config, watch: false }).pipe(
switchMap( switchMap(
(webpackCompiler) => (webpackCompiler) =>
new Observable<BuildResult>((obs) => { new Observable<BuildResult>((obs) => {
// Webpack 5 has a compiler level close function
const compilerClose = (webpackCompiler as {
close?(callback: () => void): void;
}).close?.bind(webpackCompiler);
const callback = (err?: Error, stats?: webpack.Stats) => { const callback = (err?: Error, stats?: webpack.Stats) => {
if (err) { if (err) {
return obs.error(err); return obs.error(err);
} }
if (!stats) { if (!stats) {
return; return;
} }
// Log stats. // Log stats.
log(stats, config); log(stats, config);
obs.next(({ const statsOptions = typeof config.stats === 'boolean' ? undefined :
config.stats;
obs.next({
success: !stats.hasErrors(), success: !stats.hasErrors(),
webpackStats: shouldProvideStats ? stats.toJson() : undefined, webpackStats: shouldProvideStats ? stats.toJson(statsOptions) : un defined,
emittedFiles: getEmittedFiles(stats.compilation), emittedFiles: getEmittedFiles(stats.compilation),
outputPath: stats.compilation.outputOptions.path, outputPath: stats.compilation.outputOptions.path,
} as unknown) as BuildResult); } as unknown as BuildResult);
if (!config.watch) { if (!config.watch) {
if (compilerClose) { webpackCompiler.close(() => obs.complete());
compilerClose(() => obs.complete());
} else {
obs.complete();
}
} }
}; };
try { try {
if (config.watch) { if (config.watch) {
const watchOptions = config.watchOptions || {}; const watchOptions = config.watchOptions || {};
const watching = webpackCompiler.watch(watchOptions, callback); const watching = webpackCompiler.watch(watchOptions, callback);
// Teardown logic. Close the watcher when unsubscribed from. // Teardown logic. Close the watcher when unsubscribed from.
return () => { return () => {
watching.close(() => {}); watching.close(() => {});
compilerClose?.(() => {}); webpackCompiler.close(() => {});
}; };
} else { } else {
webpackCompiler.run(callback); webpackCompiler.run(callback);
} }
} catch (err) { } catch (err) {
if (err) { if (err) {
context.logger.error( context.logger.error(
`\nAn error occurred during the build:\n${(err && err.stack) || err}`, `\nAn error occurred during the build:\n${(err && err.stack) || err}`,
); );
} }
 End of changes. 6 change blocks. 
14 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)