Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Babel 8 Ecosystem Migration Stuff

オープン
#116 コメント 1 件 リアクション 6 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
20/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript

調査の方向性

リンクされた Babel 8 Release Plan issue (#10746) と既存の next-8-dev ブランチから始めて、移行の範囲を理解してください。提案されている環境変数 BABEL_8_BREAKING と、v7/v8 テストの命名方法を確認してください。完了とするには、合意された移行戦略とサンプル PR が必要で、その後に別のプロジェクトで移行演習を行います。

索引モデルが issue の本文から書いたものです。

説明

Didn't want to spam our release issue too much so just writing this here as well.

#10746, Pinned Babel 8 Release Plan Issue

There are a lot of concerns (I have them too) around what a major version bump would look like for the ecosystem. What else can we do in addition to a upgrade guide for the end user (good errors, clear explanation of changes, workaround/migration)?

What about dependencies of dependencies? Especially if you aren't using Babel directly (see issues from v6 to v7). We ended up with slow approach of essentially a year of alphas/betas/rc so that by the time it was out, most things were already updated and you could say it was relatively smooth compared to v5 to v6. But then again it took forever and there was a long process of versioning.

Idea

Use an environment variable (currently BABEL_8_BREAKING), which includes all breaking changes. Essentially a "feature flag" that we introduce (and continue to add onto) in Babel 7 patch versions.

Enables opt-ing into breaking changes without needing to change versions or dependencies.

So as a library author, you could do a dry-run and update accordingly. Or make PRs that run against the flag so that you can update the package ahead of release as we land changes. (hopefully we don't prolong this more than needed).

For the Babel codebase, ideally we do it in a way that makes this easy to automate away with a codemod. Babel 8 diff would be removing the flags (this is good because we aren't trying to introduce new features in the major version, we just do it in the minor)

if (process.env.BABEL_8_BREAKING) {
    runNewFunction();
} else {
    runOldFunction();
}
// new code during Babel 8 release
runNewFunction();

Tests?

We'll need to run tests for both "versions" to not break anything.

One approach: based on file extension: if the flag is enabled and it's a v7 test OR if the flag isn't enable and it's a v8 test, then skip the test?

Test renaming:

  • A test only for v7: rename to output.v7.js, options.v7.json
  • A test only for v8: rename to output.v8.js, options.v8.json
  • For both: keep as is!
  • During v8 release: remove all .v7. files, rename .v8. files to normal

Issues

  • Generally (or the Babel codebase), we shouldn't intend to use this approach in general.. and end up with if statements/flags everywhere. So use a unique name for the flag: BABEL_8_BREAKING babel a.js instead of something like BABEL_BREAKING babel a.js
    • Does it even matter it's a process.env vs. config option? It seems easier since we don't need to pass options between packages (config, plugin, parser option). Also there's no access to options in our interations like CRA.
  • We already have a next-8-dev branch that has merged some PRs into it. Ideally we would be able to just port all breaking change PRs to master under the flag and ignore next-8-dev.
  • It may be a lot of work to add this flag everywhere, and maintain multiple versions of tests
  • It's very likely can't put everything under a flag, but it's a best effort to help with ecosytem migration. We can defer those till the actual release.
  • What about only supporting later versions of Node? We'll have to defer to the final release?

Todo

  • I'll make an example PR that does this, and then we can attempt a migration on another project as another example.
主要言語
言語のデータがありません
スター
123
フォーク
16
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

babel/notes のほかの issue

babel/notes の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。