Built-in plugin registration doesn't scale: binary size + startup cost grows unconditionally with every plugin

Đang mở
#231 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bun, typescript
Lĩnh vực
cli, performance

Hướng nghiên cứu

Bắt đầu với loadPlugins() của cli.ts và so sánh route hiện có PluginLoader.load/loadFromNpm với loading path github: hiện mới chỉ là stub. Đo kích thước binary và thời gian khởi động --help với sáu plugin tích hợp hiện tại, sau đó đánh giá một cơ chế tránh tải hoặc nhúng các plugin không liên quan. Được xem là hoàn tất khi có một cách tiếp cận được tài liệu hóa và kiểm thử, giải quyết khoảng trống đối với các plugin chưa được công bố và bao gồm các phép đo cơ sở.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Context

game-ci/cli#230 registered @game-ci/bevy as a built-in plugin (a literal import() in cli.ts's loadPlugins(), traced and embedded directly into the compiled binary) because it isn't published to npm and --plugin @game-ci/<name> (which resolves via loadFromNpm) can't reach it at runtime. A follow-up does the same for five more functional-but-unpublished plugins: github-release-deploy, itch-deploy, pseudo-localization, code-signing, steam-workshop.

This pattern has a real cost that will keep growing as more plugins are added this way:

  1. Binary size: every built-in plugin's code is unconditionally bundled into the single compiled game-ci binary via Bun's --compile, whether or not a given invocation ever touches it. This is unlike the genuinely-opt-in --plugin <name> path (PluginLoader.load's string-parameter/loadFromNpm route), which is a dynamic import Bun's bundler can't trace - confirmed earlier this repo's own workspace plugins impose zero bundle cost on unrelated invocations when loaded that way. Built-in registration gives up that property.
  2. Startup cost: loadPlugins() calls PluginLoader.loadModule() (and therefore each plugin's onLoad(), if it defines one) unconditionally on every CLI invocation - game-ci --help, game-ci build ./unity-project, anything - regardless of whether that plugin is relevant. Today's built-ins are presumably cheap (synchronous command-factory registration, no I/O), but nothing enforces that, and the list will only grow.

Six built-ins (soon) is probably still fine. But there's no mechanism today to keep this bounded, and "not published to npm" is currently the only trigger for going down the built-in path - which will keep happening as new plugins ship, since none of the newer ones are on npm either yet.

Ask

Investigate a real fix for the underlying gap instead of continuing to grow the built-in list:

  • Publish these plugins to npm (npm) so --plugin <name> actually works for them via the existing loadFromNpm path - the original, genuinely-opt-in mechanism this was designed around - OR
  • Implement PluginLoader's github: loading path (currently a stub that throws "not yet implemented") so a plugin can be fetched/loaded from this repo without needing either npm or unconditional binary embedding, OR
  • Some other mechanism that keeps unrelated game-ci invocations from paying for plugins they don't use, as the plugin count grows.

Whichever direction, it'd help to also measure the actual current cost (binary size delta, --help startup time) with today's 6 built-ins as a baseline, so future additions have a concrete number to weigh against.

Ngôn ngữ chính
TypeScript
Star
20
Fork
11
Merge trung bình
5 giờ 28 phút
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của game-ci/cli

Tất cả issue của game-ci/cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.