Skip to content

feat: initialize future flags#4107

Merged
h-a-n-a merged 3 commits intomainfrom
feat/future-flags
Sep 4, 2023
Merged

feat: initialize future flags#4107
h-a-n-a merged 3 commits intomainfrom
feat/future-flags

Conversation

@h-a-n-a
Copy link
Contributor

@h-a-n-a h-a-n-a commented Sep 4, 2023

Summary

Initializes future flags. Rspack learned the technique for future flag from remix team.
Future flagging is fundamentally the same as other terms you may heard of like feature-gates, feature-flags.

Essentially, in Rspack, when it comes to adopting a deprecation or a newly added feature that differs from
the behavior of the previous version, a new future flag is added.

For example:

module.exports = {
  experiments: {
    rspackFuture: {
       disableTransformByDefault: true, // opt-in new deprecations
       newResolver: true
    }
  }
}
Version Future flag Deprecation message Stability of the future behavior
Current minor Added (Default: same as the old behavior) Added ⚠️ (Not guaranteed)
Next minor Still available (Default: new behavior enabled) Still available
Minor after the next minor Removed Removed

When adopting a new breaking behavior in Rspack, three steps are included:

  1. In the current minor version, a breaking change is added with a new future flag. However,
    for the default behavior, this flag is off. You can adopt this feature by switching the flag.
    At the same time, a deprecation message with regard to the breaking will also be added.
  2. In the next minor, the flag will be turned on by default. This is a breaking change.
    At this stage, you can still switch to the old implementation. This leaves people some time
    for adopting the new behavior later. For people who turned off the flag (which is enabled in this version),
    a deprecation message will be used as a heads-up.
  3. In the minor version after that, the flag and its deprecation message will be completely removed.

In summary, developers have time of less than two releases to adopt to the new behavior.
This strategy is subject to change when it hits to our first major version.

Test Plan

Not necessary for now.

@github-actions github-actions bot added release: feature team The issue/pr is created by the member of Rspack. labels Sep 4, 2023
@h-a-n-a h-a-n-a added the need documentation Create a tracking issue in rspack-website label Sep 4, 2023
@h-a-n-a h-a-n-a enabled auto-merge September 4, 2023 08:42
@h-a-n-a h-a-n-a added this pull request to the merge queue Sep 4, 2023
Merged via the queue into main with commit 0380656 Sep 4, 2023
@h-a-n-a h-a-n-a deleted the feat/future-flags branch September 4, 2023 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need documentation Create a tracking issue in rspack-website team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants