// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { Colorize } from '@rushstack/terminal';
const PLUGIN_NAME = 'DebugHashesPlugin';
export class DebugHashesPlugin {
    constructor(terminal) {
        this._terminal = terminal;
    }
    apply(hooks) {
        hooks.beforeExecuteOperations.tap(PLUGIN_NAME, (operations) => {
            const terminal = this._terminal;
            terminal.writeLine(Colorize.blue(`===== Begin Hash Computation =====`));
            for (const [operation, record] of operations) {
                terminal.writeLine(Colorize.cyan(`--- ${operation.name} ---`));
                record.getStateHashComponents().forEach((component) => {
                    terminal.writeLine(component);
                });
                terminal.writeLine(Colorize.green(`Result: ${record.getStateHash()}`));
                // Add a blank line between operations to visually separate them
                terminal.writeLine();
            }
            terminal.writeLine(Colorize.blue(`===== End Hash Computation =====`));
        });
    }
}
//# sourceMappingURL=DebugHashesPlugin.js.map