"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/ngtools/webpack/src/ivy/plugin.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.

plugin.ts  (angular-cli-12.0.3):plugin.ts  (angular-cli-12.0.4)
skipping to change at line 13 skipping to change at line 13
* Copyright Google LLC All Rights Reserved. * Copyright Google LLC All Rights Reserved.
* *
* Use of this source code is governed by an MIT-style license that can be * Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import { CompilerHost, CompilerOptions, readConfiguration } from '@angular/compi ler-cli'; import { CompilerHost, CompilerOptions, readConfiguration } from '@angular/compi ler-cli';
import { NgtscProgram } from '@angular/compiler-cli/src/ngtsc/program'; import { NgtscProgram } from '@angular/compiler-cli/src/ngtsc/program';
import { createHash } from 'crypto'; import { createHash } from 'crypto';
import * as ts from 'typescript'; import * as ts from 'typescript';
import { import type { Compilation, Compiler, Module, NormalModule } from 'webpack';
Compilation,
Compiler,
Module,
NormalModule,
NormalModuleReplacementPlugin,
util,
} from 'webpack';
import { NgccProcessor } from '../ngcc_processor'; import { NgccProcessor } from '../ngcc_processor';
import { TypeScriptPathsPlugin } from '../paths-plugin'; import { TypeScriptPathsPlugin } from '../paths-plugin';
import { WebpackResourceLoader } from '../resource_loader'; import { WebpackResourceLoader } from '../resource_loader';
import { addError, addWarning } from '../webpack-diagnostics'; import { addError, addWarning } from '../webpack-diagnostics';
import { SourceFileCache } from './cache'; import { SourceFileCache } from './cache';
import { DiagnosticsReporter, createDiagnosticsReporter } from './diagnostics'; import { DiagnosticsReporter, createDiagnosticsReporter } from './diagnostics';
import { import {
augmentHostWithCaching, augmentHostWithCaching,
augmentHostWithDependencyCollection, augmentHostWithDependencyCollection,
augmentHostWithNgcc, augmentHostWithNgcc,
skipping to change at line 122 skipping to change at line 115
tsconfig: 'tsconfig.json', tsconfig: 'tsconfig.json',
...options, ...options,
}; };
} }
get options(): AngularWebpackPluginOptions { get options(): AngularWebpackPluginOptions {
return this.pluginOptions; return this.pluginOptions;
} }
apply(compiler: Compiler): void { apply(compiler: Compiler): void {
const { NormalModuleReplacementPlugin, util } = compiler.webpack;
// Setup file replacements with webpack // Setup file replacements with webpack
for (const [key, value] of Object.entries(this.pluginOptions.fileReplacement s)) { for (const [key, value] of Object.entries(this.pluginOptions.fileReplacement s)) {
new NormalModuleReplacementPlugin( new NormalModuleReplacementPlugin(
new RegExp('^' + key.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&') + '$'), new RegExp('^' + key.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&') + '$'),
value, value,
).apply(compiler); ).apply(compiler);
} }
// Set resolver options // Set resolver options
const pathsPlugin = new TypeScriptPathsPlugin(); const pathsPlugin = new TypeScriptPathsPlugin();
skipping to change at line 269 skipping to change at line 264
); );
// Set of files used during the unused TypeScript file analysis // Set of files used during the unused TypeScript file analysis
const currentUnused = new Set<string>(); const currentUnused = new Set<string>();
for (const sourceFile of builder.getSourceFiles()) { for (const sourceFile of builder.getSourceFiles()) {
if (internalFiles?.has(sourceFile)) { if (internalFiles?.has(sourceFile)) {
continue; continue;
} }
// Ensure all program files are considered part of the compilation and w // Ensure all program files are considered part of the compilation and w
ill be watched ill be watched.
compilation.fileDependencies.add(sourceFile.fileName); // Webpack does not normalize paths. Therefore, we need to normalize the
path with FS seperators.
compilation.fileDependencies.add(externalizePath(sourceFile.fileName));
// Add all non-declaration files to the initial set of unused files. The set will be // Add all non-declaration files to the initial set of unused files. The set will be
// analyzed and pruned after all Webpack modules are finished building. // analyzed and pruned after all Webpack modules are finished building.
if (!sourceFile.isDeclarationFile) { if (!sourceFile.isDeclarationFile) {
currentUnused.add(normalizePath(sourceFile.fileName)); currentUnused.add(normalizePath(sourceFile.fileName));
} }
} }
compilation.hooks.finishModules.tapPromise(PLUGIN_NAME, async (modules) => { compilation.hooks.finishModules.tapPromise(PLUGIN_NAME, async (modules) => {
// Rebuild any remaining AOT required modules // Rebuild any remaining AOT required modules
 End of changes. 3 change blocks. 
11 lines changed or deleted 8 lines changed or added

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