feat(workspace): add concurrency option and --concurrency CLI flag - #1030
feat(workspace): add concurrency option and --concurrency CLI flag#1030jpzwarte wants to merge 7 commits into
Conversation
❌ Deploy Preview for tsdown-main failed.
|
tsdown
create-tsdown
@tsdown/css
@tsdown/exe
tsdown-migrate
commit: |
|
@sxzz I've tried to make sure this PR follows your earlier comment in the other PR i just closed. Afaics it's ready for review. Please let me know if there's anything i missed. |
There was a problem hiding this comment.
Pull request overview
Adds a workspace-level concurrency limit to reduce resource exhaustion in large monorepos by throttling how many workspace packages are built in parallel, surfaced as both workspace.concurrency and a --concurrency <count> CLI flag.
Changes:
- Introduces
workspace.concurrency(and--concurrency) and threads the resolved concurrency value through config resolution into the build scheduler. - Updates the build scheduler to limit parallelism at the package level (all formats for a package share one concurrency slot).
- Adds a
mapConcurrentutility with unit tests, plus an e2e fixture/snapshot covering the new option wiring.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/e2e.test.ts | Adds an e2e scenario that uses workspace.concurrency. |
| tests/snapshots/workspace-concurrency-option.snap.md | Snapshot output for the new e2e scenario. |
| src/utils/general.ts | Adds mapConcurrent helper to run async tasks with a concurrency cap. |
| src/utils/general.test.ts | Unit tests for mapConcurrent (order, cap, rejection, unlimited). |
| src/config/workspace.ts | Validates/derives workspace.concurrency and returns it from workspace resolution. |
| src/config/types.ts | Documents Workspace.concurrency and adds InlineConfig.concurrency (CLI alias). |
| src/config/index.ts | Aggregates workspace concurrency and returns it from resolveConfig(). |
| src/cli.ts | Adds --concurrency <count> flag. |
| src/build.ts | Applies concurrency when building workspace packages by grouping configs per package. |
| docs/zh-CN/reference/cli.md | Documents --concurrency <count> in Chinese CLI reference. |
| docs/reference/cli.md | Documents --concurrency <count> in English CLI reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@sxzz I'm not sure what is happening with the 2 failing checks (autofix and linting). When i run linting locally i get no errors and the errors on GitHub point to lines that i haven't touched in this PR... |
b7ca706 to
dd9ba7c
Compare
Large workspaces can spawn an excessive number of subprocesses (e.g. TypeScript declaration workers) when all packages build at once, exhausting system resources (rolldown#929). Add `workspace.concurrency` to limit how many packages build in parallel, with a `--concurrency <count>` CLI alias. All formats of a package share one concurrency slot, since a package's exports/publint step only resolves once every format of that package has finished. Defaults to unlimited, preserving current behavior. Fixes rolldown#929 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dd9ba7c to
6b58931
Compare
|
Thank you for your contribution and for helping move this forward! I ended up implementing the feature directly on |
Description
Large workspaces can spawn an excessive number of subprocesses (e.g. TypeScript declaration workers) when all packages build at once, exhausting system resources (#929).
Add
workspace.concurrencyto limit how many packages build in parallel, with a--concurrency <count>CLI alias. All formats of a package share one concurrency slot, since a package's exports/publint step only resolves once every format of that package has finished. Defaults to unlimited, preserving current behavior.Linked Issues
Fixes #929
Additional context
Claude generated the Chinese documentation. Please review that yourself as i can't read Chinese :)