fyn 2.1.5 → 3.0.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 +2 -12
- package/bin/bundle.js +1 -1
- package/bin/index.js +22 -1
- package/dist/fyn.mjs +108158 -0
- package/dist/v8-compile-cache.js +3 -1
- package/package.json +17 -16
- package/dist/fyn.js +0 -135698
- package/dist/node_modules_f___p-map_7_0_3_p-map_index_js +0 -211
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
exports.id = "node_modules_f___p-map_7_0_3_p-map_index_js";
|
|
4
|
-
exports.ids = ["node_modules_f___p-map_7_0_3_p-map_index_js"];
|
|
5
|
-
exports.modules = {
|
|
6
|
-
|
|
7
|
-
/***/ "./node_modules/.f/_/p-map/7.0.3/p-map/index.js":
|
|
8
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
9
|
-
|
|
10
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11
|
-
/* harmony export */ "default": () => (/* binding */ pMap)
|
|
12
|
-
/* harmony export */ });
|
|
13
|
-
/* unused harmony exports pMapIterable, pMapSkip */
|
|
14
|
-
async function pMap(iterable, mapper, {
|
|
15
|
-
concurrency = Number.POSITIVE_INFINITY,
|
|
16
|
-
stopOnError = true,
|
|
17
|
-
signal
|
|
18
|
-
} = {}) {
|
|
19
|
-
return new Promise((resolve_, reject_) => {
|
|
20
|
-
if (iterable[Symbol.iterator] === void 0 && iterable[Symbol.asyncIterator] === void 0) {
|
|
21
|
-
throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
|
|
22
|
-
}
|
|
23
|
-
if (typeof mapper !== "function") {
|
|
24
|
-
throw new TypeError("Mapper function is required");
|
|
25
|
-
}
|
|
26
|
-
if (!(Number.isSafeInteger(concurrency) && concurrency >= 1 || concurrency === Number.POSITIVE_INFINITY)) {
|
|
27
|
-
throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
|
|
28
|
-
}
|
|
29
|
-
const result = [];
|
|
30
|
-
const errors = [];
|
|
31
|
-
const skippedIndexesMap = /* @__PURE__ */ new Map();
|
|
32
|
-
let isRejected = false;
|
|
33
|
-
let isResolved = false;
|
|
34
|
-
let isIterableDone = false;
|
|
35
|
-
let resolvingCount = 0;
|
|
36
|
-
let currentIndex = 0;
|
|
37
|
-
const iterator = iterable[Symbol.iterator] === void 0 ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
|
|
38
|
-
const signalListener = () => {
|
|
39
|
-
reject(signal.reason);
|
|
40
|
-
};
|
|
41
|
-
const cleanup = () => {
|
|
42
|
-
signal?.removeEventListener("abort", signalListener);
|
|
43
|
-
};
|
|
44
|
-
const resolve = (value) => {
|
|
45
|
-
resolve_(value);
|
|
46
|
-
cleanup();
|
|
47
|
-
};
|
|
48
|
-
const reject = (reason) => {
|
|
49
|
-
isRejected = true;
|
|
50
|
-
isResolved = true;
|
|
51
|
-
reject_(reason);
|
|
52
|
-
cleanup();
|
|
53
|
-
};
|
|
54
|
-
if (signal) {
|
|
55
|
-
if (signal.aborted) {
|
|
56
|
-
reject(signal.reason);
|
|
57
|
-
}
|
|
58
|
-
signal.addEventListener("abort", signalListener, { once: true });
|
|
59
|
-
}
|
|
60
|
-
const next = async () => {
|
|
61
|
-
if (isResolved) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const nextItem = await iterator.next();
|
|
65
|
-
const index = currentIndex;
|
|
66
|
-
currentIndex++;
|
|
67
|
-
if (nextItem.done) {
|
|
68
|
-
isIterableDone = true;
|
|
69
|
-
if (resolvingCount === 0 && !isResolved) {
|
|
70
|
-
if (!stopOnError && errors.length > 0) {
|
|
71
|
-
reject(new AggregateError(errors));
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
isResolved = true;
|
|
75
|
-
if (skippedIndexesMap.size === 0) {
|
|
76
|
-
resolve(result);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const pureResult = [];
|
|
80
|
-
for (const [index2, value] of result.entries()) {
|
|
81
|
-
if (skippedIndexesMap.get(index2) === pMapSkip) {
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
pureResult.push(value);
|
|
85
|
-
}
|
|
86
|
-
resolve(pureResult);
|
|
87
|
-
}
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
resolvingCount++;
|
|
91
|
-
(async () => {
|
|
92
|
-
try {
|
|
93
|
-
const element = await nextItem.value;
|
|
94
|
-
if (isResolved) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
const value = await mapper(element, index);
|
|
98
|
-
if (value === pMapSkip) {
|
|
99
|
-
skippedIndexesMap.set(index, value);
|
|
100
|
-
}
|
|
101
|
-
result[index] = value;
|
|
102
|
-
resolvingCount--;
|
|
103
|
-
await next();
|
|
104
|
-
} catch (error) {
|
|
105
|
-
if (stopOnError) {
|
|
106
|
-
reject(error);
|
|
107
|
-
} else {
|
|
108
|
-
errors.push(error);
|
|
109
|
-
resolvingCount--;
|
|
110
|
-
try {
|
|
111
|
-
await next();
|
|
112
|
-
} catch (error2) {
|
|
113
|
-
reject(error2);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
})();
|
|
118
|
-
};
|
|
119
|
-
(async () => {
|
|
120
|
-
for (let index = 0; index < concurrency; index++) {
|
|
121
|
-
try {
|
|
122
|
-
await next();
|
|
123
|
-
} catch (error) {
|
|
124
|
-
reject(error);
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
if (isIterableDone || isRejected) {
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
})();
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
function pMapIterable(iterable, mapper, {
|
|
135
|
-
concurrency = Number.POSITIVE_INFINITY,
|
|
136
|
-
backpressure = concurrency
|
|
137
|
-
} = {}) {
|
|
138
|
-
if (iterable[Symbol.iterator] === void 0 && iterable[Symbol.asyncIterator] === void 0) {
|
|
139
|
-
throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
|
|
140
|
-
}
|
|
141
|
-
if (typeof mapper !== "function") {
|
|
142
|
-
throw new TypeError("Mapper function is required");
|
|
143
|
-
}
|
|
144
|
-
if (!(Number.isSafeInteger(concurrency) && concurrency >= 1 || concurrency === Number.POSITIVE_INFINITY)) {
|
|
145
|
-
throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
|
|
146
|
-
}
|
|
147
|
-
if (!(Number.isSafeInteger(backpressure) && backpressure >= concurrency || backpressure === Number.POSITIVE_INFINITY)) {
|
|
148
|
-
throw new TypeError(`Expected \`backpressure\` to be an integer from \`concurrency\` (${concurrency}) and up or \`Infinity\`, got \`${backpressure}\` (${typeof backpressure})`);
|
|
149
|
-
}
|
|
150
|
-
return {
|
|
151
|
-
async *[Symbol.asyncIterator]() {
|
|
152
|
-
const iterator = iterable[Symbol.asyncIterator] === void 0 ? iterable[Symbol.iterator]() : iterable[Symbol.asyncIterator]();
|
|
153
|
-
const promises = [];
|
|
154
|
-
let runningMappersCount = 0;
|
|
155
|
-
let isDone = false;
|
|
156
|
-
let index = 0;
|
|
157
|
-
function trySpawn() {
|
|
158
|
-
if (isDone || !(runningMappersCount < concurrency && promises.length < backpressure)) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const promise = (async () => {
|
|
162
|
-
const { done, value } = await iterator.next();
|
|
163
|
-
if (done) {
|
|
164
|
-
return { done: true };
|
|
165
|
-
}
|
|
166
|
-
runningMappersCount++;
|
|
167
|
-
trySpawn();
|
|
168
|
-
try {
|
|
169
|
-
const returnValue = await mapper(await value, index++);
|
|
170
|
-
runningMappersCount--;
|
|
171
|
-
if (returnValue === pMapSkip) {
|
|
172
|
-
const index2 = promises.indexOf(promise);
|
|
173
|
-
if (index2 > 0) {
|
|
174
|
-
promises.splice(index2, 1);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
trySpawn();
|
|
178
|
-
return { done: false, value: returnValue };
|
|
179
|
-
} catch (error) {
|
|
180
|
-
isDone = true;
|
|
181
|
-
return { error };
|
|
182
|
-
}
|
|
183
|
-
})();
|
|
184
|
-
promises.push(promise);
|
|
185
|
-
}
|
|
186
|
-
trySpawn();
|
|
187
|
-
while (promises.length > 0) {
|
|
188
|
-
const { error, done, value } = await promises[0];
|
|
189
|
-
promises.shift();
|
|
190
|
-
if (error) {
|
|
191
|
-
throw error;
|
|
192
|
-
}
|
|
193
|
-
if (done) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
trySpawn();
|
|
197
|
-
if (value === pMapSkip) {
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
yield value;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
const pMapSkip = Symbol("skip");
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
/***/ })
|
|
209
|
-
|
|
210
|
-
};
|
|
211
|
-
;
|