@vladfrangu/async_event_emitter
Advanced tools
Comparing version 2.2.3-next.73d1465.0 to 2.2.3
@@ -1,3 +0,2 @@ | ||
/// <reference types="node" /> | ||
declare class AsyncEventEmitter<Events extends Record<PropertyKey, unknown[]> = Record<PropertyKey, unknown[]> & AsyncEventEmitterPredefinedEvents> { | ||
declare class AsyncEventEmitter<Events extends {} = Record<PropertyKey, unknown[]> & AsyncEventEmitterPredefinedEvents, _Events extends Record<PropertyKey, unknown[]> = Events> { | ||
private _events; | ||
@@ -8,17 +7,17 @@ private _eventCount; | ||
private _wrapperId; | ||
addListener<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; | ||
on<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; | ||
once<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; | ||
removeListener<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; | ||
off<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; | ||
removeAllListeners<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(event?: K | undefined): this; | ||
addListener<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : _Events[K]) => void): this; | ||
on<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : _Events[K]) => void): this; | ||
once<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : _Events[K]) => void): this; | ||
removeListener<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : _Events[K]) => void): this; | ||
off<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : _Events[K]) => void): this; | ||
removeAllListeners<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(event?: K | undefined): this; | ||
setMaxListeners(n: number): this; | ||
getMaxListeners(): number; | ||
listeners<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K): Listener<Events[keyof Events]>['listener'][]; | ||
rawListeners<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K): Listener<Events[keyof Events]>[]; | ||
emit<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, ...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]): boolean; | ||
listenerCount<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K): number; | ||
prependListener<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; | ||
prependOnceListener<K extends keyof Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; | ||
eventNames(): (keyof Events | keyof AsyncEventEmitterPredefinedEvents)[]; | ||
listeners<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K): Listener<_Events[keyof Events]>['listener'][]; | ||
rawListeners<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K): Listener<_Events[keyof Events]>[]; | ||
emit<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, ...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : _Events[K]): boolean; | ||
listenerCount<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K): number; | ||
prependListener<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : _Events[K]) => void): this; | ||
prependOnceListener<K extends keyof _Events | keyof AsyncEventEmitterPredefinedEvents>(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : _Events[K]) => void): this; | ||
eventNames(): (keyof _Events | keyof AsyncEventEmitterPredefinedEvents)[]; | ||
waitForAllListenersToComplete(): Promise<boolean>; | ||
@@ -28,4 +27,6 @@ private _addListener; | ||
static listenerCount<Emitter extends AsyncEventEmitter<any>, EventNames = Emitter extends AsyncEventEmitter<infer Events> ? Events : never, EventName extends PropertyKey = EventNames extends never ? string | symbol : keyof EventNames>(emitter: Emitter, eventName: EventName | keyof AsyncEventEmitterPredefinedEvents): number; | ||
static once<Emitter extends AsyncEventEmitter<any>, EventNames extends Record<PropertyKey, unknown[]> = Emitter extends AsyncEventEmitter<infer Events> ? Events : Record<PropertyKey, unknown[]>, EventName extends PropertyKey = keyof EventNames | keyof AsyncEventEmitterPredefinedEvents, EventResult extends unknown[] = EventName extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[EventName] : EventNames[EventName]>(emitter: Emitter, eventName: EventName, options?: AbortableMethods): Promise<EventResult>; | ||
static on<Emitter extends AsyncEventEmitter<any>, EventNames extends Record<PropertyKey, unknown[]> = Emitter extends AsyncEventEmitter<infer Events> ? Events : Record<PropertyKey, unknown[]>, EventName extends PropertyKey = keyof EventNames | keyof AsyncEventEmitterPredefinedEvents, EventResult extends unknown[] = EventName extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[EventName] : EventNames[EventName]>(emitter: Emitter, eventName: EventName, options?: AbortableMethods): AsyncGenerator<EventResult, void>; | ||
// @ts-ignore | ||
static once<Emitter extends AsyncEventEmitter<any, any>, EventNames extends {} = Emitter extends AsyncEventEmitter<infer Events, any> ? Events : Record<PropertyKey, unknown[]>, EventName extends PropertyKey = keyof EventNames | keyof AsyncEventEmitterPredefinedEvents, EventResult extends unknown[] = EventNames extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[EventName] : EventNames[EventName]>(emitter: Emitter, eventName: EventName, options?: AbortableMethods): Promise<EventResult>; | ||
// @ts-ignore | ||
static on<Emitter extends AsyncEventEmitter<any, any>, EventNames extends {} = Emitter extends AsyncEventEmitter<infer Events, any> ? Events : Record<PropertyKey, unknown[]>, EventName extends PropertyKey = keyof EventNames | keyof AsyncEventEmitterPredefinedEvents, EventResult extends unknown[] = EventNames extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[EventName] : EventNames[EventName]>(emitter: Emitter, eventName: EventName, options?: AbortableMethods): AsyncGenerator<EventResult, void>; | ||
} | ||
@@ -59,2 +60,2 @@ interface AsyncEventEmitterPredefinedEvents { | ||
export { AbortError, AbortErrorOptions, AbortableMethods, AsyncEventEmitter, AsyncEventEmitterPredefinedEvents, Awaitable, Listener, WrappedOnce }; | ||
export { AbortError, type AbortErrorOptions, type AbortableMethods, AsyncEventEmitter, type AsyncEventEmitterPredefinedEvents, type Awaitable, type Listener, type WrappedOnce }; |
@@ -103,3 +103,3 @@ "use strict"; | ||
__name(enhanceStackTrace, "enhanceStackTrace"); | ||
var AsyncEventEmitter = class { | ||
var _AsyncEventEmitter = class _AsyncEventEmitter { | ||
constructor() { | ||
@@ -264,3 +264,3 @@ this._events = { | ||
const capture = {}; | ||
Error.captureStackTrace(capture, AsyncEventEmitter.prototype.emit); | ||
Error.captureStackTrace(capture, _AsyncEventEmitter.prototype.emit); | ||
Object.defineProperty(er, "stack", { | ||
@@ -500,3 +500,4 @@ value: enhanceStackTrace.call(this, er, capture), | ||
}; | ||
__name(AsyncEventEmitter, "AsyncEventEmitter"); | ||
__name(_AsyncEventEmitter, "AsyncEventEmitter"); | ||
var AsyncEventEmitter = _AsyncEventEmitter; | ||
function onceWrapper() { | ||
@@ -543,3 +544,3 @@ if (!this.fired) { | ||
__name(createIterResult, "createIterResult"); | ||
var AbortError = class extends Error { | ||
var _AbortError = class _AbortError extends Error { | ||
constructor(message = "The operation was aborted", options = void 0) { | ||
@@ -554,3 +555,4 @@ if (options !== void 0 && typeof options !== "object") { | ||
}; | ||
__name(AbortError, "AbortError"); | ||
__name(_AbortError, "AbortError"); | ||
var AbortError = _AbortError; | ||
function handleMaybeAsync(emitter, result) { | ||
@@ -557,0 +559,0 @@ try { |
{ | ||
"name": "@vladfrangu/async_event_emitter", | ||
"version": "2.2.3-next.73d1465.0", | ||
"version": "2.2.3", | ||
"description": "An event emitter implementation with async support in mind", | ||
@@ -12,5 +12,14 @@ "main": "./dist/index.js", | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
"import": { | ||
"types": "./dist/index.d.mts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"default": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
} | ||
@@ -28,37 +37,30 @@ }, | ||
"update": "yarn upgrade-interactive", | ||
"build": "tsup && tsc -b src", | ||
"build": "tsc -p src --noEmit && tsup && node ./scripts/postbuild.mjs", | ||
"clean": "node scripts/clean.mjs", | ||
"typecheck": "tsc -p tsconfig.typecheck.json", | ||
"typecheck": "tsc -p src --noEmit", | ||
"bump": "cliff-jumper", | ||
"check-update": "cliff-jumper --dry-run", | ||
"_postinstall": "husky install .github/husky", | ||
"prepack": "rollup-type-bundler && pinst --disable", | ||
"postpack": "pinst --enable" | ||
"check-update": "cliff-jumper --dry-run" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.4.4", | ||
"@commitlint/config-conventional": "^17.4.4", | ||
"@favware/cliff-jumper": "^1.10.0", | ||
"@commitlint/cli": "^18.4.3", | ||
"@commitlint/config-conventional": "^18.4.3", | ||
"@favware/cliff-jumper": "^2.2.3", | ||
"@favware/npm-deprecate": "^1.0.7", | ||
"@favware/rollup-type-bundler": "^2.0.0", | ||
"@sapphire/eslint-config": "^4.3.8", | ||
"@sapphire/prettier-config": "^1.4.5", | ||
"@sapphire/ts-config": "^3.3.4", | ||
"@typescript-eslint/eslint-plugin": "^5.52.0", | ||
"@typescript-eslint/parser": "^5.52.0", | ||
"@vitest/coverage-c8": "^0.28.5", | ||
"@sapphire/eslint-config": "^5.0.2", | ||
"@sapphire/prettier-config": "^2.0.0", | ||
"@sapphire/ts-config": "^5.0.0", | ||
"@typescript-eslint/eslint-plugin": "^6.13.1", | ||
"@typescript-eslint/parser": "^6.13.1", | ||
"@vitest/coverage-c8": "^0.33.0", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.34.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.1.2", | ||
"pinst": "^3.0.0", | ||
"prettier": "^2.8.4", | ||
"pretty-quick": "^3.1.3", | ||
"tsup": "^6.6.3", | ||
"typedoc": "^0.23.25", | ||
"typedoc-plugin-mdn-links": "^2.0.2", | ||
"typescript": "^4.9.5", | ||
"vitest": "^0.28.5" | ||
"eslint": "^8.55.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"lint-staged": "^15.1.0", | ||
"prettier": "^3.1.0", | ||
"tsup": "^8.0.1", | ||
"typedoc": "^0.25.4", | ||
"typedoc-plugin-mdn-links": "^3.1.6", | ||
"typescript": "^5.3.2", | ||
"vitest": "^0.34.6" | ||
}, | ||
@@ -93,2 +95,3 @@ "repository": { | ||
"lint-staged": { | ||
"*": "prettier --ignore-unknown --write", | ||
"*.{mjs,js,ts}": "eslint --fix --ext mjs,js,ts" | ||
@@ -109,3 +112,3 @@ }, | ||
}, | ||
"packageManager": "yarn@3.2.1" | ||
"packageManager": "yarn@4.0.2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
194046
21
13
1741
0
1