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

Plugins: single file plugin format (like JSX but for plugins)

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

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

評価

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

調査の方向性

特定のファイルやテストは指定されていません。まず parser、generator、types plugin の API と、参照されている private-fields PR を確認し、単一ファイルの plugin 形式が実現可能かどうかを判断してください。完了とするには、合意された設計と実装範囲が必要ですが、この issue ではそれらが定義されていません。

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

説明

Just another idea I had for making it easier to create new syntax (not necessarily for production or standardization but to test out ideas).

Currently, the only thing you can do now in transform plugin itself is modify existing AST/syntax.

export function customPlugin() {
  return {
    visitor: {
      OptionalChaining() {}
    }
}

In order to add new syntax, you need to modify the parser (we don't allow plugins on purpose but I kinda want to re-think that but in a way that doesn't ruin the ecosystem, which is I suppose why the parser is "bundled" now).

Currently you can pass overrides for the parser/generator if you want fork the parser or use recast/prettier to do codemods.

return {
    parserOverride: parse,
    generatorOverride(ast, options) {
      return {
        code: prettier.format(
          generate(ast).code,
          config
        ),
      }
    },
  }

Even in a PR to babel (ex: tc39/proposal-private-fields-in-in
, https://github.com/babel/babel/pull/11372) you have to change a lot of different files (a good thing as it's independent), but maybe it's possible to keep it in one place? I know this wouldn't work if you are modifying different nodes, but just thinking out loud here.

So it would be interesting if we supported adding your own "types", "printer nodes" in the plugin itself?

export function customPlugin() {
  return {
    parser: { // @babel/parser
      parserOverrideFunction() { // parse a?.b }
    },
    visitor, // same as usual
    generator: { // @babel/generator
      OptionalChaining() { // print a?.b }
    },
    types: { // for @babel/types
      OptionalChaining: {
        builder: ["operator", "left", "right"],
        visitor: ["left", "right"],
        aliases: ["Binary", "Expression"]
      }
    }
  };
}
主要言語
言語のデータがありません
スター
123
フォーク
16
PR マージ指標
30日以内にマージされた PR はありません

環境構築

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

はじめの一歩

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

babel/notes のほかの issue

babel/notes の issue をすべて見る

似ている issue

Compilers の issue をもっと見る

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

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