rolldown plugin: opt-in mod split into chunks below the checkMod size limit
Maintainer thường phản hồi trong vòng 1 ngày
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
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- build-system
Hướng nghiên cứu
Start by reading packages/core/src/mod-check.ts and packages/rolldown-plugin/src/claude-code.ts, then check which splitting options the pinned rolldown version supports. Trace how the tsdown preset passes plugin options and how fixtures and goldens are maintained. Done means the acceptance checks pass, including a live claude -p run that loads relative imports, README updates, and the required changesets.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
checkMod (packages/core/src/mod-check.ts) refuses any source longer than MAX_SOURCE_LENGTH (65536 UTF-16 code units) before parseSync, because oxc-parser segfaults on long inputs (see the WARNING comment there, #83; related #137). The limit must not be raised.
The rolldown plugin (packages/rolldown-plugin/src/claude-code.ts) checks every emitted chunk with checkModSandbox in generateBundle, but checkChunk requires exactly one chunk for a mod entry (bundle has N chunks; expected exactly one). Rolldown therefore inlines all relative imports and bundled dependencies into one file, and a large mod exceeds the limit with source is longer than 65536 UTF-16 code units and is not parsed; split the mod into modules. The error asks for a split, but the bundler offers no way to produce one.
Proposal
Add an opt-in option (recommended name: modSplit, false by default) to the rolldown plugin and pass it through the tsdown preset. When on, the mod build emits the main mod file plus extra .js chunks that the main file imports by relative path (./x.js). Each chunk is kept below the limit, and each is checked on its own by checkModSandbox. The sandbox import rule already allows relative imports.
The option relaxes the exactly one chunk rule for mod entries only; hooks, script and bundle entries keep it.
Design points
- Splitting mechanism: recommend rolldown
output.codeSplittinggroups (oradvancedChunks) with amaxSizejust under 65536 (for example 60000, to keep headroom for the chunk wrapper code), applied through the plugin'soutputOptionshook. Check which of the two the pinned rolldown version supports. - File names: chunks must end in
.js(thefileNamerule) and stay in the mod's folder (${dir}/). The existing check requires.mjsfor bundle chunks; mods need their own rule. - Limits (document in README): the 128 bracket-nesting guard and the non-bracket chain crash of #137 are per source, so splitting helps only when the size or nesting is spread over modules, not a single huge or deeply nested function. A single module above the limit stays an error.
- Runtime: verify live with
claude -pthat Claude Code resolves a mod's relative imports at runtime before shipping; if it does not, close this issue with the finding in a comment. - Other checkers:
packages/vitest-plugin-claude-code-mod/src/index.ts(checkModon the mod file,bundlesModImport) andpackages/cli/src/check-mod.tscheck one file. Recommend that they follow relative imports and check each file, or that the README states they check the entry only.
Package
rolldown-plugin
Scope
packages/rolldown-plugin/src/claude-code.ts: option,checkChunkrule for mod entries, per-chunkcheckModSandbox(already present), output options for splitting.packages/tsdown-preset-claude-code: pass the option through.packages/vitest-plugin-claude-code-mod,packages/cli: follow relative imports or document the limit.fixtures/: new fixture, goldens via therefresh-goldensskill.- README of the touched packages.
- Changeset: minor for rolldown-plugin and tsdown-preset-claude-code, plus patch or minor for cli and vitest-plugin-claude-code-mod if they change. A new opt-in option rejects no existing build, so it is not breaking.
Acceptance
- With the option on, a fixture mod whose bundled source is above 65536 characters builds into several
.jschunks, and every chunk passescheckMod. - With the option off, behavior is unchanged: the same mod still fails with the
longer than 65536message. - A test covers the relaxed chunk-count rule for mod entries and that hooks/script/bundle entries still require one chunk.
- A live
claude -prun loads the split mod and its relative imports (or the issue is closed with the finding). - README documents the option and the per-source limits.
-
pnpm build,pnpm test,pnpm typecheck,pnpm lint,pnpm format:checkandpnpm test:e2epass; changeset added.
Relations
No response
- Ngôn ngữ chính
- TypeScript
- Star
- 0
- Fork
- 0
- Merge trung bình
- 29 phút
- Pull request đã merge (30 ngày)
- 138
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của kwitsch/claude-code-plugin-tooling
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
kwitsch/claude-code-plugin-tooling#219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
kwitsch/claude-code-plugin-tooling#210 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
kwitsch/claude-code-plugin-tooling#212 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
kwitsch/claude-code-plugin-tooling#209 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
kwitsch/claude-code-plugin-tooling#208 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của kwitsch/claude-code-plugin-tooling
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
makecindy/cindy#15342 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
no-repo-link tool-submission
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Priyanshu-byte-coder/devtrack#4067 ·
Maintainer thường phản hồi trong vòng 1 ngày