<commit_before>import BluebirdPromise from "bluebird-lst"
import { asArray, debug, warn } from "electron-builder-util"
import { copyDir, copyOrLinkFile, Filter, statOrNull } from "electron-builder-util/out/fs"
import { mkdirs } from "fs-extra-p"
import { Minimatch } from "minimatch"
import * as path from "path"
import { Platform } from "./core"
import { hasDep } from "./fileTransformer"
import { Config, FilePattern, PlatformSpecificBuildOptions } from "./metadata"
import { PlatformPackager } from "./platformPackager"
import { createFilter, hasMagic } from "./util/filter"

/** @internal */
export class FileMatcher {
  readonly from: string
  readonly to: string

  readonly patterns: Array<string>

  constructor(from: string, to: string, private readonly macroExpander: (pattern: string) => string, patterns?: Array<string> | string | n) {
    this.from = macroExpander(from)
    this.to = macroExpander(to)
    this.patterns = asArray(patterns).map(it => this.normalizePattern(it))
  }

  normalizePattern(pattern: string) {
    return path.posix.normalize(this.macroExpander(pattern.replace(/\\/g, "/")))
  }

  addPattern(pattern: string) {
    this.patterns.push(this.normalizePattern(pattern))
  }

  prependPattern(pattern: string) {<commit_msg>feat: remove `./` prefix from file pattern<commit_after>import BluebirdPromise from "bluebird-lst"
import { asArray, debug, warn } from "electron-builder-util"
import { copyDir, copyOrLinkFile, Filter, statOrNull } from "electron-builder-util/out/fs"
import { mkdirs } from "fs-extra-p"
import { Minimatch } from "minimatch"
import * as path from "path"
import { Platform } from "./core"
import { hasDep } from "./fileTransformer"
import { Config, FilePattern, PlatformSpecificBuildOptions } from "./metadata"
import { PlatformPackager } from "./platformPackager"
import { createFilter, hasMagic } from "./util/filter"

/** @internal */
export class FileMatcher {
  readonly from: string
  readonly to: string

  readonly patterns: Array<string>

  constructor(from: string, to: string, private readonly macroExpander: (pattern: string) => string, patterns?: Array<string> | string | n) {
    this.from = macroExpander(from)
    this.to = macroExpander(to)
    this.patterns = asArray(patterns).map(it => this.normalizePattern(it))
  }

  normalizePattern(pattern: string) {
    if (pattern.startsWith("./")) {
      pattern = pattern.substring("./".length)
    }
    return path.posix.normalize(this.macroExpander(pattern.replace(/\\/g, "/")))
  }

  addPattern(pattern: string) {
    this.patterns.push(this.normalizePattern(pattern))
  }

  prependPattern(pattern: string) {
{'fraction_non_alphanumeric': 0.13391502276176023, 'fraction_numerical': 0.0, 'mean_word_length': 4.598726114649682, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, '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': '243212', 'n_tokens_mistral': 807, 'n_tokens_neox': 787, 'n_words': 201}