PR: merge cherry-picking from upstream / common-v8#4
Conversation
Adds the all() function to run multiple Tasks in parallel or sequentially, supporting arrays, tuples, structs, and iterables. Introduces withConcurrency to control the maximum number of concurrent tasks, with type-safe options and inheritance. Updates Task, Runner, and related types to support concurrency primitives, and provides comprehensive tests for all() and withConcurrency behaviors.
Introduces a polyfill for Promise.try in the react-expo example to ensure compatibility with environments where Promise.try is not available.
Corrected the 'useSqlCipher' key to 'useSQLCipher' in the expo-sqlite configuration to match the expected property name.
Introduces new helpers for advanced task composition: `allSettled`, `forEach`, `forEachSettled`, and `any`, each with their own abort error types. Refactors `all` and `race` to use a shared concurrent worker pool implementation that respects concurrency limits and abort propagation. Updates documentation and tests to cover new helpers, concurrency inheritance, abort handling, and type preservation for tuples, structs, and arrays. Improves `Runner.onAbort` to invoke callbacks immediately if already aborted and ensures proper event listener cleanup.
Introduces Int1To99 and Int1To100 types for numeric literals, along with a helper type NumberFromString to parse numbers from string literal types. These additions enhance type safety for numeric ranges.
📝 WalkthroughWalkthroughCherry-pick introduces a large DI- and structured-concurrency refactor to Task (new lifecycle, abort-cause semantics, many composition helpers), Promise polyfills, docs/ROADMAP updates, VSCode/CI moved to Bun, TestDeps extended with ConsoleDep, plus assorted import/formatting tweaks and small API re-exports. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Runner
participant Fiber
participant Deps as "Deps (Time/Console/Random)"
participant Abort as "AbortSignal/Cause"
Client->>Runner: create/run Task<T,E,D>
Runner->>Deps: resolve injected deps
Runner->>Fiber: spawn fiber with run closure
Fiber->>Deps: use injected deps during execution
note right of Fiber: state: pending → running → done/aborted
Abort->>Runner: signal abort(cause)
Runner->>Fiber: propagate abort(cause)
Fiber->>Client: emit RunnerEvent / Snapshot update
Fiber-->>Runner: finalize result or error (with cause)
Runner->>Client: deliver final FiberSnapshot / result
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
…ubjects.txt` containing lists of commit subjects.
Closes #2.
Integration of Daniel's commits from upstream/common-v8. This PR completes Phase 1 of the roadmap.
Changes
See ROADMAP.md and .changeset/cherry-pick-common-v8.md for details.
Summary by CodeRabbit
New Features
Documentation
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.