clean: remove redundant generateRound === 0 check#400
Merged
ezolenko merged 1 commit intoezolenko:masterfrom Aug 19, 2022
Merged
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the
if (generateRound === 0)check in theoptionshook as it is redundant / unnecessarygenerateRound = 0tobuildEnd#390Details
when
optionsis called,generateRoundshould have already been reset to0, so this is redundant / unnecessaryoptionsis only called once per watch cycleoptionsis also aninputhook, not anoutputhook, i.e. it's only called once for all outputs, not per each outputgenerateRoundonly tracks the output roundthis might be leftover historical remnants prior to Rollup officially separating
outputhooks, but even before then, it should only have been called once for all outputsrollup.rollupand not duringbundle.generateetc