@snailycfx/nexus-transformer
v1.0.7
Published
TypeScript transformer for @snailycfx/nexus — injects event parameter metadata
Maintainers
Readme
@snailycfx/nexus-transformer
TypeScript compiler transformer for @snailycfx/nexus.
Automatically injects event parameter metadata at compile time, enabling
@EventHandler() to resolve event types without manual configuration.
Installation
npm install @snailycfx/nexus-transformer
npx ts-patch installSetup
Add the transformer to your tsconfig.json:
{
"compilerOptions": {
"plugins": [
{ "transform": "@snailycfx/nexus-transformer" }
]
}
}How it works
The transformer scans your code at compile time for methods decorated
with @EventHandler() and injects a NexusMetadata.define() call
with the event class type automatically.
Before:
@EventHandler()
public onWaveStarted(event: WaveStartedEvent): void {
print(event.getWave())
}After (generated):
NexusMetadata.define("paramtypes", [WaveStartedEvent], target, "onWaveStarted")
@EventHandler()
public onWaveStarted(event: WaveStartedEvent): void {
print(event.getWave())
}Requirements
typescript>= 5.0.0ts-patch>= 3.0.0@snailycfx/nexus
License
MIT
