Offload functions to worker threads with shared memory primitives for Node.js.
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: version 1.1.0

+28 -32
-5
.changeset/fix-worker-entry-ext.md
··· 1 - --- 2 - 'moroutine': patch 3 - --- 4 - 5 - Fix `Cannot find module .../dist/worker-entry.ts` when consuming the published build. The worker entry URL was hardcoded to `./worker-entry.ts` as a string literal, so tsc's extension rewriting (which only handles import specifiers) left it unchanged in `dist/*.js`. Now derived from `import.meta.url` so src uses `.ts` and dist uses `.js`.
-10
.changeset/inert-and-map.md
··· 1 - --- 2 - 'moroutine': minor 3 - --- 4 - 5 - Add `inert()` and `map()` helpers for fan-out over a worker pool 6 - 7 - - `inert(task)` returns a plain task descriptor without `PromiseLike` or `AsyncIterable` protocols — safe to yield from an (async) generator without triggering auto-await 8 - - `map(run, items, { concurrency, signal })` dispatches an iterable or async iterable of tasks to a `Runner` with bounded concurrency, yielding results in completion order; accepts mixed task types (`Task<string> | Task<number>` → `string | number`) 9 - - New example: `examples/bounded-map` — recursive directory walk hashing every file with bounded concurrency 10 - - `Task<T, A>` now carries a type-only arg brand to enable accurate result inference through `map()`; live tasks returned by `mo()` continue to be `PromiseLike<T>` / `AsyncIterable<T>` as before
-16
.changeset/is-task.md
··· 1 - --- 2 - 'moroutine': minor 3 - --- 4 - 5 - Add `isTask()` type guard for narrowing tasks to a specific moroutine 6 - 7 - ```ts 8 - if (isTask(isPrime, task)) { 9 - // task: Task<boolean, [n: number]> 10 - const [n] = task.args; 11 - } 12 - ``` 13 - 14 - - Moroutines returned by `mo()` now expose a readonly `id` for stable identity 15 - - `isTask(mo, task)` returns `true` when `task` was produced by `mo`, and narrows the task to the descriptor type produced by that moroutine 16 - - `Task<T, A>.args` is now typed as `A` (previously `unknown[]`) so narrowing propagates to argument access — unchanged for `Task<T>` without a specialized arg tuple
+27
CHANGELOG.md
··· 1 1 # moroutine 2 2 3 + ## 1.1.0 4 + 5 + ### Minor Changes 6 + 7 + - 25ea1c1: Add `inert()` and `map()` helpers for fan-out over a worker pool 8 + - `inert(task)` returns a plain task descriptor without `PromiseLike` or `AsyncIterable` protocols — safe to yield from an (async) generator without triggering auto-await 9 + - `map(run, items, { concurrency, signal })` dispatches an iterable or async iterable of tasks to a `Runner` with bounded concurrency, yielding results in completion order; accepts mixed task types (`Task<string> | Task<number>` → `string | number`) 10 + - New example: `examples/bounded-map` — recursive directory walk hashing every file with bounded concurrency 11 + - `Task<T, A>` now carries a type-only arg brand to enable accurate result inference through `map()`; live tasks returned by `mo()` continue to be `PromiseLike<T>` / `AsyncIterable<T>` as before 12 + 13 + - 4ef12db: Add `isTask()` type guard for narrowing tasks to a specific moroutine 14 + 15 + ```ts 16 + if (isTask(isPrime, task)) { 17 + // task: Task<boolean, [n: number]> 18 + const [n] = task.args; 19 + } 20 + ``` 21 + 22 + - Moroutines returned by `mo()` now expose a readonly `id` for stable identity 23 + - `isTask(mo, task)` returns `true` when `task` was produced by `mo`, and narrows the task to the descriptor type produced by that moroutine 24 + - `Task<T, A>.args` is now typed as `A` (previously `unknown[]`) so narrowing propagates to argument access — unchanged for `Task<T>` without a specialized arg tuple 25 + 26 + ### Patch Changes 27 + 28 + - e2cebd5: Fix `Cannot find module .../dist/worker-entry.ts` when consuming the published build. The worker entry URL was hardcoded to `./worker-entry.ts` as a string literal, so tsc's extension rewriting (which only handles import specifiers) left it unchanged in `dist/*.js`. Now derived from `import.meta.url` so src uses `.ts` and dist uses `.js`. 29 + 3 30 ## 1.0.0 4 31 5 32 ### Major Changes
+1 -1
package.json
··· 1 1 { 2 2 "name": "moroutine", 3 - "version": "1.0.0", 3 + "version": "1.1.0", 4 4 "repository": { 5 5 "type": "git", 6 6 "url": "git@tangled.org:divy.zone/moroutine"