@vielzeug/flux 2.0.3 → 2.0.5
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.
- package/dist/_iterator.cjs +1 -1
- package/dist/_iterator.cjs.map +1 -1
- package/dist/_iterator.d.ts.map +1 -1
- package/dist/_iterator.js +4 -6
- package/dist/_iterator.js.map +1 -1
- package/dist/_numeric.cjs +1 -1
- package/dist/_numeric.cjs.map +1 -1
- package/dist/_numeric.d.ts +1 -0
- package/dist/_numeric.d.ts.map +1 -1
- package/dist/_numeric.js +7 -1
- package/dist/_numeric.js.map +1 -1
- package/dist/_subscription.cjs.map +1 -1
- package/dist/_subscription.d.ts +1 -1
- package/dist/_subscription.d.ts.map +1 -1
- package/dist/_subscription.js.map +1 -1
- package/dist/adapters/courier.cjs +1 -1
- package/dist/adapters/courier.cjs.map +1 -1
- package/dist/adapters/courier.d.ts +0 -5
- package/dist/adapters/courier.d.ts.map +1 -1
- package/dist/adapters/courier.js +1 -22
- package/dist/adapters/courier.js.map +1 -1
- package/dist/adapters/herald.cjs.map +1 -1
- package/dist/adapters/herald.d.ts.map +1 -1
- package/dist/adapters/herald.js.map +1 -1
- package/dist/adapters/pulse.cjs.map +1 -1
- package/dist/adapters/pulse.d.ts.map +1 -1
- package/dist/adapters/pulse.js.map +1 -1
- package/dist/adapters/ripple.cjs.map +1 -1
- package/dist/adapters/ripple.d.ts.map +1 -1
- package/dist/adapters/ripple.js.map +1 -1
- package/dist/async.cjs.map +1 -1
- package/dist/async.d.ts.map +1 -1
- package/dist/async.js.map +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/courier.cjs +1 -1
- package/dist/courier.d.ts +1 -1
- package/dist/courier.d.ts.map +1 -1
- package/dist/courier.js +2 -2
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -4
- package/dist/errors.js.map +1 -1
- package/dist/flux.cjs +1 -1
- package/dist/flux.cjs.map +1 -1
- package/dist/flux.iife.js +1 -1
- package/dist/flux.iife.js.map +1 -1
- package/dist/flux.js +1 -1
- package/dist/flux.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/operators/combination.cjs.map +1 -1
- package/dist/operators/combination.d.ts.map +1 -1
- package/dist/operators/combination.js.map +1 -1
- package/dist/operators/creation.cjs +1 -1
- package/dist/operators/creation.cjs.map +1 -1
- package/dist/operators/creation.d.ts.map +1 -1
- package/dist/operators/creation.js +40 -42
- package/dist/operators/creation.js.map +1 -1
- package/dist/operators/filtering.cjs +1 -1
- package/dist/operators/filtering.cjs.map +1 -1
- package/dist/operators/filtering.d.ts.map +1 -1
- package/dist/operators/filtering.js +44 -47
- package/dist/operators/filtering.js.map +1 -1
- package/dist/operators/transformation.cjs +1 -1
- package/dist/operators/transformation.cjs.map +1 -1
- package/dist/operators/transformation.d.ts.map +1 -1
- package/dist/operators/transformation.js +68 -68
- package/dist/operators/transformation.js.map +1 -1
- package/dist/operators/utility.cjs +1 -1
- package/dist/operators/utility.cjs.map +1 -1
- package/dist/operators/utility.d.ts.map +1 -1
- package/dist/operators/utility.js +45 -46
- package/dist/operators/utility.js.map +1 -1
- package/dist/pipe.cjs.map +1 -1
- package/dist/pipe.d.ts.map +1 -1
- package/dist/pipe.js.map +1 -1
- package/dist/ripple.d.ts +1 -1
- package/dist/ripple.d.ts.map +1 -1
- package/dist/subject.cjs +1 -1
- package/dist/subject.cjs.map +1 -1
- package/dist/subject.d.ts.map +1 -1
- package/dist/subject.js +9 -9
- package/dist/subject.js.map +1 -1
- package/dist/subjects.d.ts +1 -1
- package/dist/subjects.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +54 -54
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { assertNonNegativeInteger as e } from "../_numeric.js";
|
|
2
|
+
import { stream as t } from "../core.js";
|
|
3
|
+
import { link as n } from "../_link.js";
|
|
4
|
+
import { tryCall as r } from "../_safe.js";
|
|
5
|
+
import { defaultScheduler as i } from "../_scheduler.js";
|
|
5
6
|
//#region src/operators/utility.ts
|
|
6
|
-
function
|
|
7
|
+
function a() {
|
|
7
8
|
return new DOMException("Stream consumption aborted", "AbortError");
|
|
8
9
|
}
|
|
9
|
-
function a
|
|
10
|
-
|
|
11
|
-
return (a) => e((e, o) => {
|
|
10
|
+
function o(a) {
|
|
11
|
+
return e(a.attempts, "retry attempts"), (e) => t((t, o) => {
|
|
12
12
|
let s = 0, c, l, u = () => {
|
|
13
13
|
if (o.aborted) return;
|
|
14
|
-
let d =
|
|
15
|
-
complete:
|
|
16
|
-
error(
|
|
17
|
-
if (s ===
|
|
18
|
-
|
|
14
|
+
let d = n(e, {
|
|
15
|
+
complete: t.complete,
|
|
16
|
+
error(e) {
|
|
17
|
+
if (s === a.attempts) {
|
|
18
|
+
t.error(e);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
c = typeof
|
|
24
|
-
},
|
|
21
|
+
let n = s++, c;
|
|
22
|
+
if (r(() => {
|
|
23
|
+
c = typeof a.delay == "function" ? a.delay(n) : a.delay;
|
|
24
|
+
}, t.error), !o.aborted) {
|
|
25
25
|
if (c !== void 0 && (!Number.isFinite(c) || c < 0)) {
|
|
26
|
-
|
|
26
|
+
t.error(/* @__PURE__ */ RangeError("retry delay must be a finite number greater than or equal to zero"));
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
c === void 0 || c === 0 ? queueMicrotask(u) : l =
|
|
29
|
+
c === void 0 || c === 0 ? queueMicrotask(u) : l = i.delay(u, c);
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
next:
|
|
32
|
+
next: t.next
|
|
33
33
|
}, o);
|
|
34
34
|
d.closed || (c = d);
|
|
35
35
|
};
|
|
@@ -38,65 +38,64 @@ function a(i) {
|
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
return new Promise((r,
|
|
41
|
+
function s(e, t) {
|
|
42
|
+
return new Promise((r, i) => {
|
|
43
43
|
let o = new AbortController(), s = () => {
|
|
44
|
-
o.abort(), a(
|
|
44
|
+
o.abort(), i(a());
|
|
45
45
|
};
|
|
46
|
-
if (
|
|
46
|
+
if (t?.signal?.aborted) {
|
|
47
47
|
s();
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
t?.signal?.addEventListener("abort", s, { once: !0 }), n(e, {
|
|
51
51
|
error(e) {
|
|
52
|
-
|
|
52
|
+
t?.signal?.removeEventListener("abort", s), i(e);
|
|
53
53
|
},
|
|
54
54
|
next(e) {
|
|
55
|
-
|
|
55
|
+
t?.signal?.removeEventListener("abort", s), o.abort(), r(e);
|
|
56
56
|
}
|
|
57
57
|
}, o.signal);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
return new Promise((r,
|
|
62
|
-
let o = () => a(
|
|
63
|
-
if (
|
|
60
|
+
function c(e, t) {
|
|
61
|
+
return new Promise((r, i) => {
|
|
62
|
+
let o = () => i(a()), s;
|
|
63
|
+
if (t?.signal?.aborted) {
|
|
64
64
|
o();
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
t?.signal?.addEventListener("abort", o, { once: !0 }), n(e, {
|
|
68
68
|
complete() {
|
|
69
|
-
|
|
69
|
+
t?.signal?.removeEventListener("abort", o), r(s);
|
|
70
70
|
},
|
|
71
71
|
error(e) {
|
|
72
|
-
|
|
72
|
+
t?.signal?.removeEventListener("abort", o), i(e);
|
|
73
73
|
},
|
|
74
74
|
next(e) {
|
|
75
75
|
s = e;
|
|
76
76
|
}
|
|
77
|
-
},
|
|
77
|
+
}, t?.signal ?? new AbortController().signal);
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
return new Promise((r, a) => {
|
|
80
|
+
function l(t, r) {
|
|
81
|
+
return e(r.maxItems, "toArray maxItems"), new Promise((e, i) => {
|
|
83
82
|
let o = new AbortController(), s = [], c = () => {
|
|
84
|
-
o.abort(), a(
|
|
83
|
+
o.abort(), i(a());
|
|
85
84
|
};
|
|
86
|
-
if (
|
|
85
|
+
if (r.signal?.aborted) {
|
|
87
86
|
c();
|
|
88
87
|
return;
|
|
89
88
|
}
|
|
90
|
-
|
|
89
|
+
r.signal?.addEventListener("abort", c, { once: !0 }), n(t, {
|
|
91
90
|
complete() {
|
|
92
|
-
|
|
91
|
+
r.signal?.removeEventListener("abort", c), e(s);
|
|
93
92
|
},
|
|
94
93
|
error(e) {
|
|
95
|
-
|
|
94
|
+
r.signal?.removeEventListener("abort", c), i(e);
|
|
96
95
|
},
|
|
97
96
|
next(e) {
|
|
98
|
-
if (s.length ===
|
|
99
|
-
|
|
97
|
+
if (s.length === r.maxItems) {
|
|
98
|
+
r.signal?.removeEventListener("abort", c), o.abort(), i(/* @__PURE__ */ RangeError("toArray maxItems exceeded"));
|
|
100
99
|
return;
|
|
101
100
|
}
|
|
102
101
|
s.push(e);
|
|
@@ -105,6 +104,6 @@ function c(e, n) {
|
|
|
105
104
|
});
|
|
106
105
|
}
|
|
107
106
|
//#endregion
|
|
108
|
-
export {
|
|
107
|
+
export { s as first, c as last, o as retry, l as toArray };
|
|
109
108
|
|
|
110
109
|
//# sourceMappingURL=utility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility.js","names":[],"sources":["../../src/operators/utility.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"utility.js","names":[],"sources":["../../src/operators/utility.ts"],"sourcesContent":["import { link } from '../_link';\nimport { assertNonNegativeInteger } from '../_numeric';\nimport { tryCall } from '../_safe';\nimport { defaultScheduler } from '../_scheduler';\nimport { stream } from '../core';\nimport type { Operator, Stream, Subscription } from '../types';\n\nexport type RetryOptions = {\n attempts: number;\n delay?: number | ((attempt: number) => number);\n};\n\nexport type ToArrayOptions = {\n maxItems: number;\n signal?: AbortSignal;\n};\n\nexport type ValueOptions = {\n signal?: AbortSignal;\n};\n\nfunction abortError(): DOMException {\n return new DOMException('Stream consumption aborted', 'AbortError');\n}\n\nexport function retry<T>(options: RetryOptions): Operator<T, T> {\n assertNonNegativeInteger(options.attempts, 'retry attempts');\n\n return (source) =>\n stream((sink, signal) => {\n let attempts = 0;\n let current: Subscription | undefined;\n let cancelDelay: (() => void) | undefined;\n\n const start = (): void => {\n if (signal.aborted) return;\n\n const subscription = link(\n source,\n {\n complete: sink.complete,\n error(reason) {\n if (attempts === options.attempts) {\n sink.error(reason);\n\n return;\n }\n\n const attempt = attempts++;\n let delay: number | undefined;\n\n tryCall(() => {\n delay = typeof options.delay === 'function' ? options.delay(attempt) : options.delay;\n }, sink.error);\n\n if (signal.aborted) return;\n\n if (delay !== undefined && (!Number.isFinite(delay) || delay < 0)) {\n sink.error(new RangeError('retry delay must be a finite number greater than or equal to zero'));\n\n return;\n }\n\n if (delay === undefined || delay === 0) {\n queueMicrotask(start);\n } else {\n cancelDelay = defaultScheduler.delay(start, delay);\n }\n },\n next: sink.next,\n },\n signal,\n );\n\n if (!subscription.closed) current = subscription;\n };\n\n start();\n\n return () => {\n cancelDelay?.();\n current?.unsubscribe();\n };\n });\n}\n\nexport function first<T>(source: Stream<T>, options?: ValueOptions): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const controller = new AbortController();\n const abort = (): void => {\n controller.abort();\n reject(abortError());\n };\n\n if (options?.signal?.aborted) {\n abort();\n\n return;\n }\n\n options?.signal?.addEventListener('abort', abort, { once: true });\n link(\n source,\n {\n error(reason) {\n options?.signal?.removeEventListener('abort', abort);\n reject(reason);\n },\n next(value) {\n options?.signal?.removeEventListener('abort', abort);\n controller.abort();\n resolve(value);\n },\n },\n controller.signal,\n );\n });\n}\n\nexport function last<T>(source: Stream<T>, options?: ValueOptions): Promise<T | undefined> {\n return new Promise<T | undefined>((resolve, reject) => {\n const abort = (): void => reject(abortError());\n let latest: T | undefined;\n\n if (options?.signal?.aborted) {\n abort();\n\n return;\n }\n\n options?.signal?.addEventListener('abort', abort, { once: true });\n link(\n source,\n {\n complete() {\n options?.signal?.removeEventListener('abort', abort);\n resolve(latest);\n },\n error(reason) {\n options?.signal?.removeEventListener('abort', abort);\n reject(reason);\n },\n next(value) {\n latest = value;\n },\n },\n options?.signal ?? new AbortController().signal,\n );\n });\n}\n\nexport function toArray<T>(source: Stream<T>, options: ToArrayOptions): Promise<T[]> {\n assertNonNegativeInteger(options.maxItems, 'toArray maxItems');\n\n return new Promise<T[]>((resolve, reject) => {\n const controller = new AbortController();\n const values: T[] = [];\n const abort = (): void => {\n controller.abort();\n reject(abortError());\n };\n\n if (options.signal?.aborted) {\n abort();\n\n return;\n }\n\n options.signal?.addEventListener('abort', abort, { once: true });\n link(\n source,\n {\n complete() {\n options.signal?.removeEventListener('abort', abort);\n resolve(values);\n },\n error(reason) {\n options.signal?.removeEventListener('abort', abort);\n reject(reason);\n },\n next(value) {\n if (values.length === options.maxItems) {\n options.signal?.removeEventListener('abort', abort);\n controller.abort();\n reject(new RangeError('toArray maxItems exceeded'));\n\n return;\n }\n\n values.push(value);\n },\n },\n controller.signal,\n );\n });\n}\n"],"mappings":";;;;;;AAqBA,SAAS,IAA2B;CAClC,OAAO,IAAI,aAAa,8BAA8B,YAAY;AACpE;AAEA,SAAgB,EAAS,GAAuC;CAG9D,OAFA,EAAyB,EAAQ,UAAU,gBAAgB,IAEnD,MACN,GAAQ,GAAM,MAAW;EACvB,IAAI,IAAW,GACX,GACA,GAEE,UAAoB;GACxB,IAAI,EAAO,SAAS;GAEpB,IAAM,IAAe,EACnB,GACA;IACE,UAAU,EAAK;IACf,MAAM,GAAQ;KACZ,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 @@
|
|
|
1
|
-
{"version":3,"file":"pipe.cjs","names":[],"sources":["../src/pipe.ts"],"sourcesContent":["import type { Operator, PipedStream, Stream, ValidPipe } from './types';\n\
|
|
1
|
+
{"version":3,"file":"pipe.cjs","names":[],"sources":["../src/pipe.ts"],"sourcesContent":["import { applyOperators } from './_pipe';\nimport type { Operator, PipedStream, Stream, ValidPipe } from './types';\n\n/** Standalone composition preserves contextual types for inline generic operators. */\nexport function pipe<Input>(source: Stream<Input>): Stream<Input>;\nexport function pipe<Input, A>(source: Stream<Input>, operator1: Operator<Input, A>): Stream<A>;\nexport function pipe<Input, A, B>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n): Stream<B>;\nexport function pipe<Input, A, B, C>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n): Stream<C>;\nexport function pipe<Input, A, B, C, D>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n): Stream<D>;\nexport function pipe<Input, A, B, C, D, E>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n): Stream<E>;\nexport function pipe<Input, A, B, C, D, E, F>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n operator6: Operator<E, F>,\n): Stream<F>;\nexport function pipe<Input, A, B, C, D, E, F, G>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n operator6: Operator<E, F>,\n operator7: Operator<F, G>,\n): Stream<G>;\nexport function pipe<Input, A, B, C, D, E, F, G, H>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n operator6: Operator<E, F>,\n operator7: Operator<F, G>,\n operator8: Operator<G, H>,\n): Stream<H>;\nexport function pipe<Input, A, B, C, D, E, F, G, H, I>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n operator6: Operator<E, F>,\n operator7: Operator<F, G>,\n operator8: Operator<G, H>,\n operator9: Operator<H, I>,\n): Stream<I>;\nexport function pipe<Input, A, B, C, D, E, F, G, H, I, J>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n operator6: Operator<E, F>,\n operator7: Operator<F, G>,\n operator8: Operator<G, H>,\n operator9: Operator<H, I>,\n operator10: Operator<I, J>,\n): Stream<J>;\nexport function pipe<Input, const Operators extends readonly unknown[]>(\n source: Stream<Input>,\n ...operators: Operators & ValidPipe<Input, Operators>\n): PipedStream<Input, Operators>;\nexport function pipe<Input, const Operators extends readonly unknown[]>(\n source: Stream<Input>,\n ...operators: Operators & ValidPipe<Input, Operators>\n): PipedStream<Input, Operators> {\n return applyOperators(source as Stream<unknown>, operators) as PipedStream<Input, Operators>;\n}\n"],"mappings":"+BA2FA,SAAgB,EACd,EACA,GAAG,EAC4B,CAC/B,OAAO,EAAA,eAAe,EAA2B,CAAS,CAC5D"}
|
package/dist/pipe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["../src/pipe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["../src/pipe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EA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CAAC,CAAC,GACzB,MAAM,CAAC,CAAC,CAAC,CAAC;AACb,wBAAgB,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,SAAS,SAAS,OAAO,EAAE,EACpE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,EACrB,GAAG,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,GACpD,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC"}
|
package/dist/pipe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipe.js","names":[],"sources":["../src/pipe.ts"],"sourcesContent":["import type { Operator, PipedStream, Stream, ValidPipe } from './types';\n\
|
|
1
|
+
{"version":3,"file":"pipe.js","names":[],"sources":["../src/pipe.ts"],"sourcesContent":["import { applyOperators } from './_pipe';\nimport type { Operator, PipedStream, Stream, ValidPipe } from './types';\n\n/** Standalone composition preserves contextual types for inline generic operators. */\nexport function pipe<Input>(source: Stream<Input>): Stream<Input>;\nexport function pipe<Input, A>(source: Stream<Input>, operator1: Operator<Input, A>): Stream<A>;\nexport function pipe<Input, A, B>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n): Stream<B>;\nexport function pipe<Input, A, B, C>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n): Stream<C>;\nexport function pipe<Input, A, B, C, D>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n): Stream<D>;\nexport function pipe<Input, A, B, C, D, E>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n): Stream<E>;\nexport function pipe<Input, A, B, C, D, E, F>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n operator6: Operator<E, F>,\n): Stream<F>;\nexport function pipe<Input, A, B, C, D, E, F, G>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n operator6: Operator<E, F>,\n operator7: Operator<F, G>,\n): Stream<G>;\nexport function pipe<Input, A, B, C, D, E, F, G, H>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n operator6: Operator<E, F>,\n operator7: Operator<F, G>,\n operator8: Operator<G, H>,\n): Stream<H>;\nexport function pipe<Input, A, B, C, D, E, F, G, H, I>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n operator6: Operator<E, F>,\n operator7: Operator<F, G>,\n operator8: Operator<G, H>,\n operator9: Operator<H, I>,\n): Stream<I>;\nexport function pipe<Input, A, B, C, D, E, F, G, H, I, J>(\n source: Stream<Input>,\n operator1: Operator<Input, A>,\n operator2: Operator<A, B>,\n operator3: Operator<B, C>,\n operator4: Operator<C, D>,\n operator5: Operator<D, E>,\n operator6: Operator<E, F>,\n operator7: Operator<F, G>,\n operator8: Operator<G, H>,\n operator9: Operator<H, I>,\n operator10: Operator<I, J>,\n): Stream<J>;\nexport function pipe<Input, const Operators extends readonly unknown[]>(\n source: Stream<Input>,\n ...operators: Operators & ValidPipe<Input, Operators>\n): PipedStream<Input, Operators>;\nexport function pipe<Input, const Operators extends readonly unknown[]>(\n source: Stream<Input>,\n ...operators: Operators & ValidPipe<Input, Operators>\n): PipedStream<Input, Operators> {\n return applyOperators(source as Stream<unknown>, operators) as PipedStream<Input, Operators>;\n}\n"],"mappings":";;AA2FA,SAAgB,EACd,GACA,GAAG,GAC4B;CAC/B,OAAO,EAAe,GAA2B,CAAS;AAC5D"}
|
package/dist/ripple.d.ts
CHANGED
package/dist/ripple.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ripple.d.ts","sourceRoot":"","sources":["../src/ripple.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ripple.d.ts","sourceRoot":"","sources":["../src/ripple.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/subject.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./
|
|
1
|
+
const e=require("./_numeric.cjs"),t=require("./core.cjs");function n(t){let n=t.replay??+(`initial`in t);return e.assertNonNegativeInteger(n,`Channel replay`),n}function r(e={}){let r=n(e),i=new AbortController,a=new Set,o=[];`initial`in e&&r>0&&o.push(e.initial);let s=t.stream(e=>{for(let t of o)e.next(t);if(i.signal.aborted){e.complete();return}return a.add(e),()=>a.delete(e)}),c=()=>{if(!i.signal.aborted){i.abort();for(let e of[...a])e.complete();a.clear()}};return{get disposalSignal(){return i.signal},dispose:c,get disposed(){return i.signal.aborted},send(e){if(!i.signal.aborted){r>0&&(o.length===r&&o.shift(),o.push(e));for(let t of[...a])t.next(e)}},stream:s,[Symbol.dispose]:c}}exports.createChannel=r;
|
|
2
2
|
//# sourceMappingURL=subject.cjs.map
|
package/dist/subject.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subject.cjs","names":[],"sources":["../src/subject.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"subject.cjs","names":[],"sources":["../src/subject.ts"],"sourcesContent":["import { assertNonNegativeInteger } from './_numeric';\nimport { stream } from './core';\nimport type { Sink, Stream } from './types';\n\nexport type ChannelOptions<T> = {\n initial?: T;\n replay?: number;\n};\n\nexport type Channel<T> = {\n [Symbol.dispose](): void;\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n send(value: T): void;\n readonly stream: Stream<T>;\n};\n\nfunction replayCapacity<T>(options: ChannelOptions<T>): number {\n const capacity = options.replay ?? ('initial' in options ? 1 : 0);\n\n assertNonNegativeInteger(capacity, 'Channel replay');\n\n return capacity;\n}\n\n/** Channels own mutable multicast state; disposal is their only terminal event. */\nexport function createChannel<T>(options: ChannelOptions<T> = {}): Channel<T> {\n const capacity = replayCapacity(options);\n const controller = new AbortController();\n const listeners = new Set<Sink<T>>();\n const replay: T[] = [];\n\n if ('initial' in options && capacity > 0) replay.push(options.initial as T);\n\n const source = stream<T>((sink) => {\n for (const value of replay) sink.next(value);\n\n if (controller.signal.aborted) {\n sink.complete();\n\n return;\n }\n\n listeners.add(sink);\n\n return () => listeners.delete(sink);\n });\n\n const dispose = (): void => {\n if (controller.signal.aborted) return;\n\n controller.abort();\n\n for (const listener of [...listeners]) listener.complete();\n\n listeners.clear();\n };\n\n return {\n get disposalSignal(): AbortSignal {\n return controller.signal;\n },\n dispose,\n get disposed(): boolean {\n return controller.signal.aborted;\n },\n send(value: T): void {\n if (controller.signal.aborted) return;\n\n if (capacity > 0) {\n if (replay.length === capacity) replay.shift();\n\n replay.push(value);\n }\n\n for (const listener of [...listeners]) listener.next(value);\n },\n stream: source,\n [Symbol.dispose]: dispose,\n };\n}\n"],"mappings":"0DAkBA,SAAS,EAAkB,EAAoC,CAC7D,IAAM,EAAW,EAAQ,QAAW,cAAa,GAIjD,OAFA,EAAA,yBAAyB,EAAU,gBAAgB,EAE5C,CACT,CAGA,SAAgB,EAAiB,EAA6B,CAAC,EAAe,CAC5E,IAAM,EAAW,EAAe,CAAO,EACjC,EAAa,IAAI,gBACjB,EAAY,IAAI,IAChB,EAAc,CAAC,EAEjB,YAAa,GAAW,EAAW,GAAG,EAAO,KAAK,EAAQ,OAAY,EAE1E,IAAM,EAAS,EAAA,OAAW,GAAS,CACjC,IAAK,IAAM,KAAS,EAAQ,EAAK,KAAK,CAAK,EAE3C,GAAI,EAAW,OAAO,QAAS,CAC7B,EAAK,SAAS,EAEd,MACF,CAIA,OAFA,EAAU,IAAI,CAAI,MAEL,EAAU,OAAO,CAAI,CACpC,CAAC,EAEK,MAAsB,CACtB,MAAW,OAAO,QAEtB,GAAW,MAAM,EAEjB,IAAK,IAAM,IAAY,CAAC,GAAG,CAAS,EAAG,EAAS,SAAS,EAEzD,EAAU,MAAM,CAJC,CAKnB,EAEA,MAAO,CACL,IAAI,gBAA8B,CAChC,OAAO,EAAW,MACpB,EACA,UACA,IAAI,UAAoB,CACtB,OAAO,EAAW,OAAO,OAC3B,EACA,KAAK,EAAgB,CACf,MAAW,OAAO,QAEtB,CAAI,EAAW,IACT,EAAO,SAAW,GAAU,EAAO,MAAM,EAE7C,EAAO,KAAK,CAAK,GAGnB,IAAK,IAAM,IAAY,CAAC,GAAG,CAAS,EAAG,EAAS,KAAK,CAAK,CAF1D,CAGF,EACA,OAAQ,GACP,OAAO,SAAU,CACpB,CACF"}
|
package/dist/subject.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subject.d.ts","sourceRoot":"","sources":["../src/subject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subject.d.ts","sourceRoot":"","sources":["../src/subject.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IACvB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC;IACrC,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CAC5B,CAAC;AAUF,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAE,cAAc,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAsD5E"}
|
package/dist/subject.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { assertNonNegativeInteger as e } from "./_numeric.js";
|
|
2
|
+
import { stream as t } from "./core.js";
|
|
3
3
|
//#region src/subject.ts
|
|
4
|
-
function n(
|
|
5
|
-
let n =
|
|
6
|
-
return
|
|
4
|
+
function n(t) {
|
|
5
|
+
let n = t.replay ?? +("initial" in t);
|
|
6
|
+
return e(n, "Channel replay"), n;
|
|
7
7
|
}
|
|
8
|
-
function r(
|
|
9
|
-
let r = n(
|
|
10
|
-
"initial" in
|
|
11
|
-
let s =
|
|
8
|
+
function r(e = {}) {
|
|
9
|
+
let r = n(e), i = new AbortController(), a = /* @__PURE__ */ new Set(), o = [];
|
|
10
|
+
"initial" in e && r > 0 && o.push(e.initial);
|
|
11
|
+
let s = t((e) => {
|
|
12
12
|
for (let t of o) e.next(t);
|
|
13
13
|
if (i.signal.aborted) {
|
|
14
14
|
e.complete();
|
package/dist/subject.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subject.js","names":[],"sources":["../src/subject.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"subject.js","names":[],"sources":["../src/subject.ts"],"sourcesContent":["import { assertNonNegativeInteger } from './_numeric';\nimport { stream } from './core';\nimport type { Sink, Stream } from './types';\n\nexport type ChannelOptions<T> = {\n initial?: T;\n replay?: number;\n};\n\nexport type Channel<T> = {\n [Symbol.dispose](): void;\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n send(value: T): void;\n readonly stream: Stream<T>;\n};\n\nfunction replayCapacity<T>(options: ChannelOptions<T>): number {\n const capacity = options.replay ?? ('initial' in options ? 1 : 0);\n\n assertNonNegativeInteger(capacity, 'Channel replay');\n\n return capacity;\n}\n\n/** Channels own mutable multicast state; disposal is their only terminal event. */\nexport function createChannel<T>(options: ChannelOptions<T> = {}): Channel<T> {\n const capacity = replayCapacity(options);\n const controller = new AbortController();\n const listeners = new Set<Sink<T>>();\n const replay: T[] = [];\n\n if ('initial' in options && capacity > 0) replay.push(options.initial as T);\n\n const source = stream<T>((sink) => {\n for (const value of replay) sink.next(value);\n\n if (controller.signal.aborted) {\n sink.complete();\n\n return;\n }\n\n listeners.add(sink);\n\n return () => listeners.delete(sink);\n });\n\n const dispose = (): void => {\n if (controller.signal.aborted) return;\n\n controller.abort();\n\n for (const listener of [...listeners]) listener.complete();\n\n listeners.clear();\n };\n\n return {\n get disposalSignal(): AbortSignal {\n return controller.signal;\n },\n dispose,\n get disposed(): boolean {\n return controller.signal.aborted;\n },\n send(value: T): void {\n if (controller.signal.aborted) return;\n\n if (capacity > 0) {\n if (replay.length === capacity) replay.shift();\n\n replay.push(value);\n }\n\n for (const listener of [...listeners]) listener.next(value);\n },\n stream: source,\n [Symbol.dispose]: dispose,\n };\n}\n"],"mappings":";;;AAkBA,SAAS,EAAkB,GAAoC;CAC7D,IAAM,IAAW,EAAQ,UAAW,eAAa;CAIjD,OAFA,EAAyB,GAAU,gBAAgB,GAE5C;AACT;AAGA,SAAgB,EAAiB,IAA6B,CAAC,GAAe;CAC5E,IAAM,IAAW,EAAe,CAAO,GACjC,IAAa,IAAI,gBAAgB,GACjC,oBAAY,IAAI,IAAa,GAC7B,IAAc,CAAC;CAErB,AAAI,aAAa,KAAW,IAAW,KAAG,EAAO,KAAK,EAAQ,OAAY;CAE1E,IAAM,IAAS,GAAW,MAAS;EACjC,KAAK,IAAM,KAAS,GAAQ,EAAK,KAAK,CAAK;EAE3C,IAAI,EAAW,OAAO,SAAS;GAC7B,EAAK,SAAS;GAEd;EACF;EAIA,OAFA,EAAU,IAAI,CAAI,SAEL,EAAU,OAAO,CAAI;CACpC,CAAC,GAEK,UAAsB;EACtB,OAAW,OAAO,SAEtB;KAAW,MAAM;GAEjB,KAAK,IAAM,KAAY,CAAC,GAAG,CAAS,GAAG,EAAS,SAAS;GAEzD,EAAU,MAAM;EAJC;CAKnB;CAEA,OAAO;EACL,IAAI,iBAA8B;GAChC,OAAO,EAAW;EACpB;EACA;EACA,IAAI,WAAoB;GACtB,OAAO,EAAW,OAAO;EAC3B;EACA,KAAK,GAAgB;GACf,OAAW,OAAO,SAEtB;IAAI,IAAW,MACT,EAAO,WAAW,KAAU,EAAO,MAAM,GAE7C,EAAO,KAAK,CAAK;IAGnB,KAAK,IAAM,KAAY,CAAC,GAAG,CAAS,GAAG,EAAS,KAAK,CAAK;GAF1D;EAGF;EACA,QAAQ;GACP,OAAO,UAAU;CACpB;AACF"}
|
package/dist/subjects.d.ts
CHANGED
package/dist/subjects.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subjects.d.ts","sourceRoot":"","sources":["../src/subjects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"subjects.d.ts","sourceRoot":"","sources":["../src/subjects.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type Sink<T> = {
|
|
|
17
17
|
error(reason: unknown): void;
|
|
18
18
|
next(value: T): void;
|
|
19
19
|
};
|
|
20
|
-
export type Producer<T> = (sink: Sink<T>, signal: AbortSignal) => Teardown |
|
|
20
|
+
export type Producer<T> = (sink: Sink<T>, signal: AbortSignal) => Teardown | undefined;
|
|
21
21
|
export type Operator<A = unknown, B = unknown> = (source: Stream<A>) => Stream<B>;
|
|
22
22
|
/** Streams describe reusable work. Subscriptions own lifetime. */
|
|
23
23
|
export interface Stream<T> {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,WAAW,IAAI,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IACpB,QAAQ,IAAI,IAAI,CAAC;IACjB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,KAAK,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,M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AAM,MAAM,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,OAAO,CAAC;AAErE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,cAAc,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,KAAK,UAAU,CAAC,KAAK,EAAE,SAAS,SAAS,SAAS,OAAO,EAAE,IAAI,SAAS,SAAS,SAAS;IACxF,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,CAAC;IAC7B,GAAG,MAAM,SAAS;CACnB,GACG,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,GAC7B,MAAM,CAAC,KAAK,CAAC,CAAC;AAElB,MAAM,MAAM,SAAS,CAAC,KAAK,EAAE,SAAS,SAAS,SAAS,OAAO,EAAE,IAAI,SAAS,SAAS,SAAS,EAAE,GAC9F,EAAE,GACF,SAAS,SAAS,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,CAAC,EAAE,GAAG,MAAM,SAAS,CAAC,GAC5E,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAC1D,KAAK,CAAC;AAEZ,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,SAAS,SAAS,SAAS,OAAO,EAAE,IAAI,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vielzeug/flux",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Minimal push streams with explicit ownership, buffering, and ecosystem adapters",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22"
|
|
8
|
+
},
|
|
6
9
|
"files": [
|
|
7
10
|
"dist"
|
|
8
11
|
],
|
|
@@ -11,63 +14,82 @@
|
|
|
11
14
|
"types": "dist/index.d.ts",
|
|
12
15
|
"exports": {
|
|
13
16
|
".": {
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
17
|
"import": "./dist/index.js",
|
|
16
|
-
"require": "./dist/index.cjs"
|
|
18
|
+
"require": "./dist/index.cjs",
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
17
20
|
},
|
|
18
21
|
"./async": {
|
|
19
|
-
"types": "./dist/async.d.ts",
|
|
20
22
|
"import": "./dist/async.js",
|
|
21
|
-
"require": "./dist/async.cjs"
|
|
23
|
+
"require": "./dist/async.cjs",
|
|
24
|
+
"types": "./dist/async.d.ts"
|
|
22
25
|
},
|
|
23
26
|
"./courier": {
|
|
24
|
-
"types": "./dist/courier.d.ts",
|
|
25
27
|
"import": "./dist/courier.js",
|
|
26
|
-
"require": "./dist/courier.cjs"
|
|
28
|
+
"require": "./dist/courier.cjs",
|
|
29
|
+
"types": "./dist/courier.d.ts"
|
|
27
30
|
},
|
|
28
31
|
"./herald": {
|
|
29
|
-
"types": "./dist/herald.d.ts",
|
|
30
32
|
"import": "./dist/herald.js",
|
|
31
|
-
"require": "./dist/herald.cjs"
|
|
33
|
+
"require": "./dist/herald.cjs",
|
|
34
|
+
"types": "./dist/herald.d.ts"
|
|
32
35
|
},
|
|
33
36
|
"./pulse": {
|
|
34
|
-
"types": "./dist/pulse.d.ts",
|
|
35
37
|
"import": "./dist/pulse.js",
|
|
36
|
-
"require": "./dist/pulse.cjs"
|
|
38
|
+
"require": "./dist/pulse.cjs",
|
|
39
|
+
"types": "./dist/pulse.d.ts"
|
|
37
40
|
},
|
|
38
41
|
"./ripple": {
|
|
39
|
-
"types": "./dist/ripple.d.ts",
|
|
40
42
|
"import": "./dist/ripple.js",
|
|
41
|
-
"require": "./dist/ripple.cjs"
|
|
43
|
+
"require": "./dist/ripple.cjs",
|
|
44
|
+
"types": "./dist/ripple.d.ts"
|
|
42
45
|
},
|
|
43
46
|
"./subjects": {
|
|
44
|
-
"types": "./dist/subjects.d.ts",
|
|
45
47
|
"import": "./dist/subjects.js",
|
|
46
|
-
"require": "./dist/subjects.cjs"
|
|
48
|
+
"require": "./dist/subjects.cjs",
|
|
49
|
+
"types": "./dist/subjects.d.ts"
|
|
47
50
|
}
|
|
48
51
|
},
|
|
52
|
+
"typesVersions": {
|
|
53
|
+
"*": {
|
|
54
|
+
"async": [
|
|
55
|
+
"dist/async.d.ts"
|
|
56
|
+
],
|
|
57
|
+
"courier": [
|
|
58
|
+
"dist/courier.d.ts"
|
|
59
|
+
],
|
|
60
|
+
"herald": [
|
|
61
|
+
"dist/herald.d.ts"
|
|
62
|
+
],
|
|
63
|
+
"pulse": [
|
|
64
|
+
"dist/pulse.d.ts"
|
|
65
|
+
],
|
|
66
|
+
"ripple": [
|
|
67
|
+
"dist/ripple.d.ts"
|
|
68
|
+
],
|
|
69
|
+
"subjects": [
|
|
70
|
+
"dist/subjects.d.ts"
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public",
|
|
76
|
+
"registry": "https://registry.npmjs.org/"
|
|
77
|
+
},
|
|
49
78
|
"scripts": {
|
|
50
79
|
"build": "vite build && pnpm run build:bundle && pnpm run build:types && pnpm run verify:exports",
|
|
51
80
|
"build:bundle": "vite build --config vite.bundle.config.ts",
|
|
52
81
|
"build:types": "tsc -p tsconfig.declarations.json",
|
|
53
|
-
"fix": "
|
|
54
|
-
"lint": "
|
|
82
|
+
"fix": "biome check --write src",
|
|
83
|
+
"lint": "biome ci src",
|
|
55
84
|
"prepublishOnly": "pnpm run build",
|
|
56
85
|
"test": "vitest",
|
|
57
86
|
"verify:exports": "node scripts/verify-exports.mjs && node scripts/verify-package-exports.mjs"
|
|
58
87
|
},
|
|
59
|
-
"publishConfig": {
|
|
60
|
-
"access": "public",
|
|
61
|
-
"registry": "https://registry.npmjs.org/"
|
|
62
|
-
},
|
|
63
|
-
"engines": {
|
|
64
|
-
"node": ">=22"
|
|
65
|
-
},
|
|
66
88
|
"peerDependencies": {
|
|
67
|
-
"@vielzeug/courier": "2.0
|
|
89
|
+
"@vielzeug/courier": "2.1.0",
|
|
68
90
|
"@vielzeug/herald": "2.0.0",
|
|
69
|
-
"@vielzeug/pulse": "2.1.
|
|
70
|
-
"@vielzeug/ripple": "2.
|
|
91
|
+
"@vielzeug/pulse": "2.1.2",
|
|
92
|
+
"@vielzeug/ripple": "2.2.0"
|
|
71
93
|
},
|
|
72
94
|
"peerDependenciesMeta": {
|
|
73
95
|
"@vielzeug/courier": {
|
|
@@ -84,35 +106,13 @@
|
|
|
84
106
|
}
|
|
85
107
|
},
|
|
86
108
|
"devDependencies": {
|
|
87
|
-
"@types/node": "^26.
|
|
88
|
-
"@vielzeug/courier": "2.0
|
|
109
|
+
"@types/node": "^26.2.0",
|
|
110
|
+
"@vielzeug/courier": "2.1.0",
|
|
89
111
|
"@vielzeug/herald": "2.0.0",
|
|
90
|
-
"@vielzeug/pulse": "2.1.
|
|
91
|
-
"@vielzeug/ripple": "2.
|
|
112
|
+
"@vielzeug/pulse": "2.1.2",
|
|
113
|
+
"@vielzeug/ripple": "2.2.0",
|
|
92
114
|
"typescript": "^6.0.3",
|
|
93
|
-
"vite": "^8.2.
|
|
115
|
+
"vite": "^8.2.1",
|
|
94
116
|
"vitest": "^4.1.10"
|
|
95
|
-
},
|
|
96
|
-
"typesVersions": {
|
|
97
|
-
"*": {
|
|
98
|
-
"async": [
|
|
99
|
-
"dist/async.d.ts"
|
|
100
|
-
],
|
|
101
|
-
"courier": [
|
|
102
|
-
"dist/courier.d.ts"
|
|
103
|
-
],
|
|
104
|
-
"herald": [
|
|
105
|
-
"dist/herald.d.ts"
|
|
106
|
-
],
|
|
107
|
-
"pulse": [
|
|
108
|
-
"dist/pulse.d.ts"
|
|
109
|
-
],
|
|
110
|
-
"ripple": [
|
|
111
|
-
"dist/ripple.d.ts"
|
|
112
|
-
],
|
|
113
|
-
"subjects": [
|
|
114
|
-
"dist/subjects.d.ts"
|
|
115
|
-
]
|
|
116
|
-
}
|
|
117
117
|
}
|
|
118
118
|
}
|