<commit_before>export type StartFile = {
  path: string,
  data: null | string,
  map: null | {}
}

export type StartFiles = StartFile[]

export type StartPluginPropsBefore = {
  files?: StartFiles,
  reporter: NodeJS.EventEmitter,
  [key: string]: any
}

export type StartPluginPropsAfter = StartPluginPropsBefore & {
  logFile: (file: string) => void,
  logMessage: (message: string) => void,
}

export type StartPluginPropsOut = {
  [key: string]: any
}

export type StartPluginFn = (props: StartPluginPropsAfter) => StartPluginPropsOut | Promise<StartPluginPropsOut> | void
export type StartPluginSync = (props: StartPluginPropsBefore) => StartPluginPropsOut | Promise<StartPluginPropsOut> | void
export type StartPlugin = StartPluginSync | Promise<StartPluginSync>

export default (name: string, pluginFn: StartPluginFn): StartPluginSync => async ({ reporter, ...rest }) => {
  try {
    reporter.emit('start', name)

    const result = await pluginFn({
      ...rest,
      reporter,
      logFile: (file) => reporter.emit('file', name, file),
      logMessage: (message) => reporter.emit('message', name, message)
    })

    reporter.emit('done', name)

    return {
      reporter,
      ...rest,
      ...result
    }
  } catch (error) {
    reporter.emit('error', name, error)

    throw null
  }
}
<commit_msg>🛠 plugin: minor types renaming (close #40)<commit_after>export type StartFile = {
  path: string,
  data: null | string,
  map: null | {}
}

export type StartFiles = StartFile[]

export type StartPluginPropsBefore = {
  files?: StartFiles,
  reporter: NodeJS.EventEmitter,
  [key: string]: any
}

export type StartPluginPropsAfter = StartPluginPropsBefore & {
  logFile: (file: string) => void,
  logMessage: (message: string) => void,
}

export type StartPluginPropsOut = {
  [key: string]: any
}

export type StartPluginFn = (props: StartPluginPropsAfter) => StartPluginPropsOut | Promise<StartPluginPropsOut> | void
export type StartPluginAsync = (props: StartPluginPropsBefore) => StartPluginPropsOut | Promise<StartPluginPropsOut> | void
export type StartPlugin = StartPluginAsync | Promise<StartPluginAsync>

export default (name: string, pluginFn: StartPluginFn): StartPluginAsync => async ({ reporter, ...rest }) => {
  try {
    reporter.emit('start', name)

    const result = await pluginFn({
      ...rest,
      reporter,
      logFile: (file) => reporter.emit('file', name, file),
      logMessage: (message) => reporter.emit('message', name, message)
    })

    reporter.emit('done', name)

    return {
      reporter,
      ...rest,
      ...result
    }
  } catch (error) {
    reporter.emit('error', name, error)

    throw null
  }
}

{'fraction_non_alphanumeric': 0.1288756070227867, 'fraction_numerical': 0.0007471049682480389, 'mean_word_length': 3.7906976744186047, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, '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': '7530193', 'n_tokens_mistral': 796, 'n_tokens_neox': 798, 'n_words': 216}