mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-31 07:30:32 +00:00
refactor(plugins): update export wrappers to use //go:wasmexport for WebAssembly compatibility
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
06c2556a8f
commit
633a26a273
@ -752,7 +752,7 @@ type TestService interface {
|
||||
Expect(codeStr).To(ContainSubstring("impl.(ArtistBiographyProvider)"))
|
||||
|
||||
// Check for export wrappers
|
||||
Expect(codeStr).To(ContainSubstring("//export nd_get_artist_biography"))
|
||||
Expect(codeStr).To(ContainSubstring("//go:wasmexport nd_get_artist_biography"))
|
||||
Expect(codeStr).To(ContainSubstring("func _NdGetArtistBiography()"))
|
||||
|
||||
// Check for NotImplementedCode handling
|
||||
@ -894,7 +894,7 @@ type TestService interface {
|
||||
Expect(codeStr).To(ContainSubstring("type ArtistInput struct"))
|
||||
|
||||
// Check there are no export wrappers
|
||||
Expect(codeStr).NotTo(ContainSubstring("//export"))
|
||||
Expect(codeStr).NotTo(ContainSubstring("//go:wasmexport"))
|
||||
Expect(codeStr).NotTo(ContainSubstring("pdk.InputJSON"))
|
||||
})
|
||||
})
|
||||
@ -941,7 +941,7 @@ type OnInitOutput struct {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
codeStr := string(code)
|
||||
Expect(codeStr).To(ContainSubstring("//export nd_on_init"))
|
||||
Expect(codeStr).To(ContainSubstring("//go:wasmexport nd_on_init"))
|
||||
Expect(codeStr).To(ContainSubstring("type InitProvider interface"))
|
||||
|
||||
// Generate stub code
|
||||
|
||||
@ -166,7 +166,7 @@ const NotImplementedCode int32 = -2
|
||||
{{- /* Generate export wrappers */ -}}
|
||||
{{range .Capability.Methods}}
|
||||
|
||||
//export {{.ExportName}}
|
||||
//go:wasmexport {{.ExportName}}
|
||||
func {{exportFunc .}}() int32 {
|
||||
if {{implVar .}} == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
|
||||
@ -43,7 +43,7 @@ func Register(impl Lifecycle) {
|
||||
// The host recognizes this and skips the plugin gracefully.
|
||||
const NotImplementedCode int32 = -2
|
||||
|
||||
//export nd_on_init
|
||||
//go:wasmexport nd_on_init
|
||||
func _NdOnInit() int32 {
|
||||
if initImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
|
||||
@ -234,7 +234,7 @@ func Register(impl Metadata) {
|
||||
// The host recognizes this and skips the plugin gracefully.
|
||||
const NotImplementedCode int32 = -2
|
||||
|
||||
//export nd_get_artist_mbid
|
||||
//go:wasmexport nd_get_artist_mbid
|
||||
func _NdGetArtistMbid() int32 {
|
||||
if artistMBIDImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -261,7 +261,7 @@ func _NdGetArtistMbid() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_get_artist_url
|
||||
//go:wasmexport nd_get_artist_url
|
||||
func _NdGetArtistUrl() int32 {
|
||||
if artistURLImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -288,7 +288,7 @@ func _NdGetArtistUrl() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_get_artist_biography
|
||||
//go:wasmexport nd_get_artist_biography
|
||||
func _NdGetArtistBiography() int32 {
|
||||
if artistBiographyImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -315,7 +315,7 @@ func _NdGetArtistBiography() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_get_similar_artists
|
||||
//go:wasmexport nd_get_similar_artists
|
||||
func _NdGetSimilarArtists() int32 {
|
||||
if similarArtistsImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -342,7 +342,7 @@ func _NdGetSimilarArtists() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_get_artist_images
|
||||
//go:wasmexport nd_get_artist_images
|
||||
func _NdGetArtistImages() int32 {
|
||||
if artistImagesImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -369,7 +369,7 @@ func _NdGetArtistImages() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_get_artist_top_songs
|
||||
//go:wasmexport nd_get_artist_top_songs
|
||||
func _NdGetArtistTopSongs() int32 {
|
||||
if artistTopSongsImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -396,7 +396,7 @@ func _NdGetArtistTopSongs() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_get_album_info
|
||||
//go:wasmexport nd_get_album_info
|
||||
func _NdGetAlbumInfo() int32 {
|
||||
if albumInfoImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -423,7 +423,7 @@ func _NdGetAlbumInfo() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_get_album_images
|
||||
//go:wasmexport nd_get_album_images
|
||||
func _NdGetAlbumImages() int32 {
|
||||
if albumImagesImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
|
||||
@ -52,7 +52,7 @@ func Register(impl Scheduler) {
|
||||
// The host recognizes this and skips the plugin gracefully.
|
||||
const NotImplementedCode int32 = -2
|
||||
|
||||
//export nd_scheduler_callback
|
||||
//go:wasmexport nd_scheduler_callback
|
||||
func _NdSchedulerCallback() int32 {
|
||||
if callbackImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
|
||||
@ -129,7 +129,7 @@ func Register(impl Scrobbler) {
|
||||
// The host recognizes this and skips the plugin gracefully.
|
||||
const NotImplementedCode int32 = -2
|
||||
|
||||
//export nd_scrobbler_is_authorized
|
||||
//go:wasmexport nd_scrobbler_is_authorized
|
||||
func _NdScrobblerIsAuthorized() int32 {
|
||||
if isAuthorizedImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -156,7 +156,7 @@ func _NdScrobblerIsAuthorized() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_scrobbler_now_playing
|
||||
//go:wasmexport nd_scrobbler_now_playing
|
||||
func _NdScrobblerNowPlaying() int32 {
|
||||
if nowPlayingImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -177,7 +177,7 @@ func _NdScrobblerNowPlaying() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_scrobbler_scrobble
|
||||
//go:wasmexport nd_scrobbler_scrobble
|
||||
func _NdScrobblerScrobble() int32 {
|
||||
if scrobbleImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
|
||||
@ -102,7 +102,7 @@ func Register(impl WebSocket) {
|
||||
// The host recognizes this and skips the plugin gracefully.
|
||||
const NotImplementedCode int32 = -2
|
||||
|
||||
//export nd_websocket_on_text_message
|
||||
//go:wasmexport nd_websocket_on_text_message
|
||||
func _NdWebsocketOnTextMessage() int32 {
|
||||
if textMessageImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -123,7 +123,7 @@ func _NdWebsocketOnTextMessage() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_websocket_on_binary_message
|
||||
//go:wasmexport nd_websocket_on_binary_message
|
||||
func _NdWebsocketOnBinaryMessage() int32 {
|
||||
if binaryMessageImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -144,7 +144,7 @@ func _NdWebsocketOnBinaryMessage() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_websocket_on_error
|
||||
//go:wasmexport nd_websocket_on_error
|
||||
func _NdWebsocketOnError() int32 {
|
||||
if errorImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
@ -165,7 +165,7 @@ func _NdWebsocketOnError() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//export nd_websocket_on_close
|
||||
//go:wasmexport nd_websocket_on_close
|
||||
func _NdWebsocketOnClose() int32 {
|
||||
if closeImpl == nil {
|
||||
// Return standard code - host will skip this plugin gracefully
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user