<commit_before>import { Compiler, Stats } from 'webpack';
import path from 'path';
import del from 'del';

type Options = {
    dryRun: boolean;
    verbose: boolean;
    customPatterns: string[];
    initialPatterns: string[];
};

class CleanSelfWebpackPlugin {
    private readonly options: Options;

    private currentAssets: string[];
    private initialClean: boolean;
    private outputPath?: string;

    constructor(options: Partial<Options> = {}) {
        this.options = {
            /**
             * Simulate the removal of files
             */
            dryRun: options.dryRun || false,

            /**
             * console.warn removed files
             */
            verbose: options.dryRun || options.verbose || false,

            /**
             * Custom pattern matching
             *
             * See https://github.com/sindresorhus/del#patterns
             */
            customPatterns: options.customPatterns || [],

            /**
             * Remove files once prior to compilation
             *
             * See https://github.com/sindresorhus/del#patterns
             */
            initialPatterns: options.initialPatterns || [],
        };

        /**
         * Store webpack build assets
         */
        this.currentAssets = [];

        /**
         * Only used with initialPatterns
         */
        this.initialClean = false;

        this.outputPath = undefined;

        this.handleInitial = this.handleInitial.bind(this);
        this.handleDone = this.handleDone.bind(this);
        this.removeFiles = this.removeFiles.bind(this);
    }

    apply(compiler: Compiler) {
        if (!compiler.options.output || !compiler.options.output.path) {
            // eslint-disable-next-line no-console
            console.warn(
                `clean-self-webpack-plugin: options.output.path not defined. Ignoring settings...`,
            );

            return;
        }
<commit_msg>bind apply to local instance<commit_after>import { Compiler, Stats } from 'webpack';
import path from 'path';
import del from 'del';

type Options = {
    dryRun: boolean;
    verbose: boolean;
    customPatterns: string[];
    initialPatterns: string[];
};

class CleanSelfWebpackPlugin {
    private readonly options: Options;

    private currentAssets: string[];
    private initialClean: boolean;
    private outputPath?: string;

    constructor(options: Partial<Options> = {}) {
        this.options = {
            /**
             * Simulate the removal of files
             */
            dryRun: options.dryRun || false,

            /**
             * console.warn removed files
             */
            verbose: options.dryRun || options.verbose || false,

            /**
             * Custom pattern matching
             *
             * See https://github.com/sindresorhus/del#patterns
             */
            customPatterns: options.customPatterns || [],

            /**
             * Remove files once prior to compilation
             *
             * See https://github.com/sindresorhus/del#patterns
             */
            initialPatterns: options.initialPatterns || [],
        };

        /**
         * Store webpack build assets
         */
        this.currentAssets = [];

        /**
         * Only used with initialPatterns
         */
        this.initialClean = false;

        this.outputPath = undefined;

        this.apply = this.apply.bind(this);
        this.handleInitial = this.handleInitial.bind(this);
        this.handleDone = this.handleDone.bind(this);
        this.removeFiles = this.removeFiles.bind(this);
    }

    apply(compiler: Compiler) {
        if (!compiler.options.output || !compiler.options.output.path) {
            // eslint-disable-next-line no-console
            console.warn(
                `clean-self-webpack-plugin: options.output.path not defined. Ignoring settings...`,
            );

            return;
        }

{'fraction_non_alphanumeric': 0.10959250822576563, 'fraction_numerical': 0.0, 'mean_word_length': 1.6756939742721733, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2954570', 'n_tokens_mistral': 1017, 'n_tokens_neox': 990, 'n_words': 220}