rollup-plugin-typescript2 icon indicating copy to clipboard operation
rollup-plugin-typescript2 copied to clipboard

clean: remove redundant `generateRound === 0` check

Open agilgur5 opened this issue 3 years ago • 0 comments
trafficstars

Summary

Removes the if (generateRound === 0) check in the options hook as it is redundant / unnecessary

  • Related to, but independent of, #390

Details

  • when options is called, generateRound should have already been reset to 0, so this is redundant / unnecessary

    • options is only called once per watch cycle
    • options is also an input hook, not an output hook, i.e. it's only called once for all outputs, not per each output
      • generateRound only tracks the output round
  • this might be leftover historical remnants prior to Rollup officially separating output hooks, but even before then, it should only have been called once for all outputs

    • since, per the Rollup API, it's only called during rollup.rollup and not during bundle.generate etc
    • c.f. old docs https://github.com/rollup/rollup/blob/v1.18.0/docs/05-plugin-development.md#options
    • it's possible this is even older, but I couldn't find plugin docs for Rollup pre-1.0 to try to confirm against

agilgur5 avatar Jul 29 '22 16:07 agilgur5