vendor: update cordis / loader

This commit is contained in:
imccyu
2026-07-15 10:39:18 +08:00
parent 34bb75b2d2
commit c685582d54
7 changed files with 40 additions and 20 deletions

View File

@@ -106,9 +106,9 @@ export class EventsService {
/** Run listeners concurrently and wait for all of them. */
async parallel(...args: any[]) {
// FIXME(cordis upstream): A synchronous listener throw aborts callback
// enumeration here and starves later parallel listeners. Fix upstream.
await Promise.all(this.dispatch('emit', args).map(cb => cb(...args)))
const results = await Promise.allSettled(this.dispatch('emit', args).map(async cb => cb(...args)))
const errors = results.filter((result): result is PromiseRejectedResult => result.status === 'rejected')
if (errors.length) throw new AggregateError(errors.map(error => error.reason))
}
/** Run listeners synchronously without waiting for returned promises. */

View File

@@ -189,7 +189,7 @@ export class Fiber {
this._runner = {
epoch: INACTIVE,
getOuterStack,
execute: () => {
execute: function () {
if (isConstructor(runtime.callback)) {
// eslint-disable-next-line new-cap
const instance = new runtime.callback(this.ctx, this.config)
@@ -307,7 +307,7 @@ export class Fiber {
throw new TypeError('Invalid effect')
}
}
const effect: Effect = runner.execute()
const effect: Effect = runner.execute.call(this)
if (typeof effect === 'function') {
return runner.collect(effect)
} else if (isNullable(effect)) {

View File

@@ -229,6 +229,11 @@ export class ReflectService {
fibers.push(fiber)
}
}
for (const name of names) {
const self: Context = Object.create(this.ctx)
self[symbols.filter] = (target: Context) => filter(target, name)
this.ctx.events.emit(self, 'internal/service', name, this._getImpl(name, false)?.value)
}
return fibers
}