Files
Angular-Docs-Cn/packages/compiler-cli/ngcc/src/execution/utils.ts
T
George Kalpakas 0cf94e3ed5 refactor(ngcc): remove unused EntryPointProcessingMetadata data and types (#32427)
Previously, `ngcc` needed to store some metadata related to the
processing of each entry-point. This metadata was stored in a `Map`, in
the form of `EntryPointProcessingMetadata` and passed around as needed.

After some recent refactorings, it turns out that this metadata (with
its only remaining property, `hasProcessedTypings`) was no longer used,
because the relevant information was extracted from other sources (such
as the `processDts` property on `Task`s).

This commit cleans up the code by removing the unused code and types.

PR Close #32427
2019-09-09 15:55:13 -04:00

35 lines
1.2 KiB
TypeScript

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
import {resolve} from '../../../src/ngtsc/file_system';
import {markAsProcessed} from '../packages/build_marker';
import {PackageJsonFormatProperties} from '../packages/entry_point';
import {PackageJsonUpdater} from '../writing/package_json_updater';
import {Task, TaskProcessingOutcome} from './api';
/** A helper function for handling a task's being completed. */
export const onTaskCompleted =
(pkgJsonUpdater: PackageJsonUpdater, task: Task, outcome: TaskProcessingOutcome): void => {
const {entryPoint, formatPropertiesToMarkAsProcessed, processDts} = task;
if (outcome === TaskProcessingOutcome.Processed) {
const packageJsonPath = resolve(entryPoint.path, 'package.json');
const propsToMarkAsProcessed: PackageJsonFormatProperties[] =
[...formatPropertiesToMarkAsProcessed];
if (processDts) {
propsToMarkAsProcessed.push('typings');
}
markAsProcessed(
pkgJsonUpdater, entryPoint.packageJson, packageJsonPath, propsToMarkAsProcessed);
}
};