@sapphire/event-iterator 1.4.0-next.f178b6d.0 β 1.5.0-next.edfbf1c.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.
- package/README.md +9 -3
- package/dist/index.js +156 -145
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +133 -3
- package/dist/index.mjs.map +1 -0
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ There is often a need to have async iterators with fine control, timeouts, limit
|
|
|
30
30
|
## Features
|
|
31
31
|
|
|
32
32
|
- Written in TypeScript
|
|
33
|
-
- Bundled with
|
|
33
|
+
- Bundled with esbuild so it can be used in NodeJS and browsers
|
|
34
34
|
- Offers CommonJS, ESM and UMD bundles
|
|
35
35
|
- Fully tested
|
|
36
36
|
|
|
@@ -92,7 +92,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
92
92
|
<!-- markdownlint-disable -->
|
|
93
93
|
<table>
|
|
94
94
|
<tr>
|
|
95
|
-
<td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=
|
|
95
|
+
<td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Code">π»</a> <a href="#infra-favna" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-favna" title="Project Management">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Documentation">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Tests">β οΈ</a></td>
|
|
96
96
|
<td align="center"><a href="https://github.com/kyranet"><img src="https://avatars0.githubusercontent.com/u/24852502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antonio RomΓ‘n</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Code">π»</a> <a href="#projectManagement-kyranet" title="Project Management">π</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Akyranet" title="Reviewed Pull Requests">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Tests">β οΈ</a></td>
|
|
97
97
|
<td align="center"><a href="https://github.com/PyroTechniac"><img src="https://avatars2.githubusercontent.com/u/39341355?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gryffon Bellish</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=PyroTechniac" title="Code">π»</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3APyroTechniac" title="Reviewed Pull Requests">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=PyroTechniac" title="Tests">β οΈ</a></td>
|
|
98
98
|
<td align="center"><a href="https://github.com/vladfrangu"><img src="https://avatars3.githubusercontent.com/u/17960496?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Frangu</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=vladfrangu" title="Code">π»</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3Avladfrangu" title="Bug reports">π</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Avladfrangu" title="Reviewed Pull Requests">π</a> <a href="#userTesting-vladfrangu" title="User Testing">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=vladfrangu" title="Tests">β οΈ</a></td>
|
|
@@ -114,12 +114,18 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
114
114
|
<td align="center"><a href="https://github.com/apps/dependabot"><img src="https://avatars.githubusercontent.com/in/29110?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dependabot[bot]</b></sub></a><br /><a href="#maintenance-dependabot[bot]" title="Maintenance">π§</a></td>
|
|
115
115
|
<td align="center"><a href="https://kaname.netlify.app/"><img src="https://avatars.githubusercontent.com/u/56084970?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kaname</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=kaname-png" title="Code">π»</a></td>
|
|
116
116
|
<td align="center"><a href="https://github.com/nandhagk"><img src="https://avatars.githubusercontent.com/u/62976649?v=4?s=100" width="100px;" alt=""/><br /><sub><b>nandhagk</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/issues?q=author%3Anandhagk" title="Bug reports">π</a></td>
|
|
117
|
-
<td align="center"><a href="https://megatank58.me/"><img src="https://avatars.githubusercontent.com/u/51410502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>
|
|
117
|
+
<td align="center"><a href="https://megatank58.me/"><img src="https://avatars.githubusercontent.com/u/51410502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>megatank58</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=megatank58" title="Code">π»</a></td>
|
|
118
118
|
<td align="center"><a href="https://github.com/UndiedGamer"><img src="https://avatars.githubusercontent.com/u/84702365?v=4?s=100" width="100px;" alt=""/><br /><sub><b>UndiedGamer</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=UndiedGamer" title="Code">π»</a></td>
|
|
119
119
|
<td align="center"><a href="https://github.com/Lioness100"><img src="https://avatars.githubusercontent.com/u/65814829?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lioness100</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Lioness100" title="Documentation">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=Lioness100" title="Code">π»</a></td>
|
|
120
120
|
</tr>
|
|
121
121
|
<tr>
|
|
122
122
|
<td align="center"><a href="https://gitlab.com/DavidPH/"><img src="https://avatars.githubusercontent.com/u/44669930?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=DavidPHH" title="Code">π»</a></td>
|
|
123
|
+
<td align="center"><a href="https://github.com/apps/renovate"><img src="https://avatars.githubusercontent.com/in/2740?v=4?s=100" width="100px;" alt=""/><br /><sub><b>renovate[bot]</b></sub></a><br /><a href="#maintenance-renovate[bot]" title="Maintenance">π§</a></td>
|
|
124
|
+
<td align="center"><a href="https://renovate.whitesourcesoftware.com/"><img src="https://avatars.githubusercontent.com/u/25180681?v=4?s=100" width="100px;" alt=""/><br /><sub><b>WhiteSource Renovate</b></sub></a><br /><a href="#maintenance-renovate-bot" title="Maintenance">π§</a></td>
|
|
125
|
+
<td align="center"><a href="https://fc5570.me/"><img src="https://avatars.githubusercontent.com/u/68158483?v=4?s=100" width="100px;" alt=""/><br /><sub><b>FC</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=FC5570" title="Code">π»</a></td>
|
|
126
|
+
<td align="center"><a href="https://github.com/Tokipudi"><img src="https://avatars.githubusercontent.com/u/29551076?v=4?s=100" width="100px;" alt=""/><br /><sub><b>JΓ©rΓ©my de Saint Denis</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Tokipudi" title="Code">π»</a></td>
|
|
127
|
+
<td align="center"><a href="https://github.com/ItsMrCube"><img src="https://avatars.githubusercontent.com/u/25201357?v=4?s=100" width="100px;" alt=""/><br /><sub><b>MrCube</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=ItsMrCube" title="Code">π»</a></td>
|
|
128
|
+
<td align="center"><a href="https://github.com/bitomic"><img src="https://avatars.githubusercontent.com/u/35199700?v=4?s=100" width="100px;" alt=""/><br /><sub><b>bitomic</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=bitomic" title="Code">π»</a></td>
|
|
123
129
|
</tr>
|
|
124
130
|
</table>
|
|
125
131
|
|
package/dist/index.js
CHANGED
|
@@ -1,151 +1,162 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const maxListeners = this.emitter.getMaxListeners();
|
|
56
|
-
if (maxListeners !== 0)
|
|
57
|
-
this.emitter.setMaxListeners(maxListeners + 1);
|
|
58
|
-
// @ts-expect-error Silence weird compiler issue regarding `this.push`'s arguments not being `any`.
|
|
59
|
-
this.emitter.on(this.event, (0, tslib_1.__classPrivateFieldGet)(this, _EventIterator_push, "f"));
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
14
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(module2))
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
17
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
22
|
+
return (module2, temp) => {
|
|
23
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
24
|
+
};
|
|
25
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
26
|
+
var __publicField = (obj, key, value) => {
|
|
27
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
30
|
+
var __accessCheck = (obj, member, msg) => {
|
|
31
|
+
if (!member.has(obj))
|
|
32
|
+
throw TypeError("Cannot " + msg);
|
|
33
|
+
};
|
|
34
|
+
var __privateGet = (obj, member, getter) => {
|
|
35
|
+
__accessCheck(obj, member, "read from private field");
|
|
36
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
37
|
+
};
|
|
38
|
+
var __privateAdd = (obj, member, value) => {
|
|
39
|
+
if (member.has(obj))
|
|
40
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
41
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
42
|
+
};
|
|
43
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
44
|
+
__accessCheck(obj, member, "write to private field");
|
|
45
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
46
|
+
return value;
|
|
47
|
+
};
|
|
48
|
+
var __privateWrapper = (obj, member, setter, getter) => {
|
|
49
|
+
return {
|
|
50
|
+
set _(value) {
|
|
51
|
+
__privateSet(obj, member, value, setter);
|
|
52
|
+
},
|
|
53
|
+
get _() {
|
|
54
|
+
return __privateGet(obj, member, getter);
|
|
60
55
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// Once it has received at least one value, we will clear the timer (if defined),
|
|
115
|
-
// and resolve with the new value:
|
|
116
|
-
this.emitter.once(this.event, () => {
|
|
117
|
-
if (idleTimer)
|
|
118
|
-
clearTimeout(idleTimer);
|
|
119
|
-
resolve(this.next());
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Handles what happens when you break or return from a loop.
|
|
125
|
-
*/
|
|
126
|
-
return() {
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// src/index.ts
|
|
60
|
+
var src_exports = {};
|
|
61
|
+
__export(src_exports, {
|
|
62
|
+
EventIterator: () => EventIterator
|
|
63
|
+
});
|
|
64
|
+
var _ended, _idle, _queue, _passed, _limit, _idleTimer, _push;
|
|
65
|
+
var EventIterator = class {
|
|
66
|
+
constructor(emitter, event, options = {}) {
|
|
67
|
+
__publicField(this, "emitter");
|
|
68
|
+
__publicField(this, "event");
|
|
69
|
+
__publicField(this, "filter");
|
|
70
|
+
__privateAdd(this, _ended, false);
|
|
71
|
+
__privateAdd(this, _idle, void 0);
|
|
72
|
+
__privateAdd(this, _queue, []);
|
|
73
|
+
__privateAdd(this, _passed, 0);
|
|
74
|
+
__privateAdd(this, _limit, void 0);
|
|
75
|
+
__privateAdd(this, _idleTimer, null);
|
|
76
|
+
__privateAdd(this, _push, void 0);
|
|
77
|
+
this.emitter = emitter;
|
|
78
|
+
this.event = event;
|
|
79
|
+
__privateSet(this, _limit, options.limit ?? Infinity);
|
|
80
|
+
__privateSet(this, _idle, options.idle);
|
|
81
|
+
this.filter = options.filter ?? (() => true);
|
|
82
|
+
if (__privateGet(this, _idle))
|
|
83
|
+
__privateSet(this, _idleTimer, setTimeout(this.end.bind(this), __privateGet(this, _idle)));
|
|
84
|
+
__privateSet(this, _push, this.push.bind(this));
|
|
85
|
+
const maxListeners = this.emitter.getMaxListeners();
|
|
86
|
+
if (maxListeners !== 0)
|
|
87
|
+
this.emitter.setMaxListeners(maxListeners + 1);
|
|
88
|
+
this.emitter.on(this.event, __privateGet(this, _push));
|
|
89
|
+
}
|
|
90
|
+
get ended() {
|
|
91
|
+
return __privateGet(this, _ended);
|
|
92
|
+
}
|
|
93
|
+
end() {
|
|
94
|
+
if (__privateGet(this, _ended))
|
|
95
|
+
return;
|
|
96
|
+
__privateSet(this, _ended, true);
|
|
97
|
+
__privateSet(this, _queue, []);
|
|
98
|
+
this.emitter.off(this.event, __privateGet(this, _push));
|
|
99
|
+
const maxListeners = this.emitter.getMaxListeners();
|
|
100
|
+
if (maxListeners !== 0)
|
|
101
|
+
this.emitter.setMaxListeners(maxListeners - 1);
|
|
102
|
+
}
|
|
103
|
+
async next() {
|
|
104
|
+
if (__privateGet(this, _queue).length) {
|
|
105
|
+
const value = __privateGet(this, _queue).shift();
|
|
106
|
+
if (!this.filter(value))
|
|
107
|
+
return this.next();
|
|
108
|
+
if (++__privateWrapper(this, _passed)._ >= __privateGet(this, _limit))
|
|
127
109
|
this.end();
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
* Handles what happens when you encounter an error in a loop.
|
|
132
|
-
*/
|
|
133
|
-
throw() {
|
|
134
|
-
this.end();
|
|
135
|
-
return Promise.resolve({ done: true, value: undefined });
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* The symbol allowing EventIterators to be used in for-await-of loops.
|
|
139
|
-
*/
|
|
140
|
-
[(_EventIterator_ended = new WeakMap(), _EventIterator_idle = new WeakMap(), _EventIterator_queue = new WeakMap(), _EventIterator_passed = new WeakMap(), _EventIterator_limit = new WeakMap(), _EventIterator_idleTimer = new WeakMap(), _EventIterator_push = new WeakMap(), Symbol.asyncIterator)]() {
|
|
141
|
-
return this;
|
|
110
|
+
if (__privateGet(this, _idleTimer))
|
|
111
|
+
__privateGet(this, _idleTimer).refresh();
|
|
112
|
+
return { done: false, value };
|
|
142
113
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
(0, tslib_1.__classPrivateFieldGet)(this, _EventIterator_queue, "f").push(value);
|
|
114
|
+
if (__privateGet(this, _ended)) {
|
|
115
|
+
if (__privateGet(this, _idleTimer))
|
|
116
|
+
clearTimeout(__privateGet(this, _idleTimer));
|
|
117
|
+
return { done: true, value: void 0 };
|
|
148
118
|
}
|
|
149
|
-
|
|
150
|
-
|
|
119
|
+
return new Promise((resolve) => {
|
|
120
|
+
let idleTimer = null;
|
|
121
|
+
if (__privateGet(this, _idle)) {
|
|
122
|
+
idleTimer = setTimeout(() => {
|
|
123
|
+
this.end();
|
|
124
|
+
resolve(this.next());
|
|
125
|
+
}, __privateGet(this, _idle));
|
|
126
|
+
}
|
|
127
|
+
this.emitter.once(this.event, () => {
|
|
128
|
+
if (idleTimer)
|
|
129
|
+
clearTimeout(idleTimer);
|
|
130
|
+
resolve(this.next());
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return() {
|
|
135
|
+
this.end();
|
|
136
|
+
return Promise.resolve({ done: true, value: void 0 });
|
|
137
|
+
}
|
|
138
|
+
throw() {
|
|
139
|
+
this.end();
|
|
140
|
+
return Promise.resolve({ done: true, value: void 0 });
|
|
141
|
+
}
|
|
142
|
+
[Symbol.asyncIterator]() {
|
|
143
|
+
return this;
|
|
144
|
+
}
|
|
145
|
+
push(...value) {
|
|
146
|
+
__privateGet(this, _queue).push(value);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
__name(EventIterator, "EventIterator");
|
|
150
|
+
_ended = new WeakMap();
|
|
151
|
+
_idle = new WeakMap();
|
|
152
|
+
_queue = new WeakMap();
|
|
153
|
+
_passed = new WeakMap();
|
|
154
|
+
_limit = new WeakMap();
|
|
155
|
+
_idleTimer = new WeakMap();
|
|
156
|
+
_push = new WeakMap();
|
|
157
|
+
module.exports = __toCommonJS(src_exports);
|
|
158
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
159
|
+
0 && (module.exports = {
|
|
160
|
+
EventIterator
|
|
161
|
+
});
|
|
151
162
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { EventEmitter } from 'node:events';\n\n/**\n * A filter for an EventIterator.\n */\nexport type EventIteratorFilter<V> = (value: V) => boolean;\n\n/**\n * Options to be passed to an EventIterator.\n */\nexport interface EventIteratorOptions<V> {\n\t/**\n\t * The filter.\n\t */\n\tfilter?: EventIteratorFilter<V>;\n\n\t/**\n\t * The timeout in ms before ending the EventIterator.\n\t */\n\tidle?: number;\n\n\t/**\n\t * The limit of events that pass the filter to iterate.\n\t */\n\tlimit?: number;\n}\n\n/**\n * An EventIterator, used for asynchronously iterating over received values.\n */\nexport class EventIterator<V extends unknown[]> implements AsyncIterableIterator<V> {\n\t/**\n\t * The emitter to listen to.\n\t */\n\tpublic readonly emitter: EventEmitter;\n\n\t/**\n\t * The event the event iterator is listening for to receive values from.\n\t */\n\tpublic readonly event: string;\n\n\t/**\n\t * The filter used to filter out values.\n\t */\n\tpublic filter: EventIteratorFilter<V>;\n\n\t/**\n\t * Whether or not the EventIterator has ended.\n\t */\n\t#ended = false;\n\n\t/**\n\t * The amount of idle time in ms before moving on.\n\t */\n\t#idle?: number;\n\n\t/**\n\t * The queue of received values.\n\t */\n\t#queue: V[] = [];\n\n\t/**\n\t * The amount of events that have passed the filter.\n\t */\n\t#passed = 0;\n\n\t/**\n\t * The limit before ending the EventIterator.\n\t */\n\t#limit: number;\n\n\t/**\n\t * The timer to track when this will idle out.\n\t */\n\t#idleTimer: NodeJS.Timer | null = null;\n\n\t/**\n\t * The push handler with context bound to the instance.\n\t */\n\t#push: (this: EventIterator<V>, ...value: V) => void;\n\n\t/**\n\t * @param emitter The event emitter to listen to.\n\t * @param event The event we're listening for to receives values from.\n\t * @param limit The amount of values to receive before ending the iterator.\n\t * @param options Any extra options.\n\t */\n\tpublic constructor(emitter: EventEmitter, event: string, options: EventIteratorOptions<V> = {}) {\n\t\tthis.emitter = emitter;\n\t\tthis.event = event;\n\t\tthis.#limit = options.limit ?? Infinity;\n\t\tthis.#idle = options.idle;\n\t\tthis.filter = options.filter ?? ((): boolean => true);\n\n\t\t// This timer is to idle out on lack of valid responses\n\t\tif (this.#idle) this.#idleTimer = setTimeout(this.end.bind(this), this.#idle);\n\n\t\t// @ts-expect-error Silence weird compiler issue regarding `this.push`'s arguments not being `any`.\n\t\tthis.#push = this.push.bind(this);\n\t\tconst maxListeners = this.emitter.getMaxListeners();\n\t\tif (maxListeners !== 0) this.emitter.setMaxListeners(maxListeners + 1);\n\n\t\t// @ts-expect-error Silence weird compiler issue regarding `this.push`'s arguments not being `any`.\n\t\tthis.emitter.on(this.event, this.#push);\n\t}\n\n\t/**\n\t * Whether or not the EventIterator has ended.\n\t */\n\tpublic get ended(): boolean {\n\t\treturn this.#ended;\n\t}\n\n\t/**\n\t * Ends the EventIterator.\n\t */\n\tpublic end(): void {\n\t\tif (this.#ended) return;\n\t\tthis.#ended = true;\n\t\tthis.#queue = [];\n\n\t\t// @ts-expect-error Silence weird compiler issue regarding `this.push`'s arguments not being `any`.\n\t\tthis.emitter.off(this.event, this.#push);\n\t\tconst maxListeners = this.emitter.getMaxListeners();\n\t\tif (maxListeners !== 0) this.emitter.setMaxListeners(maxListeners - 1);\n\t}\n\n\t/**\n\t * The next value that's received from the EventEmitter.\n\t */\n\tpublic async next(): Promise<IteratorResult<V>> {\n\t\t// If there are elements in the queue, return an undone response:\n\t\tif (this.#queue.length) {\n\t\t\tconst value = this.#queue.shift()!;\n\t\t\tif (!this.filter(value)) return this.next();\n\t\t\tif (++this.#passed >= this.#limit) this.end();\n\t\t\tif (this.#idleTimer) this.#idleTimer.refresh();\n\t\t\treturn { done: false, value };\n\t\t}\n\n\t\t// If the iterator ended, clean-up timer and return a done response:\n\t\tif (this.#ended) {\n\t\t\tif (this.#idleTimer) clearTimeout(this.#idleTimer);\n\t\t\treturn { done: true, value: undefined as never };\n\t\t}\n\n\t\t// Listen for a new element from the emitter:\n\t\treturn new Promise<IteratorResult<V>>((resolve) => {\n\t\t\tlet idleTimer: NodeJS.Timer | null = null;\n\n\t\t\t// If there is an idle time set, we will create a temporary timer,\n\t\t\t// which will cause the iterator to end if no new elements are received:\n\t\t\tif (this.#idle) {\n\t\t\t\tidleTimer = setTimeout(() => {\n\t\t\t\t\tthis.end();\n\t\t\t\t\tresolve(this.next());\n\t\t\t\t}, this.#idle);\n\t\t\t}\n\n\t\t\t// Once it has received at least one value, we will clear the timer (if defined),\n\t\t\t// and resolve with the new value:\n\t\t\tthis.emitter.once(this.event, () => {\n\t\t\t\tif (idleTimer) clearTimeout(idleTimer);\n\t\t\t\tresolve(this.next());\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Handles what happens when you break or return from a loop.\n\t */\n\tpublic return(): Promise<IteratorResult<V>> {\n\t\tthis.end();\n\t\treturn Promise.resolve({ done: true, value: undefined as never });\n\t}\n\n\t/**\n\t * Handles what happens when you encounter an error in a loop.\n\t */\n\tpublic throw(): Promise<IteratorResult<V>> {\n\t\tthis.end();\n\t\treturn Promise.resolve({ done: true, value: undefined as never });\n\t}\n\n\t/**\n\t * The symbol allowing EventIterators to be used in for-await-of loops.\n\t */\n\tpublic [Symbol.asyncIterator](): AsyncIterableIterator<V> {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Pushes a value into the queue.\n\t */\n\tprotected push(...value: V): void {\n\t\tthis.#queue.push(value);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BO,0BAA6E;AAAA,EAyD5E,YAAY,SAAuB,OAAe,UAAmC,IAAI;AArDhF;AAKA;AAKT;AAKP,+BAAS;AAKT;AAKA,+BAAc;AAKd,gCAAU;AAKV;AAKA,mCAAkC;AAKlC;AASC,SAAK,UAAU;AACf,SAAK,QAAQ;AACb,uBAAK,QAAS,QAAQ,SAAS;AAC/B,uBAAK,OAAQ,QAAQ;AACrB,SAAK,SAAS,QAAQ,UAAW,OAAe;AAGhD,QAAI,mBAAK;AAAO,yBAAK,YAAa,WAAW,KAAK,IAAI,KAAK,OAAO,mBAAK;AAGvE,uBAAK,OAAQ,KAAK,KAAK,KAAK;AAC5B,UAAM,eAAe,KAAK,QAAQ;AAClC,QAAI,iBAAiB;AAAG,WAAK,QAAQ,gBAAgB,eAAe;AAGpE,SAAK,QAAQ,GAAG,KAAK,OAAO,mBAAK;AAAA;AAAA,MAMvB,QAAiB;AAC3B,WAAO,mBAAK;AAAA;AAAA,EAMN,MAAY;AAClB,QAAI,mBAAK;AAAQ;AACjB,uBAAK,QAAS;AACd,uBAAK,QAAS;AAGd,SAAK,QAAQ,IAAI,KAAK,OAAO,mBAAK;AAClC,UAAM,eAAe,KAAK,QAAQ;AAClC,QAAI,iBAAiB;AAAG,WAAK,QAAQ,gBAAgB,eAAe;AAAA;AAAA,QAMxD,OAAmC;AAE/C,QAAI,mBAAK,QAAO,QAAQ;AACvB,YAAM,QAAQ,mBAAK,QAAO;AAC1B,UAAI,CAAC,KAAK,OAAO;AAAQ,eAAO,KAAK;AACrC,UAAI,AAAO,EAAL,uBAAK,SAAL,KAAgB,mBAAK;AAAQ,aAAK;AACxC,UAAI,mBAAK;AAAY,2BAAK,YAAW;AACrC,aAAO,EAAE,MAAM,OAAO;AAAA;AAIvB,QAAI,mBAAK,SAAQ;AAChB,UAAI,mBAAK;AAAY,qBAAa,mBAAK;AACvC,aAAO,EAAE,MAAM,MAAM,OAAO;AAAA;AAI7B,WAAO,IAAI,QAA2B,CAAC,YAAY;AAClD,UAAI,YAAiC;AAIrC,UAAI,mBAAK,QAAO;AACf,oBAAY,WAAW,MAAM;AAC5B,eAAK;AACL,kBAAQ,KAAK;AAAA,WACX,mBAAK;AAAA;AAKT,WAAK,QAAQ,KAAK,KAAK,OAAO,MAAM;AACnC,YAAI;AAAW,uBAAa;AAC5B,gBAAQ,KAAK;AAAA;AAAA;AAAA;AAAA,EAQT,SAAqC;AAC3C,SAAK;AACL,WAAO,QAAQ,QAAQ,EAAE,MAAM,MAAM,OAAO;AAAA;AAAA,EAMtC,QAAoC;AAC1C,SAAK;AACL,WAAO,QAAQ,QAAQ,EAAE,MAAM,MAAM,OAAO;AAAA;AAAA,GAMrC,OAAO,iBAA2C;AACzD,WAAO;AAAA;AAAA,EAME,QAAQ,OAAgB;AACjC,uBAAK,QAAO,KAAK;AAAA;AAAA;AArKZ;AAmBN;AAKA;AAKA;AAKA;AAKA;AAKA;AAKA;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,134 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
var __publicField = (obj, key, value) => {
|
|
5
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
var __accessCheck = (obj, member, msg) => {
|
|
9
|
+
if (!member.has(obj))
|
|
10
|
+
throw TypeError("Cannot " + msg);
|
|
11
|
+
};
|
|
12
|
+
var __privateGet = (obj, member, getter) => {
|
|
13
|
+
__accessCheck(obj, member, "read from private field");
|
|
14
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
15
|
+
};
|
|
16
|
+
var __privateAdd = (obj, member, value) => {
|
|
17
|
+
if (member.has(obj))
|
|
18
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
19
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
20
|
+
};
|
|
21
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
22
|
+
__accessCheck(obj, member, "write to private field");
|
|
23
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
26
|
+
var __privateWrapper = (obj, member, setter, getter) => {
|
|
27
|
+
return {
|
|
28
|
+
set _(value) {
|
|
29
|
+
__privateSet(obj, member, value, setter);
|
|
30
|
+
},
|
|
31
|
+
get _() {
|
|
32
|
+
return __privateGet(obj, member, getter);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
2
36
|
|
|
3
|
-
|
|
4
|
-
|
|
37
|
+
// src/index.ts
|
|
38
|
+
var _ended, _idle, _queue, _passed, _limit, _idleTimer, _push;
|
|
39
|
+
var EventIterator = class {
|
|
40
|
+
constructor(emitter, event, options = {}) {
|
|
41
|
+
__publicField(this, "emitter");
|
|
42
|
+
__publicField(this, "event");
|
|
43
|
+
__publicField(this, "filter");
|
|
44
|
+
__privateAdd(this, _ended, false);
|
|
45
|
+
__privateAdd(this, _idle, void 0);
|
|
46
|
+
__privateAdd(this, _queue, []);
|
|
47
|
+
__privateAdd(this, _passed, 0);
|
|
48
|
+
__privateAdd(this, _limit, void 0);
|
|
49
|
+
__privateAdd(this, _idleTimer, null);
|
|
50
|
+
__privateAdd(this, _push, void 0);
|
|
51
|
+
this.emitter = emitter;
|
|
52
|
+
this.event = event;
|
|
53
|
+
__privateSet(this, _limit, options.limit ?? Infinity);
|
|
54
|
+
__privateSet(this, _idle, options.idle);
|
|
55
|
+
this.filter = options.filter ?? (() => true);
|
|
56
|
+
if (__privateGet(this, _idle))
|
|
57
|
+
__privateSet(this, _idleTimer, setTimeout(this.end.bind(this), __privateGet(this, _idle)));
|
|
58
|
+
__privateSet(this, _push, this.push.bind(this));
|
|
59
|
+
const maxListeners = this.emitter.getMaxListeners();
|
|
60
|
+
if (maxListeners !== 0)
|
|
61
|
+
this.emitter.setMaxListeners(maxListeners + 1);
|
|
62
|
+
this.emitter.on(this.event, __privateGet(this, _push));
|
|
63
|
+
}
|
|
64
|
+
get ended() {
|
|
65
|
+
return __privateGet(this, _ended);
|
|
66
|
+
}
|
|
67
|
+
end() {
|
|
68
|
+
if (__privateGet(this, _ended))
|
|
69
|
+
return;
|
|
70
|
+
__privateSet(this, _ended, true);
|
|
71
|
+
__privateSet(this, _queue, []);
|
|
72
|
+
this.emitter.off(this.event, __privateGet(this, _push));
|
|
73
|
+
const maxListeners = this.emitter.getMaxListeners();
|
|
74
|
+
if (maxListeners !== 0)
|
|
75
|
+
this.emitter.setMaxListeners(maxListeners - 1);
|
|
76
|
+
}
|
|
77
|
+
async next() {
|
|
78
|
+
if (__privateGet(this, _queue).length) {
|
|
79
|
+
const value = __privateGet(this, _queue).shift();
|
|
80
|
+
if (!this.filter(value))
|
|
81
|
+
return this.next();
|
|
82
|
+
if (++__privateWrapper(this, _passed)._ >= __privateGet(this, _limit))
|
|
83
|
+
this.end();
|
|
84
|
+
if (__privateGet(this, _idleTimer))
|
|
85
|
+
__privateGet(this, _idleTimer).refresh();
|
|
86
|
+
return { done: false, value };
|
|
87
|
+
}
|
|
88
|
+
if (__privateGet(this, _ended)) {
|
|
89
|
+
if (__privateGet(this, _idleTimer))
|
|
90
|
+
clearTimeout(__privateGet(this, _idleTimer));
|
|
91
|
+
return { done: true, value: void 0 };
|
|
92
|
+
}
|
|
93
|
+
return new Promise((resolve) => {
|
|
94
|
+
let idleTimer = null;
|
|
95
|
+
if (__privateGet(this, _idle)) {
|
|
96
|
+
idleTimer = setTimeout(() => {
|
|
97
|
+
this.end();
|
|
98
|
+
resolve(this.next());
|
|
99
|
+
}, __privateGet(this, _idle));
|
|
100
|
+
}
|
|
101
|
+
this.emitter.once(this.event, () => {
|
|
102
|
+
if (idleTimer)
|
|
103
|
+
clearTimeout(idleTimer);
|
|
104
|
+
resolve(this.next());
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return() {
|
|
109
|
+
this.end();
|
|
110
|
+
return Promise.resolve({ done: true, value: void 0 });
|
|
111
|
+
}
|
|
112
|
+
throw() {
|
|
113
|
+
this.end();
|
|
114
|
+
return Promise.resolve({ done: true, value: void 0 });
|
|
115
|
+
}
|
|
116
|
+
[Symbol.asyncIterator]() {
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
push(...value) {
|
|
120
|
+
__privateGet(this, _queue).push(value);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
__name(EventIterator, "EventIterator");
|
|
124
|
+
_ended = new WeakMap();
|
|
125
|
+
_idle = new WeakMap();
|
|
126
|
+
_queue = new WeakMap();
|
|
127
|
+
_passed = new WeakMap();
|
|
128
|
+
_limit = new WeakMap();
|
|
129
|
+
_idleTimer = new WeakMap();
|
|
130
|
+
_push = new WeakMap();
|
|
131
|
+
export {
|
|
132
|
+
EventIterator
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { EventEmitter } from 'node:events';\n\n/**\n * A filter for an EventIterator.\n */\nexport type EventIteratorFilter<V> = (value: V) => boolean;\n\n/**\n * Options to be passed to an EventIterator.\n */\nexport interface EventIteratorOptions<V> {\n\t/**\n\t * The filter.\n\t */\n\tfilter?: EventIteratorFilter<V>;\n\n\t/**\n\t * The timeout in ms before ending the EventIterator.\n\t */\n\tidle?: number;\n\n\t/**\n\t * The limit of events that pass the filter to iterate.\n\t */\n\tlimit?: number;\n}\n\n/**\n * An EventIterator, used for asynchronously iterating over received values.\n */\nexport class EventIterator<V extends unknown[]> implements AsyncIterableIterator<V> {\n\t/**\n\t * The emitter to listen to.\n\t */\n\tpublic readonly emitter: EventEmitter;\n\n\t/**\n\t * The event the event iterator is listening for to receive values from.\n\t */\n\tpublic readonly event: string;\n\n\t/**\n\t * The filter used to filter out values.\n\t */\n\tpublic filter: EventIteratorFilter<V>;\n\n\t/**\n\t * Whether or not the EventIterator has ended.\n\t */\n\t#ended = false;\n\n\t/**\n\t * The amount of idle time in ms before moving on.\n\t */\n\t#idle?: number;\n\n\t/**\n\t * The queue of received values.\n\t */\n\t#queue: V[] = [];\n\n\t/**\n\t * The amount of events that have passed the filter.\n\t */\n\t#passed = 0;\n\n\t/**\n\t * The limit before ending the EventIterator.\n\t */\n\t#limit: number;\n\n\t/**\n\t * The timer to track when this will idle out.\n\t */\n\t#idleTimer: NodeJS.Timer | null = null;\n\n\t/**\n\t * The push handler with context bound to the instance.\n\t */\n\t#push: (this: EventIterator<V>, ...value: V) => void;\n\n\t/**\n\t * @param emitter The event emitter to listen to.\n\t * @param event The event we're listening for to receives values from.\n\t * @param limit The amount of values to receive before ending the iterator.\n\t * @param options Any extra options.\n\t */\n\tpublic constructor(emitter: EventEmitter, event: string, options: EventIteratorOptions<V> = {}) {\n\t\tthis.emitter = emitter;\n\t\tthis.event = event;\n\t\tthis.#limit = options.limit ?? Infinity;\n\t\tthis.#idle = options.idle;\n\t\tthis.filter = options.filter ?? ((): boolean => true);\n\n\t\t// This timer is to idle out on lack of valid responses\n\t\tif (this.#idle) this.#idleTimer = setTimeout(this.end.bind(this), this.#idle);\n\n\t\t// @ts-expect-error Silence weird compiler issue regarding `this.push`'s arguments not being `any`.\n\t\tthis.#push = this.push.bind(this);\n\t\tconst maxListeners = this.emitter.getMaxListeners();\n\t\tif (maxListeners !== 0) this.emitter.setMaxListeners(maxListeners + 1);\n\n\t\t// @ts-expect-error Silence weird compiler issue regarding `this.push`'s arguments not being `any`.\n\t\tthis.emitter.on(this.event, this.#push);\n\t}\n\n\t/**\n\t * Whether or not the EventIterator has ended.\n\t */\n\tpublic get ended(): boolean {\n\t\treturn this.#ended;\n\t}\n\n\t/**\n\t * Ends the EventIterator.\n\t */\n\tpublic end(): void {\n\t\tif (this.#ended) return;\n\t\tthis.#ended = true;\n\t\tthis.#queue = [];\n\n\t\t// @ts-expect-error Silence weird compiler issue regarding `this.push`'s arguments not being `any`.\n\t\tthis.emitter.off(this.event, this.#push);\n\t\tconst maxListeners = this.emitter.getMaxListeners();\n\t\tif (maxListeners !== 0) this.emitter.setMaxListeners(maxListeners - 1);\n\t}\n\n\t/**\n\t * The next value that's received from the EventEmitter.\n\t */\n\tpublic async next(): Promise<IteratorResult<V>> {\n\t\t// If there are elements in the queue, return an undone response:\n\t\tif (this.#queue.length) {\n\t\t\tconst value = this.#queue.shift()!;\n\t\t\tif (!this.filter(value)) return this.next();\n\t\t\tif (++this.#passed >= this.#limit) this.end();\n\t\t\tif (this.#idleTimer) this.#idleTimer.refresh();\n\t\t\treturn { done: false, value };\n\t\t}\n\n\t\t// If the iterator ended, clean-up timer and return a done response:\n\t\tif (this.#ended) {\n\t\t\tif (this.#idleTimer) clearTimeout(this.#idleTimer);\n\t\t\treturn { done: true, value: undefined as never };\n\t\t}\n\n\t\t// Listen for a new element from the emitter:\n\t\treturn new Promise<IteratorResult<V>>((resolve) => {\n\t\t\tlet idleTimer: NodeJS.Timer | null = null;\n\n\t\t\t// If there is an idle time set, we will create a temporary timer,\n\t\t\t// which will cause the iterator to end if no new elements are received:\n\t\t\tif (this.#idle) {\n\t\t\t\tidleTimer = setTimeout(() => {\n\t\t\t\t\tthis.end();\n\t\t\t\t\tresolve(this.next());\n\t\t\t\t}, this.#idle);\n\t\t\t}\n\n\t\t\t// Once it has received at least one value, we will clear the timer (if defined),\n\t\t\t// and resolve with the new value:\n\t\t\tthis.emitter.once(this.event, () => {\n\t\t\t\tif (idleTimer) clearTimeout(idleTimer);\n\t\t\t\tresolve(this.next());\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Handles what happens when you break or return from a loop.\n\t */\n\tpublic return(): Promise<IteratorResult<V>> {\n\t\tthis.end();\n\t\treturn Promise.resolve({ done: true, value: undefined as never });\n\t}\n\n\t/**\n\t * Handles what happens when you encounter an error in a loop.\n\t */\n\tpublic throw(): Promise<IteratorResult<V>> {\n\t\tthis.end();\n\t\treturn Promise.resolve({ done: true, value: undefined as never });\n\t}\n\n\t/**\n\t * The symbol allowing EventIterators to be used in for-await-of loops.\n\t */\n\tpublic [Symbol.asyncIterator](): AsyncIterableIterator<V> {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Pushes a value into the queue.\n\t */\n\tprotected push(...value: V): void {\n\t\tthis.#queue.push(value);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA8BO,0BAA6E;AAAA,EAyD5E,YAAY,SAAuB,OAAe,UAAmC,IAAI;AArDhF;AAKA;AAKT;AAKP,+BAAS;AAKT;AAKA,+BAAc;AAKd,gCAAU;AAKV;AAKA,mCAAkC;AAKlC;AASC,SAAK,UAAU;AACf,SAAK,QAAQ;AACb,uBAAK,QAAS,QAAQ,SAAS;AAC/B,uBAAK,OAAQ,QAAQ;AACrB,SAAK,SAAS,QAAQ,UAAW,OAAe;AAGhD,QAAI,mBAAK;AAAO,yBAAK,YAAa,WAAW,KAAK,IAAI,KAAK,OAAO,mBAAK;AAGvE,uBAAK,OAAQ,KAAK,KAAK,KAAK;AAC5B,UAAM,eAAe,KAAK,QAAQ;AAClC,QAAI,iBAAiB;AAAG,WAAK,QAAQ,gBAAgB,eAAe;AAGpE,SAAK,QAAQ,GAAG,KAAK,OAAO,mBAAK;AAAA;AAAA,MAMvB,QAAiB;AAC3B,WAAO,mBAAK;AAAA;AAAA,EAMN,MAAY;AAClB,QAAI,mBAAK;AAAQ;AACjB,uBAAK,QAAS;AACd,uBAAK,QAAS;AAGd,SAAK,QAAQ,IAAI,KAAK,OAAO,mBAAK;AAClC,UAAM,eAAe,KAAK,QAAQ;AAClC,QAAI,iBAAiB;AAAG,WAAK,QAAQ,gBAAgB,eAAe;AAAA;AAAA,QAMxD,OAAmC;AAE/C,QAAI,mBAAK,QAAO,QAAQ;AACvB,YAAM,QAAQ,mBAAK,QAAO;AAC1B,UAAI,CAAC,KAAK,OAAO;AAAQ,eAAO,KAAK;AACrC,UAAI,AAAO,EAAL,uBAAK,SAAL,KAAgB,mBAAK;AAAQ,aAAK;AACxC,UAAI,mBAAK;AAAY,2BAAK,YAAW;AACrC,aAAO,EAAE,MAAM,OAAO;AAAA;AAIvB,QAAI,mBAAK,SAAQ;AAChB,UAAI,mBAAK;AAAY,qBAAa,mBAAK;AACvC,aAAO,EAAE,MAAM,MAAM,OAAO;AAAA;AAI7B,WAAO,IAAI,QAA2B,CAAC,YAAY;AAClD,UAAI,YAAiC;AAIrC,UAAI,mBAAK,QAAO;AACf,oBAAY,WAAW,MAAM;AAC5B,eAAK;AACL,kBAAQ,KAAK;AAAA,WACX,mBAAK;AAAA;AAKT,WAAK,QAAQ,KAAK,KAAK,OAAO,MAAM;AACnC,YAAI;AAAW,uBAAa;AAC5B,gBAAQ,KAAK;AAAA;AAAA;AAAA;AAAA,EAQT,SAAqC;AAC3C,SAAK;AACL,WAAO,QAAQ,QAAQ,EAAE,MAAM,MAAM,OAAO;AAAA;AAAA,EAMtC,QAAoC;AAC1C,SAAK;AACL,WAAO,QAAQ,QAAQ,EAAE,MAAM,MAAM,OAAO;AAAA;AAAA,GAMrC,OAAO,iBAA2C;AACzD,WAAO;AAAA;AAAA,EAME,QAAQ,OAAgB;AACjC,uBAAK,QAAO,KAAK;AAAA;AAAA;AArKZ;AAmBN;AAKA;AAKA;AAKA;AAKA;AAKA;AAKA;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/event-iterator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-next.edfbf1c.0",
|
|
4
4
|
"description": "Turns event emitter events into async iterators.",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"test": "jest",
|
|
19
19
|
"lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
|
|
20
|
-
"build": "tsc -b src
|
|
21
|
-
"start": "yarn build -w",
|
|
20
|
+
"build": "tsup && tsc -b src",
|
|
22
21
|
"prepublishOnly": "yarn build"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
@@ -53,5 +52,5 @@
|
|
|
53
52
|
"publishConfig": {
|
|
54
53
|
"access": "public"
|
|
55
54
|
},
|
|
56
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "edfbf1cfb99082aa30813050900a3df7e8be5ced"
|
|
57
56
|
}
|