Squash the current repository state back into one baseline commit while
preserving the README reframing and repository contents.

Constraint: User explicitly requested a single squashed commit with subject "asdf"
Confidence: high
Scope-risk: broad
Reversibility: clean
Directive: This commit intentionally rewrites published history; coordinate before future force-pushes
Tested: git status clean; local history rewritten to one commit; force-pushed main to origin and instructkr
Not-tested: Fresh clone verification after push
This commit is contained in:
did:key:z6MkqDnb7Siv3Cwj7pGJq4T5EsUisECqR8KpnDLwcaZq5TPr
2026-03-31 03:34:03 -07:00
commit d2542c9a62
1903 changed files with 513517 additions and 0 deletions

39
src/ink/events/emitter.ts Normal file
View File

@@ -0,0 +1,39 @@
import { EventEmitter as NodeEventEmitter } from 'events'
import { Event } from './event.js'
// Similar to node's builtin EventEmitter, but is also aware of our `Event`
// class, and so `emit` respects `stopImmediatePropagation()`.
export class EventEmitter extends NodeEventEmitter {
constructor() {
super()
// Disable the default maxListeners warning. In React, many components
// can legitimately listen to the same event (e.g., useInput hooks).
// The default limit of 10 causes spurious warnings.
this.setMaxListeners(0)
}
override emit(type: string | symbol, ...args: unknown[]): boolean {
// Delegate to node for `error`, since it's not treated like a normal event
if (type === 'error') {
return super.emit(type, ...args)
}
const listeners = this.rawListeners(type)
if (listeners.length === 0) {
return false
}
const ccEvent = args[0] instanceof Event ? args[0] : null
for (const listener of listeners) {
listener.apply(this, args)
if (ccEvent?.didStopImmediatePropagation()) {
break
}
}
return true
}
}