nanoeffects 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +2 -1
  2. package/dist/actions.d.ts +2 -2
  3. package/dist/context-types-qXxr_Grf.d.ts +14 -0
  4. package/dist/context.d.ts +25 -0
  5. package/dist/context.js +1 -0
  6. package/dist/dev.d.ts +1 -1
  7. package/dist/effects.d.ts +1 -1
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.js +1 -1
  10. package/dist/{module-woawvR28.d.ts → module-COv9ZSzS.d.ts} +1 -1
  11. package/dist/notrace/actions.d.ts +1 -1
  12. package/dist/notrace/context-types-DQYBFJG4.d.ts +14 -0
  13. package/dist/notrace/effects.d.ts +1 -1
  14. package/dist/notrace/index.d.ts +2 -2
  15. package/dist/notrace/index.js +1 -1
  16. package/dist/notrace/{plugin-Cw45_-Bo.d.ts → plugin-W4pZY7mM.d.ts} +1 -1
  17. package/dist/observable.d.ts +29 -0
  18. package/dist/observable.js +1 -1
  19. package/dist/oop.d.ts +48 -0
  20. package/dist/oop.js +1 -1
  21. package/dist/{plugin-BrTsPg2Y.d.ts → plugin-15-kkZp0.d.ts} +1 -1
  22. package/dist/scope.d.ts +1 -1
  23. package/dist/{types-bzocBVYc.d.ts → types-C7ukMwE-.d.ts} +1 -1
  24. package/docs/cancel-stale-requests.md +6 -2
  25. package/docs/context.md +3 -2
  26. package/docs/debounce-and-abort.md +1 -3
  27. package/docs/effects.md +10 -3
  28. package/docs/observable.md +50 -0
  29. package/docs/oop.md +126 -4
  30. package/docs/package.md +1 -0
  31. package/docs/plugins.md +12 -4
  32. package/docs/stores.md +4 -2
  33. package/docs/tracing.md +34 -8
  34. package/docs/typescript.md +2 -1
  35. package/llms-full.txt +249 -29
  36. package/llms.txt +2 -2
  37. package/package.json +12 -3
  38. package/dist/context-plugin-Cphk8jfq.d.ts +0 -34
  39. package/dist/notrace/context-plugin-BQa-wtbj.d.ts +0 -34
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nanoeffects",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "description": "Cancel stale async work and fix race conditions in event handlers: a typed event bus where every handler is a task with an AbortSignal, plus latest, debounce, throttle, queue, retry, timeout and poll. About 1.4 kB gzip.",
5
5
  "keywords": [
6
6
  "event-bus",
@@ -40,7 +40,7 @@
40
40
  "node": ">=18"
41
41
  },
42
42
  "type": "module",
43
- "packageManager": "pnpm@11.13.0",
43
+ "packageManager": "pnpm@11.28.9",
44
44
  "sideEffects": false,
45
45
  "files": [
46
46
  "dist",
@@ -98,6 +98,10 @@
98
98
  "types": "./dist/signal.d.ts",
99
99
  "import": "./dist/signal.js"
100
100
  },
101
+ "./context": {
102
+ "types": "./dist/context.d.ts",
103
+ "import": "./dist/context.js"
104
+ },
101
105
  "./oop": {
102
106
  "types": "./dist/oop.d.ts",
103
107
  "import": "./dist/oop.js"
@@ -214,10 +218,15 @@
214
218
  "path": "dist/signal.js",
215
219
  "limit": "0.6 kB"
216
220
  },
221
+ {
222
+ "name": "context (plugin)",
223
+ "path": "dist/context.js",
224
+ "limit": "0.2 kB"
225
+ },
217
226
  {
218
227
  "name": "oop (class entry)",
219
228
  "path": "dist/oop.js",
220
- "limit": "2.5 kB"
229
+ "limit": "2.6 kB"
221
230
  },
