@websublime/vite-plugin-open-api-server 0.24.0-next.6 → 0.24.0-next.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -725,14 +725,12 @@ declare function getSeedFiles(seedsDir: string, cwd?: string): Promise<string[]>
725
725
  /**
726
726
  * Hot Reload
727
727
  *
728
- * What: File watcher for hot reloading handlers and seeds
729
- * How: Uses chokidar to watch for file changes
730
- * Why: Enables rapid development iteration without server restart
728
+ * What: File watcher for hot reloading handlers and seeds with per-spec isolation
729
+ * How: Uses chokidar to watch for file changes, one watcher per spec instance
730
+ * Why: Enables rapid development iteration without server restart; per-spec
731
+ * isolation ensures handler/seed changes in one spec don't affect others
731
732
  *
732
733
  * @module hot-reload
733
- *
734
- * TODO: Full implementation in Task 3.3
735
- * This module provides placeholder/basic functionality for Task 3.1
736
734
  */
737
735
 
738
736
  /**
@@ -795,6 +793,14 @@ interface FileWatcher {
795
793
  * @returns Promise resolving to file watcher instance
796
794
  */
797
795
  declare function createFileWatcher(options: FileWatcherOptions): Promise<FileWatcher>;
796
+ /**
797
+ * Debounced function with cancel support
798
+ */
799
+ interface DebouncedFunction<T extends (...args: unknown[]) => unknown> {
800
+ (...args: Parameters<T>): void;
801
+ /** Cancel any pending debounce timer and queued execution */
802
+ cancel(): void;
803
+ }
798
804
  /**
799
805
  * Debounce a function with async execution guard
800
806
  *
@@ -808,9 +814,50 @@ declare function createFileWatcher(options: FileWatcherOptions): Promise<FileWat
808
814
  *
809
815
  * @param fn - Function to debounce (can be sync or async)
810
816
  * @param delay - Debounce delay in milliseconds
811
- * @returns Debounced function
817
+ * @returns Debounced function with cancel() method
818
+ */
819
+ declare function debounce<T extends (...args: unknown[]) => unknown>(fn: T, delay: number): DebouncedFunction<T>;
820
+ /**
821
+ * Create file watchers for all spec instances
822
+ *
823
+ * Each spec gets independent watchers for its handlers and seeds directories.
824
+ * Changes to one spec's files only trigger reload for that spec instance.
825
+ *
826
+ * @param instances - All spec instances to watch
827
+ * @param vite - Vite dev server (for ssrLoadModule / module invalidation)
828
+ * @param cwd - Project root directory
829
+ * @param options - Resolved plugin options
830
+ * @returns Promise resolving to array of file watchers (one per spec)
831
+ */
832
+ declare function createPerSpecFileWatchers(instances: SpecInstance[], vite: ViteDevServer, cwd: string, options: ResolvedOptions): Promise<FileWatcher[]>;
833
+ /**
834
+ * Reload handlers for a specific spec instance
835
+ *
836
+ * Loads fresh handlers from disk via Vite's ssrLoadModule, updates
837
+ * the spec's server, broadcasts a WebSocket event, and logs the result.
838
+ *
839
+ * @param instance - The spec instance to reload handlers for
840
+ * @param vite - Vite dev server
841
+ * @param cwd - Project root directory
842
+ * @param options - Resolved plugin options
843
+ */
844
+ declare function reloadSpecHandlers(instance: SpecInstance, vite: ViteDevServer, cwd: string, options: ResolvedOptions): Promise<void>;
845
+ /**
846
+ * Reload seeds for a specific spec instance
847
+ *
848
+ * Loads fresh seeds from disk, clears the spec's store, and re-executes
849
+ * seeds. Broadcasts a WebSocket event and logs the result.
850
+ *
851
+ * Note: This operation is not fully atomic — there's a brief window between
852
+ * clearing the store and repopulating it where requests may see empty data.
853
+ * For development tooling, this tradeoff is acceptable.
854
+ *
855
+ * @param instance - The spec instance to reload seeds for
856
+ * @param vite - Vite dev server
857
+ * @param cwd - Project root directory
858
+ * @param options - Resolved plugin options
812
859
  */
813
- declare function debounce<T extends (...args: unknown[]) => unknown>(fn: T, delay: number): (...args: Parameters<T>) => void;
860
+ declare function reloadSpecSeeds(instance: SpecInstance, vite: ViteDevServer, cwd: string, options: ResolvedOptions): Promise<void>;
814
861
 
815
862
  /**
816
863
  * Vue DevTools Integration
@@ -893,4 +940,4 @@ declare function registerDevTools(app: App, options?: RegisterDevToolsOptions):
893
940
  */
894
941
  declare function getDevToolsUrl(port?: number, host?: string, protocol?: 'http' | 'https'): string;
895
942
 
896
- export { API_PROXY_PATH, DEVTOOLS_PROXY_PATH, type DeriveProxyPathResult, type FileWatcher, type FileWatcherOptions, type LoadHandlersResult, type LoadSeedsResult, type OpenApiServerOptions, type OrchestratorResult, type ProxyPathSource, type RegisterDevToolsOptions, type ResolvedOptions, type ResolvedSpecConfig, SPEC_COLORS, type SpecConfig, type SpecInstance, ValidationError, type ValidationErrorCode, WS_PROXY_PATH, configureMultiProxy, createFileWatcher, createOrchestrator, debounce, deriveProxyPath, deriveSpecId, getDevToolsUrl, getHandlerFiles, getSeedFiles, loadHandlers, loadSeeds, normalizeProxyPath, openApiServer, registerDevTools, resolveOptions, slugify, validateSpecs, validateUniqueIds, validateUniqueProxyPaths };
943
+ export { API_PROXY_PATH, DEVTOOLS_PROXY_PATH, type DebouncedFunction, type DeriveProxyPathResult, type FileWatcher, type FileWatcherOptions, type LoadHandlersResult, type LoadSeedsResult, type OpenApiServerOptions, type OrchestratorResult, type ProxyPathSource, type RegisterDevToolsOptions, type ResolvedOptions, type ResolvedSpecConfig, SPEC_COLORS, type SpecConfig, type SpecInstance, ValidationError, type ValidationErrorCode, WS_PROXY_PATH, configureMultiProxy, createFileWatcher, createOrchestrator, createPerSpecFileWatchers, debounce, deriveProxyPath, deriveSpecId, getDevToolsUrl, getHandlerFiles, getSeedFiles, loadHandlers, loadSeeds, normalizeProxyPath, openApiServer, registerDevTools, reloadSpecHandlers, reloadSpecSeeds, resolveOptions, slugify, validateSpecs, validateUniqueIds, validateUniqueProxyPaths };