Repository: tailwindlabs/tailwindcss
File: packages/@tailwindcss-vite/src/index.ts (TypeScript)

Code before:

    // Parse all candidates given the resolved files
    for (let candidate of scanner.scanFiles([{ content: src, extension }])) {
      updated = true
      candidates.add(candidate)
    }

    return updated
  }

  async function generateCss(css: string, inputPath: string, addWatchFile: (file: string) => void) {
    let inputBasePath = path.dirname(path.resolve(inputPath))
    clearRequireCache(fullRebuildPaths)
    fullRebuildPaths = []
    let { build, globs } = await compile(css, {
      base: inputBasePath,
      onDependency(path) {
        addWatchFile(path)
        fullRebuildPaths.push(path)
      },
    })

    scanner = new Scanner({
      sources: globs.map(({ origin, pattern }) => ({
        // Ensure the glob is relative to the input CSS file or the config file
        // where they are specified.
        base: origin ? path.dirname(path.resolve(inputBasePath, origin)) : inputBasePath,
        pattern,
      })),
    })

    // This should not be here, but right now the Vite plugin is setup where we
    // setup a new scanner and compiler every time we request the CSS file
    // (regardless whether it actually changed or not).
    for (let candidate of scanner.scan()) {
      candidates.add(candidate)
    }

    if (changedContent.length > 0) {
      for (let candidate of scanner.scanFiles(changedContent.splice(0))) {
        candidates.add(candidate)
      }
    }

    // Watch individual files
    for (let file of scanner.files) {
      addWatchFile(file)
    }

    // Watch globs
    for (let glob of scanner.globs) {

Review comment (suggestion):
```suggestion
        // where it is specified.
```

Code after:

    // Parse all candidates given the resolved files
    for (let candidate of scanner.scanFiles([{ content: src, extension }])) {
      updated = true
      candidates.add(candidate)
    }

    return updated
  }

  async function generateCss(css: string, inputPath: string, addWatchFile: (file: string) => void) {
    let inputBasePath = path.dirname(path.resolve(inputPath))
    clearRequireCache(fullRebuildPaths)
    fullRebuildPaths = []
    let { build, globs } = await compile(css, {
      base: inputBasePath,
      onDependency(path) {
        addWatchFile(path)
        fullRebuildPaths.push(path)
      },
    })

    scanner = new Scanner({
      sources: globs.map(({ origin, pattern }) => ({
        // Ensure the glob is relative to the input CSS file or the config file
        // where it is specified.
        base: origin ? path.dirname(path.resolve(inputBasePath, origin)) : inputBasePath,
        pattern,
      })),
    })

    // This should not be here, but right now the Vite plugin is setup where we
    // setup a new scanner and compiler every time we request the CSS file
    // (regardless whether it actually changed or not).
    for (let candidate of scanner.scan()) {
      candidates.add(candidate)
    }

    if (changedContent.length > 0) {
      for (let candidate of scanner.scanFiles(changedContent.splice(0))) {
        candidates.add(candidate)
      }
    }

    // Watch individual files
    for (let file of scanner.files) {
      addWatchFile(file)
    }

    // Watch globs
    for (let glob of scanner.globs) {