222
231
  {
223
232
  "name": "scope (plugin and effect)",
@@ -1,34 +0,0 @@
1
- import { B as EventMap, N as WithContext, h as Bus, x as ContextOf } from "./action-creator-CQlFgQm4.js";
2
- //#region src/core/context-plugin.d.ts
3
- /** What a function that makes the fields of a task gets to see. */
4
- type ContextTask = {
5
- type: string;
6
- payload?: unknown;
7
- };
8
- /**
9
- * `unknown` when none of the `fields` is already a context field of the bus,
10
- * else `never`: the call does not compile. Used as `bus: Bus<E> & NoClash<…>`.
11
- */
12
- type NoClash<Fields extends object, E extends EventMap> = [keyof Fields & keyof ContextOf<E>] extends [never] ? unknown : never;
13
- /**
14
- * Puts `fields` on the context of every task of the bus: a store, a client, a
15
- * logger. The types come from the value, so the event map needs no
16
- * `WithContext`. Returns the same bus, typed with the fields. A function gets
17
- * `{ type, payload }` of the task and returns its fields.
18
- *
19
- * Several uses merge with each other, with the `context` option of `createBus`
20
- * and with `effectsPlugin`. A name that the bus already has is a type error. The
21
- * fields of the library (`signal`, `emit`, `run`, …) win, and a field that the
22
- * context already has is not replaced.
23
- *
24
- * @example
25
- * ```ts
26
- * type Events = { "user/loaded": User };
27
- *
28
- * const bus = createBus<Events>().use(contextPlugin({ store }));
29
- * bus.on("user/loaded", (user, { store }) => store.put(user)); // ctx.store: Store
30
- * ```
31
- */
32
- declare const contextPlugin: <Fields extends object>(fields: Fields | ((task: ContextTask) => Fields)) => <E extends EventMap>(bus: Bus<E> & NoClash<Fields, E>) => Bus<E & WithContext<Fields>>;
33
- //#endregion
34
- export { NoClash as n, contextPlugin as r, ContextTask as t };
@@ -1,34 +0,0 @@
1
- import { R as EventMap, j as WithContext, p as Bus, y as ContextOf } from "./action-creator-Ls3Gy3jk.js";
2
- //#region src/core/context-plugin.d.ts
3
- /** What a function that makes the fields of a task gets to see. */
4
- type ContextTask = {
5
- type: string;
6
- payload?: unknown;
7
- };
8
- /**
9
- * `unknown` when none of the `fields` is already a context field of the bus,
10
- * else `never`: the call does not compile. Used as `bus: Bus<E> & NoClash<…>`.
11
- */
12
- type NoClash<Fields extends object, E extends EventMap> = [keyof Fields & keyof ContextOf<E>] extends [never] ? unknown : never;
13
- /**
14
- * Puts `fields` on the context of every task of the bus: a store, a client, a
15
- * logger. The types come from the value, so the event map needs no
16
- * `WithContext`. Returns the same bus, typed with the fields. A function gets
17
- * `{ type, payload }` of the task and returns its fields.
18
- *
19
- * Several uses merge with each other, with the `context` option of `createBus`
20
- * and with `effectsPlugin`. A name that the bus already has is a type error. The
21
- * fields of the library (`signal`, `emit`, `run`, …) win, and a field that the
22
- * context already has is not replaced.
23
- *
24
- * @example
25
- * ```ts
26
- * type Events = { "user/loaded": User };
27
- *
28
- * const bus = createBus<Events>().use(contextPlugin({ store }));
29
- * bus.on("user/loaded", (user, { store }) => store.put(user)); // ctx.store: Store
30
- * ```
31
- */
32
- declare const contextPlugin: <Fields extends object>(fields: Fields | ((task: ContextTask) => Fields)) => <E extends EventMap>(bus: Bus<E> & NoClash<Fields, E>) => Bus<E & WithContext<Fields>>;
33
- //#endregion
34
- export { NoClash as n, contextPlugin as r, ContextTask as t };