@nuclearplayer/plugin-sdk
Advanced tools
+4
-0
@@ -254,2 +254,4 @@ import { FC } from 'react'; | ||
| export declare const formatArtistNames: (artists: ArtistCredit[]) => string; | ||
| export declare class HttpAPI { | ||
@@ -1008,3 +1010,5 @@ readonly fetch: FetchFunction; | ||
| searchForTrack: (artist: string, title: string, album?: string) => Promise<StreamCandidate[]>; | ||
| searchForTrackV2?: (track: Track) => Promise<StreamCandidate[]>; | ||
| getStreamUrl: (candidateId: string) => Promise<Stream>; | ||
| getStreamUrlV2?: (candidate: StreamCandidate) => Promise<Stream>; | ||
| supportsLocalFiles?: boolean; | ||
@@ -1011,0 +1015,0 @@ }; |
+3
-3
| { | ||
| "name": "@nuclearplayer/plugin-sdk", | ||
| "version": "2.7.0", | ||
| "version": "2.8.0", | ||
| "description": "Plugin SDK for Nuclear music player", | ||
@@ -44,4 +44,4 @@ "type": "module", | ||
| "vitest": "^4.0.0", | ||
| "@nuclearplayer/tailwind-config": "0.0.10", | ||
| "@nuclearplayer/eslint-config": "0.0.10" | ||
| "@nuclearplayer/eslint-config": "0.0.10", | ||
| "@nuclearplayer/tailwind-config": "0.0.10" | ||
| }, | ||
@@ -48,0 +48,0 @@ "peerDependencies": { |
+14
-26
@@ -5,3 +5,3 @@ # Nuclear Plugin SDK | ||
| Plugins are JavaScript/TypeScript modules that extend Nuclear's functionality. Write lifecycle hooks, register providers, and ship it as an npm package or local bundle. | ||
| Plugins are JavaScript/TypeScript modules that extend Nuclear's functionality. Write lifecycle hooks, register providers, distribute it through the [plugin registry](https://github.com/NuclearPlayer/plugin-registry). | ||
@@ -28,6 +28,6 @@ ## Quick Start | ||
| }, | ||
| async onDisable() { | ||
| async onDisable(api: NuclearPluginAPI) { | ||
| console.log('Plugin disabled'); | ||
| }, | ||
| async onUnload() { | ||
| async onUnload(api: NuclearPluginAPI) { | ||
| console.log('Plugin unloaded'); | ||
@@ -38,3 +38,3 @@ }, | ||
| Build it to `dist/index.js` as a CommonJS bundle. | ||
| You can load both TS and JS files. Nuclear compiles TS using esbuild. | ||
@@ -82,3 +82,3 @@ ## Manifest (package.json) | ||
| Link icons should point to a local file path or remote URL; keep them small (<= 64x64, optimized). | ||
| Link icons should point to a local file path or remote URL. | ||
@@ -91,4 +91,4 @@ ## Lifecycle Hooks | ||
| - `onEnable(api)` - Runs when user enables the plugin | ||
| - `onDisable()` - Runs when user disables it | ||
| - `onUnload()` - Runs before plugin is removed from memory | ||
| - `onDisable(api)` - Runs when user disables it | ||
| - `onUnload(api)` - Runs before plugin is removed from memory | ||
@@ -101,5 +101,5 @@ ```ts | ||
| }, | ||
| async onDisable() { | ||
| async onDisable(api) { | ||
| }, | ||
| async onUnload() { | ||
| async onUnload(api) { | ||
| }, | ||
@@ -117,3 +117,3 @@ }; | ||
| | `api.Queue` | Read and manipulate the playback queue | | ||
| | `api.Playback` | Control audio transport: play, pause, stop, seek | | ||
| | `api.Playback` | Control playback, volume, shuffle, and repeat | | ||
| | `api.Events` | Subscribe to player lifecycle events (e.g. track finished) | | ||
@@ -126,2 +126,4 @@ | `api.Favorites` | Manage the user's favorite tracks | | ||
| | `api.Dashboard` | Fetch dashboard content (top tracks, new releases, etc.) | | ||
| | `api.Discovery` | Fetch track recommendations from providers | | ||
| | `api.Shell` | Open URLs in the system browser | | ||
| | `api.Http` | Make HTTP requests from plugins and bypass CORS | | ||
@@ -170,18 +172,4 @@ | `api.Logger` | Structured logging | | ||
| 3. Load it in Nuclear | ||
| 4. Rebuild after changes; you'll need to reload the plugin | ||
| 4. You'll need to reload the plugin after changes | ||
| ## Tips | ||
| - Keep startup fast, defer heavy work to `onEnable` | ||
| - Validate network responses | ||
| - Minimize dependencies, smaller = faster | ||
| ## Troubleshooting | ||
| | Problem | Solution | | ||
| |---------|----------| | ||
| | Can't find entry file | Check `main` in package.json or make sure `index.js` or `dist/index.js` exists | | ||
| | Missing fields error | Add all required fields: name, version, description, author | | ||
| | Hooks don't fire | Export a default object, not a function or class | | ||
| ## Types | ||
@@ -195,3 +183,3 @@ | ||
| // Model types (re-exported from @nuclearplayer/model) | ||
| Artist, | ||
| ArtistCredit, | ||
| Album, | ||
@@ -198,0 +186,0 @@ Track, |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
183713
0.01%4444
0.09%183
-6.15%