Lifecycle
pre
Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
Can be used to validate dependent plugins.
pre: string[]
post
Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
post: string[]
buildStart
hookParallel
: Start of the lifecycle of a plugin. BuildStart is used to implement your transformation logic and is also the only place where you can run this.addFile.
buildStart: (this: PluginContext, kubbConfig: KubbConfig) => WithPromise<void>
resolvePath
hookFirst
: Resolve to an id based on fileName(example: ./Pet.ts
) and directory(example: ./models
).
resolvePath: (this: PluginContext, fileName: string, directory?: string, options?: Record<string, any>) => string | null | undefined
resolveName
hookFirst
: Resolve to a name based on a string. Useful when converting to PascalCase or camelCase.
resolveName: (this: PluginContext, name: string, type?: string) => string
load
hookFirst
: Makes it possible to run async logic to override the path defined previously by resolvePath
.
load: (this: PluginContext, path: Path) => WithPromise<TransformResult | null>
transform
hookReduceArg0
: Transform the source code.
transform: (this: PluginContext, source: string, path: Path) => WithPromise<TransformResult>
writeFile
hookParallel
: Write the result to the file system based on the id(defined by resolvePath
or changed by load
).
writeFile: (this: PluginContext, source: string | undefined, path: Path) => WithPromise<void>
buildEnd
hookParallel
: End of the plugin lifecycle.
buildEnd: (this: PluginContext) => WithPromise<void>
Inspired by: rollup.netlify.app/guide/en/#build-hooks