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
This commit is contained in:

committed by
Matias Niemelä

parent
9270d3f279
commit
0cf94e3ed5
@ -8,11 +8,14 @@
|
||||
|
||||
import {EntryPoint, EntryPointJsonProperty} from '../packages/entry_point';
|
||||
|
||||
/** The type of the function that analyzes entry-points and creates the list of tasks. */
|
||||
export type AnalyzeEntryPointsFn = () => {
|
||||
processingMetadataPerEntryPoint: Map<string, EntryPointProcessingMetadata>;
|
||||
tasks: Task[];
|
||||
};
|
||||
|
||||
/**
|
||||
* The type of the function that analyzes entry-points and creates the list of tasks.
|
||||
*
|
||||
* @return A list of tasks that need to be executed in order to process the necessary format
|
||||
* properties for all entry-points.
|
||||
*/
|
||||
export type AnalyzeEntryPointsFn = () => Task[];
|
||||
|
||||
/** The type of the function that can process/compile a task. */
|
||||
export type CompileFn = (task: Task) => void;
|
||||
@ -29,15 +32,6 @@ export interface Executor {
|
||||
void|Promise<void>;
|
||||
}
|
||||
|
||||
/** Represents metadata related to the processing of an entry-point. */
|
||||
export interface EntryPointProcessingMetadata {
|
||||
/**
|
||||
* Whether the typings for the entry-point have been successfully processed (or were already
|
||||
* processed).
|
||||
*/
|
||||
hasProcessedTypings: boolean;
|
||||
}
|
||||
|
||||
/** Represents a unit of work: processing a specific format property of an entry-point. */
|
||||
export interface Task {
|
||||
/** The `EntryPoint` which needs to be processed as part of the task. */
|
||||
|
@ -22,10 +22,9 @@ export class SingleProcessExecutor implements Executor {
|
||||
execute(analyzeEntryPoints: AnalyzeEntryPointsFn, createCompileFn: CreateCompileFn): void {
|
||||
this.logger.debug(`Running ngcc on ${this.constructor.name}.`);
|
||||
|
||||
const {processingMetadataPerEntryPoint, tasks} = analyzeEntryPoints();
|
||||
const compile = createCompileFn(
|
||||
(task, outcome) =>
|
||||
onTaskCompleted(this.pkgJsonUpdater, processingMetadataPerEntryPoint, task, outcome));
|
||||
const tasks = analyzeEntryPoints();
|
||||
const compile =
|
||||
createCompileFn((task, outcome) => onTaskCompleted(this.pkgJsonUpdater, task, outcome));
|
||||
|
||||
// Process all tasks.
|
||||
for (const task of tasks) {
|
||||
|
@ -11,14 +11,12 @@ import {markAsProcessed} from '../packages/build_marker';
|
||||
import {PackageJsonFormatProperties} from '../packages/entry_point';
|
||||
import {PackageJsonUpdater} from '../writing/package_json_updater';
|
||||
|
||||
import {EntryPointProcessingMetadata, Task, TaskProcessingOutcome} from './api';
|
||||
import {Task, TaskProcessingOutcome} from './api';
|
||||
|
||||
|
||||
/** A helper function for handling a task's being completed. */
|
||||
export const onTaskCompleted =
|
||||
(pkgJsonUpdater: PackageJsonUpdater,
|
||||
processingMetadataPerEntryPoint: Map<string, EntryPointProcessingMetadata>, task: Task,
|
||||
outcome: TaskProcessingOutcome, ): void => {
|
||||
(pkgJsonUpdater: PackageJsonUpdater, task: Task, outcome: TaskProcessingOutcome): void => {
|
||||
const {entryPoint, formatPropertiesToMarkAsProcessed, processDts} = task;
|
||||
|
||||
if (outcome === TaskProcessingOutcome.Processed) {
|
||||
@ -27,8 +25,6 @@ export const onTaskCompleted =
|
||||
[...formatPropertiesToMarkAsProcessed];
|
||||
|
||||
if (processDts) {
|
||||
const processingMeta = processingMetadataPerEntryPoint.get(entryPoint.path) !;
|
||||
processingMeta.hasProcessedTypings = true;
|
||||
propsToMarkAsProcessed.push('typings');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user