<commit_before>import plugin from '@start/plugin/src/'

export default (glob: string | string[]) =>
  plugin('findGitStaged', async ({ logFile }) => {
    const { default: path } = await import('path')
    const { default: { EOL } } = await import('os')
    const { default: execa } = await import('execa')
    const { default: multimatch } = await import('multimatch')

    const gitArgs = ['diff', '--cached', '--name-only', '--diff-filter=ACM']

    return execa('git', gitArgs).then(({ stdout }) => {
      const gitFiles = stdout.split(EOL)
      const matchedFiles = multimatch(gitFiles, glob)

      return matchedFiles
        .map((file) => path.resolve(file))
        .map((file) => {
          logFile(file)

          return {
            path: file,
            data: null,
            map: null
          }
        })
    })
  })
<commit_msg>🛠️ plugin-find-git-staged: simplify destructuring of dynamic imports<commit_after>import plugin from '@start/plugin/src/'

export default (glob: string | string[]) =>
  plugin('findGitStaged', async ({ logFile }) => {
    const path = await import('path')
    const { EOL } = await import('os')
    const { default: execa } = await import('execa')
    const { default: multimatch } = await import('multimatch')

    const gitArgs = ['diff', '--cached', '--name-only', '--diff-filter=ACM']

    return execa('git', gitArgs).then(({ stdout }) => {
      const gitFiles = stdout.split(EOL)
      const matchedFiles = multimatch(gitFiles, glob)

      return matchedFiles
        .map((file) => path.resolve(file))
        .map((file) => {
          logFile(file)

          return {
            path: file,
            data: null,
            map: null
          }
        })
    })
  })

{'fraction_non_alphanumeric': 0.15967834577828835, 'fraction_numerical': 0.0, 'mean_word_length': 2.362934362934363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '3860600', 'n_tokens_mistral': 535, 'n_tokens_neox': 520, 'n_words': 128}