@modern-js/plugin 2.19.1 → 2.21.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/CHANGELOG.md +26 -0
- package/dist/cjs/index.js +5 -17
- package/dist/cjs/manager/index.js +4 -16
- package/dist/cjs/waterfall/index.js +3 -15
- package/dist/cjs/workflow/index.js +4 -16
- package/dist/esm/index.js +31 -596
- package/dist/types/manager/async.d.ts +0 -9
- package/dist/types/manager/sync.d.ts +0 -9
- package/dist/types/manager/types.d.ts +0 -7
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
# @modern-js/plugin
|
2
2
|
|
3
|
+
## 2.21.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 26dcf3a: chore: bump typescript to v5 in devDependencies
|
8
|
+
|
9
|
+
chore: 升级 devDependencies 中的 typescript 版本到 v5
|
10
|
+
|
11
|
+
- Updated dependencies [e81eeaf]
|
12
|
+
- Updated dependencies [26dcf3a]
|
13
|
+
- Updated dependencies [056627f]
|
14
|
+
- Updated dependencies [0fc15ca]
|
15
|
+
- Updated dependencies [43b4e83]
|
16
|
+
- Updated dependencies [ad78387]
|
17
|
+
- @modern-js/utils@2.21.0
|
18
|
+
|
19
|
+
## 2.20.0
|
20
|
+
|
21
|
+
### Patch Changes
|
22
|
+
|
23
|
+
- 6b9d90a: chore: remove @babel/runtime. add @swc/helper and enable `externalHelper` config.
|
24
|
+
chore: 移除 @babel/runtime 依赖. 增加 @swc/helpers 依赖并且开启 `externalHelpers` 配置
|
25
|
+
- Updated dependencies [3c4e0a5]
|
26
|
+
- Updated dependencies [6b9d90a]
|
27
|
+
- @modern-js/utils@2.20.0
|
28
|
+
|
3
29
|
## 2.19.1
|
4
30
|
|
5
31
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
@@ -2,20 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
_export_star
|
6
|
-
_export_star(require("./
|
7
|
-
_export_star(require("./
|
8
|
-
_export_star(require("./
|
9
|
-
|
10
|
-
Object.keys(from).forEach(function(k) {
|
11
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
12
|
-
Object.defineProperty(to, k, {
|
13
|
-
enumerable: true,
|
14
|
-
get: function() {
|
15
|
-
return from[k];
|
16
|
-
}
|
17
|
-
});
|
18
|
-
}
|
19
|
-
});
|
20
|
-
return from;
|
21
|
-
}
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./farrow-pipeline"), exports);
|
7
|
+
_export_star._(require("./waterfall"), exports);
|
8
|
+
_export_star._(require("./workflow"), exports);
|
9
|
+
_export_star._(require("./manager"), exports);
|
@@ -2,19 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
_export_star
|
6
|
-
_export_star(require("./
|
7
|
-
_export_star(require("./
|
8
|
-
|
9
|
-
Object.keys(from).forEach(function(k) {
|
10
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
11
|
-
Object.defineProperty(to, k, {
|
12
|
-
enumerable: true,
|
13
|
-
get: function() {
|
14
|
-
return from[k];
|
15
|
-
}
|
16
|
-
});
|
17
|
-
}
|
18
|
-
});
|
19
|
-
return from;
|
20
|
-
}
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./sync"), exports);
|
7
|
+
_export_star._(require("./async"), exports);
|
8
|
+
_export_star._(require("./types"), exports);
|
@@ -2,18 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
_export_star
|
6
|
-
_export_star(require("./
|
7
|
-
|
8
|
-
Object.keys(from).forEach(function(k) {
|
9
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
10
|
-
Object.defineProperty(to, k, {
|
11
|
-
enumerable: true,
|
12
|
-
get: function() {
|
13
|
-
return from[k];
|
14
|
-
}
|
15
|
-
});
|
16
|
-
}
|
17
|
-
});
|
18
|
-
return from;
|
19
|
-
}
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./sync"), exports);
|
7
|
+
_export_star._(require("./async"), exports);
|
@@ -2,19 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
_export_star
|
6
|
-
_export_star(require("./
|
7
|
-
_export_star(require("./
|
8
|
-
|
9
|
-
Object.keys(from).forEach(function(k) {
|
10
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
11
|
-
Object.defineProperty(to, k, {
|
12
|
-
enumerable: true,
|
13
|
-
get: function() {
|
14
|
-
return from[k];
|
15
|
-
}
|
16
|
-
});
|
17
|
-
}
|
18
|
-
});
|
19
|
-
return from;
|
20
|
-
}
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./sync"), exports);
|
7
|
+
_export_star._(require("./parallel"), exports);
|
8
|
+
_export_star._(require("./async"), exports);
|
package/dist/esm/index.js
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
// src/farrow-pipeline/index.ts
|
2
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
3
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
4
|
+
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
5
|
+
|
1
6
|
// src/farrow-pipeline/context.ts
|
2
7
|
var createContext = function(value) {
|
3
8
|
var currentValue = value;
|
@@ -39,68 +44,6 @@ var createCounter = function(callback) {
|
|
39
44
|
};
|
40
45
|
|
41
46
|
// src/farrow-pipeline/index.ts
|
42
|
-
function _array_like_to_array(arr, len) {
|
43
|
-
if (len == null || len > arr.length)
|
44
|
-
len = arr.length;
|
45
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
46
|
-
arr2[i] = arr[i];
|
47
|
-
return arr2;
|
48
|
-
}
|
49
|
-
function _array_without_holes(arr) {
|
50
|
-
if (Array.isArray(arr))
|
51
|
-
return _array_like_to_array(arr);
|
52
|
-
}
|
53
|
-
function _define_property(obj, key, value) {
|
54
|
-
if (key in obj) {
|
55
|
-
Object.defineProperty(obj, key, {
|
56
|
-
value: value,
|
57
|
-
enumerable: true,
|
58
|
-
configurable: true,
|
59
|
-
writable: true
|
60
|
-
});
|
61
|
-
} else {
|
62
|
-
obj[key] = value;
|
63
|
-
}
|
64
|
-
return obj;
|
65
|
-
}
|
66
|
-
function _iterable_to_array(iter) {
|
67
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
68
|
-
return Array.from(iter);
|
69
|
-
}
|
70
|
-
function _non_iterable_spread() {
|
71
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
72
|
-
}
|
73
|
-
function _object_spread(target) {
|
74
|
-
for (var i = 1; i < arguments.length; i++) {
|
75
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
76
|
-
var ownKeys8 = Object.keys(source);
|
77
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
78
|
-
ownKeys8 = ownKeys8.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
79
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
80
|
-
}));
|
81
|
-
}
|
82
|
-
ownKeys8.forEach(function(key) {
|
83
|
-
_define_property(target, key, source[key]);
|
84
|
-
});
|
85
|
-
}
|
86
|
-
return target;
|
87
|
-
}
|
88
|
-
function _to_consumable_array(arr) {
|
89
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
90
|
-
}
|
91
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
92
|
-
if (!o)
|
93
|
-
return;
|
94
|
-
if (typeof o === "string")
|
95
|
-
return _array_like_to_array(o, minLen);
|
96
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
97
|
-
if (n === "Object" && o.constructor)
|
98
|
-
n = o.constructor.name;
|
99
|
-
if (n === "Map" || n === "Set")
|
100
|
-
return Array.from(n);
|
101
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
102
|
-
return _array_like_to_array(o, minLen);
|
103
|
-
}
|
104
47
|
var isPipeline = function(input) {
|
105
48
|
return Boolean(input === null || input === void 0 ? void 0 : input[PipelineSymbol]);
|
106
49
|
};
|
@@ -159,92 +102,10 @@ var createAsyncPipeline = function() {
|
|
159
102
|
};
|
160
103
|
|
161
104
|
// src/waterfall/sync.ts
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
arr2[i] = arr[i];
|
167
|
-
return arr2;
|
168
|
-
}
|
169
|
-
function _array_without_holes2(arr) {
|
170
|
-
if (Array.isArray(arr))
|
171
|
-
return _array_like_to_array2(arr);
|
172
|
-
}
|
173
|
-
function _define_property2(obj, key, value) {
|
174
|
-
if (key in obj) {
|
175
|
-
Object.defineProperty(obj, key, {
|
176
|
-
value: value,
|
177
|
-
enumerable: true,
|
178
|
-
configurable: true,
|
179
|
-
writable: true
|
180
|
-
});
|
181
|
-
} else {
|
182
|
-
obj[key] = value;
|
183
|
-
}
|
184
|
-
return obj;
|
185
|
-
}
|
186
|
-
function _iterable_to_array2(iter) {
|
187
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
188
|
-
return Array.from(iter);
|
189
|
-
}
|
190
|
-
function _non_iterable_spread2() {
|
191
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
192
|
-
}
|
193
|
-
function _object_spread2(target) {
|
194
|
-
for (var i = 1; i < arguments.length; i++) {
|
195
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
196
|
-
var ownKeys8 = Object.keys(source);
|
197
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
198
|
-
ownKeys8 = ownKeys8.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
199
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
200
|
-
}));
|
201
|
-
}
|
202
|
-
ownKeys8.forEach(function(key) {
|
203
|
-
_define_property2(target, key, source[key]);
|
204
|
-
});
|
205
|
-
}
|
206
|
-
return target;
|
207
|
-
}
|
208
|
-
function ownKeys(object, enumerableOnly) {
|
209
|
-
var keys = Object.keys(object);
|
210
|
-
if (Object.getOwnPropertySymbols) {
|
211
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
212
|
-
if (enumerableOnly) {
|
213
|
-
symbols = symbols.filter(function(sym) {
|
214
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
215
|
-
});
|
216
|
-
}
|
217
|
-
keys.push.apply(keys, symbols);
|
218
|
-
}
|
219
|
-
return keys;
|
220
|
-
}
|
221
|
-
function _object_spread_props(target, source) {
|
222
|
-
source = source != null ? source : {};
|
223
|
-
if (Object.getOwnPropertyDescriptors) {
|
224
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
225
|
-
} else {
|
226
|
-
ownKeys(Object(source)).forEach(function(key) {
|
227
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
228
|
-
});
|
229
|
-
}
|
230
|
-
return target;
|
231
|
-
}
|
232
|
-
function _to_consumable_array2(arr) {
|
233
|
-
return _array_without_holes2(arr) || _iterable_to_array2(arr) || _unsupported_iterable_to_array2(arr) || _non_iterable_spread2();
|
234
|
-
}
|
235
|
-
function _unsupported_iterable_to_array2(o, minLen) {
|
236
|
-
if (!o)
|
237
|
-
return;
|
238
|
-
if (typeof o === "string")
|
239
|
-
return _array_like_to_array2(o, minLen);
|
240
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
241
|
-
if (n === "Object" && o.constructor)
|
242
|
-
n = o.constructor.name;
|
243
|
-
if (n === "Map" || n === "Set")
|
244
|
-
return Array.from(n);
|
245
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
246
|
-
return _array_like_to_array2(o, minLen);
|
247
|
-
}
|
105
|
+
import { _ as _define_property2 } from "@swc/helpers/_/_define_property";
|
106
|
+
import { _ as _object_spread2 } from "@swc/helpers/_/_object_spread";
|
107
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
108
|
+
import { _ as _to_consumable_array2 } from "@swc/helpers/_/_to_consumable_array";
|
248
109
|
var WATERFALL_SYMBOL = Symbol.for("MODERN_WATERFALL");
|
249
110
|
var getBrook = function(input) {
|
250
111
|
if (typeof input === "function") {
|
@@ -295,92 +156,10 @@ var mapBrookToMiddleware = function(brook) {
|
|
295
156
|
};
|
296
157
|
|
297
158
|
// src/waterfall/async.ts
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
arr2[i] = arr[i];
|
303
|
-
return arr2;
|
304
|
-
}
|
305
|
-
function _array_without_holes3(arr) {
|
306
|
-
if (Array.isArray(arr))
|
307
|
-
return _array_like_to_array3(arr);
|
308
|
-
}
|
309
|
-
function _define_property3(obj, key, value) {
|
310
|
-
if (key in obj) {
|
311
|
-
Object.defineProperty(obj, key, {
|
312
|
-
value: value,
|
313
|
-
enumerable: true,
|
314
|
-
configurable: true,
|
315
|
-
writable: true
|
316
|
-
});
|
317
|
-
} else {
|
318
|
-
obj[key] = value;
|
319
|
-
}
|
320
|
-
return obj;
|
321
|
-
}
|
322
|
-
function _iterable_to_array3(iter) {
|
323
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
324
|
-
return Array.from(iter);
|
325
|
-
}
|
326
|
-
function _non_iterable_spread3() {
|
327
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
328
|
-
}
|
329
|
-
function _object_spread3(target) {
|
330
|
-
for (var i = 1; i < arguments.length; i++) {
|
331
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
332
|
-
var ownKeys8 = Object.keys(source);
|
333
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
334
|
-
ownKeys8 = ownKeys8.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
335
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
336
|
-
}));
|
337
|
-
}
|
338
|
-
ownKeys8.forEach(function(key) {
|
339
|
-
_define_property3(target, key, source[key]);
|
340
|
-
});
|
341
|
-
}
|
342
|
-
return target;
|
343
|
-
}
|
344
|
-
function ownKeys2(object, enumerableOnly) {
|
345
|
-
var keys = Object.keys(object);
|
346
|
-
if (Object.getOwnPropertySymbols) {
|
347
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
348
|
-
if (enumerableOnly) {
|
349
|
-
symbols = symbols.filter(function(sym) {
|
350
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
351
|
-
});
|
352
|
-
}
|
353
|
-
keys.push.apply(keys, symbols);
|
354
|
-
}
|
355
|
-
return keys;
|
356
|
-
}
|
357
|
-
function _object_spread_props2(target, source) {
|
358
|
-
source = source != null ? source : {};
|
359
|
-
if (Object.getOwnPropertyDescriptors) {
|
360
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
361
|
-
} else {
|
362
|
-
ownKeys2(Object(source)).forEach(function(key) {
|
363
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
364
|
-
});
|
365
|
-
}
|
366
|
-
return target;
|
367
|
-
}
|
368
|
-
function _to_consumable_array3(arr) {
|
369
|
-
return _array_without_holes3(arr) || _iterable_to_array3(arr) || _unsupported_iterable_to_array3(arr) || _non_iterable_spread3();
|
370
|
-
}
|
371
|
-
function _unsupported_iterable_to_array3(o, minLen) {
|
372
|
-
if (!o)
|
373
|
-
return;
|
374
|
-
if (typeof o === "string")
|
375
|
-
return _array_like_to_array3(o, minLen);
|
376
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
377
|
-
if (n === "Object" && o.constructor)
|
378
|
-
n = o.constructor.name;
|
379
|
-
if (n === "Map" || n === "Set")
|
380
|
-
return Array.from(n);
|
381
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
382
|
-
return _array_like_to_array3(o, minLen);
|
383
|
-
}
|
159
|
+
import { _ as _define_property3 } from "@swc/helpers/_/_define_property";
|
160
|
+
import { _ as _object_spread3 } from "@swc/helpers/_/_object_spread";
|
161
|
+
import { _ as _object_spread_props2 } from "@swc/helpers/_/_object_spread_props";
|
162
|
+
import { _ as _to_consumable_array3 } from "@swc/helpers/_/_to_consumable_array";
|
384
163
|
var ASYNC_WATERFALL_SYMBOL = Symbol.for("MODERN_ASYNC_WATERFALL");
|
385
164
|
var getAsyncBrook = function(input) {
|
386
165
|
if (typeof input === "function") {
|
@@ -434,92 +213,10 @@ var mapAsyncBrookToAsyncMiddleware = function(brook) {
|
|
434
213
|
};
|
435
214
|
|
436
215
|
// src/workflow/sync.ts
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
arr2[i] = arr[i];
|
442
|
-
return arr2;
|
443
|
-
}
|
444
|
-
function _array_without_holes4(arr) {
|
445
|
-
if (Array.isArray(arr))
|
446
|
-
return _array_like_to_array4(arr);
|
447
|
-
}
|
448
|
-
function _define_property4(obj, key, value) {
|
449
|
-
if (key in obj) {
|
450
|
-
Object.defineProperty(obj, key, {
|
451
|
-
value: value,
|
452
|
-
enumerable: true,
|
453
|
-
configurable: true,
|
454
|
-
writable: true
|
455
|
-
});
|
456
|
-
} else {
|
457
|
-
obj[key] = value;
|
458
|
-
}
|
459
|
-
return obj;
|
460
|
-
}
|
461
|
-
function _iterable_to_array4(iter) {
|
462
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
463
|
-
return Array.from(iter);
|
464
|
-
}
|
465
|
-
function _non_iterable_spread4() {
|
466
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
467
|
-
}
|
468
|
-
function _object_spread4(target) {
|
469
|
-
for (var i = 1; i < arguments.length; i++) {
|
470
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
471
|
-
var ownKeys8 = Object.keys(source);
|
472
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
473
|
-
ownKeys8 = ownKeys8.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
474
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
475
|
-
}));
|
476
|
-
}
|
477
|
-
ownKeys8.forEach(function(key) {
|
478
|
-
_define_property4(target, key, source[key]);
|
479
|
-
});
|
480
|
-
}
|
481
|
-
return target;
|
482
|
-
}
|
483
|
-
function ownKeys3(object, enumerableOnly) {
|
484
|
-
var keys = Object.keys(object);
|
485
|
-
if (Object.getOwnPropertySymbols) {
|
486
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
487
|
-
if (enumerableOnly) {
|
488
|
-
symbols = symbols.filter(function(sym) {
|
489
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
490
|
-
});
|
491
|
-
}
|
492
|
-
keys.push.apply(keys, symbols);
|
493
|
-
}
|
494
|
-
return keys;
|
495
|
-
}
|
496
|
-
function _object_spread_props3(target, source) {
|
497
|
-
source = source != null ? source : {};
|
498
|
-
if (Object.getOwnPropertyDescriptors) {
|
499
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
500
|
-
} else {
|
501
|
-
ownKeys3(Object(source)).forEach(function(key) {
|
502
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
503
|
-
});
|
504
|
-
}
|
505
|
-
return target;
|
506
|
-
}
|
507
|
-
function _to_consumable_array4(arr) {
|
508
|
-
return _array_without_holes4(arr) || _iterable_to_array4(arr) || _unsupported_iterable_to_array4(arr) || _non_iterable_spread4();
|
509
|
-
}
|
510
|
-
function _unsupported_iterable_to_array4(o, minLen) {
|
511
|
-
if (!o)
|
512
|
-
return;
|
513
|
-
if (typeof o === "string")
|
514
|
-
return _array_like_to_array4(o, minLen);
|
515
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
516
|
-
if (n === "Object" && o.constructor)
|
517
|
-
n = o.constructor.name;
|
518
|
-
if (n === "Map" || n === "Set")
|
519
|
-
return Array.from(n);
|
520
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
521
|
-
return _array_like_to_array4(o, minLen);
|
522
|
-
}
|
216
|
+
import { _ as _define_property4 } from "@swc/helpers/_/_define_property";
|
217
|
+
import { _ as _object_spread4 } from "@swc/helpers/_/_object_spread";
|
218
|
+
import { _ as _object_spread_props3 } from "@swc/helpers/_/_object_spread_props";
|
219
|
+
import { _ as _to_consumable_array4 } from "@swc/helpers/_/_to_consumable_array";
|
523
220
|
var WORKFLOW_SYMBOL = Symbol.for("MODERN_WORKFLOW");
|
524
221
|
var createWorkflow = function() {
|
525
222
|
var pipeline = createPipeline();
|
@@ -557,92 +254,10 @@ var mapWorkerToMiddleware = function(worker) {
|
|
557
254
|
};
|
558
255
|
|
559
256
|
// src/workflow/parallel.ts
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
arr2[i] = arr[i];
|
565
|
-
return arr2;
|
566
|
-
}
|
567
|
-
function _array_without_holes5(arr) {
|
568
|
-
if (Array.isArray(arr))
|
569
|
-
return _array_like_to_array5(arr);
|
570
|
-
}
|
571
|
-
function _define_property5(obj, key, value) {
|
572
|
-
if (key in obj) {
|
573
|
-
Object.defineProperty(obj, key, {
|
574
|
-
value: value,
|
575
|
-
enumerable: true,
|
576
|
-
configurable: true,
|
577
|
-
writable: true
|
578
|
-
});
|
579
|
-
} else {
|
580
|
-
obj[key] = value;
|
581
|
-
}
|
582
|
-
return obj;
|
583
|
-
}
|
584
|
-
function _iterable_to_array5(iter) {
|
585
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
586
|
-
return Array.from(iter);
|
587
|
-
}
|
588
|
-
function _non_iterable_spread5() {
|
589
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
590
|
-
}
|
591
|
-
function _object_spread5(target) {
|
592
|
-
for (var i = 1; i < arguments.length; i++) {
|
593
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
594
|
-
var ownKeys8 = Object.keys(source);
|
595
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
596
|
-
ownKeys8 = ownKeys8.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
597
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
598
|
-
}));
|
599
|
-
}
|
600
|
-
ownKeys8.forEach(function(key) {
|
601
|
-
_define_property5(target, key, source[key]);
|
602
|
-
});
|
603
|
-
}
|
604
|
-
return target;
|
605
|
-
}
|
606
|
-
function ownKeys4(object, enumerableOnly) {
|
607
|
-
var keys = Object.keys(object);
|
608
|
-
if (Object.getOwnPropertySymbols) {
|
609
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
610
|
-
if (enumerableOnly) {
|
611
|
-
symbols = symbols.filter(function(sym) {
|
612
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
613
|
-
});
|
614
|
-
}
|
615
|
-
keys.push.apply(keys, symbols);
|
616
|
-
}
|
617
|
-
return keys;
|
618
|
-
}
|
619
|
-
function _object_spread_props4(target, source) {
|
620
|
-
source = source != null ? source : {};
|
621
|
-
if (Object.getOwnPropertyDescriptors) {
|
622
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
623
|
-
} else {
|
624
|
-
ownKeys4(Object(source)).forEach(function(key) {
|
625
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
626
|
-
});
|
627
|
-
}
|
628
|
-
return target;
|
629
|
-
}
|
630
|
-
function _to_consumable_array5(arr) {
|
631
|
-
return _array_without_holes5(arr) || _iterable_to_array5(arr) || _unsupported_iterable_to_array5(arr) || _non_iterable_spread5();
|
632
|
-
}
|
633
|
-
function _unsupported_iterable_to_array5(o, minLen) {
|
634
|
-
if (!o)
|
635
|
-
return;
|
636
|
-
if (typeof o === "string")
|
637
|
-
return _array_like_to_array5(o, minLen);
|
638
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
639
|
-
if (n === "Object" && o.constructor)
|
640
|
-
n = o.constructor.name;
|
641
|
-
if (n === "Map" || n === "Set")
|
642
|
-
return Array.from(n);
|
643
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
644
|
-
return _array_like_to_array5(o, minLen);
|
645
|
-
}
|
257
|
+
import { _ as _define_property5 } from "@swc/helpers/_/_define_property";
|
258
|
+
import { _ as _object_spread5 } from "@swc/helpers/_/_object_spread";
|
259
|
+
import { _ as _object_spread_props4 } from "@swc/helpers/_/_object_spread_props";
|
260
|
+
import { _ as _to_consumable_array5 } from "@swc/helpers/_/_to_consumable_array";
|
646
261
|
var PARALLEL_WORKFLOW_SYMBOL = Symbol.for("MODERN_PARALLEL_WORKFLOW");
|
647
262
|
var isParallelWorkflow = function(input) {
|
648
263
|
return Boolean(input === null || input === void 0 ? void 0 : input[PARALLEL_WORKFLOW_SYMBOL]);
|
@@ -681,92 +296,10 @@ var mapParallelWorkerToAsyncMiddleware = function(worker) {
|
|
681
296
|
};
|
682
297
|
|
683
298
|
// src/workflow/async.ts
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
arr2[i] = arr[i];
|
689
|
-
return arr2;
|
690
|
-
}
|
691
|
-
function _array_without_holes6(arr) {
|
692
|
-
if (Array.isArray(arr))
|
693
|
-
return _array_like_to_array6(arr);
|
694
|
-
}
|
695
|
-
function _define_property6(obj, key, value) {
|
696
|
-
if (key in obj) {
|
697
|
-
Object.defineProperty(obj, key, {
|
698
|
-
value: value,
|
699
|
-
enumerable: true,
|
700
|
-
configurable: true,
|
701
|
-
writable: true
|
702
|
-
});
|
703
|
-
} else {
|
704
|
-
obj[key] = value;
|
705
|
-
}
|
706
|
-
return obj;
|
707
|
-
}
|
708
|
-
function _iterable_to_array6(iter) {
|
709
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
710
|
-
return Array.from(iter);
|
711
|
-
}
|
712
|
-
function _non_iterable_spread6() {
|
713
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
714
|
-
}
|
715
|
-
function _object_spread6(target) {
|
716
|
-
for (var i = 1; i < arguments.length; i++) {
|
717
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
718
|
-
var ownKeys8 = Object.keys(source);
|
719
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
720
|
-
ownKeys8 = ownKeys8.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
721
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
722
|
-
}));
|
723
|
-
}
|
724
|
-
ownKeys8.forEach(function(key) {
|
725
|
-
_define_property6(target, key, source[key]);
|
726
|
-
});
|
727
|
-
}
|
728
|
-
return target;
|
729
|
-
}
|
730
|
-
function ownKeys5(object, enumerableOnly) {
|
731
|
-
var keys = Object.keys(object);
|
732
|
-
if (Object.getOwnPropertySymbols) {
|
733
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
734
|
-
if (enumerableOnly) {
|
735
|
-
symbols = symbols.filter(function(sym) {
|
736
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
737
|
-
});
|
738
|
-
}
|
739
|
-
keys.push.apply(keys, symbols);
|
740
|
-
}
|
741
|
-
return keys;
|
742
|
-
}
|
743
|
-
function _object_spread_props5(target, source) {
|
744
|
-
source = source != null ? source : {};
|
745
|
-
if (Object.getOwnPropertyDescriptors) {
|
746
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
747
|
-
} else {
|
748
|
-
ownKeys5(Object(source)).forEach(function(key) {
|
749
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
750
|
-
});
|
751
|
-
}
|
752
|
-
return target;
|
753
|
-
}
|
754
|
-
function _to_consumable_array6(arr) {
|
755
|
-
return _array_without_holes6(arr) || _iterable_to_array6(arr) || _unsupported_iterable_to_array6(arr) || _non_iterable_spread6();
|
756
|
-
}
|
757
|
-
function _unsupported_iterable_to_array6(o, minLen) {
|
758
|
-
if (!o)
|
759
|
-
return;
|
760
|
-
if (typeof o === "string")
|
761
|
-
return _array_like_to_array6(o, minLen);
|
762
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
763
|
-
if (n === "Object" && o.constructor)
|
764
|
-
n = o.constructor.name;
|
765
|
-
if (n === "Map" || n === "Set")
|
766
|
-
return Array.from(n);
|
767
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
768
|
-
return _array_like_to_array6(o, minLen);
|
769
|
-
}
|
299
|
+
import { _ as _define_property6 } from "@swc/helpers/_/_define_property";
|
300
|
+
import { _ as _object_spread6 } from "@swc/helpers/_/_object_spread";
|
301
|
+
import { _ as _object_spread_props5 } from "@swc/helpers/_/_object_spread_props";
|
302
|
+
import { _ as _to_consumable_array6 } from "@swc/helpers/_/_to_consumable_array";
|
770
303
|
var ASYNC_WORKFLOW_SYMBOL = Symbol.for("MODERN_ASYNC_WORKFLOW");
|
771
304
|
var isAsyncWorkflow = function(input) {
|
772
305
|
return Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WORKFLOW_SYMBOL]);
|
@@ -815,6 +348,10 @@ function isPromise(obj) {
|
|
815
348
|
return obj && typeof obj.then === "function";
|
816
349
|
}
|
817
350
|
|
351
|
+
// src/manager/sync.ts
|
352
|
+
import { _ as _object_spread7 } from "@swc/helpers/_/_object_spread";
|
353
|
+
import { _ as _object_spread_props6 } from "@swc/helpers/_/_object_spread_props";
|
354
|
+
|
818
355
|
// src/manager/shared.ts
|
819
356
|
import { pluginDagSort } from "@modern-js/utils/universal/plugin-dag-sort";
|
820
357
|
var checkPlugins = function(plugins) {
|
@@ -853,58 +390,6 @@ var hasOwnProperty = function(obj, prop) {
|
|
853
390
|
};
|
854
391
|
|
855
392
|
// src/manager/sync.ts
|
856
|
-
function _define_property7(obj, key, value) {
|
857
|
-
if (key in obj) {
|
858
|
-
Object.defineProperty(obj, key, {
|
859
|
-
value: value,
|
860
|
-
enumerable: true,
|
861
|
-
configurable: true,
|
862
|
-
writable: true
|
863
|
-
});
|
864
|
-
} else {
|
865
|
-
obj[key] = value;
|
866
|
-
}
|
867
|
-
return obj;
|
868
|
-
}
|
869
|
-
function _object_spread7(target) {
|
870
|
-
for (var i = 1; i < arguments.length; i++) {
|
871
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
872
|
-
var ownKeys8 = Object.keys(source);
|
873
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
874
|
-
ownKeys8 = ownKeys8.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
875
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
876
|
-
}));
|
877
|
-
}
|
878
|
-
ownKeys8.forEach(function(key) {
|
879
|
-
_define_property7(target, key, source[key]);
|
880
|
-
});
|
881
|
-
}
|
882
|
-
return target;
|
883
|
-
}
|
884
|
-
function ownKeys6(object, enumerableOnly) {
|
885
|
-
var keys = Object.keys(object);
|
886
|
-
if (Object.getOwnPropertySymbols) {
|
887
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
888
|
-
if (enumerableOnly) {
|
889
|
-
symbols = symbols.filter(function(sym) {
|
890
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
891
|
-
});
|
892
|
-
}
|
893
|
-
keys.push.apply(keys, symbols);
|
894
|
-
}
|
895
|
-
return keys;
|
896
|
-
}
|
897
|
-
function _object_spread_props6(target, source) {
|
898
|
-
source = source != null ? source : {};
|
899
|
-
if (Object.getOwnPropertyDescriptors) {
|
900
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
901
|
-
} else {
|
902
|
-
ownKeys6(Object(source)).forEach(function(key) {
|
903
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
904
|
-
});
|
905
|
-
}
|
906
|
-
return target;
|
907
|
-
}
|
908
393
|
var SYNC_PLUGIN_SYMBOL = "SYNC_PLUGIN_SYMBOL";
|
909
394
|
var DEFAULT_OPTIONS = {
|
910
395
|
name: "untitled",
|
@@ -1058,58 +543,8 @@ var cloneHooksMap = function(record) {
|
|
1058
543
|
};
|
1059
544
|
|
1060
545
|
// src/manager/async.ts
|
1061
|
-
|
1062
|
-
|
1063
|
-
Object.defineProperty(obj, key, {
|
1064
|
-
value: value,
|
1065
|
-
enumerable: true,
|
1066
|
-
configurable: true,
|
1067
|
-
writable: true
|
1068
|
-
});
|
1069
|
-
} else {
|
1070
|
-
obj[key] = value;
|
1071
|
-
}
|
1072
|
-
return obj;
|
1073
|
-
}
|
1074
|
-
function _object_spread8(target) {
|
1075
|
-
for (var i = 1; i < arguments.length; i++) {
|
1076
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
1077
|
-
var ownKeys8 = Object.keys(source);
|
1078
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
1079
|
-
ownKeys8 = ownKeys8.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
1080
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
1081
|
-
}));
|
1082
|
-
}
|
1083
|
-
ownKeys8.forEach(function(key) {
|
1084
|
-
_define_property8(target, key, source[key]);
|
1085
|
-
});
|
1086
|
-
}
|
1087
|
-
return target;
|
1088
|
-
}
|
1089
|
-
function ownKeys7(object, enumerableOnly) {
|
1090
|
-
var keys = Object.keys(object);
|
1091
|
-
if (Object.getOwnPropertySymbols) {
|
1092
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
1093
|
-
if (enumerableOnly) {
|
1094
|
-
symbols = symbols.filter(function(sym) {
|
1095
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
1096
|
-
});
|
1097
|
-
}
|
1098
|
-
keys.push.apply(keys, symbols);
|
1099
|
-
}
|
1100
|
-
return keys;
|
1101
|
-
}
|
1102
|
-
function _object_spread_props7(target, source) {
|
1103
|
-
source = source != null ? source : {};
|
1104
|
-
if (Object.getOwnPropertyDescriptors) {
|
1105
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
1106
|
-
} else {
|
1107
|
-
ownKeys7(Object(source)).forEach(function(key) {
|
1108
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
1109
|
-
});
|
1110
|
-
}
|
1111
|
-
return target;
|
1112
|
-
}
|
546
|
+
import { _ as _object_spread8 } from "@swc/helpers/_/_object_spread";
|
547
|
+
import { _ as _object_spread_props7 } from "@swc/helpers/_/_object_spread_props";
|
1113
548
|
var ASYNC_PLUGIN_SYMBOL = "ASYNC_PLUGIN_SYMBOL";
|
1114
549
|
var createAsyncManager = function(hooks, api) {
|
1115
550
|
var index = 0;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import type { ToRunners, ToThreads, CommonAPI, PluginOptions } from './types';
|
2
2
|
/** Setup function of async plugin. */
|
3
|
-
|
4
3
|
export type AsyncSetup<Hooks, API = Record<string, never>> = (api: API & CommonAPI<Hooks>) => Partial<ToThreads<Hooks>> | Promise<Partial<ToThreads<Hooks>> | void> | void;
|
5
4
|
declare const ASYNC_PLUGIN_SYMBOL = "ASYNC_PLUGIN_SYMBOL";
|
6
5
|
export type AsyncPlugin<Hooks, API> = {
|
@@ -17,46 +16,38 @@ export type AsyncManager<Hooks, API> = {
|
|
17
16
|
* Determine if a value is a async plugin.
|
18
17
|
* @param input
|
19
18
|
*/
|
20
|
-
|
21
19
|
isPlugin: (input: unknown) => input is AsyncPlugin<Hooks, API>;
|
22
20
|
/**
|
23
21
|
* Register new plugins to current manager.
|
24
22
|
* @param plugins one or more plugin.
|
25
23
|
*/
|
26
|
-
|
27
24
|
usePlugin: (...plugins: Array<AsyncPlugin<Hooks, API> | PluginOptions<Hooks, AsyncSetup<Hooks, API>> | (() => PluginOptions<Hooks, AsyncSetup<Hooks, API>>)>) => AsyncManager<Hooks, API>;
|
28
25
|
/**
|
29
26
|
* Init manager, it will call the setup function of all registered plugins.
|
30
27
|
*/
|
31
|
-
|
32
28
|
init: () => Promise<ToRunners<Hooks>>;
|
33
29
|
/**
|
34
30
|
* Run callback function.
|
35
31
|
* @param callback
|
36
32
|
*/
|
37
|
-
|
38
33
|
run: <O>(cb: () => O) => O;
|
39
34
|
/**
|
40
35
|
* Register new hooks.
|
41
36
|
* @param newHooks
|
42
37
|
*/
|
43
|
-
|
44
38
|
registerHook: (newHooks: Partial<Hooks>) => void;
|
45
39
|
/**
|
46
40
|
* Return a cloned manager.
|
47
41
|
* @param overrideAPI override the default plugin API.
|
48
42
|
*/
|
49
|
-
|
50
43
|
clone: (overrideAPI?: Partial<API & CommonAPI<Hooks>>) => AsyncManager<Hooks, API>;
|
51
44
|
/**
|
52
45
|
* Clear all registered plugins.
|
53
46
|
*/
|
54
|
-
|
55
47
|
clear: () => void;
|
56
48
|
/**
|
57
49
|
* Get all runner functions of the hooks.
|
58
50
|
*/
|
59
|
-
|
60
51
|
useRunner: () => ToRunners<Hooks>;
|
61
52
|
};
|
62
53
|
export declare const createAsyncManager: <Hooks extends Record<string, any>, API extends Record<string, any> = Record<string, never>>(hooks?: Partial<Hooks> | undefined, api?: API | undefined) => AsyncManager<Hooks, API>;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import type { Hook, CommonAPI, ToRunners, ToThreads, PluginOptions } from './types';
|
2
2
|
/** Setup function of sync plugin. */
|
3
|
-
|
4
3
|
export type Setup<Hooks, API = Record<string, never>> = (api: API) => Partial<ToThreads<Hooks>> | void;
|
5
4
|
declare const SYNC_PLUGIN_SYMBOL = "SYNC_PLUGIN_SYMBOL";
|
6
5
|
export type Plugin<Hooks, API> = {
|
@@ -17,46 +16,38 @@ export type Manager<Hooks, API> = {
|
|
17
16
|
* Determine if a value is a sync plugin.
|
18
17
|
* @param input
|
19
18
|
*/
|
20
|
-
|
21
19
|
isPlugin: (input: unknown) => input is Plugin<Hooks, API>;
|
22
20
|
/**
|
23
21
|
* Register new plugins to current manager.
|
24
22
|
* @param plugins one or more plugin.
|
25
23
|
*/
|
26
|
-
|
27
24
|
usePlugin: (...plugins: Array<Plugin<Hooks, API> | PluginOptions<Hooks, Setup<Hooks, API>> | (() => PluginOptions<Hooks, Setup<Hooks, API>>)>) => Manager<Hooks, API>;
|
28
25
|
/**
|
29
26
|
* Init manager, it will call the setup function of all registered plugins.
|
30
27
|
*/
|
31
|
-
|
32
28
|
init: () => ToRunners<Hooks>;
|
33
29
|
/**
|
34
30
|
* Run callback function.
|
35
31
|
* @param callback
|
36
32
|
*/
|
37
|
-
|
38
33
|
run: <O>(cb: () => O) => O;
|
39
34
|
/**
|
40
35
|
* Register new hooks.
|
41
36
|
* @param newHooks
|
42
37
|
*/
|
43
|
-
|
44
38
|
registerHook: (hewHooks: Partial<Hooks>) => void;
|
45
39
|
/**
|
46
40
|
* Clear all registered plugins.
|
47
41
|
*/
|
48
|
-
|
49
42
|
clear: () => void;
|
50
43
|
/**
|
51
44
|
* Return a cloned manager.
|
52
45
|
* @param overrideAPI override the default plugin API.
|
53
46
|
*/
|
54
|
-
|
55
47
|
clone: (overrideAPI?: Partial<API & CommonAPI<Hooks>>) => Manager<Hooks, API>;
|
56
48
|
/**
|
57
49
|
* Get all runner functions of the hooks.
|
58
50
|
*/
|
59
|
-
|
60
51
|
useRunner: () => ToRunners<Hooks>;
|
61
52
|
};
|
62
53
|
export declare const DEFAULT_OPTIONS: {
|
@@ -2,23 +2,17 @@ import type { Pipeline, MaybeAsync, Middleware, AsyncPipeline } from '../farrow-
|
|
2
2
|
import type { Brook, Waterfall, AsyncBrook, AsyncWaterfall } from '../waterfall';
|
3
3
|
import type { Worker, Workflow, AsyncWorker, AsyncWorkflow, ParallelWorkflow } from '../workflow';
|
4
4
|
/** All hook types. */
|
5
|
-
|
6
5
|
export type Hook = Waterfall<any> | AsyncWaterfall<any> | Workflow<any, any> | AsyncWorkflow<any, any> | ParallelWorkflow<any> | Pipeline<any, any> | AsyncPipeline<any, any>;
|
7
6
|
export type HooksMap = Record<string, Hook>;
|
8
7
|
/** Extract the type of callback function from a hook. */
|
9
|
-
|
10
8
|
export type ToThread<P extends Hook> = P extends Workflow<infer I, infer O> ? Worker<I, O> : P extends AsyncWorkflow<infer I, infer O> ? AsyncWorker<I, O> : P extends ParallelWorkflow<infer I, infer O> ? AsyncWorker<I, O> : P extends Waterfall<infer I> ? Brook<I> : P extends AsyncWaterfall<infer I> ? AsyncBrook<I> : P extends Pipeline<infer I, infer O> ? Middleware<I, O> : P extends AsyncPipeline<infer I, infer O> ? Middleware<I, MaybeAsync<O>> : never;
|
11
9
|
/** Extract types of callback function from hooks. */
|
12
|
-
|
13
10
|
export type ToThreads<PS> = { [K in keyof PS]: PS[K] extends Hook ? ToThread<PS[K]> : PS[K] extends void ? void : never };
|
14
11
|
/** Extract run method from a hook. */
|
15
|
-
|
16
12
|
export type RunnerFromHook<P extends Hook> = P extends Waterfall<infer I> ? Waterfall<I>['run'] : P extends AsyncWaterfall<infer I> ? AsyncWaterfall<I>['run'] : P extends Workflow<infer I, infer O> ? Workflow<I, O>['run'] : P extends AsyncWorkflow<infer I, infer O> ? AsyncWorkflow<I, O>['run'] : P extends ParallelWorkflow<infer I, infer O> ? ParallelWorkflow<I, O>['run'] : P extends Pipeline<infer I, infer O> ? Pipeline<I, O>['run'] : P extends AsyncPipeline<infer I, infer O> ? AsyncPipeline<I, O>['run'] : never;
|
17
13
|
/** Extract all run methods from hooks. */
|
18
|
-
|
19
14
|
export type ToRunners<PS> = { [K in keyof PS]: PS[K] extends Hook ? RunnerFromHook<PS[K]> : PS[K] extends void ? void : never };
|
20
15
|
/** All options to define a plugin. */
|
21
|
-
|
22
16
|
export type PluginOptions<Hooks, Setup = undefined, ExtendHooks = Record<string, unknown>> = {
|
23
17
|
name?: string;
|
24
18
|
pre?: string[];
|
@@ -30,7 +24,6 @@ export type PluginOptions<Hooks, Setup = undefined, ExtendHooks = Record<string,
|
|
30
24
|
registerHook?: Partial<Hooks & ExtendHooks>;
|
31
25
|
};
|
32
26
|
/** Common api of setup function. */
|
33
|
-
|
34
27
|
export type CommonAPI<Hooks> = {
|
35
28
|
useHookRunners: () => ToRunners<Hooks>;
|
36
29
|
};
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.21.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -32,16 +32,16 @@
|
|
32
32
|
}
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
|
-
"@
|
36
|
-
"@modern-js/utils": "2.
|
35
|
+
"@swc/helpers": "0.5.1",
|
36
|
+
"@modern-js/utils": "2.21.0"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
39
|
"@types/jest": "^29",
|
40
40
|
"@types/node": "^14",
|
41
|
-
"typescript": "^
|
41
|
+
"typescript": "^5",
|
42
42
|
"jest": "^29",
|
43
|
-
"@scripts/
|
44
|
-
"@scripts/
|
43
|
+
"@scripts/jest-config": "2.21.0",
|
44
|
+
"@scripts/build": "2.21.0"
|
45
45
|
},
|
46
46
|
"sideEffects": false,
|
47
47
|
"publishConfig": {
|