enabled __hooks in the jsvm migrations
This commit is contained in:
parent
95787da4df
commit
58b564557f
|
|
@ -7,7 +7,7 @@
|
||||||
- Mocked `syscall.Exec` when building for WASM ([#7116](https://github.com/pocketbase/pocketbase/pull/7116); thanks @joas8211).
|
- Mocked `syscall.Exec` when building for WASM ([#7116](https://github.com/pocketbase/pocketbase/pull/7116); thanks @joas8211).
|
||||||
_Note that WASM is not officially supported PocketBase build target and many things may not work as expected._
|
_Note that WASM is not officially supported PocketBase build target and many things may not work as expected._
|
||||||
|
|
||||||
- Registered missing `$filesystem`, `$mails` and `$template` bindings in the JSVM migrations ([#7125](https://github.com/pocketbase/pocketbase/issues/7125)).
|
- Registered missing `$filesystem`, `$mails`, `$template` and `__hooks` bindings in the JSVM migrations ([#7125](https://github.com/pocketbase/pocketbase/issues/7125)).
|
||||||
|
|
||||||
- Regenerated JSVM types to include methods from structs with single generic parameter.
|
- Regenerated JSVM types to include methods from structs with single generic parameter.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,6 @@ declare function routerUse(...middlewares: Array<string|((e: core.RequestEvent)
|
||||||
/**
|
/**
|
||||||
* Global helper variable that contains the absolute path to the app pb_hooks directory.
|
* Global helper variable that contains the absolute path to the app pb_hooks directory.
|
||||||
*
|
*
|
||||||
* _Note that this variable is available only in pb_hooks context._
|
|
||||||
*
|
|
||||||
* @group PocketBase
|
* @group PocketBase
|
||||||
*/
|
*/
|
||||||
declare var __hooks: string
|
declare var __hooks: string
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,11 @@ func (p *plugin) registerMigrations() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
absHooksDir, err := filepath.Abs(p.config.HooksDir)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
registry := new(require.Registry) // this can be shared by multiple runtimes
|
registry := new(require.Registry) // this can be shared by multiple runtimes
|
||||||
templateRegistry := template.NewRegistry()
|
templateRegistry := template.NewRegistry()
|
||||||
|
|
||||||
|
|
@ -206,6 +211,7 @@ func (p *plugin) registerMigrations() error {
|
||||||
mailsBinds(vm)
|
mailsBinds(vm)
|
||||||
|
|
||||||
vm.Set("$template", templateRegistry)
|
vm.Set("$template", templateRegistry)
|
||||||
|
vm.Set("__hooks", absHooksDir)
|
||||||
|
|
||||||
vm.Set("migrate", func(up, down func(txApp core.App) error) {
|
vm.Set("migrate", func(up, down func(txApp core.App) error) {
|
||||||
core.AppMigrations.Register(up, down, file)
|
core.AppMigrations.Register(up, down, file)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue