mirror of
https://github.com/pockethost/pockethost.git
synced 2025-09-16 05:30:17 +00:00
feat(pockethost): new action PluginsLoaded
This commit is contained in:
parent
52b70cbe76
commit
cce72b35e2
5
.changeset/tricky-trees-wave.md
Normal file
5
.changeset/tricky-trees-wave.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'pockethost': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
New action: AfterPluginsLoaded
|
@ -133,6 +133,10 @@ onServeAction(async ({ only }) => {
|
|||||||
| InstanceLog | A log action | logLevel, currentLogLevel, args | [example](https://github.com/pockethost/pockethost/blob/e6355c1aea2484ffba9d95110faa2af40e922855/packages/plugin-launcher-spawn/src/index.ts#L147) | 1.3.0 |
|
| InstanceLog | A log action | logLevel, currentLogLevel, args | [example](https://github.com/pockethost/pockethost/blob/e6355c1aea2484ffba9d95110faa2af40e922855/packages/plugin-launcher-spawn/src/index.ts#L147) | 1.3.0 |
|
||||||
| Serve | The `pockethost serve` command has been called | only[] | | 1.4.0 |
|
| Serve | The `pockethost serve` command has been called | only[] | | 1.4.0 |
|
||||||
|
|
||||||
|
#### AfterPluginsLoaded (since 1.6.0)
|
||||||
|
|
||||||
|
Fired after all plugins have been loaded. This is a good time to perform initialization that may depend upon other plugins.
|
||||||
|
|
||||||
### Core Filters
|
### Core Filters
|
||||||
|
|
||||||
#### ServerSlugs (since 1.4.0)
|
#### ServerSlugs (since 1.4.0)
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
DEBUG,
|
DEBUG,
|
||||||
LogLevelName,
|
LogLevelName,
|
||||||
LoggerService,
|
LoggerService,
|
||||||
|
doAfterPluginsLoadedAction,
|
||||||
doCliCommandsFilter,
|
doCliCommandsFilter,
|
||||||
loadPlugins,
|
loadPlugins,
|
||||||
} from '../common'
|
} from '../common'
|
||||||
@ -45,6 +46,8 @@ export const main = async () => {
|
|||||||
|
|
||||||
await loadPlugins([pockethost, ...uniq(PH_PLUGINS()), ...extraPlugins])
|
await loadPlugins([pockethost, ...uniq(PH_PLUGINS()), ...extraPlugins])
|
||||||
|
|
||||||
|
await doAfterPluginsLoadedAction()
|
||||||
|
|
||||||
program
|
program
|
||||||
.name('pockethost')
|
.name('pockethost')
|
||||||
.description('Multitenant PocketBase hosting')
|
.description('Multitenant PocketBase hosting')
|
||||||
|
@ -4,6 +4,7 @@ import { DEBUG } from '../debug'
|
|||||||
import { InstanceFields } from '../schema'
|
import { InstanceFields } from '../schema'
|
||||||
|
|
||||||
enum CoreActions {
|
enum CoreActions {
|
||||||
|
AfterPluginsLoaded = 'core_after_plugins_loaded',
|
||||||
Init = 'core_init',
|
Init = 'core_init',
|
||||||
Serve = 'core_serve',
|
Serve = 'core_serve',
|
||||||
AppMounted = 'core_on_app_mount',
|
AppMounted = 'core_on_app_mount',
|
||||||
@ -70,6 +71,9 @@ export function createCustomAction(actionName: CoreActions) {
|
|||||||
] as const
|
] as const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const [doAfterPluginsLoadedAction, onAfterPluginsLoadedAction] =
|
||||||
|
createCustomAction(CoreActions.AfterPluginsLoaded)
|
||||||
|
|
||||||
export const [doRequestErrorAction, onRequestErrorAction] =
|
export const [doRequestErrorAction, onRequestErrorAction] =
|
||||||
createCustomActionWithContext<{
|
createCustomActionWithContext<{
|
||||||
err: Error
|
err: Error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user