Skip to content

Conversation

@agilgur5
Copy link
Collaborator

@agilgur5 agilgur5 commented Jul 29, 2022

Summary

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

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

- 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 agilgur5 added the kind: internal Changes only affect the internals, and _not_ the public API or external-facing docs label Jul 29, 2022
@ezolenko ezolenko merged commit 697e839 into ezolenko:master Aug 19, 2022
@agilgur5 agilgur5 deleted the clean-remove-redundant-generateRound-check branch July 2, 2023 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: internal Changes only affect the internals, and _not_ the public API or external-facing docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants